A Chinese named entity recognition method and device

By generating planar grid structures and multiple data embedding networks, combining Chinese character semantic features with grid information, the problem of low performance of the existing Chinese naming entity recognition model is solved, and more efficient and accurate naming entity recognition is achieved.

CN118410801BActive Publication Date: 2024-12-27GUANGDONG UNIV OF TECH
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410098390.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-23
Publication Date
2024-12-27
Estimated Expiration
2044-01-23

AI Technical Summary

Technical Problem

The existing Chinese named entity recognition model cannot fully capture text features due to insufficient resource data, resulting in performance degradation. The grid-based model is difficult to make full use of GPU parallel computing and inference speeds, especially in Chinese word segmentation, complex combinations, and entity embedding. There are difficulties in tasks such as sets.

Method used

By generating a planar grid structure, the semantic features of Chinese characters are combined with grid information, and the multivariate data embedding network is used for naming entity recognition, including the BERT model to obtain word embedding features, and the grid features are generated through relative position encoding, combining with the Transformer encoder and Bi-LSTM Identify with the CRF layer.

Benefits of technology

It improves the efficiency and accuracy of Chinese naming entity recognition, and the model has word boundaries and semantic learning capabilities, which is better than the performance of the existing technology on multiple data sets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118410801B_ABST
    Figure CN118410801B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for Chinese named entity recognition, comprising the following steps: generating a plurality of plane lattice structures according to a sentence to be recognized; wherein one of the plane lattice structures includes a character string obtained by segmenting the sentence to be recognized; generating a word embedding feature of the sentence to be recognized according to the sentence to be recognized, and generating a lattice feature of the sentence to be recognized according to the character string in the plane lattice structure; inputting the lattice feature and the word embedding feature into a preset multivariate data embedding network, and outputting a named entity recognition result of the sentence to be recognized. The present invention can improve the efficiency and accuracy of Chinese named entity recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of named entity recognition, and in particular to a Chinese named entity recognition method and device. Background Art

[0002] Named Entity Recognition (NER) is an important part of the information extraction process and plays a key role in multiple fields. In question-answering systems, NER helps understand the entities in the question, helping the system find relevant information and generate answers. In social media analysis, NER is used to analyze posts, comments, and tweets to help understand the topics and key entities discussed. In the field of finance and market analysis, NER can extract entity information such as companies, stocks, currencies, and economic events from financial news, reports, and social media to assist in financial decision-making. In addition, NER is used in healthcare and bioinformatics to extract diseases, drugs, symptoms, and medical terms, helping to promote research and clinical decision-making. In all these fields, NER provides a foundation for information extraction, semantic understanding, and decision support.

[0003] With the advancement of deep learning, pre-trained models have become the mainstream solution for named entity recognition. However, the lack of resource data limits the performance of the model. Due to the defects of the corpus, the model cannot fully capture the text features, resulting in a decline in the performance of the model. In addition, compared with English, there are no spaces between Chinese characters as word separators. Chinese word segmentation is mostly distinguished by readers through the semantic information of the sentence, which brings a lot of difficulties to Chinese NER. In addition, the task faces many other challenges, such as complex combinations, entity nesting, and indefinite length. The character-word lattice structure has been proven to be effective for Chinese named entity recognition by combining word information. However, due to the complexity and dynamics of the lattice structure, most of the existing lattice-based models find it difficult to fully utilize the parallel computing of GPUs, and the inference speed is usually low. Summary of the invention

[0004] In order to overcome the above-mentioned defects of the prior art, the present invention provides a Chinese named entity recognition method and device, which can improve the efficiency and accuracy of Chinese named entity recognition.

[0005] An embodiment of the present invention provides a Chinese named entity recognition method, comprising the following steps:

[0006] Generate a plurality of plane lattice structures according to the sentence to be recognized; wherein one of the plane lattice structures includes a character string obtained by segmenting the sentence to be recognized;

[0007] Generating a word embedding feature of the sentence to be recognized according to the sentence to be recognized, and generating a lattice feature of the sentence to be recognized according to the character string in the plane lattice structure;

