Named entity recognition method, apparatus and computer readable storage medium

By employing span and cue learning methods, combined with pre-trained models and pooling, the performance of named entity recognition is improved, solving the recognition challenge on small sample datasets and achieving more efficient entity nesting recognition.

CN117235205BActive Publication Date: 2026-07-03RICOH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
RICOH CO LTD
Filing Date
2022-06-02
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Existing named entity recognition methods perform poorly on small sample datasets, and traditional models struggle to effectively address the problem of nested entities.

Method used

A named entity recognition method based on span and cue learning is adopted. By generating cue templates of candidate entity words and concatenating them with the text to be recognized, a vector representation is generated using a pre-trained model. Span information and cue information are then fused through pooling and softmax classification.

Benefits of technology

It improves the performance of named entity recognition and reduces the requirements for sample datasets, especially showing significant performance on small sample datasets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117235205B_ABST
    Figure CN117235205B_ABST
Patent Text Reader

Abstract

This application provides a named entity recognition method, apparatus, and computer-readable storage medium. The method includes: traversing text elements in a text to be recognized based on text span to obtain multiple candidate entity words; for each candidate entity word, identifying its category through the following steps: generating a prompt template corresponding to the candidate entity word; concatenating the text to be recognized with the prompt template to obtain concatenated text; generating vector representations of text elements in the concatenated text; generating a vector representation of the candidate entity word based on the vector representations of text elements of each candidate entity word and the vector representations of text elements of a masked word in the concatenated text; and classifying the vector representations of the candidate entity words to obtain their category. This application combines span information with prompt information for named entity recognition, which can improve the performance of named entity recognition and reduce the requirements for sample datasets.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of machine learning and natural language processing (NLP) technology, specifically to a named entity recognition method, apparatus, and computer-readable storage medium. Background Technology

[0002] In the field of artificial intelligence, information extraction technology is an indispensable and crucial skill. Currently, information extraction technology mainly includes three types of algorithms. The first is extraction algorithms based on knowledge graphs. This type of extraction algorithm requires the support of data and rules from a knowledge graph. Building a knowledge graph requires a significant amount of human resources, and the amount of data obtained is often less than ideal. The second type is extraction algorithms based on traditional statistical machine learning algorithms. These algorithms can use manually labeled training data and apply different learning models to handle different scenarios. However, this type of algorithm suffers from high labor costs and poor generalization, causing it to encounter bottlenecks in widespread application. The last type of algorithm is the one that has become popular in recent years, using neural network models. Compared with traditional machine learning algorithms, neural network-based models that use large-scale training datasets have demonstrated superior performance in natural language processing tasks.

[0003] Named Entity Recognition (NER) is a common task in Natural Language Processing (NLP). Named entities are used as the basic units of semantic representation in many applications, and their application is very wide-ranging, thus NER technology plays an important role. Named entities typically refer to entities in text that have special meaning or strong referentiality, usually including names of people, places, organizations, times, and proper nouns. NER technology plays a crucial role because named entities are used as the basic units of semantic representation in many tasks. Therefore, high-precision NER methods are of great significance in developing high-performance translation, dialogue, public opinion monitoring, topic tracking, and semantic understanding systems.

[0004] Sequence labeling is a common problem in natural language processing. Common solutions include Hidden Markov Models (HMMs), Maximum Entropy Models, and Conditional Random Fields (CRFs). Currently, with the development of deep learning, Recurrent Neural Networks (RNNs) have been applied to sequence labeling, simplifying its solution. Most NLP problems, including named entity recognition, can be transformed into sequence labeling problems.

[0005] Traditional sequence labeling models assign a label to each position in the sequence. The loss function during backpropagation optimization is based on each position rather than the entire entity word, and it cannot handle entity nesting. Span-based named entity recognition methods, on the other hand, classify entities by enumerating all possible spans. The loss function during model optimization is based on the entire entity word, thus aligning more with conventional thinking and resolving entity nesting issues. Summary of the Invention

[0006] The technical problem to be solved by the embodiments of this application is to provide a named entity recognition method, apparatus and computer-readable storage medium, which can improve the performance of named entity recognition and reduce the requirements for sample datasets.

[0007] According to one aspect of this application, at least one embodiment provides a named entity recognition method, comprising:

[0008] By traversing the text elements in the text to be identified based on the text span, multiple candidate entity words are obtained;

[0009] For each candidate entity word, the following steps are used to identify the category to which the candidate entity word belongs:

[0010] Generate a prompt template corresponding to the candidate entity word, and concatenate the text to be identified with the prompt template to obtain concatenated text. The prompt template is used to prompt the learning of the category to which the candidate entity word belongs, and the prompt template includes the candidate entity word and the entity category covered by the blocked word.

[0011] Generate vector representations of the text elements in the concatenated text;

[0012] Based on the vector representation of the text element of each candidate entity word in the concatenated text and the vector representation of the text element of the masked word, the vector representation of the candidate entity word is generated;

[0013] The vector representations of the candidate entity words are classified to obtain the category to which the candidate entity words belong.

[0014] Furthermore, according to at least one embodiment of this application, generating the vector representation of the candidate entity word based on the vector representation of the text element of each candidate entity word in the concatenated text and the vector representation of the text element of the masked word includes:

[0015] The vector representations of the text elements of the candidate entity words in the text to be identified are subjected to a first integration process to obtain a first span representation of the candidate entity words; the vector representations of the text elements of the candidate entity words in the prompt template are subjected to a first integration process to obtain a second span representation of the candidate entity words.

[0016] Based on the first span representation, the second span representation, and the vector representation of the text elements of the blocked word, the vector representation of the candidate entity word is generated.

[0017] Furthermore, according to at least one embodiment of this application, generating the vector representation of the candidate entity word based on the first span representation, the second span representation, and the vector representation of the text elements of the blocked word includes:

[0018] A second integration process is performed on the first span representation and the second span representation to obtain a third span representation;

