CN116629245A - Nested entity identification method and device, electronic equipment and storage medium - Google Patents

Nested entity identification method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116629245A
CN116629245A CN202310613596.1A CN202310613596A CN116629245A CN 116629245 A CN116629245 A CN 116629245A CN 202310613596 A CN202310613596 A CN 202310613596A CN 116629245 A CN116629245 A CN 116629245A
Authority
CN
China
Prior art keywords
vector
entity
model
standard
loss function
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310613596.1A
Other languages
Chinese (zh)
Inventor
刘羲
舒畅
陈又新
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202310613596.1A priority Critical patent/CN116629245A/en
Publication of CN116629245A publication Critical patent/CN116629245A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02TCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
    • Y02T10/00Road transport of goods or passengers
    • Y02T10/10Internal combustion engine [ICE] based vehicles
    • Y02T10/40Engine management systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Machine Translation (AREA)

Abstract

The invention relates to a natural language processing technology used in the digital medical field, and discloses a nested entity identification method, which comprises the following steps: encoding the historical text data to obtain an encoded data vector, and splicing the encoded data vector and the position information of the historical text data into a spliced vector sequence; searching a final optimization vector corresponding to the spliced vector sequence, inputting the final optimization vector into an initial entity recognition model for embedded entity recognition, and obtaining an entity prediction result; and constructing a standard loss function according to the boundary feature vector of the two-dimensional vector boundary mapping and the entity prediction result, and carrying out model training on the initial entity model by using the standard loss function to obtain a standard entity recognition model and obtain an embedded entity corresponding to the sentence to be recognized. In addition, the present invention relates to blockchain technology, and the coded data vector can be stored in nodes of the blockchain. The invention also provides a nested entity identification device, electronic equipment and a storage medium. The invention can improve the accuracy of nested entity identification.

Description

