Generative span-based named entity identification method in big data
Through the named entity recognition method based on generative span, combined with feature extraction and dynamic matching algorithm, the efficiency and accuracy of identifying nested entities in the existing technology are solved, and efficient identification and accurate classification of flat and nested entities are achieved. .
Patent Information
- Application Number
- CN202411139788.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2024-12-13
AI Technical Summary
The existing named entity recognition methods are difficult to efficiently identify nested entities, and there are problems with computational redundancy and too many negative samples, so long entities cannot be identified.
The named entity recognition method based on generative spans is adopted, including feature extraction module, candidate span generation module and candidate span classification module. Through feature extraction, span seed generation and classification, combined with dynamic matching algorithms and prompt learning, flat and nested entities are identified. .
It realizes high accuracy in simultaneously identifying flat and nested entities, reduces recognition time, and improves the accuracy of boundary detection and entity classification.
Smart Images

Figure CN119129597A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of named entity recognition, and in particular relates to a named entity recognition method based on generative span in big data. Background Art
[0002] Named entity recognition is an important basic task in natural language processing. It can extract predefined named entities, such as people, places, and organizations, from unstructured text. It is widely used in relation extraction, question-answering systems, and knowledge graph construction.
[0003] Early named entity recognition was based on machine learning or rules. These methods require a large amount of labeled training data and hand-crafted rules, which are not only costly but also difficult to maintain accuracy and adaptability. In recent years, with the development of deep learning and neural networks, named entity recognition has made significant progress. People have made many improvements in improving the accuracy of named entity recognition tasks, but they still have many problems. Sequence labeling-based methods cannot efficiently identify nested entities. Although enumeration-based methods can solve nested entities, they have problems such as large computational redundancy, too many negative samples (spans classified as non-entities), and inability to recognize long entities. Summary of the invention
[0004] In order to solve the problems existing in the background technology, the present invention provides a method for named entity recognition based on generative span in big data, comprising: inputting a text sentence into a trained named entity recognition model, and outputting entities and entity categories in the text sentence; wherein the named entity recognition model comprises: a feature extraction module, a candidate span generation module and a candidate span classification module;
[0005] The feature extraction module is used to extract features from the input text sentence to obtain a feature vector for each word in the text sentence;
[0006] The candidate span generation module is used to use the words that meet the preset conditions in the text sentence as span seeds according to the feature vector of each word, and generate candidate span entities according to the span seeds;
[0007] The candidate span classification module is used to classify the candidate span entity according to a preset template to obtain the category of the entity.
[0008] Preferably, the feature extraction of the input text sentence includes:
[0009] The input text sentence is encoded through the first BERT model to obtain the word embedding vector of each word in the text sentence Represents the word embedding vector of the i-th word in the text sentence;
[0010] Use the first BiLSTM model to generate character embeddings for each word in the text sentence to obtain the character features of the word Represents the character features of the i-th word in the text sentence;
[0011] Use StanfordNLP to perform part-of-speech tagging on each word in the text sentence, and encode the part-of-speech tagging information of each word through the second BERT model to obtain the part-of-speech information of each word in the text sentence Represents the part-of-speech information of the i-th word in the text sentence;
[0012] Embed the word vector for each word in the text sentence Character characteristics and part-of-speech information After concatenation, it is input into the second BiLSTM model for feature processing to obtain the feature vector h of each word i ,h i Represents the feature vector of the i-th word in the text sentence.
[0013] Preferably, the method of using words in a text sentence that meet preset conditions as span seeds according to the feature vector of each word includes: inputting the feature vector of each word in the text sentence into a first MLP to predict the probability of each word belonging to a span seed, and selecting words with a probability greater than a set threshold as span seeds.
[0014] Preferably, generating a candidate span entity according to the span seed comprises:
[0015] The feature vector of the span seed is concatenated with the feature vector of each word in the text sentence, and the concatenated features are input into the second MLP to predict the probability of each word in the text sentence belonging to the start word and the end word of the candidate span entity. The words with the highest probability are selected as the start word and the end word of the candidate span entity, and the text from the start word to the end word of the candidate span entity in the text sentence is used as the candidate span entity.
[0016] Preferably, the classifying the candidate span entities according to a preset template comprises:
[0017] The candidate span entity is generated according to the preset template as follows:
[0018] T={X,s i isa[mask]entity}
[0019] Among them, X represents the input text sentence, s i represents the i-th candidate span entity, [mask] represents the mask of the entity category;
[0020] Input sentence T into the pre-trained language model, predict the word vector at the position [mask], and use the predicted word vector as the category vector of the candidate span entity;
[0021] The category vector of the candidate span entity is input into SoftMax for classification to obtain the entity category of the candidate span entity.
[0022] Preferably, the training process of the named entity recognition model includes:
[0023] Input the training sample into the named entity recognition model to calculate the candidate span entity and the category of the candidate span entity; wherein the training sample includes a training text sentence, a plurality of entity tags in the training text sentence and an entity category tag corresponding to each entity tag;
[0024] A dynamic matching algorithm is used to match the entity label corresponding to each candidate span entity, and the loss of the candidate span stage is calculated;
[0025] The loss of the classification phase is calculated based on the predicted category of the candidate span entity and the entity category label of the entity label corresponding to the candidate span entity;
[0026] The loss of the candidate span stage and the loss of the classification stage are weighted summed to obtain the final loss, and the named entity recognition model is trained by back-propagation gradient update according to the final loss until the final loss converges to obtain a trained named entity recognition model.
[0027] Preferably, the adopting a dynamic matching algorithm to match the entity label corresponding to each candidate span entity comprises:
[0028] For each candidate span entity, the matching cost between the candidate span entity and the entity label in the training text sentence is calculated, and the entity label with the smallest cost is selected as the entity label of the candidate span entity. The matching cost is calculated as follows:
[0029] COST=2-IoU(e,s)-IoF(e,s)
[0030]
[0031] Among them, COST represents the matching cost, e represents the entity label in the training text sentence, and s represents the candidate span entity.
[0032] Preferably, the loss at the candidate span stage includes:
[0033]
[0034] Among them, L proposal_spanrepresents the loss at the candidate span stage, SmoothL1 represents the SmoothL1 loss function; represents the i-th candidate span entity, represents the entity label of the i-th candidate span entity; σ is represents the starting word of the entity tag of the i-th candidate span entity, represents the starting word of the candidate span entity, σ ie The ending word of the entity tag representing the i-th candidate span entity; Indicates the ending word of the candidate span entity.
[0035] Preferably, the loss in the classification stage includes:
[0036]
[0037] Among them, L cls represents the loss in the classification stage, y=1 indicates when the candidate span entity category is predicted correctly, and γ represents the exponential parameter. Indicates the true probability value that the i-th candidate span entity belongs to the category y; Represents the probability value that the i-th candidate span entity predicted by the named entity recognition model is of category y.
[0038] Preferably, the final loss includes:
[0039] L=α1L prpoposal_span +α2L cls
[0040] Among them, L represents the final loss, α1 and α2 represent weight parameters, and L prpoposal_span represents the loss at the candidate span stage, L cls represents the loss of the classification stage.
[0041] The present invention has at least the following beneficial effects
[0042] The present invention can simultaneously identify flat entities and nested entities; the present invention assigns different boundary extension targets to span seeds by designing a dynamic span seed-entity matching algorithm, so that the span seeds can fully learn the boundary information of different entities and generate corresponding candidate spans; at the same time, since the method does not need to enumerate all spans, it is less time-consuming than the span-based nested named entity recognition method, and entity information in a sentence can be identified by only extending the boundaries of the span seeds.
[0043] Compared with the existing technical solutions, the present invention has higher accuracy in the recognition of flat entities and nested entities. In terms of boundary detection, when expanding the boundary of the span seed, the present invention not only considers the feature information of the span seed itself, but also considers the semantic information of its context, and interacts the span seed with each word in the sentence to obtain its left and right boundaries; in terms of classification of candidate spans, the present invention uses the prompt learning method to convert the classification task into the form of cloze, guiding the pre-trained model to better understand the context of the entity, thereby improving the accuracy of entity classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 It is a flowchart of the method of the present invention. DETAILED DESCRIPTION
[0045] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments only illustrate the basic concept of the present invention in a schematic manner, and the following embodiments and features in the embodiments can be combined with each other without conflict.
[0046] Among them, the drawings are only used for illustrative explanations, and they only represent schematic diagrams rather than actual pictures, and should not be understood as limitations on the present invention. In order to better illustrate the embodiments of the present invention, some parts of the drawings may be omitted, enlarged or reduced, and do not represent the size of actual products. For those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings may be omitted.
[0047] The same or similar numbers in the drawings of the embodiments of the present invention correspond to the same or similar parts; in the description of the present invention, it should be understood that if the terms "upper", "lower", "left", "right", "front", "rear", etc. indicate the orientation or position relationship, they are based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation. Therefore, the terms describing the position relationship in the drawings are only used for illustrative purposes and cannot be understood as limiting the present invention. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.
[0048] See also Figure 1, the present invention provides a named entity recognition method based on generative span in big data, comprising: inputting a text sentence into a trained named entity recognition model, and outputting entities and entity categories in the text sentence; wherein the named entity recognition model comprises: a feature extraction module, a candidate span generation module and a candidate span classification module;
[0049] The feature extraction module is used to extract features from the input text sentence to obtain a feature vector for each word in the text sentence;
[0050] The candidate span generation module is used to use the words that meet the preset conditions in the text sentence as span seeds according to the feature vector of each word, and generate candidate span entities according to the span seeds;
[0051] The candidate span classification module is used to classify the candidate span entity according to a preset template to obtain the category of the entity.
[0052] In this embodiment, the span generation module is used to use the words that meet the preset conditions in the text sentence as span seeds according to the feature vector of each word, and generate candidate span entities according to the span seeds. Since this method does not need to enumerate all spans, it is less time-consuming than the span-based nested named entity recognition method. It only needs to expand the boundaries of the span seeds to identify the entity information in the sentence; the candidate span entities are classified according to the preset template to obtain the category of the entity, and the classification task is converted into a cloze form through the prompt learning method, guiding the pre-trained model to better understand the context of the entity, thereby improving the accuracy of entity classification.
[0053] The text sentences in this embodiment include: Chinese sentences and English sentences; the Chinese sentence is "Tsinghua University is located at North Street, Zhongguancun, Haidian District, Beijing", and the English sentence is "Xinhua News Agency, Canberra, August 31st".
[0054] Preferably, the feature extraction of the input text sentence includes:
[0055] The input text sentence is encoded through the first BERT model to obtain the word embedding vector of each word in the text sentence Represents the word embedding vector of the i-th word in the text sentence;
[0056] In this embodiment, the input text sentence is first tokenized. By using methods such as string matching-based methods, language model-based methods, and deep learning-based methods, the word sequence after tokenization is input into the first BERT model for encoding to obtain the word embedding vectors of each word in the text sentence. For example, for the sentence "Tsinghua University is located at the north end of Zhongguancun Avenue, Haidian District, Beijing", the word sequence obtained after tokenization is {"Tsinghua", "University", "is located at", "Beijing", "Haidian District", "Zhongguancun", "north end of the avenue"}. For the sentence "Xinhua News Agency, Canberra, August 31st", the word sequence obtained after tokenization is {"Xinhua", "News", "Agency", ",", "Canberra", ",", "August", "31st"}
[0057] The first BiLSTM model is used to generate character embeddings for each word in the text sentence to obtain the character features of the words represents the character feature of the i-th word in the text sentence;
[0058] In this embodiment, for Chinese sentences, the words in the Chinese sentence are first decomposed in terms of glyphs, and the decomposed glyph sequence is input into the first BiLSTM model to obtain the character features of the words. For example, for the word "Tsinghua", according to the radicals that make up the word, the decomposed glyph sequence is {"氵", "青", "亻", "匕", "十"}. As a preferred embodiment, decomposing the words in the Chinese sentence in terms of glyphs also includes: querying the pinyin of the words in the Chinese sentence, and taking the pinyin of the words as a sequence and inputting it into the first BiLSTM model to obtain the character features of the words. For example, for the word "Tsinghua", its pinyin is "qinghua", then its pinyin sequence is {"q", "i", "n", "g", "h", "u", "a"}, and the pinyin sequence is input into the first BiLSTM model to obtain the character features of the words;
[0059] In this embodiment, for English sentences, the letter sequence that makes up the word is input into the first BiLSTM model to obtain the character features of the word. For example, for the word "Xinhua", the input sequence of the first BiLSTM model is represented as {"X", "i", "n", "h", "u", "a"};
[0060] StanfordNLP is used to perform part-of-speech tagging on each word in the text sentence, and the part-of-speech tagging information of each word is encoded through the second BERT model to obtain the part-of-speech information of each word in the text sentence represents the part-of-speech information of the i-th word in the text sentence;
[0061] In this embodiment, the preferred implementation method of encoding the part-of-speech tagging information of each word through the second BERT model includes:
[0062] Expand the part-of-speech information of words into natural language sentences, input the natural language sentences into the second BERT model for encoding, and obtain the [cls] vector representation corresponding to the sentences in BERT as the part-of-speech information of the words. For example, for the word "university" in a Chinese sentence, its part-of-speech tagging information is "NN", and the expanded natural language sentence is "Common nouns that represent a person, place, thing, or idea". In this embodiment, based on the definition of part-of-speech tagging information in Baidu Encyclopedia, the part-of-speech information is expanded into natural language sentences.
[0063] The word embedding vectors of each word in the text sentence Character features and part-of-speech information are concatenated and input into the second BiLSTM model for feature processing to obtain the feature vector h of each word i , h i represents the feature vector of the i-th word in the text sentence, which is expressed as:
[0064]
[0065] In this embodiment, through the word embedding vectors of words Character features and part-of-speech information the feature vectors of words are obtained. The word embedding vectors provide semantic information of words, enabling the model to understand the similarities and differences between words; the character features can capture the morphological information within words; the part-of-speech information provides the grammatical role information of words in sentences, helping the model understand the structure of sentences and thus more accurately understand the meaning of sentences. The word feature vector h obtained through the above features i can improve the generalization ability of the model and enhance the adaptability to subsequent tasks.
[0066] Preferably, the step of using the words that meet the preset conditions in the text sentence as span seeds according to the feature vectors of each word includes: inputting the feature vectors of each word in the text sentence into the first MLP to predict the probability that each word belongs to the span seeds, and selecting the words with probabilities greater than the set threshold as the span seeds, which is expressed as:
[0067]
[0068] where represents the probability that the i-th word belongs to the candidate seeds, Sigmoid represents the activation function, and MLP1 represents the first MLP (multi-layer perceptron); in this embodiment, the first MLP uses the GELU activation function.
[0069] Preferably, generating a candidate span entity according to the span seed comprises:
[0070] The feature vector of the span seed is concatenated with the feature vector of each word in the text sentence, and the concatenated features are input into the second MLP to predict the probability of each word in the text sentence belonging to the start word and the end word of the candidate span entity. The words with the largest probability are selected as the start word and the end word of the candidate span entity, and the text from the start word to the end word of the candidate span entity in the text sentence is taken as the candidate span entity, which is expressed as:
[0071]
[0072] in, represents the probability of each word in the text sentence belonging to the start word and the end word, Softmax represents the classification function, MLP2 represents the second MLP, and h seed The feature vector representing the span seed; for example, for the Chinese sentence "University" as the span seed, it is predicted that Tsinghua has the highest probability of belonging to the starting word and University has the highest probability of belonging to the ending word, so the candidate span entity is "Tsinghua University"; for the English sentence "News" as the span seed, it is predicted that Xinhua has the highest probability of belonging to the starting word and Agency has the highest probability of belonging to the ending word, so the candidate span entity is "XinhuaNews Agency".
[0073] This embodiment uses a seed-based generation method to construct candidate spans, which effectively reduces the number of "non-entity" candidate spans, improves the model reasoning speed, and alleviates the category imbalance problem caused by a large number of negative samples generated by enumeration, further improving the performance of the model. When expanding the boundaries of the span seeds, the present invention not only considers the feature information of the span seeds themselves, but also considers the semantic information of their context, and interacts the span seeds with each word in the sentence to obtain their left and right boundaries, further improving the performance of the model.
[0074] Preferably, the classifying the candidate span entities according to a preset template comprises:
[0075] The candidate span entity is generated according to the preset template as follows:
[0076] T={X,s i isa[mask]entity}
[0077] Among them, X represents the input text sentence, s i represents the i-th candidate span entity, [mask] represents the mask of the entity category;
[0078] Input sentence T into the pre-trained language model, predict the word vector at the position [mask], and use the predicted word vector as the category vector of the candidate span entity;
[0079] The category vector of the candidate span entity is input into SoftMax for classification to obtain the entity category of the candidate span entity.
[0080] In this embodiment, the prompt learning method is used to convert the classification task into a cloze form, guiding the pre-trained model to better understand the context of the entity, thereby improving the accuracy of entity classification.
[0081] Preferably, the training process of the named entity recognition model includes:
[0082] Input the training sample into the named entity recognition model to calculate the candidate span entity and the category of the candidate span entity; wherein the training sample includes a training text sentence, a plurality of entity tags in the training text sentence and an entity category tag corresponding to each entity tag;
[0083] A dynamic matching algorithm is used to match the entity label corresponding to each candidate span entity, and the loss of the candidate span stage is calculated;
[0084] The loss of the classification phase is calculated based on the predicted category of the candidate span entity and the entity category label of the entity label corresponding to the candidate span entity;
[0085] The loss of the candidate span stage and the loss of the classification stage are weighted summed to obtain the final loss, and the named entity recognition model is trained by back-propagation gradient update according to the final loss until the final loss converges to obtain a trained named entity recognition model.
[0086] In this embodiment, a dynamic span seed-entity matching algorithm is designed to assign different boundary extension targets to span seeds, so that span seeds can fully learn the boundary information of different entities and generate corresponding candidate spans. Since this method does not need to enumerate all spans, it is less time-consuming than the span-based nested named entity recognition method, and only the boundary extension of the span seed is required to identify the entity information in the sentence.
[0087] Preferably, the adopting a dynamic matching algorithm to match the entity label corresponding to each candidate span entity comprises:
[0088] For each candidate span entity, the matching cost between the candidate span entity and the entity label in the training text sentence is calculated, and the entity label with the smallest cost is selected as the entity label of the candidate span entity. The matching cost is calculated as follows:
[0089] COST=2-IoU(e,s)-IoF(e,s)
[0090]
[0091] Among them, COST represents the matching cost, e represents the entity label in the training text sentence, and s represents the candidate span entity.
[0092] Preferably, the loss at the candidate span stage includes:
[0093]
[0094] Among them, L proposal_span represents the loss at the candidate span stage, SmoothL1 represents the SmoothL1 loss function; represents the i-th candidate span entity, represents the entity label of the i-th candidate span entity; σ is represents the starting word of the entity tag of the i-th candidate span entity, represents the starting word of the candidate span entity, σ ie The ending word of the entity tag representing the i-th candidate span entity; Indicates the ending word of the candidate span entity.
[0095] Preferably, the loss in the classification stage includes:
[0096]
[0097] Among them, L cls represents the loss in the classification stage, y=1 indicates when the candidate span entity category is predicted correctly, and γ represents the exponential parameter. Indicates the true probability value that the i-th candidate span entity belongs to the category y; It represents the probability value that the i-th candidate span entity predicted by the named entity recognition model is of category y. In this embodiment, when the candidate span classification module predicts that the category of the candidate span entity is the same as the category of the entity label of the candidate span entity, the candidate span entity category prediction is correct y=1, otherwise.
[0098] Preferably, the final loss includes:
[0099] L=α1L prpoposal_span +α2L cls
[0100] Among them, L represents the final loss, α1 and α2 represent weight parameters, and L prpoposal_span represents the loss at the candidate span stage, L cls represents the loss of the classification stage.
[0101] In summary, the present invention can simultaneously identify flat entities and nested entities; the present invention assigns different boundary extension targets to span seeds by designing a dynamic span seed-entity matching algorithm, so that the span seeds can fully learn the boundary information of different entities and generate corresponding candidate spans; at the same time, since this method does not need to enumerate all spans, it is less time-consuming than the span-based nested named entity recognition method, and only the boundary expansion of the span seed is required to identify the entity information in the sentence.
[0102] Compared with the existing technical solutions, the present invention has higher accuracy in the recognition of flat entities and nested entities. In terms of boundary detection, when expanding the boundary of the span seed, the present invention not only considers the feature information of the span seed itself, but also considers the semantic information of its context, and interacts the span seed with each word in the sentence to obtain its left and right boundaries; in terms of classification of candidate spans, the present invention uses the prompt learning method to convert the classification task into the form of cloze, guiding the pre-trained model to better understand the context of the entity, thereby improving the accuracy of entity classification.
[0103] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0104] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
[0105] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution, which should be included in the scope of the claims of the present invention.
Claims
1. A method for named entity recognition based on generative span in big data, characterized in that: include: Inputting a text sentence into a trained named entity recognition model, and outputting entities and entity categories in the text sentence; wherein the named entity recognition model comprises: a feature extraction module, a candidate span generation module, and a candidate span classification module; The feature extraction module is used to extract features from the input text sentence to obtain a feature vector for each word in the text sentence; The candidate span generation module is used to use the words that meet the preset conditions in the text sentence as span seeds according to the feature vector of each word, and generate candidate span entities according to the span seeds; The candidate span classification module is used to classify the candidate span entity according to a preset template to obtain the category of the entity.
2. According to the method for named entity recognition based on generative span in big data in claim 1, it is characterized in that: The feature extraction of the input text sentence comprises: The input text sentence is encoded through the first BERT model to obtain the word embedding vector of each word in the text sentence Represents the word embedding vector of the i-th word in the text sentence; Use the first BiLSTM model to generate character embeddings for each word in the text sentence to obtain the character features of the word Represents the character features of the i-th word in the text sentence; Use StanfordNLP to perform part-of-speech tagging on each word in the text sentence, and encode the part-of-speech tagging information of each word through the second BERT model to obtain the part-of-speech information of each word in the text sentence Represents the part-of-speech information of the i-th word in the text sentence; Embed the word vector for each word in the text sentence Character characteristics and part-of-speech information After concatenation, it is input into the second BiLSTM model for feature processing to obtain the feature vector h of each word i ,h i Represents the feature vector of the i-th word in the text sentence.
3. According to the method for named entity recognition based on generative span in big data according to claim 1, it is characterized in that: The method of using words in a text sentence that meet preset conditions as span seeds according to the feature vector of each word includes: inputting the feature vector of each word in the text sentence into a first MLP to predict the probability of each word belonging to a span seed, and selecting words with probabilities greater than a set threshold as span seeds.
4. The method for named entity recognition based on generative span in big data according to claim 1, characterized in that: Generating a candidate span entity according to the span seed includes: The feature vector of the span seed is concatenated with the feature vector of each word in the text sentence, and the concatenated features are input into the second MLP to predict the probability of each word in the text sentence belonging to the start word and the end word of the candidate span entity. The words with the highest probability are selected as the start word and the end word of the candidate span entity, and the text from the start word to the end word of the candidate span entity in the text sentence is used as the candidate span entity.
5. The method for named entity recognition based on generative span in big data according to claim 1, characterized in that: The classifying the candidate span entities according to the preset template includes: The candidate span entity is generated according to the preset template as follows: T={X,s i isa[mask]entity} Among them, X represents the input text sentence, s i represents the i-th candidate span entity, [mask] represents the mask of the entity category; Input sentence T into the pre-trained language model, predict the word vector at the position [mask], and use the predicted word vector as the category vector of the candidate span entity; The category vector of the candidate span entity is input into SoftMax for classification to obtain the entity category of the candidate span entity.
6. The method for named entity recognition based on generative span in big data according to claim 1, characterized in that: The training process of the named entity recognition model includes: Input the training sample into the named entity recognition model to calculate the candidate span entity and the category of the candidate span entity; wherein the training sample includes a training text sentence, a plurality of entity tags in the training text sentence and an entity category tag corresponding to each entity tag; A dynamic matching algorithm is used to match the entity label corresponding to each candidate span entity, and the loss of the candidate span stage is calculated; The loss of the classification phase is calculated based on the predicted category of the candidate span entity and the entity category label of the entity label corresponding to the candidate span entity; The loss of the candidate span stage and the loss of the classification stage are weighted summed to obtain the final loss, and the named entity recognition model is trained by back-propagation gradient update according to the final loss until the final loss converges to obtain a trained named entity recognition model.
7. The method for named entity recognition based on generative span in big data according to claim 6, characterized in that: The method of using a dynamic matching algorithm to match the entity label corresponding to each candidate span entity includes: For each candidate span entity, the matching cost between the candidate span entity and the entity label in the training text sentence is calculated, and the entity label with the smallest cost is selected as the entity label of the candidate span entity. The matching cost is calculated as follows: COST=2-IoU(e,s)-IoF(e,s) Among them, COST represents the matching cost, e represents the entity label in the training text sentence, and s represents the candidate span entity.
8. The method for named entity recognition based on generative span in big data according to claim 6, characterized in that: The losses at the candidate span stage include: Among them, L proposal_span represents the loss at the candidate span stage, Smooth L1 represents the Smooth L1 loss function; represents the i-th candidate span entity, represents the entity label of the i-th candidate span entity; σ is represents the starting word of the entity tag of the i-th candidate span entity, represents the starting word of the candidate span entity, σ ie The ending word of the entity tag representing the i-th candidate span entity; Indicates the ending word of the candidate span entity.
9. The method for named entity recognition based on generative span in big data according to claim 6, characterized in that: The losses in the classification stage include: Among them, L cls represents the loss in the classification stage, y=1 indicates when the candidate span entity category is predicted correctly, and γ represents the exponential parameter. Indicates the true probability value that the i-th candidate span entity belongs to the category y; Represents the probability value that the i-th candidate span entity predicted by the named entity recognition model is of category y.
10. The method for named entity recognition based on generative span in big data according to claim 6, characterized in that: The final losses include: L=α1L prpoposal_span +α2L cls Among them, L represents the final loss, α1 and α2 represent weight parameters, and L prpoposal_span represents the loss at the candidate span stage, L cls represents the loss of the classification stage.
Citation Information
Cited By
Named entity recognition method
CN119692352A
Multi-model collaborative entity recognition method based on hierarchical check and dynamic gating
CN121279310A
