Artificial intelligence-based named entity recognition method, apparatus, device, and medium

By combining matching and concatenation processing in a pre-trained entity dictionary with a pre-trained model, the contradiction between real-time performance and accuracy in named entity recognition models is resolved, achieving efficient named entity recognition.

CN115730601BActive Publication Date: 2026-02-13CHINA PING AN LIFE INSURANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211418787.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-14
Publication Date
2026-02-13
Estimated Expiration
2042-11-14

AI Technical Summary

Technical Problem

Existing named entity recognition models struggle to improve recognition accuracy while maintaining real-time performance, especially when faced with newly emerging entities and recognition ambiguities.

Method used

By matching the text to be processed in a preset entity dictionary, using preset delimiters to concatenate the text and dictionary recognition results, and combining them with a pre-trained named entity classification model for classification, real-time updates and accurate recognition are achieved.

Benefits of technology

It improves the accuracy and reliability of named entity recognition, reduces the difficulty of recognition, and ensures real-time performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115730601B_ABST
    Figure CN115730601B_ABST
Patent Text Reader

Abstract

The application is suitable for the field of artificial intelligence, and particularly relates to a named entity recognition method and device based on artificial intelligence, equipment and medium. The application matches a dictionary recognition result of a to-be-processed text in an entity dictionary, including N target entities and M entity types corresponding to each target entity i The real-time effectiveness of the dictionary recognition result is ensured through the real-time updated entity dictionary, and the reliability of the named entity recognition result is improved. The to-be-processed text and the dictionary recognition result are spliced into a target character sequence through a preset separator, a pre-trained named entity classification model is used to classify the target character sequence, and a named entity recognition result is obtained. The generation task of determining the named entity and the actual entity type in the to-be-processed text is converted into a classification task of selecting the actual entity type from the candidate entity types, the difficulty of the named entity recognition of the to-be-processed text is reduced, and the accuracy of the named entity recognition result is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application is suitable for the field of artificial intelligence, and particularly relates to a named entity recognition method and device based on artificial intelligence, equipment and a medium. BACKGROUND

[0002] Named entity recognition occupies an important position in many application fields such as intelligent dialogue systems, sentiment analysis, event extraction, and knowledge graphs.

[0003] Traditional named entity recognition is based on entity dictionaries to match named entities in text. However, due to the variability of human language and the complexity of use scenarios, new entities emerge in an endless stream, which may cause recognition ambiguity and result in low accuracy of named entity recognition.

[0004] To solve the above problems, existing named entity recognition models update model parameters by updating training data in real time to ensure that the model can accurately recognize new entities and ambiguous entities. However, this method is time-consuming and laborious, and due to the uneven quality of training data updates, it is difficult to obtain good recognition results while ensuring real-time performance.

[0005] Therefore, in the field of named entity recognition, how to improve the accuracy of named entity recognition results while ensuring real-time performance has become a problem to be solved. SUMMARY

[0006] Therefore, the embodiments of the present application provide a named entity recognition method and device based on artificial intelligence to solve the problem that existing named entity recognition models are difficult to obtain good recognition results while ensuring real-time performance.

[0007] In a first aspect, the embodiments of the present application provide a named entity recognition method based on artificial intelligence, which comprises:

[0008] Obtain a to-be-processed text, match and recognize the to-be-processed text in a preset entity dictionary, and obtain a dictionary recognition result, wherein the dictionary recognition result comprises N target entities associated with the to-be-processed text and M entity types corresponding to each target entity, wherein i=1, 2, …, N, i is an entity number; i

[0009] Perform splicing processing on the to-be-processed text and the dictionary recognition result using a preset delimiter to obtain a target character sequence;

[0010] Classify the target character sequence using a pre-trained named entity classification model to obtain a named entity recognition result.

[0011] ​In a second aspect, an embodiment of the present application provides a named entity recognition device based on artificial intelligence, the named entity recognition device comprising:

[0012] An entity matching module is configured to acquire a to-be-processed text, perform matching recognition on the to-be-processed text in a preset entity dictionary, and obtain a dictionary recognition result, the dictionary recognition result comprising N target entities associated with the to-be-processed text and M i entity types corresponding to each of the target entities, wherein i = 1, 2, …, N, and i is an entity number.

[0013] A character concatenation module is configured to concatenate the to-be-processed text and the dictionary recognition result by using a preset separator to obtain a target character sequence.

[0014] An entity recognition module is configured to classify the target character sequence by using a pre-trained named entity classification model to obtain a named entity recognition result.

[0015] In a third aspect, an embodiment of the present application provides a computer device, the computer device comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, and the processor implements the named entity recognition method according to the first aspect when executing the computer program.

[0016] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, the computer readable storage medium storing a computer program, and the computer program is executed by a processor to implement the named entity recognition method according to the first aspect.

