An entity extraction method based on MRC framework

By employing an entity extraction method based on the MRC framework and utilizing the BERT model and multi-head attention mechanism, the problems of data dispersion and poor correlation in CNC machine tool equipment maintenance were solved. This resulted in efficient entity extraction and knowledge graph construction, thereby improving the informatization and decision management of equipment maintenance.

CN116362247BActive Publication Date: 2026-03-31ZHEJIANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-23
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Traditional CNC machine tool maintenance relies on experience and knowledge, with data being scattered and lacking correlation, making it difficult to carry out fault detection and maintenance work quickly and effectively, and knowledge graph construction is lacking.

Method used

We adopt an entity extraction method based on the MRC framework, which combines sentence-level features and entity type probabilities with the BERT model and multi-head attention mechanism to achieve efficient extraction of named entities.

Benefits of technology

It improved the correlation of equipment data, built a more effective knowledge network, enhanced the accuracy of entity extraction and the informatization level of equipment maintenance, and optimized decision-making and management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116362247B_ABST
    Figure CN116362247B_ABST
Patent Text Reader

Abstract

The application discloses an entity extraction method based on an MRC framework, which comprises the following steps: firstly, obtaining a target sentence according to a device maintenance manual, generating a corresponding question according to the definition of an entity type, and splicing the target sentence and the question to obtain a corpus; then, performing word segmentation on the corpus by using a word segmentation tool, inputting the corpus into a BERT model after coding to obtain word embedding representation of the target sentence; secondly, obtaining sentence-level features of the target sentence by a sentence classification module; then, combining the sentence-level features and the word embedding representation of the target sentence to integrate into an entity extraction module; finally, combining the sentence classification module and the entity extraction module, training the two modules together, and completing entity extraction according to the two trained modules. The application can use the information at the sentence level in the entity extraction task, which helps to improve the precision of entity extraction and solves the problem of entity extraction in the device maintenance document.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial equipment maintenance, and in particular to an entity extraction method based on the MRC (Machine Reading Comprehension) framework. Background Technology

[0002] CNC machine tools are the material and technological foundation of production activities. Ensuring the healthy and continuous operation of equipment and reducing risks and malfunctions is a prerequisite for the normal operation of every manufacturing enterprise. However, with the development of economic globalization, competition among enterprises is constantly intensifying, and equipment is becoming increasingly mechanized, automated, and intelligent. At the same time, the complexity of equipment system structures is increasing, and the difficulty of fault detection, diagnosis, prediction, and daily comprehensive maintenance is also constantly increasing. A failure in any component of the system will affect the normal operation of the entire equipment system. In the rapid industrial development of the past decade or so, catastrophic events caused by mechanical component failures have occurred frequently both domestically and internationally.

[0003] The development of CNC machine tool equipment maintenance technology and industrial production promotes each other. However, with the development of traditional industrial production, its shortcomings and limitations have emerged: due to the scattered and complex nature of data, the information retrieval effect of traditional equipment management systems is far from ideal; there are actually connections between various data, such as equipment and various fault repair methods, which are closely related, but traditional systems do not link these data, resulting in poor correlation between data; traditional equipment maintenance largely relies on the experience and knowledge of maintenance personnel and maintenance documents, which are very fragmented, making it difficult to carry out maintenance work quickly and effectively when equipment malfunctions.

[0004] Due to these shortcomings, the technical methods for CNC machine tool equipment maintenance need continuous improvement. Furthermore, the knowledge graph for CNC machine tool equipment maintenance suffers from deficiencies, making it difficult to quickly address certain problems. Named entity recognition is a crucial step in the knowledge graph construction process. This invention aims to propose an entity extraction method for the equipment maintenance field, for use in constructing a knowledge graph for CNC machine tool equipment maintenance. Summary of the Invention

[0005] The purpose of this invention is to address the shortcomings of existing technologies by providing an entity extraction method based on the MRC framework.

[0006] The objective of this invention is achieved through the following technical solution: an entity extraction method based on the MRC framework, comprising the following steps:

[0007] (1) Obtain the target sentence according to the equipment maintenance manual, generate the corresponding question according to the definition of entity type, and concatenate the target sentence and the question to obtain the corpus;

[0008] (2) Use a word segmentation tool to segment the corpus obtained in step (1), and encode the segmented corpus. Input the encoded corpus into the BERT model to obtain the word embedding representation of the target sentence.

[0009] (3) Obtain sentence-level features based on the word embedding representation of the target sentence obtained in step (2);

[0010] (4) Combine the sentence-level features obtained in step (3) with weights into the word embedding representation of the target sentence obtained in step (2) to obtain a new target sentence word embedding; predict the words that may be the beginning of the sentence based on the new target sentence word embedding to obtain a word head set; predict the words that may be the end of the sentence based on the new target sentence word embedding to obtain a word tail set; and match the words in the word head set and the word tail set.

[0011] (5) Complete entity extraction based on the matching results in step (4).

[0012] Optionally, in step (2), the word segmentation tool is WordpieceTokenizer; the segmented corpus is encoded using bert-embedding.

[0013] Optionally, in step (3), obtaining sentence-level features based on the word embedding representation of the target sentence obtained in step (2) specifically involves: passing the word embedding representation of the target sentence obtained in step (2) through a multi-head attention mechanism layer, and performing max pooling on the output of the multi-head attention mechanism layer to obtain the target sentence embedding, and predicting the sentence type based on the target sentence embedding.

[0014] Optionally, the target sentence is embedded as a sentence-level feature.

[0015] Optionally, the step of predicting the sentence type based on the target sentence embedding specifically involves: passing the target sentence embedding through a linear mapping layer to obtain an unnormalized log probability; normalizing the log probability using a softmax function to obtain a predicted distribution of the sentence type; and predicting the sentence type based on the predicted distribution.

[0016] The loss function for sentence type prediction is obtained based on the cross-entropy between the predicted distribution and the actual distribution.

[0017] Optionally, in step (4), the method of combining the sentence-level features obtained in step (3) into the word embedding representation of the target sentence obtained in step (2) according to the weights is as follows: First, calculate the correlation matrix between different sentence types and entity types based on the probability of the simultaneous occurrence of sentence type and entity type; then, use the value corresponding to the correlation matrix as the initial weight; finally, add the target sentence embedding to the word embedding representation of each target sentence according to the initial weight.

[0018] Optionally, in step (4), the method for obtaining the word head set is as follows: First, the target sentence word embedding is passed through a linear mapping layer to obtain the unnormalized log probability; then, the unnormalized log probability is normalized by the softmax function to obtain the probability distribution of each word predicted as the beginning of an entity; finally, words with a probability greater than 0.5 as the beginning of an entity are selected as the set of words that may be the beginning, which is the word head set.

[0019] The loss function for predicting the start coordinates is obtained based on the cross-entropy between the predicted probability distribution of the entity's start and the actual distribution.

[0020] Optionally, in step (4), the method for obtaining the word ending set is as follows: First, the target sentence word embedding is passed through a linear mapping layer to obtain the unnormalized log probability; then, the unnormalized log probability is normalized by the softmax function to obtain the probability distribution of each word predicted as the entity ending; finally, words with a probability greater than 0.5 as the entity ending are selected as the set of words that may be the ending, which is the word ending set.

[0021] The loss function for predicting the end coordinates is obtained based on the cross-entropy between the predicted probability distribution of the entity's end and the actual distribution.

[0022] Optionally, in step (4), the method of matching words in the prefix set and the suffix set is as follows: First, the embedding representations of candidate beginning words in the prefix set and candidate ending words in the suffix set are combined; then, the combined word embeddings are passed through a linear mapping layer to obtain unnormalized log probabilities; finally, the unnormalized log probabilities are normalized using a softmax function to obtain the corresponding predicted matching probability distribution.

[0023] The loss function for matching the start and end coordinates is obtained based on the cross-entropy of the predicted matching probability distribution and the actual distribution.