[0019] The vector representation of the candidate entity word is obtained by concatenating the third span representation and the vector representation of the text element of the blocked word.

[0020] Furthermore, according to at least one embodiment of this application, generating the vector representation of the candidate entity word based on the first span representation, the second span representation, and the vector representation of the text elements of the blocked word includes:

[0021] A second integration process is performed on the first span representation and the second span representation to obtain a third span representation;

[0022] Obtain the vector representation corresponding to the width value of the text span of the candidate entity word, and concatenate the third span representation with the vector representation corresponding to the width value of the text span of the candidate entity word to obtain the fourth span representation;

[0023] The vector representation of the candidate entity word is obtained by concatenating the fourth span representation and the vector representation of the text element of the blocked word.

[0024] Furthermore, according to at least one embodiment of this application, the concatenated text includes a start identifier; generating the vector representation of the candidate entity word based on the vector representation of the text element of each candidate entity word in the concatenated text and the vector representation of the text element of the masked word includes:

[0025] The vector representations of the text elements of the candidate entity words in the text to be identified are subjected to a first integration process to obtain a first span representation of the candidate entity words; the vector representations of the text elements of the candidate entity words in the prompt template are subjected to a first integration process to obtain a second span representation of the candidate entity words.

[0026] The vector representation of the candidate entity word is generated based on the first span representation, the second span representation, the vector representation of the starting identifier, and the vector representation of the text element of the masked word.

[0027] Furthermore, according to at least one embodiment of this application, generating a vector representation of the candidate entity word based on the first span representation, the second span representation, the vector representation of the text element of the masked word, and the vector representation of the start identifier includes:

[0028] A second integration process is performed on the first span representation and the second span representation to obtain a third span representation;

[0029] The vector representation of the candidate entity word is obtained by concatenating the vector representation of the third span, the vector representation of the starting identifier, and the vector representation of the text element of the masked word.

[0030] Furthermore, according to at least one embodiment of this application, generating a vector representation of the candidate entity word based on the first span representation, the second span representation, the vector representation of the text element of the masked word, and the vector representation of the start identifier includes:

[0031] A second integration process is performed on the first span representation and the second span representation to obtain a third span representation;

[0032] Obtain the vector representation corresponding to the width value of the text span of the candidate entity word, and concatenate the third span representation with the vector representation corresponding to the width value of the text span of the candidate entity word to obtain the fourth span representation;

[0033] The vector representation of the fourth span, the vector representation of the starting identifier, and the vector representation of the text element of the masked word are concatenated to obtain the vector representation of the candidate entity word.

[0034] Furthermore, according to at least one embodiment of this application, the first integration process includes any one of the following processes: max pooling; average pooling; concatenation of vector representations of the first and last text elements in the candidate entity words; the second integration process includes any one of the following processes: max pooling; average pooling.

[0035] Furthermore, according to at least one embodiment of this application, classifying the vector representations of the candidate entity words to obtain the category to which the candidate entity words belong includes:

[0036] The vector representation of the candidate entity word is input into the softmax function to obtain the probability of the candidate entity word being mapped to different candidate categories, and the candidate category with the highest probability is taken as the category to which the candidate entity word belongs.

[0037] According to another aspect of this application, at least one embodiment provides a named entity recognition device, comprising:

[0038] The traversal module is used to traverse the text elements in the text to be identified based on the text span to obtain multiple candidate entity words;

[0039] The identification module is used to identify the category to which each candidate entity word belongs through the following sub-modules:

[0040] The first generation submodule is used to generate a prompt template corresponding to the candidate entity word, and to concatenate the text to be identified with the prompt template to obtain concatenated text. The prompt template is used to prompt the learning of the category to which the candidate entity word belongs, and the prompt template includes the candidate entity word and the entity category covered by the blocked word.

[0041] The second generation submodule is used to generate vector representations of the text elements in the concatenated text;

[0042] The third generation submodule is used to generate the vector representation of the candidate entity word based on the vector representation of the text element of each candidate entity word in the concatenated text and the vector representation of the text element of the masked word;

[0043] The classification submodule is used to classify the vector representations of the candidate entity words to obtain the category to which the candidate entity words belong.

[0044] Furthermore, according to at least one embodiment of this application, the third generation submodule is further configured to perform a first integration process on the vector representation of the text elements of the candidate entity words in the text to be identified to obtain a first span representation of the candidate entity words; perform a first integration process on the vector representation of the text elements of the candidate entity words in the prompt template to obtain a second span representation of the candidate entity words; and generate a vector representation of the candidate entity words based on the first span representation, the second span representation, and the vector representation of the text elements of the blocked words.

[0045] Furthermore, according to at least one embodiment of this application, the third generation submodule is further configured to perform a second integration process on the first span representation and the second span representation to obtain a third span representation; and to concatenate the third span representation with the vector representation of the text element of the blocked word to obtain the vector representation of the candidate entity word.

[0046] Furthermore, according to at least one embodiment of this application, the third generation submodule is further configured to perform a second integration process on the first span representation and the second span representation to obtain a third span representation; obtain the vector representation corresponding to the width value of the text span of the candidate entity word, and concatenate the third span representation and the vector representation corresponding to the width value of the text span of the candidate entity word to obtain a fourth span representation; and concatenate the fourth span representation and the vector representation of the text element of the blocked word to obtain the vector representation of the candidate entity word.

[0047] Furthermore, according to at least one embodiment of this application, the concatenated text includes a start identifier; the third generation submodule is further configured to perform a first integration process on the vector representation of the text elements of the candidate entity words in the text to be identified to obtain a first span representation of the candidate entity words; perform a first integration process on the vector representation of the text elements of the candidate entity words in the prompt template to obtain a second span representation of the candidate entity words; and generate a vector representation of the candidate entity words based on the first span representation, the second span representation, the vector representation of the text elements of the blocked word, and the vector representation of the start identifier.

