Discontinuous entity recognition method, system, terminal and storage medium

By generating character pair representation matrices and word pair relationships, and using the transformer model for parameter updates, the problem of low accuracy in Chinese text by existing discontinuous entity recognition methods is solved, achieving more efficient entity recognition.

CN117252200BActive Publication Date: 2026-02-17BEIJING UNISOUND INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311421009.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-30
Publication Date
2026-02-17
Estimated Expiration
2043-10-30

AI Technical Summary

Technical Problem

Existing methods for identifying discontinuous entities have low accuracy in Chinese text and cannot effectively take into account the contextual semantics.

Method used

By obtaining the character representation matrix of the sample text, generating the character pair representation matrix, determining the probability matrix, and combining entities according to the word pair relationship, the parameters are updated using the transformer model until the model converges, thus achieving discontinuous entity recognition.

Benefits of technology

It improves the accuracy of discontinuous entity recognition, effectively captures entity boundaries and contextual semantics, and enhances the training effect of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117252200B_ABST
    Figure CN117252200B_ABST
Patent Text Reader

Abstract

The application provides a discontinuous entity recognition method, system, terminal and storage medium, the method comprises the following steps: obtaining all sample word feature matrices of sample texts according to an entity recognition model; combining sample words to obtain sample word pairs, and generating word pair feature matrices according to all word feature matrices; determining a probability matrix according to the word pair feature matrices, and determining word pair relationships according to the probability matrix; combining entities according to the word pair relationships to obtain target discontinuous entities, and determining a model loss according to the target discontinuous entities and standard discontinuous entities; updating parameters of the entity recognition model according to the model loss, inputting to-be-recognized texts into the converged entity recognition model for discontinuous entity recognition, and obtaining discontinuous entity recognition results. The application can effectively capture entity boundaries and context semantics of sample texts, effectively improve the training effect of the entity recognition model based on the captured entity boundaries and context semantics, and improve the accuracy of the entity recognition model.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of natural language processing, and particularly relates to a discontinuous entity recognition method and system, a terminal and a storage medium. BACKGROUND

[0002] In the process of data analysis, first, structured information needs to be extracted from unstructured text, and then data analysis is performed on the extracted structured information. Since entity information extracted in the data analysis process needs to be used, the recognition of entities occupies an important position in the process of extracting structured information.

[0003] Discontinuous entities refer to entities that are divided into several segments and are isolated from each other. As the most difficult one among the three entity recognition tasks (normal, nested, and discontinuous), discontinuous entities are increasingly valued by people.

[0004] The existing discontinuous entity recognition method generally adopts an extraction method (such as w2ner) and a word generation method (such as bartner) of word classification. The former takes a word as the smallest unit to form a complete entity by judging the relationship between words, and does not consider the information of Chinese words, resulting in poor effect on Chinese. The latter learns the semantic and structural information of the previous content to generate the next word, and then takes the previous word and the generated word as input to generate the next word, and so on until a complete discontinuous entity is generated. This method only focuses on the previous word, which leads to the inability to consider the context semantics, and the discontinuous entity recognition accuracy is low. SUMMARY

[0005] The purpose of the embodiment of the present application is to provide a discontinuous entity recognition method, system, terminal and storage medium, which aims to solve the problem of low accuracy of the existing discontinuous entity recognition.

[0006] The embodiment of the present application is implemented in this way. A discontinuous entity recognition method, the method comprising:

[0007] inputting a sample text into an entity recognition model, and obtaining a word representation matrix of all sample words in the sample text according to the entity recognition model;

[0008] combining sample words to obtain sample word pairs, and generating a word pair representation matrix of all sample word pairs according to the word representation matrix;

[0009] determining a probability matrix according to the word pair representation matrix, and determining a word pair relationship according to the probability matrix;

[0010] performing entity combination according to the word pair relationship to obtain a target discontinuous entity, and determining a model loss according to the target discontinuous entity and a standard discontinuous entity corresponding to the sample text.

[0011] The entity recognition model is updated with parameters based on the model loss until the entity recognition model converges.

[0012] The entity recognition model after convergence is input with the text to be recognized, and discontinuous entity recognition is performed to obtain discontinuous entity recognition results.

[0013] Preferably, the character pair representation matrix for generating sample character pairs based on the character representation matrix includes:

[0014] For each sample word pair, the representation vectors of the words contained in the word representation matrix are found by index and concatenated to obtain the concatenated vector;

[0015] Conditional layer normalization is performed on the concatenated vectors to obtain character pair representation vectors, and the character pair representation vectors are combined to obtain the character pair representation matrix.

[0016] Preferably, entity combination based on the word pair relationship includes:

[0017] Based on the head-to-tail relationship of Chinese words in the word pair relationship, the sample entities in the sample text are determined, and based on the head-to-head relationship of adjacent word pairs in the word pair relationship, the first adjacency relationship between each sample entity is determined.

[0018] Based on the tail-to-tail relationship of adjacent word pairs in the word pair relationship, the second adjacency relationship between each sample entity is determined, and based on the head-to-tail relationship of complete discontinuous entities in the word pair relationship, the complete relationship of each sample entity is determined.

[0019] The sample entities are sorted and combined according to the first adjacency relationship and the second adjacency relationship to obtain an entity combination, and the entity combination is judged as complete according to the complete relationship.

[0020] If the completeness of the entity combination is deemed satisfactory, then the entity combination is identified as the target discontinuous entity.

[0021] Preferably, determining the probability matrix based on the word pair representation matrix includes:

[0022] A linear transformation is performed on the character pair representation matrix to obtain a transformation matrix, and the transformation matrix is ​​then mapped to obtain the probability matrix.

[0023] Preferably, determining word pair relationships based on the probability matrix includes:

[0024] The probability matrix is ​​normalized, and the word pair relationship is determined based on the relationship between the probability values ​​in the normalized probability matrix and the sample word pairs.

[0025] Preferably, obtaining the character representation matrix of the sample characters in the sample text according to the entity recognition model includes:

[0026] The sample text is segmented according to the entity recognition model to obtain the index vector of all sample characters;

[0027] The character index vector is encoded according to the encoding layer in the entity recognition model to obtain the character representation matrix.

[0028] Another objective of this invention is to provide a discontinuous entity recognition system, the system comprising:

[0029] The representation acquisition module is used to input sample text into the entity recognition model and obtain the character representation matrix of all sample characters in the sample text according to the entity recognition model.

[0030] The representation generation module is used to combine sample characters to obtain sample character pairs, and generate a character pair representation matrix for all sample character pairs based on the character representation matrix;

[0031] The relation determination module is used to determine a probability matrix based on the word pair representation matrix, and to determine the word pair relation based on the probability matrix;

[0032] The loss determination module is used to combine entities according to the word pair relationship to obtain the target discontinuous entity, and to determine the model loss according to the target discontinuous entity and the standard discontinuous entity corresponding to the sample text.

[0033] The model training module is used to update the parameters of the entity recognition model based on the model loss until the entity recognition model converges.

[0034] The entity recognition module is used to perform discontinuous entity recognition on the entity recognition model after the text to be recognized has converged, and to obtain discontinuous entity recognition results.

[0035] Preferably, the characterization generation module is further configured to:

[0036] For each sample word pair, the representation vectors of the words contained in the word representation matrix are found by index and concatenated to obtain the concatenated vector;

[0037] Conditional layer normalization is performed on the concatenated vectors to obtain character pair representation vectors, and the character pair representation vectors are combined to obtain the character pair representation matrix.

[0038] Another objective of this invention is to provide a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method described above.

[0039] Another objective of this invention is to provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method.

[0040] In this embodiment of the invention, by obtaining the character representation matrix of sample characters, the character pair representation matrix of sample character pairs can be effectively generated. Based on the character pair representation matrix, the probability matrix can be effectively determined. Based on the probability matrix, the word pair relationship can be effectively determined. Based on the word pair relationship, the target discontinuous entity can be effectively combined. In this embodiment of the invention, entity boundaries and contextual semantics can be effectively captured. Based on the captured entity boundaries and contextual semantics, the training effect of the entity recognition model is effectively improved, thereby improving the accuracy of the entity recognition model. Attached Figure Description

[0041] Figure 1 This is a flowchart of the discontinuous entity recognition method provided in the first embodiment of the present invention;

[0042] Figure 2 This is a schematic diagram of the probability matrix provided in the first embodiment of the present invention;

[0043] Figure 3 This is a flowchart of the discontinuous entity recognition method provided in the second embodiment of the present invention;

[0044] Figure 4 This is a schematic diagram of the discontinuous entity combination provided in the second embodiment of the present invention;

[0045] Figure 5 This is a schematic diagram of the discontinuous entity recognition system provided in the third embodiment of the present invention;

[0046] Figure 6 This is a block diagram illustrating a specific implementation of the discontinuous entity recognition system provided in the third embodiment of the present invention;

[0047] Figure 7 This is a schematic diagram of the structure of the terminal device provided in the fourth embodiment of the present invention. Detailed Implementation

[0048] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0049] To illustrate the technical solution described in this invention, specific embodiments are described below.

[0050] Example One

[0051] Please seeFigure 1 This is a flowchart of a discontinuous entity recognition method provided in the first embodiment of the present invention. This discontinuous entity recognition method can be applied to any terminal device or system, and includes the following steps:

[0052] Step S10: Input the sample text into the entity recognition model, and obtain the character representation matrix of all sample characters in the sample text according to the entity recognition model;

[0053] Among them, the character representation matrix R1 for the sample character in the sample text is obtained by using the pre-trained semantic model in the entity recognition model;

[0054] Optionally, the character representation matrix of all sample characters in the sample text is obtained according to the entity recognition model, including:

[0055] The sample text is segmented according to the entity recognition model to obtain a character index vector composed of all sample characters;

[0056] The sample text is used as input, and the tokenizer class of the transformers library is used to process the sample text into characters (tokens). One Chinese character is one token, resulting in an sl-dimensional vector, where sl is the number of characters in the sample text.

[0057] The character index vector is encoded according to the encoding layer in the entity recognition model to obtain the character representation matrix;

[0058] The sl-dimensional vector is obtained by passing through the encoder layer of a pre-trained semantic model (such as BERT) to obtain the character representation matrix R1 of all sample characters. This matrix is ​​in units of characters and has dimensions (sl, hs), where hs is the dimension of the text representation.

[0059] Step S20: Combine the sample characters to obtain sample character pairs, and generate the character pair representation matrix of the sample character pairs based on the character representation matrix of each character.

[0060] Specifically, the word pair representation matrix R2 of all word pairs in the sample text is obtained through conditional layer normalization (CLN). Each pair of sample words forms a sample word pair, resulting in ls*(ls+1) / 2 sets of sample word pairs.

[0061] Optionally, a character pair representation matrix for the sample character pairs is generated based on each character representation matrix, including:

[0062] For each sample word pair, the word representation matrix of the sample word is concatenated to obtain a concatenated vector;

[0063] Conditional layer normalization is performed on the concatenated vectors to obtain character pair representation vectors, and the character pair representation vectors are combined to obtain the character pair representation matrix.

[0064] Specifically, for each pair of sample characters, the representation matrices of the two sample characters contained in R1 are extracted and concatenated to obtain a concatenated vector. Then, the character pair representation vector of the concatenated vector is obtained through CLN transformation. The character pair representation vectors of all sample characters are combined to obtain a character pair representation matrix R2 of (sl*(sl+1) / 2, hs).

[0065] Step S30: Determine the probability matrix based on the word pair representation matrix, and determine the word pair relationship based on the probability matrix;

[0066] In this process, the word pair representation matrix R2 is linearly transformed and probabilized to obtain the probability matrix P of the final output of the model. The probability matrix P is then post-processed to obtain the word pair relationship.

[0067] Optionally, determining the probability matrix based on the word pair representation matrix includes:

[0068] A linear transformation is performed on the character pair representation matrix to obtain a transformation matrix, and the transformation matrix is ​​then mapped to obtain the probability matrix.

[0069] The word pair representation matrix R2 is transformed by a multilayer perceptron (MLP) to obtain a transformation matrix with dimensions (ls*(ls+1) / 2, 4n), where n is the number of entity categories and the transformation matrix ranges from -∞ to +∞. The transformation matrix is ​​then subjected to a sigmoid transformation to obtain a probability matrix P with values ​​ranging from 0 to 1, and the dimension remains (ls*(ls+1) / 2, 4n).

[0070] Further, determining word pair relationships based on the probability matrix includes:

[0071] The probability matrix is ​​normalized, and the word pair relationship is determined based on the relationship between the probability values ​​in the normalized probability matrix and the sample word pairs.

[0072] The probability matrix P is normalized (0-1 normalization). Normalization sets the probability values ​​in the probability matrix P that are greater than 0.5 to 1 and the probability values ​​that are less than 0 to 0. The system queries the word pairs corresponding to the probability values ​​in the probability matrix P that are equal to 1, and performs word formation and word pair relationship judgment on the queried word pairs.

[0073] The identification of each complete entity depends on four different word pair relations, which include:

[0074] ①PhraseHead2PhraseTail (PH2PT): Phrase Head to Phrase Tail (Chinese words paired together)

[0075] ②NeighborHead2NeighborHead(NH2NH): Head-to-head pairs of adjacent words

[0076] ③NeighborTail2NeighborTail(NT2NT): End-to-end pair of adjacent words

[0077] ④RelationHead2RelationTail(RH2RT): Head-to-tail of a complete discontinuous entity;

[0078] Taking the clinical surgical procedure “endoscopic esophageal dilation + stent adjustment” (the correct surgical entities are “endoscopic esophageal dilation” and “endoscopic esophageal stent adjustment”) as an example, from the perspective of Chinese lexical analysis, it can be divided into four words: “endoscopic esophagus”, “dilation”, “stent adjustment”, and “procedure” (for ease of analysis, “endoscopic esophagus” will not be further divided into “endoscopic” and “esophagus”).

[0079] Please see Figure 2 Taking the recognition of the sample text "endoscopic esophageal stent adjustment" as an example, the correct word combination is: "endoscopic esophagus" + "stent adjustment" + "operation". For relation ①, the probability value of the word pair (internal, tube), (stent, whole), (operation, operation) should be 1. For relation ②, the probability value of the word pair (internal, stent) and (stent, operation) should be 1. For relation ③, the probability value of the word pair (tube, whole) and (whole, operation) should be 1.

[0080] For relation ④, the probability value of the word pair (inner, technique) should be 1. In actual reasoning, the word pairs that satisfy relations ①②③④ can be deduced by the index of the element with probability 1 in P.

[0081] Step S40: Combine entities according to the word pair relationship to obtain the target discontinuous entity, and determine the model loss according to the target discontinuous entity and the standard discontinuous entity corresponding to the sample text;

[0082] In this process, adjacent words and their connection order are obtained based on word pair relationships. The adjacent words are then combined in order to obtain the complete target discontinuous entity.

[0083] Step S50: Update the parameters of the entity recognition model according to the model loss until the entity recognition model converges;

[0084] The convergence condition of the entity recognition model can be set according to requirements. For example, the convergence condition can be set to 50 iterations, or the entity recognition model can be determined to have converged when the determined model loss is less than the loss threshold.

[0085] Step S60: Input the text to be recognized into the converged entity recognition model and perform discontinuous entity recognition to obtain discontinuous entity recognition results;

[0086] In this embodiment, the non-continuous entity recognition method based on the encoder of transformer is improved for Chinese. It can take into account the context in both directions in terms of attention, and under the same conditions, it performs better than the one-way generation method.

[0087] In this embodiment, by obtaining the character representation matrix of the sample characters, the character pair representation matrix of the sample character pairs can be effectively generated. Based on the character pair representation matrix, the probability matrix can be effectively determined. Based on the probability matrix, the word pair relationship can be effectively determined. Based on the word pair relationship, the target discontinuous entity can be effectively combined. In this embodiment of the invention, word pair classification based on the character pair representation matrix can effectively capture entity boundaries and contextual semantics. Based on the captured entity boundaries and contextual semantics, the training effect of the entity recognition model is effectively improved, thereby improving the accuracy of the entity recognition model.

[0088] Example Two

[0089] Please see Figure 3 This is a flowchart of a discontinuous entity recognition method provided in the second embodiment of the present invention. This embodiment further refines step S40 in the first embodiment, including the following steps:

[0090] Step S41: Based on the head-to-tail relationship of Chinese words in the word pair relationship, determine the sample entities in the sample text, and based on the head-to-head relationship of adjacent word pairs in the word pair relationship, determine the first adjacency relationship between each sample entity.

[0091] Please refer to Figure 4 Taking the combination of "endoscopic esophageal stent adjustment" as an example, the sample entities in the sample text can be obtained by outputting the head-to-tail relationship of Chinese words in the word pair relationship: "endoscopic esophagus", "stent adjustment", and "operation". By outputting the head-to-head relationship of adjacent word pairs in the word pair relationship, it can be seen that "endoscopic esophagus" and "stent adjustment" are adjacent to each other (first adjacent relationship).

[0092] Step S42: Determine the second adjacency relationship between each sample entity based on the tail-to-tail relationship of adjacent word pairs in the word pair relationship, and determine the complete relationship of each sample entity based on the head-to-tail relationship of complete discontinuous entities in the word pair relationship.

[0093] Among them, by outputting the end-to-end relationship of adjacent word pairs in the word pair relationship, it can be seen that "scaffold adjustment" and "technique" are adjacent (second adjacency relationship). According to the head-to-tail relationship of complete discontinuous entities in the word pair relationship, it can be obtained that "inner" to "technique" is the head-to-tail of a complete entity.

[0094] Step S43: Sort and combine each sample entity according to the first adjacency relationship and the second adjacency relationship to obtain an entity combination, and make a complete judgment on the entity combination according to the complete relationship;

[0095] Specifically, the sample entities are sorted and combined according to the first and second adjacency relationships to obtain "endoscopic esophageal stent adjustment", and a complete judgment is made on "endoscopic esophageal stent adjustment" based on the complete relationship.

[0096] Step S44: If the completeness of the entity combination is qualified, then the entity combination is determined as the target discontinuous entity.

[0097] In this embodiment, the concept of a word is introduced by judging the prefix-suffix pairs. Relationships are judged on a word-by-word basis, and then complete discontinuous entities are formed by combining word pairs. This is more in line with Chinese grammar rules, which is conducive to the correctness of semantic representation and improves the recognition of discontinuous entities. In addition, since ordinary entities and nested entities have prefix-suffix pairs but no word pair relationships, they can be regarded as special cases of discontinuous entities and can also be recognized by this embodiment, thus achieving a unified entity recognition framework.

[0098] Example Three

[0099] Please see Figure 5 This is a structural schematic diagram of the discontinuous entity recognition system 100 provided in the third embodiment of the present invention, including:

[0100] The representation acquisition module 10 is used to input sample text into the entity recognition model and obtain the character representation matrix of sample characters in the sample text according to the entity recognition model.

[0101] Optionally, the representation acquisition module 10 is further configured to: perform character segmentation on the sample text according to the entity recognition model to obtain the character index vector of the sample character;

[0102] The character index vector is encoded according to the encoding layer in the entity recognition model to obtain the character representation matrix.

[0103] The representation generation module 11 is used to combine sample characters to obtain sample character pairs, and generate character pair representation matrices of sample character pairs based on the character representation matrices of each character.

[0104] Optionally, the representation generation module 11 is also used to: for each sample word pair, find the representation vector of the word contained in the word representation matrix by index and concatenate them to obtain a concatenated vector;

[0105] Conditional layer normalization is performed on the concatenated vectors to obtain character pair representation vectors, and the character pair representation vectors are combined to obtain the character pair representation matrix.

[0106] The relation determination module 12 is used to determine the probability matrix based on the word pair representation matrix, and to determine the word pair relation based on the probability matrix.

[0107] Optionally, the relation determination module 12 is further configured to: perform a linear transformation on the word pair representation matrix to obtain a transformation matrix, and map the transformation matrix to obtain the probability matrix.

[0108] Furthermore, the relationship determination module 12 is also used to: normalize the probability matrix and determine the word pair relationship based on the relationship between the probability values ​​in the normalized probability matrix and the sample word pairs.

[0109] The loss determination module 13 is used to combine entities according to the word pair relationship to obtain the target discontinuous entity, and to determine the model loss according to the target discontinuous entity and the standard discontinuous entity corresponding to the sample text.

[0110] Optionally, the loss determination module 13 is further configured to: determine the sample entities in the sample text based on the head-to-tail relationship of Chinese words in the word pair relationship, and determine the first adjacency relationship between each sample entity based on the head-to-head relationship of adjacent word pairs in the word pair relationship;

[0111] Based on the tail-to-tail relationship of adjacent word pairs in the word pair relationship, the second adjacency relationship between each sample entity is determined, and based on the head-to-tail relationship of complete discontinuous entities in the word pair relationship, the complete relationship of each sample entity is determined.

[0112] The sample entities are sorted and combined according to the first adjacency relationship and the second adjacency relationship to obtain an entity combination, and the entity combination is judged as complete according to the complete relationship.

[0113] If the completeness of the entity combination is deemed satisfactory, then the entity combination is identified as the target discontinuous entity.

[0114] The model training module 14 is used to update the parameters of the entity recognition model based on the model loss until the entity recognition model converges.

[0115] The entity recognition module 15 is used to perform discontinuous entity recognition on the entity recognition model after the text to be recognized is input and obtain discontinuous entity recognition results.

[0116] Please see Figure 6 The specific implementation steps of the discontinuous entity recognition system 100 include:

[0117] In the first stage, a representation matrix in units of characters (tokens) is obtained. Taking the sample text as input, the tokenizer class of the transformers library is used to process the sample text into characters (tokens). One Chinese character is one token, resulting in an sl-dimensional vector, where sl is the number of characters in the sample text. The sl-dimensional vector is passed through the encoder layer of a pre-trained semantic model (such as BERT). This encoder layer can use a Long Short-Term Memory (LSTM) network to obtain the character representation matrix R1 and the text representation of the sample characters. This matrix is ​​in units of characters and has a dimension of (sl, hs), where hs is the dimension of the text representation.

[0118] In the second stage, the representation matrix of all token pairs in the sample text is obtained. For each pair of sample tokens, the representation matrix of the sample characters contained in R1 is extracted and concatenated to obtain the concatenated vector. Then, the token pair representation vector of the concatenated vector is obtained through CLN transformation. The token pair representation vectors of all sample token pairs are combined to obtain a token pair representation matrix R2 of (sl*(sl+1) / 2, hs).

[0119] In the third stage, all word pairs are classified to obtain word formation and word pair relationships. Then, the target discontinuous entity is obtained through post-processing. Specifically, the word pair representation matrix R2 is transformed by a multilayer perceptron (MLP) to obtain a transformation matrix (logits) with dimensions (ls*(ls+1) / 2, 4n), where n is the number of entity categories and the transformation matrix ranges from -∞ to +∞. The transformation matrix is ​​then subjected to a sigmoid transformation to obtain a probability matrix P with values ​​ranging from 0 to 1. The probability matrix is ​​then normalized, and word pair relationships are determined based on the probability values ​​in the normalized probability matrix and the sample word pairs. Adjacent words and their connection order are obtained based on the word pair relationships, and adjacent words are combined in order to obtain the complete target discontinuous entity.

[0120] In the fourth stage, the parameters of the entity recognition model are updated until the entity recognition model converges.

[0121] In this embodiment, by obtaining the character representation matrix of the sample characters, the character pair representation matrix of the sample character pairs can be effectively generated. Based on the character pair representation matrix, the probability matrix can be effectively determined. Based on the probability matrix, the word pair relationship can be effectively determined. Based on the word pair relationship, the target discontinuous entity can be effectively combined. In this embodiment, the entity boundary and contextual semantics can be effectively captured. Based on the captured entity boundary and contextual semantics, the training effect of the entity recognition model is effectively improved, thereby improving the accuracy of the entity recognition model.

[0122] Example Four

[0123] Figure 7 This is a structural block diagram of a terminal device 2 provided in the fourth embodiment of this application. For example... Figure 7 As shown, the terminal device 2 in this embodiment includes a processor 20, a memory 21, and a computer program 22 stored in the memory 21 and executable on the processor 20, such as a program for a discontinuous entity recognition method. When the processor 20 executes the computer program 22, it implements the steps in the various embodiments of the discontinuous entity recognition methods described above.

[0124] For example, the computer program 22 may be divided into one or more modules, which are stored in the memory 21 and executed by the processor 20 to complete this application. The one or more modules may be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program 22 in the terminal device 2. The terminal device may include, but is not limited to, the processor 20 and the memory 21.

[0125] The processor 20 may be a Central Processing Unit (CPU), or 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 may be a microprocessor or any conventional processor.

[0126] The memory 21 can be an internal storage unit of the terminal device 2, such as a hard drive or memory of the terminal device 2. The memory 21 can also be an external storage device of the terminal device 2, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the terminal device 2. Furthermore, the memory 21 can include both internal and external storage units of the terminal device 2. The memory 21 is used to store the computer program and other programs and data required by the terminal device. The memory 21 can also be used to temporarily store data that has been output or will be output.

[0127] Furthermore, the functional modules 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. The integrated unit can be implemented in hardware or as a software functional unit.

[0128] If an integrated module is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. This computer-readable storage medium can be non-volatile or volatile. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable storage medium can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the contents of a computer-readable storage medium may be appropriately added to or subtracted from the contents as required by the legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, a computer-readable storage medium may not include electrical carrier signals and telecommunication signals.

[0129] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A method of discontinuous entity recognition, characterized by, The method comprises: inputting a sample text into an entity recognition model, and obtaining a word representation matrix of all sample words in the sample text according to the entity recognition model; combining sample words to obtain sample word pairs, and generating a word pair representation matrix of the sample word pairs according to the word representation matrix; determining a probability matrix according to the word pair representation matrix, and determining a word pair relationship according to the probability matrix; performing entity combination according to the word pair relationship to obtain a target discontinuous entity, and determining a model loss according to the target discontinuous entity and a standard discontinuous entity corresponding to the sample text; updating parameters of the entity recognition model according to the model loss until the entity recognition model converges; inputting a text to be recognized into the converged entity recognition model to perform discontinuous entity recognition, and obtaining a discontinuous entity recognition result; generating a word pair representation matrix of sample word pairs according to a word representation matrix, comprising: for each sample word pair, finding the representation vectors of the words contained therein by indexing from the word representation matrix to splice the representation vectors and obtain a spliced vector; performing conditional layer normalization on the spliced vector to obtain a word pair representation vector, and performing vector combination on each word pair representation vector to obtain the word pair representation matrix; performing entity combination according to the word pair relationship, comprising: determining sample entities in the sample text according to the head-to-tail relationship of Chinese words in the word pair relationship, determining first adjacency relationships between the sample entities according to the head-to-head relationship of adjacent word pairs in the word pair relationship, determining second adjacency relationships between the sample entities according to the tail-to-tail relationship of adjacent word pairs in the word pair relationship, and determining complete relationships of the sample entities according to the head-to-tail relationship of complete discontinuous entities in the word pair relationship; performing sorting combination on each sample entity according to the first adjacency relationship and the second adjacency relationship to obtain an entity combination, and performing complete judgment on the entity combination according to the complete relationship; if the complete judgment of the entity combination is qualified, the entity combination is determined as the target discontinuous entity.

2. The discontinuous entity recognition method of claim 1, wherein, Determining a probability matrix according to the word pair representation matrix comprises: performing linear transformation on the word pair representation matrix to obtain a transformation matrix, and performing mapping on the transformation matrix to obtain the probability matrix.

3. The discontinuous entity recognition method of claim 1, wherein, Determining a word pair relationship according to the probability matrix comprises: performing normalization processing on the probability matrix, and determining the word pair relationship according to the relationship between the probability values in the normalized probability matrix and the sample word pairs.

4. The discontinuous entity recognition method of any one of claims 1 to 3, wherein, Obtaining a word representation matrix of sample words in the sample text according to the entity recognition model comprises: performing word segmentation processing on the sample text according to the entity recognition model to obtain an index vector of all sample words; performing coding on the word index vector according to the coding layer in the entity recognition model to obtain the word representation matrix.

5. A discontinuous entity recognition system, characterized in that, The system comprises: a representation obtaining module configured to input a sample text into an entity recognition model, and obtain a word representation matrix of all sample words in the sample text according to the entity recognition model; a representation generating module configured to combine sample words to obtain sample word pairs, and generate a word pair representation matrix of the sample word pairs according to the word representation matrix; The relationship determining module is configured to determine a probability matrix according to the word pair representation matrix, and determine a word pair relationship according to the probability matrix. The loss determining module is configured to perform entity combination according to the word pair relationship to obtain a target discontinuous entity, and determine a model loss according to the target discontinuous entity and a standard discontinuous entity corresponding to the sample text. The model training module is configured to perform parameter update on the entity recognition model according to the model loss until the entity recognition model converges. The entity recognition module is configured to input a text to be recognized into the converged entity recognition model to perform discontinuous entity recognition, and obtain a discontinuous entity recognition result. The word pair representation matrix of the sample word pair is generated according to the word representation matrix, including: for each sample word pair, finding the representation vectors of the words contained therein by indexing from the word representation matrix to splice the representation vectors, obtaining a spliced vector; performing conditional layer normalization on the spliced vector to obtain a word pair representation vector, and combining the word pair representation vectors to obtain the word pair representation matrix. The entity combination according to the word pair relationship includes: determining sample entities in the sample text according to the head-to-tail relationship of the Chinese words in the word pair relationship, and determining first adjacent relationships between the sample entities according to the head-to-head relationship of the adjacent word pairs in the word pair relationship; determining second adjacent relationships between the sample entities according to the tail-to-tail relationship of the adjacent word pairs in the word pair relationship, and determining complete relationships of the sample entities according to the head-to-tail relationship of the complete discontinuous entities in the word pair relationship; performing sorting combination on the sample entities according to the first adjacent relationship and the second adjacent relationship to obtain entity combination, and performing complete judgment on the entity combination according to the complete relationship; if the complete judgment of the entity combination is qualified, the entity combination is determined as the target discontinuous entity.

6. The discontinuous entity recognition system of claim 5, wherein, The representation generating module is further configured to: For each sample word pair, find the representation vectors of the words contained therein by indexing from the word representation matrix to splice the representation vectors, obtaining a spliced vector; Perform conditional layer normalization on the spliced vector to obtain a word pair representation vector, and combine the word pair representation vectors to obtain the word pair representation matrix.

7. A terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the steps of the method of any one of claims 1 to 4.

8. A computer-readable storage medium storing a computer program, the computer-readable storage medium comprising: The computer program is executed by the processor to implement the steps of the method of any one of claims 1 to 4.

Citation Information

Patent Citations

  • Named entity recognition system for nested and discontinuous entities of Chinese financial text

    CN115688777A

  • Event element generation method and system, terminal and storage medium

    CN116306586A