[0017] Compared with the prior art, the embodiment of the present application has the beneficial effects that: the to-be-processed text is matched and recognized in the preset entity dictionary to obtain a dictionary recognition result, the dictionary recognition result comprising N target entities associated with the to-be-processed text and M i entity types corresponding to each of the target entities, the real-time effectiveness of the dictionary recognition result is ensured by the real-time updated entity dictionary, and the reliability of the named entity recognition result is improved; the to-be-processed text and the dictionary recognition result are concatenated by using a preset separator to obtain a target character sequence, the generation task of the named entity recognition and the actual entity type recognition in the to-be-processed text according to the semantic information of the to-be-processed text is converted into a classification task of selecting the actual entity type from the candidate entity types according to the semantic information of the to-be-processed text, and the difficulty of the named entity recognition of the to-be-processed text is effectively reduced; the target character sequence is classified by using a pre-trained named entity classification model to obtain a named entity recognition result, and the accuracy of the named entity recognition result is effectively improved. BRIEF DESCRIPTION OF DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained from these drawings without creative labor.

[0019] Figure 1 is an application environment schematic diagram of a named entity recognition method based on artificial intelligence provided by the embodiment one of the present application;

[0020] Figure 2 is a flow schematic diagram of a named entity recognition method based on artificial intelligence provided by the embodiment one of the present application;

[0021] Figure 3 is a structure schematic diagram of a named entity recognition device based on artificial intelligence provided by the embodiment two of the present application;

[0022] Figure 4 is a structure schematic diagram of a computer device provided by the embodiment three of the present application. DETAILED DESCRIPTION

[0023] In the following description, for the purpose of explanation and not limitation, specific details are set forth, such as particular system configurations, techniques, etc., in order to provide a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application can be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.

[0024] It should be understood that, when used in the specification and the appended claims of the present application, the term "comprising" indicates the presence of described features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0025] It should also be understood that the term "and / or" used in the specification and the appended claims of the present application means any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.

[0026] As used in the description of the application and the appended claims, the term "if' can be interpreted to mean "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [a described condition or event] is detected" can be interpreted to mean "upon determining" or "in response to determining" or "upon detecting [the described condition or event]" or "in response to detecting [the described condition or event]," depending on the context.

[0027] In addition, in the description of the application and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance.

[0028] In the description of the application, the reference "one embodiment" or "some embodiments" and the like means that the specific features, structures or characteristics described in connection with the embodiment are included in one or more embodiments of the application. Therefore, the statements "in one embodiment", "in some embodiments", "in other some embodiments", "in further some embodiments" and the like appearing in different places in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized. The terms "include", "contain", "have" and their variants mean "include but not limited to", unless otherwise specifically emphasized.

[0029] The embodiments of the application can acquire and process related data based on artificial intelligence technology. Artificial intelligence (AI) is the use of digital computers or computer-controlled machines to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0030] The basic technology of artificial intelligence generally includes technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction system, mechatronics, etc. The software technology of artificial intelligence mainly includes computer vision technology, robot technology, biometric technology, speech processing technology, natural language processing technology, and machine learning / deep learning, etc.

[0031] It should be understood that the size of the serial number of each step in the following embodiments does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the application.

[0032] In order to illustrate the technical solutions of the application, the following will be described by specific embodiments. In order to illustrate the technical solutions of the application, the following will be described by specific embodiments.

[0033] The embodiment one of the present application provides a named entity recognition method based on artificial intelligence, which can be applied to the application environment as shown in Figure 1 The client and the server communicate with each other. The client includes but is not limited to a palm computer, a desktop computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cloud computer device, a personal digital assistant (PDA) and the like. The server can be implemented by an independent server or a server cluster composed of multiple servers.

[0034] Referring to Figure 2 , which is a flowchart of the named entity recognition method based on artificial intelligence provided by the embodiment one of the present application. The named entity recognition method can be applied to the client in Figure 1 The named entity recognition method can include the following steps.

[0035] In step S201, a to-be-processed text is acquired, and the to-be-processed text is matched and recognized in a preset entity dictionary to obtain a dictionary recognition result. The dictionary recognition result includes N target entities associated with the to-be-processed text and M i entity types corresponding to each target entity.

[0036] The to-be-processed text can be a word, a sentence, a paragraph or the like, and at least one target entity is included in the to-be-processed text, that is, N is a positive integer.

[0037] The preset entity dictionary includes a large number of preset entities and a plurality of entity types corresponding to each preset entity. The preset entity dictionary is updated over time to ensure that the to-be-processed text can match the target entity with the highest accuracy from the preset entity dictionary.

[0038] Specifically, for the to-be-processed text, the to-be-processed text is matched and recognized in the preset entity dictionary to obtain N target entities associated with the to-be-processed text and M i entity types corresponding to each target entity. The N target entities and the M i entity types are matched to form a corresponding dictionary recognition result, which is used to complete the entity type recognition of each target entity of the to-be-processed text. Correspondingly, i=1, 2, …, N, i is an entity number.

[0039] Optionally, the to-be-processed text is matched and recognized in the preset entity dictionary to obtain a dictionary recognition result, which includes:

[0040] The entity dictionary includes each preset entity and M i entity types corresponding to each preset entity.

[0041] The text to be processed is segmented to obtain K word items to be recognized.

[0042] Each word item to be recognized is matched with each preset entity in the entity dictionary according to similarity, N target entities and M i entity types corresponding to each target entity are determined according to the similarity matching result.