[0048] Furthermore, according to at least one embodiment of this application, the third generation submodule is further configured to perform a second integration process on the first span representation and the second span representation to obtain a third span representation; and to concatenate the third span representation, the vector representation of the starting identifier, and the vector representation of the text element of the masked word to obtain the vector representation of the candidate entity word.

[0049] Furthermore, according to at least one embodiment of this application, the third generation submodule is further configured to perform a second integration process on the first span representation and the second span representation to obtain a third span representation; obtain the vector representation corresponding to the width value of the text span of the candidate entity word, and concatenate the third span representation and the vector representation corresponding to the width value of the text span of the candidate entity word to obtain a fourth span representation; and concatenate the fourth span representation, the vector representation of the starting identifier, and the vector representation of the text element of the masked word to obtain the vector representation of the candidate entity word.

[0050] Furthermore, according to at least one embodiment of this application, the first integration process includes any one of the following processes: max pooling; average pooling; the second integration process includes any one of the following processes: max pooling; average pooling.

[0051] Furthermore, according to at least one embodiment of this application, the classification submodule is further configured to input the vector representation of the candidate entity word into a softmax function to obtain the probability of the candidate entity word being mapped to different candidate categories as output by the softmax function, and to take the candidate category with the highest probability as the category to which the candidate entity word belongs.

[0052] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the named entity recognition method described above.

[0053] Compared with existing technologies, the named entity recognition method, apparatus, and computer-readable storage medium provided in this application integrate span information and prompt information from the prompt template in the final representation of candidate entity words, thereby effectively improving the performance of named entity recognition and reducing the requirements for sample datasets. For small sample datasets, this model shows significant effectiveness. Furthermore, the prompt template construction method in this application is simple and effective. Attached Figure Description

[0054] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0055] Figure 1 This is a schematic flowchart of a named entity recognition method according to an embodiment of this application;

[0056] Figure 2 This is a schematic diagram of a named entity recognition device according to an embodiment of this application;

[0057] Figure 3 This is another structural schematic diagram of the named entity recognition device according to an embodiment of this application. Detailed Implementation

[0058] To make the technical problems, technical solutions, and advantages of this application clearer, a detailed description will be provided below in conjunction with the accompanying drawings and specific embodiments. In the following description, specific details such as particular configurations and components are provided merely to aid in a comprehensive understanding of the embodiments of this application. Therefore, those skilled in the art should understand that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this application. Furthermore, for clarity and brevity, descriptions of known functions and structures have been omitted.

[0059] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments.

[0060] In the various embodiments of this application, it should be understood that the sequence number of each process described below does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0061] Most existing neural network models are based on pre-trained models, which significantly impact downstream tasks. Therefore, adding prompts to inform the model of the specific tasks to be performed allows downstream tasks to better adapt to the pre-trained model, resulting in improved performance. Furthermore, incorporating prompts can also address the issue of low model performance on small datasets.

[0062] This application provides a named entity recognition method based on span and cue learning, which can improve the performance of named entity recognition and reduce the requirements for sample datasets. This method utilizes a neural network model to recognize named entities. Specifically, the neural network model may include a pre-trained model and an output layer based on the softmax function, which can also be called a softmax layer.

[0063] Please refer to Figure 1 The named entity recognition method provided in this application includes:

[0064] Step 11: Traverse the text elements in the text to be identified according to the text span to obtain multiple candidate entity words.

[0065] Here, as an example, the text to be recognized can be entered by a user, such as through voice, handwriting, or other means, or it can be automatically selected. Then, the text elements in the text to be recognized are determined; the types of text elements include characters and words. Specifically, for text elements that are words, the text to be recognized is segmented to obtain text elements, such as word fragments.

[0066] In this embodiment, a maximum entity word length threshold l can be set. The size of l can be set empirically, for example, based on the length of the longest entity word in the domain of the text to be identified, or based on the longest entity word in the dataset. Furthermore, it can be adaptively adjusted during model training based on different datasets. Additionally, l should generally be less than or equal to the number of text elements n in the text to be identified, i.e., l ≤ n. Then, under different text spans, the possible named entities in the text to be identified can be enumerated through traversal operations, suitable for cases with multi-level nested named entities. There are various specific traversal methods: for example, for a text span i, the text to be identified can be traversed separately to obtain candidate entity words composed of i consecutive text elements in the text to be identified. The value of i ranges from 1 to l; another example is that the text element sequence ([CLS], x1, x2, ..., x...) of the text to be identified can be... n [SEP]), taking each text element in the text element sequence as the starting point, combines it with no more than l-1 text elements after the current element to obtain different text spans, with text element x i For example, candidate entity words can be obtained, such as x. i x i x i+1 x i x i+1 x i+2 , ..., x i ...x i+t , ...; where x i [CLS] represents the i-th text element in the text to be recognized; [CLS] represents the start identifier of the text to be recognized; [SEP] represents the end identifier of the text to be recognized.

[0067] Thus, after the traversal operation in step 11, multiple candidate entity words can be obtained. Named entity recognition is performed on each candidate entity word. The specific recognition method will be explained in detail later.

[0068] Step 12: For each candidate entity word, identify the category to which the candidate entity word belongs through the following steps:

[0069] A) Generate a prompt template corresponding to the candidate entity word, and concatenate the text to be identified with the prompt template to obtain concatenated text. The prompt template is used to prompt the learning of the category to which the candidate entity word belongs, and the prompt template includes the candidate entity word and the entity category covered by the blocked word.

