Chinese named entity recognition method and system combining vocabulary enhancement and adversarial learning and medium
By combining vocabulary enhancement and adversarial learning methods, the problems of insufficient utilization of vocabulary information, insufficient model robustness and inaccurate entity boundary recognition in the existing Chinese named entity recognition technology are solved, and more efficient semantic understanding and robustness are achieved, which is suitable for a variety of text data.
Patent Information
- Application Number
- CN202411790717.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-03-21
AI Technical Summary
The existing Chinese named entity recognition technology has problems such as insufficient utilization of vocabulary information, insufficient robustness of the model, and inaccurate entity boundary recognition.
Using a method combining vocabulary enhancement and adversarial learning, character embedding is generated through pre-training language models, small amplitude perturbation is added for adversarial training, external dictionary information is fused and learningable attention mechanism is used, multi-layer semantic features are dynamically weighted, and sequence decoding is finally performed using conditional random fields.
Improves the understanding of complex semantics, enhances the robustness of the model and the accuracy of entity boundary recognition, and is suitable for structured and unstructured text data.
Smart Images

Figure CN119670753A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of entity naming recognition, and in particular to a Chinese named entity recognition method, system and medium combining vocabulary enhancement and adversarial learning. Background Art
[0002] With the development of natural language processing technology, named entity recognition (NER) as one of the basic tasks is dedicated to identifying and classifying entities with specific meanings in text, such as names of people, places, organizations, etc. In the Chinese NER task, the lack of clear word boundaries in Chinese makes entity boundary recognition more difficult. Traditional NER methods are mainly divided into rule-based methods and statistical learning-based methods.
[0003] Rule-based methods: Early NER methods usually rely on hand-written rules and domain dictionaries. For example, the SRA system proposed by Krupka uses semantic information in the text to generate rule templates to improve the accuracy of entity recognition. Shaalan et al. use the contextual features of the text to design rules and combine them with a place name dictionary to identify technical terms.
[0004] Methods based on statistical models: including supervised learning and unsupervised learning. Supervised learning regards NER as a sequence labeling task and uses labeled data to train models, such as Hidden Markov Model (HMM), Conditional Random Field (CRF), etc. Unsupervised learning uses methods such as clustering to extract related entities based on context similarity.
[0005] Deep learning-based methods: In recent years, deep learning methods have made significant progress in NER tasks. Models based on character sequences avoid the impact of Chinese word segmentation errors, but there is a sparsity problem at the character level. To this end, some studies have begun to incorporate external vocabulary information (such as dictionaries, word vectors) into the model to enhance semantic expression capabilities. For example:
[0006] Lattice LSTM: Encodes words matched by characters into a directed acyclic graph and combines character and word information for sequence labeling.
[0007] LR-CNN: Based on convolutional neural network, it uses different window sizes to encode the matched words.
[0008] SoftLexicon: Integrates all matched words into the character representation, retaining the dictionary matching information to the maximum extent.
[0009] The above technical solution has the following defects:
[0010] 1. Insufficient use of lexical information: Most existing models only consider character-level features and fail to fully utilize lexical-level information, resulting in insufficient understanding of complex semantics.
[0011] 2. Insufficient model robustness: When faced with noisy data or incomplete sentences, the performance of the model may drop significantly and lack the ability to resist interference.
[0012] 3. Inaccurate entity boundary recognition: Due to the lack of effective aggregation of multi-level semantic information, the model is prone to errors when processing entity boundaries. Summary of the invention
[0013] The present invention aims to at least solve the technical problems existing in the prior art, and in particular innovatively proposes a Chinese named entity recognition method, system and medium combining vocabulary enhancement and adversarial learning.
[0014] In order to achieve the above-mentioned object of the present invention, the present invention provides a Chinese named entity recognition method combining vocabulary enhancement and adversarial learning, comprising the following steps: S1, receiving structured or / and unstructured Chinese text data, and performing preprocessing such as sentence segmentation, noise removal, and format normalization;
[0015] S2, uses a pre-trained language model to convert characters in the text into vector representations, capturing semantic and grammatical information;
[0016] S3, adds small perturbations to the character embedding and iteratively updates it through the PGD algorithm to obtain adversarial samples, thereby improving the model's robustness to noise and erroneous inputs, as well as its ability to recognize fuzzy entity boundaries;
[0017] S4, matches related words through an external dictionary, fuses lexical embedding information into character embedding, and flexibly regulates the influence of lexical information on character representation through learnable attention mechanism and word information weight;
[0018] S5, extracts the multi-layer output of the pre-trained language model and dynamically fuses the semantic features of different layers with a learnable weighting strategy to obtain richer high-dimensional semantic representation;
[0019] S6, use conditional random field (CRF) to decode the enhanced features and predict the entity label of each character;
[0020] S7 formats and outputs recognition results according to requirements, supports multiple formats such as JSON, CSV, etc., and provides visual display and API interface.
[0021] In a preferred embodiment of the present invention, step S3 includes:
[0022] δ (0) =0 (1)
[0023] Among them, δ (0) represents the initial disturbance;
[0024]
[0025] Among them, g (t) is the gradient calculated in the tth iteration;
[0026] ▽ δ Represents the loss function Partial derivatives with respect to the variable δ;
[0027] Represents the loss function for the named entity recognition task;
[0028] f θ () represents the named entity recognition model;
[0029] X is the input sample;
[0030] δ (t) is the current disturbance;
[0031] Y is the corresponding true label;
[0032]
[0033] Among them, δ (t+1) is the gradient calculated in the t+1th iteration;
[0034] clip ∈ () means limiting the disturbance to the maximum amplitude ∈;
[0035] δ (t) is the current disturbance;
[0036] α is the step size;
[0037] g (t) is the gradient calculated in the tth iteration;
[0038] ‖g (t) ‖ p g (t) The p-norm of ;
[0039] X adv =X+δ (T) (4)
[0040] Among them, X adv is the generated adversarial sample;
[0041] X is the input sample;
[0042] δ (T)represents the perturbation amount generated after T iterations;
[0043] T is the number of iterations.
[0044] In a preferred embodiment of the present invention, step S4 includes:
[0045] Linear transformation:
[0046]
[0047] in, Represents the linearly transformed embedding vector of the jth word matched by the i-th character; Represents the original embedding vector of the jth word matched by the i-th character;
[0048] W v and b v are learnable parameters;
[0049] Attention weight calculation:
[0050]
[0051] in, Indicates the attention weight corresponding to the jth word matched by the i-th character;
[0052] Represents the linearly transformed embedding vector of the jth word matched by the i-th character;
[0053] h i Represents the embedding vector of the i-th character;
[0054] K represents the number of matched words;
[0055] Represents the embedding vector of the k-th word matched by the i-th character after linear transformation;
[0056] Lexical Information Fusion:
[0057]
[0058] in, Represents the fused vocabulary vector;
[0059] K represents the number of matched words;
[0060] Indicates the attention weight corresponding to the jth word matched by the i-th character;
[0061] Represents the linearly transformed embedding vector of the jth word matched by the ith character; fused to the character representation:
[0062]
[0063] in, represents enhanced character representation;
[0064] h i Represents the embedding vector of the i-th character;
[0065] λ is the learnable word information weight;
[0066] Represents the fused vocabulary vector.
[0067] In a preferred embodiment of the present invention, step S5 includes:
[0068] Weight normalization:
[0069]
[0070] Among them, α (l) Represents the normalized weight coefficient of the lth layer;
[0071] w( l ) represents the weight of the lth layer;
[0072] L represents the number of pre-trained model layers;
[0073] w( k ) represents the weight of the kth layer;
[0074] Weighted Fusion:
[0075]
[0076] in, represents the fused vector;
[0077] L represents the number of pre-trained model layers;
[0078] α (l ) represents the normalized weight coefficient of the lth layer;
[0079] The hidden state vector representing the position of the i-th character in the l-th layer.
[0080] The present invention also discloses a computer system, comprising:
[0081] processor;
[0082] a memory for storing processor-executable instructions;
[0083] Wherein, the processor is configured to implement the Chinese named entity recognition method combining vocabulary enhancement and adversarial learning when executing the executable instructions.
[0084] The present invention also discloses a computer-readable storage medium, comprising:
[0085] a memory having a computer program stored thereon;
[0086] A processor is used to execute the program in the memory to implement the Chinese named entity recognition method combining vocabulary enhancement and adversarial learning.
[0087] In summary, due to the adoption of the above technical solution, the present invention can:
[0088] 1) Make full use of vocabulary information and enhance semantic understanding: By introducing vocabulary information from external dictionaries and using the attention mechanism and learnable fusion coefficients to finely integrate external vocabulary information into character representation, the model can capture richer contextual semantics, alleviate the semantic sparsity problem at the character level, and improve the ability to understand complex sentences.
[0089] 2) Improve the accuracy of entity boundary recognition: The semantic information aggregation layer dynamically weights the multi-layer semantic output of the pre-trained model through learnable layer weights, thereby automatically adapting the optimal semantic feature combination in different scenarios, enhancing the ability to capture entity boundaries and reducing recognition errors caused by blurred boundaries.
[0090] 3) Enhance model robustness and resist input perturbations: The adversarial training module improves the model's resistance to noise and adversarial samples by adding small perturbations during the training process, ensuring high accuracy in complex environments.
[0091] 4) The software is efficient, easy to integrate and deploy: The software device of this solution adopts a modular design, has good scalability and maintainability, supports integration with other systems, and is easy to deploy in practical applications.
[0092] 5) Highly innovative and fills the technical gap: Combining vocabulary enhancement and adversarial learning for Chinese named entity recognition, it proposes a new solution with high innovation and improves the technical level in the field.
[0093] 6) Wide applicability and strong versatility: It can run effectively on both structured and unstructured text data, and is suitable for multiple fields such as social media, finance, news, e-commerce, etc., meeting the needs of different scenarios.
[0094] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0095] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0096] Figure 1 It is a schematic block diagram of the process connection of the present invention.
[0097] Figure 2 It is a schematic diagram of the software architecture of the present invention.
[0098] Figure 3 It is a schematic block diagram of the model structure of the present invention.
[0099] Figure 4 It is a schematic block diagram of the vocabulary information injection module process of the present invention.
[0100] Figure 5 It is a schematic block diagram of the semantic information aggregation module of the present invention.
[0101] Figure 6 It is a schematic diagram showing the experimental results of the model of the present invention. DETAILED DESCRIPTION
[0102] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0103] This paper proposes a Chinese named entity recognition method that combines vocabulary enhancement and adversarial learning, which can automatically recognize named entities from structured and unstructured input texts and output recognition results. The specific scheme is as follows:
[0104] 1. Overall Architecture
[0105] The overall architecture of the software system includes the following modules:
[0106] Input processing module: receives structured or unstructured Chinese text data and performs preprocessing.
[0107] Embedding layer module: converts the preprocessed text into character embedding representation and uses the pre-trained model to capture semantic information at the character level.
[0108] Adversarial training module: Generate adversarial samples by adding small perturbations based on character embedding, thereby improving the robustness to noise and non-standard data, so that the model can still maintain high performance in complex scenarios.
[0109] Lexical Information Injection Module: Use external dictionary information to semantically enhance character embeddings, and selectively fuse matched lexical information through learnable weights and attention mechanisms, allowing the model to autonomously learn the contribution of lexical information in representation.
[0110] Semantic information aggregation module: Integrates the multi-layer output of the pre-trained language model, introduces learnable hierarchical weights and dynamic fusion strategies, so that the model can autonomously determine the participation of semantic features at each layer according to actual task needs and obtain the best semantic representation.
[0111] Decoding module: Use conditional random field (CRF) to perform sequence decoding and generate the final entity recognition result.
[0112] Output module: outputs the recognition results in a specified format and supports a variety of application scenarios.
[0113] 2. Specific implementation steps
[0114] Step 1: Input text preprocessing
[0115] Function: Receive Chinese text input by users, which can be structured data (such as database records) or unstructured data (such as documents, web pages).
[0116] deal with:
[0117] Sentence splitting: Split the text into sentences according to punctuation marks or specified rules.
[0118] Noise removal: filter out irrelevant information such as special characters and emoticons.
[0119] Format normalization: processing full-width and half-width characters, uppercase and lowercase conversion, traditional and simplified Chinese conversion, etc.
[0120] Step 2: Character Embedding Generation
[0121] Function: Convert each character in the text into a vector representation.
[0122] Technical details:
[0123] Use the pre-trained language model LERT to obtain character-level embedding representations that capture the semantic and grammatical information of characters.
[0124] Consider the contextual information of the characters and generate dynamic embedding vectors.
[0125] Step 3: Adversarial Training
[0126] Function: By applying small perturbations to the model input, the model's robustness to noise, non-standard input, or maliciously constructed adversarial sample input and the model's ability to identify fuzzy entity boundaries are improved.
[0127] Technical details:
[0128] The projected gradient descent (PGD) method is used to add small perturbations to the character embeddings, generate adversarial samples and conduct adversarial training. The specific steps are as follows: first initialize the perturbation, then calculate the gradient of the loss function with respect to the current perturbation, then update the perturbation, and finally generate adversarial samples. The adversarial samples are input into the model together with normal samples, the loss is calculated, and the parameters are iteratively optimized.
[0129] The formula is as follows:
[0130] Initialize the perturbation:
[0131] δ (0) =0 (1)
[0132] Among them, δ (0) represents the initial disturbance;
[0133] Compute the gradient:
[0134] At the tth iteration, the gradient of the loss function with respect to the perturbation is calculated:
[0135]
[0136] Among them, g (t) is the gradient calculated at the tth iteration, represents the loss function of the named entity recognition task, f θ Named entity recognition model, X is the input sample, Y is the corresponding true label, δ (t) for the current disturbance.
[0137] Update perturbation:
[0138]
[0139] Among them, α is the step size, ‖g (t) ‖ p g (t) The p-norm of clip ∈ It means limiting the disturbance to a maximum amplitude ∈.
[0140] Generate adversarial examples:
[0141] X adv =X+δ (T) (4)
[0142] Among them, X adv is the generated adversarial sample, and T is the number of iterations.
[0143] Training process: The adversarial samples are fed into the model together with the original samples, the loss is calculated and the parameters are updated.
[0144] Step 4: Lexical Information Injection
[0145] Function: Use an external dictionary to integrate vocabulary information related to each character into the model. Introduce attention weights to ensure that among the multiple words matched, the words that have the greatest semantic contribution to the target character receive higher weights. In addition, through the learnable fusion coefficient, the degree of fusion between word information and character basic representation can be dynamically adjusted. This learnable dynamic fusion method makes the present invention more adaptable and robust when dealing with polysemous characters or context changes.
[0146] Technical details:
[0147] Dictionary matching: For each character, search the predefined Chinese word vector dictionary to obtain all possible words containing that character.
[0148] Vocabulary embedding acquisition: Extract the pre-trained word vectors of the matched words to form a vocabulary embedding matrix.
[0149] Fusion method:
[0150] For each input character, match the possible words it can form, obtain the word embedding representation, and fuse it into the character embedding through the attention mechanism.
[0151] formula:
[0152] Character Embedding:
[0153] Let the embedding vector of the i-th character be h i .
[0154] Lexical Matching:
[0155] For the i-th character, the set of matched words is The corresponding word embedding vector is K is the number of matched words.
[0156] Linear transformation:
[0157] Linearly transform the word embeddings to make them consistent in dimension with the character embeddings:
[0158]
[0159] Among them, W v and b v are learnable parameters.
[0160] Attention weight calculation: For each matched word, calculate its relevance to the character and get the attention weight
[0161]
[0162] in, Indicates the attention weight corresponding to the jth word matched by the i-th character;
[0163] Represents the linearly transformed embedding vector of the jth word matched by the i-th character;
[0164] h i Represents the embedding vector of the i-th character;
[0165] K represents the number of matched words;
[0166] Represents the embedding vector of the k-th word matched by the i-th character after linear transformation;
[0167] Lexical Information Fusion:
[0168] The word embedding vectors are weighted and summed according to the attention weights to obtain the fused vocabulary representation:
[0169]
[0170] in, Represents the fused vocabulary vector;
[0171] K represents the number of matched words;
[0172] Indicates the attention weight corresponding to the jth word matched by the i-th character;
[0173] Represents the linearly transformed embedding vector of the jth word matched by the i-th character;
[0174] Fuse to character representation:
[0175] Combine the fused vocabulary representation with the character embedding to form an enhanced character representation:
[0176]
[0177] Among them, λ is the learnable word information weight, which controls the influence of vocabulary information on character representation.
[0178] Fusion result: The lexical information weighted by the attention weights is added to the character embedding to form an enhanced character representation.
[0179] Step 5: Semantic Information Aggregation
[0180] Function: Fuse the semantic information of multiple layers of pre-trained language model output to obtain rich feature representation. Different from the traditional method that only uses the last layer output of the pre-trained model or simply averages and fuses the multi-layer results, the present invention sets independent and learnable weight parameters for each layer in semantic information aggregation, and dynamically weights them through Softmax normalization. This method enables the model to automatically determine the contribution of each layer to the downstream named entity recognition task during the training process, so as to flexibly adjust the aggregation strategy in different fields and different data features, and improve the accuracy of capturing entity boundaries and semantic details.
[0181] Technical details:
[0182] Extract the output of the last four layers of the pre-trained model, and for each character position, get the corresponding hidden state vector.
[0183] Concatenation and fusion: Extract the output of the last four layers of the pre-trained model, and obtain the corresponding hidden state vector for each character position. Set a learnable weight for each layer output, and perform weighted fusion on the hidden state vectors of multiple layers to form a high-dimensional semantic representation.
[0184] Assume that the pre-trained model has L layers, h i (l) The hidden state vector represents the position of the i-th character in the l-th layer. We perform weighted fusion on the outputs of the last four layers (i.e., the L-3th layer to the Lth layer).
[0185] Learnable weight parameters:
[0186] Assign a learnable weight parameter w to the output of each layer (l) .
[0187] Weight normalization:
[0188] In order to make the weights easier to train and compare, these weights are normalized by Softmax to obtain the normalized weight coefficient α (l) :
[0189]
[0190] Among them, α (l) Represents the normalized weight coefficient of the lth layer;
[0191] w( l ) represents the weight of the lth layer;
[0192] L represents the number of pre-trained model layers;
[0193] w( k ) represents the weight of the kth layer;
[0194] Weighted Fusion:
[0195] Perform weighted summation on the hidden state vectors of multiple layers to obtain the fused representation h i :
[0196]
[0197] in, represents the fused vector;
[0198] L represents the number of pre-trained model layers;
[0199] α (l ) represents the normalized weight coefficient of the lth layer;
[0200] The hidden state vector representing the position of the i-th character in the l-th layer;
[0201] Step 6: Decoding and Entity Recognition
[0202] Function: Predict the entity label of each character based on the feature representation.
[0203] Technical details:
[0204] Linear layer mapping: Map the semantic representation to the label space to obtain the score of each label.
[0205] CRF decoding: Use the conditional random field (CRF) layer to consider the transition probability between labels and solve the optimal label sequence. The decoding process uses the Viterbi algorithm to achieve efficient sequence labeling.
[0206] Step 7: Output the results
[0207] Function: Output the recognized named entity results in multiple formats.
[0208] Technical details:
[0209] Result formatting: Organize the results into JSON, XML, CSV and other formats as required.
[0210] Visual display: Provides highlighted display of entity recognition results for easy viewing by users.
[0211] Interface support: Provide API interface to support integration with other systems.
[0212] 3. Software Implementation Details
[0213] The software system operation steps are as follows Figures 1 to 5As shown. The software first receives the text manually input or batch imported by the user from the client, then performs text cleaning, inputs the preprocessed text sequence into the model, converts the characters into corresponding feature expressions through the embedding layer module, adds disturbances to the character features through the adversarial training module, and then inputs the vocabulary information injection module to integrate the matched vocabulary information into the character features according to the attention mechanism and the learnable word information weights. Then, the word fusion features are input into the semantic aggregation module, and the features are input into the pre-trained model to obtain the output results of each layer of the pre-trained model, and the output results of the multiple layers are aggregated for semantic information. The high-dimensional semantic information fusion expression of the input sequence is obtained by dynamic weighted fusion through the learnable weights of each layer. Then, the aggregated semantic information features are input into the decoding module, and the features corresponding to each character are mapped to an entity label using CRF. Finally, through the output module, the entity recognition results are exported according to the specified data organization method and format.
[0214] 4. Model Experiment Results
[0215] The experimental results are as follows Figure 6 As shown in Figure 1, the model proposed in this patent shows significant performance improvement on multiple Chinese named entity recognition datasets compared to the baseline model. The model proposed in this patent has achieved high F1 scores and fast convergence speed on datasets such as Weibo, E-commerce, Resume, and People's Daily.
[0216] Wherein, Precision represents the precision, Recall represents the recall, and F1 represents the F1 score.
[0217] The experimental results show that the F1 score of the model proposed in this patent on the Weibo dataset is 1.87% higher than that of the second-best DCSAN model; on other datasets, the model proposed in this patent is better than the comparison model, and the average F1 score is 0.75% higher than that of the second-best model. These results verify the effectiveness and superiority of the named entity recognition method proposed in this patent in the Chinese named entity recognition task.
[0218] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
Claims
1. A Chinese named entity recognition method combining vocabulary enhancement and adversarial learning, characterized in that: The following steps are involved: S1, receiving structured and / or unstructured text data and performing preprocessing; S2, uses a pre-trained language model to convert characters in the text into vector representations, capturing semantic and grammatical information; S3, adds small perturbations to the character embedding and iteratively updates it through the PGD algorithm to obtain adversarial samples, thereby improving the model's robustness to noise and erroneous inputs, as well as its ability to recognize fuzzy entity boundaries; S4, matches related words through an external dictionary, fuses lexical embedding information into character embedding, and flexibly regulates the influence of lexical information on character representation through learnable attention mechanism and word information weight; S5, extracts the multi-layer output of the pre-trained language model and dynamically fuses the semantic features of different layers with a learnable weighting strategy to obtain richer high-dimensional semantic representation; S6, use conditional random fields to decode the features sequentially and predict the entity label of each character; S7, format and output the recognition results according to requirements.
2. The Chinese named entity recognition method combining vocabulary enhancement and adversarial learning according to claim 1 is characterized in that: In step S7 , the format is one of JSON, XML, CSV, or any combination thereof.
3. The Chinese named entity recognition method combining vocabulary enhancement and adversarial learning according to claim 1 is characterized in that: In step S1 , the preprocessing includes one of sentence segmentation, noise removal, and format normalization, or any combination of processing methods.
4. The Chinese named entity recognition method combining vocabulary enhancement and adversarial learning according to claim 1 is characterized in that: Step S3 includes: d (0) =0 (1) Among them, δ (0) represents the initial disturbance; Among them, g (t) is the gradient calculated in the tth iteration; Represents the loss function Partial derivatives with respect to the variable δ; Represents the loss function for the named entity recognition task; f θ () represents the named entity recognition model; X is the input sample; δ (t) is the current disturbance; Y is the corresponding true label; Among them, δ (t+1) is the gradient calculated in the t+1th iteration; clip ∈ () means limiting the disturbance to the maximum amplitude ∈; δ (t) is the current disturbance; α is the step size; g (t) is the gradient calculated in the tth iteration; ‖g (t) ‖ p g (t) The p-norm of ; X adv =X+δ (T) (4) Among them, X adv is the generated adversarial sample; X is the input sample; δ (T) represents the perturbation amount generated after T iterations; T is the number of iterations.
5. The Chinese named entity recognition method combining vocabulary enhancement and adversarial learning according to claim 1, characterized in that: Step S4 includes: Linear transformation: in, Represents the linearly transformed embedding vector of the jth word matched by the i-th character; Represents the original embedding vector of the jth word matched by the i-th character; W v and b v are learnable parameters; Attention weight calculation: in, Indicates the attention weight corresponding to the jth word matched by the i-th character; Represents the linearly transformed embedding vector of the jth word matched by the i-th character; h i Represents the embedding vector of the i-th character; K represents the number of matched words; Represents the embedding vector of the k-th word matched by the i-th character after linear transformation; Lexical Information Fusion: in, Represents the fused vocabulary vector; K represents the number of matched words; Indicates the attention weight corresponding to the jth word matched by the i-th character; Represents the linearly transformed embedding vector of the jth word matched by the i-th character; Fuse to character representation: in, represents enhanced character representation; h i Represents the embedding vector of the i-th character; λ is the learnable word information weight; Represents the fused vocabulary vector.
6. The Chinese named entity recognition method combining vocabulary enhancement and adversarial learning according to claim 1, characterized in that: Step S5 includes: Weight normalization: Among them, α (l) Represents the normalized weight coefficient of the lth layer; w( l ) represents the weight of the lth layer; L represents the number of pre-trained model layers; w( k ) represents the weight of the kth layer; Weighted Fusion: in, represents the fused vector; L represents the number of pre-trained model layers; α (l ) represents the normalized weight coefficient of the lth layer; The hidden state vector representing the position of the i-th character in the l-th layer.
7. A computer system, characterized in that: include: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to implement the Chinese named entity recognition method combining vocabulary enhancement and adversarial learning as described in one of claims 1 to 6 when executing the executable instructions.
8. A computer-readable storage medium, characterized in that: include: a memory having a computer program stored thereon; A processor is used to execute the program in the memory to implement the Chinese named entity recognition method combining vocabulary enhancement and adversarial learning as described in any one of claims 1 to 6.
9. A Chinese named entity recognition device combining vocabulary enhancement and adversarial learning, characterized in that: It includes input processing module, embedding layer module, adversarial training module, vocabulary information injection module, decoding module and output module; The input processing module is used to receive structured or unstructured Chinese text data and perform preprocessing; The embedding layer module is used to convert the preprocessed text into character embedding representation, using the pre-trained model to capture the semantic information at the character level; The adversarial training module is used to generate adversarial samples by adding small perturbations based on character embedding, thereby improving the robustness to noise and non-standard data, so that the model can still maintain high performance in complex scenarios; The vocabulary information injection module is used to semantically enhance character embeddings using external dictionary information. It selectively fuses matched vocabulary information through learnable weights and attention mechanisms, allowing the model to autonomously learn the contribution of vocabulary information in representation. The semantic information aggregation module is used to integrate the multi-layer output of the pre-trained language model, introduce learnable layer weights and dynamic fusion strategies, so that the model can autonomously determine the participation of semantic features at each layer according to actual task needs and obtain the best semantic representation; The decoding module is used to use conditional random fields to perform sequence decoding and generate the final entity recognition result; The output module is used to output the recognition results in a preset format.
10. The Chinese named entity recognition device combining vocabulary enhancement and adversarial learning according to claim 9, characterized in that: The preset formats include JSON, XML, CSV or any combination thereof.
Citation Information
Patent Citations
Model training method and named entity identification method and device
CN114611514A
Chinese named entity recognition method and system based on vocabulary enhancement and deep learning
CN116011455A
Medical named entity recognition robustness enhancement method and system
CN116796749A
Text classification method based on multi-layer feature weighted fusion of mask and causal language model
CN118332116A
Multi-granularity fusion model-based intelligent semantic chinese sentence matching method, and device
WO2021164199A1