[0024] Optionally, in step (5), the entity extraction based on the matching results in step (4) specifically involves generating a loss function for predicting the starting coordinates based on the matching results in step (4). Loss function for end coordinate prediction Loss function for matching start and end coordinates Simultaneously, the loss function is combined with sentence type prediction. Each loss function is assigned a different weight, and the weights are summed to obtain the final loss function. The system is then trained based on the final loss function to complete entity extraction.

[0025] The beneficial effects of this invention are as follows: This invention introduces knowledge graph technology into the equipment management and maintenance business of manufacturing enterprises, realizes the informatization of equipment management and maintenance, helps production enterprises optimize decision-making and management, and builds a more effective information retrieval method; This invention can better highlight the connections between equipment data and build an effective knowledge network; This invention integrates equipment manufacturing data to form a complete knowledge network; This invention can extract entities with high accuracy during extraction, which helps to improve the accuracy of entity extraction. Attached Figure Description

[0026] Figure 1 This is an overall flowchart of the present invention;

[0027] Figure 2 This is a schematic diagram of the structure of a multi-task entity extraction model based on the MRC framework. Detailed Implementation

[0028] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0029] See Figure 1 The entity extraction method based on the MRC framework of the present invention can improve the performance of the entity extraction model by introducing sentence-level information. The entity extraction method includes the following steps:

[0030] (1) Obtain the target sentence according to the equipment maintenance manual, generate the corresponding question according to the definition of entity type, and concatenate the target sentence and the question to obtain the corpus.

[0031] In this embodiment, the entity extraction problem can be modeled as a type of machine reading comprehension problem, and different entity types can generate corresponding questions.

[0032] It should be noted that industrial equipment includes various types of equipment, such as CNC machine tools, lathes, drilling machines, etc. Correspondingly, different types of industrial equipment will have corresponding equipment maintenance manuals, from which the target sentence can be obtained.

[0033] In this embodiment, the equipment maintenance manual of CNC machine tools is used as an example, such as "500 Practical CNC Machine Tool Fault Diagnosis and Repair Techniques" published by China Knowledge Press. Specific target sentences can be obtained from the cases in this book.

[0034] Specifically, the data is labeled, including entity type labeling and sentence category labeling. For entity types, based on the characteristics of CNC machine tool equipment maintenance, they can be categorized as: systems, components, alarms, etc. e There are several different types. For sentence categories, considering the rigorous format and wide range of professional distinctions in CNC machine tool equipment maintenance documents, the classification includes multiple levels. First, it is assigned according to the format of the case document, such as fault symptoms and analysis and handling processes; then, it is classified according to the fault category to which the case belongs, such as CNC faults, servo feed system faults, servo drive system faults, etc. Then, the entity type and sentence category tags are combined pairwise to obtain the final n. l Corpus tags.

[0035] There are many ways to generate a question; in this embodiment, the definition of an entity type is used as the question. For example, such as... Figure 2 As shown, the entity type is "CNC system," and the corresponding problem is "A numerical control system is short for a digital control system. It is a dedicated computer system that executes some or all numerical control functions based on control programs stored in its computer memory, and is equipped with interface circuits and servo drive devices." The problem sequence is denoted as Q{q1,q2,…,q...}. k}, where k represents the number of words in the question; the target sentence is denoted as W{w1,w2,…,w n}, where n represents the length of the input sequence. Concatenate Q and W to obtain the final corpus, denoted as {[CLS], q1, q2, ..., q k ,{SEP},w1,w2,…,w n The concatenated corpus is then input into the BERT model as a single data point.

[0036] (2) The corpus obtained in step (1) is segmented using a word segmentation tool, and the segmented corpus is encoded. The encoded corpus is then input into the BERT model (Bidirectional Encoder Representation from Transformers) to obtain the word embedding representation of the target sentence.

[0037] It should be understood that the BERT model obtains the word embedding representation of the target sentence by training an unsupervised task. Therefore, inputting the encoded corpus into the BERT model will obtain the word embedding representation of the target sentence.

[0038] In this embodiment, the question and the target sentence, i.e., the corpus, need to be input into the BERT model simultaneously. In addition, since encoding each Chinese character is very costly and ineffective, it is necessary to first use a word segmentation tool to segment the corpus into smaller units, and then encode them before inputting them into the BERT model to obtain the word embedding representation of the target sentence.

[0039] Specifically, the input corpus is segmented using a word segmentation tool such as WordpieceTokenizer. The segmented corpus is then encoded using pre-trained word embeddings (BERT-embedding), and segmentation embeddings (SegmentEmbedding) are added to distinguish between the question and target sentences, along with position embeddings to represent location information. The BERT model is then pre-trained using two unsupervised models: Masked Language Model and NextSentence Prediction. The Masked Language Model's training task is to predict the removed words in a sentence with some words removed, focusing on token-level representations. The NextSentence Prediction's training task is to predict whether a given sentence is the next sentence of the target sentence, focusing on sentence-level representations. Figure 1 As shown, the word embedding representation of the target sentence ultimately output by the BERT model is as follows: Where U=u1,u2,…,u k} is the pre-trained embedding of the problem, H = h1, h2, ..., h n H represents the pre-trained embeddings of the target sentence. Because the BERT model is a bidirectional deep model, the word embeddings in H already contain information about the question and context through training, so H can be used directly to perform subsequent tasks.