[0070] This application combines prompt learning with span-based named entity recognition. Specifically, for each candidate entity word, a prompt template is generated containing the candidate entity word and its corresponding entity category. Furthermore, a masking word is used to cover the entity category to which the candidate entity word belongs. The masking word can be selected based on the specific named entity recognition model; for example, the masking word can be represented as [MASK]. It can be seen that since the entity category in the prompt template is ultimately represented by the masking word, it is not necessary to predetermine the category to which the candidate entity word belongs when generating the prompt template. Assume the text to be recognized is English text, and the candidate entity word is x. i ...x i+t The masking word is [MASK]. There are several possible prompt templates, and you can choose one based on the recognition accuracy of different prompt templates in specific applications:

[0071] x i ...x i+t is a [MASK]

[0072] x i ...x i+t is a [MASK] entity

[0073] The type of x i ...x i+t is[MASK]

[0074] The entity type of x i ...x i+t is[MASK]

[0075] In one example, suppose the text to be recognized is x1, x2, ..., x n , (x i ...x i+t ) is a text span, belonging to entity category A (A is one of the named entity categories, None indicates it is not a named entity), mapping entity category A to a meaningful word [TYPE]. Based on the mapping between the text span and the entity category word, a hint template "x" is defined. i ...x i+t "is a [TYPE] entity". Then, disable the prompt template "x". i ...x i+t The entity classification term in "is a[TYPE]entity" is replaced with the [MASK] tag from the pre-trained model, and the prompt template becomes "x i ...x i+t"is a [MASK] entity". Therefore, the generated concatenated text (including the start and end identifiers) can be represented as a sequence of text elements as:

[0076] ([CLS],x1,x2,...,x n x i , ..., x i+t ,is,a,[MASK],entity,[SEP])

[0077] The above explanation uses English as an example. For Chinese, Japanese, or other language texts, a similar format can be used to generate prompt templates and concatenated text.

[0078] B) Generate vector representations of the text elements in the concatenated text.

[0079] Here, each text element in the concatenated text undergoes vector transformation, that is, the text elements are embedded, mapping the text elements to a vector space to obtain the vector representation of the text elements. In other words, the text elements are represented in vector form to facilitate subsequent processing.

[0080] Specifically, a pre-trained model can be used to generate vector representations of text elements in the concatenated text. The concatenated text is input into the pre-trained model, and the pre-trained model outputs vector representations of the text elements in the concatenated text. The pre-trained model includes, but is not limited to, one of the following models: BERT model, Albert model, Roberta model, XLnet model, etc.

[0081] Continuing with the example above, after inputting the concatenated text into the pre-trained model, the vector representations of the text elements in the concatenated text are obtained as follows:

[0082] (e CLS e1, e2, ...e i , ..., e i+t , ...e n ,e′ i ,e′ i+1 , ..., e′ i+t e is e a e MASK e entity e SEP )

[0083] Among them, e CLS The vector representation of the starting identifier has no obvious semantics. After passing through a self-attention mechanism, it "fairly" integrates the semantic information of all text elements, thus better representing the semantics of the entire sentence. SEPThe vector representation of the terminator; e i For the text element x in the text to be identified i Vector representation; e′ i For the text element x in the prompt template i vector representation; e is e is the vector representation of the text element is in the text to be identified. a Let e ​​be the vector representation of text element a in the text to be identified. MASK e is the vector representation of the masked words in the prompt template; entity This is a vector representation of the text element entity in the prompt template. (e i , ..., e i+t (e′) is the vector representation of the text elements of the candidate entity words in the text to be identified. i , ..., e′ i+t ) is the vector representation of the text elements of the candidate entity words in the prompt template.

[0084] C) Generate the vector representation of the candidate entity word based on the vector representation of the text element of each candidate entity word in the concatenated text and the vector representation of the text element of the masked word.

[0085] In this embodiment, the concatenated text includes a text to be identified and a prompt template, and each of the text to be identified and the prompt template includes one candidate entity word, meaning the concatenated text includes two candidate entity words. This embodiment performs a first integration process on the vector representation of the text elements of each candidate entity word in the concatenated text to obtain a first span representation and a second span representation for each candidate entity word. Specifically, the first integration process is performed on the vector representation of the text elements of the candidate entity words in the text to be identified to obtain a first span representation of the candidate entity words; the first integration process is also performed on the vector representation of the text elements of the candidate entity words in the prompt template to obtain a second span representation of the candidate entity words. Here, the first integration process may include any of the following: max pooling; average pooling; concatenation of the vector representations of the first and last text elements of the candidate entity words, etc.

[0086] For example, by performing max pooling, we obtain the first span representation e′. span The second span represents e″ span .

[0087] e′ span =maxPooling(e i , ..., e i+i )

[0088] e″ span=maxPooling(e′) i , ..., e′ i+t )

[0089] After obtaining the first span representation and the second span representation of the candidate entity words, this application embodiment has a variety of ways to generate the vector representation of the candidate entity words, which will be described below.

[0090] As one way to generate the vector representation of the candidate entity word, this application embodiment can generate the vector representation of the candidate entity word based on the first span representation, the second span representation, and the vector representation of the text elements of the blocked word.

[0091] For example, a second integration process is performed on the first and second span representations to obtain a third span representation. Then, the third span representation and the vector representation of the text elements of the blocked word are concatenated to obtain the vector representation of the candidate entity word. The second integration process may specifically include any of the following processes: max pooling; average pooling.

[0092] For example, a second integration process is performed on the first span representation and the second span representation to obtain a third span representation. The vector representation corresponding to the width value of the text span of the candidate entity word is obtained, and the third span representation and the vector representation corresponding to the width value of the text span of the candidate entity word are concatenated to obtain a fourth span representation; the fourth span representation and the vector representation of the text element of the blocked word are concatenated to obtain the vector representation of the candidate entity word.

[0093] Here, the width value of the text span of the candidate entity word refers to the number of text elements included in the candidate entity word. The vector representation corresponding to the width value of the text span of the candidate entity word can be obtained by backpropagation by obtaining a representation matrix of the width value. This representation matrix contains the vector representation corresponding to the width value of each text span (e.g., width values ​​of 1, 2, 3, ..., l). The vector representation corresponding to the width value of the current text span can be found from the matrix.