[0043] Since the text to be processed can be various forms of text, in addition to including target entities, the text to be processed can also include some non-entity interference texts, and the target entities and the interference texts together constitute the text to be processed. Therefore, when matching and recognizing the text to be processed in the preset entity dictionary, the text to be processed is first segmented to obtain K word items to be recognized, and then each word item to be recognized is matched with each preset entity in the entity dictionary according to similarity, and N target entities are determined according to the similarity matching result, so as to filter out K-N interference texts in the text to be processed. Therefore, in this embodiment, K is a positive integer greater than N.

[0044] In an embodiment, when each word item to be recognized is matched with each preset entity in the entity dictionary according to similarity, a word item to be recognized with similarity greater than a similarity threshold is selected as a target entity, and M i entity types of the preset entity corresponding to the target entity are obtained, and the N target entities in the text to be processed and the M i entity types corresponding to each target entity are matched according to the M i entity types.

[0045] The above step of obtaining the text to be processed, matching and recognizing the text to be processed in the preset entity dictionary, and matching to obtain a dictionary recognition result, the dictionary recognition result includes N target entities associated with the text to be processed and M i entity types corresponding to each target entity, the dictionary recognition result of the text to be processed is matched through the real-time updated entity dictionary, the real-time effectiveness of the N target entities and the M i entity types corresponding to each target entity is ensured, and the reliability of the named entity recognition result is improved.

[0046] In step S202, the text to be processed and the dictionary recognition result are spliced using a preset separator to obtain a target character sequence.

[0047] The N target entities associated with the to-be-processed text and the M i entity types corresponding to each target entity are matched from the to-be-processed text by using a preset entity dictionary, and the M i entity types can be regarded as candidate entity types of the target entities.

[0048] On this basis, in order to determine the actual entity types of the named entities, the to-be-processed text and the dictionary recognition result are spliced, and the spliced result is taken as input content of a named entity recognition model. The spliced result contains semantic information of the to-be-processed text itself, and all target entities in the to-be-processed text and candidate entity types of each named entity. Therefore, the named entity recognition and the generation task of the actual entity type recognition of the to-be-processed text according to the semantic information of the to-be-processed text are converted into a classification task of selecting an actual entity type from the candidate entity types according to the semantic information of the to-be-processed text, which effectively reduces the difficulty of the named entity recognition of the to-be-processed text.

[0049] Optionally, the to-be-processed text and the dictionary recognition result are spliced by using a preset separator to obtain a target character sequence, including:

[0050] The preset separator includes a first separator, a second separator and a third separator.

[0051] The first separator is used to splice each target entity and the M i entity types corresponding to each target entity to obtain a first spliced result corresponding to each target entity.

[0052] The second separator is used to splice the first spliced result corresponding to the N target entities to obtain a second spliced result.

[0053] The third separator is used to splice the to-be-processed text and the second spliced result to obtain the target character sequence.

[0054] The dictionary recognition result includes N groups of recognition results composed of target entities and the M i entity types corresponding to each target entity. Therefore, the to-be-processed text and the dictionary recognition result need to be spliced by using three types of separators to obtain the target character sequence.

[0055] Specifically, first, the first separator is used to splice each target entity and the M iThe first splicing results corresponding to the N target entities are spliced by using the second separator to obtain a second splicing result, and correspondingly, the number of the second splicing results is 1; and finally, the target character sequence is obtained by splicing the to-be-processed text and the second splicing result by using a third separator.

[0056] The specific forms of the first separator, the second separator and the third separator can be set according to actual conditions. For example, the first separator can be set as "|", the second separator can be set as "||", and the third separator can be set as "|||". For the to-be-processed text "W", through matching with the preset entity dictionary, two target entities "A" and "B" are obtained, and the entity types corresponding to the target entity "A" are "a", "b" and "c", and the entity types corresponding to the target entity "B" are "d" and "e". After splicing the to-be-processed text and the dictionary recognition result by using the preset separator, the target character sequence obtained is "W|||A|abc||B|de".

[0057] The above step of splicing the to-be-processed text and the dictionary recognition result by using the preset separator to obtain the target character sequence converts the generation task of the named entity recognition and the actual entity type recognition in the to-be-processed text according to the semantic information of the to-be-processed text into a classification task of selecting an actual entity type from the candidate entity types according to the semantic information of the to-be-processed text, thereby effectively reducing the difficulty of the named entity recognition of the to-be-processed text.

[0058] In step S203, the target character sequence is classified by using the pre-trained named entity classification model to obtain a named entity recognition result.

[0059] The target character sequence is the input content of the named entity classification model, and the named entity classification model learns the semantic information in the to-be-processed text and the dictionary recognition result, the association information between the target entities and the M i entity types corresponding to the target entities, and finally selects the actual entity type of each target entity from the M i entity types of each target entity to obtain the named entity recognition result.

[0060] Optionally, the target character sequence is classified by using the pre-trained named entity classification model to obtain the named entity recognition result, including:

[0061] The pre-trained named entity classification model comprises a pre-trained encoder and a pre-trained full connection layer, the pre-trained full connection layer comprises a pre-trained linear transformation layer and a normalized exponential function;

[0062] The target character sequence is input into the pre-trained encoder for feature extraction to obtain a target coding sequence;

[0063] The target coding sequence is input into the pre-trained full connection layer, the target coding sequence is transformed into a target classification vector according to the pre-trained linear transformation layer, and the target classification vector is normalized according to the normalized exponential function to obtain a target probability vector;