[0008] The case features and word embedding features are input into a preset multivariate data embedding network, and a named entity recognition result of the sentence to be recognized is obtained as an output.

[0009] Furthermore, the generating of a plurality of plane lattice structures according to the sentences to be recognized specifically includes:

[0010] According to a preset dictionary, the sentence to be recognized is segmented to obtain a plurality of character strings, and the plurality of character strings are respectively filled into a plurality of grids to obtain the plurality of grid structures; wherein the character string includes a single character or a word composed of a plurality of the single characters obtained by matching the preset dictionary;

[0011] The plurality of lattice structures are flattened to obtain the plurality of planar lattice structures.

[0012] Further, generating a word embedding feature of the sentence to be recognized according to the sentence to be recognized specifically includes:

[0013] All characters in the sentence to be recognized are input into the BERT model respectively to obtain the word embedding features of the sentence to be recognized.

[0014] Furthermore, the method of generating the sentence lattice feature to be recognized according to the character string in the plane lattice structure specifically includes:

[0015] When the generation of the first-order feature starts, one of the multiple character strings is selected as an input character string, and the input character string is input into the BERT model to obtain the word feature corresponding to the input character string;

[0016] Calculating the relative position codes between the input string and the other strings among the plurality of strings except the input string to obtain the plurality of relative position codes corresponding to the input string, and combining the word feature corresponding to the input string with the plurality of relative position codes to obtain the string lattice feature of the input string, and ending the lattice feature generation once;

[0017] The plurality of character strings are respectively used as input character strings and correspondingly generate lattice features for a plurality of times, and the character string lattice features corresponding to all the character strings are combined to obtain the lattice features of the sentence to be recognized.

[0018] Preferably, the calculation method of the relative position code specifically includes:

[0019] Take two of the above strings, and let one of them be x i , and the other string is x j, let the first character of each string be the head character, the last character of each string be the tail character, and let x i The position of the head character in the sentence to be recognized is head[i], x i The position of the tail character of in the sentence to be recognized is tail[i], and x j The position of the head character in the sentence to be recognized is head[j], x j The position of the tail character of in the sentence to be recognized is tail[j], then:

[0020]

[0021]

[0022]

[0023]

[0024] in, Represents x i The first character and x j The distance between the head characters, Represents x i The first character and x j The distance between the tail characters of Represents x i The last character of j The distance between the head characters, Represents x i The last character of j The distance between the tail characters of ;

[0025] according to Get x i With x j The relative position code R ij :

[0026]

[0027] Among them, W r To preset learnable parameters, n is the preset dimension threshold, and the specific calculation formula is:

[0028]

[0029]

[0030] Among them, k∈[0,n], d model is the preset dimension of the word feature.

[0031] Furthermore, the preset multivariate data embedding network includes two Transformer encoders, a fully connected layer, a Bi-LSTM layer, and a CRF layer;

[0032] The input ends of the two Transformer encoders are respectively used to receive the case features and word embedding features of the sentence to be recognized, and the output ends of the two Transformer encoders are respectively connected to the input end of the fully connected layer, the output end of the fully connected layer is connected to the input end of the Bi-LSTM layer, the output end of the Bi-LSTM layer is connected to the input end of the CRF layer, and the output end of the CRF layer is used to output the recognition result.

[0033] Preferably, the Transformer encoder includes a multi-head self-attention layer, a feedforward network layer, a first residual connection and layer normalization module, and a second residual connection and layer normalization module;

[0034] The input end of the multi-head self-attention layer is used to receive the case features or word embedding features of the sentence to be recognized, the output end of the multi-head self-attention layer is connected to the input end of the feedforward network layer through the first residual connection and layer normalization module, the output end of the feedforward network layer is connected to the second residual connection and layer normalization module, and the output end of the second residual connection and layer normalization module is connected to the input end of the fully connected layer.

[0035] Furthermore, the case feature and the word embedding feature are input into a preset multivariate data embedding network, and the named entity recognition result of the sentence to be recognized is obtained by output, specifically including:

[0036] Inputting the lattice feature and the word embedding feature into the two Transformer encoders respectively, and obtaining a first attention score and a second attention score correspondingly;

[0037] The first attention score and the second attention score are input into the fully connected layer for information fusion to obtain a fusion feature. The specific calculation formula is:

[0038]

[0039] Among them, Fusion (Att L ,Att R ) is the fusion feature, Att L With Att R are the first attention score and the second attention score, respectively, and W o is the preset weight matrix, b is the preset bias parameter;

[0040] After the fusion feature is input into the Bi-LSTM layer and the CRF layer for processing, the named entity recognition result is finally outputted.

[0041] Another embodiment of the present invention provides a Chinese named entity recognition device, comprising: a lattice structure generation module, a feature generation module and a recognition module;

[0042] The lattice structure generation module is used to generate a plurality of plane lattice structures according to the sentence to be recognized; wherein one of the plane lattice structures includes a character string obtained by segmenting the sentence to be recognized;

[0043] The feature generation module is used to generate a word embedding feature of the sentence to be recognized according to the sentence to be recognized, and to generate a lattice feature of the sentence to be recognized according to the character string in the plane lattice structure;

[0044] The recognition module is used to input the case features and word embedding features into a preset multivariate data embedding network, and output a named entity recognition result of the sentence to be recognized.

[0045] Furthermore, the lattice structure generation module is used to generate a plurality of plane lattice structures according to the sentence to be recognized, specifically including:

[0046] According to a preset dictionary, the sentence to be recognized is segmented to obtain a plurality of character strings, and the plurality of character strings are respectively filled into a plurality of grids to obtain the plurality of grid structures; wherein the character string includes a single character or a word composed of a plurality of the single characters obtained by matching the preset dictionary;

[0047] The plurality of lattice structures are flattened to obtain the plurality of planar lattice structures.

[0048] Compared with the prior art, the present invention has the following beneficial effects:

[0049] By converting the lattice structure into a planar structure composed of spans and embedding the semantic features of Chinese characters with the lattice information through a multivariate data embedding network, the model has both word boundary and semantic learning capabilities, thereby improving the efficiency and accuracy of Chinese named entity recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 A flowchart of a Chinese named entity recognition method provided by one embodiment of the present invention.

[0051] Figure 2 A schematic structural diagram of a planar lattice structure provided by an embodiment of the present invention.

[0052] Figure 3A schematic diagram of a model structure of a multivariate data embedding network provided by an embodiment of the present invention.

[0053] Figure 4 A schematic structural diagram of a Chinese named entity recognition device provided by another embodiment of the present invention.

[0054] Figure 5 A schematic diagram of the results of a Chinese named entity recognition comparison experiment provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0055] The drawings are for illustrative purposes only and should not be construed as limiting the present patent;

[0056] It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.

[0057] The technical solution of the present invention is further described below in conjunction with the accompanying drawings and embodiments.

[0058] Reference Figure 1 , is a flow chart of a Chinese named entity recognition method provided by an embodiment of the present invention, comprising the following steps:

[0059] S1: generating a plurality of plane lattice structures according to the sentence to be recognized; wherein one of the plane lattice structures includes a character string obtained by segmenting the sentence to be recognized;

[0060] S2: generating a word embedding feature of the sentence to be recognized according to the sentence to be recognized, and generating a lattice feature of the sentence to be recognized according to the character string in the plane lattice structure;

[0061] S3: Input the case features and word embedding features into a preset multivariate data embedding network, and output a named entity recognition result of the sentence to be recognized.

[0062] For step S1, specifically, generating a plurality of plane lattice structures according to the sentence to be recognized specifically includes:

[0063] According to a preset dictionary, the sentence to be recognized is segmented to obtain a plurality of character strings, and the plurality of character strings are respectively filled into a plurality of grids to obtain the plurality of grid structures; wherein the character string includes a single character or a word composed of a plurality of the single characters obtained by matching the preset dictionary;

[0064] The plurality of lattice structures are flattened to obtain the plurality of planar lattice structures.

