Named entity recognition method, device, medium and electronic device

By using the target dictionary and entity recognition model in named entity recognition combined with graph convolutional neural network, the accuracy of nested named entity recognition in complex text is solved, and the recognition accuracy and applicability are improved.

CN114385784BActive Publication Date: 2024-12-24SHENYANG NEUSOFT INTELLIGENT MEDICAL TECH RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111590632.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-23
Publication Date
2024-12-24
Estimated Expiration
2041-12-23

AI Technical Summary

Technical Problem

The prior art is difficult to accurately identify nested named entities in complex unstructured medical texts, especially when multiple nested entities exist, resulting in insufficient recognition accuracy and accuracy.

Method used

By obtaining the text to be recognized, using the target dictionary for word recognition, generating word vectors, and using the entity recognition model combined with the graph convolutional neural network and multi-classification model to determine the named entity and its type. The training sample contains nested named entity text and Label information to improve the recognition ability of nested entities.

Benefits of technology

It realizes accurate recognition in nested entity text, improves the accuracy and accuracy of named entity recognition, and is suitable for recognition scenarios of complex expressing texts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114385784B_ABST
    Figure CN114385784B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a method, device, medium and electronic device for named entity recognition, wherein the method comprises: obtaining a target text to be recognized; performing word recognition on the target text according to a target dictionary to obtain a word set corresponding to the target text, wherein the word set includes at least one word in the target text; determining a word vector corresponding to each word in the target text; determining a named entity in the target text and a type corresponding to each named entity according to an entity recognition model and the word vector corresponding to each word, wherein the training sample of the entity recognition model includes a nested named entity text and annotation information of multiple named entities corresponding to the nested named entity text. Thus, multiple named entities existing in the target text can be accurately recognized, and the accuracy and precision of nested entity text recognition can be ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing, and in particular, to a method, device, medium and electronic device for named entity recognition. Background Art

[0002] The main purpose of the named entity recognition task is to extract elements that may be entities from a text. As an important subtask of information extraction, many scholars have used a variety of technologies to conduct in-depth research in various fields in recent years. In the medical field, extracting named entities from unstructured or semi-structured medical texts and then constructing a medical knowledge graph can serve downstream subtasks. Unstructured medical texts, such as the chief complaint, current medical history, and examination findings in electronic medical records, are usually composed of Chinese natural language sentences or sentence sets. However, the expressions in the above texts are usually complex, and there may be multiple entities or nested entities in a short text expression.

[0003] In the related art, entity recognition tasks are usually solved as sequence labeling tasks. For example, for a text, each character in the text can be labeled with a label to indicate the entity category of the character. However, when the text to be recognized contains multiple nested entities, it is difficult to accurately recognize the multiple nested entities in the above manner. Summary of the invention

[0004] The purpose of the present disclosure is to provide a named entity recognition method, device, medium and electronic device that can accurately recognize each entity in a nested entity in a text.

[0005] In order to achieve the above objective, according to a first aspect of the present disclosure, a method for named entity recognition is provided, the method comprising:

[0006] Obtain the target text to be recognized;

[0007] Performing word recognition on the target text according to the target dictionary to obtain a word set corresponding to the target text, wherein the word set includes at least one word in the target text;

[0008] Determine the word vector corresponding to each word in the target text;

[0009] According to the entity recognition model and the word vectors corresponding to each word, the named entities in the target text and the type corresponding to each named entity are determined, wherein the training sample of the entity recognition model includes nested named entity text and labeling information of multiple named entities corresponding to the nested named entity text.

[0010] Optionally, determining the word vector corresponding to each word in the target text includes:

[0011] Generate a target graph corresponding to the target text according to a word set corresponding to the target text, wherein the first character and the last character of each word in the target text have a connecting line in the target graph;

[0012] According to the target graph and the character vector of each character in the target text, a word vector corresponding to each word in the target text is determined.

[0013] Optionally, determining the word vector corresponding to each word in the target text according to the target graph and the character vector of each character in the target text includes:

[0014] Based on the target graph, feature extraction is performed on the character vector of each character in the target text by using a graph convolutional neural network to obtain a graph vector corresponding to each character;

[0015] For each word in the target text containing multiple characters, concatenate the graph vectors corresponding to the first character and the last character in the word to obtain a word vector corresponding to the word;

[0016] For each word in the target text containing a single character, two identical graph vectors corresponding to the character are concatenated to obtain a word vector corresponding to the word.

[0017] Optionally, the word set is represented by a matrix, and the word recognition is performed on the target text according to the target dictionary to obtain the word set corresponding to the target text, including:

[0018] For each character in the target text, a row vector corresponding to the character is generated according to the target dictionary and the target text, wherein the dimension of the row vector is the number of characters in the target text, and the value of the character dimension corresponding to each character in the row vector corresponding to the character is a first value. When a word formed with the character as the starting character and the target character after the character as the ending character is determined to be a valid word according to the target dictionary, the value of the character dimension corresponding to the target character is the first value, and the value of the character dimension corresponding to other characters except the character and the target character corresponding to the character in the row vector corresponding to the character is a second value.

[0019] The matrix corresponding to the word set is determined according to the row vector corresponding to each character in the target text.

[0020] Optionally, the entity recognition model is determined in the following manner:

[0021] Obtaining the training sample;

[0022] Performing word recognition on the nested named entity text according to a target dictionary to obtain a training word set corresponding to the nested named entity text;

[0023] Determine a training word vector corresponding to each training word in the nested named entity text;

[0024] Inputting each of the training word vectors into a multi-classification model to obtain a predicted classification distribution corresponding to each of the training word vectors output by the multi-classification model;

[0025] Determining a target loss of the multi-classification model according to the predicted classification distribution corresponding to each of the training word vectors and the labeling information of the multiple named entities corresponding to the nested named entity texts;

[0026] The multi-classification model is trained according to the target loss to obtain the entity recognition model.

[0027] Optionally, the training samples are determined in the following manner:

[0028] Get the candidate corpus corresponding to the nested named entity text in the corpus;

[0029] Performing word recognition on the candidate corpus according to the target dictionary to determine a word set corresponding to the candidate corpus;

[0030] The tag information of each word in the candidate corpus is obtained, and the tag information and words corresponding to the entity in the tag information and the candidate corpus are used as the training samples.

[0031] According to a second aspect of the present disclosure, a named entity recognition device is provided, the device comprising:

[0032] An acquisition module is used to acquire the target text to be recognized;

[0033] A first recognition module is used to perform word recognition on the target text according to a target dictionary to obtain a word set corresponding to the target text, wherein the word set includes at least one word in the target text;

[0034] A determination module, used to determine the word vector corresponding to each word in the target text;

[0035] The second recognition module is used to determine the named entities in the target text and the type corresponding to each named entity based on the entity recognition model and the word vectors corresponding to each word, wherein the training sample of the entity recognition model includes nested named entity text and labeling information of multiple named entities corresponding to the nested named entity text.

[0036] Optionally, the determining module includes:

[0037] A first generating submodule is used to generate a target graph corresponding to the target text according to a word set corresponding to the target text, wherein the first character and the last character of each word in the target text have a connecting line in the target graph;

[0038] The first determination submodule is used to determine the word vector corresponding to each word in the target text according to the target graph and the character vector of each character in the target text.

[0039] According to a third aspect of the present disclosure, a non-temporary computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the steps of any method described in the first aspect are implemented.

[0040] According to a fourth aspect of the present disclosure, there is provided an electronic device, including:

[0041] a memory having a computer program stored thereon;

[0042] A processor is used to execute the computer program in the memory to implement the steps of any method described in the first aspect.

[0043] Therefore, through the above technical solution, the target text to be identified can be identified by performing word recognition to obtain each word in the target text that may be a named entity, and then each word can be further identified through the entity recognition model to determine the named entity in each word and the corresponding type, so as to accurately identify multiple named entities in the target text and ensure the accuracy and precision of nested entity text recognition. In addition, the training sample of the entity recognition model includes nested named entity text and the annotation information of multiple named entities corresponding to the nested named entity text, so that the entity recognition model can simultaneously learn the nested features in the nested entity text during the training and learning process, which is more suitable for the recognition application scenario of the nested entity, and further improves the accuracy of the recognition of each named entity contained in the target text.

[0044] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present disclosure but do not constitute a limitation of the present disclosure. In the accompanying drawings:

[0046] Figure 1 is a flowchart of a named entity recognition method provided according to an embodiment of the present disclosure;

[0047] Figure 2 is a schematic diagram of a matrix corresponding to a word set determined according to an embodiment of the present disclosure;

[0048] Figure 3 is a schematic diagram of a target graph corresponding to the target text “upper respiratory tract infection” determined according to an embodiment of the present disclosure;

[0049] Figure 4 is a block diagram of a named entity recognition device provided according to an embodiment of the present disclosure;

[0050] Figure 5 is a block diagram of an electronic device according to an exemplary embodiment;

[0051] Figure 6 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0052] The specific implementation of the present disclosure is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described herein is only used to illustrate and explain the present disclosure, and is not used to limit the present disclosure.