[0064] The actual entity type of each target entity is determined according to the target probability vector to obtain a named entity recognition result.

[0065] The pre-trained named entity classification model comprises a pre-trained encoder and a pre-trained full connection layer, the pre-trained full connection layer comprises a pre-trained linear transformation layer and a normalized exponential function;

[0066] The pre-trained full connection layer comprises a pre-trained linear transformation layer for transforming the extracted features into a vector, and a normalized exponential function for normalizing the vector transformed by the linear transformation layer to obtain a target probability vector with probability values in the range of [0, 1] to determine the actual entity type of each target entity.

[0067] Specifically, the target character sequence is first input into the pre-trained encoder for feature extraction to obtain a target coding sequence, and then the target coding sequence is input into the pre-trained full connection layer, the target coding sequence is transformed into a target classification vector according to the pre-trained linear transformation layer, and the target classification vector is normalized according to the normalized exponential function to obtain a target probability vector.

[0068] The total number of entity types of the N target entities in the target character sequence is:

[0069]

[0070] In the formula, M is the total number of entity types in the target character sequence, N is the number of target entities in the target character sequence, M i is the number of entity types corresponding to the i-th target entity in the target character sequence.

[0071] The number of rows of the target probability vector is M, and the number of columns is N. The i-th column vector represents the probability that the i-th target entity in the target character sequence corresponds to all entity types in the target character sequence. The j-th (j = 1, 2, … M) row vector represents the probability that the j-th entity type in the target character sequence corresponds to all target entities in the target character sequence. Therefore, the target probability vector can be used to represent the probability that each target entity in the target character sequence corresponds to each entity type in the target character sequence.

[0072] Therefore, finally, the actual entity type of each target entity is determined according to the target probability vector, and the named entity recognition result is obtained.

[0073] Optionally, the training process of the encoder and the full connection layer includes:

[0074] The sample text is obtained, and the sample text is matched and recognized in the preset entity dictionary. A sample dictionary recognition result is obtained by matching. The sample dictionary recognition result includes N sample entities associated with the sample text and M i entity types corresponding to each sample entity;

[0075] The sample text and the sample dictionary recognition result are spliced by using a preset separator to obtain a sample character sequence;

[0076] The sample character sequence is input into the encoder for feature extraction to obtain a sample encoding sequence;

[0077] The sample encoding sequence is input into the full connection layer. The sample encoding sequence is transformed into a sample classification vector according to the linear transformation layer. The sample classification vector is normalized by using a normalized exponential function to obtain a sample probability vector. The sample actual entity type of each sample entity is determined according to the sample probability vector, and a sample named entity recognition result is obtained.

[0078] The actual named entity recognition result of the sample text is obtained. The encoder and the full connection layer are trained according to the sample named entity recognition result and the actual named entity recognition result to obtain a pre-trained encoder and a pre-trained full connection layer.

[0079] In order to improve the accuracy of the named entity classification model, the encoder and the full connection layer of the named entity classification model are trained according to a large amount of sample text to obtain a pre-trained encoder and a pre-trained full connection layer.

[0080] Specifically, for the obtained sample text, first, matching and recognition are performed in the preset entity dictionary. A sample dictionary recognition result is obtained by matching. The sample dictionary recognition result includes N sample entities associated with the sample text and M iThe sample character sequence can be taken as an input of the named entity recognition model, and the actual named entity recognition result of the sample text obtained can be taken as a training label to train the named entity recognition model.

[0081] Specifically, the sample character sequence is first input into an encoder to perform feature extraction to obtain a sample encoding sequence, and then the sample encoding sequence is input into a full connection layer, the sample encoding sequence is transformed into a sample classification vector according to a linear transformation layer, and the sample classification vector is normalized according to a normalized exponential function to obtain a sample probability vector. The sample probability vector can be used to represent the probability that each sample entity in the sample character sequence corresponds to each entity type in the sample character sequence.

[0082] Therefore, the actual entity type of each sample entity is determined according to the sample probability vector, and the sample named entity recognition result is obtained. Then, the encoder and the full connection layer are trained according to the sample named entity recognition result and the actual named entity recognition result to obtain the pre-trained encoder and the pre-trained full connection layer, thereby effectively improving the accuracy of the named entity classification model.

[0083] Optionally, the encoder and the full connection layer are trained according to the sample named entity recognition result and the actual named entity recognition result to obtain the pre-trained encoder and the pre-trained full connection layer, including:

[0084] The cross-entropy loss is calculated according to the sample named entity recognition result and the actual named entity recognition result.

[0085] The parameters of the encoder and the parameters of the full connection layer are trained according to the gradient descent method until the cross-entropy loss converges, and the pre-trained encoder and the pre-trained full connection layer are obtained.

[0086] The more similar the sample named entity recognition result and the actual named entity recognition result are, the higher the accuracy of the named entity classification model in this training is.

[0087] Therefore, the cross-entropy loss between the sample named entity recognition result and the actual named entity recognition result is calculated. When the cross-entropy loss is large, the parameters of the encoder and the parameters of the full connection layer are trained according to the gradient descent method until the cross-entropy loss converges, and the pre-trained encoder and the pre-trained full connection layer are obtained.