[0065] In a preferred embodiment, although the character-word lattice structure has been proven to be effective for Chinese named entity recognition by combining word information, due to the complexity and dynamics of the lattice structure, most existing lattice-based models are difficult to fully utilize the parallel computing of GPUs, and the inference speed is usually low.

[0066] So, refer to Figure 2 The present invention flattens the lattice structure into a plane structure composed of spans, each span corresponds to a character or a potential word and its position in the original lattice, thereby obtaining a plurality of flat lattice structures (Flat-lattice). A flat lattice structure, that is, a set of spans, corresponds to a token, a head, and a tail. Wherein, a token is a single character or a word, and head and tail represent the position index of the first and last characters of the token in the original sequence, which indicate the position of the token in the lattice. For a single character, its head and tail are the same.

[0067] For step S2, specifically, generating a word embedding feature of the sentence to be recognized according to the sentence to be recognized specifically includes:

[0068] All characters in the sentence to be recognized are input into the BERT model respectively to obtain the word embedding features of the sentence to be recognized.

[0069] In a preferred embodiment, the word embedding feature of the input text represents the text as a dense vector, which enables the model to better utilize the semantic information of Chinese characters when recognizing named entities. BERT is pre-trained on a large-scale corpus and can capture the semantic relationship between words. Therefore, the pre-trained model BERT is used here to obtain the vector representation of the word, that is, to obtain the word embedding feature of the sentence to be recognized.

[0070] For step S2, further, the method of generating the sentence lattice feature to be recognized according to the character string in the plane lattice structure specifically includes:

[0071] When the generation of the first-order feature starts, one of the multiple character strings is selected as an input character string, and the input character string is input into the BERT model to obtain the word feature corresponding to the input character string;

[0072] Calculating the relative position codes between the input string and the other strings among the plurality of strings except the input string to obtain the plurality of relative position codes corresponding to the input string, and combining the word feature corresponding to the input string with the plurality of relative position codes to obtain the string lattice feature of the input string, and ending the lattice feature generation once;

[0073] The plurality of character strings are respectively used as input character strings and correspondingly generate lattice features for a plurality of times, and the character string lattice features corresponding to all the character strings are combined to obtain the lattice features of the sentence to be recognized.

[0074] Preferably, the calculation method of the relative position code specifically includes:

[0075] Take two of the above strings, and let one of them be x i , and the other string is x j , let the first character of each string be the head character, the last character of each string be the tail character, and let x i The position of the head character in the sentence to be recognized is head[i], x i The position of the tail character of in the sentence to be recognized is tail[i], and x j The position of the head character in the sentence to be recognized is head[j], x j The position of the tail character of in the sentence to be recognized is tail[j], then:

[0076]

[0077]

[0078]

[0079]

[0080] in, Represents x i The first character and x j The distance between the head characters, Represents x i The first character and x j The distance between the tail characters of Represents x i The last character of j The distance between the head characters, Represents x i The last character of j The distance between the tail characters of ;

[0081] according to Get x i With x j The relative position code R ij :

[0082]

[0083] Among them, W r To preset learnable parameters, n is the preset dimension threshold, and the specific calculation formula is:

[0084]

[0085]

[0086] Among them, k∈[0,n], d model is the preset dimension of the word feature.

[0087] In a preferred embodiment, the planar lattice structure is composed of spans of different lengths. In order to encode the interaction between the spans, the present invention proposes encoding the relative positions of the spans. i and x j , the relative position relationships between them include intersection, inclusion, and separation. Modeling these three relationships through relative position encoding can not only represent the relationship between two tokens, but also indicate more detailed information, such as the distance between characters and words.

[0088] For step S3, specifically, the preset multivariate data embedding network includes two Transformer encoders, a fully connected layer, a Bi-LSTM layer, and a CRF layer;

[0089] The input ends of the two Transformer encoders are respectively used to receive the case features and word embedding features of the sentence to be recognized, and the output ends of the two Transformer encoders are respectively connected to the input end of the fully connected layer, the output end of the fully connected layer is connected to the input end of the Bi-LSTM layer, the output end of the Bi-LSTM layer is connected to the input end of the CRF layer, and the output end of the CRF layer is used to output the recognition result.