[0040] It should be understood that, since Chinese NLP has been developing for some time, there are already many pre-trained embeddings, similar to dictionaries, where one word corresponds to one code.

[0041] (3) Obtain sentence-level features based on the word embedding representation of the target sentence obtained in step (2).

[0042] In this embodiment, as Figure 2 As shown, the sentence-level features obtained from the word embedding representation of the target sentence obtained in step (2) are obtained by passing the word embedding representation of the target sentence obtained in step (2) through a multi-head attention layer and performing max pooling on the output of the multi-head attention layer to obtain the target sentence embedding, and predicting the sentence type based on the target sentence embedding.

[0043] It should be noted that sentence-level features are the target sentence embeddings.

[0044] In this embodiment, the sentence classification module performs a sentence classification task. The word embedding representation of the target sentence obtained in step (2) can be used to obtain sentence-level features. Specifically, the word embedding representation H of the target sentence obtained in the BERT model is first passed through a Multi-head Attention layer, as follows:

[0045]

[0046] head j =attention(Q j ,K j V j )

[0047] Q j ,K i V j =HW j Q HW j K HW i v

[0048] in, These are all weights that need to be trained. Where n h This represents the number of heads.

[0049] Furthermore, the attention function is calculated as follows:

[0050]

[0051] Here, softmax refers to the normalized exponential function. We choose the standard dot product attention mechanism from Transformers.

[0052] In this embodiment, as Figure 2As shown, predicting sentence type based on target sentence embedding involves: passing the target sentence embedding through a linear mapping layer to obtain unnormalized log probabilities; normalizing these log probabilities using a softmax function to obtain the predicted distribution of sentence type; and predicting sentence type based on this predicted distribution.

[0053] Specifically, the output of the multi-head attention layer is defined as H′={h′1,h′2,…h′ n}, Then H′ is obtained through a max pooling layer. Then h * The unnormalized log probabilities are obtained through a linear mapping layer, then input into the softmax function to achieve normalization, resulting in the predictions from the sentence classification module.

[0054] In this embodiment, the cross-entropy between the predicted distribution and the actual distribution is used as the loss function for sentence type prediction. The distribution of true sentence categories in the training data is defined as R. l The loss function The expression is:

[0055]

[0056] In this context, the superscript (i) represents the i-th input sample, the symbol "·" represents the dot product, and M represents the sample size.

[0057] (4) Combine the sentence-level features obtained in step (3) into the word embedding representation of the target sentence obtained in step (2) according to the weights to obtain a new target sentence word embedding; predict the words that may be the beginning based on the new target sentence word embedding to obtain a word head set; predict the words that may be the end based on the new target sentence word embedding to obtain a word tail set; and match the words in the word head set and word tail set.