[0053] Figure 1 As shown, it is a flowchart of a method for named entity recognition provided according to an embodiment of the present disclosure, as shown in Figure 1 As shown, the method may include:

[0054] In step 11, the target text to be recognized is obtained.

[0055] As an example, the target text to be recognized may be a text for named entity recognition. As another example, the received text for named entity recognition may be processed into sentences, and each sentence obtained may be used as the target text. Punctuation marks for sentence processing may be pre-set, so that punctuation marks may be detected for the text to be recognized to achieve sentence segmentation, thereby obtaining the target text.

[0056] In step 12, word recognition is performed on the target text according to the target dictionary to obtain a word set corresponding to the target text, wherein the word set contains at least one word in the target text.

[0057] It should be noted that the words described in the present disclosure can be a single word or a combination of multiple words. The target dictionary can be one or more selected from multiple dictionaries that record common words, or it can be a dictionary pre-set for the field to which the text to be recognized belongs, so as to adapt to the word recognition in this field, and the present disclosure does not limit this.

[0058] As an example, each character in the target text can be used as a word, and the target text can be segmented to obtain multiple possible candidate words. Afterwards, if the candidate word can be found in the target dictionary, the candidate word can be used as a word in the target text. If the candidate word is not found in the target dictionary, the candidate word can be discarded and not processed as a candidate.

[0059] In step 13, the word vector corresponding to each word in the target text is determined, wherein the word vector corresponding to the word can represent the text feature of the word.

[0060] In step 14, the named entities in the target text and the type corresponding to each named entity are determined based on the entity recognition model and the word vectors corresponding to each word, wherein the training sample of the entity recognition model includes nested named entity text and annotation information of multiple named entities corresponding to the nested named entity text.

[0061] Among them, the training samples of the entity recognition model are obtained by training based on the nested named entity text, and the training samples may include multiple entities in the nested named entity text. Therefore, in this embodiment, the words "upper respiratory tract", "upper respiratory tract infection", "breathing", "respiratory tract", "respiratory tract infection", "infection", etc. in the target text "upper respiratory tract infection" to be identified can be determined through the above steps. In this step, the entity recognition model can be used to perform named entity recognition on the identified words, and it can be further identified that "upper respiratory tract" and "respiratory tract" are named entities and their types are part entities, and "respiratory tract infection" and "upper respiratory tract infection" are named entities and their types are disease entities, thereby achieving accurate recognition of nested entities.

[0062] Thus, through the above technical solution, it is possible to perform word recognition on the obtained target text to be recognized, obtain each word in the target text that may be a named entity, and then further recognize each word through an entity recognition model to determine the named entity and the corresponding type in each word, so as to accurately recognize multiple named entities existing in the target text and ensure the accuracy and precision of nested entity text recognition. Moreover, the training samples of the entity recognition model include nested named entity texts and annotation information of multiple named entities corresponding to the nested named entity texts, so that the entity recognition model can learn the nested features in the nested entity text simultaneously during the training and learning process, which is more suitable for the recognition application scenario of nested entities and further improves the accuracy of recognizing each named entity included in the target text.

[0063] In a possible embodiment, the word set can be represented by a matrix. Correspondingly, an exemplary implementation manner of obtaining the word set corresponding to the target text by performing word recognition on the target text according to the target dictionary is as follows. This step may include:

[0064] For each character in the target text, generate a row vector corresponding to the character according to the target dictionary and the target text, where the dimension of the row vector is the number of characters in the target text. In the row vector corresponding to each character, the value of the character dimension corresponding to the character is the first value. When it is determined according to the target dictionary that the word formed by using the character as the starting character and the target character after the character as the ending character is a valid word, the value of the character dimension corresponding to the target character is the first value, and the values of the character dimensions corresponding to the other characters except the character and the target character corresponding to the character in the row vector corresponding to the character are the second value;

[0065] Determine the matrix corresponding to the word set according to the row vector corresponding to each character in the target text.

[0066] Exemplarily, if the target text is "upper respiratory tract infection", then row vectors corresponding to 6 characters such as "上 (shàng), 呼 (hū), 吸 (xī), 道 (dào), 感 (gǎn), 染 (rǎn)" can be generated respectively, and the dimension of the row vector corresponding to each character is 6, which are 6 character dimensions of "上 (shàng), 呼 (hū), 吸 (xī), 道 (dào), 感 (gǎn), 染 (rǎn)".