Nested entity identification method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of digital medical technology, and in particular, to a method and apparatus for identifying nested entities, an electronic device, and a storage medium.
Background
Entity identification is widely applied to tasks such as information extraction, information retrieval, information recommendation and the like as an important step in a natural language processing process. The method can also be applied to the digital medical field for medical information extraction. Because of the diversity of natural language, nested entities exist in a large number of texts. The nested entity refers to the situation that an entity is integrally formed, and a plurality of simple entities are contained in the nested entity. In unstructured texts in some fields, the phenomenon of nested entities is common, but traditional entity recognition research does not make a targeted design on the nested entities, so that the accuracy of entity recognition is reduced. It is therefore desirable to propose a nested entity identification method with greater accuracy.
Disclosure of Invention
The invention provides a nested entity identification method, a nested entity identification device, electronic equipment and a storage medium, and mainly aims to improve the accuracy of nested entity identification.
In order to achieve the above object, the present invention provides a nested entity identification method, including:
Acquiring historical text data and position information of the historical text data, performing coding processing on the historical text data by utilizing a pre-training language model to obtain coded data vectors, and performing splicing processing on the coded data vectors and the position information of the historical text data to obtain a spliced vector sequence;
searching a final optimization vector corresponding to the spliced vector sequence by using a Hungary algorithm, and inputting the final optimization vector into an initial entity recognition model for embedded entity recognition to obtain an entity prediction result;
performing boundary mapping processing on the pre-acquired two-dimensional vector to obtain a boundary feature vector, constructing a standard loss function according to the boundary feature vector and the entity prediction result, and performing model training on the initial entity model by using a loss function value obtained by the standard loss function to obtain a standard entity recognition model;
and inputting the sentences to be identified into the standard entity identification model to obtain the embedded entities corresponding to the sentences to be identified.
Optionally, the splicing processing is performed on the encoded data vector and the position information of the historical text data to obtain a spliced vector sequence, which includes:
Combining the position information of the coded data vector and the historical text data into data information, and combining a predefined learning vector and the position information of the learning vector into learning information;
and performing splicing and unfolding processing on the data information and the learning information to obtain a spliced vector sequence.
Optionally, the performing a stitching and unfolding process on the data information and the learning information to obtain a stitching vector sequence includes:
multiplying the coded data vector in the data information with the learning vector in the learning information to obtain a first splicing sequence;
multiplying the position information of the historical text data in the data information with the position information of the learning vector in the learning information to obtain a second splicing sequence;
and carrying out summation calculation on the first splicing sequence and the second splicing sequence to obtain a splicing vector sequence.
Optionally, inputting the final optimization vector into an initial entity recognition model to perform embedded entity recognition, to obtain an entity prediction result, including:
carrying out probability prediction on the final optimization vector by using the initial entity identification model to obtain entity type probability;
Determining a predicted entity tag corresponding to the final optimization vector according to the entity type probability, and performing type prediction on the predicted entity tag by using a preset tag prediction algorithm to obtain the entity type of the historical text data;
and taking the entity type of the historical text data as an entity prediction result.
Optionally, the performing boundary mapping processing on the pre-acquired two-dimensional vector to obtain a boundary feature vector includes:
identifying the dimension size corresponding to the position information of the historical text data, and mapping the two-dimensional vector to the dimension which is the same as the dimension size to obtain a conversion vector;
and carrying out dot product calculation on the conversion vector and the coded data vector, carrying out summation processing on the result of the dot product calculation and the position information of the learning vector, and carrying out offset mapping on the result obtained by the summation processing to obtain a boundary feature vector.
Optionally, the constructing a standard loss function according to the boundary feature vector and the entity prediction result includes:
performing difference calculation on the entity prediction result and a preset entity real result to obtain a difference part;
and acquiring preset reference weights, carrying out weight distribution on the difference value part and the boundary feature vector, and generating a standard loss function according to the distributed weights.
Optionally, the model training is performed on the initial entity model by using the loss function value obtained by the standard loss function to obtain a standard entity identification model, including:
comparing the loss function value obtained by the standard loss function with a preset loss threshold value;
when the loss function value is smaller than or equal to the preset loss threshold value, outputting the initial entity model as a standard entity identification model;
and when the loss function value is larger than the preset loss threshold value, carrying out parameter adjustment on the initial entity model until the initial entity model subjected to parameter adjustment meets the preset requirement, and outputting the model subjected to parameter adjustment as a standard entity identification model.
In order to solve the above problems, the present invention also provides a nested entity recognition apparatus, the apparatus comprising:
the vector splicing module is used for acquiring historical text data and position information of the historical text data, carrying out coding processing on the historical text data by utilizing a pre-training language model to obtain coded data vectors, and carrying out splicing processing on the coded data vectors and the position information of the historical text data to obtain a spliced vector sequence;
The entity recognition module is used for searching a final optimization vector corresponding to the spliced vector sequence by using a Hungary algorithm, inputting the final optimization vector into an initial entity recognition model for embedded entity recognition, and obtaining an entity prediction result;
the function construction module is used for carrying out boundary mapping processing on the pre-acquired two-dimensional vector to obtain a boundary feature vector, constructing a standard loss function according to the boundary feature vector and the entity prediction result, and carrying out model training on the initial entity model by utilizing the loss function value obtained by the standard loss function to obtain a standard entity recognition model;
and the model application module is used for inputting sentences to be identified into the standard entity identification model to obtain embedded entities corresponding to the sentences to be identified.
In order to solve the above-mentioned problems, the present invention also provides an electronic apparatus including:
at least one processor; the method comprises the steps of,
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the nested entity identification method described above.
In order to solve the above-mentioned problems, the present invention also provides a storage medium having stored therein at least one computer program that is executed by a processor in an electronic device to implement the above-mentioned nested entity identification method.
In the embodiment of the invention, the spliced vector sequence is obtained by splicing the coded data vector after the historical text data coding processing and the position information of the historical text data, the position information is added, and the model convergence speed is improved by the splicing processing. And carrying out boundary mapping processing on the pre-acquired two-dimensional vector to obtain a boundary feature vector, constructing a standard loss function according to the boundary feature vector and the entity prediction result, adding the two-dimensional vector into the loss function to relieve model trouble caused by information interaction, carrying out model training on the initial entity model by using the loss function value obtained by the standard loss function to obtain a standard entity recognition model, and using the standard entity recognition model to obtain a sentence to be recognized with higher recognition accuracy. Therefore, the nested entity identification method, the nested entity identification device, the electronic equipment and the storage medium can solve the problem of low accuracy of improving nested entity identification.
Drawings
FIG. 1 is a flow chart of a method for identifying nested entities according to an embodiment of the present application;
FIG. 2 is a detailed flow chart of one of the steps shown in FIG. 1;
FIG. 3 is a functional block diagram of a nested entity identification device according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device for implementing the nested entity identification method according to an embodiment of the present application.
The achievement of the objects, functional features and advantages of the present application will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The embodiment of the application provides a nested entity identification method. The execution subject of the nested entity identification method includes, but is not limited to, at least one of a server, a terminal, and the like, which can be configured to execute the method provided by the embodiment of the application. In other words, the nested entity identification method may be performed by software or hardware installed in a terminal device or a server device, and the software may be a blockchain platform. The service end includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like. The server may be an independent server, or may be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (ContentDelivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms.
Referring to fig. 1, a flow chart of a method for identifying nested entities according to an embodiment of the present invention is shown. In this embodiment, the nested entity identification method includes the following steps S1-S4:
s1, acquiring historical text data and position information of the historical text data, performing coding processing on the historical text data by utilizing a pre-training language model to obtain coded data vectors, and performing splicing processing on the coded data vectors and the position information of the historical text data to obtain a spliced vector sequence.
In the embodiment of the invention, the historical text data refers to the text containing the entity in any field, and can be sentences or text paragraphs. The location information of the history text data refers to the actual location of the history text data in a certain article or a certain paragraph.
Wherein, any field in the scheme is a digital medical field, and the historical text data can be an article or a paragraph in any medical reference book in the digital medical field, for example, the medical reference book can be medical imaging.
Specifically, the historical text data is encoded with a pre-trained language model, which may be a BERT (Bidirectional Encoder Representations from Transformer, bi-directional encoder characterization) model or an ELMO (Embedding from language models, bi-directional language model) model, to obtain encoded data vectors.
Further, the splicing processing is performed on the position information of the encoded data vector and the historical text data to obtain a spliced vector sequence, which includes:
combining the position information of the coded data vector and the historical text data into data information, and combining a predefined learning vector and the position information of the learning vector into learning information;
and performing splicing and unfolding processing on the data information and the learning information to obtain a spliced vector sequence.
In detail, the encoded data vector is H content The position information of the historical text data is P postion The predefined learning vector is H learned The position information of the learning vector is P learned . Combining the encoded data vector and the position information of the history text data into data information [ H ] content ,P postion ]Combining a predefined learning vector and the position information of the learning vector into learning information H learned ,P learned ]。
Specifically, the performing a stitching and unfolding process on the data information and the learning information to obtain a stitching vector sequence includes:
multiplying the coded data vector in the data information with the learning vector in the learning information to obtain a first splicing sequence;
Multiplying the position information of the historical text data in the data information with the position information of the learning vector in the learning information to obtain a second splicing sequence;
and carrying out summation calculation on the first splicing sequence and the second splicing sequence to obtain a splicing vector sequence.
In detail, the coded data vector H in the data information is used for content And a learning vector H in the learning information learned Multiplying to obtain a first spliced sequence H content H learned Position information P of the history text data in the data information postion And the position of the learning vector in the learning informationInformation P learned Multiplying to obtain a second spliced sequence P postion P learned . Summing the first splicing sequence and the second splicing sequence to obtain a splicing vector sequence H content H learned +P postion P learned
Preferably, a valuable span mode is learned by using a predefined learning vector instead of presetting a candidate span, position information is added into the predefined learning vector, and information is spliced by adopting a splicing method, so that model trouble caused by direct information interaction can be relieved, and the reduction of convergence rate is avoided.
S2, searching a final optimization vector corresponding to the spliced vector sequence by using a Hungary algorithm, and inputting the final optimization vector into an initial entity recognition model for embedded entity recognition to obtain an entity prediction result.
In the embodiment of the invention, the Hungary algorithm is a combined optimization algorithm for solving the task allocation problem in polynomial time, and the Hungary algorithm is utilized to search a final optimization vector corresponding to the spliced vector sequence before model training, and the final optimization vector is used as input data of model training.
Specifically, the inputting the final optimization vector into an initial entity recognition model for embedding entity recognition to obtain an entity prediction result includes:
carrying out probability prediction on the final optimization vector by using the initial entity identification model to obtain entity type probability;
determining a predicted entity tag corresponding to the final optimization vector according to the entity type probability, and performing type prediction on the predicted entity tag by using a preset tag prediction algorithm to obtain the entity type of the historical text data;
and taking the entity type of the historical text data as an entity prediction result.
In detail, the initial entity recognition model may be a two-way long-short term memory network, and the tag prediction algorithm may be a viterbi algorithm. Wherein the viterbi algorithm is a dynamic programming algorithm for finding the-viterbi path-hidden state sequence most likely to produce the sequence of observation events.
S3, performing boundary mapping processing on the pre-acquired two-dimensional vector to obtain a boundary feature vector, constructing a standard loss function according to the boundary feature vector and the entity prediction result, and performing model training on the initial entity model by using a loss function value obtained by the standard loss function to obtain a standard entity recognition model.
In the embodiment of the invention, the pre-acquired two-dimensional vector is alpha, wherein the two-dimensional vector alpha is used for representing the left and right boundary characteristics in the process of detecting the entity boundary, helping the model to identify the detection boundary and improving the model effect.
Specifically, the performing boundary mapping processing on the pre-acquired two-dimensional vector to obtain a boundary feature vector includes:
identifying the dimension size corresponding to the position information of the historical text data, and mapping the two-dimensional vector to the dimension which is the same as the dimension size to obtain a conversion vector;
And carrying out dot product calculation on the conversion vector and the coded data vector, carrying out summation processing on the result of the dot product calculation and the position information of the learning vector, and carrying out offset mapping on the result obtained by the summation processing to obtain a boundary feature vector.
In detail, the two-dimensional vector α is mapped to the position information P where the learning vector is located learned In the same dimension, considering that text information needs to be combined for judging entity boundaries, dot product calculation is performed on the conversion vector and the coded data vector, and summation processing is performed on the result of the dot product calculation and the position information where the learning vector is located. And carrying out offset mapping on the result obtained by the summation processing to obtain a boundary feature vector.
The boundary feature vector may be represented as b=ffn (f) +s, where s is an offset learned by performing offset mapping, and FFN (f) is a result of the sum processing.
Further, the constructing a standard loss function according to the boundary feature vector and the entity prediction result includes:
performing difference calculation on the entity prediction result and a preset entity real result to obtain a difference part;
and acquiring preset reference weights, carrying out weight distribution on the difference value part and the boundary feature vector, and generating a standard loss function according to the distributed weights.
In detail, the standard loss function includes three aspects, namely, distinction between an entity prediction result and an entity true result, and the boundary feature vector represents a left boundary and a right boundary.
Specifically, the model training is performed on the initial entity model by using the loss function value obtained by the standard loss function to obtain a standard entity identification model, including:
comparing the loss function value obtained by the standard loss function with a preset loss threshold value;
when the loss function value is smaller than or equal to the preset loss threshold value, outputting the initial entity model as a standard entity identification model;
and when the loss function value is larger than the preset loss threshold value, carrying out parameter adjustment on the initial entity model until the initial entity model subjected to parameter adjustment meets the preset requirement, and outputting the model subjected to parameter adjustment as a standard entity identification model.
In detail, the preset requirement refers to a condition that a loss function value obtained by satisfying a standard loss function is less than or equal to a preset loss threshold value.
Preferably, the scheme starts from a cross attention calculation formula, discovers the problem of slow model fitting, provides a new parameter interaction mode, accelerates model convergence, and aims at newly adding a group of two-dimensional left and right boundary feature vectors from original learnable parameters aiming at text data, so as to help the model to identify detection boundaries and improve model effects.
S4, inputting the sentences to be identified into the standard entity identification model to obtain the embedded entities corresponding to the sentences to be identified.
In the embodiment of the invention, the standard entity recognition model has higher embedded entity recognition capability, so that sentences to be recognized are input into the standard entity recognition model to obtain the embedded entities corresponding to the sentences to be recognized.
In the embodiment of the invention, the spliced vector sequence is obtained by splicing the coded data vector after the historical text data coding processing and the position information of the historical text data, the position information is added, and the model convergence speed is improved by the splicing processing. And carrying out boundary mapping processing on the pre-acquired two-dimensional vector to obtain a boundary feature vector, constructing a standard loss function according to the boundary feature vector and the entity prediction result, adding the two-dimensional vector into the loss function to relieve model trouble caused by information interaction, carrying out model training on the initial entity model by using the loss function value obtained by the standard loss function to obtain a standard entity recognition model, and using the standard entity recognition model to obtain a sentence to be recognized with higher recognition accuracy. Therefore, the nested entity identification method provided by the invention can solve the problem of low accuracy of improving the nested entity identification.
Fig. 3 is a functional block diagram of a nested entity recognition device according to an embodiment of the present invention.
The nested entity identification apparatus 100 of the present invention may be installed in an electronic device. Depending on the implemented functions, the nested entity recognition device 100 may include a vector stitching module 101, an entity recognition module 102, a function building module 103, and a model application module 104. The module of the invention, which may also be referred to as a unit, refers to a series of computer program segments, which are stored in the memory of the electronic device, capable of being executed by the processor of the electronic device and of performing a fixed function.
In the present embodiment, the functions concerning the respective modules/units are as follows:
the vector splicing module 101 is configured to obtain historical text data and location information of the historical text data, encode the historical text data by using a pre-training language model to obtain an encoded data vector, and splice the encoded data vector and the location information of the historical text data to obtain a spliced vector sequence;
the entity recognition module 102 is configured to search a final optimization vector corresponding to the spliced vector sequence by using a hungarian algorithm, input the final optimization vector into an initial entity recognition model, and perform embedded entity recognition to obtain an entity prediction result;
The function construction module 103 is configured to perform boundary mapping on the pre-acquired two-dimensional vector to obtain a boundary feature vector, construct a standard loss function according to the boundary feature vector and the entity prediction result, and perform model training on the initial entity model by using a loss function value obtained by the standard loss function to obtain a standard entity recognition model;
the model application module 104 is configured to input a sentence to be identified into the standard entity identification model, so as to obtain an embedded entity corresponding to the sentence to be identified.
In detail, the specific embodiments of the modules of the nested entity identifying device 100 are as follows:
step one, acquiring historical text data and position information of the historical text data, performing coding processing on the historical text data by utilizing a pre-training language model to obtain coded data vectors, and performing splicing processing on the coded data vectors and the position information of the historical text data to obtain a spliced vector sequence.
In the embodiment of the invention, the historical text data refers to the text containing the entity in any field, and can be sentences or text paragraphs. The location information of the history text data refers to the actual location of the history text data in a certain article or a certain paragraph.
Wherein, any field in the scheme is a digital medical field, and the historical text data can be an article or a paragraph in any medical reference book in the digital medical field, for example, the medical reference book can be medical imaging.
Specifically, the historical text data is encoded with a pre-trained language model, which may be a BERT (Bidirectional Encoder Representations from Transformer, bi-directional encoder characterization) model or an ELMO (Embedding from language models, bi-directional language model) model, to obtain encoded data vectors.
Further, the splicing processing is performed on the position information of the encoded data vector and the historical text data to obtain a spliced vector sequence, which includes:
combining the position information of the coded data vector and the historical text data into data information, and combining a predefined learning vector and the position information of the learning vector into learning information;
and performing splicing and unfolding processing on the data information and the learning information to obtain a spliced vector sequence.
In detail, the encoded data vector is H content The position information of the historical text data is P postion The predefined learning vector is H learned The position information of the learning vector is P learned . Combining the encoded data vector and the position information of the history text data into data information [ H ] content ,P postion ]Combining a predefined learning vector and the position information of the learning vector into learning information H learned ,P learned ]。
Specifically, the performing a stitching and unfolding process on the data information and the learning information to obtain a stitching vector sequence includes:
multiplying the coded data vector in the data information with the learning vector in the learning information to obtain a first splicing sequence;
multiplying the position information of the historical text data in the data information with the position information of the learning vector in the learning information to obtain a second splicing sequence;
and carrying out summation calculation on the first splicing sequence and the second splicing sequence to obtain a splicing vector sequence.
In detail, the coded data vector H in the data information is used for content And a learning vector H in the learning information learned Multiplying to obtain a first spliced sequence Hc ontent H learned Position information P of the history text data in the data information postion And position information P of the learning vector in the learning information learned Multiplying to obtain a second spliced sequence P postion P learned . Summing the first splicing sequence and the second splicing sequence to obtain a splicing vector sequence H content H learned +P postion P learned
Preferably, a valuable span mode is learned by using a predefined learning vector instead of presetting a candidate span, position information is added into the predefined learning vector, and information is spliced by adopting a splicing method, so that model trouble caused by direct information interaction can be relieved, and the reduction of convergence rate is avoided.
And secondly, searching a final optimization vector corresponding to the spliced vector sequence by using a Hungary algorithm, and inputting the final optimization vector into an initial entity recognition model for embedded entity recognition to obtain an entity prediction result.
In the embodiment of the invention, the Hungary algorithm is a combined optimization algorithm for solving the task allocation problem in polynomial time, and the Hungary algorithm is utilized to search a final optimization vector corresponding to the spliced vector sequence before model training, and the final optimization vector is used as input data of model training.
Specifically, the inputting the final optimization vector into an initial entity recognition model for embedding entity recognition to obtain an entity prediction result includes:
carrying out probability prediction on the final optimization vector by using the initial entity identification model to obtain entity type probability;
determining a predicted entity tag corresponding to the final optimization vector according to the entity type probability, and performing type prediction on the predicted entity tag by using a preset tag prediction algorithm to obtain the entity type of the historical text data;
and taking the entity type of the historical text data as an entity prediction result.
In detail, the initial entity recognition model may be a two-way long-short term memory network, and the tag prediction algorithm may be a viterbi algorithm. Wherein the viterbi algorithm is a dynamic programming algorithm for finding the-viterbi path-hidden state sequence most likely to produce the sequence of observation events.
And thirdly, performing boundary mapping processing on the pre-acquired two-dimensional vector to obtain a boundary feature vector, constructing a standard loss function according to the boundary feature vector and the entity prediction result, and performing model training on the initial entity model by using a loss function value obtained by the standard loss function to obtain a standard entity recognition model.
In the embodiment of the invention, the pre-acquired two-dimensional vector is alpha, wherein the two-dimensional vector alpha is used for representing the left and right boundary characteristics in the process of detecting the entity boundary, helping the model to identify the detection boundary and improving the model effect.
Specifically, the performing boundary mapping processing on the pre-acquired two-dimensional vector to obtain a boundary feature vector includes:
identifying the dimension size corresponding to the position information of the historical text data, and mapping the two-dimensional vector to the dimension which is the same as the dimension size to obtain a conversion vector;
and carrying out dot product calculation on the conversion vector and the coded data vector, carrying out summation processing on the result of the dot product calculation and the position information of the learning vector, and carrying out offset mapping on the result obtained by the summation processing to obtain a boundary feature vector.
In detail, the two-dimensional vector α is mapped to the position information P where the learning vector is located learned In the same dimension, and considering that text information needs to be combined to judge entity boundaries, the conversion vector is converted intoAnd carrying out dot product calculation on the code data vector, and carrying out summation processing on the result of the dot product calculation and the position information of the learning vector. And carrying out offset mapping on the result obtained by the summation processing to obtain a boundary feature vector.
The boundary feature vector may be represented as b=ffn (f) +s, where s is an offset learned by performing offset mapping, and FFN (f) is a result of the sum processing.
Further, the constructing a standard loss function according to the boundary feature vector and the entity prediction result includes:
performing difference calculation on the entity prediction result and a preset entity real result to obtain a difference part;
and acquiring preset reference weights, carrying out weight distribution on the difference value part and the boundary feature vector, and generating a standard loss function according to the distributed weights.
In detail, the standard loss function includes three aspects, namely, distinction between an entity prediction result and an entity true result, and the boundary feature vector represents a left boundary and a right boundary.
Specifically, the model training is performed on the initial entity model by using the loss function value obtained by the standard loss function to obtain a standard entity identification model, including:
comparing the loss function value obtained by the standard loss function with a preset loss threshold value;
when the loss function value is smaller than or equal to the preset loss threshold value, outputting the initial entity model as a standard entity identification model;
And when the loss function value is larger than the preset loss threshold value, carrying out parameter adjustment on the initial entity model until the initial entity model subjected to parameter adjustment meets the preset requirement, and outputting the model subjected to parameter adjustment as a standard entity identification model.
In detail, the preset requirement refers to a condition that a loss function value obtained by satisfying a standard loss function is less than or equal to a preset loss threshold value.
Preferably, the scheme starts from a cross attention calculation formula, discovers the problem of slow model fitting, provides a new parameter interaction mode, accelerates model convergence, and aims at newly adding a group of two-dimensional left and right boundary feature vectors from original learnable parameters aiming at text data, so as to help the model to identify detection boundaries and improve model effects.
And step four, inputting sentences to be identified into the standard entity identification model to obtain embedded entities corresponding to the sentences to be identified.
In the embodiment of the invention, the standard entity recognition model has higher embedded entity recognition capability, so that sentences to be recognized are input into the standard entity recognition model to obtain the embedded entities corresponding to the sentences to be recognized.
In the embodiment of the invention, the spliced vector sequence is obtained by splicing the coded data vector after the historical text data coding processing and the position information of the historical text data, the position information is added, and the model convergence speed is improved by the splicing processing. And carrying out boundary mapping processing on the pre-acquired two-dimensional vector to obtain a boundary feature vector, constructing a standard loss function according to the boundary feature vector and the entity prediction result, adding the two-dimensional vector into the loss function to relieve model trouble caused by information interaction, carrying out model training on the initial entity model by using the loss function value obtained by the standard loss function to obtain a standard entity recognition model, and using the standard entity recognition model to obtain a sentence to be recognized with higher recognition accuracy. Therefore, the nested entity recognition device provided by the invention can solve the problem of low accuracy of improving the nested entity recognition.
Fig. 4 is a schematic structural diagram of an electronic device for implementing a nested entity identification method according to an embodiment of the present invention.
The electronic device 1 may comprise a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may further comprise a computer program, such as a nested entity identification program, stored in the memory 11 and executable on the processor 10.
The processor 10 may be formed by an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or may be formed by a plurality of integrated circuits packaged with the same function or different functions, including one or more central processing units (Central Processing Unit, CPU), a microprocessor, a digital processing chip, a graphics processor, a combination of various control chips, and so on. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the entire electronic device using various interfaces and lines, and executes various functions of the electronic device and processes data by running or executing programs or modules (e.g., executing a nested entity recognition program, etc.) stored in the memory 11, and calling data stored in the memory 11.
The memory 11 includes at least one type of readable storage medium including flash memory, a removable hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device, such as a mobile hard disk of the electronic device. The memory 11 may in other embodiments also be an external storage device of the electronic device, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the electronic device. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device. The memory 11 may be used not only for storing application software installed in an electronic device and various data, such as code of a nested entity identification program, but also for temporarily storing data that has been output or is to be output.
The communication bus 12 may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus, or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, among others. The bus may be classified as an address bus, a data bus, a control bus, etc. The bus is arranged to enable a connection communication between the memory 11 and at least one processor 10 etc.
The communication interface 13 is used for communication between the electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), typically used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a Display (Display), an input unit such as a Keyboard (Keyboard), or alternatively a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch, or the like. The display may also be referred to as a display screen or display unit, as appropriate, for displaying information processed in the electronic device and for displaying a visual user interface.
Fig. 4 shows only an electronic device with components, it being understood by a person skilled in the art that the structure shown in fig. 4 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than shown, or may combine certain components, or may be arranged in different components.
For example, although not shown, the electronic device may further include a power source (such as a battery) for supplying power to the respective components, and preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that functions of charge management, discharge management, power consumption management, and the like are implemented through the power management device. The power supply may also include one or more of any of a direct current or alternating current power supply, recharging device, power failure detection circuit, power converter or inverter, power status indicator, etc. The electronic device may further include various sensors, bluetooth modules, wi-Fi modules, etc., which are not described herein.
It should be understood that the embodiments described are for illustrative purposes only and are not limited to this configuration in the scope of the patent application.
The nested entity identification program stored in the memory 11 of the electronic device 1 is a combination of instructions which, when executed in the processor 10, may implement:
Acquiring historical text data and position information of the historical text data, performing coding processing on the historical text data by utilizing a pre-training language model to obtain coded data vectors, and performing splicing processing on the coded data vectors and the position information of the historical text data to obtain a spliced vector sequence;
searching a final optimization vector corresponding to the spliced vector sequence by using a Hungary algorithm, and inputting the final optimization vector into an initial entity recognition model for embedded entity recognition to obtain an entity prediction result;
performing boundary mapping processing on the pre-acquired two-dimensional vector to obtain a boundary feature vector, constructing a standard loss function according to the boundary feature vector and the entity prediction result, and performing model training on the initial entity model by using a loss function value obtained by the standard loss function to obtain a standard entity recognition model;
and inputting the sentences to be identified into the standard entity identification model to obtain the embedded entities corresponding to the sentences to be identified.
In particular, the specific implementation method of the above instructions by the processor 10 may refer to the description of the relevant steps in the corresponding embodiment of the drawings, which is not repeated herein.
Further, the modules/units integrated in the electronic device 1 may be stored in a storage medium if implemented in the form of software functional units and sold or used as separate products. The storage medium may be volatile or nonvolatile. For example, the computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM).
The present invention also provides a storage medium storing a computer program which, when executed by a processor of an electronic device, can implement:
acquiring historical text data and position information of the historical text data, performing coding processing on the historical text data by utilizing a pre-training language model to obtain coded data vectors, and performing splicing processing on the coded data vectors and the position information of the historical text data to obtain a spliced vector sequence;
searching a final optimization vector corresponding to the spliced vector sequence by using a Hungary algorithm, and inputting the final optimization vector into an initial entity recognition model for embedded entity recognition to obtain an entity prediction result;
Performing boundary mapping processing on the pre-acquired two-dimensional vector to obtain a boundary feature vector, constructing a standard loss function according to the boundary feature vector and the entity prediction result, and performing model training on the initial entity model by using a loss function value obtained by the standard loss function to obtain a standard entity recognition model;
and inputting the sentences to be identified into the standard entity identification model to obtain the embedded entities corresponding to the sentences to be identified.
In the several embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be other manners of division when actually implemented.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units can be realized in a form of hardware or a form of hardware and a form of software functional modules.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof.
The present embodiments are, therefore, to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The Blockchain (Blockchain), which is essentially a decentralised database, is a string of data blocks that are generated by cryptographic means in association, each data block containing a batch of information of network transactions for verifying the validity of the information (anti-counterfeiting) and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
The embodiment of the application can acquire and process the related data based on the artificial intelligence technology. Among these, artificial intelligence (Artificial Intelligence, AI) is the theory, method, technique and application system that uses a digital computer or a digital computer-controlled machine to simulate, extend and extend human intelligence, sense the environment, acquire knowledge and use knowledge to obtain optimal results.
Furthermore, it is evident that the word "comprising" does not exclude other elements or steps, and that the singular does not exclude a plurality. A plurality of units or means recited in the system claims can also be implemented by means of software or hardware by means of one unit or means. The terms first, second, etc. are used to denote a name, but not any particular order.
Finally, it should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present application and not for limiting the same, and although the present application has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made to the technical solution of the present application without departing from the spirit and scope of the technical solution of the present application.

