A small sample entity recognition method combining character-aware and sentence-aware
By combining the method of character perception and sentence perception, combined with the prototype network, the overfitting problem of the small-sample named entity recognition model is solved when the data is insufficient, the recognition accuracy and robustness are improved, and the small-sample entity recognition task is achieved. performance improvement.
Patent Information
- Application Number
- CN202210117815.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-08
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2042-02-08
AI Technical Summary
Existing small-sample named entity recognition models are prone to overfitting when there is less data, and ignore the semantic correlation between sentences, resulting in low efficiency in small-sample entity recognition tasks.
Using a method of combining character perception and sentence perception, sentence features are extracted through a one-dimensional convolutional neural network, the correlation between sentences and characters is calculated, and the prototype network is combined to obtain the prototype of the entity category, improving the model's performance in small sample entity recognition tasks. performance.
The robustness and accuracy of the model are improved, and entity categories can be identified more accurately, especially when there is insufficient data, and the performance is better than the existing state-of-the-art models.
Smart Images

Figure CN114547241B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of natural language processing, and in particular to a small sample entity recognition method combining character perception and sentence perception. Background Art
[0002] In natural language learning, named entity recognition is an important task in information extraction, which aims to identify and classify the components representing entities in text. In general corpora, named entity recognition tasks have obtained fairly high-quality solutions. However, in practical applications, rich corpora are not common, and there are often insufficient resources, such as lack of data annotation, and the small number of entities in a certain category in the corpus is not enough to obtain accurate entity categories through training. In order to solve the above problems, few-shot learning (FSL) technology was proposed and rapidly promoted. Few-shot learning can not only reduce the burden of annotated data, but also enable the model to be quickly extended to new tasks without the need for retraining (usually only 1 or 5 reference samples are given for each category). Few-shot learning has made significant progress in many fields. For example, in the field of computer vision and relation extraction in the field of natural language processing, few-shot learning has been widely studied and achieved breakthroughs.
[0003] In the past, named entity recognition has only achieved good results in large sample scenarios and limited entity categories (names of people, places, and organizations). Compared with other information retrieval tasks, it is more likely to overfit when there is less data. To alleviate this drawback, small sample learning models are used in named entity recognition (NER) tasks, and the prototypical network is one of the simple and efficient models. The basic idea of the prototypical network for small sample naming is to learn the prototype representation of each predefined category, and then classify the samples according to the nearest prototype. Most existing small sample entity recognition models focus on the massive semantic information hidden in the entity space. For example, in previous entity recognition, entities belonging to non-predefined categories are usually classified into the same category (other class, O-class). In order to further learn the prototype representation, (Tong et al. 2021) used clustering methods to make a finer division of entity categories (Other-class) outside the predefined categories. However, they ignore the rich semantics of sentences containing multiple entity categories. At the same time, these methods are all based on coarse-grained entity classification or slot filling in dialogue tasks, which are relatively inefficient for small sample entity recognition. Therefore, it can be said that the existing prototype methods only roughly consider the similarity between entities in the support set and the query set, while ignoring the semantic relevance between sentences containing these entities. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a small sample entity recognition method that combines character awareness and sentence awareness. The method utilizes the correlation between sentences and the correlation between characters to improve the performance of the model on the small sample entity recognition task, thereby improving the robustness and accuracy of the model.
[0005] In order to solve the above technical problems, the present invention adopts the following technical method: a small sample entity recognition method based on a prototype network, characterized in that it includes the following steps:
[0006] S1, through an embedding function f with learning parameters θ θ (), encode each character in the support set and query set into a continuous D-dimensional embedding vector;
[0007] X i =f θ (x i ), X i ∈R D (1)
[0008] S2. Construct a sentence-aware model that captures the correlation between sentences in the support set and the query set in a small sample, or a character-aware model that captures the correlation between characters in the support set and the query set in a small sample. The prototype network obtains prototypes of all entity categories based on the examples in the support set and the correlation between sentences in the support set and the query set obtained by the sentence-aware model, or the correlation between characters in the support set and the query set obtained by the character-aware model.
[0009] S3, calculate the distance between the query entity and each category prototype;
[0010] S4. Determine the category distribution of the query entity according to the distance obtained in step S3.
[0011] Furthermore, in step S2, the sentence-aware model obtains the correlation between the support set and the query set sentences using the following method:
[0012] First, use a one-dimensional convolutional neural network to extract each sentence s in the query set q features and encodes them into a continuous low-dimensional sentence vector h q ;
[0013] h q =conv(s q <q1,.....,q n >) (2)
[0014] Then use a one-dimensional convolutional neural network to extract each sentence s in the support set l features and encodes them into a continuous low-dimensional sentence vector
[0015]
[0016] Finally, the correlation α between sentences is calculated as follows l ;
[0017]
[0018] In step S2, the prototype network obtains the prototypes of all entity categories based on the examples in the support set and the correlation between the support set and the query set sentences:
[0019]
[0020] In the formula, |c i | belongs to entity category c i The number of characters;
[0021] In step S3, the distance between the query entity and each category prototype is:
[0022]
[0023] In step S4, the category distribution of the query entity is determined using the following formula.
[0024]
[0025] Alternatively, in step S2, the character perception model uses the following formula to obtain the correlation between the characters of the support set and the query set in the small sample;
[0026]
[0027] In the formula, β j Represents query entities q and c i x in the class j Correlation coefficients between entities;
[0028] In step S2, the prototype network obtains the prototypes of all entity categories based on the examples in the support set and the correlation between the support set and the query set sentences:
[0029]
[0030] In the formula, |c i | belongs to entity category c i The number of characters;
[0031] In step S3, the distance between the query entity and each category prototype is:
[0032]
[0033] In step S4, the category distribution of the query entity is determined using the following formula.
[0034]
[0035] Preferably, when constructing the sentence perception model or the character perception model, the cross entropy loss function of the sentence perception model or the character perception model is minimized by the following formula;
[0036]
[0037] In the formula, g θ is a sentence-aware model or a character-aware model; λ is a weight decay parameter; l is a cost function used to calculate the cross entropy between the true value label and the predicted label.
[0038] As another aspect of the present invention, a small sample entity recognition method combining character perception and sentence perception comprises the following steps:
[0039] S1. The aforementioned small sample entity recognition method based on prototype network is used to obtain the category distribution of the query entity in the small sample, wherein the prototype of the entity category is obtained by the prototype network according to the samples in the support set and the correlation between the support set and the query set sentences obtained by the sentence perception model;
[0040] S2. Using the aforementioned prototype network-based small sample entity recognition method to obtain the category distribution of the query entity in the small sample, wherein the prototype of the entity category is obtained by the prototype network based on the samples in the support set and the correlation between the support set and the query set characters obtained by the character perception model;
[0041] S3. Combining the category distributions obtained in steps S1 and S2, the final category distribution of the small sample query entity is obtained.
[0042] Further, in step S3, the final category distribution of the small sample query entity is obtained by combining the category distributions obtained in steps S1 and S2 through the following formula;
[0043]
[0044] Where δ is a hyperparameter representing the credibility of the sentence-aware model, and γ is a hyperparameter representing the credibility of the character-aware model.
[0045] Furthermore, the combined character-aware and sentence-aware small sample entity recognition method further includes step S4: after obtaining the category distribution in step S3, using the Viterbi decoder to obtain the transition rules between adjacent entity labels, and through the transition distribution g(y ′ ,y) to correct the category distribution.
[0046]
[0047] As another aspect of the present invention, a small sample entity recognition model based on a prototype network includes a prototype network and the aforementioned sentence perception model.
[0048] Alternatively, a small sample entity recognition model based on a prototype network includes a prototype network and the aforementioned character perception model.
[0049] As another aspect of the present invention, a small sample entity recognition model that combines character awareness and sentence awareness includes a prototype network and also includes the aforementioned sentence awareness model and character awareness model.
[0050] In order to solve the problem that traditional few-sample entity recognition methods are disturbed by semantically similar information, resulting in deviations and difficulty in accurately capturing categories, this paper proposes a new model that combines character perception and sentence perception for small-sample named entity recognition. Sentence perception is used to explore the semantic relevance between sentences, and character perception is used to explore the relevance between characters. The relevance between sentences and characters can be used to improve the performance of the model in the small-sample entity recognition task, while the advantages of character and sentence perception can be used to improve the robustness and accuracy of the model. Experimental results show that on the two latest small-sample named entity recognition datasets, the model provided by the present invention outperforms the existing most advanced models. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 The architecture diagram of the combined character-aware and sentence-aware small sample entity recognition model JSTA of the present invention;
[0052] Figure 2 A graph showing changes in the F1 value of the character perception model SAP in the training process on the validation set and the training set;
[0053] Figure 3 This is a graph showing changes in the F1 value of the sentence perception model TAP involved in the present invention on the validation set and the training set during the training process;
[0054] Figure 4 The class labeling diagrams of the entity "jakarta stockexchange" predicted from the sentence by SAP, TAP and JTSA respectively in the embodiment of the present invention;
[0055] Figure 5 The class labeling diagrams of the entity "Republic of the philippines commission elections" predicted from the sentence by SAP, TAP and JTSA respectively in the embodiment of the present invention;
[0056] Figure 6 It is a comparison chart of error indicators of ProtoNet, Struct, SAP, TAP, and JSTA in the implementation manner of the present invention. DETAILED DESCRIPTION
[0057] In order to facilitate the understanding of those skilled in the art, the present invention is further described below in conjunction with embodiments and drawings. The contents mentioned in the implementation modes are not intended to limit the present invention.
[0058] As mentioned in the previous background technology, among the current numerous small-sample models, the prototype network is a very effective model for small-sample named entity recognition, but it ignores the rich semantics of sentences containing multiple entity categories. At the same time, these methods are all based on coarse-grained entity classification or slot filling in dialogue tasks, which is relatively inefficient for small-sample entity recognition. The help of sentence-level semantic information for small-sample entity recognition can be attributed to the following two aspects: (1) Entity relations. A large number of sentences contain two or more entities. To some extent, sentences reflect the relationship between two entities, although this relationship does not need to be identified and classified in entity recognition tasks. However, entity relations in sentences can be used to improve category prototypes in small-sample entity recognition. (2) Positive and negative effects of O-class. Sentence-level semantics can use the rich semantics in other-class (O-class) to learn entity prototypes. Sentence semantics are embedded in sentence-level representations, focusing on contextual information in sentences without being affected by other class labels. Sentence embedding can represent each predefined entity class. This method can deal with the noise problem of O-class.
[0059] In order to solve the above problems, the inventors proposed a new model based on the prototype network, a small sample entity recognition model (JSTA) that combines character perception and sentence perception. Character perception considers the correlation between entities (entities are composed of characters), and then designs a sentence perception module based on character perception to learn semantic information from sentences and focus on the correlation between sentences containing entities. Through these two related information, entity recognition is assisted and the entity recognition ability of the model in a small sample scenario is improved. In fact, sentences often contain rich entity semantics, which can provide rich knowledge for discovering the best prototype of each entity class. In order to further improve small sample entity recognition, it is also possible to combine the model (SAP) with character perception and the model (TAP) with sentence perception for classification, so that the entity prototype in the sentence can be better learned. As the final model, JSTA combines character perception and sentence perception, realizes the deep interaction between characters and sentences, and can absorb their respective useful semantic information. The model calibrates the character level (token-level) prototype through the sentence-level prototype, which can effectively alleviate the noise brought by the O-class category entity and improve the small sample entity recognition. The present invention is described in detail below.
[0060] Example 1
[0061] A small sample entity recognition method based on prototype network includes the following steps:
[0062] S1, through an embedding function f with learning parameters θ θ(), encode each character in the support set and query set into a continuous D-dimensional embedding vector;
[0063] X i =f θ (x i ), X i ∈R D (1)
[0064] S2, obtain the prototypes of all entity categories;
[0065] S21. Construct a sentence-aware model TAP and use it to obtain the correlation between the support set and the query set sentences: First, use a one-dimensional convolutional neural network to extract each sentence s in the query set. q features and encodes them into a continuous low-dimensional sentence vector h q , where the encoder used to extract features from the support set and the query set shares parameters;
[0066]
[0067] Then use a one-dimensional convolutional neural network to extract each sentence s in the support set l features and encodes them into a continuous low-dimensional sentence vector
[0068]
[0069] Finally, the correlation α between sentences is calculated as follows l ;
[0070]
[0071] S22. The prototype network obtains the prototypes of all entity categories based on the examples in the support set and the correlation between the support set and the query set sentences obtained by the sentence perception model TAP; in sentence perception, the category prototype is redefined as follows, which can pay more attention to the query sentence s q and support set statements s l The relationship information between them;
[0072]
[0073] In the formula, |c i | belongs to entity category c i The number of characters;
[0074] S3, using a similarity measurement function to calculate the distance between the query entity and each category prototype;
[0075]
[0076] S4. Use the following formula to determine the category distribution of the query entity.
[0077]
[0078] In small sample entity recognition, o_class is a special query entity, which includes all entities that do not belong to predefined categories. There are huge differences between these entities, which brings great challenges to entity recognition. This embodiment 1 uses sentence semantics to alleviate this problem.
[0079] Example 2
[0080] A small sample entity recognition model based on a prototype network includes the prototype network and the sentence perception model TAP in the aforementioned embodiment 1.
[0081] It is worth mentioning that the model of the present invention is improved based on the prototype network, because the prototype network is a simple and efficient small sample learning method. For the small sample entity recognition task, the prototype network assumes that there is a prototype that can represent the category for each entity category, and each entity is clustered around the class prototype to which they belong. Therefore, the main purpose of the prototype network is to calculate a prototype representation for each entity category. The prototype network predicts the category label of the query entity q through three steps. First, the prototype network obtains the prototype P = {p1, p2, ..., p n}. Secondly, the distances between the query entity q and all category prototypes are calculated respectively. Finally, the query entity is classified into the nearest category. Specifically:
[0082] The first step is to use an embedding function f with learnable parameters θ θ (), encode each character in the support set and query set into a continuous D-dimensional embedding vector;
[0083] X i =f θ (x i ), X i ∈R D (1)
[0084] In the prototype network, the pre-trained language model Bert is used as the encoder f θ , and then calculate the prototype of each class as follows:
[0085]
[0086] In the formula, |c i | belongs to entity category c i The number of characters.
[0087] The second step is to use the similarity measurement function to calculate the query entity q and each category prototype p i The distance between.
[0088]
[0089] In the third step, we obtain the category distribution of the query entity q through the following equation;
[0090]
[0091] In the formula, |C| represents the number of categories in the category set C. In addition, during meta-testing, a Viterbi decoder is added to obtain the transition rules between adjacent entity labels, and then the category distribution is corrected by the transfer distribution g(y′,y).
[0092]
[0093] The traditional prototype network obtains the class prototype by averaging all the word embeddings of each entity category. However, in practice, due to the different semantic relationships of sentences, the contribution of entities in each sentence to predicting the query entity label is different. The sentence-aware model TAP relies on the similarity between the support set sentences and the query set sentences. When the sentence s q When predicting the query entity q in , the sentence-aware model TAP captures the query entity q from the support set. q Similar sentences, the entities in these sentences have a higher correlation with the query entity q. Therefore, in order to obtain a better entity category prototype, the present invention designs the sentence perception model TAP in Example 1 and Example 2 based on the prototype network to obtain a task-adaptive category prototype.
[0094] Example 3
[0095] A small sample entity recognition method based on prototype network includes the following steps:
[0096] S1, through an embedding function f with learning parameters θ θ (), encode each character in the support set and query set into a continuous D-dimensional embedding vector;
[0097] X i =f θ (x i ), X i ∈R D (1)
[0098] S2, obtain the prototypes of all entity categories;
[0099] S21. Construct a character perception model SAP, and use the character perception model SAP to obtain the correlation between the support set and the query set characters:
[0100]
[0101] In the formula, β j Represents query entities q and c i x in the class j Correlation coefficients between entities;
[0102] S22. The prototype network obtains the prototypes of all entity categories based on the samples in the support set and the correlation between the characters in the support set and the query set:
[0103]
[0104] In the formula, |c i | belongs to entity category c i The number of characters;
[0105] S3, using a similarity measurement function to calculate the distance between the query entity and each category prototype;
[0106]
[0107] S4. Use the following formula to determine the category distribution of the query entity.
[0108]
[0109] Example 4
[0110] A small sample entity recognition model based on a prototype network includes the prototype network and the character perception model SAP in the aforementioned embodiment 3.
[0111] For the prototype network, please refer to the content in the aforementioned Example 2 for details. Based on the prototype network, in order to obtain a better entity category prototype, the present invention designs the sentence perception model TAP in Example 3 and Example 4 on the basis of the prototype network, which can make the entire model pay more attention to supporting entities with greater relevance to the query entity and more similarity features.
[0112] For the above-mentioned embodiments 1-4, the sentence perception model SAP and the character perception model TAP are used, and the optimization goal is to minimize the cross entropy loss function, as shown in the following formula:
[0113]
[0114] In the formula, g θ is SAP or TAP; λ is the weight decay parameter; l is the cost function used to calculate the cross entropy between the true value label and the predicted label.
[0115] Example 5
[0116] In small sample learning, different small sample task settings and entity granularity have different requirements for the model. In practice, sentence perception, which focuses more on the correlation between sentences, has better results when predicting fine-grained entity categories and the support set provides very few examples. The character perception model focuses on information sharing between entities, which can be of great help when predicting coarse-grained entity categories and the support set provides more samples. Therefore, in order to better coordinate these two modules and enable our model to achieve good performance in various scenarios, we explored a simple and proven method to combine the two models to form a JTSA model, as follows.
[0117] A small sample entity recognition method combining character awareness and sentence awareness includes the following steps:
[0118] S1. Using the method in the above-mentioned embodiment 1, obtain the category distribution of the query entity in the small sample;
[0119] S2. Using the method in the aforementioned embodiment 3, obtain the category distribution of the query entity in the small sample;
[0120] S3, obtain the final category distribution of the small sample query entity by combining the category distribution obtained in steps S1 and S2 through the following formula;
[0121]
[0122] Wherein, δ is a hyperparameter representing the credibility of SAP, and γ is a hyperparameter representing the credibility of TAP. The two hyperparameters are obtained according to the verification results.
[0123] For the final prediction result, the present invention preferably uses the Viterbi encoder for correction: obtain the transition rules between adjacent entity labels, and use the transition distribution g(y ′ ,y) to correct the category distribution.
[0124]
[0125] Example 6
[0126] A small sample entity recognition model that combines character perception and sentence perception includes the prototype network, sentence perception model SAP and character perception model TAP in the aforementioned embodiment 5.
[0127] For the prototype network, the sentence perception model SAP, and the character perception model TAP, the aforementioned embodiments 1-4 have more detailed descriptions, which can be referred to above.
[0128] In order to demonstrate the effectiveness and superiority of the character perception model TAP, sentence perception model SAP and joint character perception and sentence perception model JTSA involved in the present invention. Detailed experiments are given below. First, the hyperparameters and data sets used in the model are given here. Then, the model of the present invention is evaluated on data sets of different granularities and compared with existing advanced models. Finally, ablation experiments are conducted to study the effectiveness of the sentence perception model, the character perception model and the joint character perception and sentence perception model, respectively.
[0129] experiment
[0130] 1. Dataset
[0131] For the N-way K-shot small sample entity recognition task setting, this experiment 1 evaluates the model of the present invention on two open datasets FEW-NERD (INTRA) and FEW-NERD (INTER). As shown in Table 1 below, FEW-NERD is a large-scale entity recognition dataset based on Wikipedia annotations, which contains 188,200 sentences, 4,601,223 characters and 491,711 entities. All entities are divided into 8 coarse-grained categories and 66 fine-grained categories. After removing sentences without entities, the dataset can be divided into two benchmarks FEW-NERD (INTRA) and FEW-NERD (INTER) according to the coarseness of the entity type granularity. FEW-NERD (INTRA) is a coarse-grained dataset. Its training set consists of four coarse-grained entity types: People, MISC, Art, Product, and has all fine-grained types belonging to these four types. Then, "Event" and "Building" are assigned to the validation set, while "ORG" and "LOC" are in the test set. FEW-NERD(INTER) shares all coarse-grained entity types, but allocates 60% of the fine-grained types under each coarse-grained type to the training set, 20% to the validation set, and 20% to the test set.
[0132] Table 1: Dataset
[0133]
[0134] 2. Experimental Setup
[0135] In the experiment, we evaluated our JTSA under four small sample tasks: 5-way 1-shoy, 5-way 5-shot, 10-way 1-shot, and 10-way 5-shot. The hyperparameters of the model are shown in the following table. The experiment uses the pre-trained language model Bert to extract the initial word embedding representation of the model. The batch size of the training is 2, and the number of query entities is 1. The training iterations are 10,000, the validation iterations are 1, and the test iterations are 500. AdamW is used as the optimizer, and the learning rate is set to 1e-4.
[0136] Table 2: Hyperparameter settings
[0137]
[0138] 3. Overall performance
[0139] Based on two benchmark datasets FEW-NERD(INTER) and FEW-NERD(INTRA), the character-aware model TAP, sentence-aware model SAP and joint character-aware and sentence-aware model JTSA proposed in the present invention are evaluated from different perspectives, and the method involved in the present invention is compared with the existing state-of-the-art methods.
[0140] For the fine-grained FEW-NERD (INTER), SAP and TAP are first used. As shown in Table 3, compared with the existing state-of-the-art models, SAP achieves higher performance on 1-shot tasks. In the 5-way 1-shot task, compared with the best baseline model, the F1 value of SAP is improved by 5.78%, and in the 10-way 1-shot task, it is also improved by about 4%. This fully demonstrates the effectiveness of sentence perception in helping to identify entity types by integrating the structural information of sentences when the support set provides very few reference samples. In the case of more support set samples (5-shot), the character perception model TAP proposed in the present invention has greater advantages and obtains a higher F1 value. Due to the particularity of the entity recognition task, when the entity does not belong to the predefined type, it is regarded as the Other-class class, which inevitably introduces a large number of useless samples. The character perception of the present invention is specially designed for this purpose, and uses the correlation between entities to filter out samples that may interfere with entity recognition.
[0141] Table 3: Performance comparison on model FEW-NERD (INTER)
[0142]
[0143]
[0144] For the coarse-grained FEW-NERD (INTRA), the empirical results reported in Table 4 show that this dataset is challenging for all existing models because the query sample shares little information with the reference samples in the support set. However, TAP also has a significant performance improvement in various small-sample task settings. This is because there is a huge gap between the query entity and the entity in the support set, and character awareness can filter out the reference samples in the support set that have little relevance to the query entity.
[0145] Table 4: Performance comparison on model FEW-NERD (INTRA)
[0146]
[0147] In order to comprehensively utilize the association information between entities and sentences, the present invention constructs a joint character-aware and sentence-aware model JTSA. The character-aware model and the sentence-aware model complement each other and give full play to their respective advantages in different scenarios. As can be seen from Tables 3 and 4, JSTA has good performance under various small sample task settings, not only surpassing the best baseline structshot on 1-shot but also surpassing the best baseline prototypicalnetwork on 5-shot.
[0148] 4. Convergence speed
[0149] First, the experiment uses the FEW-NERD (INTER) dataset to compare the convergence speed of SAP with the existing state-of-the-art models structshot and prototypical network in the 5-way 1-shot small sample task. Figure 2 As shown, the curve with circle dots represents the SAP involved in the present invention, the curve with square dots is the structshot model, and the curve with triangle dots is the prototypical network. Figure 2 The left and right figures in the middle show the changes in the F1 value of the model during the validation process and the training process respectively. Figure 2 As shown, SAP only needs half the time to reach the optimal point, which improves the performance by about 15% compared with the structshot model.
[0150] Secondly, the experiment also compares TAP with two baseline methods on the 5-shot task, such as Figure 3 As shown in the figure. Although the initial convergence speed is almost the same, the TAP of the present invention has better performance on the validation set, which shows that the model of the present invention has strong generalization ability. In the second half of the time, TAP converges faster, the optimal point is higher, and it exceeds the prototype network.
[0151] 5. Ablation study
[0152] In order to further illustrate the effect of the combined character perception and sentence perception model of the present invention, this experiment randomly selected two groups of data and evaluated the model of the present invention on a 5-way 1-shot task. Figure 4 It shows how the character-aware model TAP corrects the wrong results predicted by the sentence-aware model SAP. In the figure, we show the probability distribution of SAP, TAP, and JTSA for identifying the "stock" entity on predefined categories. The entity "stock" appears in the sentence "It began focusing on foreign exchange transaction in 1976 and listed its shares on the Jakarta stock exchange in 1989". The true label of the entity "stock" is "organization-government / government agency" (G), but SAP believes that there is a 55% probability that the entity is of the "building-hospital" (H) type. In this case, our JSTA uses the character-aware model TAP to correct the result, believing that the entity has an 80% probability of belonging to the "G" label and has the largest proportion in the category distribution. Figure 5 , showing the correction process of the sentence-aware model SAP when predicting "the". The character "the" appears in the entity phrase "republic of thePhilippines Commission on elections(Comelec)". It can be seen that the character-aware model TAP has controversy over whether "the" belongs to "other-class" or "event-election" because the model believes that the probability of belonging to these two categories is almost the same. In contrast, SAP has great confidence that "the" belongs to "event-election", believing that there is a 67% probability, which is the largest proportion among all categories. After comprehensive consideration, JSTA obtains the correct classification result. In summary, it is reasonable to believe that JTSA, the joint character-aware and sentence-aware model, is meaningful and can achieve the best learning effect in various scenarios.
[0153] 6. Error indicator analysis
[0154] This experiment analyzes the model involved in the present invention from four aspects: Figure 6The comparison results between the model proposed by the present invention and the baseline are shown. In the figure, FP error indicates that the O-class entity is incorrectly predicted as other entity categories; FN error indicates that the other-class entity is incorrectly predicted as O-class; "Within" error indicates that the entity is incorrectly classified as another type in the same coarse-grained type; and "Outer" error indicates that the entity is incorrectly classified as another type in another different coarse-grained type. The error rates of all the models of the present invention, SAP, TAP, and JSTA, are lower than the baseline in most cases ("FP", "WITHIN", and "OUTER"). For example, the error rate of "FP" is reduced by 50% compared with the traditional prototype network. This experimental result fully demonstrates that character perception and sentence perception can effectively identify "Other-class" entities and alleviate the similarity comparison problem caused by the ambiguity of the "Other-class" category. On the other hand, our model also has the lowest error rate for "WITHIN" and "OUTER", which is 10%-24% and 30%-40% lower than the baseline, respectively. This shows that our character perception and sentence perception are also more superior in the recognition of predefined categories, especially in the coarse-grained types with more significant semantic differences. In addition, compared with TAP and SAP, the JSTA provided by the present invention has lower error rates in "FP", "WITHIN", and "OUTER", which further illustrates the importance of the joint model of the present invention.
[0155] The above embodiments are preferred implementation schemes of the present invention. In addition, the present invention can also be realized in other ways. Any obvious replacement without departing from the concept of the present technical solution is within the protection scope of the present invention.
[0156] In order to make it easier for ordinary technicians in the field to understand the improvements of the present invention over the prior art, some drawings and descriptions of the present invention have been simplified, and for the sake of clarity, some other elements are omitted in this application document. Ordinary technicians in the field should realize that these omitted elements may also constitute the content of the present invention.
Claims
1. A small sample entity recognition method combining character awareness and sentence awareness, characterized in that: The steps include: S1. Use the following method to obtain the category distribution of the query entity in the small sample; S101, through an embedding function f with learning parameters θ θ (), encode each character in the support set and query set into a continuous D-dimensional embedding vector; X i =f θ (x i ),X i ∈R D (1) S102, constructing a sentence-aware model that captures the correlation between the support set and the query set sentences in the small sample, and the prototype network obtains the prototypes of all entity categories based on the samples in the support set and the correlation between the support set and the query set sentences obtained by the sentence-aware model; S103, calculating the distance between the query entity and each category prototype; S104, determining the category distribution of the query entity according to the distance obtained in S103; In S102, the sentence-aware model obtains the correlation between the support set and the query set sentences using the following method: First, use a one-dimensional convolutional neural network to extract each sentence s in the query set q features and encodes them into a continuous low-dimensional sentence vector h q ; h q =conv(s q <q1,.....,q n >) (2) Then use a one-dimensional convolutional neural network to extract each sentence s in the support set l features and encodes them into a continuous low-dimensional sentence vector Finally, the correlation α between sentences is calculated as follows l ; In S102, the prototype network obtains the prototypes of all entity categories based on the samples in the support set and the correlation between the support set and the query set sentences obtained by the sentence perception model: In the formula, |c i | belongs to entity category c i The number of characters; In S103, the distance between the query entity and each category prototype is: In S104, the category distribution of the query entity is determined using the following formula: S2. Use the following method to obtain the category distribution of the query entity in the small sample; S201, constructing a character perception model that captures the correlation between characters in the support set and the query set in a small sample, and the prototype network obtains the prototypes of all entity categories based on the samples in the support set and the correlation between characters in the support set and the query set obtained by the character perception model; S202, calculating the distance between the query entity and each category prototype; S203, determining the category distribution of the query entity according to the distance obtained in S202; In S201, the character perception model uses the following formula to obtain the correlation between the characters of the support set and the query set in the small sample; In the formula, β j Represents query entities q and c i x in the class j Correlation coefficients between entities; In S201, the prototype network obtains the prototypes of all entity categories based on the samples in the support set and the correlation between the support set and the query set characters obtained by the character perception model: In the formula, |c i | belongs to entity category c i The number of characters; In S202, the distance between the query entity and each category prototype is: In S203, the category distribution of the query entity is determined using the following formula: S3. Combining the category distributions obtained in steps S1 and S2, the final category distribution of the small sample query entity is obtained.
2. The combined character-aware and sentence-aware small sample entity recognition method according to claim 1, characterized in that: When constructing a sentence-aware model or a character-aware model, the cross entropy loss function of the sentence-aware model or the character-aware model is minimized by the following formula; In the formula, g θ is a sentence-aware model or a character-aware model; λ is a weight decay parameter; l is a cost function used to calculate the cross entropy between the true value label and the predicted label.
3. The combined character-aware and sentence-aware small sample entity recognition method according to claim 2, characterized in that: In step S3, the final category distribution of the small sample query entity is obtained by combining the category distributions obtained in steps S1 and S2 through the following formula; Where δ is a hyperparameter representing the credibility of the sentence-aware model, and γ is a hyperparameter representing the credibility of the character-aware model.
4. The combined character-aware and sentence-aware small sample entity recognition method according to claim 3, characterized in that: The step S4 is also included: after obtaining the category distribution in step S3, the Viterbi decoder is used to obtain the transition rules between adjacent entity labels, and the transition distribution g(y ′ ,y) to correct the category distribution 。
Citation Information
Patent Citations
Few-sample relation extraction method based on granularity perception in open environment and application
CN112507137A
Few-sample named entity identification method and system for entity boundary category decoupling
CN112541355A
Model training method and device for named entity recognition, and recognition method and device
CN113298253A
Small sample intention recognition method based on knowledge graph and capsule network
CN113535950A
KR20190133931A