[0067] Exemplarily, for the convenience of matrix calculation and processing, the first value can be set to 1, and the second value can be set to 0 to achieve a binary representation of the matrix. Taking the character "上" as an example, the value of the corresponding character dimension "上" is the first value. Taking the character "上" as the starting character and each character after this character "上" as the ending character, the formed words include {"上呼", "上呼吸", "上呼吸道", "上呼吸道感", "上呼吸道感染"}. Then, through the target dictionary, it can be determined that "上呼吸道" and "上呼吸道感染" among them are valid words, that is, the word formed by taking the character "上" as the starting character and the character "道" as the ending character, and the word formed by taking the character "上" as the starting character and the character "染" as the ending character are valid words. Then the target characters can include the characters "道" and "染", and the values of the corresponding character dimensions of "道" and "染" are 1, and the values of the remaining undetermined character dimensions are 0. Thus, the row vector corresponding to the character "上" is represented as 100101.

[0068] Similarly, taking the character "感" as an example, the value of the corresponding character dimension "感" is the first value. Taking the character "感" as the starting character and each character after this character "感" as the ending character, the formed word includes "感染". Then, through the target dictionary, it can be determined that "感染" is a valid word, that is, the word formed by taking the character "感" as the starting character and the character "染" as the ending character is a valid word. Then the target character is the character "染", and the value of the corresponding character dimension of "染" is 1, and the values of the remaining undetermined character dimensions are 0. Thus, the row vector corresponding to the character "感" is represented as 000011. Exemplarily, the matrix corresponding to the determined word set is as Figure 2 shown, where the columns in this matrix represent character dimensions, and the rows represent the row vectors corresponding to each character.

[0069] Thus, through the above technical solution, a word set matrix corresponding to the target text can be generated through the target dictionary to simply and effectively represent each word in the target text, providing accurate data support for further recognition of each word subsequently. At the same time, representing the words of the target text through the matrix can also simplify the subsequent word recognition calculation process to a certain extent and improve the efficiency of named entity recognition.

[0070] In a possible embodiment, an exemplary implementation manner for determining the word vectors corresponding to each word in the target text is as follows. This step may include:

[0071] Generate a target graph corresponding to the target text according to the word set corresponding to the target text, where there is a connection line between the first character and the last character of each word in the target text in the target graph.

[0072] Among them, the matrix corresponding to the word set can be used as an adjacency matrix to generate a graph structure, so as to obtain a target graph corresponding to the target text. Among them, the conversion and generation method between the adjacency matrix and the graph structure can be carried out in a common way in this field, and the present disclosure does not limit this. Continuing with the above example, the target graph corresponding to the determined target text "upper respiratory tract infection" is as Figure 3 shown. Among them, taking the word "respiratory tract" included in the target text as an example, there is a connection line between the characters "呼" and "道", and the representations of other words are similar and will not be elaborated here. Among them, the representation of a single-character word in the graph is the node itself in the graph.

[0073] After that, according to the target graph and the character vectors of each character in the target text, determine the word vectors corresponding to each word in the target text.

[0074] Among them, the target graph can be used to represent the association relationship between each character in the target text. Then, as an example, the character vectors of each character in the target text can be determined based on a vector representation model, so that the word vectors corresponding to the words can be obtained by splicing based on the association relationship in the target graph and the character vectors of each character in the word.

[0075] As another example, the exemplary implementation manner of determining the word vectors corresponding to each word in the target text according to the target graph and the character vectors of each character in the target text is as follows. This step may include:

[0076] Based on the target graph, use a graph convolutional neural network to extract features from the character vectors of each character in the target text to obtain the graph vector corresponding to each character.

[0077] Exemplarily, the character vectors of each character in the target text can be determined based on a vector representation model. Among them, the vector representation model can use the labeled and unlabeled texts in the corpus as training data and be trained based on the BERT model. For example, the vector representation model can be trained with each corpus in the corpus as training data to improve the accuracy of the vector representation model. The pre-training of the BERT model can be to randomly occlude some words in the training data and train the model based on the occluded training data and the original training data, or to train the model by predicting whether two training data are connected. The training process and loss determination can be carried out in a common way in this field and will not be elaborated here. Thus, by using all texts such as the labeled and unlabeled texts in the corpus as training data to determine the vector representation model, the accuracy of the vector conversion of the vector representation model can be improved, the accuracy of the features in the character vector can be improved, and accurate data support can be provided for subsequent determination of the graph vector corresponding to the character.

[0078] Among them, the Graph Convolutional Network (GCN) can utilize the Fourier transform and combine the convolution theorem to implement the convolution operation. Among them, the GCN model can be pre-trained in the conventional manner in this field, and the present disclosure will not elaborate herein. In this embodiment, after obtaining the character vectors of each character in the target text, the character vectors can be further feature-extracted based on the nodes and association relationships in the target graph by the GCN, and the predicted output of the GCN network for each character vector is obtained, that is, the graph vector corresponding to the character. Then, the graph vector can include the features of the character and the association features of other characters associated with the character.