[0090] Preferably, the Transformer encoder includes a multi-head self-attention layer, a feedforward network layer, a first residual connection and layer normalization module, and a second residual connection and layer normalization module;

[0091] The input end of the multi-head self-attention layer is used to receive the case features or word embedding features of the sentence to be recognized, the output end of the multi-head self-attention layer is connected to the input end of the feedforward network layer through the first residual connection and layer normalization module, the output end of the feedforward network layer is connected to the second residual connection and layer normalization module, and the output end of the second residual connection and layer normalization module is connected to the input end of the fully connected layer.

[0092] Furthermore, the case feature and the word embedding feature are input into a preset multivariate data embedding network, and the named entity recognition result of the sentence to be recognized is obtained by output, specifically including:

[0093] Inputting the lattice feature and the word embedding feature into the two Transformer encoders respectively, and obtaining a first attention score and a second attention score correspondingly;

[0094] The first attention score and the second attention score are input into the fully connected layer for information fusion to obtain a fusion feature. The specific calculation formula is:

[0095]

[0096] Among them, Fusopn(Att L ,Att R ) is the fusion feature, Att L With Att R are the first attention score and the second attention score, respectively, and W o is the preset weight matrix, b is the preset bias parameter;

[0097] After the fusion feature is input into the Bi-LSTM layer and the CRF layer for processing, the named entity recognition result is finally outputted.

[0098] In a preferred embodiment, referring to Figure 3 , which is a schematic diagram of a model structure of a multivariate data embedding network provided by an embodiment of the present invention.

[0099] After the sentence to be recognized is extracted to obtain case features and word embedding features, the case features and word embedding features are input into two Transformer encoders respectively.

[0100] Let the lattice feature be E L , the word embedding feature is E R , then when the lattice feature and word embedding feature are input into the multi-head attention layer, three components are obtained through linear transformation, namely, the query component Q L(R) , key component L L(R) and the value component V L(R) , the specific formula is:

[0101]

[0102] where each W is a learnable parameter matrix and d head is the dimension of each self-attention mechanism head.

[0103] Subsequently, the attention scores of the case feature and the word embedding feature are calculated respectively according to the above components, namely, the first attention score and the second attention score. The specific calculation formula is:

[0104] Att L =Softmax(A L )V L

[0105] Att R =Softmax(A R )V R

[0106] Among them, A L is the attention score of the feature, A R is the attention score of the word embedding feature, and the specific calculation formula is:

[0107] A L,ij =(Q L,i +u L ) T K L,i +(Q L,i +v L ) T R ij W R

[0108]

[0109] Among them, u L 、v L and W R are all learnable parameters.

[0110] After obtaining the first attention score and the second attention score, they are respectively processed in the first residual connection and layer normalization module, the feedforward network layer (FNN), and the second residual connection and layer normalization module in their respective Transformer encoders. Among them, the feedforward network layer is a positional multilayer perceptron with nonlinear transformation.

[0111] Then, in order to reduce information loss, the Att L and Att R The information is input into the fully connected layer to obtain the fused features.