[0094] Since the vector representation of the starting identifier generated by the pre-trained model usually includes semantic information of each text element in the concatenated text, the embodiments of this application can further combine the vector representation of the starting identifier to generate the vector representation of the candidate entity word.

[0095] Specifically, as another way to generate the vector representation of the candidate entity word, this embodiment of the application can generate the vector representation of the candidate entity word based on the first span representation, the second span representation, the vector representation of the text element of the blocked word, and the vector representation of the starting identifier.

[0096] For example, a second integration process is performed on the first span representation and the second span representation to obtain a third span representation. Then, the third span representation, the vector representation of the starting identifier, and the vector representation of the text elements of the masked word are concatenated to obtain the vector representation of the candidate entity word.

[0097] For example, a second integration process is performed on the first and second span representations to obtain a third span representation. The vector representation e corresponding to the width value of the text span of the candidate entity word is then obtained. w And the vector representation e corresponding to the width value of the text span of the third span and the candidate entity word. w Concatenate to obtain the fourth span representation. Then, combine the fourth span representation with the vector representation e of the starting identifier. CLS and the vector representation e of the text elements of the masked word MASK The vector representation e of the candidate entity word is obtained by concatenation. This implementation can be expressed by the following formula, where the second integration process uses average pooling. Vector concatenation:

[0098]

[0099] It should also be noted that the specific method used to generate the vector representation of the candidate entity words can be selected based on the named entity recognition performance under different generation methods.

[0100] D) Classify the vector representations of the candidate entity words to obtain the category to which the candidate entity words belong.

[0101] Here, the vector representations of candidate entity words are classified and mapped to probabilities corresponding to multiple candidate categories. The category to which a candidate entity word belongs is then determined based on these probabilities. Candidate categories include non-entity categories and multiple named entity categories. Specifically, the vector representations of the candidate entity words can be input into a softmax function to obtain the probabilities of the candidate entity word mapped to different candidate categories, as output by the softmax function. The candidate category with the highest probability is then taken as the category to which the candidate entity word belongs. This process can be represented by the softmax function as follows:

[0102]

[0103] W represents the probability that the candidate entity word is mapped to different candidate categories, and W and b represent the trainable parameters of the neural network model.

[0104] It should also be noted that, in this embodiment, non-entity categories are treated as candidate categories, and are treated equally with named entity categories. That is, candidate categories include non-entity categories and multiple named entity categories, which can be personal names, place names, organization names, etc. Here, "multiple" in this embodiment typically refers to at least two.

[0105] The methods described in this application embodiment can be applied to the training and inference processes of a neural network model. For example, when applied to the training process, a neural network model for named entity recognition can be trained. When applied to the inference process, the trained neural network model can be used to identify the category to which candidate entity words belong. Furthermore, after obtaining the category to which the candidate entity words belong, the candidate entity words in the text to be identified that belong to the named entity category can be applied to natural language processing application scenarios, including but not limited to summarization, object recommendation, text classification, and question answering application scenarios.

[0106] As can be seen from the above description, the named entity recognition method of this application proposes a prompt template construction method based on text span. For example, the prompt template "[SPAN] is a [MSAK] entity" is used, where [SPAN] represents the text span of a candidate entity word, and [MASK] is the masked entity type. The prompt template helps the pre-trained model recall the knowledge learned during the pre-training stage, making downstream tasks more adaptable to the pre-trained model. Furthermore, this application proposes a representation method that combines span representation with prompt information. By using methods such as average pooling / max pooling, the original span and the span in the prompt template are merged, and the representation of the masked word [MSAK] is concatenated. This ensures that the final representation of the candidate entity word not only has span information but also provides prompt information to the model, thereby effectively improving the performance of named entity recognition and reducing the requirements for sample datasets. For small sample datasets, this model shows significant effectiveness. In addition, the prompt template construction method of this application is simple and effective.

[0107] Based on the above methods, this application also provides an apparatus for implementing the above methods. Please refer to [link / reference]. Figure 2 The named entity recognition device provided in this application includes:

[0108] Traversal module 21 is used to traverse the text elements in the text to be identified according to the text span to obtain multiple candidate entity words;

[0109] The identification module 22 is used to identify the category to which each candidate entity word belongs through the following sub-modules:

[0110] The first generation submodule 221 is used to generate a prompt template corresponding to the candidate entity word, and to concatenate the text to be identified with the prompt template to obtain concatenated text. The prompt template is used to prompt the learning of the category to which the candidate entity word belongs, and the prompt template includes the candidate entity word and the entity category covered by the blocked word.

[0111] The second generation submodule 222 is used to generate vector representations of the text elements in the concatenated text;

[0112] The third generation submodule 223 is used to generate the vector representation of the candidate entity word based on the vector representation of the text element of each candidate entity word in the concatenated text and the vector representation of the text element of the masked word;

[0113] The classification submodule 224 is used to classify the vector representations of the candidate entity words to obtain the category to which the candidate entity words belong.

[0114] Through the above modules, the named entity recognition device of this application embodiment can effectively improve the performance of named entity recognition and reduce the requirements for sample datasets.

[0115] Optionally, the third generation submodule is further configured to perform a first integration process on the vector representation of the text elements of the candidate entity words in the text to be identified to obtain a first span representation of the candidate entity words; perform a first integration process on the vector representation of the text elements of the candidate entity words in the prompt template to obtain a second span representation of the candidate entity words; and generate a vector representation of the candidate entity words based on the first span representation, the second span representation, and the vector representation of the text elements of the blocked words.

[0116] Optionally, the third generation submodule is further configured to perform a second integration process on the first span representation and the second span representation to obtain a third span representation; and to concatenate the third span representation with the vector representation of the text element of the blocked word to obtain the vector representation of the candidate entity word.