[0088] For example, when calculating the cross-entropy loss between the sample named entity recognition result and the actual named entity recognition result, first, the sample named entity recognition result is converted into a sample named entity recognition result vector according to the word vector technology, the actual named entity recognition result is converted into an actual named entity recognition result vector, and the i th sample named entity recognition result vector is denoted as X i The i th actual named entity recognition result vector is denoted as Y i The cross-entropy loss between the sample named entity recognition result and the actual named entity recognition result is:

[0089]

[0090] In the formula, L1 is the cross-entropy loss, N is the number of sample named entity recognition results and the number of actual named entity recognition results, X i is the i th sample named entity recognition result vector, Y i is the i th actual named entity recognition result vector.

[0091] Optionally, after obtaining the sample named entity recognition result, the following steps are further included:

[0092] determining each row vector in the sample classification vector as a sample sub-vector corresponding to each entity type;

[0093] calculating the divergence value between any two sample sub-vectors, and the difference between each divergence value and a preset threshold, and determining the sum of all the differences as the divergence loss of the named entity classification model.

[0094] The sample classification vector can be used to represent the probability that each sample entity in the sample character sequence corresponds to each entity type in the sample character sequence, and the j th row vector represents the probability that the j th entity type in the sample character sequence corresponds to all sample entities in the sample character sequence. Therefore, for different entity types, the probability distribution of different row vectors with respect to all sample entities is different, and thus there is a certain difference between the probability distributions of different row vectors when the accuracy of the named entity classification model is high.

[0095] Therefore, in this embodiment, each row vector in the sample classification vector is taken as a sample sub-vector corresponding to each entity type, and the divergence value between any two sample sub-vectors is calculated, and the difference between each divergence value and a preset threshold is calculated, and the mean of all the differences is determined as the divergence loss of the named entity classification model.

[0096] For example, the total number of all entity types of the N sample entities in the sample character sequence is M, and the j th row vector in the sample classification vector is denoted as the sample sub-vector Z jThe kth row vector in the sample classification vector is denoted as a sample subvector Z corresponding to the kth entity type k The preset threshold is denoted as δ, and the divergence loss of the named entity classification model is named as follows:

[0097]