[0112] Finally, the fusion features are sequentially input into the Bi-LSTM layer and the CRF layer ( Figure 3 After Linear&CRF (in the figure), the final named entity recognition result is obtained.

[0113] Reference Figure 4, is a schematic diagram of the structure of a Chinese named entity recognition device provided by another embodiment of the present invention, comprising: a lattice structure generation module 201, a feature generation module 202 and a recognition module 203;

[0114] The lattice structure generating module 201 is used to generate a plurality of plane lattice structures according to the sentence to be recognized; wherein one of the plane lattice structures includes a character string obtained by segmenting the sentence to be recognized;

[0115] The feature generation module 202 is used to generate a word embedding feature of the sentence to be recognized according to the sentence to be recognized, and to generate a lattice feature of the sentence to be recognized according to the character string in the plane lattice structure;

[0116] The recognition module 203 is used to input the case features and word embedding features into a preset multivariate data embedding network, and output a named entity recognition result of the sentence to be recognized.

[0117] Furthermore, the lattice structure generating module 201 is used to generate a plurality of plane lattice structures according to the sentence to be recognized, specifically including:

[0118] According to a preset dictionary, the sentence to be recognized is segmented to obtain a plurality of character strings, and the plurality of character strings are respectively filled into a plurality of grids to obtain the plurality of grid structures; wherein the character string includes a single character or a word composed of a plurality of the single characters obtained by matching the preset dictionary;

[0119] The plurality of lattice structures are flattened to obtain the plurality of planar lattice structures.

[0120] Compared with the existing technology, the present invention converts the lattice structure into a planar structure composed of spans and combines the semantic features of Chinese characters with the lattice information through a multivariate data embedding network, so that the model has both word boundary and semantic learning capabilities, thereby improving the efficiency and accuracy of Chinese named entity recognition.

[0121] The Chinese named entity method provided by the present invention is evaluated by comparing the performance of the device provided by the present invention with other commonly used models on different data sets.

[0122] First, we process the datasets for evaluation. The datasets include Weibo, Finance, and Ocean: Weibo consists of annotated NER messages from the social media Sina Weibo. The corpus contains named entities and entity mentions PER, ORG, GPE, and LOC; the Finance dataset is an annotated Chinese resume dataset with a small amount of data, which is suitable for simulating low-resource scenarios; the Ocean news dataset Ocean contains 600 sentences for training NER.

[0123] The named entities in the dataset are all marked as BIO chunks. BIO chunks are a type of annotation used in named entity recognition tasks to mark named entities in text. In BIO chunks, each word or token is labeled as one of the following three: B-(category): indicates the beginning of a named entity. For example, "B-PER" indicates the beginning of a person's name ("PER" stands for "Person"). I-(category): indicates inside a named entity. For example, "I-PER" indicates inside a person's name. O: indicates outside the named entity, i.e. "Outside". The "O" label is usually used to mark parts that are not named entities. Compared with public datasets, the entity types of the Ocean dataset are more comprehensive, including different granularities.

[0124] The above dataset is divided into training set, validation set and test data in the ratio of 7:1.5:1.5.

[0125] Then, determine the evaluation indicators. The evaluation indicators of named entity recognition include label-level indicators and entity-level indicators. In this comparative experiment, entity-level precision, recall rate and F1 are used for evaluation. The following is the specific formula and introduction of the indicator:

[0126] a) Precision (Pre): Precision indicates the number of samples of a particular class that we predicted correctly.

[0127]

[0128] b) Recall (Rec): Recall represents the number of original actual samples that are predicted correctly.

[0129]

[0130] c) F1: combines the precision and recall of each entity type using a weighted average.

[0131]

[0132] Among them, TP represents the number of samples correctly predicted by the model as positive, that is, the model correctly identified the samples that were actually positive. FP represents the number of samples incorrectly predicted by the model as positive, that is, the model incorrectly predicted the samples that were actually negative as positive. FN represents the number of samples incorrectly predicted by the model as negative, that is, the model incorrectly predicted the samples that were actually positive as negative.