[0117] Optionally, the third generation submodule is further configured to perform a second integration process on the first span representation and the second span representation to obtain a third span representation; obtain the vector representation corresponding to the width value of the text span of the candidate entity word, and concatenate the third span representation and the vector representation corresponding to the width value of the text span of the candidate entity word to obtain a fourth span representation; and concatenate the fourth span representation and the vector representation of the text element of the blocked word to obtain the vector representation of the candidate entity word.

[0118] Optionally, the concatenated text includes a start identifier; the third generation submodule is further configured to perform a first integration process on the vector representation of the text elements of the candidate entity words in the text to be identified to obtain a first span representation of the candidate entity words; perform a first integration process on the vector representation of the text elements of the candidate entity words in the prompt template to obtain a second span representation of the candidate entity words; and generate a vector representation of the candidate entity words based on the first span representation, the second span representation, the vector representation of the text elements of the blocked word, and the vector representation of the start identifier.

[0119] Optionally, the third generation submodule is further configured to perform a second integration process on the first span representation and the second span representation to obtain a third span representation; and to concatenate the third span representation, the vector representation of the starting identifier and the vector representation of the text element of the masked word to obtain the vector representation of the candidate entity word.

[0120] Optionally, the third generation submodule is further configured to perform a second integration process on the first span representation and the second span representation to obtain a third span representation; obtain the vector representation corresponding to the width value of the text span of the candidate entity word, and concatenate the third span representation and the vector representation corresponding to the width value of the text span of the candidate entity word to obtain a fourth span representation; and concatenate the fourth span representation, the vector representation of the starting identifier, and the vector representation of the text element of the masked word to obtain the vector representation of the candidate entity word.

[0121] Optionally, the first integration process includes any of the following processes: max pooling; average pooling; concatenation of vector representations of the first and last text elements in the candidate entity words; the second integration process includes any of the following processes: max pooling; average pooling, etc.

[0122] Optionally, the classification submodule is further configured to input the vector representation of the candidate entity word into the softmax function to obtain the probability of the candidate entity word being mapped to different candidate categories as output by the softmax function, and to take the candidate category with the highest probability as the category to which the candidate entity word belongs.

[0123] Please refer to Figure 3 This application also provides a hardware structure block diagram of a named entity recognition device, such as... Figure 3 As shown, the named entity recognition device 300 includes:

[0124] Processor 302; and

[0125] Memory 304, wherein computer program instructions are stored.

[0126] When the computer program instructions are executed by the processor, the processor 302 performs the following steps:

[0127] By traversing the text elements in the text to be identified based on the text span, multiple candidate entity words are obtained;

[0128] For each candidate entity word, the following steps are used to identify the category to which the candidate entity word belongs:

[0129] Generate a prompt template corresponding to the candidate entity word, and concatenate the text to be identified with the prompt template to obtain concatenated text. The prompt template is used to prompt the learning of the category to which the candidate entity word belongs, and the prompt template includes the candidate entity word and the entity category covered by the blocked word.

[0130] Generate vector representations of the text elements in the concatenated text;

[0131] Based on the vector representation of the text element of each candidate entity word in the concatenated text and the vector representation of the text element of the masked word, the vector representation of the candidate entity word is generated;

[0132] The vector representations of the candidate entity words are classified to obtain the category to which the candidate entity words belong.

[0133] Furthermore, such as Figure 3 As shown, the named entity recognition device 300 also includes a network interface 301, an input device 303, a hard disk 305, and a display device 306.

[0134] The various interfaces and devices described above can be interconnected via a bus architecture. The bus architecture can include any number of interconnecting buses and bridges. Specifically, various circuits representing one or more central processing units (CPUs) and / or graphics processing units (GPUs), as represented by processor 302, and one or more memories, as represented by memory 304, are connected together. The bus architecture can also connect various other circuits such as peripheral devices, voltage regulators, and power management circuits. It is understood that the bus architecture is used to implement communication between these components. In addition to the data bus, the bus architecture also includes a power bus, a control bus, and a status signal bus, which are well known in the art and therefore will not be described in detail herein.

[0135] The network interface 301 can be connected to a network (such as the Internet, local area network, etc.), receive training data, text to be recognized, and other data from the network, and can save the received data to the hard disk 305.

[0136] The input device 303 can receive various instructions input by the operator and send them to the processor 302 for execution. The input device 303 may include a keyboard or a clicking device (e.g., a mouse, trackball, touchpad, or touchscreen).

[0137] The display device 306 can display the results obtained by the processor 302 executing instructions, such as the identified entity words and their respective categories.

[0138] The memory 304 is used to store programs and data necessary for the operation of the operating system, as well as intermediate results and other data during the calculation process of the processor 302.

[0139] It is understood that the memory 304 in the embodiments of this application may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory may be random access memory (RAM), which is used as an external cache. The memory 304 of the apparatus and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0140] In some implementations, memory 304 stores elements such as executable modules or data structures, or subsets thereof, or extended sets thereof: operating system 3041 and application program 3042.

[0141] The operating system 3041 includes various system programs, such as a framework layer, a core library layer, and a driver layer, used to implement various basic business functions and handle hardware-based tasks. The application program 3042 includes various applications, such as a browser, used to implement various application functions. Programs implementing the methods of this application embodiment can be included in application program 3042.

[0142] The methods disclosed in the above embodiments of this application can be applied to processor 302, or implemented by processor 302. Processor 302 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in processor 302 or by instructions in the form of software. The processor 302 may be a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), off-the-shelf programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, and can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules may be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 304. Processor 302 reads the information in memory 304 and completes the steps of the above method in conjunction with its hardware.

[0143] It is understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described herein, or combinations thereof.

[0144] For software implementation, the techniques described herein can be achieved through modules (e.g., procedures, functions, etc.) that perform the functions described herein. The software code can be stored in memory and executed by a processor. The memory can be implemented within the processor or externally.

[0145] Specifically, when the computer program is executed by the processor 302, it can also perform the following steps:

[0146] The vector representations of the text elements of the candidate entity words in the text to be identified are subjected to a first integration process to obtain a first span representation of the candidate entity words; the vector representations of the text elements of the candidate entity words in the prompt template are subjected to a first integration process to obtain a second span representation of the candidate entity words.

[0147] Based on the first span representation, the second span representation, and the vector representation of the text elements of the blocked word, the vector representation of the candidate entity word is generated.

[0148] Specifically, when the computer program is executed by the processor 302, it can also perform the following steps:

[0149] A second integration process is performed on the first span representation and the second span representation to obtain a third span representation;

[0150] The vector representation of the candidate entity word is obtained by concatenating the third span representation and the vector representation of the text element of the blocked word.

[0151] Specifically, when the computer program is executed by the processor 302, it can also perform the following steps:

[0152] A second integration process is performed on the first span representation and the second span representation to obtain a third span representation;

[0153] Obtain the vector representation corresponding to the width value of the text span of the candidate entity word, and concatenate the third span representation with the vector representation corresponding to the width value of the text span of the candidate entity word to obtain the fourth span representation;

[0154] The vector representation of the candidate entity word is obtained by concatenating the fourth span representation and the vector representation of the text element of the blocked word.

[0155] The concatenated text includes a start identifier. When the computer program is executed by the processor 302, it can also perform the following steps: generating the vector representation of the candidate entity word based on the vector representation of the text element of each candidate entity word in the concatenated text and the vector representation of the text element of the masked word includes:

[0156] The vector representations of the text elements of the candidate entity words in the text to be identified are subjected to a first integration process to obtain a first span representation of the candidate entity words; the vector representations of the text elements of the candidate entity words in the prompt template are subjected to a first integration process to obtain a second span representation of the candidate entity words.

[0157] The vector representation of the candidate entity word is generated based on the first span representation, the second span representation, the vector representation of the starting identifier, and the vector representation of the text element of the masked word.

[0158] Specifically, when the computer program is executed by the processor 302, it can also perform the following steps:

[0159] A second integration process is performed on the first span representation and the second span representation to obtain a third span representation;

[0160] The vector representation of the candidate entity word is obtained by concatenating the vector representation of the third span, the vector representation of the starting identifier, and the vector representation of the text element of the masked word.

[0161] Specifically, when the computer program is executed by the processor 302, it can also perform the following steps:

[0162] A second integration process is performed on the first span representation and the second span representation to obtain a third span representation;

[0163] Obtain the vector representation corresponding to the width value of the text span of the candidate entity word, and concatenate the third span representation with the vector representation corresponding to the width value of the text span of the candidate entity word to obtain the fourth span representation;

[0164] The vector representation of the fourth span, the vector representation of the starting identifier, and the vector representation of the text element of the masked word are concatenated to obtain the vector representation of the candidate entity word.

[0165] Optionally, the first integration process includes any one of the following processes: max pooling; average pooling; concatenation of the vector representations of the first and last text elements in the candidate entity words; the second integration process includes any one of the following processes: max pooling; average pooling.

[0166] Specifically, when the computer program is executed by the processor 302, it can also perform the following steps:

[0167] The vector representation of the candidate entity word is input into the softmax function to obtain the probability of the candidate entity word being mapped to different candidate categories, and the candidate category with the highest probability is taken as the category to which the candidate entity word belongs.

[0168] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0169] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0170] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0171] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of this application, depending on actual needs.

[0172] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0173] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.

[0174] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A named entity recognition method, characterized in that, include: By traversing the text elements in the text to be identified based on the text span, multiple candidate entity words are obtained; For each candidate entity word, the following steps are used to identify the category to which the candidate entity word belongs: Generate a prompt template corresponding to the candidate entity word, and concatenate the text to be identified with the prompt template to obtain concatenated text. The prompt template is used to prompt the learning of the category to which the candidate entity word belongs, and the prompt template includes the candidate entity word and the entity category covered by the blocked word. Generate vector representations of the text elements in the concatenated text; Based on the vector representation of the text element of each candidate entity word in the concatenated text and the vector representation of the text element of the masked word, the vector representation of the candidate entity word is generated; The vector representations of the candidate entity words are classified to obtain the category to which the candidate entity words belong; The step of generating the vector representation of the candidate entity word based on the vector representation of the text element of each candidate entity word in the concatenated text and the vector representation of the text element of the masked word includes: The vector representations of the text elements of the candidate entity words in the text to be identified are subjected to a first integration process to obtain a first span representation of the candidate entity words; the vector representations of the text elements of the candidate entity words in the prompt template are subjected to a first integration process to obtain a second span representation of the candidate entity words. Based on the first span representation, the second span representation, and the vector representation of the text elements of the blocked word, the vector representation of the candidate entity word is generated.

2. The method as described in claim 1, characterized in that, The step of generating the vector representation of the candidate entity word based on the first span representation, the second span representation, and the vector representation of the text elements of the blocked word includes: A second integration process is performed on the first span representation and the second span representation to obtain a third span representation; The vector representation of the candidate entity word is obtained by concatenating the third span representation and the vector representation of the text element of the blocked word.

3. The method as described in claim 1, characterized in that, The step of generating the vector representation of the candidate entity word based on the first span representation, the second span representation, and the vector representation of the text elements of the blocked word includes: A second integration process is performed on the first span representation and the second span representation to obtain a third span representation; Obtain the vector representation corresponding to the width value of the text span of the candidate entity word, and concatenate the third span representation with the vector representation corresponding to the width value of the text span of the candidate entity word to obtain the fourth span representation; The vector representation of the candidate entity word is obtained by concatenating the fourth span representation and the vector representation of the text element of the blocked word.