[0098] In the formula, L2 is the divergence loss of the named entity classification model, M is the total number of entity types, δ is the preset threshold, Z j is the sample subvector corresponding to the jth entity type, Z k is the sample subvector corresponding to the kth entity type, KL( j || k is the divergence value between the sample subvector corresponding to the jth entity type and the sample subvector corresponding to the kth entity type.

[0099] Optionally, the encoder and the fully connected layer are trained according to the sample named entity recognition result and the actual named entity recognition result to obtain the pre-trained encoder and the pre-trained fully connected layer, including:

[0100] The cross-entropy loss is calculated according to the sample named entity recognition result and the actual named entity recognition result;

[0101] The cross-entropy loss and the divergence loss are weighted and summed to obtain the model loss of the named entity classification model;

[0102] The parameters of the encoder and the parameters of the fully connected layer are trained according to the gradient descent method until the model loss converges, and the pre-trained encoder and the pre-trained fully connected layer are obtained.

[0103] The cross-entropy loss can be used to represent the difference between the sample named entity recognition result and the actual named entity recognition result, and the divergence loss can be used to represent the difference between the probability distribution of different entity types with respect to all sample entities. Therefore, in the embodiment, the cross-entropy loss and the divergence loss can be used to train the encoder and the fully connected layer at the same time.

[0104] Specifically, the cross-entropy loss and the divergence loss are weighted and summed to obtain the model loss of the named entity classification model, and the parameters of the encoder and the parameters of the fully connected layer are trained according to the gradient descent method until the model loss converges, and the pre-trained encoder and the pre-trained fully connected layer are obtained, so as to improve the accuracy of the named entity classification model.

[0105] In the preset entity dictionary, the to-be-processed text is matched and recognized, and a dictionary recognition result is obtained, including N target entities associated with the to-be-processed text and M ientity types, and the real-time validity of the dictionary recognition result is ensured by the real-time updated entity dictionary, and the reliability of the named entity recognition result is improved; the target character sequence is obtained by splicing the to-be-processed text and the dictionary recognition result by using the preset separator, the generation task of the named entity recognition and the actual entity type recognition in the to-be-processed text according to the semantic information of the to-be-processed text is converted into the classification task of selecting the actual entity type from the candidate entity types according to the semantic information of the to-be-processed text, and the difficulty of the named entity recognition of the to-be-processed text is effectively reduced; the named entity recognition result is obtained by classifying the target character sequence by using the pre-trained named entity classification model, and the accuracy of the named entity recognition result is effectively improved.

[0106] The named entity recognition method corresponding to the above embodiment, Figure 3 The structure block diagram of the named entity recognition device provided in the second embodiment of the present application is given, and only the parts related to the embodiments of the present application are shown for the convenience of description.

[0107] Referring to Figure 3 The named entity recognition device comprises:

[0108] The entity matching module 31 is configured to acquire the to-be-processed text, perform matching recognition on the to-be-processed text in the preset entity dictionary, and obtain a dictionary recognition result, wherein the dictionary recognition result comprises N target entities associated with the to-be-processed text and M i entity types corresponding to each target entity, wherein i=1, 2, …, N, and i is an entity number.

[0109] The character splicing module 32 is configured to splice the to-be-processed text and the dictionary recognition result by using a preset separator to obtain a target character sequence.

[0110] The entity recognition module 33 is configured to classify the target character sequence by using a pre-trained named entity classification model to obtain a named entity recognition result.

[0111] Optionally, the entity matching module 31 comprises:

[0112] The entity dictionary determination sub-module is configured to determine that the entity dictionary comprises each preset entity and M i entity types corresponding to each preset entity.

[0113] The text segmentation sub-module is configured to perform segmentation processing on the to-be-processed text to obtain K to-be-recognized terms.

[0114] The entity matching sub-module is configured to perform similarity matching on each to-be-recognized term and each preset entity in the entity dictionary, and determine N target entities and Mi an entity type.

[0115] Optionally, the character concatenation module 32 comprises:

[0116] a preset separator determination sub-module configured to determine that the preset separator comprises a first separator, a second separator and a third separator;

[0117] a first concatenation sub-module configured to concatenate the N target entities and the corresponding M i entity types by using the first separator to obtain a first concatenation result corresponding to each target entity;

[0118] a second concatenation sub-module configured to concatenate the first concatenation results corresponding to the N target entities by using the second separator to obtain a second concatenation result;

[0119] a third concatenation sub-module configured to concatenate the to-be-processed text and the second concatenation result by using the third separator to obtain the target character sequence.

[0120] Optionally, the entity recognition module 33 comprises:

[0121] a model structure determination sub-module configured to determine that the pre-trained named entity classification model comprises a pre-trained encoder and a pre-trained fully connected layer, and the pre-trained fully connected layer comprises a pre-trained linear transformation layer and a normalized exponential function;

[0122] a first feature extraction sub-module configured to input the target character sequence into the pre-trained encoder to perform feature extraction to obtain a target encoding sequence;

[0123] a first vector determination sub-module configured to input the target encoding sequence into the pre-trained fully connected layer, transform the target encoding sequence into a target classification vector according to the pre-trained linear transformation layer, and perform normalization processing on the target classification vector according to the normalized exponential function to obtain a target probability vector;

[0124] a first entity recognition sub-module configured to determine the actual entity type of each target entity according to the target probability vector to obtain a named entity recognition result.

[0125] Optionally, the entity recognition module 33 comprises:

[0126] a sample entity matching sub-module configured to obtain a sample text, perform matching recognition on the sample text in a preset entity dictionary, and obtain a sample dictionary recognition result, wherein the sample dictionary recognition result comprises N sample entities associated with the sample text and M i entity types corresponding to each sample entity;

[0127] The sample character concatenation submodule is configured to concatenate the sample text and the sample dictionary recognition result by using a preset separator to obtain a sample character sequence.

[0128] The second feature encoding submodule is configured to input the sample character sequence into an encoder to perform feature extraction to obtain a sample encoding sequence.

[0129] The second vector determination submodule is configured to input the sample encoding sequence into a full connection layer, transform the sample encoding sequence into a sample classification vector according to a linear transformation layer, and normalize the sample classification vector according to a normalized exponential function to obtain a sample probability vector.

[0130] The second entity recognition submodule is configured to determine a sample actual entity type of each sample entity according to the sample probability vector to obtain a sample named entity recognition result.

[0131] The parameter correction submodule is configured to obtain an actual named entity recognition result of the sample text, train the encoder and the full connection layer according to the sample named entity recognition result and the actual named entity recognition result, and obtain a pre-trained encoder and a pre-trained full connection layer.

[0132] Optionally, the parameter correction submodule includes:

[0133] The first cross-entropy loss calculation unit is configured to calculate a cross-entropy loss according to the sample named entity recognition result and the actual named entity recognition result.

[0134] The first parameter correction unit is configured to train parameters of the encoder and parameters of the full connection layer according to a gradient descent method until the cross-entropy loss converges, and obtain the pre-trained encoder and the pre-trained full connection layer.

[0135] Optionally, the entity recognition module 33 includes:

[0136] The sub-vector determination submodule is configured to determine each row vector in the sample classification vector as a sample sub-vector corresponding to each entity type.

[0137] The divergence loss calculation submodule is configured to calculate divergence values between any two sample sub-vectors, and differences between each divergence value and a preset threshold, and determine a sum of all the differences as a divergence loss of the named entity classification model.

[0138] Optionally, the parameter correction submodule includes:

[0139] The second cross-entropy loss calculation unit is configured to calculate a cross-entropy loss according to the sample named entity recognition result and the actual named entity recognition result.

[0140] The model loss calculation unit is used to perform a weighted summation of the cross-entropy loss and the divergence loss to obtain the model loss of the named entity classification model.

[0141] The second parameter correction unit is used to train the parameters of the encoder and the fully connected layer according to the gradient descent method until the model loss converges, thus obtaining the pre-trained encoder and the pre-trained fully connected layer.

[0142] It should be noted that the information interaction and execution process between the above modules are based on the same concept as the method embodiments of the present invention. For details on their specific functions and technical effects, please refer to the method embodiments section, which will not be repeated here.

[0143] Figure 4 This is a schematic diagram of the structure of a computer device provided in Embodiment 3 of the present invention. Figure 4 As shown, the computer device of this embodiment includes: at least one processor ( Figure 4 Only one is shown in the diagram), a memory, and a computer program stored in the memory and executable on at least one processor, wherein the processor executes the computer program to implement the steps in any of the above-described named entity recognition method embodiments.

[0144] This computer device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that... Figure 4 The examples of computer devices are merely examples and do not constitute a limitation on computer devices. Computer devices may include more or fewer components than shown, or combinations of certain components, or different components, such as network interfaces, displays, and input devices.

[0145] The processor referred to can be a CPU, but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.

[0146] The memory includes a readable storage medium, an internal memory, etc., wherein the internal memory can be a memory of the computer device, and the internal memory provides an environment for running of the operating system and the computer-readable instructions in the readable storage medium. The readable storage medium can be a hard disk of the computer device, and in other embodiments, can also be an external storage device of the computer device, for example, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. Further, the memory can include both an internal storage unit of the computer device and an external storage device. The memory is used to store an operating system, an application program, a BootLoader, data, and other programs, such as program codes of computer programs, etc. The memory can also be used to temporarily store data that has been output or will be output.

[0147] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of each functional unit and module is exemplified, and in actual application, the above-mentioned functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of software functional unit. In addition, the specific names of each functional unit and module are only for easy distinction, and do not limit the protection scope of the present application. The specific working process of the unit and module in the above device can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here. If the integrated unit is realized in the form of software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the present application realizes all or part of the processes in the above-mentioned embodiment methods, which can be completed by a computer program to instruct related hardware. The computer program can be stored in a computer readable storage medium, and when the processor executes the computer program, the steps of the above-mentioned method embodiment can be realized. The computer program includes computer program code, which can be in the form of source code, object code, executable file or some intermediate form, etc. The computer readable medium can at least include any entity or device capable of carrying computer program code, recording medium, computer memory, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), electrical carrier signal, telecommunication signal and software distribution medium. For example, U disk, mobile hard disk, magnetic disk or optical disk, etc. In some jurisdictions, according to legislation and patent practice, the computer readable medium cannot be an electrical carrier signal and a telecommunication signal.

