A method, device, equipment and medium for extracting overlapping entity relationships based on SDT-MCM
By adopting the SDT-MCM model in the joint extraction of entity relationships, combining semantic features and syntactic features, and performing multi-dimensional angle annotation, the problem of overlapping syntactic features and entity relationships in the existing technology is solved, and the accuracy of knowledge triple extraction is improved.
Patent Information
- Application Number
- CN202410770535.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-14
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-06-14
AI Technical Summary
The prior art does not consider the overlap of syntactic features and entity relationships of the sentence itself when extracting joint entity relationships, resulting in the limitation of model extraction performance.
Using the SDT-MCM-based method, the text is processed through the semantic feature extraction module, the syntactic feature extraction module, the multi-dimensional angle labeling module and the classifier module, the semantic features and syntactic features are extracted, the features are fused and the multi-dimensional angle labeling is performed, and the joint extraction of entities and relationships is finally realized through the classifier.
By considering the syntactic characteristics of sentences and dealing with overlapping entity relationships, the accuracy of Chinese knowledge triple extraction is improved, and the effective extraction of overlapping entities and relationships in the text is achieved.
Smart Images

Figure CN118504571B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of relationship classification, and in particular to a method, device, equipment and medium for extracting overlapping entity relationships based on SDT-MCM. Background Art
[0002] Entity and relationship extraction is the basic work of building knowledge graphs. Its core is to mine the intrinsic knowledge from unstructured or semi-structured data and extract knowledge triples. In reality, a sentence often contains a lot of information and complex factual relationships. Different triples may overlap in a sentence. Taking the DuIE2.0 dataset as an example, 39% of the texts in 190,000 data contain more than one pair of entity relationship triples, and 37% of the texts have overlapping entity relationship triples. Therefore, solving the problem of extracting overlapping triples is the key to improving the accuracy of Chinese knowledge triple extraction; overlapping entity relationship problems are divided into three categories, namely SEO (SingleEntityOverlap, one entity has a relationship with multiple entities), EPO (Entity pair overlap, the same pair of entities has multiple relationships) and Normal.
[0003] The entity-relationship joint extraction method based on deep learning makes good use of the potential connection between entities and relations in the text, and identifies entity pairs with a certain relationship and their relations at one time. At present, the OneRel model converts the joint extraction into a fine-grained triple classification problem (i.e., the subject, relationship type, and object of relationship extraction). Through a scoring-based classifier and a horns tagging strategy for specific relationships, it can complete the process of extracting all triples from unstructured text in one step; the TAG-JE model proposes a method for constructing a word adjacency graph, mapping inter-word dependencies into inter-character dependencies, so that the Chinese syntactic dependency tree can be integrated with the features extracted by the BERT pre-training model.
[0004] However, although the OneRel model alleviates the problem of overlapping triples extraction to a certain extent, it only utilizes the contextual features of the sentence and pays less attention to the syntactic features of the sentence itself, so that the model does not fully explore the connection between entity relationship triplets and limits the representation ability of text features. The TAG-JE model does not take into account the overlapping of entity relationships when performing joint entity relationship extraction, and cannot handle SEO and EPO problems, which limits the model extraction performance. Summary of the invention
[0005] In view of this, it is necessary to provide an overlapping entity relationship extraction method, device, equipment and medium based on SDT-MCM to solve the technical problem of not considering the syntactic features of the sentence itself and the overlapping of entity relationships when jointly extracting entity relationships from text.
[0006] In order to solve the above problems, the present invention provides an overlapping entity relationship extraction method based on SDT-MCM, which is used to jointly extract the text to be predicted based on a well-trained SDT-MCM model to obtain a prediction result; the SDT-MCM model includes a semantic feature extraction module, a syntactic feature extraction module, a multi-dimensional corner annotation module, and a classifier module;
[0007] The overlapping entity relationship extraction method based on SDT-MCM includes:
[0008] Extracting semantic features of the text based on the semantic feature extraction module;
[0009] Constructing a character adjacency graph based on the syntactic dependency tree corresponding to the text data, and extracting features from the character adjacency graph based on the syntactic feature extraction module to obtain syntactic features;
[0010] Obtain fusion features based on the semantic features and the syntactic features, and annotate the fusion features based on the multi-dimensional corner annotation module to obtain a multi-dimensional corner annotation matrix;
[0011] Based on the classifier module, the multi-dimensional corner annotation matrix is jointly extracted with respect to entities and relations, so as to realize the extraction of overlapping entities and relations of the text.
[0012] In a possible implementation, the semantic feature extraction module includes a BERT model; and extracting the semantic features of the text based on the semantic feature extraction module includes:
[0013] Obtaining a first text sequence of text data;
[0014] Adding a CLS tag and a SEP tag to the beginning and the end of the first text sequence respectively to obtain a second text sequence;
[0015] A BERT model is constructed, the second text sequence is input into the BERT model, and the second text sequence is encoded based on the BERT model to obtain semantic features of the text.
[0016] In a possible implementation, the step of constructing a word adjacency graph based on a syntactic dependency tree corresponding to the text data includes:
[0017] Obtaining the text of the text data, segmenting the text using a spacy tool, and then performing dependency syntactic analysis on the segmented text to obtain a syntactic dependency tree;
[0018] The CLS tags in the BERT are embedded into the syntactic dependency tree, and a word adjacency graph is constructed based on the syntactic dependency tree after the CLS tags are embedded.
[0019] In a possible implementation, the syntactic feature extraction module includes a GCN network; and extracting features from the word adjacency graph based on the syntactic feature extraction module to obtain syntactic features includes:
[0020] Transforming the character adjacency graph to obtain a character adjacency matrix;
[0021] Each word in the word adjacency matrix is encoded based on a GCN network to obtain syntactic features of the text, wherein the GCN network adopts a 2-layer GCNs network architecture.
[0022] In a possible implementation, the multidimensional corner labeling module includes a multidimensional corner labeling strategy; the step of obtaining a fusion feature based on the syntactic feature and the semantic feature, labeling the fusion feature based on the multidimensional corner labeling module, and obtaining a multidimensional corner labeling matrix includes:
[0023] Fusing the syntactic feature with the semantic feature to obtain a fused feature;
[0024] Each pair of entities in the fusion features is obtained, each pair of entities is annotated using a multi-dimensional corner annotation strategy to obtain a multi-dimensional corner annotation matrix, and a predefined relationship is embedded into the text corresponding to each pair of entities.
[0025] In a possible implementation, the classifier module includes an evaluation-based classifier; the method of jointly extracting entities and relationships from the multidimensional corner-annotated matrix based on the classifier module to extract overlapping entities and relationships of the text includes:
[0026] Building evaluation-based classifiers;
[0027] Obtain the head entity, the relationship and the tail entity of the multidimensional corner annotation matrix by enumeration, and construct triples based on the head entity, the relationship and the tail entity;
[0028] Constructing a score function of the classifier, extracting the head entity and the tail entity of the triple in one step based on the score function, and mining the relationship between the head entity and the tail entity based on the constructed nonlinear function to obtain the relationship of the triple;
[0029] Based on the score function and the nonlinear function, construct a final scoring function;
[0030] Scoring the triplet based on the final scoring function to obtain a score vector, inputting the score vector into the Softmax layer to obtain the prediction probability of the triplet in the fusion feature;
[0031] Based on the predicted probability of the triples in the fusion features, a loss function is constructed, and the parameters of the SDT-MCM model are updated based on the loss function;
[0032] Based on the SDT-MCM model with updated parameters, entities and relations are jointly extracted from the text to be predicted, so as to realize the extraction of overlapping entities and relations of the text.
[0033] In a possible implementation, the score function is calculated as follows:
[0034] ,
[0035] in, is the score function, is the head entity, is the tail entity, To explore the potential dependencies between the head entity and the tail entity, For predefined relationships, is the transpose of the matrix;
[0036] The calculation formula of the nonlinear function is:
[0037] ,
[0038] in, is the activation function, is the trainable weight, is the deviation, It is the concatenation of the head entity matrix and the tail entity matrix;
[0039] The calculation formula of the final scoring function is:
[0040] ,
[0041] in, is the final scoring function, is a triple, is the predefined number of relations, is a fractional vector, For fusion features;
[0042] The calculation formula of the loss function is:
[0043] ,
[0044] in, is the loss function, is the predicted probability of the triple in the fusion feature, is the predicted triple, is the labeled entity relationship triple, is a constant, is a constant, is the dimension of the matrix.
[0045] On the other hand, the present invention also provides an overlapping entity relationship extraction device based on SDT-MCM, which is used to jointly extract the text to be predicted based on a well-trained SDT-MCM model to obtain a prediction result; the SDT-MCM model includes a semantic feature extraction module, a syntactic feature extraction module, a multi-dimensional corner annotation module, and a classifier module;
[0046] The overlapping entity relationship extraction device based on SDT-MCM comprises:
[0047] A semantic feature extraction unit, used to extract the semantic features of the text based on the semantic feature extraction module;
[0048] A syntactic feature extraction unit, configured to construct a character adjacency graph based on a syntactic dependency tree corresponding to the text data, and to extract features from the character adjacency graph based on the syntactic feature extraction module to obtain syntactic features;
[0049] A multi-dimensional corner annotation unit, used for obtaining a fusion feature based on the semantic feature and the syntactic feature, and annotating the fusion feature based on the multi-dimensional corner annotation module to obtain a multi-dimensional corner annotation matrix;
[0050] A joint extraction unit is used to perform joint extraction of entities and relations on the multi-dimensional corner annotation matrix based on the classifier module, so as to realize the extraction of overlapping entities and relations in the text.
[0051] In another aspect, the present invention further provides an electronic device, comprising: a processor and a memory;
[0052] The memory stores a computer-readable program executable by the processor;
[0053] When the processor executes the computer-readable program, the steps in the overlapping entity relationship extraction method based on SDT-MCM as described above are implemented.
[0054] On the other hand, the present invention also provides a computer-readable storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in the overlapping entity relationship extraction method based on SDT-MCM as described above.
[0055] The beneficial effects of the present invention are as follows: extracting features from a word adjacency graph through a syntactic feature extraction module of an SDT-MCM model to obtain syntactic features, obtaining fused features based on the syntactic features and semantic features, fusing the syntactic features and semantic features of a text to obtain fused features, taking into account the syntactic features of the sentence itself, and achieving the purpose of knowledge enhancement through fused features, annotating the fused features through a multidimensional corner annotation module of the SDT-MCM model to obtain a multidimensional corner annotation matrix, annotating the fused features through the multidimensional corner annotation module, jointly extracting entities and relationships from the multidimensional corner annotation matrix, converting the problem of extracting entity-relationship triples into a problem of relationship classification, and realizing feature separation of overlapping entity relationships in the text. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 A schematic diagram of the structure of an embodiment of the SDT-MCM model provided by the present invention;
[0057] Figure 2 A flow chart of an embodiment of the overlapping entity relationship extraction method based on SDT-MCM provided by the present invention;
[0058] Figure 3 A schematic diagram of a word adjacency graph of an overlapping entity relationship extraction method based on SDT-MCM provided by the present invention;
[0059] Figure 4 A schematic diagram of a word adjacency matrix of the overlapping entity relationship extraction method based on SDT-MCM provided by the present invention;
[0060] Figure 5 A schematic diagram of entity annotation in a text of the overlapping entity relationship extraction method based on SDT-MCM provided by the present invention;
[0061] Figure 6 A schematic structural diagram of an embodiment of an overlapping entity relationship extraction device based on SDT-MCM provided by the present invention;
[0062] Figure 7 A schematic structural diagram of an embodiment of an electronic device provided by the present invention. DETAILED DESCRIPTION
[0063] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.
[0064] The present invention discloses a method, device, equipment and medium for extracting overlapping entity relationships based on SDT-MCM, which can be used in a computer. The method, device or computer-readable storage medium involved in the present invention can be integrated with the above-mentioned device or can be relatively independent.
[0065] A specific embodiment of the present invention discloses a method for extracting overlapping entity relationships based on SDT-MCM, which can be executed by a computer, specifically by one or more processors of the computer. Figure 1 As shown, the SDT-MCM model 100 includes a semantic feature extraction module 110, a syntactic feature extraction module 120, a multi-dimensional corner annotation module 130, and a classifier module 140. Based on the well-trained SDT-MCM model, the predicted text is jointly extracted to obtain the prediction result; Figure 2 As shown in FIG. 1 , the overlapping entity relationship extraction method based on SDT-MCM includes:
[0066] S201, extracting semantic features of the text based on the semantic feature extraction module 110;
[0067] S202, constructing a character adjacency graph based on the syntactic dependency tree corresponding to the text data, and extracting features from the character adjacency graph based on the syntactic feature extraction module 120 to obtain syntactic features;
[0068] S203, obtaining fusion features based on semantic features and syntactic features, and annotating the fusion features based on the multi-dimensional corner annotation module 130 to obtain a multi-dimensional corner annotation matrix;
[0069] S204: Jointly extract entities and relations from the multi-dimensional corner annotation matrix based on the classifier module 140 to extract overlapping entities and relations from the text.
[0070] Among them, the SDT-MCM model is a text overlapping entity and relationship extraction model based on syntactic dependency tree and multi-dimensional corner labeling strategy. The semantic feature extraction module of the SDT-MCM model includes the BERT model, the syntactic feature extraction module includes the GCN network, the multi-dimensional corner labeling module includes the multi-dimensional corner labeling strategy, and the classifier module includes the evaluation-based classifier; the semantic features of the text are extracted by the BERT model. The BERT model is encoded based on single words in the text and cannot handle the dependency relationship between words in the text. Therefore, the word adjacency graph is extracted through the GCN network to extract the syntactic features of the text. Among them, the GCN network adopts a 2-layer GCNs network architecture, after fusing the syntactic features and semantic features, the fused features are labeled by the multi-dimensional corner labeling strategy to obtain the multi-dimensional corner labeling matrix, and the multi-dimensional corner labeling matrix is jointly extracted by the evaluation-based classifier, and the final output result of the model is obtained through the Softmax layer.
[0071] Compared with the prior art, the overlapping entity relationship extraction method based on SDT-MCM provided in this embodiment extracts the semantic features of the text through the semantic feature extraction module of the SDT-MCM model, which is convenient for defining the processing scope, constructs a word adjacency graph based on the syntactic dependency tree corresponding to the text data, extracts features from the word adjacency graph through the syntactic feature extraction module of the SDT-MCM model to obtain syntactic features, obtains fusion features based on syntactic features and semantic features, so that the SDT-MCM model can fully explore the connections between entity relationship triples, annotates the fusion features using the multidimensional corner annotation strategy of the multidimensional corner annotation module, obtains a multidimensional corner annotation matrix, and realizes feature separation of overlapping situations, and jointly extracts entities and relationships from the multidimensional corner annotation matrix through the classifier module of the SDT-MCM model to realize the extraction of overlapping entities and relationships in the text, transforms the problem of extracting entity relationship triples into a problem of relationship classification, and realizes feature separation of overlapping situations at the same time.
[0072] In some embodiments, in step S201, the semantic feature extraction module 110 includes a BERT model. The semantic feature extraction module extracts the semantic features of the text. First, a first text sequence X of the text data is obtained. To facilitate the definition of the processing range, a CLS tag is added to the head of the first text sequence, and a SEP tag is added to the end of the first text sequence, thereby obtaining a new input sequence, namely, the second text sequence S. , build a BERT model, input the second text sequence into the input layer of the BERT model, and after encoding the second text sequence based on the BERT model, obtain the hidden layer features corresponding to each word in the input sequence S, that is, the semantic features H of the text:
[0073] ,
[0074] in, is the semantic feature embedding of CLS tag, is the semantic feature embedding of SEP tags, is the semantic feature embedding of each word in the original text, is the length of sequence X, , is the dimension of the BERT vector.
[0075] In some embodiments, in step S202, syntactic features of a text sequence are extracted. First, a syntactic dependency tree needs to be constructed for each text, and various dependencies between words are obtained by marking the directed edges in the syntactic dependency tree. However, since Chinese text needs to be segmented before processing, and syntactic dependencies are also established based on word segmentation, and the BERT model is encoded based on single words in the text, it cannot process dependencies between words. To solve this problem, the Chinese syntactic dependency tree is converted into a word adjacency graph to express it, and then the GCN graph neural network is used to perform feature learning on the word adjacency graph to complete the extraction of syntactic features;
[0076] Construct a word adjacency graph based on the syntactic dependency tree corresponding to the text data. First, obtain the text of the text data, segment the text with the spacy tool, and perform dependency syntactic analysis on the segmented text to obtain a syntactic dependency tree. The directed edges in the syntactic dependency tree represent the dependency relationship between different words, and use different labels to annotate the words in the text to determine the text dependency relationship. The CLS label in BERT is embedded in the syntactic dependency tree to obtain an extended syntactic dependency tree. The extended syntactic dependency tree strengthens the structural relationship between the segmentation and the whole sentence, expands the structure of the syntactic dependency tree, and also strengthens the feature extraction ability of the model. The solid line in the extended syntactic dependency tree represents the original dependency relationship in the sentence, and the dotted line represents the additional context dependency relationship. Construct a word adjacency graph based on the syntactic dependency tree after embedding the CLS label. Take the text example sentence " Sung by "Depend on Taking "lyrics" as an example, the word adjacency graph is used to convert the word dependency relationship of Chinese text into the character dependency relationship. First, the words after Chinese word segmentation are connected with undirected solid lines. At the same time, the dependency relationship between words is also represented by undirected solid lines, but only the last word of the starting word is connected to the first word of the word pointed by the dependency relationship. The relationship between CLS and each word is represented by an undirected dotted line. The schematic diagram of the word adjacency graph can be found in Figure 3 On the basis of retaining the directed dependency relationship in the original syntactic dependency tree, the word adjacency graph converts the directed edges of the original syntactic dependency tree into undirected edges, which facilitates the subsequent calculation of syntactic features using the GCN model.
[0077] In some embodiments, based on the syntactic feature extraction module 120, the word adjacency graph is subjected to feature extraction to obtain syntactic features. The syntactic feature extraction module 120 includes a GCN network. First, the word adjacency graph is transformed to obtain a word adjacency matrix. Sung by "Depend on Taking the text "Composition" as an example, after using the spacy tool for word segmentation, the above text sentence is segmented into: , "singing", "of" and " "","Depend on"," ” and “compose music”, their word adjacency matrix, see Figure 4 In the word adjacency matrix, the small matrix of all 1s formed on the main diagonal marks each word in the text sequence. The matrix of all 1s for each word extends horizontally and vertically to the marks of other words, indicating that there is a syntactic dependency relationship between the two words. The values corresponding to the unmarked areas are all 0. After obtaining the word adjacency matrix, each word in the word adjacency matrix is encoded through the GCN network to obtain the syntactic features of the text. In the word adjacency graph, each word is equivalent to a node in the graph. For each node in the word adjacency graph, the GCN network updates the corresponding embedding node by aggregating the characteristics of the node's neighbor nodes. In the SDT-MCM model, the GCN network uses 2 layers of GCNs as syntactic feature encoders to encode each word in the word adjacency graph, and only obtains the neighbor node information within the 2-top, where the 2-top is the first 2 words and the last 2 words of the node; the CLS embedding of BERT is used as the initial node embedding corresponding to each word to obtain the initial text sequence. , with text sequence For the GCN network model The input of the layer is :
[0078] ,
[0079] ,
[0080] ,
[0081] in, is the adjacency matrix abstracted from the word adjacency graph, is a diagonal matrix, is the degree matrix of the adjacency matrix, For GCN network The learnable parameters of the layer, is the activation function ReLU, .
[0082] In some embodiments, in step S203, the semantic features extracted by BERT of the pre-trained model are And the syntactic features obtained through the GCN network Fusion to obtain fusion features .
[0083] In some embodiments, after obtaining the fused features, the fused features are annotated based on the multidimensional corner annotation module 130 to obtain a multidimensional corner annotation matrix. The multidimensional corner annotation module 130 includes a multidimensional corner annotation strategy. To solve the problem of overlapping entity relationship triples, the SDT-MCM model proposes a multidimensional corner annotation strategy. The multidimensional corner annotation strategy is used to annotate the fused features to obtain a multidimensional corner annotation matrix. The multidimensional corner annotation strategy is as follows: a text of length n is constructed for each pair of entities in the text. Dimensional label matrix , the predefined The relationship is embedded into the text where each pair of entities is located. For the entity annotation method, the BIE symbol is used to indicate the position of a word in the word, H is used to indicate the head entity, and T is used to indicate the tail entity. Among them, HB represents the first word at the beginning of the head entity, HI represents the word between the beginning and the end of the head entity, HE represents the word at the end of the head entity, and TB, TI and TE are the first word, the middle word and the first word at the end of the tail entity respectively. Among them, HB-TI indicates that the word corresponding to the position vertically is the first word of the head entity, and the word corresponding horizontally is the first word of the tail entity, such as in ( ,singer, ) in the triplet " ” is assigned the label HB-TB. There are nine different labels, including HI-TB, HE-TB, HB-TI, HI-TI, HE-TI, HB-TE, HI-TE, and HE-TE, to identify the attributes of a certain location. For a schematic diagram of entity annotation in the text, please refer to Figure 5 ,like Figure 5 As shown, we only need to mark the three corners of the matrix HB-TB, HE-TB, and HE-TE to successfully decode the head entity and tail entity of the text from the matrix, and the marking matrix is sparse. The sparse label matrix has the following advantages: first, using three instead of nine special labels can effectively reduce the potential search space for classification; second, the sparse This means that there are enough negative samples during training; third, The sparsity of ensures the simplicity and efficiency of triple decoding; after obtaining the fusion feature, each pair of entities in the fusion feature is obtained, and each pair of entities in the fusion feature is labeled using a multi-dimensional corner labeling strategy to obtain a multi-dimensional corner labeling matrix, and the predefined relationship is embedded into the text corresponding to each pair of entities. After constructing the multi-dimensional corner labeling matrix, The dimensional matrix is input into the model, which transforms the problem of extracting entity-relationship triples into a problem of relationship classification, and at the same time realizes the feature separation of overlapping situations.
[0084] In some embodiments, in step S204, after obtaining the multidimensional corner labeling matrix, the multidimensional corner labeling matrix is subjected to joint extraction of entities and relations based on the classifier module 140, wherein the classifier module 140 includes an evaluation-based classifier; the purpose of the joint extraction of entities and relations is to extract all entity-relationship triples in the sentence, that is, for a sentence of length n ,and Predefined relationships After fusing the semantic features and syntactic features of the sentence Sentence, we get the sentence , the task of joint extraction is to identify all triples in X ,in, is the number of triples in the sentence, , It is the head and tail entity. An entity may be composed of multiple words, that is, , Indicated by arrive Between It is composed of characters;
[0085] The scoring-based classifier can realize the joint extraction of entity-relationship triplets, build an evaluation-based classifier, obtain the head entity, relationship, and tail entity of the multidimensional corner-labeled matrix by enumeration, and build a triple based on the head entity, relationship, and tail entity. , whose triples have multiple combinations, the evaluation-based classifier scores each triple to complete the joint extraction of entity relationship triples. The specific process is: given a relationship In the case of , the score function of the classifier is constructed, and the head entity and the tail entity of the triple are extracted in one step based on the score function. The calculation formula of the score function is:
[0086] ,
[0087] in, is the score function, is the head entity, is the tail entity, To explore the potential dependencies between the head entity and the tail entity, For predefined relationships, is the transpose of the matrix;
[0088] Construct a nonlinear function of the classifier, and mine the relationship between the head entity and the tail entity based on the nonlinear function to obtain all the relationships of the triples. The calculation formula of the nonlinear function is:
[0089] ,
[0090] in, is the activation function, is the trainable weight, is the deviation, It is the concatenation of the head entity matrix and the tail entity matrix;
[0091] Based on the score function and the nonlinear function, the final scoring function is constructed. The calculation formula of the final scoring function is:
[0092] ,
[0093] in, is the final scoring function, is a triple, is the predefined number of relations, is a fractional vector, For fusion features;
[0094] The triples are scored based on the final scoring function, that is, all the relations of the triples are sent to two fully connected layers, and each entity relationship triple is scored by the final scoring function to obtain the corresponding dimensional rating matrix, i.e., score vector ,in The matrix with value > 0 is the predicted entity relationship triple. The score vector is input into the Softmax layer to predict the label and get the final output of the model. The output is the predicted probability of the triple in the fusion feature. When the predicted probability of the triple in the fusion feature is greater than 0.5, the final triple is obtained. The calculation formula of the predicted probability of the triple in the fusion feature is:
[0095] ,
[0096] in, is the predicted probability of the triple in the fusion feature, is the predicted triple;
[0097] Based on the prediction probability of the triples in the fusion features, a loss function is constructed, and the parameters of the SDT-MCM model are updated based on the loss function. The calculation formula of the loss function is:
[0098] ,
[0099] in, is the loss function, is the predicted probability of the triple in the fusion feature, is the predicted triple, is the labeled entity relationship triple, is a constant, is a constant, is the dimension of the matrix;
[0100] Based on the parameter-updated SDT-MCM model, entities and relations are jointly extracted from the predicted text to achieve the extraction of overlapping entities and relations in the text.
[0101] In order to better implement the overlapping entity relationship extraction method based on SDT-MCM in the embodiment of the present invention, on the basis of the overlapping entity relationship extraction method based on SDT-MCM, correspondingly, Figure 6 As shown, the embodiment of the present invention further provides an overlapping entity relationship extraction device based on SDT-MCM, which is used to jointly extract the text to be predicted based on the well-trained SDT-MCM model to obtain the prediction result; the SDT-MCM model includes a semantic feature extraction module, a syntactic feature extraction module, a multi-dimensional corner labeling module, and a classifier module; the overlapping entity relationship extraction device 600 based on SDT-MCM includes:
[0102] A semantic feature extraction unit 601, used to extract semantic features of text based on a semantic feature extraction module;
[0103] A syntactic feature extraction unit 602, configured to construct a character adjacency graph based on a syntactic dependency tree corresponding to the text data, and extract features from the character adjacency graph based on a syntactic feature extraction module to obtain syntactic features;
[0104] A multi-dimensional corner annotation unit 603 is used to obtain a fusion feature based on the semantic feature and the syntactic feature, and annotate the fusion feature based on the multi-dimensional corner annotation module to obtain a multi-dimensional corner annotation matrix;
[0105] The joint extraction unit 604 is used to perform joint extraction of entities and relations on the multi-dimensional corner annotation matrix based on the classifier module, so as to realize the extraction of overlapping entities and relations in the text.
[0106] like Figure 7 As shown, the present invention also provides an electronic device 700 , which can be a computing device such as a mobile terminal, a desktop computer, a notebook, a palmtop computer, a server, etc. The electronic device 700 includes a processor 701 , a memory 702 , and a display 703 . Figure 7 Only some components of the electronic device 700 are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0107] In some embodiments, the memory 702 may be an internal storage unit of the electronic device 700, such as a hard disk or memory of the electronic device 700. In other embodiments, the memory 702 may also be an external storage device of the electronic device 700, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 700. Further, the memory 702 may also include both an internal storage unit of the electronic device 700 and an external storage device. The memory 702 is used to store application software and various types of data installed in the electronic device 700, such as program codes installed in the electronic device 700. The memory 702 may also be used to temporarily store data that has been output or is to be output. In one embodiment, the memory 702 stores an overlapping entity relationship extraction program 704 based on SDT-MCM, and the overlapping entity relationship extraction program 704 based on SDT-MCM can be executed by the processor 701, thereby realizing the overlapping entity relationship extraction method based on SDT-MCM in various embodiments of the present invention.
[0108] In some embodiments, the processor 701 may be a central processing unit (CPU), a microprocessor or other data processing chip, used to run program codes or process data stored in the memory 702, such as an overlapping entity relationship extraction method based on SDT-MCM.
[0109] In some embodiments, the display 703 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, etc. The display 703 is used to display the identification information of the overlapping entity relationship extraction program 704 based on SDT-MCM and to display a visual user interface. The components 701-703 of the electronic device 700 communicate with each other through a system bus.
[0110] In some embodiments, when the processor 701 executes the SDT-MCM-based overlapping entity relationship extraction program 704 in the memory 702, the various steps in the SDT-MCM-based overlapping entity relationship extraction method described in the above embodiments are implemented. Since the SDT-MCM-based overlapping entity relationship extraction method has been described in detail above, it will not be repeated here.
[0111] Accordingly, the present invention also provides a computer-readable storage medium, which is used to store computer-readable programs or instructions. When the program or instructions are executed by a processor, it can implement the steps or functions of the overlapping entity relationship extraction method based on SDT-MCM provided in the above-mentioned method embodiments.
[0112] In summary, the overlapping entity relationship extraction method, device, equipment and medium based on SDT-MCM provided by the present invention are used to jointly extract the text to be predicted based on the fully trained SDT-MCM model to obtain the prediction result; the SDT-MCM model includes a semantic feature extraction module, a syntactic feature extraction module, a multi-dimensional corner labeling module, and a classifier module; the overlapping entity relationship extraction method based on SDT-MCM includes: extracting the semantic features of the text based on the semantic feature extraction module; constructing a word adjacency graph based on the syntactic dependency tree corresponding to the text data, extracting features from the word adjacency graph based on the syntactic feature extraction module, and obtaining syntactic features; obtaining fused features based on semantic features and syntactic features, labeling the fused features based on the multi-dimensional corner labeling module, and obtaining a multi-dimensional corner labeling matrix; and jointly extracting entities and relationships from the multi-dimensional corner labeling matrix based on the classifier module to realize the extraction of overlapping entities and relationships in the text, thereby improving the accuracy of Chinese knowledge triple extraction.
[0113] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, wherein the computer-readable storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
[0114] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.
Claims
1. A method for extracting overlapping entity relations based on SDT-MCM, characterized in that: Used to jointly extract the text to be predicted based on the well-trained SDT-MCM model to obtain the prediction result; the SDT-MCM model includes a semantic feature extraction module, a syntactic feature extraction module, a multi-dimensional corner annotation module, and a classifier module; The overlapping entity relationship extraction method based on SDT-MCM includes: Extracting semantic features of the text based on the semantic feature extraction module; Constructing a character adjacency graph based on the syntactic dependency tree corresponding to the text data, and extracting features from the character adjacency graph based on the syntactic feature extraction module to obtain syntactic features; Obtain fusion features based on the semantic features and the syntactic features, and annotate the fusion features based on the multi-dimensional corner annotation module to obtain a multi-dimensional corner annotation matrix; Based on the classifier module, the multidimensional corner-labeled matrix is subjected to joint extraction of entities and relations, so as to realize the extraction of overlapping entities and relations of the text, wherein the classifier module includes an evaluation-based classifier; based on the classifier module, the multidimensional corner-labeled matrix is subjected to joint extraction of entities and relations, so as to realize the extraction of overlapping entities and relations of the text, comprising: Building evaluation-based classifiers; Obtain the head entity, the relationship and the tail entity of the multidimensional corner annotation matrix by enumeration, and construct triples based on the head entity, the relationship and the tail entity; Construct a score function for the classifier, extract the head entity and the tail entity of the triple in one step based on the score function, and mine the relationship between the head entity and the tail entity based on the constructed nonlinear function to obtain the relationship of the triple, wherein the calculation formula of the score function is: , in, is the score function, is the head entity, is the tail entity, To explore the potential dependencies between the head entity and the tail entity, For predefined relationships, is the transpose of the matrix; Based on the score function and the nonlinear function, a final scoring function is constructed, wherein the calculation formula of the nonlinear function is: , in, is the activation function, is the trainable weight, is the deviation, It is the concatenation of the head entity matrix and the tail entity matrix; The calculation formula of the final scoring function is: , in, is the final scoring function, is a triple, is the predefined number of relations, is a fractional vector, To fusion features, is a predefined relationship; Scoring the triplet based on the final scoring function to obtain a score vector, inputting the score vector into a Softmax layer to obtain a prediction probability of the triplet in the fusion feature; Based on the predicted probability of the triples in the fusion features, a loss function is constructed, and the parameters of the SDT-MCM model are updated based on the loss function, wherein the calculation formula of the loss function is: , in, is the loss function, is the predicted probability of the triple in the fusion feature, is the predicted triple, is the labeled entity relationship triple, is a constant, is a constant, is the dimension of the matrix, is the input sequence; Based on the SDT-MCM model with updated parameters, entities and relations are jointly extracted from the text to be predicted, so as to realize the extraction of overlapping entities and relations of the text.
2. The overlapping entity relationship extraction method based on SDT-MCM according to claim 1 is characterized in that: The semantic feature extraction module includes a BERT model; the semantic feature extraction module extracts the semantic features of the text, including: Obtaining a first text sequence of text data; Adding a CLS tag and a SEP tag to the beginning and the end of the first text sequence respectively to obtain a second text sequence; A BERT model is constructed, the second text sequence is input into the BERT model, and the second text sequence is encoded based on the BERT model to obtain semantic features of the text.
3. The overlapping entity relationship extraction method based on SDT-MCM according to claim 2 is characterized in that: The step of constructing a word adjacency graph based on a syntactic dependency tree corresponding to the text data includes: Obtaining the text of the text data, segmenting the text using a spacy tool, and then performing dependency syntactic analysis on the segmented text to obtain a syntactic dependency tree; The CLS tags in the BERT are embedded into the syntactic dependency tree, and a word adjacency graph is constructed based on the syntactic dependency tree after the CLS tags are embedded.
4. The overlapping entity relationship extraction method based on SDT-MCM according to claim 3 is characterized in that: The syntactic feature extraction module includes a GCN network; the feature extraction of the word adjacency graph based on the syntactic feature extraction module to obtain syntactic features includes: Transforming the character adjacency graph to obtain a character adjacency matrix; Each word in the word adjacency matrix is encoded based on a GCN network to obtain syntactic features of the text, wherein the GCN network adopts a 2-layer GCNs network architecture.
5. The overlapping entity relationship extraction method based on SDT-MCM according to claim 4 is characterized in that: The multidimensional corner annotation module includes a multidimensional corner annotation strategy; the fusion feature is obtained based on the syntactic feature and the semantic feature, and the fusion feature is annotated based on the multidimensional corner annotation module to obtain a multidimensional corner annotation matrix, including: Fusing the syntactic feature with the semantic feature to obtain a fused feature; Obtain each pair of entities in the fusion feature, use a multi-dimensional corner annotation strategy to annotate each pair of entities, obtain a multi-dimensional corner annotation matrix, and embed the predefined relationship into the text corresponding to each pair of entities, wherein the multi-dimensional corner annotation strategy is: a text of length n, for each pair of entities in the text, construct a Dimensional label matrix , embedding the predefined K relations into the text of each entity pair.
6. A device for extracting overlapping entity relations based on SDT-MCM, characterized in that: Used to jointly extract the text to be predicted based on the well-trained SDT-MCM model to obtain the prediction result; the SDT-MCM model includes a semantic feature extraction module, a syntactic feature extraction module, a multi-dimensional corner annotation module, and a classifier module; The overlapping entity relationship extraction device based on SDT-MCM comprises: A semantic feature extraction unit, used to extract the semantic features of the text based on the semantic feature extraction module; A syntactic feature extraction unit, configured to construct a character adjacency graph based on a syntactic dependency tree corresponding to the text data, and to extract features from the character adjacency graph based on the syntactic feature extraction module to obtain syntactic features; A multi-dimensional corner annotation unit, used for obtaining a fusion feature based on the semantic feature and the syntactic feature, and annotating the fusion feature based on the multi-dimensional corner annotation module to obtain a multi-dimensional corner annotation matrix; A joint extraction unit is used to perform joint extraction of entities and relations on the multidimensional corner-labeled matrix based on the classifier module to realize the extraction of overlapping entities and relations of the text, wherein the classifier module includes an evaluation-based classifier; the joint extraction of entities and relations on the multidimensional corner-labeled matrix based on the classifier module to realize the extraction of overlapping entities and relations of the text includes: Building evaluation-based classifiers; Obtain the head entity, the relationship and the tail entity of the multidimensional corner annotation matrix by enumeration, and construct triples based on the head entity, the relationship and the tail entity; Construct a score function for the classifier, extract the head entity and the tail entity of the triple in one step based on the score function, and mine the relationship between the head entity and the tail entity based on the constructed nonlinear function to obtain the relationship of the triple, wherein the calculation formula of the score function is: , in, is the score function, is the head entity, is the tail entity, To explore the potential dependencies between the head entity and the tail entity, For predefined relationships, is the transpose of the matrix; Based on the score function and the nonlinear function, a final scoring function is constructed, wherein the calculation formula of the nonlinear function is: , in, is the activation function, is the trainable weight, is the deviation, It is the concatenation of the head entity matrix and the tail entity matrix; The calculation formula of the final scoring function is: , in, is the final scoring function, is a triple, is the predefined number of relations, is a fractional vector, To fusion features, is a predefined relationship; Scoring the triplet based on the final scoring function to obtain a score vector, inputting the score vector into a Softmax layer to obtain a prediction probability of the triplet in the fusion feature; Based on the predicted probability of the triples in the fusion features, a loss function is constructed, and the parameters of the SDT-MCM model are updated based on the loss function, wherein the calculation formula of the loss function is: , in, is the loss function, is the predicted probability of the triple in the fusion feature, is the predicted triple, is the labeled entity relationship triple, is a constant, is a constant, is the dimension of the matrix, is the input sequence; Based on the SDT-MCM model with updated parameters, entities and relations are jointly extracted from the text to be predicted, so as to realize the extraction of overlapping entities and relations of the text.
7. An electronic device, characterized in that: including memory and processor; The memory stores a computer-readable program executable by the processor; When the processor executes the computer-readable program, the processor implements the steps in the overlapping entity relationship extraction method based on SDT-MCM as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in the overlapping entity relationship extraction method based on SDT-MCM as described in any one of claims 1-5.
Citation Information
Patent Citations
Entity relation joint extraction method and device based on multi-feature fusion
CN116402019A