Claims (10)

1. A method of nested entity identification, the method comprising:
Acquiring historical text data and position information of the historical text data, performing coding processing on the historical text data by utilizing a pre-training language model to obtain coded data vectors, and performing splicing processing on the coded data vectors and the position information of the historical text data to obtain a spliced vector sequence;
searching a final optimization vector corresponding to the spliced vector sequence by using a Hungary algorithm, and inputting the final optimization vector into an initial entity recognition model for embedded entity recognition to obtain an entity prediction result;
performing boundary mapping processing on the pre-acquired two-dimensional vector to obtain a boundary feature vector, constructing a standard loss function according to the boundary feature vector and the entity prediction result, and performing model training on the initial entity model by using a loss function value obtained by the standard loss function to obtain a standard entity recognition model;
and inputting the sentences to be identified into the standard entity identification model to obtain the embedded entities corresponding to the sentences to be identified.
2. The nested entity identification method of claim 1, wherein the performing a concatenation process on the encoded data vector and the position information of the historical text data to obtain a concatenation vector sequence includes:
Combining the position information of the coded data vector and the historical text data into data information, and combining a predefined learning vector and the position information of the learning vector into learning information;
and performing splicing and unfolding processing on the data information and the learning information to obtain a spliced vector sequence.
3. The nested entity identification method of claim 2, wherein the performing a splice expansion process on the data information and the learning information to obtain a spliced vector sequence comprises:
multiplying the coded data vector in the data information with the learning vector in the learning information to obtain a first splicing sequence;
multiplying the position information of the historical text data in the data information with the position information of the learning vector in the learning information to obtain a second splicing sequence;
and carrying out summation calculation on the first splicing sequence and the second splicing sequence to obtain a splicing vector sequence.
4. The method for identifying nested entities according to claim 1, wherein the step of inputting the final optimization vector into an initial entity identification model to perform embedded entity identification to obtain an entity prediction result comprises:
Carrying out probability prediction on the final optimization vector by using the initial entity identification model to obtain entity type probability;
determining a predicted entity tag corresponding to the final optimization vector according to the entity type probability, and performing type prediction on the predicted entity tag by using a preset tag prediction algorithm to obtain the entity type of the historical text data;
and taking the entity type of the historical text data as an entity prediction result.
5. The method for identifying nested entities according to claim 1, wherein the performing a boundary mapping process on the pre-acquired two-dimensional vector to obtain a boundary feature vector comprises:
identifying the dimension size corresponding to the position information of the historical text data, and mapping the two-dimensional vector to the dimension which is the same as the dimension size to obtain a conversion vector;
and carrying out dot product calculation on the conversion vector and the coded data vector, carrying out summation processing on the result of the dot product calculation and the position information of the learning vector, and carrying out offset mapping on the result obtained by the summation processing to obtain a boundary feature vector.
6. The nested entity identification method of claim 1 wherein said constructing a standard loss function from said boundary feature vector and said entity prediction result comprises:
Performing difference calculation on the entity prediction result and a preset entity real result to obtain a difference part;
and acquiring preset reference weights, carrying out weight distribution on the difference value part and the boundary feature vector, and generating a standard loss function according to the distributed weights.
7. The nested entity identification method of claim 1 wherein the model training the initial entity model using the loss function value obtained by the standard loss function to obtain a standard entity identification model comprises:
comparing the loss function value obtained by the standard loss function with a preset loss threshold value;
when the loss function value is smaller than or equal to the preset loss threshold value, outputting the initial entity model as a standard entity identification model;
and when the loss function value is larger than the preset loss threshold value, carrying out parameter adjustment on the initial entity model until the initial entity model subjected to parameter adjustment meets the preset requirement, and outputting the model subjected to parameter adjustment as a standard entity identification model.
8. A nested entity identification device, the device comprising:
the vector splicing module is used for acquiring historical text data and position information of the historical text data, carrying out coding processing on the historical text data by utilizing a pre-training language model to obtain coded data vectors, and carrying out splicing processing on the coded data vectors and the position information of the historical text data to obtain a spliced vector sequence;
The entity recognition module is used for searching a final optimization vector corresponding to the spliced vector sequence by using a Hungary algorithm, inputting the final optimization vector into an initial entity recognition model for embedded entity recognition, and obtaining an entity prediction result;
the function construction module is used for carrying out boundary mapping processing on the pre-acquired two-dimensional vector to obtain a boundary feature vector, constructing a standard loss function according to the boundary feature vector and the entity prediction result, and carrying out model training on the initial entity model by utilizing the loss function value obtained by the standard loss function to obtain a standard entity recognition model;
and the model application module is used for inputting sentences to be identified into the standard entity identification model to obtain embedded entities corresponding to the sentences to be identified.
9. An electronic device, the electronic device comprising:
at least one processor; the method comprises the steps of,
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the nested entity identification method of any of claims 1 to 7.
10. A storage medium storing a computer program which, when executed by a processor, implements the nested entity identification method of any one of claims 1 to 7.
CN202310613596.1A 2023-05-26 2023-05-26 Nested entity identification method and device, electronic equipment and storage medium Pending CN116629245A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310613596.1A CN116629245A (en) 2023-05-26 2023-05-26 Nested entity identification method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310613596.1A CN116629245A (en) 2023-05-26 2023-05-26 Nested entity identification method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116629245A true CN116629245A (en) 2023-08-22