[0148] The present application realizes all or part of the processes in the above-mentioned embodiment methods, which can also be completed by a computer program product. When the computer program product runs on the computer device, it makes the computer device execute the steps that can realize the above-mentioned method embodiments.

[0149] In the above embodiments, the description of each embodiment has its own emphasis, and the parts not described or recorded in detail in a certain embodiment can be referred to the related description of other embodiments.

[0150] Those skilled in the art can understand that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized in electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized 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 the present application.

[0151] In the embodiments provided by the present application, it should be understood that the disclosed apparatus / computer device and method can be implemented in other ways. For example, the embodiments of the apparatus / computer device described above are merely schematic, and the division of the modules or units is merely a logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between the units can be indirect couplings or communication connections through some interfaces, devices or units, and can be electrical, mechanical or in other forms.

[0152] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e. can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiments.

[0153] The above embodiments are only used to illustrate the technical solutions of the present application, but not limit it; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. An artificial intelligence-based named entity recognition method, characterized by, The named entity recognition method comprises: The method comprises the following steps: obtaining a to-be-processed text, performing matching recognition on the to-be-processed text in a preset entity dictionary, obtaining a dictionary recognition result, the dictionary recognition result comprising N target entities associated with the to-be-processed text and an entity type corresponding to each target entity, wherein i = 1, 2, …, N, i is an entity number. i = 1, 2, …, N, i is an entity number. The preset separator is used to splice the to-be-processed text and the dictionary recognition result, and a target character sequence is obtained; A pre-trained named entity classification model is used to classify the target character sequence, and a named entity recognition result is obtained; The preset separator is used to splice the to-be-processed text and the dictionary recognition result, and a target character sequence is obtained; The preset separator comprises a first separator, a second separator and a third separator; The first separator is used to splice each target entity and a corresponding entity type to obtain a first splicing result corresponding to each target entity. The first splicing result corresponding to each target entity is obtained. The second separator is used to splice the first spliced result corresponding to the N target entities, and a second spliced result is obtained; The third separator is used to splice the to-be-processed text and the second spliced result, and a target character sequence is obtained; The pre-trained named entity classification model comprises a pre-trained encoder and a pre-trained full connection layer, and the pre-trained full connection layer comprises a pre-trained linear transformation layer and a normalized exponential function; The target character sequence is input into the pre-trained encoder for feature extraction, and a target encoding sequence is obtained; The target encoding sequence is input into the pre-trained full connection layer, the target encoding sequence is transformed into a target classification vector according to the pre-trained linear transformation layer, and the target classification vector is normalized according to the normalized exponential function, and a target probability vector is obtained; The actual entity type of each target entity is determined according to the target probability vector, and a named entity recognition result is obtained. The to-be-processed text is matched and recognized in a preset entity dictionary, and a dictionary recognition result is obtained; 2. The named entity recognition method of claim 1, wherein, The to-be-processed text is segmented, and K to-be-recognized terms are obtained; The entity dictionary includes each preset entity and a corresponding entity type of each preset entity entity type The training process of the encoder and the full connection layer comprises: The similarity matching is performed between each of the to-be-identified word items and each of the preset entities in the entity dictionary, N target entities and entity types corresponding to each of the target entities are determined according to a similarity matching result, and K is a positive integer greater than N. The similarity matching is performed between each of the to-be-identified word items and each of the preset entities in the entity dictionary, N target entities and entity types corresponding to each of the target entities are determined according to a similarity matching result, and K is a positive integer greater than N. 3.The named entity recognition method of claim 1, wherein, The preset separator is used to splice the sample text and the sample dictionary recognition result, and a sample character sequence is obtained; Obtain sample text, and match and recognize the sample text in a preset entity dictionary to obtain sample dictionary recognition results. The sample dictionary recognition results include N sample entities associated with the sample text, and the corresponding entities of each sample entity. One entity type; The sample character sequence is input into the encoder for feature extraction, and a sample encoding sequence is obtained; The sample encoding sequence is input into the full connection layer, the sample encoding sequence is transformed into a sample classification vector according to the linear transformation layer, and the sample classification vector is normalized according to the normalized exponential function, and a sample probability vector is obtained; The sample actual entity type of each sample entity is determined according to the sample probability vector, and a sample named entity recognition result is obtained; The actual named entity recognition result of the sample text is obtained, the encoder and the full connection layer are trained according to the sample named entity recognition result and the actual named entity recognition result, and a pre-trained encoder and a pre-trained full connection layer are obtained. The encoder and the full connection layer are trained according to the sample named entity recognition result and the actual named entity recognition result, and a pre-trained encoder and a pre-trained full connection layer are obtained.

4. The named entity recognition method of claim 3, wherein, ​ According to the sample named entity recognition result and the actual named entity recognition result, a cross-entropy loss is calculated; According to the gradient descent method, the parameters of the encoder and the parameters of the full connection layer are trained until the cross-entropy loss converges, to obtain a pre-trained encoder and a pre-trained full connection layer.

5. The named entity recognition method of claim 3, wherein, After the sample named entity recognition result is obtained, the method further includes: Each row vector in the sample classification vector is determined as a sample sub-vector corresponding to each entity type; A divergence value between any two sample sub-vectors is calculated, and a difference between each divergence value and a preset threshold is determined, and a sum of all the differences is determined as a divergence loss of the named entity classification model; Accordingly, the training of the encoder and the full connection layer according to the sample named entity recognition result and the actual named entity recognition result to obtain a pre-trained encoder and a pre-trained full connection layer includes: According to the sample named entity recognition result and the actual named entity recognition result, a cross-entropy loss is calculated; The cross-entropy loss and the divergence loss are weighted and summed to obtain a model loss of the named entity classification model; According to the gradient descent method, the parameters of the encoder and the parameters of the full connection layer are trained until the model loss converges, to obtain a pre-trained encoder and a pre-trained full connection layer.

6. An artificial intelligence-based named entity recognition apparatus, characterized by, The named entity recognition device includes: The entity matching module is used to acquire the text to be processed, match and identify the text in a preset entity dictionary, and obtain a dictionary recognition result. The dictionary recognition result includes N target entities associated with the text to be processed, and the corresponding entities of each target entity. There are 1 entity type, where i = 1, 2, ..., N, and i is the entity number; A character concatenation module configured to concatenate the to-be-processed text and the dictionary recognition result by using a preset delimiter to obtain a target character sequence; An entity recognition module configured to classify the target character sequence by using a pre-trained named entity classification model to obtain a named entity recognition result; The character concatenation module includes: A preset delimiter determination sub-module configured to determine that the preset delimiter includes a first delimiter, a second delimiter, and a third delimiter; The first splicing submodule is configured to adopt the first separator to splice each target entity and a corresponding entity type to obtain a first splicing result corresponding to each target entity. The first splicing submodule is configured to adopt the first separator to splice each target entity and a corresponding entity type to obtain a first splicing result corresponding to each target entity. A second concatenation sub-module configured to concatenate the first concatenation results corresponding to the N target entities by using the second delimiter to obtain a second concatenation result; A third concatenation sub-module configured to concatenate the to-be-processed text and the second concatenation result by using the third delimiter to obtain a target character sequence; The entity recognition module includes: A model structure determination sub-module configured to determine that the pre-trained named entity classification model includes a pre-trained encoder and a pre-trained full connection layer, and the pre-trained full connection layer includes a pre-trained linear transformation layer and a normalization exponential function; A first feature extraction sub-module configured to input the target character sequence into the pre-trained encoder to perform feature extraction, to obtain a target encoding sequence; A first vector determination sub-module configured to input the target encoding sequence into the pre-trained full connection layer, to transform the target encoding sequence into a target classification vector according to the pre-trained linear transformation layer, and to perform normalization processing on the target classification vector according to the normalization exponential function, to obtain a target probability vector; The first entity recognition submodule is configured to determine actual entity types of each of the target entities according to the target probability vector, and obtain a named entity recognition result.

7. A computer device, characterized by The computer device comprises a processor, a memory, and a computer program stored in the memory and executable on the processor, and the processor implements the named entity recognition method according to any one of claims 1 to 5 when executing the computer program.

8. A computer-readable storage medium storing a computer program, the computer-readable storage medium comprising: The computer program is executable on the processor to implement the named entity recognition method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Named entity identification method and device, computer equipment and storage medium

    CN111353311A

  • Named entity recognition method, device and equipment and computer readable storage medium

    CN113011186A