Named entity recognition method fusing Chinese character features and word pair relation

By integrating Chinese character features and word pair relationships, we solve the problem of nested and discontinuous entity recognition in Chinese texts, improve the performance of named entity recognition, make up for the lack of pre-trained language models in glyph and pinyin features, and achieve Efficient extraction of nested and discontinuous entities.

CN118734853AInactive Publication Date: 2024-10-01ANHUI NORMAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410878469.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-02
Publication Date
2024-10-01
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing technologies are difficult to handle nested and discontinuous entities in Chinese text, and pre-trained language models such as BERT lack the glyph and pinyin features of Chinese characters, resulting in a decline in named entity recognition performance.

Method used

A named entity recognition method is designed that integrates Chinese character features and word pair relationships. It uses different fonts to vectorize Chinese character graphics, pinyin embedding and CNN models to extract pinyin features, and combines BERT and LSTM models for encoding to build a word pair grid. and multi-granularity convolution modules to extract semantic information, and finally calculate word pair relationships through the MLP model to decode common, nested and discontinuous entities.

Benefits of technology

It improves the model's ability to extract nested and discontinuous entities, solves the problem of difficulty in processing nested and discontinuous entities in traditional named entity recognition, and makes up for the lack of glyph and pinyin features of the pre-trained language model, improving Semantic understanding ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118734853A_ABST
    Figure CN118734853A_ABST
Patent Text Reader

Abstract

The invention relates to the field of Chinese character text recognition, and discloses a named entity recognition method fusing Chinese character features and word pair relationships, which comprises the following steps: keeping character embedding consistent with original BERT without any modification; performing 24 * 24 pattern vectorization on each Chinese character, splicing the Chinese characters, flattening the Chinese characters, and sending the Chinese characters into a font fusion layer to obtain a font embedding vector; for pinyin embedding, an open-source PyPinyin packet is used for converting an input character sequence into a corresponding pinyin sequence, and the pinyin sequence of each character is composed of a Roman character and four tones; character embedding, font embedding and pinyin embedding are spliced together and sent to a fusion layer; according to the method, fusion embedding, position embedding and fragment embedding are added to form input of the BERT model, and the method has the advantages that the problem of deficiency of Chinese character feature information is solved, and the ability of the model to process nesting and discontinuous entities is enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Chinese character text recognition, and in particular to a named entity recognition method integrating Chinese character features and word pair relationships. Background Art

[0002] Natural Language Processing (NLP) is an interdisciplinary subject between artificial intelligence and linguistics, which aims to process natural language through computer intelligence. The goal of intelligence is to enable machines to understand human language, imitate human thinking, and achieve smooth communication between humans and machines. Faced with huge unstructured text data, one of its tasks is to mine useful information from it, reconstruct it into orderly structured information, and then extract it into specific events or factual information. This process is called information extraction. Among them, an important type of information is entity, and the corresponding information extraction task is called named entity recognition (NER). As a key natural language processing task, named entity recognition aims to identify named entities with specific meanings in text and classify them into predefined entity types. Academically, the research subjects of named entity recognition generally include three major categories (entity class, time class and number class) and seven subcategories (names, place names, organization names, time, date, currency and percentage) of named entities. In the era of big data, accurately and efficiently extracting key information from massive unstructured or semi-structured data is one of the foundations of NLP tasks. Named entities usually carry rich semantic information and are closely linked to key information in the data. The NER task plays a key role in solving the problem of information overload in Internet text data. It can effectively obtain key information and is widely used in fields such as relationship extraction, machine translation, and knowledge graph construction.

[0003] As a typical symbolic language, Chinese characters contain certain semantic information in addition to the characters themselves. The structure and pronunciation of the characters also contain additional text semantic information. However, the original pre-trained language models such as BERT lack the glyph and phonetic features of Chinese characters. At the same time, traditional named entity recognition models usually use CRF for decoding, and this sequence annotation method is difficult to handle nested and discontinuous entities in the text.

[0004] In order to solve the problem that nested entities and discontinuous entities in Chinese text are difficult to extract, the present invention will design a named entity recognition model that integrates Chinese character features and word pair relationships, so that the model has better performance when processing Chinese text with nested and discontinuous entities. Summary of the invention

[0005] 1. Technical issues to be solved

[0006] In view of the deficiencies in the prior art, the present invention provides a named entity recognition method that integrates Chinese character features and word pair relationships, which makes up for the lack of Chinese character feature information, enhances the model's ability to handle nested and discontinuous entities, and solves the problems in the above-mentioned background technology.