[0079] After obtaining the graph vectors corresponding to each character, the word vectors corresponding to each word can be obtained in the following manner:

[0080] For each word containing multiple characters in the target text, the graph vectors corresponding to the first character and the last character in the word are respectively concatenated to obtain the word vector corresponding to the word;

[0081] For each word containing a single character in the target text, two identical graph vectors corresponding to the character are concatenated to obtain the word vector corresponding to the word.

[0082] Exemplarily, the character vectors of each character in the target text "upper respiratory tract infection" are sequentially denoted as h1 to h6, and the graph vectors corresponding to each character are sequentially denoted as to For each word containing multiple characters in the target text, the graph vectors corresponding to the first character and the last character in the word are respectively concatenated to obtain the word vector s i,j , which is expressed as follows:

[0083]

[0084] Among them, is used to represent the graph vector corresponding to the first character in the word, is used to represent the graph vector corresponding to the last character in the word. Taking the word "upper respiratory tract" as an example, the graph vectors corresponding to the character "upper" and the character "tract" can be concatenated to obtain the word vector s 1,4 , which is expressed as follows: The determination methods of the word vectors of other words containing multiple characters are similar and will not be elaborated herein.

[0085] For each word in the target text that contains a single character, splice the two identical graph vectors corresponding to the character to obtain the word vector corresponding to the word. Taking the word "上" as an example, the two identical graph vectors corresponding to the character "上" can be spliced to obtain the word vector s1 corresponding to the word "上", which is expressed as follows: The determination method of the word vectors of other words containing a single character is similar and will not be elaborated here.

[0086] Thus, through the above technical solution, the graph convolutional neural network can further extract features from the character vectors in the target text, so as to obtain the graph vectors corresponding to the characters by combining the correlation relationships between the characters, and then the word vectors of the words can be determined based on the graph vectors of the characters, improving the comprehensiveness of the features in the word vectors and providing comprehensive reference features for subsequent classification based on the word vectors. At the same time, through the above method, the lengths of the word vectors corresponding to words with different numbers of characters can be made the same, facilitating the unified processing of each word and improving the efficiency of data processing.

[0087] In a possible embodiment, the entity recognition model is determined in the following manner:

[0088] Obtain the training samples. As described above, the training samples include nested named entity texts and the annotation information of multiple named entities corresponding to the nested named entity texts.

[0089] In a possible embodiment, the nested named entity text can be output to the annotator, so that the annotator can annotate the nested named entity text and mark the corresponding positions and types of the possible named entities therein.

[0090] In another possible embodiment, the training samples can be determined in the following manner:

[0091] Obtain the candidate corpus corresponding to the nested named entity text in the corpus. Among them, any text can be randomly selected from the nested named entity text as the candidate corpus. Or as described above, randomly select any text from the nested named entity text, and split the selected text into sentences, and select any sentence as the candidate corpus, so as to annotate each candidate corpus to obtain the training samples.

[0092] Perform word recognition on the candidate corpus according to the target dictionary to determine the word set corresponding to the candidate corpus. Among them, the method of determining the word set has been elaborated above and will not be elaborated here.

[0093] Obtain the annotation information of each word in the candidate corpus, and use the annotation information corresponding to the entity, the word, and the candidate corpus as the training samples.

[0094] Afterwards, each word in the candidate corpus is output to the annotator for annotation. In response to receiving the annotation operation of the annotator on the word, the annotation information input by the annotator is used as the annotation information of the word. If the annotator does not perform an annotation operation on the word, the obtained annotation information is empty, which means that the word is not an entity. At this time, the word can be automatically annotated, that is, annotated with other information other than the entity type, or the part of the word can be ignored and not annotated.

[0095] Therefore, after the training corpus is segmented, it can be output to the labelers for labeling, which can reduce the risk of missing or mislabeling named entities in the training samples to a certain extent, ensure the accuracy of the training samples of the entity training model, and improve the training efficiency and training accuracy of the entity recognition model.

[0096] Perform word recognition on the nested named entity text according to the target dictionary to obtain a training word set corresponding to the nested named entity text; and determine a training word vector corresponding to each training word in the nested named entity text.

[0097] Among them, the above-mentioned method of performing word recognition to obtain a training word set and determining the training word vectors corresponding to the training words is similar to the method of determining a word set and determining the word vectors of the words in the word set described above, and will not be repeated here.

[0098] The training word vectors are input into a multi-classification model to obtain a predicted classification distribution corresponding to each training word vector output by the multi-classification model.