4. The method as described in claim 1, characterized in that, The concatenated text includes a start identifier; generating the vector representation of the candidate entity word based on the vector representation of the text element of each candidate entity word in the concatenated text and the vector representation of the text element of the masked word includes: The vector representations of the text elements of the candidate entity words in the text to be identified are subjected to a first integration process to obtain a first span representation of the candidate entity words; the vector representations of the text elements of the candidate entity words in the prompt template are subjected to a first integration process to obtain a second span representation of the candidate entity words. The vector representation of the candidate entity word is generated based on the first span representation, the second span representation, the vector representation of the starting identifier, and the vector representation of the text element of the masked word.

5. The method as described in claim 4, characterized in that, Based on the first span representation, the second span representation, the vector representation of the starting identifier, and the vector representation of the text elements of the masked word, the vector representation of the candidate entity word is generated, including: A second integration process is performed on the first span representation and the second span representation to obtain a third span representation; The vector representation of the candidate entity word is obtained by concatenating the vector representation of the third span, the vector representation of the starting identifier, and the vector representation of the text element of the masked word.

6. The method as described in claim 4, characterized in that, Based on the first span representation, the second span representation, the vector representation of the starting identifier, and the vector representation of the text elements of the masked word, the vector representation of the candidate entity word is generated, including: A second integration process is performed on the first span representation and the second span representation to obtain a third span representation; Obtain the vector representation corresponding to the width value of the text span of the candidate entity word, and concatenate the third span representation with the vector representation corresponding to the width value of the text span of the candidate entity word to obtain the fourth span representation; The vector representation of the fourth span, the vector representation of the starting identifier, and the vector representation of the text element of the masked word are concatenated to obtain the vector representation of the candidate entity word.

7. The method as described in claim 2, 3, 5 or 6, characterized in that, The first integration process includes any one of the following processes: max pooling; average pooling; concatenation of vector representations of the first and last text elements in the candidate entity words; The second integration process includes any one of the following processes: max pooling; average pooling.

8. The method as described in claim 1, characterized in that, The step of classifying the vector representations of the candidate entity words to obtain the category to which the candidate entity words belong includes: The vector representation of the candidate entity word is input into the softmax function to obtain the probability of the candidate entity word being mapped to different candidate categories, and the candidate category with the highest probability is taken as the category to which the candidate entity word belongs.

9. A named entity recognition device, characterized in that, include: The traversal module is used to traverse the text elements in the text to be identified based on the text span to obtain multiple candidate entity words; The identification module is used to identify the category to which each candidate entity word belongs through the following sub-modules: The first generation submodule is used to generate a prompt template corresponding to the candidate entity word, and to concatenate the text to be identified with the prompt template to obtain concatenated text. The prompt template is used to prompt the learning of the category to which the candidate entity word belongs, and the prompt template includes the candidate entity word and the entity category covered by the blocked word. The second generation submodule is used to generate vector representations of the text elements in the concatenated text; The third generation submodule is used to generate the vector representation of the candidate entity word based on the vector representation of the text element of each candidate entity word in the concatenated text and the vector representation of the text element of the masked word; The classification submodule is used to classify the vector representations of the candidate entity words to obtain the category to which the candidate entity words belong; The third generation submodule is further configured to perform a first integration process on the vector representation of the text elements of the candidate entity words in the text to be identified to obtain a first span representation of the candidate entity words; perform a first integration process on the vector representation of the text elements of the candidate entity words in the prompt template to obtain a second span representation of the candidate entity words; and generate a vector representation of the candidate entity words based on the first span representation, the second span representation, and the vector representation of the text elements of the blocked words.

10. The apparatus as claimed in claim 9, characterized in that, The third generation submodule is further configured to perform a second integration process on the first span representation and the second span representation to obtain a third span representation; and to concatenate the third span representation with the vector representation of the text element of the blocked word to obtain the vector representation of the candidate entity word.

11. The apparatus as claimed in claim 9, characterized in that, The third generation submodule is further configured to perform a second integration process on the first span representation and the second span representation to obtain a third span representation; obtain the vector representation corresponding to the width value of the text span of the candidate entity word, and concatenate the third span representation and the vector representation corresponding to the width value of the text span of the candidate entity word to obtain a fourth span representation; and concatenate the fourth span representation and the vector representation of the text element of the blocked word to obtain the vector representation of the candidate entity word.

12. The apparatus as claimed in claim 9, characterized in that, The concatenated text includes a start identifier; the third generation submodule is further used to perform a first integration process on the vector representation of the text elements of the candidate entity words in the text to be identified, to obtain the first span representation of the candidate entity words; The vector representations of the text elements of the candidate entity words in the prompt template are first integrated to obtain the second span representation of the candidate entity words; the vector representation of the candidate entity words is generated based on the first span representation, the second span representation, the vector representation of the start identifier, and the vector representation of the text elements of the masked word.

13. The apparatus as claimed in claim 12, characterized in that, The third generation submodule is further configured to perform a second integration process on the first span representation and the second span representation to obtain a third span representation; and to concatenate the third span representation, the vector representation of the starting identifier and the vector representation of the text element of the masked word to obtain the vector representation of the candidate entity word.

14. The apparatus as claimed in claim 12, characterized in that, The third generation submodule is further configured to perform a second integration process on the first span representation and the second span representation to obtain a third span representation; obtain the vector representation corresponding to the width value of the text span of the candidate entity word, and concatenate the third span representation and the vector representation corresponding to the width value of the text span of the candidate entity word to obtain a fourth span representation; and concatenate the fourth span representation, the vector representation of the starting identifier, and the vector representation of the text element of the masked word to obtain the vector representation of the candidate entity word.

15. The apparatus as claimed in claim 9, characterized in that, The classification submodule is further configured to input the vector representation of the candidate entity word into the softmax function to obtain the probability of the candidate entity word being mapped to different candidate categories as output by the softmax function, and to take the candidate category with the highest probability as the category to which the candidate entity word belongs.

16. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the named entity recognition method as described in any one of claims 1 to 8.