Chinese entity recognition model and method based on vocabulary enhancement and character external information
The Chinese entity recognition model, which dynamically adjusts weights through a dual-path encoding structure and attention mechanism, solves the problem that existing methods fail to fully utilize the external information of Chinese characters, thereby improving the accuracy and generalization ability of Chinese named entity recognition.
Patent Information
- Application Number
- CN202411501310.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2044-10-25
AI Technical Summary
Existing Chinese named entity recognition methods fail to fully utilize the external information of Chinese characters, such as strokes and pinyin, and ignore the correlation between characters and words in different contexts, resulting in insufficient recognition accuracy and generalization ability.
A Chinese entity recognition model based on lexical enhancement and character extrinsic information is adopted. The model effectively integrates the lexical information, pinyin information and component information of Chinese characters through a dual-path encoding structure, and uses an attention mechanism to dynamically adjust the weight of matching words to improve the semantic expression and generalization ability of the model.
It improves the accuracy and generalization ability of Chinese named entity recognition, optimizes the boundary recognition effect, and significantly improves the recognition accuracy, especially in complex text environments.
Smart Images

Figure CN119398054B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the fields of artificial intelligence and natural language processing, and mainly involves Chinese named entity recognition. Specifically, it is a Chinese entity recognition model and method based on lexical enhancement and character external information, which is used to extract Chinese entities such as personal names, place names, and organization names from unstructured input text. It has wide applications in many fields such as intelligent customer service, intelligent recommendation, and intelligent question answering. Background Technology
[0002] Named Entity Recognition (NER) aims to detect entities in sentences and identify predefined types, such as names of people, places, and organizations. NER is fundamental to many downstream Natural Language Processing (NLP) problems, such as knowledge graphs, information retrieval, question answering systems, and machine translation. Chinese, as one of the world's most widely spoken languages, plays an increasingly important role in international communication, business exchanges, and cultural dissemination. The widespread use of the internet has brought a massive amount of Chinese text data, including social media posts, news reports, and academic articles. Chinese named entity recognition technology can extract key information from this data, helping users quickly find the content they need, thereby improving the efficiency of information retrieval and processing.
[0003] Early named entity recognition methods primarily relied on manually written rules and dictionaries to match named entities in text. However, these rules are often strongly correlated with the domain, language, and text style, and the creation of rules and dictionaries depends on expert knowledge and is extremely time-consuming. Furthermore, such systems have poor portability and are not suitable for cross-scenario use.
[0004] Statistical methods transform the NER task into a sequence labeling task and train the model using a manually labeled corpus. The cost of data labeling is far lower than the cost of designing rules, and statistical methods are general-purpose, requiring minimal manually designed rules. Before the explosion of deep learning, they gradually became the mainstream approach. Commonly used statistical models include Conditional Random Fields, Hidden Markov Models, and Maximum Entropy Models. However, statistical methods rely on manually designed features, such as part-of-speech tags and glyph features, which require domain experts' knowledge and experience. Incorrect feature design can severely impact model performance.
[0005] In recent years, deep learning has achieved remarkable breakthroughs in the field of NLP. When applying deep learning to named entity recognition, deep learning can learn complex hidden representations without the need for complex feature engineering and rich domain knowledge. In addition, the named entity recognition method based on deep learning has stronger generalization and is more general. Therefore, the named entity recognition method based on deep learning is more widely used and has higher recognition accuracy compared with traditional rule-based and statistic-based methods. There have been many studies on named entity recognition methods based on deep learning, but they mainly focus on English named entity recognition. Chinese named entity recognition is more difficult than English named entity recognition, which is mainly reflected in two aspects. First, the significant difference between Chinese and English is that the basic unit of Chinese is Chinese characters, while that of English is words, and Chinese does not have an obvious separator like spaces in English. Second, many entities in English have obvious features, that is, the first letter is capitalized. This makes the boundary recognition of Chinese entities more difficult, while the main task of English entity recognition focuses on identifying the types of entities.
[0006] Because Chinese lacks explicit delimiters, early research often involved word segmentation before performing Chinese NER. However, errors in Chinese word segmentation can lead to misidentification of entity boundaries, impacting model performance. Recent NER methods are character-based, which can eliminate segmentation errors but also lose word information. In Chinese NER, word information and lexical boundary information are crucial. Some recent lexical augmentation-based NER methods utilize external dictionaries to supplement lost lexical information. By integrating lexical information from the dictionary into the character-level representation layer, NER models can more accurately capture entity information within the language. Zhang Y et al. proposed Lattice LSTM in their paper "Chinese NER using lattice LSTM" (Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). 2018: 1554-1564.). Lattice LSTM is the first method to extract latent word information from an external dictionary and incorporate it into a character-based Chinese named entity model, introducing word information without relying on word segmentation results and avoiding error propagation caused by word segmentation. R Ma et al. proposed SoftLexicon in their paper "Simplify the Usage of Lexiconin Chinese NER" (Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics. 2020: 5951-5960.). SoftLexicon integrates lexical information into character representations, thereby avoiding complex modeling structures. These methods of injecting word information into the model through an external dictionary have achieved promising results on several Chinese NER datasets. However, after integrating dictionary information into character representations, most existing methods neglect additional information about Chinese characters (such as stroke count and pinyin), which has been shown to improve the performance of Chinese NER models. How to effectively integrate this external information into the model is also a key issue. Furthermore, existing vocabulary-based augmentation methods directly use the frequency of matched words as their weights, failing to capture the different relationships between characters and words in different contexts.
[0007] Existing techniques compensate for the loss of lexical and word boundary information in character-based Chinese named entity methods by integrating external dictionary information. These methods often ignore additional information about Chinese characters (such as stroke count and pinyin), which can further enrich feature representations and greatly improve model performance. Furthermore, existing methods mostly rely on word frequency as weights, failing to fully capture the correlation between characters and words in different contexts. Summary of the Invention
[0008] The purpose of this invention is to overcome the shortcomings of existing technologies and propose a Chinese named entity recognition model and method based on lexical enhancement and character external information, which has higher recognition accuracy and stronger generalization ability.
[0009] This invention is a Chinese entity recognition model based on vocabulary enhancement and character extrinsic information. It is characterized by the sequential connection of a Chinese character information extraction section, a Chinese character feature extraction section containing dynamically matched word features, a dual-channel encoder section for enhanced character embedding and component embedding, and a decoding output section. The Chinese character information extraction section includes a character extraction module, and based on the character extraction module, it further includes a matched word extraction module, a pinyin extraction module, and a component extraction module. The Chinese character feature extraction section containing dynamically matched word features includes a character feature extraction module, a dynamically matched word feature extraction module, a pinyin feature extraction module, and a component feature extraction module. The character feature extraction module uses the output of the character extraction module in the Chinese character information extraction section as input to obtain character embeddings. The dynamically matched word feature extraction module first uses the output of the Chinese character information extraction section... The outputs of the matching word extraction module and the character extraction module are used as input, and then the dynamic matching word feature embedding is obtained by weighted summation of each matching word embedding based on the attention mechanism. The pinyin feature extraction module uses the output of the pinyin extraction module in the Chinese character information extraction part as input to extract pinyin feature embedding. The component feature extraction module uses the output of the component extraction module in the Chinese character information extraction part as input to extract component feature embedding. The dual-channel encoder part of the enhanced character embedding and component embedding includes two branches, which are used to encode the context features of component embedding and the context features of enhanced character embedding that fuse dynamic matching word features and pinyin features, respectively. Then, the component context features and enhanced character context features are concatenated as the dual-channel encoder output. The decoding output part is used to decode the encoder output to obtain the optimal label sequence.
[0010] This invention is also a Chinese entity recognition method based on lexical enhancement and character extrinsic information, implemented on any of the Chinese entity recognition models based on lexical enhancement and character extrinsic information as described in claims 1-2, characterized by comprising the following steps:
[0011] (1) Data cleaning: Receive the original Chinese input text, split the excessively long text into several short sentences and remove illegal characters and Unicode characters to complete the data cleaning and obtain the cleaned sentences;
[0012] (2) Chinese character feature extraction with dynamic matching word features: Extract multiple features from the cleaned input sentence, including character features, dynamic matching word features, pinyin features, and component features; character feature extraction involves inputting the cleaned sentence into the BERT model to obtain the feature embeddings of each character; dynamic matching word feature extraction first involves matching each character with an external dictionary to obtain matching words, calculating the dynamic weights of each matching word based on the matching word embeddings and character feature embeddings, and then weighted summing the matching word embeddings to obtain the final dynamic matching word feature embedding; pinyin feature extraction involves obtaining the pinyin of each Chinese character in the input sentence, extracting and obtaining pinyin feature embeddings using a convolutional neural network; character feature embeddings, dynamic matching word feature embeddings, and pinyin feature embeddings are concatenated sequentially to obtain enhanced character embeddings; when extracting component features, each Chinese character in the input sentence is first decomposed to obtain the components that make up the Chinese character, and then a convolutional neural network is used to extract and obtain component feature embeddings, thus completing the Chinese character feature extraction with dynamic matching word features;
[0013] (3) Dual-path encoding of enhanced character embedding and component embedding: Two bidirectional gated recurrent units (Bi-GRUs) are used to extract the context features of enhanced character embedding and Chinese character component embedding; the character embedding, dynamic matching word feature embedding, and pinyin embedding are concatenated to obtain the enhanced character embedding and input into one Bi-GRU to extract the context representation of the enhanced character embedding; the Chinese character component embedding representation is input into another Bi-GRU to extract the context representation of the component embedding, and the component context representation and the enhanced character context representation are concatenated to complete the dual-path encoding of enhanced character embedding and component embedding;
[0014] (4) Decoding output: The linear chain conditional random field (CRF) is selected as the decoder. The encoded context representation that integrates Chinese character information, matching word information, pinyin information and component information is input into the CRF for decoding. The CRF will output the label sequence with the highest score. Based on the label sequence, the entities in the sentence are extracted to complete the decoding output.
[0015] This invention addresses the problems of existing methods failing to fully utilize the external information of Chinese characters and relying solely on word frequency to determine the static weights of matching words. This invention fully utilizes the external information of Chinese characters and improves vocabulary enhancement through dynamic weights, thereby increasing the accuracy of Chinese named entity recognition.
[0016] This invention proposes a dual-path encoding structure that effectively integrates lexical, pinyin, and component information of Chinese characters into the model, greatly enriching the semantic expression of character-based Chinese named entity recognition and solving the problem that existing methods fail to fully utilize the external information of Chinese characters. Furthermore, this invention employs an attention mechanism when introducing lexical information, dynamically adjusting the weights of matching words by calculating the relevance between characters and matching words. Compared to existing methods that rely solely on word frequency to determine static weights for matching words, this invention offers more flexible and reasonable weight allocation, treating each matching word more evenly and avoiding an overemphasis on high-frequency words, thereby improving the model's generalization ability and recognition accuracy.
[0017] Compared with the prior art, the present invention has the following advantages:
[0018] Higher accuracy: This invention integrates pinyin, component and vocabulary information into the character feature extraction process; and adopts a novel dual-path encoding fusion strategy, using two parallel modules to process enhanced character representation and Chinese character component embedding respectively in the context encoding process, which optimizes the boundary recognition effect of Chinese named entity recognition and effectively improves the recognition accuracy of the model in complex text environments.
[0019] Enhancing Model Generalization Ability: This invention employs an attention mechanism to extract dynamic matching word features. By calculating the correlation between characters and matching words, the weights of matching words are dynamically adjusted. These dynamic weights are flexibly adjusted according to the specific context. This allows the Chinese entity recognition model of this invention to better capture the different associations between characters and words in different contexts, while also treating each matching word more evenly and accurately, avoiding an overemphasis on high-frequency words in weight allocation, thus further improving the model's generalization ability and recognition accuracy. Attached Figure Description
[0020] Figure 1 This is a block diagram of the model of the present invention;
[0021] Figure 2 This is a structural diagram of the model of the present invention;
[0022] Figure 3 This is a flowchart of the present invention;
[0023] Figure 4 This is a flowchart of the present invention;
[0024] Figure 5 Diagram of the convolutional neural network architecture used to extract pinyin / component features. Detailed Implementation
[0025] Example 1
[0026] Existing methods for Chinese named entity recognition based on lexical augmentation, after integrating dictionary information into character representations, mostly neglect more external information about Chinese characters, resulting in insufficient accuracy and robustness. This is because the entity recognition models fail to fully utilize the rich information such as the structure and pronunciation of Chinese characters, lacking an understanding of the character structure itself. Existing lexical augmentation methods directly use the frequency of matching words as their weights, failing to capture the different relationships between characters and words in different contexts, which may result in the loss of important semantic information and affect the overall understanding of the text. This invention addresses the above problems by analyzing and researching, and proposes a Chinese entity recognition model and method based on lexical augmentation and external character information.
[0027] This invention is firstly a Chinese entity recognition model based on lexical enhancement and character extrinsic information, see [link to relevant documentation]. Figure 1 , Figure 1This is a model block diagram of the present invention. The Chinese entity recognition model of the present invention is sequentially connected to a Chinese character information extraction part, a Chinese character feature extraction part containing dynamic matching word features, a dual-channel encoder part for enhanced character embedding and component embedding, and a decoding output part. The Chinese character information extraction part of the present invention includes a character extraction module, and based on the character extraction module, it also includes a matching word extraction module, a pinyin extraction module, and a component extraction module. The Chinese character feature extraction part containing dynamic matching word features of the present invention includes a character feature extraction module, a dynamic matching word feature extraction module, a pinyin feature extraction module, and a component feature extraction module. The character feature extraction module uses the output of the character extraction module in the Chinese character information extraction part as its input to obtain character embeddings. The dynamic matching word feature extraction module first uses the output of the matching word extraction module in the Chinese character information extraction part and the output of the character extraction module as input, and then uses an attention mechanism to weighted sum the embeddings of each matching word to obtain the final dynamic matching word feature embedding. The dynamic weights employed in this invention can better capture the different associations between characters and words in different contexts, and can treat each matched word more evenly and accurately. Compared with the static weights used in most current Chinese entity recognition methods, dynamic weights can avoid the situation where the weight allocation is overly biased towards high-frequency words, thus improving the model's generalization ability and recognition accuracy. The pinyin feature extraction module takes the output of the pinyin extraction module in the Chinese character information extraction part as input and uses a convolutional neural network to extract pinyin feature embeddings. Polyphonic characters are particularly common in Chinese, and pinyin feature embeddings make it easy to distinguish the different meanings of homophones. The component feature extraction module takes the output of the component extraction module in the Chinese character information extraction part as input and uses a convolutional neural network to extract component feature embeddings. Chinese characters are pictographic, and the structural information of Chinese characters, such as strokes and components, contains rich semantics. Integrating component feature embeddings into the Chinese entity recognition model of this invention can improve the model's semantic representation ability and enhance the understanding of the structure of Chinese characters themselves, thereby improving performance. The dual-path encoder for enhanced character embedding and component embedding in this invention comprises two branches: one for encoding the contextual features of component embedding and the other for encoding the contextual features of enhanced character embedding, which integrates dynamically matched word features and pinyin features. This helps the model to understand different types of input more deeply. The component contextual features and the enhanced character contextual features are then concatenated as the dual-path encoder output. Furthermore, the dual-path encoder allows for individual hyperparameter tuning for each branch, enabling more precise control of the model's learning process and improving model performance. The decoding output section is used to decode the encoder output to obtain the optimal label sequence.
[0028] The model proposed in this invention incorporates pinyin and component information, and uses a dual-path encoding structure to effectively integrate character, vocabulary, pinyin, and component information, thereby improving model accuracy. Furthermore, when incorporating vocabulary information, an attention mechanism is employed. By calculating the relevance between characters and matching words, each matching word can be treated more evenly, avoiding an overemphasis on high-frequency words and thus improving the model's generalization ability.
[0029] This invention proposes a Chinese entity recognition technology based on lexical enhancement and external character information, addressing the problems of existing methods failing to fully utilize external information of Chinese characters and lacking dynamic weight allocation when integrating external dictionary information, resulting in insufficient generalization ability. This invention is a holistic technical solution comprising a Chinese character information extraction part, a Chinese character feature extraction part containing dynamically matched word features, a dual-channel encoder part enhancing character embedding and component embedding, and a decoding output part, thereby improving the semantic representation ability and recognition accuracy of the Chinese entity recognition model.
[0030] Example 2
[0031] The overall structure of the Chinese entity recognition model based on lexical enhancement and character extrinsic information is the same as in Example 1. In the dynamic matching word feature extraction module, the final dynamic matching word feature embedding is obtained by weighted summation of the embeddings of each matching word. The dynamic attention weight α of each matching word is obtained by calculating the correlation between the character embedding and each matching word embedding through the attention mechanism. The calculation formula is as follows:
[0032]
[0033] Where x and y are character embedding and matched word embedding, respectively, and W Q and W K For learnable parameters, This is the scaling factor;
[0034] In this invention, to preserve segmentation information, matching words are divided into four groups (B, M, E, and S) according to the relationship between characters and matching words. In group B, the character is the first character of the matching word; in group M, the character appears in the middle of the matching word; in group E, the character is the last character of the matching word; and in group S, the character and the matching word are equal. The weighted word embeddings of each group are obtained by weighted summation of the word embeddings of each group.
[0035]
[0036] in α ω It is the attention weight of the matched word ω, eω (ω) is the embedding representation of the matching word ω.
[0037] By concatenating the four sets of weighted word embeddings, we can obtain the final dynamic matching word embedding representation v. i The calculation formula is as follows:
[0038] v i ={v i (B); v i (M); v i (E); v i (S)}
[0039] Where v i (B), v i (M), v i (E), v i (S) represents the dynamic weighted word embeddings of the four sets of matching words: B, M, E, and S.
[0040] The dynamic weights used in this invention are calculated through an attention mechanism, combining the embedding of characters in a sentence with the relevance of matched words, and can flexibly adjust the weights according to the specific context. Therefore, the Chinese entity recognition model of this invention can better capture the different associations between characters and words in different contexts, improving recognition accuracy. In addition, the dynamic weights of this invention avoid the situation where the weight allocation is overly biased towards high-frequency words, improving the generalization ability of the model.
[0041] Example 3
[0042] This invention also provides a Chinese entity recognition method based on lexical enhancement and character extrinsic information. It is implemented on any of the aforementioned Chinese entity recognition models based on lexical enhancement and character extrinsic information, which are the same as those in Examples 1-2. See also... Figure 3 , Figure 3 The flowchart of this invention includes the following steps:
[0043] (1) Data cleaning: Receive the original Chinese input text, split the excessively long text into several short sentences and remove illegal characters, Unicode characters, etc., to complete the data cleaning and obtain the cleaned sentences.
[0044] This invention segments long texts into shorter sentences during data cleaning, helping the model focus more on local context and improving processing efficiency and accuracy. Illegal characters and Unicode characters can interfere with the model's learning process, leading to reduced recognition accuracy, and therefore also need to be removed.
[0045] (2) Chinese character feature extraction with dynamic matching word features: Extracting multiple features from the cleaned input sentence, including character features, dynamic matching word features, pinyin features, and component features. Character feature extraction involves inputting the cleaned sentence into the BERT model to obtain the feature embeddings of each character. Dynamic matching word feature extraction first involves matching each character with an external dictionary to obtain matching words. Based on the matching word embeddings and character feature embeddings, the dynamic weights of each matching word are calculated, and the weighted sum of the matching word embeddings is used to obtain the final dynamic matching word feature embedding. The dynamic weight mechanism used in this invention can more effectively capture the correlation between characters and words in different contexts. Compared with the static weights used in most current Chinese entity recognition methods, dynamic weights avoid excessive bias towards high-frequency words, improving the model's generalization ability and recognition accuracy. Polyphonic characters are particularly common in Chinese. Based on pinyin feature embedding, it is easy to distinguish the different meanings of homophones. Integrating pinyin feature embedding into the Chinese entity recognition model of this invention can improve the model's entity recognition ability in texts with polyphonic characters. Extracting pinyin features involves obtaining the pinyin of each Chinese character in the input sentence and using a convolutional neural network to extract and obtain pinyin feature embeddings. The character feature embedding, dynamic matching word feature embedding, and pinyin feature embedding are sequentially concatenated to obtain the enhanced character embedding. Chinese characters are pictographic, and their strokes, components, and other structural information contain rich semantics. Integrating component feature embedding into the Chinese entity recognition model of this invention can improve the model's semantic representation ability and achieve performance improvement. When extracting component features, this invention first decomposes each Chinese character in the input sentence to obtain the components that make up the character, and then uses a convolutional neural network to extract and obtain component feature embeddings, completing the extraction of Chinese character features containing dynamic matching word features.
[0046] (3) Dual-path encoding of enhanced character embedding and component embedding: This invention uses two bidirectional gated recurrent units (Bi-GRUs) to extract contextual features of enhanced character embedding and Chinese character component embedding; the character embedding, dynamic matching word feature embedding, and pinyin embedding are concatenated to obtain the enhanced character embedding, which is then input into a Bi-GRU to extract the contextual representation of the enhanced character embedding. This invention uses two Bi-GRUs respectively to extract the contextual features of enhanced character embedding and Chinese character component embedding, which helps the model to understand different types of input more deeply. In addition, the dual-path encoder can adjust the hyperparameters of each Bi-GRU encoder individually, thereby controlling the model's learning process more precisely and improving model performance. The Chinese character component embedding representation is input into another Bi-GRU to extract the contextual representation of component embedding, and the component contextual representation and the enhanced character contextual representation are concatenated to complete the dual-path encoding of enhanced character embedding and component embedding.
[0047] See Figure 2 , Figure 2The diagram illustrates the structure of the Chinese entity recognition model of this invention. First, characters are extracted from the input sentence. Based on these characters, matching words, pinyin, and components are then obtained. Specifically, the component extraction module extracts the constituent components of Chinese characters, which are then processed by a convolutional neural network to obtain the component feature embeddings, which serve as the input to the first Bi-GRU in the dual-path encoding. In the matching word extraction module, matching words for the characters are obtained. The matching word feature extraction module uses the character embeddings and matching word embeddings as input, calculates the correlation between the character embeddings and matching word embeddings based on an attention mechanism as dynamic weights, and weighted sums of each matching word embedding to obtain the final dynamic matching word feature embedding. In the pinyin extraction module, the pinyin of the characters is obtained, processed by a convolutional neural network to obtain the pinyin feature embeddings, and then the character embeddings, dynamic matching word embeddings, and pinyin embeddings are sequentially concatenated to obtain an enhanced character embedding, which serves as the input to the other Bi-GRU in the dual-path encoding. In the Chinese entity recognition model of this invention, the character embedding serves both as a direct part of the enhanced character embedding and as input to the matching word extraction module in the calculation of dynamic matching word features.
[0048] (4) Decoding Output: This invention selects a linear chain conditional random field (CRF) as the decoder. CRF can effectively model the dependencies between labels, thereby improving recognition accuracy. The encoded context representation, which integrates Chinese character information, matching word information, pinyin information, and component information, is input into the CRF for decoding. The CRF will output the label sequence with the highest score. Based on the label sequence, entities in the sentence are extracted to complete the decoding output.
[0049] This invention proposes a Chinese entity recognition method based on lexical enhancement and external character information, addressing the shortcomings of existing methods in fully utilizing external information of Chinese characters, such as stroke information, pinyin information, and component information, as well as the lack of dynamic weight allocation when integrating external dictionary information, leading to insufficient generalization ability. This invention is a holistic technical solution, with a process including data cleaning, extraction of Chinese character features containing dynamically matched word features, dual-channel encoding of enhanced character embedding and component embedding, and decoding output. When extracting matched word features, this invention uses dynamic weights to weight the matched word embeddings. Dynamic weights better capture the different correlations between characters and words in different contexts, while treating each matched word more evenly and accurately. Compared to the static weights used in most current Chinese entity recognition methods, the dynamic weights used in this invention avoid the situation where weight allocation is overly biased towards high-frequency words, thus improving the model's generalization ability and recognition accuracy. When extracting Chinese character features, this invention extracts pinyin and component feature embeddings. Polyphonic characters are particularly common in Chinese, and pinyin feature embedding makes it easy to distinguish the different meanings of homophones. Integrating pinyin feature embedding into the Chinese entity recognition model of this invention improves the model's entity recognition ability in texts containing polyphonic characters. Chinese characters are pictographic, and the structural information of strokes, components, etc., of Chinese characters contains rich semantics. Integrating component feature embedding into the Chinese entity recognition model of this invention improves the model's semantic representation ability and achieves performance improvement. This invention uses a dual-channel encoding structure to extract contextual features for enhanced character embedding and contextual features for Chinese character component embedding. The dual-channel encoder can adjust hyperparameters individually for each Bi-GRU encoder, more precisely controlling the model's learning process and improving model performance.
[0050] Example 4
[0051] The Chinese entity recognition model and method based on vocabulary enhancement and character extrinsic information are the same as those in Examples 1-3. The Chinese character feature extraction in step (2) of this invention specifically includes:
[0052] 2.1) Character Feature Extraction: The cleaned sentence is input into the Chinese-BERT-wwm model to obtain the feature embeddings of each character. The Chinese-BERT-wwm model has been pre-trained on a large-scale Chinese corpus, possesses rich linguistic knowledge, and can effectively capture contextual information.
[0053] 2.2) Dynamic matching word feature extraction: See Figure 2This invention first performs string matching between each character and an external dictionary to obtain matching words for each character. Then, based on the relationship between characters and matching words, the matching words are divided into four groups: B, M, E, and S. Using an attention mechanism, the correlation between the character embedding and the embeddings of each matching word is calculated as the dynamic weight of the matching words. Then, the weighted word embeddings of each group of matching words are obtained by weighted summation. The four groups of weighted word embeddings are concatenated to obtain the final dynamic matching word feature embedding. The dynamic weights flexibly adjust the matching word weights according to the specific context. This invention's Chinese entity recognition model can better capture the different associations between characters and words in different contexts, and can treat each matching word more evenly and accurately, avoiding an overly biased weight allocation towards high-frequency words, further improving the model's generalization ability and recognition accuracy.
[0054] 2.3) Pinyin Feature Extraction: Polyphonic characters are particularly common in Chinese. Pinyin feature embedding makes it easy to distinguish the different meanings of homophones. Integrating pinyin feature embedding into the Chinese entity recognition model of this invention can improve the model's entity recognition ability in texts containing polyphonic characters. This invention first uses the PyPinyin tool to obtain the pinyin of each Chinese character in the input sentence, and then uses a convolutional neural network to extract and obtain the pinyin feature embedding.
[0055] 2.4) Component Feature Extraction: Chinese characters are pictographic, and the structural information of their strokes and components contains rich semantics. Embedding component features into the Chinese entity recognition model of this invention can improve the model's semantic representation ability and achieve performance improvement. This invention first decomposes each Chinese character in the input sentence to obtain the components that make up the characters, and then uses a convolutional neural network to extract and obtain component feature embeddings.
[0056] 2.5) See also Figure 5 , Figure 5 This is a diagram of the convolutional neural network architecture used to extract pinyin / component features. The convolutional neural network structures in pinyin feature extraction and component feature extraction are the same, both consisting of a one-dimensional convolutional layer, a max pooling layer, and a fully connected layer connected in sequence.
[0057] This invention extracts dynamic matching word features. Dynamic weights better capture the different relationships between characters and words in different contexts, while treating each matching word more evenly and accurately, avoiding overly biased weight allocation towards high-frequency words, thus improving the model's generalization ability and recognition accuracy. This invention also extracts pinyin and component features of Chinese characters. The pinyin and component information of Chinese characters contain rich semantics. Integrating pinyin and component features into the Chinese entity recognition model of this invention enhances the model's semantic representation ability and achieves performance improvements.
[0058] Example 5
[0059] The Chinese entity recognition model and method based on lexical enhancement and character extrinsic information are the same as those described in Step 2.2) of Examples 1-4, and include the following steps:
[0060] 2.2.1) Calculation of dynamic matching word weights: In step (2), the weighted summation of each matching word embedding yields the final matching word feature embedding. The dynamic attention weight α of each matching word is obtained by calculating the correlation between the character embedding and each matching word embedding through the attention mechanism. The calculation formula is as follows:
[0061]
[0062] Where x and y are character embedding and matched word embedding, respectively, and W Q and W K For learnable parameters, This is the scaling factor.
[0063] 2.2.2) Dynamic matching word embedding calculation: To preserve segmentation information, matching words are divided into four groups (B, M, E, and S) according to the relationship between characters and matching words. In group B, the character is the first character of the matching word; in group M, the character appears in the middle of the matching word; in group E, the character is the last character of the matching word; and in group S, the character and the matching word are equal. The weighted word embedding of each group of matching words is obtained by weighted summing of the word embeddings of each group.
[0064]
[0065] in α ω It is the attention weight of the matched word ω, e ω (ω) is the embedding representation of the matching word ω.
[0066] By concatenating the four sets of weighted word embeddings, we can obtain the final dynamic matching word embedding representation v. i The calculation formula is as follows:
[0067] v i ={v i (B); v i (M); v i (E); v i (S)}
[0068] Where v i (B), v i (M), v i (E), v i (S) represents the dynamic weighted word embeddings of the four sets of matching words: B, M, E, and S.
[0069] The dynamic weights employed in this invention are calculated through an attention mechanism, combining the embedding of characters in a sentence with the relevance of matched words, and can flexibly adjust the weights according to the specific context. This means that the model can better capture the different associations between characters and words in different contexts, thereby improving recognition accuracy. Furthermore, dynamic weights can avoid the situation where weight allocation is overly biased towards high-frequency words, thus improving the model's generalization ability.
[0070] Example 6
[0071] The Chinese entity recognition model and method based on vocabulary enhancement and character extrinsic information are the same as in Examples 1-5. In step 2.4), the components that make up Chinese characters are obtained based on a dictionary of Chinese character components. For most commonly used characters, the components that make up the character can be obtained by directly querying the dictionary, which is relatively fast and convenient. If a character cannot be found in the dictionary, it is usually a rare character with a low probability of occurrence. In this invention, a special character ["None"] is used to represent its components.
[0072] Example 7
[0073] The Chinese entity recognition model and method based on vocabulary enhancement and character extrinsic information are the same as in Examples 1-6. In step (3), the two bidirectional gated recurrent units (Bi-GRUs) used in the dual-path encoding are parameter-independent, independently optimized, and do not interfere with each other. A bidirectional gated recurrent unit is a combination of two GRUs, one forward and one backward. They are identical in network structure, only the input sequence directions are reversed. The forward network implementation is as follows:
[0074] z t =σ(W z ·[h t-1 ,x t ])
[0075] r t =σ(W r ·[h t-1 ,x t ])
[0076]
[0077] Where σ represents the sigmoid function, tanh is the hyperbolic tangent function, r and z represent the reset gate and update gate, respectively, and h t This represents the hidden state at time step t. This is the candidate hidden state, W r W z W are trainable weight parameters; the bidirectional hidden state of Bi-GRU at character i is the concatenation of the forward hidden state and the backward hidden state: In the forward-hidden state, Backward hidden state.
[0078] This invention employs a novel dual-encoding fusion strategy, using two parallel modules to handle enhanced character representation and Chinese character component embedding during context encoding. This optimizes the boundary recognition performance of Chinese named entity recognition and effectively improves the model's recognition accuracy in complex text environments. The dual encoder in this invention allows for individual adjustment of hyperparameters for each Bi-GRU encoder, enabling more precise control over the model's learning process.
[0079] This invention integrates pinyin, component, and vocabulary information into the character feature extraction process. It employs a novel fusion strategy, using two parallel modules to handle enhanced character representation and Chinese character component embedding respectively, effectively combining pinyin and component information with vocabulary information. This further enriches character feature representation and improves performance.
[0080] Example 8
[0081] The Chinese entity recognition model and method based on lexical enhancement and character extrinsic information are the same as those in Examples 1-7. This invention designs a dual-stream model and adopts a novel dual-path encoding fusion strategy. It uses two parallel modules to process the enhanced character representation and the Chinese character component embedding respectively, so as to effectively fuse the rich extrinsic information of Chinese characters (the extrinsic information of Chinese characters usually refers to the additional information that is not inside a single Chinese character but is crucial for understanding and processing Chinese characters) to further improve the Chinese named entity model based on lexical enhancement and improve the accuracy of named entity recognition.
[0082] To achieve the above objectives, the technical solution of the present invention includes the following steps:
[0083] Step 1) Preprocess the input text dataset, including removing redundant characters and special symbols. Then, use an intelligent sentence segmentation algorithm to divide excessively long text data into reasonable sentence units to ensure the model's efficient processing capability.
[0084] Step 2) This step aims to extract various features from the input sentence, including character features, vocabulary features, pinyin features, component features, etc.
[0085] Step 2.1) The cleaned sentence s = {c1, c2, c3, ..., c n Inputting the c into the BERT model to obtain each character i Embedded representation;
[0086] Step 2.2) Perform string matching between each character and the external dictionary to obtain the matching words for each character. Each character may have multiple matching words, and a weight needs to be assigned to each matching word. Previous methods directly used the word frequency as the weight. In order to capture the relationship between characters and their matching words and to allocate the weights of each matching word more reasonably, this invention calculates the attention weights of characters and their matching words based on an attention mechanism:
[0087]
[0088] Where x and y are character embedding and matched word embedding, respectively, and W Q and W K For learnable parameters, This is the scaling factor.
[0089] To preserve segmentation information, matching words are divided into four groups based on their relationship to the matching word: B (the character is the first character of the matching word), M (the character appears in the middle of the matching word), E (the character is the last character of the matching word), and S (the character is equal to the matching word). The weighted word embeddings of each of the four groups are then summed using weighted averages to obtain the weighted word embeddings for each group.
[0090]
[0091] in α ω It is the attention weight of the matched word ω, e ω (ω) is the embedding representation of the matching word ω.
[0092] By concatenating the four sets of weighted word embeddings, we can obtain the final dynamic matching word embedding representation v. i The calculation formula is as follows:
[0093] v i ={v i (B); v i (M); v i (E); v i (S)}
[0094] Where v i (B), v i (M), v i (E), v i (S) represents the dynamic weighted word embeddings of the four sets of matching words: B, M, E, and S.
[0095] Step 2.3) Obtain the pinyin of each Chinese character in the input sentence, and use a convolutional neural network to extract pinyin features to obtain pinyin feature embeddings;
[0096] Step 2.4) Decompose each Chinese character in the input sentence to obtain the components that make up the Chinese character, and use a convolutional neural network to extract the features of the components to obtain the component embedding;
[0097] Step 3) Concatenate the character embedding, word embedding, and pinyin embedding to obtain the enhanced character representation:
[0098] x i ←[x i ;v i ;e p ]
[0099] Where x i It is a character embedding representation, e p It is a pinyin embedding representation;
[0100] Step 4) Use a dual-channel bidirectional gated recurrent unit (Bi-GRU) to extract contextual features of the enhanced character representation and contextual features of the embedded Chinese character components; the two Bi-GRU parameters are independent and do not interfere with each other;
[0101] Step 4.1) Concatenate the character embedding, word embedding, and pinyin embedding to obtain the enhanced character representation and input it into a Bi-GRU to further extract the contextual representation of the character embedding; the bidirectional gated recurrent unit can be understood as a combination of two GRUs, forward and backward. They are consistent in network structure, only the input sequence direction is reversed. The implementation of the forward network is as follows:
[0102] z t =σ(W z ·[h t-1 ,x t ])
[0103] r t =σ(W r ·[h t-1 ,x t ])
[0104]
[0105] Where σ represents the sigmoid function, tanh is the hyperbolic tangent function, r and z represent the reset gate and update gate, respectively, and h t This represents the hidden state at time step t. This is the candidate hidden state, W r W z W are trainable weight parameters; the bidirectional hidden state of Bi-GRU at character i is the concatenation of the forward hidden state and the backward hidden state: In the forward-hidden state, The backward hidden state; the Bi-GRU output of this step can be represented as a set of hidden vectors.
[0106] Step 4.2) Input the Chinese character component embedding representation into another Bi-GRU to further extract the contextual representation of the component embedding; the Bi-GRU output of this step can be represented as a set of hidden vectors.
[0107] Step 5) This invention selects a linear chain conditional random field (CRF) as the decoder. By concatenating the outputs of the Bi-GRU in steps 4.1) and 4.2), we can obtain... S l When input into a CRF, the CRF will output a sequence of entity labels y = [l1, l2, ..., l n Score:
[0108]
[0109] Where y′ represents all possible label sequences. It is specific to l i Learnable parameters From the label l i-1 to l i The offset.
[0110] This invention uses the Viterbi algorithm to search for the highest-scoring tag sequence, and entities in the sentence can be extracted based on the tag sequence.
[0111] The following example, which integrates the model and method, further illustrates the present invention.
[0112] Example 9
[0113] The Chinese entity recognition model and method based on vocabulary enhancement and character external information are the same as those in Examples 1-3. The specific embodiments and effects of the present invention will be further described in detail below with reference to the accompanying drawings.
[0114] Reference Figure 1 The implementation steps for this example are as follows:
[0115] Step 1, data cleaning.
[0116] The input text may be non-standard, containing non-standard characters, Unicode characters, etc., which need to be removed. In addition, some input text may be too long. BERT has a limit on the length of input text, and excessively long text is not conducive to Bi-GRU extracting contextual information. Therefore, excessively long input text needs to be segmented into several short sentences.
[0117] Step 2: Extract features from the input sentence.
[0118] This step aims to extract various features from the input sentence, including character features, lexical features, pinyin features, and component features. The Chinese named entity recognition method proposed in this invention is a character-based named entity recognition method. For the sentence cleaned in step 1, the character embedding, matching word embedding, pinyin embedding, and Chinese character component embedding can be obtained based on each character in the sentence.
[0119] The specific implementation of this step is as follows:
[0120] 2.1) Character Embedding Extraction: There are various methods to extract character embeddings from the cleaned sentence. This invention uses the BERT model to extract character embeddings. BERT is based on the Transformer architecture, uses a masked language model and next-sentence prediction as pre-training tasks, and is pre-trained on a large amount of data, enabling it to generate high-quality language representations. The cleaned sentence s = {c1, c2, c3, ..., c...} is then used to extract character embeddings. n Inputting the input into the BERT model will retrieve the values of each character c. i Embedded representation;
[0121] 2.2) Lexical Embedding Extraction: Each character in the sentence is matched against an external dictionary to obtain matching words for each character. Each character may have multiple matching words, requiring a weight to be assigned to each. Previous methods mostly used word frequency as the weight directly. To capture the relationship between characters and their matching words and more rationally allocate the weights of each matching word, this invention calculates the attention weights between characters and their matching words based on an attention mechanism:
[0122]
[0123] Where x and y are character embedding and matched word embedding, respectively, and W Q and W K For learnable parameters, This is the scaling factor.
[0124] To preserve segmentation information, matching words are divided into four groups based on their relationship to the matching word: B (the character is the first character of the matching word), M (the character appears in the middle of the matching word), E (the character is the last character of the matching word), and S (the matching word is a single character). The weighted word embeddings of each of the four groups are then summed using weighted averages to obtain the weighted word embeddings for each group.
[0125]
[0126] in α ω It is the attention weight of the matched word ω, e ω (ω) is the embedding representation of the matching word ω.
[0127] The four groups of weighted word embeddings are concatenated to obtain the final dynamic matching word embedding representation v i , and its calculation formula is as follows:
[0128] v i = {v i (B); v i (M); v i (E); v i}
[0129] where v i (B), v i (M), v i (E), v i (S) are the dynamic weighted word embeddings of the four groups of matching words B, M, E, and S respectively.
[0130] 2.3) Extract pinyin embeddings: First, use the PyPinyin tool to extract the pinyin of each character in the sentence. For example, for the character "中", the PyPinyin output is ["z", "h", "o", "n", "g", "1"], where "1" represents the first tone. Then, input it into a convolutional neural network to extract pinyin embeddings. Refer to Figure 3 , this convolutional neural network includes a one-dimensional convolutional layer, a max pooling layer, and a fully connected layer.
[0131] 2.4) Extract Chinese character component embeddings: The present invention constructs a Chinese character component dictionary. For the vast majority of commonly used characters, the components that make up the character can be directly queried from the dictionary. For example, the composition of "亮" is ["亠", "口", "冖", "儿"]. Similarly, input it into a convolutional neural network to extract Chinese character component embeddings, and the structure of this convolutional neural network is the same as the convolutional neural network mentioned in 2.3).
[0132] Step 3, obtain enhanced character embeddings.
[0133] Concatenate the character embeddings, vocabulary embeddings, and pinyin embeddings to obtain an enhanced character representation:
[0134] x i ← [x i ; v i ; e p
[0135] where x i is the character embedding representation, and e p is the pinyin embedding representation.
[0136] Step 4, extract text context features.
[0137] This invention proposes a two-stream model to fuse various external information of Chinese characters, selecting two bidirectional gated recurrent units (Bi-GRU) as encoders to extract contextual features of enhanced character representation and component embedding, respectively. Bi-GRU can simultaneously capture forward and backward information in the sequence, meaning that the output at each time point is based on the context of the entire sequence, which is crucial for named entity recognition. Bi-GRU can be flexibly applied to different sequence lengths and effectively handles long-term dependencies in long sequences.
[0138] 4.1) The character embedding, word embedding, and pinyin embedding are concatenated to obtain an enhanced character representation, which is then input into a Bi-GRU to further extract the contextual representation of the character embedding. The bidirectional gated recurrent unit can be understood as a combination of two GRUs, one forward and one backward. They are identical in network structure, only the input sequence directions are reversed. The implementation of the forward network is as follows:
[0139] z t =σ(W z ·[h t-1 ,x t ])
[0140] r t =σ(W r ·[h t-1 ,x t ])
[0141]
[0142] Where σ represents the sigmoid function, z and r represent the reset gate and update gate respectively, and W are trainable parameters; the bidirectional hidden state of Bi-GRU at character i can be represented as the concatenation of the forward hidden state and the backward hidden state: The output of this step, the Bi-GRU, can be represented as a set of hidden vectors.
[0143] 4.2) Input the Chinese character component embedding representation into another Bi-GRU to further extract the contextual representation of the component embedding; the Bi-GRU output of this step can be represented as a set of hidden vectors.
[0144] Step 5: CRF decoding yields the output.
[0145] Linear-chain conditional random fields (CRFs) can capture global information of the entire sequence, ensuring that the labeling of the entire sequence is optimal. This means that CRFs consider not only the optimal labeling at a single position, but also the optimal combination of labels for the entire sequence, which is crucial for NER tasks; concatenating the outputs of the two Bi-GRU modules in step 4 yields... S lWhen input into a CRF model, the CRF will output a sequence of entity labels y = [l1, l2, ..., l n Score:
[0146]
[0147] Where y′ represents all possible label sequences. It is specific to l i Learnable parameters From the label l i-1 to l i The offset; This invention uses the Viterbi algorithm to search for the highest-scoring tag sequence, and entities in the sentence can be extracted based on the tag sequence.
[0148] This invention integrates pinyin, component, and vocabulary information into the character feature extraction process. It employs a novel fusion strategy, using two parallel modules to handle enhanced character representation and Chinese character component embedding respectively. This effectively combines pinyin and component information with vocabulary information, further enriching character feature representation and improving performance. The implementation scheme is as follows: Clean the input text, removing invalid characters and segmenting excessively long text. Extract multiple features from the input sentence, including character features, vocabulary features, pinyin features, and component features. First, use the BERT model to extract the embeddings of each character in the input sentence. Perform string matching between each character in the input sentence and an external dictionary to obtain matching words for each character. Then, use an attention mechanism to weightedly sum the matching words to obtain the vocabulary embedding. After obtaining the pinyin of each character in the input sentence using PyPinyin, feed it into a convolutional neural network to extract pinyin embeddings. Finally, after obtaining the constituent components of each character based on the constructed Chinese character component dictionary, feed them into a convolutional neural network to extract Chinese character component embeddings. The enhanced character embedding is obtained by concatenating the above character features, pinyin features, and vocabulary features. It is then input into a Bi-GRU model to extract character context features. The component embedding is input into another Bi-GRU model to extract component context features. The outputs of the two Bi-GRU models are concatenated and input into a linear chain conditional random field model for decoding to obtain the output entity label sequence.
[0149] The technical effects of this invention will be further verified through simulation below.
[0150] Example 10
[0151] The Chinese entity recognition model and method based on vocabulary enhancement and character external information are the same as those in Examples 1-9.
[0152] Simulation conditions
[0153] Experimental data used included the Weibo dataset, OntoNotes dataset, and Resume dataset. The simulation platform consisted of an Intel Core i5-12400 CPU, 16.0GB of RAM, an NVIDIA GeForce RTX 3090Ti graphics card, and a Windows 11 operating system.
[0154] Simulation content
[0155] The present invention and existing algorithms, namely SoftLexicon, TENER, FLAT and MECT, were used to test the above three datasets. The F1 score was used to evaluate their performance. The results are shown in Table 1, which is a comparison table of simulation results between the present invention and existing technologies.
[0156] Simulation Results and Analysis
[0157] Referring to Table 1, the proposed method achieves a 2.58% improvement in F1 score compared to the baseline model SoftLexicon on the Weibo dataset; on the OntoNotes dataset, it improves the F1 score to 83.32%; and it also achieves the best results on the Resume dataset, with an F1 score 0.15% higher than the baseline model SoftLexicon. Simulation results demonstrate that on the relatively difficult Weibo dataset, the proposed method significantly outperforms other methods in F1 score, proving its adaptability to complex text environments. Simulation results show that the proposed method outperforms existing methods on all three datasets.
[0158] Table 1 Comparison of Simulation Results between the Invention and Prior Art
[0159] Weibo OntoNotes Resume SoftLexicon 70.50 82.81 96.11 TENER 58.39 72.82 95.25 FLAT 68.55 81.82 95.86 MECT 70.43 82.57 95.98 The present invention 73.08 83.32 96.26
[0160] Example 11
[0161] The Chinese entity recognition model and method based on vocabulary enhancement and character extrinsic information are the same as in Examples 1-9, and the simulation conditions are the same as in Example 10. In this example, only the Weibo dataset was used on the experimental dataset.
[0162] Simulation content
[0163] To verify the contribution of each module in the model of this invention, ablation experiments were conducted on the Weibo dataset. The performance of each module was evaluated using precision, recall, and F1 score. The results are shown in Table 2. Table 2 shows the ablation experiment results of this invention.
[0164] Simulation Results and Analysis
[0165] To verify the contribution of each module in the model of this invention, an ablation experiment was conducted on the Weibo dataset. The results of the ablation experiment are shown in Table 2.
[0166] Table 2 Ablation Experiment Results of the Invention
[0167] Model Accuracy Recall rate F1 score Complete model 73.73 72.46 73.08 Remove Pinyin Information 71.06 72.95 71.99 Remove component information 73.42 70.04 71.69 Remove components and pinyin information simultaneously. 72.82 68.60 70.65 Remove dynamic weights 73.27 71.50 72.37
[0168] When the pinyin embedding was removed, the F1 score dropped to 71.99, a decrease of 1.09% compared to the full model. This invention removes component information to evaluate its contribution. After removing component information, the model's F1 score on the Weibo dataset decreased by 1.39%. Furthermore, when both pinyin and component information were removed, the F1 score further decreased to 70.65, a decrease of 2.43% compared to the full model. These results demonstrate that the complementary use of various external information in this invention can further improve model performance. In this example, the dynamic weights used in this invention were removed, and instead, word frequency was used as the weight for matched words, similar to SoftLexicon, to evaluate the importance of the dynamic weights. Experimental results show that this resulted in a 0.71% decrease in the F1 score, verifying that the dynamic weights used in this invention can effectively improve model accuracy and generalization ability.
[0169] In summary, this invention proposes a Chinese entity recognition model and method based on lexical enhancement and character extrinsic information, integrating pinyin, component, and lexical information into the character feature extraction process. It employs a novel fusion strategy, using two parallel modules to process enhanced character representation and Chinese character component embedding respectively, effectively combining Chinese character pinyin and component information with lexical information. This further enriches character feature representation and improves performance. It addresses the problems of existing methods failing to fully utilize Chinese character extrinsic information and relying solely on word frequency to determine static weights for matching words. The Chinese entity recognition model sequentially connects a Chinese character information extraction part, a Chinese character feature extraction part containing dynamic matching word features, a dual-channel encoder part for enhanced character embedding and component embedding, and a decoding output part. The implementation method includes data cleaning, Chinese character feature extraction containing dynamic matching word features, dual-channel encoding for enhanced character embedding and component embedding, and decoding output. This invention proposes a dual-channel encoding structure that effectively integrates lexical, pinyin, and component information of Chinese characters into the model, greatly enriching the semantic expression of character-based Chinese named entity recognition and solving the problem of existing methods failing to fully utilize Chinese character extrinsic information. Furthermore, this invention employs an attention mechanism when introducing lexical information, dynamically adjusting the weights of matching words by calculating the relevance between characters and matching words. Compared to existing methods that rely solely on word frequency to determine static weights for matching words, this invention offers more flexible and reasonable weight allocation, treating each matching word more evenly and avoiding an overemphasis on high-frequency words. This improves the model's generalization ability and recognition accuracy. It is used to extract Chinese entities from unstructured input text.
Claims
1. A Chinese entity recognition device based on lexical enhancement and character extrinsic information, characterized in that, The system is sequentially connected to a Chinese character information extraction section, a Chinese character feature extraction section containing dynamic matching word features, a dual-channel encoder section with enhanced character embedding and component embedding, and a decoding output section. The Chinese character information extraction section includes a character extraction module, which in turn includes a matching word extraction module, a pinyin extraction module, and a component extraction module. The Chinese character feature extraction section containing dynamic matching word features includes a character feature extraction module, a dynamic matching word feature extraction module, a pinyin feature extraction module, and a component feature extraction module. The character feature extraction module uses the output of the character extraction module in the Chinese character information extraction section as input to obtain character embeddings. The dynamic matching word feature extraction module first uses the outputs of the matching word extraction module and the character extraction module in the Chinese character information extraction section as input, and then uses an attention mechanism to weightedly sum the embeddings of each matching word to obtain the dynamic matching word feature embedding. Pinyin The feature extraction module uses the output of the pinyin extraction module in the Chinese character information extraction section as input to extract pinyin feature embedding; The component feature extraction module uses the output of the component extraction module in the Chinese character information extraction section as input to extract component feature embeddings; the dual-channel encoder section for enhanced character embedding and component embedding includes two branches, which are used to encode the context features of component embedding and the context features of enhanced character embedding that fuse dynamic matching word features and pinyin features, respectively. Then, the component context features and enhanced character context features are concatenated as the dual-channel encoder output; the decoding output section is used to decode the encoder output to obtain the optimal label sequence; In the dynamic matching word feature extraction module, when the dynamic matching word embeddings are obtained by weighted summation of each matching word embedding, the dynamic attention weight α of each matching word is obtained by calculating the correlation between the character embedding and each matching word embedding through the attention mechanism. The calculation formula is as follows: Where x and y are character embedding and matched word embedding, respectively, and W Q and W K For learnable parameters, This is the scaling factor; To preserve segmentation information, the matching words are divided into four groups: B, M, E, and S, according to the relationship between the characters and the matching words. In group B, the character is the first character of the matching word; in group M, the character appears in the middle of the matching word; in group E, the character is the last character of the matching word; and in group S, the character is equal to the matching word. The weighted word embeddings of each of the four sets of matched words are obtained by weighted summation of the word embeddings. in α ω It is the attention weight of the matched word ω, e ω (ω) is the embedding representation of the matching word ω; By concatenating the four sets of weighted word embeddings, we can obtain the final dynamic matching word embedding representation v. i The calculation formula is as follows: v i ={v i (B);v i (M);v i (E);v i (S)}; Where v i (B), v i (M), v i (E), v i (S) represents the dynamic weighted word embeddings of the four sets of matching words: B, M, E, and S.
2. A Chinese entity recognition method based on lexical enhancement and character extrinsic information, implemented on the Chinese entity recognition device based on lexical enhancement and character extrinsic information as described in claim 1, characterized in that, Includes the following steps: (1) Data cleaning: Receive the original Chinese input text, split the excessively long text into several short sentences and remove illegal characters and Unicode characters to complete the data cleaning and obtain the cleaned sentences; (2) Extraction of Chinese character features containing dynamic matching words: Extract various features of the input sentence after data cleaning, including character features, dynamic matching word features, pinyin features, and component features; Extracting character features involves inputting the cleaned sentence into the BERT model to obtain the feature embeddings of each character. Extracting dynamic matching word features first involves matching each character with an external dictionary to obtain matching words. Based on the matching word embeddings and character feature embeddings, the dynamic weights of each matching word are calculated, and the weighted sum of the matching word embeddings is obtained to obtain the dynamic matching word feature embedding. extract Pinyin features are obtained by acquiring the pinyin of each Chinese character in the input sentence, and then using a convolutional neural network to extract and obtain pinyin feature embeddings. Character feature embeddings, dynamic matching word feature embeddings, and pinyin feature embeddings are concatenated in sequence to obtain enhanced character embeddings. When extracting component features, each Chinese character in the input sentence is first decomposed to obtain the components that make up the Chinese character, and then a convolutional neural network is used to extract and obtain component feature embeddings, thus completing the extraction of Chinese character features containing dynamic matching word features. (3) Enhanced character embedding and component embedding dual-path encoding: Two bidirectional gated recurrent units (Bi-GRU) are used to extract the context features of enhanced character embedding and Chinese character component embedding; The character embedding, dynamic matching word feature embedding, and pinyin embedding are concatenated to obtain the enhanced character embedding, which is then input into a Bi-GRU to extract the contextual representation of the enhanced character embedding; The Chinese character component embedding representation is input into another Bi-GRU to extract the component embedding context representation. The component context representation and the enhanced character context representation are concatenated to complete the dual-path encoding of enhanced character embedding and component embedding. (4) Decoding output: The linear chain conditional random field (CRF) is selected as the decoder. The encoded context representation that integrates Chinese character information, matching word information, pinyin information and component information is input into the CRF for decoding. The CRF will output the label sequence with the highest score. Based on the label sequence, the entities in the sentence are extracted to complete the decoding output.
3. The Chinese entity recognition method based on lexical enhancement and character extrinsic information according to claim 2, characterized in that, The Chinese character feature extraction in step (2) specifically includes: 2.1) Character Feature Extraction: Input the cleaned sentence into the Chinese-BERT-wwm model to obtain the feature embeddings of each character; 2.2) Dynamic matching word feature extraction: First, each character is matched with the external dictionary to obtain the matching words for each character. Then, the matching words are divided into four groups (B, M, E, S) according to the relationship between the characters and the matching words. The correlation between the character embedding and the embedding of each matching word is calculated based on the attention mechanism as the dynamic weight of the matching words. Then, the weighted word embeddings of each group of matching words are obtained by weighted summation. The four groups of weighted word embeddings are concatenated to obtain the final dynamic matching word feature embedding. 2.3) Pinyin feature extraction: The Pinyin of each Chinese character in the input sentence is obtained using the PyPinyin tool, and the Pinyin feature embedding is extracted and obtained using a convolutional neural network; 2.4) Component feature extraction: Decompose each Chinese character in the input sentence to obtain the components that make up the Chinese character, and use a convolutional neural network to extract and obtain component feature embeddings; 2.5) The convolutional neural network structures in pinyin feature extraction and component feature extraction are the same, both consisting of a one-dimensional convolutional layer, a max pooling layer, and a fully connected layer connected in sequence.
4. The Chinese entity recognition method based on lexical enhancement and character extrinsic information according to claim 3, characterized in that, Step 2.2) describes the dynamic matching word feature extraction, which includes the following steps: 2.2.1) Dynamic matching word weight calculation: The dynamic attention weight α of each matching word is obtained by calculating the correlation between the character embedding and each matching word embedding through the attention mechanism. The calculation formula is as follows: Where x and y are character embedding and matched word embedding, respectively, and W Q and W K For learnable parameters, This is the scaling factor; 2.2.2) Dynamic matching word embedding calculation: In order to preserve segmentation information, the matching words are divided into four groups: B, M, E, and S according to the relationship between the characters and the matching words. In group B, the character is the first character of the matching word; in group M, the character appears in the middle of the matching word; in group E, the character is the last character of the matching word; and in group S, the character is equal to the matching word. The weighted word embeddings of each of the four sets of matched words are obtained by weighted summation of the word embeddings. in α ω It is the attention weight of the matched word ω, e ω (ω) is the embedding representation of the matching word ω; By concatenating the four sets of weighted word embeddings, we can obtain the final dynamic matching word embedding representation v. i The calculation formula is as follows: v i ={v i (B);v i (M);v i (E);v i (S)}; Where v i (B), v i (M), v i (E), v i (S) represents the dynamic weighted word embeddings of the four sets of matching words: B, M, E, and S.
5. The Chinese entity recognition method based on lexical enhancement and character extrinsic information according to claim 3, characterized in that, The process of obtaining the components that make up Chinese characters in step 2.4) is based on a dictionary of Chinese character components. For most commonly used characters, the components that make up the character are obtained by directly querying the dictionary. If a character cannot be found in the dictionary, a special character ["None"] is used to represent its components.
6. The Chinese entity recognition method based on lexical enhancement and character extrinsic information according to claim 2, characterized in that, Step (3) The two bidirectional gated recurrent units (Bi-GRUs) used in the dual-path coding are parameter-independent, independently optimized, and do not interfere with each other; the bidirectional gated recurrent unit is a combination of two GRUs, one forward and one backward. The two are consistent in network structure, only the input sequence direction is reversed. The implementation of the forward network is as follows: Where σ represents the sigmoid function, tanh is the hyperbolic tangent function, r and z represent the reset gate and update gate, respectively, and h t This represents the hidden state at time step t. This is the candidate hidden state, W r W z W are trainable weight parameters; the bidirectional hidden state of Bi-GRU at character i is the concatenation of the forward hidden state and the backward hidden state: It is in a forward-hidden state. Backward hidden state.
Citation Information
Patent Citations
Character sequence recognition method fusing dictionary and character features
CN114662476A
Chinese named entity recognition method and system fusing vocabulary and syntactic information
CN114818717A