[0058] In this embodiment, the entity extraction module performs the entity extraction task. The above steps can be executed through the entity extraction module. There is a certain correlation between different entity types and different sentence types. To use sentence categories to help improve the performance of the entity extraction task, this embodiment uses sentence-level features in the entity extraction task. Therefore, H is not directly used to perform the entity extraction task; instead, sentence-level features are added to H, which is referred to here as h. * Represents sentence-level features.

[0059] The method of combining sentence-level features into the word embedding representation of the target sentence according to weights is as follows: First, calculate the correlation matrix between different sentence types and entity types based on the probability of simultaneous occurrence of sentence type and entity type; then, use the value corresponding to the correlation matrix as the initial weight; finally, add the target sentence embedding to the word embedding representation of each target sentence according to the initial weight.

[0060] For example, taking the identification process of the i-th type of entity as an example, the specific combination method is as follows:

[0061] First, based on the probability of different sentence categories and entity categories appearing simultaneously, calculate the matching degree matrix between different sentence categories and entity categories. Where n l This represents the number of sentence categories, n e This represents the number of entity categories. Next, based on the matching degree matrix M, h will be... * This is incorporated into the embedding representation H of the input sentence.

[0062] H″=H+λ{h * ,h * ,…h *}

[0063] λ0=M (i) ·P sen

[0064] Where λ is the parameter to be trained, λ0 is the initial value of λ, and M (i) For the i-th column of the correlation matching model M in step (1), Since the inputs belong to the same sentence and have the same sentence-level features, h will be... * This is combined with each word embedding of H in the same way. The final result is an input sentence embedding representation containing sentence-level information.

[0065] In this embodiment, the method for obtaining the word head set is as follows: First, the word embeddings of the target sentence (i.e., the embeddings of each word in the target sentence) are passed through a linear mapping layer to obtain unnormalized log probabilities; then, the unnormalized log probabilities are normalized using a softmax function to obtain the probability distribution of each word predicted as the beginning of an entity; finally, words with a probability greater than 0.5 as the beginning of an entity are selected as the set of words that may be the beginning, which is the word head set.

[0066] In this embodiment, the method for obtaining the word ending set is as follows: First, the word embeddings of the target sentence (the embeddings of each word in the target sentence) are passed through a linear mapping layer to obtain unnormalized log probabilities; then, the unnormalized log probabilities are normalized using a softmax function to obtain the probability distribution of each word predicted as an entity ending; finally, words with a probability greater than 0.5 as entity endings are selected as the set of words that may be endings, which is the word ending set.

[0067] Specifically, since a sentence can contain multiple named entities, each word can potentially be the beginning or end of a named entity. Therefore, in calculating the named entity prediction process, we predict the probability distribution P of each word being the beginning of a named entity. start And the probability distribution P that serves as the end of the entity. end P start and P end The calculation process is as follows:

[0068]

[0069]

[0070] In the above formula, T start , These are the parameters that need to be learned during the training process. Let P be an example. start For example, to obtain the probability distribution of each word starting with a named entity, each word is assigned a binary array representing the unnormalized logarithmic probability distribution. This is then normalized using the softmax function, and the output represents the probability distribution of each word starting with a named entity, such as... P is a binary array representing the probability distribution of the i-th word as the beginning of an entity. The first element of this array represents the probability of it being the beginning, and the second element represents the probability of it not being the beginning. end The calculation process is the same as above.

[0071] Next, we obtain the coordinate set S of the candidate words that will serve as the starting point. s , and the coordinate set S of the candidate words as endings e Get P start The set of coordinates S of words predicted as having a probability greater than 0.5 as the beginning of a word. s Similarly, P end The set of coordinates of words predicted to end with a probability greater than 0.5 is defined as S. e .

[0072] In this embodiment, the method for matching words in the prefix set and the suffix set is as follows: First, the embedding representations of candidate beginning words in the prefix set and candidate ending words in the suffix set are combined; then, the combined word embeddings are passed through a linear mapping layer to obtain unnormalized log probabilities; finally, the unnormalized log probabilities are normalized using a softmax function to obtain the corresponding predicted matching probability distribution.

[0073] Specifically, considering the potential nesting between named entities, it's not possible to directly match the start and end coordinates using the nearest-neighbor principle. Therefore, it's necessary to create a candidate set S of start entities. s The coordinates and the candidate end set S in the data. e The coordinates in the coordinates are matched. The embeddings of the candidate start word and the candidate end word are concatenated, and the concatenated embedding is used to calculate the probability of a match.

[0074] For the coordinates i of the candidate starting word start ∈S s The coordinates i of the candidate ending words end ∈S e We have the matching probability:

[0075]

[0076] in, These are the weights that need to be learned; sigmoid(·) represents the logistic function; Embedded representation of candidate start words; This represents the embedding of candidate ending words.

[0077] In this embodiment, the loss function for the entity extraction task consists of three parts: the loss function for predicting the entity's starting coordinates. Loss function for predicting the coordinates of the end of an entity And the loss function for matching the start and end coordinates.

[0078] Specifically, the cross-entropy between the initial predicted distribution and the actual distribution is used as the loss function for the initial coordinate prediction. The cross-entropy between the predicted and actual distributions at the end is used as the loss function for predicting the end coordinates. The cross-entropy between the predicted matching probability distribution and the actual distribution is used as the loss function for matching the start and end coordinates. Furthermore, if R represents the distribution of the real data, then correspondingly:

[0079]

[0080]

[0081]

[0082] in, This represents cross-entropy. This represents the matching probability between different starting coordinates and different ending coordinates.

[0083] (5) Complete entity extraction based on the matching results in step (4).

[0084] In this embodiment, the BERT model needs to perform two tasks: sentence classification and entity extraction. These tasks need to be performed in tandem. Accordingly, the sentence classification module and the entity extraction module need to be trained together. Therefore, the loss function of the sentence classification task and the loss function of the entity extraction task need to be combined to obtain the final loss function.

[0085] Specifically, based on the matching results in step (4), a loss function for predicting the start coordinate, a loss function for predicting the end coordinate, and a loss function for matching the start and end coordinates are generated. At the same time, the loss function for predicting the sentence type is combined. The sentence classification module and the entity extraction module are trained together according to the combined loss function. The entity extraction is completed based on the trained sentence classification module and entity extraction module.

[0086] In this embodiment, the method of combining the loss functions of the sentence classification module and the entity extraction module is specifically as follows: the loss function of sentence type prediction is used... As the loss function of the sentence classification module; the loss function for predicting the starting coordinates. Loss function for end coordinate prediction Loss function for matching start and end coordinates As a loss function for the entity extraction module, each loss function is assigned a different weight, and the weights are summed to obtain the final loss function.

[0087] The final expression for the loss function is:

[0088]

[0089] Where α,β,γ,δ∈[0,1] are hyperparameters, representing the weights of different tasks throughout the training process.

[0090] By implementing the above steps, predefined entity types can be extracted from CNC machine tool maintenance documents. Furthermore, due to the collaboration of the sentence classification module, sentence-level features are used to assist entity extraction, effectively improving the effectiveness of the entity extraction method.

[0091] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention 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 the present invention.

Claims

1. A method for entity extraction based on MRC framework, characterized in that, The method comprises the following steps: (1) obtaining a target sentence according to a device maintenance manual, generating a corresponding question according to the definition of an entity type, and splicing the target sentence and the question to obtain corpus; (2) performing word segmentation on the corpus obtained in the step (1) by using a word segmentation tool, encoding the word segmented corpus, and inputting the encoded corpus into a BERT model to obtain word embedding representation of the target sentence; (3) obtaining sentence level features according to the word embedding representation of the target sentence obtained in the step (2); (4) combining the sentence level features obtained in the step (3) into the word embedding representation of the target sentence obtained in the step (2) according to a weight to obtain new target sentence word embedding, predicting words that may be beginnings according to the new target sentence word embedding to obtain a word head set, predicting words that may be endings according to the new target sentence word embedding to obtain a word tail set, and matching the words in the word head set and the word tail set; In the step (4), the method of combining the sentence level features obtained in the step (3) into the word embedding representation of the target sentence obtained in the step (2) according to a weight is specifically as follows: first, calculating a correlation degree matrix between different sentence types and entity types according to the probability of simultaneous occurrence of the sentence types and the entity types; then taking the values corresponding to the correlation degree matrix as initial weights; and finally adding the target sentence embedding to the word embedding representation of each target sentence according to the initial weights. (5) completing entity extraction according to the matched result in the step (4).

2. The MRC framework based entity extraction method of claim 1, wherein, In the step (2), the word segmentation tool is WordpieceTokenizer, and the word segmented corpus is encoded by using bert-embedding. 3.The MRC framework based entity extraction method of claim 1, wherein, In the step (3), the method of obtaining sentence level features according to the word embedding representation of the target sentence obtained in the step (2) is specifically as follows: passing the word embedding representation of the target sentence obtained in the step (2) through a multi-head attention mechanism layer, performing maximum pooling processing on the output of the multi-head attention mechanism layer to obtain target sentence embedding, and predicting a sentence type according to the target sentence embedding.

4. The MRC framework based entity extraction method of claim 3, wherein, The target sentence embedding is the sentence level feature.

5. The MRC framework based entity extraction method of claim 3, wherein, The method of predicting a sentence type according to the target sentence embedding is specifically as follows: passing the target sentence embedding through a linear mapping layer to obtain unnormalized logarithmic probability, performing softmax function normalization processing on the logarithmic probability to obtain a prediction distribution of the sentence type, and predicting the sentence type according to the prediction distribution. A loss function for sentence type prediction is obtained from the cross-entropy between the predicted distribution and the actual distribution . 6.The MRC framework based entity extraction method of claim 1, wherein, In the step (4), the method of obtaining the word head set is specifically as follows: first, passing the target sentence word embedding through a linear mapping layer to obtain unnormalized logarithmic probability; then performing softmax function normalization processing on the unnormalized logarithmic probability to obtain a probability distribution of each word being a beginning of an entity; and finally selecting words with a probability greater than 0.5 of being a beginning of an entity as the word head set, that is, the word head set. A loss function for start coordinate prediction is obtained according to the cross-entropy between the predicted probability distribution of the entity start and the actual distribution .

7. The MRC framework based entity extraction method of claim 1, wherein, In the step (4), the method for obtaining the word tail set comprises the following steps: firstly, performing linear mapping on the target sentence word embedding to obtain an unnormalized logarithmic probability; then, performing softmax function normalization on the unnormalized logarithmic probability to obtain a probability distribution of each word being predicted as an entity tail; and finally, selecting a word with a probability greater than 0.5 of being an entity tail as a word set possibly being a tail, that is, the word tail set; A loss function for end coordinate prediction is obtained according to the cross-entropy between the predicted probability distribution of the entity end and the actual distribution . 8.The MRC framework based entity extraction method of claim 1, wherein, In the step (4), the method for matching the words in the word head set and the word tail set comprises the following steps: firstly, combining the embedding representations of the candidate start words in the word head set and the candidate end words in the word tail set; then, performing linear mapping on the combined word embedding to obtain an unnormalized logarithmic probability; and finally, performing softmax function normalization on the unnormalized logarithmic probability to obtain a corresponding predicted matching probability distribution. A loss function of start coordinate and end coordinate matching is obtained according to cross entropy of the predicted matching probability distribution and the actual distribution . 9.The MRC framework based entity extraction method of claim 1, wherein, The entity extraction in the step (5) is specifically: generating a start coordinate prediction loss function based on the matched result in the step (4) , an end coordinate prediction loss function , a start coordinate and end coordinate matching loss function , and a sentence type prediction loss function Different weights are given to each loss function, and the sum is taken to obtain a final loss function. Training is performed according to the final loss function to complete entity extraction.

Citation Information

Patent Citations

  • Entity relation joint extraction method and system based on relation guidance

    CN113887211A

  • Threat intelligence named entity recognition method based on machine reading understanding

    CN114757193A