[0099] For example, the multi-classification model can be implemented by a fully connected multi-layer perceptron neural network (MLP). In this embodiment, each training word vector can be input into the multi-classification model, and data processing is performed based on the multi-classification model to output the training word vector s i,j Corresponding predicted classification distribution The formula is as follows:

[0100]

[0101] Afterwards, the target loss of the multi-classification model is determined according to the predicted classification distribution corresponding to each of the training word vectors and the labeling information of the multiple named entities corresponding to the nested named entity texts; and the multi-classification model is trained according to the target loss to obtain the entity recognition model.

[0102] For example, when determining the target loss of a multi-classification model, it can be calculated based on the cross entropy loss, and the formula is as follows:

[0103]

[0104] Among them, loss is used to represent the target loss; D is used to represent the number of training samples; C is used to represent the number of classifications; It is used to represent the target output of the mth training word vector under the nth category. It is used to represent the predicted output of the mth training word vector under the nth category, that is, the probability that the output predicted classification distribution corresponds to the jth category, λ is used to represent the hyperparameter, and θ is used to represent the learning parameter of the cross entropy calculation, which can be learned and adjusted by the gradient descent method.

[0105] For example, corresponding to the target output in the training sample, for any nested named entity text, for the single-word words therein, the corresponding target output can be automatically marked as the first type, and for the words that have not been marked by the annotation personnel, the target output corresponding to the word is automatically marked as the second type. Among them, the first type and the second type are different, and are also different from the annotation information input by the annotation personnel to ensure the accuracy of the classification annotation. For the named entities with annotation information in the nested named entity text, the annotation information can be directly used as the target output. Thus, the target loss of the multi-classification model can be determined based on the target output corresponding to the training words and the predicted classification release, so that the multi-classification model can be updated when the target loss is greater than the loss threshold, or the multi-classification model can be updated when the number of learning iterations of the multi-classification model is less than the number threshold, so as to finally obtain the trained multi-classification model and determine it as the entity recognition model.

[0106] Therefore, through the above technical scheme, the multi-classification model can be trained based on the training samples corresponding to the nested entity text. During the training process, the multi-classification model can output the predicted classification distribution corresponding to multiple entities in the text, thereby obtaining an entity recognition model for nested entity recognition, which is suitable for entity recognition scenarios with complex expression texts. At the same time, it ensures the recognition accuracy of the entity recognition model and improves the accuracy of named entity recognition.

[0107] Based on the same inventive concept, the present disclosure also provides a named entity recognition device, such as Figure 4 As shown, the device 10 comprises:

[0108] An acquisition module 100 is used to acquire a target text to be recognized;

[0109] A first recognition module 200 is used to perform word recognition on the target text according to a target dictionary to obtain a word set corresponding to the target text, wherein the word set contains at least one word in the target text;

[0110] A determination module 300 is used to determine a word vector corresponding to each word in the target text;

[0111] The second recognition module 400 is used to determine the named entities in the target text and the type corresponding to each named entity based on the entity recognition model and the word vectors corresponding to each word, wherein the training sample of the entity recognition model includes nested named entity text and labeling information of multiple named entities corresponding to the nested named entity text.

[0112] Optionally, the determining module includes:

[0113] A first generating submodule is used to generate a target graph corresponding to the target text according to a word set corresponding to the target text, wherein the first character and the last character of each word in the target text have a connecting line in the target graph;

[0114] The first determination submodule is used to determine the word vector corresponding to each word in the target text according to the target graph and the character vector of each character in the target text.

[0115] Optionally, the first determining submodule includes:

[0116] An extraction submodule, for extracting features of a character vector of each character in the target text through a graph convolutional neural network based on the target graph, to obtain a graph vector corresponding to each character;

[0117] A first concatenation submodule is used for concatenating the graph vectors corresponding to the first character and the last character of each word in the target text containing multiple characters, so as to obtain a word vector corresponding to the word;

[0118] The second concatenation submodule is used for concatenating two identical graph vectors corresponding to each word containing a single character in the target text to obtain a word vector corresponding to the word.

[0119] Optionally, the word set is represented by a matrix, and the first recognition module includes:

[0120] A second generating submodule is used to generate, for each character in the target text, a row vector corresponding to the character according to the target dictionary and the target text, wherein the dimension of the row vector is the number of characters in the target text, and the value of the character dimension corresponding to each character in the row vector corresponding to the character is a first value. When a word formed by taking the character as the starting character and taking the target character after the character as the ending character is determined to be a valid word according to the target dictionary, the value of the character dimension corresponding to the target character is the first value, and the value of the character dimension corresponding to other characters except the character and the target character corresponding to the character in the row vector corresponding to the character is a second value.