Family

ID=87609484

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310613596.1A Pending CN116629245A (en) 2023-05-26 2023-05-26 Nested entity identification method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116629245A (en)

Similar Documents

Publication Publication Date Title
CN112667800A (en) Keyword generation method and device, electronic equipment and computer storage medium
CN114822812B (en) Role dialogue simulation method, device, equipment and storage medium
CN113821622B (en) Answer retrieval method and device based on artificial intelligence, electronic equipment and medium
CN113378970B (en) Sentence similarity detection method and device, electronic equipment and storage medium
CN115238670B (en) Information text extraction method, device, equipment and storage medium
CN114880449B (en) Method and device for generating answers of intelligent questions and answers, electronic equipment and storage medium
CN116450829A (en) Medical text classification method, device, equipment and medium
CN116383766A (en) Auxiliary diagnosis method, device, equipment and storage medium based on multi-mode data
CN116821373A (en) Map-based prompt recommendation method, device, equipment and medium
CN114138243A (en) Function calling method, device, equipment and storage medium based on development platform
CN113342940A (en) Text matching analysis method and device, electronic equipment and storage medium
CN116630712A (en) Information classification method and device based on modal combination, electronic equipment and medium
CN116702761A (en) Text error correction method, device, equipment and storage medium
CN114548114B (en) Text emotion recognition method, device, equipment and storage medium
CN116341646A (en) Pretraining method and device of Bert model, electronic equipment and storage medium
CN115346095A (en) Visual question answering method, device, equipment and storage medium
CN111414452B (en) Search word matching method and device, electronic equipment and readable storage medium
CN116629245A (en) Nested entity identification method and device, electronic equipment and storage medium
CN113887201A (en) Text fixed-length error correction method, device, equipment and storage medium
CN113705692A (en) Emotion classification method and device based on artificial intelligence, electronic equipment and medium
CN112749264A (en) Problem distribution method and device based on intelligent robot, electronic equipment and storage medium
CN115221875B (en) Word weight generation method, device, electronic equipment and storage medium
CN116578690B (en) Insurance customer service method and system based on artificial intelligence
CN115204120B (en) Insurance field triplet extraction method and device, electronic equipment and storage medium
CN113157865B (en) Cross-language word vector generation method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination