Identification method and system for complex named entity of natural language text
By introducing BART models and feature enhancement networks in complex named entity recognition, and learning entity category information using self-attention and cross-attention mechanisms, the problem of inaccuracy and efficiency in existing methods is solved, and more accurate and efficient are achieved entity identification.
Patent Information
- Application Number
- CN202310792590.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-30
- Publication Date
- 2024-12-31
AI Technical Summary
The existing complex named entity recognition methods based on sequence generation lack the utilization of entity category information, resulting in low recognition accuracy and efficiency, and the inability to provide accurate and complete entity information.
The candidate entity generation module and feature enhancement network based on the BART model are used to learn the position and category information of entities through self-attention and cross-attention mechanisms, generate candidate entities with strong position correlation, and filter through multi-layer perceptrons. Improve the accuracy and efficiency of entity recognition.
It significantly improves the recognition accuracy and recall rate of complex named entities, reduces the invalid output rate, provides more accurate and comprehensive entity characteristics, and improves the effect and accuracy of entity recognition.
Smart Images

Figure CN119227684A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of natural language processing, and in particular to a method and system for identifying complex named entities in natural language text. Background Art
[0002] In recent years, with the rapid development of information technology, products based on natural language processing technology such as dialogue generation, sentiment analysis, and machine translation have provided convenience and speed to people's lives. Faced with a huge amount of data, these products need to convert unstructured text data into structured text data before they can further use the data information to provide stable and effective services. The core technology for converting unstructured text data into structured text data is named entity recognition technology. By extracting entities of specific categories such as people, time, and place in the text, downstream tasks will be able to obtain more accurate processing objects, thereby effectively improving the efficiency and accuracy of the entire system.
[0003] Named entity recognition technology can be roughly divided into three types: ordinary named entity recognition technology, nested entity recognition technology, and complex named entity recognition technology. Among them, complex named entity recognition technology is the most versatile technology. It can not only recognize ordinary entities, but also effectively process complex named entities composed of nested entities and discontinuous entities. Due to its wide range of application scenarios, complex named entity recognition technology has recently attracted the interest of scholars. Existing complex named entity recognition technology can be mainly divided into two categories: fragment-based and sequence-based generation. The fragment-based method first enumerates and segments the text to include complex entities as much as possible, and then classifies and recognizes each text fragment to extract complex named entities. The sequence-based method uses the encoder of the model to learn the features of each word in the text, and then uses the decoder to select the words with the strongest feature association to form the output. Since the sequence-based method is not subject to the performance limitations brought by enumeration and segmentation, it has better effects in processing discontinuous entities. This type of method has become the mainstream technology of current research. For example, foreign scholars use LSTM as an encoder and construct a decoder based on a pointer network to realize the recognition of complex named entities. These technologies effectively improve the recognition accuracy of complex named entities, especially in the fields of medicine, biology, chemistry, etc., which can provide great support for information extraction.
[0004] There are two main shortcomings of the existing complex named entity methods based on sequence generation. First, the existing methods lack the use of entity category information. Since the category information of the entity is closely related to the entity content, the neglect of this information in the entire entity recognition process inevitably affects the accuracy of the extraction and classification of existing complex named entities. Secondly, the existing methods have a high invalid output rate. Due to the lack of guided learning of the output template, the existing methods often have the situation where the output does not match the specified template, resulting in the result still being unstructured text and cannot be used by subsequent downstream tasks. Therefore, these methods cannot provide accurate and complete entity information. Summary of the invention
[0005] The purpose of the present invention is to address the shortcomings of existing complex named entity recognition methods based on sequence generation, and to propose a method and system for recognizing complex named entities in natural language texts. Based on prompt guidance and entity representation enhancement, the performance of the complex entity recognition system is improved, the invalid output rate is reduced, the recall rate is increased, and more accurate and comprehensive entity features are obtained by utilizing category information, thereby achieving accurate and efficient entity recognition.
[0006] To achieve the above purpose, the technical solution adopted by the present invention is as follows:
[0007] A method for identifying complex named entities in natural language text comprises the following steps:
[0008] Construct a candidate entity generation module and an entity screening module. The candidate entity generation module includes an input-output template and a BART model. The BART model adopts an encoder-decoder structure. The candidate entity screening module includes a feature enhancement network and a multi-layer perceptron. The feature enhancement network includes a self-attention mechanism module and a cross-attention mechanism module.
[0009] Train the candidate entity generation module. The training data is filled into the input template and input into the BART encoder. The BART encoder learns the relationship between the word segments in the text and between the word segments and the target entity category based on the self-attention mechanism. The BART decoder generates candidate entities with strong position correlation based on the cross-attention mechanism under the guidance of the output template.
[0010] Train the candidate entity screening module. The feature enhancement network obtains the weight relationship between each segmentation within the entity through the self-attention mechanism, and represents the target feature in the weighted form of each component segmentation of the entity through the cross-attention mechanism to enhance the features of the candidate entity. The multi-layer perceptron determines whether the candidate entity is a real entity of the corresponding category based on the enhanced features of the candidate entity.
[0011] The natural language text to be processed is taken as the input text, and is processed by the trained candidate entity generation module and entity screening module to identify the entities in the text.
[0012] Furthermore, when training the candidate entity generation module, the training data is filled with the target type entity and the text in which it is located according to the format of the input template, the word segmentation at the adjacent position of the target entity is marked, and non-entity negative samples are selected.
[0013] Furthermore, when training the candidate entity generation module, the self-attention mechanism in the BART encoder represents each participle as the weight of all participles, so that the participle features contain correlation features between participles and between participles and categories.
[0014] Furthermore, when training the candidate entity generation module, the output template is used as the input of the BART decoder, and the probability weights of each word under the current output are obtained through the cross-attention mechanism. Then, by maximizing the current output probability, the word with the highest weight is selected as the current output.
[0015] Furthermore, when training the candidate entity generation module, the BART decoder output probability is optimized by iteratively updating the various weight parameters of the self-attention mechanism and the cross-attention mechanism in the BART model, and the error with the output template content is calculated until the output of the BART decoder is consistent with the content of the output template.
[0016] Furthermore, when training the candidate entity screening module, positive and negative examples and their texts and categories are input into the BART encoder trained in the candidate entity generation module to obtain the corresponding representation, which is used as data for training the candidate entity screening module.
[0017] Furthermore, when training the candidate entity screening module, the text context features and category features of the candidate entities are passed through a stacked feature enhancement network to obtain multi-granularity enhanced text context and category feature representations, and then these two features are concatenated as the input of the multi-layer perceptron.
[0018] Furthermore, when training the candidate entity screening module, the weights in the attention mechanism module and the multi-layer perceptron in the feature enhancement network are continuously optimized until the discriminant output of the multi-layer perceptron is consistent with the label.
[0019] Furthermore, the input template contains category information of the entity to be extracted, and the category information and the text to be processed are converted into a representation form that can be processed by the BART model through the word segmentation operation of the BART model.
[0020] Furthermore, when the natural language text to be processed is used as input text, the target type entity and its text in the text are filled in according to the format of the input and output template.
[0021] A complex named entity recognition system for natural language text, including:
[0022] The candidate entity generation module includes input and output templates and a BART model. The BART model adopts an encoder-decoder structure. The BART encoder learns the relationship between word segments and between word segments and target entity categories in the text based on the self-attention mechanism. The BART decoder generates candidate entities with strong position correlation under the guidance of the output template based on the cross-attention mechanism.
[0023] The candidate entity screening module includes a feature enhancement network and a multi-layer perceptron. The feature enhancement network includes a self-attention mechanism module and a cross-attention mechanism module. The feature enhancement network obtains the weight relationship between each segmentation within the entity through the self-attention mechanism, and represents the target feature in the weighted form of each component segmentation of the entity through the cross-attention mechanism to enhance the features of the candidate entity; the multi-layer perceptron determines whether the candidate entity is a real entity of the corresponding category based on the enhanced features of the candidate entity;
[0024] Among them, the candidate entity generation module and the entity screening module are used to process the natural language text to be processed and identify the entities in the text after being trained.
[0025] The beneficial effects achieved by the present invention are as follows:
[0026] 1. Improve recognition effect: By introducing input and output templates containing position information and category information and prompt learning guidance of the candidate entity generation module, the present invention can generate candidate entities that are highly relevant to the target complex entity in terms of position and significantly reduce the probability of invalid output. With the guidance of the template, the candidate entity generation module can provide more accurate and comprehensive candidate entities, thereby improving the recall rate of the system and improving the recognition effect.
[0027] 2. Enhanced entity features: The present invention uses a candidate entity screening module based on a feature enhancement network to enhance the contextual features and category features of candidate entities through self-attention mechanism and cross-attention mechanism. This can enhance the feature expression of candidate entities, improve the distinction between entities and non-entities, and thus ensure the accuracy of entity recognition.
[0028] 3. Use category information to improve the accuracy of candidate entities: The prompt guidance template of the present invention injects entity category information into the input, thereby guiding the candidate entity generation module to generate candidate entities that match the target entity category. This can provide more accurate and comprehensive candidate entities and increase the accuracy of entity recognition.
[0029] 4. Complete entity recognition process: The present invention combines the candidate entity generation module and the candidate entity screening module to form a complete entity recognition process. The candidate entity generation module generates candidate entities and categories related to the target entity, and then the candidate entity screening module uses the feature enhancement network to further screen and enhance the candidate entities, thereby improving the overall recognition effect and accuracy.
[0030] The present invention realizes accurate recognition and differentiation of complex entities by introducing input and output templates and prompt learning guidance, and the coordinated application of candidate entity generation module and candidate entity screening module, thereby improving the performance and effect of entity recognition system. Through template guidance, feature enhancement and category information utilization, the present invention can provide more accurate and comprehensive candidate entities and reduce the invalid output rate, thereby significantly improving the effect and accuracy of entity recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 It is a flow chart of a method for identifying complex named entities in natural language text according to the present invention. DETAILED DESCRIPTION
[0032] In order to make the various technical features and advantages or technical effects in the above technical solutions of the present invention more obvious and easy to understand, they are described in detail below with reference to the accompanying drawings.
[0033] The technical solution of the complex named entity recognition method and system based on prompt guidance and entity representation enhancement in natural language text proposed in the present invention is mainly implemented based on a candidate entity generation module and a candidate entity screening module.
[0034] 1. Candidate entity generation module:
[0035] Category label information is additionally introduced into the input template. The template information is used to guide the attention mechanism in the BART encoder to capture and effectively learn the relationship between each word segment and the target entity category in the text to be processed. It can build a more complete and accurate feature representation for each word segment, and then guide the BART decoder to combine the output template position information. According to the feature representation of each word segment, it selects the word segment and category with stronger correlation, so as to maximize the conditional probability of decoding, and use the corresponding position information as output, thereby realizing the generation of candidate entities with strong position correlation and reducing the invalid output rate of the system.
[0036] Among them, the feature representation formula of the input sentence obtained by the BART encoder is:
[0037] H={h1,h2,…,h l}…
[0038] Where H represents the feature representation sequence of the entire input sentence, and h represents the feature representation of each position in the feature representation sequence of the input sentence.
[0039] Under the guidance of the output template, the BART decoder selects the most relevant word segmentation candidate entities according to the word segmentation features, and the output result formula generated is:
[0040] y t =Decoder(H, Y <t )
[0041] In the formula, y t represents the output result generated by the BART decoder, where t represents the generated time step; Decoder represents the decoder in the BART model; H represents the feature representation sequence of the entire input sentence; Y <t Represents the partial output sequence previously generated, including the output results from time steps 1 to t-1.
[0042] 2. Candidate entity screening module:
[0043] By stacking a feature enhancement network constructed by the self-attention mechanism and the cross-attention mechanism, this module can strengthen the features of candidate entities from the perspectives of text context and entity category, increase the distinction between entities and non-entities, and enable complex named entities to be successfully identified, thereby improving the accuracy of the system.
[0044] The formula of the self-attention mechanism in the feature enhancement network is:
[0045]
[0046] Where SelfAttn represents the output of the self-attention mechanism; softmax represents the softmax function used to calculate the attention weight; Q represents the query vector, which is used to measure the importance of each position; K represents the key vector, which is used to provide the relevance information of each position; T represents the transposition operation; d k represents the dimension of the query vector and the key vector, that is, the number of attention heads; V represents the value vector, which contains the feature representation of each position; Q, K, and V come from the same input value.
[0047] The formula for the cross-attention mechanism in the feature enhancement network is:
[0048]
[0049] In the formula, CrossAttn represents the output result of the cross attention mechanism; softmax represents the softmax function used to calculate the attention weight; Q represents the query vector, which is used to measure the relationship between each position and the target entity category; K represents the key vector, which is used for the correlation information between each position and the target entity category; T represents the transposition operation; d k represents the dimension of the query vector and the key vector, that is, the number of attention heads; V represents the value vector, which contains the feature representation of each position; Q, K, and V come from different input values.
[0050] The candidate entity representation formula after feature enhancement is:
[0051] F=[U c ; U l ]
[0052] Where F represents the candidate entity representation after feature enhancement; U c Represents contextual features, including information about the candidate entity in the context; U l Represents the category feature, which contains the category information of the candidate entity.
[0053] The candidate entity discrimination formula is:
[0054] Prob=MLP(F)
[0055] Where Prob represents the probability of the candidate entity, that is, the probability that the model predicts that the candidate entity is an entity; MLP represents a multi-layer perceptron, which is used to perform classification prediction on the candidate entity representation F after feature enhancement.
[0056] The present invention combines the text information to be processed with the input template and inputs it into the BART model. The candidate entity generation module can firstly use the attention mechanism in the BART encoder under the guidance of the template information to capture and effectively learn the relationship between each word segmentation and the target entity category in the text to be processed, and can construct a more complete and accurate feature representation for each word segmentation. Then, the BART decoder combines the output template position information, selects the word segmentation and category with stronger correlation according to the feature representation of each word segmentation, maximizes the conditional probability of decoding, and uses the corresponding position information as output, thereby realizing the generation of candidate entities with strong position correlation.
[0057] In addition, the candidate entity screening module further screens the generated candidate entities to improve the accuracy of the system. By stacking the feature enhancement network constructed by the self-attention mechanism and the cross-attention mechanism, the candidate entity screening module can enhance the features of the candidate entities from the perspectives of text context and entity category, thereby increasing the distinction between entities and non-entities, allowing complex named entities to be successfully identified.
[0058] The present invention provides a complex named entity recognition method for natural language text, which specifically comprises the following steps:
[0059] Step 1. Data preprocessing: divide the text information to be processed into two parts: training set and test set. The target type entity in the text and the corresponding text are filled in according to the format of the input and output template. In addition, for the training data set, the word segments of the adjacent positions of the target entity are marked, and some of them are selected and combined with the target entity to form non-entity negative samples for training the candidate entity screening module.
[0060] Step 2. Construct a candidate entity generation module. This module is mainly composed of input and output templates and a BART model. The input template introduces the category information of the entity to be extracted, and the text to be processed is transformed into a representation that can be processed by the model through the word segmentation operation of the BART model. The self-attention mechanism in the BART encoder can obtain the representation of each word segmentation obtained by weighting all word segmentations, and then capture the feature relationship between each word segmentation and between word segmentation and category information. Then, the cross-attention mechanism in the BART decoder, under the guidance of the output template, selects the highly relevant word segmentations according to the decoded part as the next output, thereby avoiding invalid output and extracting candidate entities.
[0061] Step 3. Train the candidate entity generation module. First, the input template content in the training data is used as the input of the BART encoder. The self-attention mechanism in the BART encoder represents each word segmentation as the weight of all word segmentations, so that the word segmentation features contain correlation features between word segmentations and between word segmentations and categories. Then, the output template is used as the input of the BART decoder, and the probability weights of each word segmentation under the current output are obtained through the cross-attention mechanism. Then, by maximizing the current output probability, the word segmentation with the highest weight is selected as the current output. By iteratively updating the various weight parameters of the self-attention mechanism, cross-attention mechanism, etc. in BART, the decoder output probability is continuously optimized, and the error with the output template content is calculated until the output of the BART decoder is consistent with the content of the output template, and the final optimal model is obtained.
[0062] Step 4. Construct a candidate entity screening module. This module is mainly composed of a feature enhancement network and a multi-layer perceptron. Among them, the core structure of the feature enhancement network is the self-attention mechanism module and the cross-attention mechanism module. The self-attention mechanism can obtain the weight relationship between each participle within the entity, which is conducive to handling the nested entity composed of entities. The cross-attention mechanism represents the target feature in the weighted form of each component participle of the entity, thereby enhancing the correlation between the entity and the target feature and expanding the feature difference between entities. The multi-layer perceptron judges whether the candidate entity is a real entity of the corresponding category based on the enhanced entity features.
[0063] Step 5. Train the candidate entity screening module. First, the positive and negative samples used for screening module training and the corresponding texts and categories are input into the trained BART encoder in the candidate entity generation module to obtain the corresponding representation as the input of the feature enhancement network. The present invention mainly enhances the text context features and category features of the candidate entities. The two features are respectively passed through a stacked feature enhancement network to obtain multi-granularity enhanced text context and category feature representations, and then the two features are spliced as the input of the multi-layer perceptron. During the training process, the weights in the attention mechanism module and the multi-layer perceptron in the feature enhancement network are continuously optimized until the discrimination output of the multi-layer perceptron is consistent with the label.
[0064] Step 6. Put the input data in the test set into the candidate entity generation module. The candidate entity generation module obtains the connection between word segmentation and word segmentation, word segmentation and category and constructs features according to the prompt guidance of the template in the input data. Then, according to the goal of maximizing the output probability, word segmentation is selected and candidate entities and corresponding categories are formed as output. The candidate entity screening module uses the BART encoder encoding corresponding to the candidate entity and its text and predicted category as input for feature enhancement. The enhanced candidate entity context and category features are spliced and input into the multi-layer perceptron for judgment. If the judgment is yes, the output of the entity in the candidate entity generation module is retained as the entity recognition result.
[0065] To better illustrate the technical solution of the present invention, a specific embodiment is given below, which is further illustrated by taking the identification of entities "pain in hip" and "pain in knee" of the drug reaction category in the sentence "I have a pain in hip and knee." as an example.
[0066] Step 1. Divide the text information to be processed into a training set and a test set. The target type entity in the text and the corresponding text are filled in according to the format of the input and output template. In addition, for the training data set, the word segments of the adjacent positions of the target entity are marked, and some of them are selected to combine with the target entity to form non-entity negative samples such as "a pain inhip", "in knee", etc. for training the candidate entity screening module;
[0067] Step 2. Construct a candidate entity generation module. Figure 1As shown in the figure, the candidate entity generation module includes an input template, a BART encoder, a BART model decoder and an output template. First, in the candidate entity generation module, the sentence to be recognized is combined with the input template to form the input sentence of the module "Extract the reaction entity in sentence. I have a pain in hip and knee." Then the feature representation H of the input sentence is obtained through the BART encoder: H = {h1,h2,…,h l}, where h i is the feature representation of the i-th word in the sentence to be recognized. Under the guidance of the output template, the BART decoder selects the most relevant word according to the word feature to form the output result Y of the candidate entity. The output result y at time t t For example, y t =Decoder(H,Y <t ), where Decoder represents the BART decoder, Y <t Represents all output results before time t.
[0068] Step 3. Train the candidate entity generation module. During the training process, each output of the candidate entity generation module is compared with the result of the output template, and the cross entropy loss is calculated, and then the gradient is back-propagated to adjust the weights of various parameters of the attention mechanism in the BART encoder and decoder. Finally, after completing the predetermined number of iterations or the output of the trained module is consistent with the result of the template, the iteration is stopped to obtain the candidate entity generation module with the best effect after training.
[0069] Step 4. Build a candidate entity screening module. Figure 1 As shown in the candidate entity screening section, this module is mainly composed of a feature enhancement network and a multi-layer perceptron. Among them, the core structure of the feature enhancement network is the self-attention mechanism module and the cross-attention mechanism module. The self-attention mechanism can be expressed as Where Q, K, V are the same input value and the corresponding weight matrix W Q ,W K ,W V By using the self-attention mechanism, the candidate entity screening module can obtain the weight relationship between each word in the entity, which is helpful for processing the nested entity composed of entities. The cross attention mechanism can be expressed as Where Q, K, and V are different input values and the corresponding weight matrix W respectively. Q ,W K ,W VThe cross-attention mechanism represents the target feature as the weighted form of each entity component, thereby enhancing the correlation between the entity and the target feature and expanding the feature differences between entities. Through the feature enhancement network, the candidate entity screening module can obtain the enhanced context feature U of the candidate entity c and the category feature U l . The two features are concatenated to form the feature F of the candidate entity, F = [U c ; U l ] Based on this feature, the multi-layer perceptron judges whether the candidate entity is a real entity of the corresponding category and outputs the corresponding discriminant label.
[0070] Step 5. Train the candidate entity screening module. First, the positive and negative examples used for screening module training, such as "pain in hip", "a pain in hip", "in knee" and the corresponding text "I have a pain in hip and knee." and the category "reaction", are input into the trained BART encoder in the candidate entity generation module to obtain the corresponding entity representation H e , the context indicates H c And the category representation H l As the input of the feature enhancement network. After being processed by the self-attention mechanism and the cross-attention mechanism, the multi-granular enhanced text context and category feature representation U is obtained. c and U l , and then concatenate the two features as the input of the multilayer perceptron. During the training process, the output of the multilayer perceptron is compared with the actual label and the mean square error loss is obtained to continuously optimize the W in the attention mechanism module in the feature enhancement network. Q ,W K ,W V The weights of each layer in the multi-layer perceptron are adjusted until the discriminant output of the multi-layer perceptron is consistent with the label, and the optimal candidate entity screening model is obtained.
[0071] Step 6. Entity recognition. The input data in the test set is put into the candidate entity generation module. The candidate entity generation module obtains the connection between word segmentation and word segmentation, word segmentation and category and constructs features according to the prompt guidance of the template in the input data. Then, according to the goal of maximizing the output probability, word segmentation is selected to form candidate entities and corresponding categories as output. The candidate entity screening module uses the BART encoder encoding corresponding to the candidate entity and its text and predicted category as input for feature enhancement. The enhanced candidate entity context and category features are spliced and input into the multi-layer perceptron for judgment. If the perceptron output probability value is greater than or equal to 0.5, it is yes, and the output of the entity in the candidate entity generation module is retained as the entity recognition result.
[0072] Experimental test:
[0073] The present invention was tested on four widely used datasets, and the measurement method used was the F1 value. The ACE series datasets are mainly news broadcast content, in which about 30% of the entities are nested entities; the GENIA dataset is biochemistry-related content, in which more than 20% of the entities are complex named entities; and the CADEC dataset is medical-related content, in which more than 10% of the entities are complex named entities.
[0074] The comparison methods selected by the present invention are MTL-BAM, BENSC, BARTNER and Pyramid. Among them, MTL-BAM is a common fragment-based entity recognition method, BARTNER is a common sequence-generated entity recognition method, and Pyramid is another type of method. The specific test results of the present invention are shown in Table 1:
[0075] Table 1
[0076]
[0077] As can be seen from Table 1, compared with the prior art, the present invention has achieved the best results in the tests on the four data sets, especially on the ACE2005 and GENIA data sets, the present invention has improved the maximum F1 values by 3.58 and 3.97 respectively, proving the technical advantages of the present invention.
[0078] Although the present invention has been disclosed as above by way of embodiments, it is not intended to limit the present invention. Appropriate modifications or equivalent substitutions of the technical solutions of the present invention made by ordinary technicians in the field should all be included in the protection scope of the present invention. The protection scope of the present invention shall be based on what is defined in the claims.
Claims
1. A method for identifying complex named entities in natural language text, characterized in that: The following steps are involved: Construct a candidate entity generation module and an entity screening module. The candidate entity generation module includes an input-output template and a BART model. The BART model adopts an encoder-decoder structure. The candidate entity screening module includes a feature enhancement network and a multi-layer perceptron. The feature enhancement network includes a self-attention mechanism module and a cross-attention mechanism module. Train the candidate entity generation module. The training data is filled into the input template and input into the BART encoder. The BART encoder learns the relationship between the word segments in the text and between the word segments and the target entity category based on the self-attention mechanism. The BART decoder generates candidate entities with strong position correlation based on the cross-attention mechanism under the guidance of the output template. Train the candidate entity screening module. The feature enhancement network obtains the weight relationship between each segmentation within the entity through the self-attention mechanism, and represents the target feature in the weighted form of each component segmentation of the entity through the cross-attention mechanism to enhance the features of the candidate entity. The multi-layer perceptron determines whether the candidate entity is a real entity of the corresponding category based on the enhanced features of the candidate entity. The natural language text to be processed is taken as the input text, and is processed by the trained candidate entity generation module and entity screening module to identify the entities in the text.
2. The method according to claim 1, characterized in that When training the candidate entity generation module, the training data is filled with the target type entity and its text according to the format of the input template, the word segmentation at the adjacent position of the target entity is marked, and non-entity negative samples are selected.
3. The method according to claim 1 or 2, characterized in that When training the candidate entity generation module, the self-attention mechanism in the BART encoder represents each participle as the weight of all participles, so that the participle features contain correlation features between participles and between participles and categories.
4. The method according to claim 1 or 2, characterized in that: When training the candidate entity generation module, the output template is used as the input of the BART decoder. The probability weights of each word under the current output are obtained through the cross-attention mechanism. Then, by maximizing the current output probability, the word with the highest weight is selected as the current output.
5. The method according to claim 4, characterized in that When training the candidate entity generation module, the BART decoder output probability is optimized by iteratively updating the various weight parameters of the self-attention mechanism and cross-attention mechanism in the BART model, and the error with the output template content is calculated until the output of the BART decoder is consistent with the content of the output template.
6. The method according to claim 1, characterized in that When training the candidate entity screening module, positive and negative examples and their texts and categories are input into the BART encoder trained in the candidate entity generation module to obtain the corresponding representation, which is used as data for training the candidate entity screening module.
7. The method according to claim 1 or 6, characterized in that When training the candidate entity screening module, the text context features and category features of the candidate entities are passed through a stacked feature enhancement network to obtain multi-granularity enhanced text context and category feature representations, and then these two features are spliced as the input of the multi-layer perceptron.
8. The method according to claim 7, characterized in that When training the candidate entity screening module, the weights in the attention mechanism module and the multi-layer perceptron in the feature enhancement network are continuously optimized until the discriminant output of the multi-layer perceptron is consistent with the label.
9. The method according to claim 1, characterized in that The input template contains the category information of the entity to be extracted. The category information and the text to be processed are converted into a representation that can be processed by the BART model through the word segmentation operation of the BART model.
10. A complex named entity recognition system for natural language text, characterized in that: include: The candidate entity generation module includes input and output templates and a BART model. The BART model adopts an encoder-decoder structure. The BART encoder learns the relationship between word segments and between word segments and target entity categories in the text based on the self-attention mechanism. The BART decoder generates candidate entities with strong position correlation under the guidance of the output template based on the cross-attention mechanism. The candidate entity screening module includes a feature enhancement network and a multi-layer perceptron. The feature enhancement network includes a self-attention mechanism module and a cross-attention mechanism module. The feature enhancement network obtains the weight relationship between each segmentation within the entity through the self-attention mechanism, and represents the target feature in the weighted form of each component segmentation of the entity through the cross-attention mechanism to enhance the features of the candidate entity. The multi-layer perceptron determines whether the candidate entity is a real entity of the corresponding category based on the enhanced features of the candidate entity. Among them, the candidate entity generation module and the entity screening module are used to process the natural language text to be processed and identify the entities in the text after being trained.
Citation Information
Cited By
Multi-language rapid processing method for ERP system
CN119849511A
Text entity recognition model construction method and equipment based on large model data enhancement
CN120995985A