[0121] The second determination submodule is used to determine the matrix corresponding to the word set according to the row vector corresponding to each character in the target text.

[0122] Optionally, the entity recognition model is determined in the following manner:

[0123] Obtaining the training sample;

[0124] Performing word recognition on the nested named entity text according to a target dictionary to obtain a training word set corresponding to the nested named entity text;

[0125] Determine a training word vector corresponding to each training word in the nested named entity text;

[0126] Inputting each of the training word vectors into a multi-classification model to obtain a predicted classification distribution corresponding to each of the training word vectors output by the multi-classification model;

[0127] Determining a target loss of the multi-classification model according to the predicted classification distribution corresponding to each of the training word vectors and the labeling information of the multiple named entities corresponding to the nested named entity texts;

[0128] The multi-classification model is trained according to the target loss to obtain the entity recognition model.

[0129] Optionally, the training samples are determined in the following manner:

[0130] Get the candidate corpus corresponding to the nested named entity text in the corpus;

[0131] Performing word recognition on the candidate corpus according to the target dictionary to determine a word set corresponding to the candidate corpus;

[0132] The tag information of each word in the candidate corpus is obtained, and the tag information and words corresponding to the entity in the tag information and the candidate corpus are used as the training samples.

[0133] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0134] Figure 5 FIG. 7 is a block diagram of an electronic device 700 according to an exemplary embodiment. Figure 5 As shown, the electronic device 700 may include: a processor 701 and a memory 702. The electronic device 700 may also include one or more of a multimedia component 703, an input / output (I / O) interface 704, and a communication component 705.