[0007] (II) Technical solution

[0008] In order to achieve the above-mentioned purpose of making up for the lack of Chinese character feature information and enhancing the model's ability to handle nested and discontinuous entities, the present invention provides the following technical solutions: a method for named entity recognition that integrates Chinese character features and word pair relationships, including character embedding that is consistent with the original BERT without any modification; three different open source fonts are used for glyph embedding, namely Fangsong, Kaishu and Lishu, and each Chinese character is vectorized into a 24*24 graphic, which is then spliced ​​and flattened, and sent to a glyph fusion layer to obtain a glyph embedding vector; for pinyin embedding , use the open source PyPinyin package to convert the input character sequence into the corresponding pinyin sequence. The pinyin sequence of each character consists of Roman characters and four tones. The pinyin sequence is initially embedded, and the CNN model is used for convolution and maximum pooling to obtain the final pinyin embedding; the character embedding, glyph embedding and pinyin embedding are spliced ​​together and sent to a fusion layer, and its dimension is controlled to 768 dimensions to obtain the final fused embedding containing glyph features and pinyin features; the fused embedding is added to the position embedding and fragment embedding to form the input of the BERT model.

[0009] According to the above technical solution, the input of the BERT model includes a word vector embedded with glyph and pinyin features, which passes through the encoding layer and is encoded by the BERT and LSTM modules to form a word vector containing deep semantic information; the word vector is sent to the convolution module and converted into a character embedding represented by a word pair grid through conditional layer normalization. When constructing the word pair grid, according to the input style of the BERT model, a distance embedding is constructed to represent the distance between two words in the word pair, and a region embedding is used to distinguish the upper triangle and the lower triangle of the grid; the three grid vectors are concatenated and sent to the multi-granularity convolution module, and a plurality of different convolution kernels are used for convolution in the multi-granularity convolution module so that the model can extract semantic information; the word vector is sent to the MLP model for relationship score calculation, and finally a classification diagram of word pair relationships is obtained; the decoding part of the model uses two relationships, the next adjacent word of the current word and the tail word, to decode ordinary entities, nested entities and discontinuous entities.

[0010] According to the above technical solution, the word vector embedded with glyph and pinyin features passes through the encoding layer, and is encoded by the BERT and LSTM modules to form a word vector containing deep semantic information. Specifically, the text is converted into glyph features and pinyin features, and the glyph embedding and pinyin embedding are fused. The fused embedding represents the comprehensive feature vector of each Chinese character. The fused word vector is processed through the encoding layer, and the word vector after the encoding layer is input into the BERT model. The BERT model contextually encodes the input word vector through its bidirectional Transformer structure to generate a deep context-related word vector representation. The word vector output from BERT is further input into the LSTM module.

[0011] According to the above technical solution, the word vector is sent to the convolution module and converted into a character embedding of a word pair grid representation through conditional layer normalization. When constructing the word pair grid, according to the input style of the BERT model, a distance embedding is constructed to represent the distance between two words in the word pair, and a region embedding is used to distinguish the upper triangle and the lower triangle of the grid. Specifically, the word vector encoded by BERT and LSTM is sent to a convolutional neural network (CNN) module. CNN can further extract and transform the input word vector. Conditional layer normalization is applied in the convolution module. The normalization process is adjusted by introducing conditional information. The features output from the convolution module are normalized through the conditional layer, and the obtained features are used to construct the word pair grid representation. The distance embedding and the region embedding are integrated with the features after conditional layer normalization. The integrated word pair feature vectors form a word pair grid matrix.

[0012] According to the above technical solution, the three grid vectors are sent to the multi-granularity convolution module after splicing. In the multi-granularity convolution module, multiple different convolution kernels are used for convolution so that the model can extract semantic information. Specifically, the three grid vectors are spliced, and the spliced ​​grid vectors are sent to the multi-granularity convolution module. The multi-granularity convolution module uses multiple convolution kernels of different sizes for convolution operation. Each convolution kernel generates a set of feature maps. The convolution operation can be expressed as:

[0013]

[0014] Among them, A represents the feature map generated by convolution, B represents the input spliced ​​grid vector, and C represents the convolution kernel. The feature maps generated by multiple convolution kernels of different granularities are fused, and they are merged into an overall feature vector through connection operations. The fused feature vector forms a multi-granularity feature representation.

[0015] According to the above technical solution, the MLP model is fed to calculate the relationship score, and the classification diagram of the word pair relationship is finally obtained. Specifically, the fused feature vector output by the multi-granularity convolution module is fed into the multi-layer perceptron (MLP) model. The MLP model is a neural network composed of several fully connected layers. Each layer performs linear transformation and nonlinear activation on the input features. The MLP is composed of multiple fully connected layers, each of which includes a linear transformation and a nonlinear activation function. Each layer of the MLP can be expressed as:

[0016] h t =σ(W t h t-1 +b t )

[0017] Among them, h t represents the output feature vector of the tth layer, W t and b t are the weight matrix and bias vector of the tth layer, respectively, and σ is the activation function; the last layer of MLP outputs a score vector to represent the relationship score between word pairs, and the output layer can be expressed as:

[0018] y=W out h L +b out

[0019] Among them, y represents the output relationship score vector, W out and b out They represent the weight matrix and bias vector of the output layer respectively, and represent the output feature vector of the last layer of MLP; according to the output relationship score vector y, the relationship of each word pair is classified, and for each word pair, the relationship category to which it belongs is determined according to the maximum value of its relationship score, and then these category information is filled into the word pair network.

[0020] According to the above technical solution, the decoding part of the model uses the next adjacent word and the tail word of the current word to decode common entities, nested entities and discontinuous entities. Specifically, the common entity decoding finds the relationship between each word and its next adjacent word from the word pair relationship classification diagram output by the model, and traverses each word w i , if w i and w i+1 The relationship between is continuous, then w i and w i+1 Merge into the current entity. If the relationship does not indicate continuity, end the construction of the current entity and start a new entity. Nested entity decoding is the same as ordinary entity decoding. From the word pair relationship classification diagram output by the model, find the relationship between each word and its next adjacent word. In the process of constructing ordinary entities, if the current word w is found i and the previous word wi-1 and the next word w i+1 If there is a relationship between them, it means there are nested entities. By checking w i and w i-1 and w i and w i+1 The relationship between i Whether it is the beginning or end of a nested entity, merge the nested entity into its parent entity; Discontinuous entity decoding From the word pair relationship classification diagram output by the model, find the relationship between each word and the tail word, and traverse each word w i , if w i and w j The relationship between represents a connection, then w i and w j As parts of a discontinuous entity, merge all these parts to form the complete discontinuous entity.

[0021] According to the above technical solution, the named entity recognition system integrating Chinese character features and word pair relationships is characterized by comprising:

[0022] Feature fusion module: The acquired glyph and pinyin features are fused with the character features of the text, and the fused word vector is transformed through dimension conversion to control its dimension to 768 dimensions (the dimension of BERT input);

[0023] Encoding module: obtains the context word vector in the input sentence based on BERT and Bi-LSTM models;

[0024] Convolutional module: used to establish word pair relationships and further extract semantic information for subsequent word-word relationship classification;

[0025] Decoding module: Through the NNW and THW relationships, entities in the text can be effectively extracted from the word pair relationship classification graph;

[0026] Prediction module: obtains prediction results through iterative training.

[0027] (III) Beneficial effects

[0028] Compared with the prior art, the present invention provides a named entity recognition method integrating Chinese character features and word pair relationships, which has the following beneficial effects:

[0029] This named entity recognition method that integrates Chinese character features and word pair relationships, first, in the input stage of the model, by integrating the character and pinyin features of Chinese characters into the model for training, the model's ability to understand semantics is improved, and the problem of pre-trained language models such as BERT lacking in character shape and pinyin is solved; secondly, in the decoding stage of the model, by constructing a model structure of word pair relationships, the nested entities and discontinuous entities in the text can be effectively extracted, solving the problem that nested entities and discontinuous entities are difficult to handle in traditional entity extraction tasks. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 It is a framework diagram of the present invention integrating Chinese character feature information;

[0031] Figure 2 It is the main framework diagram of the model of the present invention;

[0032] Figure 3 This is a decoding example diagram. DETAILED DESCRIPTION

[0033] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0034] See also Figure 1-2 The present invention provides a technical solution: a method for named entity recognition that integrates Chinese character features and word pair relationships, including character embedding that is consistent with the original BERT without any modification; using three different open source fonts for glyph embedding, namely Fangsong, Kaishu and Lishu, respectively performing 24*24 graphic vectorization on each Chinese character, then splicing and flattening them, and sending them to a glyph fusion layer to obtain a glyph embedding vector; for pinyin embedding, using the open source PyPinyin package to convert the input character sequence into a corresponding pinyin sequence, the pinyin sequence of each character consists of Roman characters and four tones, performing initial embedding on the pinyin sequence, and using a CNN model for convolution and maximum pooling to obtain a final pinyin embedding; splicing the character embedding, glyph embedding and pinyin embedding together, sending them to a fusion layer, controlling their dimension to 768 dimensions, and obtaining a final fused embedding containing glyph features and pinyin features; adding the fused embedding to the position embedding and the fragment embedding to form the input of the BERT model.

[0035] The input of the BERT model includes word vectors embedded with glyph and pinyin features. Through the encoding layer, they are encoded by two modules, BERT and LSTM, to form word vectors containing deep semantic information. The word vectors are fed into the convolutional module, and through conditional layer normalization, they are converted into character embeddings represented by a word pair grid. When constructing the word pair grid, according to the input style of the BERT model, distance embeddings are constructed to represent the distance between the two words in the word pair, and region embeddings are used to distinguish the upper triangular and lower triangular parts of the grid. After the three grid vectors are concatenated, they are fed into the multi-granularity convolutional module, where multiple different convolutional kernels are used for convolution so that the model can extract semantic information. Then it is fed into the MLP model for relationship score calculation, and finally a classification graph of word pair relationships is obtained. In the decoding part of the model, two relationships, the next adjacent word and the head and tail words of the current word, are used to decode ordinary entities, nested entities, and discontinuous entities.

[0036] Taking the discontinuous entity "bladder and renal colic" in medical texts as an example, in the upper triangular part, the word "bladder" on the horizontal axis corresponds to the word "cyst" on the vertical axis; the word "cyst" on the horizontal axis corresponds to the word "pain" on the vertical axis; it means that the next adjacent word of "bladder" is "cyst", and the next adjacent word of "cyst" is "pain"; in the lower triangular part, the word "pain" on the horizontal axis corresponds to the word "bladder" on the vertical axis, indicating that there is an entity, the last word is "pain", and the first word is "bladder"; thus, it can be decoded that the text contains the entity "bladder pain", and in the same way, the entity "renal colic" can be decoded. The same is true for nested entities and ordinary entities.

[0037] It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device.

[0038] Although the embodiments of the present invention have been shown and described, for those of ordinary skill in the art, it can be understood that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A named entity recognition method integrating Chinese character features and word pair relationships, characterized in that: The following steps are involved: S1: character embeddings remain the same as the original BERT without any modification; S2: Three different open source fonts are used for glyph embedding, namely Fangsong, Kaishu and Lishu. Each Chinese character is vectorized into a 24*24 graphic, then concatenated and flattened, and sent to a glyph fusion layer to obtain the glyph embedding vector; S3: For pinyin embedding, the open source PyPinyin package is used to convert the input character sequence into the corresponding pinyin sequence. The pinyin sequence of each character consists of a Roman character and four tones. The pinyin sequence is initially embedded, and the CNN model is used for convolution and maximum pooling to obtain the final pinyin embedding; S4: concatenate the character embedding, glyph embedding and pinyin embedding together and send them to a fusion layer, controlling its dimension to 768 dimensions, and finally obtaining the fusion embedding containing glyph features and pinyin features; S5: Add the fused embedding to the position embedding and the fragment embedding to form the input of the BERT model.

2. A method for named entity recognition integrating Chinese character features and word pair relationships according to claim 1, characterized in that: The input of the BERT model, The following steps are involved: S1: The word vector embedded with the glyph and phonetic features passes through the encoding layer and is encoded by the BERT and LSTM modules to form a word vector containing deep semantic information; S2: The word vectors are fed into the convolutional module and converted into character embeddings represented by word pair grids through conditional layer normalization. When constructing the word pair grid, according to the input style of the BERT model, distance embedding is constructed to represent the distance between two words in the word pair, and region embedding is used to distinguish the upper and lower triangular parts of the grid; S3: The three grid vectors are concatenated and sent to the multi-granularity convolution module, where multiple different convolution kernels are used for convolution so that the model can extract semantic information; S4: Send it to the MLP model to calculate the relationship score, and finally obtain the classification diagram of word pair relationships; S5: The decoding part of the model uses two relationships: the next adjacent word of the current word and the tail word, and can decode common entities, nested entities, and discontinuous entities.

3. A method for named entity recognition integrating Chinese character features and word pair relationships according to claim 2, characterized in that: The S1 is specifically: The text is converted into glyph features and pinyin features, and the glyph embedding and pinyin embedding are fused. The fused embedding represents the comprehensive feature vector of each Chinese character. The fused word vector is processed by the encoding layer and input into the BERT model. The BERT model uses its bidirectional Transformer structure to contextually encode the input word vector and generate a deep context-related word vector representation. The word vector output from BERT is further input into the LSTM module.

4. A method for named entity recognition integrating Chinese character features and word pair relationships according to claim 2, characterized in that: The S2 is specifically: The word vectors encoded by BERT and LSTM are sent to the convolutional neural network (CNN) module. CNN can further extract and transform the input word vectors. Conditional layer normalization is applied in the convolution module. The normalization process is adjusted by introducing conditional information. The features output from the convolution module are normalized by the conditional layer. The obtained features are used to construct the word pair grid representation. The distance embedding and regional embedding are integrated with the features after conditional layer normalization. The integrated word pair feature vectors form a word pair grid matrix.

5. A method for named entity recognition integrating Chinese character features and word pair relationships according to claim 2, characterized in that: The S3 is specifically: The three grid vectors are concatenated and sent to the multi-granularity convolution module. The multi-granularity convolution module uses multiple convolution kernels of different sizes for convolution operations. Each convolution kernel generates a set of feature maps. The convolution operation can be expressed as: Among them, A represents the feature map generated by convolution, B represents the input spliced ​​grid vector, and C represents the convolution kernel. The feature maps generated by multiple convolution kernels of different granularities are fused, and they are merged into an overall feature vector through connection operations. The fused feature vector forms a multi-granularity feature representation.

6. A method for named entity recognition integrating Chinese character features and word pair relationships according to claim 2, characterized in that: The S4 is specifically: The fused feature vector output by the multi-granularity convolution module is fed into the multi-layer perceptron (MLP) model. The MLP model is a neural network composed of several fully connected layers. Each layer performs linear transformation and nonlinear activation on the input features. The MLP consists of multiple fully connected layers, each of which includes linear transformation and nonlinear activation functions. Each layer of the MLP can be expressed as: h t =σ(W t h t-1 +b t ) Among them, h t represents the output feature vector of the tth layer, W t and b t are the weight matrix and bias vector of the tth layer, and σ is the activation function; The last layer of MLP outputs a score vector to represent the relationship score between word pairs. The output layer can be expressed as: y=W out h L +b out Among them, y represents the output relationship score vector, W out and b out Represent the weight matrix and bias vector of the output layer respectively, h L Represents the output feature vector of the last layer of MLP; According to the output relationship score vector y, the relationship of each word pair is classified. For each word pair, the relationship category to which it belongs is determined according to the maximum value of its relationship score, and then these category information is filled into the word pair network.

7. A method for named entity recognition integrating Chinese character features and word pair relationships according to claim 2, characterized in that: The S5 is specifically: Common entity decoding finds the relationship between each word and its next adjacent word from the word pair relationship classification graph output by the model, traversing each word w i , if w i and w i+1 The relationship between is continuous, then w i and w i+1 Merge into the current entity. If the relationship does not indicate continuity, end the construction of the current entity and start a new entity. Nested entity decoding is the same as ordinary entity decoding. From the word pair relationship classification diagram output by the model, the relationship between each word and its next adjacent word is found. In the process of constructing ordinary entities, if the current word w i and the previous word w i-1 and the next word w i+1 If there is a relationship between them, it means there are nested entities. By checking w i and w i-1 and w i and w i+1 The relationship between i Whether it is the beginning or end of a nested entity, merge the nested entity into its parent entity; Discontinuous entity decoding finds the relationship between each word and the tail word from the word pair relationship classification diagram output by the model, and traverses each word w i , if w i and w j The relationship between represents a connection, then w i and w j As parts of a discontinuous entity, merge all these parts to form the complete discontinuous entity.

8. A named entity recognition system integrating Chinese character features and word pair relationships, characterized in that: include: Feature fusion module: The acquired glyph and pinyin features are fused with the character features of the text, and the fused word vector is transformed through dimension conversion to control its dimension to 768 dimensions (the dimension of BERT input); Encoding module: obtains the context word vector in the input sentence based on BERT and Bi-LSTM models; Convolutional module: used to establish word pair relationships and further extract semantic information for subsequent word-word relationship classification; Decoding module: Through the NNW and THW relationships, entities in the text can be effectively extracted from the word pair relationship classification graph; Prediction module: obtains prediction results through iterative training.