[0133] Finally, refer to Figure 5 , is the device of the present invention ( Figure 5Schematic diagram of the results of comparing Our with three baseline models: BERT-CRF, FLAT, and MECT. It can be seen that Our has achieved state-of-the-art performance on two small datasets, Ocean and Finance, which simulate low-resource scenarios. At the same time, Our can also approach the best model in scenarios with large-scale annotated data. Compared with the best baseline model, Our improved F1-source by 0.84% ​​and 2.38% respectively. On the Weibo dataset, Our is close to the best baseline model. Among them, the two models BERE-CRF and FLAT are missing the results of the two indicators Pre and Rec because the original paper of the model did not disclose this part of the data, but this does not affect the final results.

[0134] In summary, the performance of the Chinese named entity device provided by the present invention evaluated on three data sets is basically better than the existing baseline model.

[0135] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the embodiments here. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the claims of the present invention.

Claims

1. A Chinese named entity recognition method, characterized in that: The steps include: Generate a plurality of plane lattice structures according to the sentence to be recognized; wherein one of the plane lattice structures includes a character string obtained by segmenting the sentence to be recognized; Generating a word embedding feature of the sentence to be recognized according to the sentence to be recognized, and generating a lattice feature of the sentence to be recognized according to the character string in the plane lattice structure; The case features and word embedding features are input into a preset multivariate data embedding network, and the named entity recognition result of the sentence to be recognized is obtained by output; wherein the preset multivariate data embedding network includes two Transformer encoders, a fully connected layer, a Bi-LSTM layer and a CRF layer; the input ends of the two Transformer encoders are respectively used to receive the case features and word embedding features of the sentence to be recognized, the output ends of the two Transformer encoders are respectively connected to the input end of the fully connected layer, the output end of the fully connected layer is connected to the input end of the Bi-LSTM layer, the output end of the Bi-LSTM layer is connected to the input end of the CRF layer, and the output end of the CRF layer is used to output the recognition result; The Transformer encoder includes a multi-head self-attention layer, a feedforward network layer, a first residual connection and layer normalization module, and a second residual connection and layer normalization module; the input end of the multi-head self-attention layer is used to receive the case feature or word embedding feature of the sentence to be recognized, the output end of the multi-head self-attention layer is connected to the input end of the feedforward network layer through the first residual connection and layer normalization module, the output end of the feedforward network layer is connected to the second residual connection and layer normalization module, and the output end of the second residual connection and layer normalization module is connected to the input end of the fully connected layer; The step of inputting the case feature and the word embedding feature into a preset multivariate data embedding network and outputting a named entity recognition result of the sentence to be recognized specifically includes: Inputting the lattice feature and the word embedding feature into the two Transformer encoders respectively, and obtaining a first attention score and a second attention score correspondingly; The first attention score and the second attention score are input into the fully connected layer for information fusion to obtain a fusion feature. The specific calculation formula is: Among them, Fusion (Att L ,Att R ) is the fusion feature, Att L With Att R are the first attention score and the second attention score, respectively, and W o is the preset weight matrix, b is the preset bias parameter; After the fusion feature is input into the Bi-LSTM layer and the CRF layer for processing, the named entity recognition result is finally outputted.

2. The Chinese named entity recognition method as claimed in claim 1, characterized in that: The generating of a plurality of plane lattice structures according to the sentences to be recognized specifically includes: According to a preset dictionary, the sentence to be recognized is segmented to obtain a plurality of character strings, and the plurality of character strings are respectively filled into a plurality of grids to obtain the plurality of grid structures; wherein the character string includes a single character or a word composed of a plurality of the single characters obtained by matching the preset dictionary; The plurality of lattice structures are flattened to obtain the plurality of planar lattice structures.

3. The Chinese named entity recognition method as claimed in claim 1, characterized in that: Generating a word embedding feature of the sentence to be recognized according to the sentence to be recognized specifically includes: All characters in the sentence to be recognized are input into the BERT model respectively to obtain the word embedding features of the sentence to be recognized.

4. The Chinese named entity recognition method according to claim 1, characterized in that: The method for generating the sentence lattice feature to be recognized according to the character string in the plane lattice structure specifically includes: When the generation of the first-order feature starts, one of the multiple character strings is selected as an input character string, and the input character string is input into the BERT model to obtain the word feature corresponding to the input character string; Calculating the relative position codes between the input string and the other strings among the plurality of strings except the input string to obtain the plurality of relative position codes corresponding to the input string, and combining the word feature corresponding to the input string with the plurality of relative position codes to obtain the string lattice feature of the input string, and ending the lattice feature generation once; The plurality of character strings are respectively used as input character strings and correspondingly generate lattice features for a plurality of times, and the character string lattice features corresponding to all the character strings are combined to obtain the lattice features of the sentence to be recognized.

5. The Chinese named entity recognition method as claimed in claim 4, characterized in that: The calculation method of the relative position code specifically includes: Take two of the above strings, and let one of them be x i , and the other string is x j , let the first character of each string be the head character, the last character of each string be the tail character, and let x i The position of the head character in the sentence to be recognized is head[i], x i The position of the tail character of in the sentence to be recognized is tail[i], and x j The position of the head character in the sentence to be recognized is head[j], x j The position of the tail character of in the sentence to be recognized is tail[j], then: in, Represents x i The first character and x j The distance between the head characters, Represents x i The first character and x j The distance between the tail characters of Represents x i The last character of j The distance between the head characters, Represents x i The last character of j The distance between the tail characters of ; according to Get x i With x j The relative position code R ij : Among them, W r To preset learnable parameters, n is the preset dimension threshold, and the specific calculation formula is: Among them, k∈[0,n], d model is the preset dimension of the word feature.

6. A Chinese named entity recognition device, characterized in that: include: Lattice structure generation module, feature generation module and recognition module; The lattice structure generation module is used to generate a plurality of plane lattice structures according to the sentence to be recognized; wherein one of the plane lattice structures includes a character string obtained by segmenting the sentence to be recognized; The feature generation module is used to generate a word embedding feature of the sentence to be recognized according to the sentence to be recognized, and to generate a lattice feature of the sentence to be recognized according to the character string in the plane lattice structure; The recognition module is used to input the case features and word embedding features into a preset multivariate data embedding network, and output a named entity recognition result of the sentence to be recognized; wherein the preset multivariate data embedding network includes two Transformer encoders, a fully connected layer, a Bi-LSTM layer and a CRF layer; the input ends of the two Transformer encoders are respectively used to receive the case features and word embedding features of the sentence to be recognized, the output ends of the two Transformer encoders are respectively connected to the input end of the fully connected layer, the output end of the fully connected layer is connected to the input end of the Bi-LSTM layer, the output end of the Bi-LSTM layer is connected to the input end of the CRF layer, and the output end of the CRF layer is used to output the recognition result; The Transformer encoder includes a multi-head self-attention layer, a feedforward network layer, a first residual connection and layer normalization module, and a second residual connection and layer normalization module; the input end of the multi-head self-attention layer is used to receive the case feature or word embedding feature of the sentence to be recognized, the output end of the multi-head self-attention layer is connected to the input end of the feedforward network layer through the first residual connection and layer normalization module, the output end of the feedforward network layer is connected to the second residual connection and layer normalization module, and the output end of the second residual connection and layer normalization module is connected to the input end of the fully connected layer; The step of inputting the case feature and the word embedding feature into a preset multivariate data embedding network and outputting a named entity recognition result of the sentence to be recognized specifically includes: Inputting the lattice feature and the word embedding feature into the two Transformer encoders respectively, and obtaining a first attention score and a second attention score correspondingly; The first attention score and the second attention score are input into the fully connected layer for information fusion to obtain a fusion feature. The specific calculation formula is: Among them, Fusion (Att L ,Att R ) is the fusion feature, Att L With Att R are the first attention score and the second attention score, respectively, and W o is the preset weight matrix, b is the preset bias parameter; After the fusion feature is input into the Bi-LSTM layer and the CRF layer for processing, the named entity recognition result is finally outputted.

7. The Chinese named entity recognition device according to claim 6, characterized in that: The lattice structure generation module is used to generate a plurality of plane lattice structures according to the sentence to be recognized, specifically including: According to a preset dictionary, the sentence to be recognized is segmented to obtain a plurality of character strings, and the plurality of character strings are respectively filled into a plurality of grids to obtain the plurality of grid structures; wherein the character string includes a single character or a word composed of a plurality of the single characters obtained by matching the preset dictionary; The plurality of lattice structures are flattened to obtain the plurality of planar lattice structures.

Citation Information

Patent Citations

  • Chinese semantic information extraction method and device based on long-short-term memory network of bidirectional lattice structure

    CN111444726A

  • Chinese named entity recognition method and device for dynamically fusing dictionary information

    CN113988074A

  • Traditional Chinese medicine text named entity recognition method based on vocabulary enhancement

    CN115906857A

  • Named entity recognition method, apparatus, and computer-readable recording medium

    EP3767516A1