[0135] The processor 701 is used to control the overall operation of the electronic device 700 to complete all or part of the steps in the above-mentioned named entity recognition method. The memory 702 is used to store various types of data to support the operation of the electronic device 700, and these data may include, for example, instructions for any application or method used to operate on the electronic device 700, and application-related data, such as contact data, sent and received messages, pictures, audio, video, etc. The memory 702 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, referred to as EPROM), programmable read-only memory (Programmable Read-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic memory, flash memory, magnetic disk or optical disk. The multimedia component 703 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may be further stored in the memory 702 or sent through the communication component 705. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 704 provides an interface between the processor 701 and other interface modules, and the other interface modules may be keyboards, mice, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 705 is used for wired or wireless communication between the electronic device 700 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, etc., or a combination of one or more of them, is not limited here. Therefore, the corresponding communication component 705 may include: Wi-Fi module, Bluetooth module, NFC module, etc.

[0136] In an exemplary embodiment, the electronic device 700 can be implemented by one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components to execute the above-mentioned named entity recognition method.

[0137] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the above-mentioned named entity recognition method are implemented. For example, the computer-readable storage medium can be the above-mentioned memory 702 including program instructions, and the above-mentioned program instructions can be executed by the processor 701 of the electronic device 700 to complete the above-mentioned named entity recognition method.

[0138] Figure 6 1 is a block diagram of an electronic device 1900 according to an exemplary embodiment. For example, the electronic device 1900 may be provided as a server. Figure 6 The electronic device 1900 includes a processor 1922, which may be one or more, and a memory 1932 for storing a computer program executable by the processor 1922. The computer program stored in the memory 1932 may include one or more modules each corresponding to a set of instructions. In addition, the processor 1922 may be configured to execute the computer program to perform the above-mentioned named entity recognition method.

[0139] In addition, the electronic device 1900 may further include a power supply component 1926 and a communication component 1950. The power supply component 1926 may be configured to perform power management of the electronic device 1900, and the communication component 1950 may be configured to implement communication of the electronic device 1900, for example, wired or wireless communication. In addition, the electronic device 1900 may further include an input / output (I / O) interface 1958. The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server 2003. TM , Mac OS X TM , Unix TM , Linux TM etc.

[0140] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the above-mentioned named entity recognition method are implemented. For example, the non-transitory computer-readable storage medium can be the above-mentioned memory 1932 including program instructions, and the above-mentioned program instructions can be executed by the processor 1922 of the electronic device 1900 to complete the above-mentioned named entity recognition method.

[0141] In another exemplary embodiment, a computer program product is further provided. The computer program product includes a computer program that can be executed by a programmable device. The computer program has a code portion for executing the above-mentioned named entity recognition method when executed by the programmable device.

[0142] The preferred embodiments of the present disclosure are described in detail above in conjunction with the accompanying drawings; however, the present disclosure is not limited to the specific details in the above embodiments. Within the technical concept of the present disclosure, a variety of simple modifications can be made to the technical solution of the present disclosure, and these simple modifications all fall within the protection scope of the present disclosure.

[0143] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present disclosure will not further describe various possible combinations.

[0144] In addition, various embodiments of the present disclosure may be arbitrarily combined, and as long as they do not violate the concept of the present disclosure, they should also be regarded as the contents disclosed by the present disclosure.

Claims

1. A method for named entity recognition, characterized in that: The method comprises: Obtain the target text to be recognized; Performing word recognition on the target text according to the target dictionary to obtain a word set corresponding to the target text, wherein the word set includes at least one word in the target text; Determine the word vector corresponding to each word in the target text; Determine the named entities in the target text and the type corresponding to each of the named entities according to the entity recognition model and the word vectors corresponding to each word, wherein the training sample of the entity recognition model includes nested named entity text and labeling information of multiple named entities corresponding to the nested named entity text; Wherein, determining the word vector corresponding to each word in the target text includes: Generate a target graph corresponding to the target text according to a word set corresponding to the target text, wherein the first character and the last character of each word in the target text have a connecting line in the target graph; According to the target graph and the character vector of each character in the target text, a word vector corresponding to each word in the target text is determined.

2. The method according to claim 1, characterized in that The step of determining the word vector corresponding to each word in the target text according to the target graph and the character vector of each character in the target text comprises: Based on the target graph, feature extraction is performed on the character vector of each character in the target text by using a graph convolutional neural network to obtain a graph vector corresponding to each character; For each word in the target text containing multiple characters, concatenate the graph vectors corresponding to the first character and the last character in the word to obtain a word vector corresponding to the word; For each word in the target text containing a single character, two identical graph vectors corresponding to the character are concatenated to obtain a word vector corresponding to the word.

3. The method according to claim 1, characterized in that The word set is represented by a matrix, and the word recognition is performed on the target text according to the target dictionary to obtain the word set corresponding to the target text, including: For each character in the target text, a row vector corresponding to the character is generated according to the target dictionary and the target text, wherein the dimension of the row vector is the number of characters in the target text, and the value of the character dimension corresponding to each character in the row vector corresponding to the character is a first value. When a word formed with the character as the starting character and the target character after the character as the ending character is determined to be a valid word according to the target dictionary, the value of the character dimension corresponding to the target character is the first value, and the value of the character dimension corresponding to other characters except the character and the target character corresponding to the character in the row vector corresponding to the character is a second value. The matrix corresponding to the word set is determined according to the row vector corresponding to each character in the target text.

4. The method according to claim 1, characterized in that The entity recognition model is determined in the following way: Obtaining the training sample; Performing word recognition on the nested named entity text according to a target dictionary to obtain a training word set corresponding to the nested named entity text; Determine a training word vector corresponding to each training word in the nested named entity text; Input each of the training word vectors into a multi-classification model to obtain a predicted classification distribution corresponding to each of the training word vectors output by the multi-classification model; Determining a target loss of the multi-classification model according to the predicted classification distribution corresponding to each of the training word vectors and the labeling information of the multiple named entities corresponding to the nested named entity texts; The multi-classification model is trained according to the target loss to obtain the entity recognition model.

5. The method according to any one of claims 1 to 4, characterized in that The training samples are determined in the following way: Get the candidate corpus corresponding to the nested named entity text in the corpus; Performing word recognition on the candidate corpus according to the target dictionary to determine a word set corresponding to the candidate corpus; The tag information of each word in the candidate corpus is obtained, and the tag information and words corresponding to the entity in the tag information and the candidate corpus are used as the training samples.

6. A named entity recognition device, characterized in that: The device comprises: An acquisition module is used to acquire the target text to be recognized; A first recognition module is used to perform word recognition on the target text according to a target dictionary to obtain a word set corresponding to the target text, wherein the word set includes at least one word in the target text; A determination module, used to determine the word vector corresponding to each word in the target text; A second recognition module is used to determine the named entities in the target text and the type corresponding to each of the named entities according to the entity recognition model and the word vectors corresponding to each word, wherein the training sample of the entity recognition model includes nested named entity text and labeling information of multiple named entities corresponding to the nested named entity text; Wherein, the determination module includes: A first generating submodule is used to generate a target graph corresponding to the target text according to a word set corresponding to the target text, wherein the first character and the last character of each word in the target text have a connecting line in the target graph; The first determination submodule is used to determine the word vector corresponding to each word in the target text according to the target graph and the character vector of each character in the target text.

7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method described in any one of claims 1 to 5 are implemented.

8. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the method according to any one of claims 1 to 5.