Entity relationship acquisition method, device, equipment and storage medium
Through the combination of entity extraction, word segmentation processing and multi-category and multi-label recognition models, the problem that existing technology cannot obtain multiple entity relationships in text corpus is solved, and accurate prediction of entity phrase relationships is achieved, which is suitable for applications such as knowledge graphs.
Patent Information
- Application Number
- CN202010149505.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-06
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2040-03-06
AI Technical Summary
Existing information extraction methods cannot effectively obtain multiple correspondences of the same group of entity phrases in text corpus.
Entity extraction, word segmentation processing, vector extraction model, vector fusion processing and multi-category multi-label recognition model are used to predict all entity relationship sets of entity phrases through word vector representation and feature vector extraction.
It improves the accuracy of predicting entity relationships between entity phrases in text corpus, and is suitable for application scenarios such as building knowledge graphs.
Smart Images

Figure CN111428493B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of semantic parsing technology of artificial intelligence, and in particular to an entity relationship acquisition method, device, equipment and storage medium. Background Art
[0002] The information extraction methods in the prior art have certain defects. The general approach is to extract the subject first, then extract the object and the corresponding relationship between the two, or extract the subject and object and the corresponding relationship between the two at the same time. However, in knowledge extraction, it is often encountered that the same group of subjects and objects correspond to multiple relationships, but the existing information extraction methods cannot obtain multiple corresponding relationships of the same group of entity phrases in the text corpus. Summary of the invention
[0003] The main purpose of the present invention is to solve the technical problem that the existing information extraction method cannot obtain multiple corresponding relationships of the same group of entity phrases in a text corpus.
[0004] To achieve the above object, the present invention provides a method for acquiring entity relationships in a first aspect, comprising:
[0005] Perform entity extraction on the corpus text to be recognized to obtain corresponding entity phrases with entity relationships;
[0006] Using a preset word segmentation algorithm to perform word segmentation processing on the corpus text to be recognized, and obtaining corresponding preset word blocks;
[0007] Using a preset vector extraction model to represent and extract word vectors for the preset word blocks, to obtain word vectors corresponding to the corpus text to be recognized;
[0008] Using the preset vector extraction model to perform word vector representation and extraction on the pre-obtained entity phrase, to obtain the word vector of the entity phrase;
[0009] Performing vector fusion processing on the word vectors of the corpus text to be recognized and the word vectors of the entity phrase to obtain a corresponding fusion vector, wherein the vector fusion processing includes at least one processing method selected from the group consisting of vector concatenation, vector averaging, vector pooling, and vector weighted sum processing, or a combination of at least two processing methods;
[0010] Using a preset feature vector extraction model to extract feature vectors from the fusion vector to obtain corresponding feature vectors, wherein the feature vectors contain entity relationships;
[0011] The feature vector is predicted using a preset multi-category multi-label recognition model to obtain a set of all entity relationships corresponding to the entity phrase.
[0012] Optionally, in another implementation of the first aspect of the present invention, performing entity extraction on the corpus text to be recognized to obtain corresponding entity phrases with entity relationships includes:
[0013] Segment the corpus text to be recognized to obtain corresponding preset word blocks;
[0014] Using labels including at least two label types to label the preset word blocks, to obtain training data classified according to the label types, wherein the label types represent entity types of the corresponding preset word blocks, and the relationships between the label types represent entity relationships;
[0015] Using a preset vector extraction model to vectorize and extract the data to be trained, so as to obtain a word vector for each word block corresponding to the label type;
[0016] Input the word vectors of the word blocks corresponding to each of the label types into the first long short-term memory network-conditional random field model and the second long short-term memory network-conditional random field model for prediction processing to obtain a predicted label sequence corresponding to each of the label types;
[0017] Merging the predicted label sequences corresponding to each of the label types to obtain a merged predicted label sequence;
[0018] The combined predicted label sequence is subjected to a de-labeling decoding process to obtain an entity phrase with an entity relationship; the de-labeling decoding process is to perform a label deleting process on the combined predicted label sequence.
[0019] Optionally, in another implementation of the first aspect of the present invention, the word vectors of the word blocks corresponding to each of the label types are respectively input into the first long short-term memory network-conditional random field model and the second long short-term memory network-conditional random field model for prediction processing to obtain the predicted label sequence corresponding to each of the label types specifically includes:
[0020] Inputting the word vectors of the word blocks corresponding to each of the label types into the first long short-term memory network model and the second long short-term memory network model for prediction processing to obtain the corresponding first prediction results and second prediction results;
[0021] The corresponding first prediction result and the second prediction result are respectively input into the first conditional random field model and the second conditional random field model for prediction processing to obtain a prediction label sequence corresponding to each label type.
[0022] Optionally, in another implementation of the first aspect of the present invention, the preset vector extraction model is at least one of a one-hot encoding model, a co-occurrence matrix model, and a word frequency-inverse text frequency index model;
[0023] The preset feature vector extraction model is at least one of a long short-term memory network model, a convolutional neural network model, an autoencoder model, and a recurrent neural network model.
[0024] Optionally, in another implementation of the first aspect of the present invention, the preset vector extraction model is at least one of a one-hot encoding model, a co-occurrence matrix model, and a word frequency-inverse text frequency index model;
[0025] The preset feature vector extraction model is at least one of a long short-term memory network model, a convolutional neural network model, an autoencoder model, and a recurrent neural network model.
[0026] Optionally, in another implementation of the first aspect of the present invention, the preset multi-category multi-label recognition model extracts feature vectors for the corpus in the target domain corresponding to the corpus text to be recognized, and inputs the feature vectors into the multi-category multi-label recognition model obtained by training the long short-term memory network model.
[0027] A second aspect of the present invention provides an entity relationship acquisition device, comprising:
[0028] The entity phrase acquisition module is used to extract entities from the corpus text to be recognized and obtain corresponding entity phrases with entity relationships;
[0029] A preset word block acquisition module, used to perform word segmentation processing on the corpus text to be recognized using a preset word segmentation algorithm to acquire corresponding preset word blocks;
[0030] A preset word block representation and extraction module, used to use a preset vector extraction model to perform word vector representation and extraction on the preset word block, and obtain the word vector corresponding to the corpus text to be recognized;
[0031] An entity phrase representation and extraction module, used to use the preset vector extraction model to perform word vector representation and extraction on the pre-obtained entity phrase to obtain the word vector of the entity phrase;
[0032] A vector fusion processing module, used for performing vector fusion processing on the word vector of the corpus text to be recognized and the word vector of the entity phrase to obtain a corresponding fusion vector, wherein the vector fusion processing includes at least one processing method selected from the group consisting of vector concatenation processing, vector averaging processing, vector pooling processing, and vector weighted sum processing, or a combination of at least two processing methods;
[0033] A feature vector extraction module, used to extract feature vectors from the fusion vector using a preset feature vector extraction model to obtain corresponding feature vectors, wherein the feature vectors contain entity relationships;
[0034] The multi-label recognition module is used to predict the feature vector using a preset multi-category multi-label recognition model to obtain a set of all entity relationships corresponding to the entity phrase.
[0035] Optionally, in another implementation of the second aspect of the present invention, the entity phrase acquisition module includes:
[0036] A preset word block acquisition unit is used to segment the corpus text to be recognized to obtain corresponding preset word blocks;
[0037] a to-be-trained data acquisition unit, configured to perform label marking processing on the preset character blocks using labels including at least two label types, to obtain to-be-trained data classified according to the label types, wherein the label types represent entity types of the corresponding preset character blocks, and the relationships between the label types represent entity relationships;
[0038] A vectorization representation unit, used for performing vectorization representation and extraction on the data to be trained using a preset vector extraction model, so as to obtain a word vector for each word block corresponding to the label type;
[0039] A predicted label sequence acquisition unit is used to input the word vectors of the word blocks corresponding to each of the label types into the first long short-term memory network-conditional random field model and the second long short-term memory network-conditional random field model for prediction processing to obtain a predicted label sequence corresponding to each of the label types;
[0040] A merging unit, used to merge the predicted label sequences corresponding to each of the label types to obtain a merged predicted label sequence;
[0041] The de-labeling decoding processing unit is used to perform de-labeling decoding processing on the merged predicted label sequence to obtain entity phrases with entity relationships; the de-labeling decoding processing is to delete labels from the merged predicted label sequence.
[0042] Optionally, in another implementation of the second aspect of the present invention, the prediction label sequence acquisition unit is specifically used to:
[0043] Inputting the word vectors of the word blocks corresponding to each of the label types into the first long short-term memory network model and the second long short-term memory network model for prediction processing to obtain the corresponding first prediction results and second prediction results;
[0044] The corresponding first prediction result and the second prediction result are respectively input into the first conditional random field model and the second conditional random field model for prediction processing to obtain a prediction label sequence corresponding to each label type.
[0045] Optionally, in another implementation of the second aspect of the present invention, the preset vector extraction model is at least one of a one-hot encoding model, a co-occurrence matrix model, and a word frequency-inverse text frequency index model;
[0046] The preset feature vector extraction model is at least one of a long short-term memory network model, a convolutional neural network model, an autoencoder model, and a recurrent neural network model.
[0047] Optionally, in another implementation of the second aspect of the present invention, the preset multi-category multi-label recognition model extracts feature vectors for the corpus in the target domain corresponding to the corpus text to be recognized, and inputs the feature vectors into the multi-category multi-label recognition model obtained by training the long short-term memory network model.
[0048] The third aspect of the present invention provides an entity relationship acquisition device, comprising: a memory and at least one processor, wherein instructions are stored in the memory, and the memory and the at least one processor are interconnected via a line; the at least one processor calls the instructions in the memory so that the entity relationship acquisition device executes the method described in the first aspect above.
[0049] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the method described in the first aspect.
[0050] In the technical solution provided by the present invention, entity extraction is performed on the corpus text to be recognized to obtain corresponding entity phrases with entity relationships; the corpus text to be recognized is segmented using a preset word segmentation algorithm to obtain corresponding preset word blocks; the preset vector extraction model is used to represent and extract word vectors on the preset word blocks to obtain word vectors corresponding to the corpus text to be recognized; the preset vector extraction model is used to represent and extract word vectors on the pre-obtained entity phrases to obtain word vectors of the entity phrases; vector fusion processing is performed on the word vectors of the corpus text to be recognized and the word vectors of the entity phrases to obtain corresponding fusion vectors; feature vector extraction is performed on the fusion vector using a preset feature vector extraction model to obtain corresponding feature vectors, and the feature vectors contain entity relationships; the feature vectors are predicted using a preset multi-category multi-label recognition model to obtain a set of all entity relationships corresponding to the entity phrases. In an embodiment of the present invention, a preset training model is used to predict entity phrases in a text corpus to be recognized; the text corpus to be recognized and the predicted entity phrases are vectorized to obtain respective corresponding word vectors; further, the respective corresponding word vectors are vector fused to obtain a fused vector; a feature vector extraction model is used to extract feature vectors from the fused vector; finally, a multi-label relationship prediction is performed on the feature vector through a multi-category and multi-label recognition model, thereby predicting all relationship sets corresponding to the entity phrases. The present invention improves the accuracy of predicting entity relationships between entity phrases in text corpora by using multiple joint training models and combining multi-label classification strategies for entity relationship prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 A schematic diagram of an embodiment of a method for acquiring entity relationships in an embodiment of the present invention;
[0052] Figure 2 A schematic diagram of another embodiment of the entity relationship acquisition method in an embodiment of the present invention;
[0053] Figure 3 A schematic diagram of an embodiment of an entity relationship acquisition device in an embodiment of the present invention;
[0054] Figure 4 It is a schematic diagram of another embodiment of the entity relationship acquisition device in an embodiment of the present invention;
[0055] Figure 5 It is a schematic diagram of an embodiment of an entity relationship acquisition device in an embodiment of the present invention. DETAILED DESCRIPTION
[0056] Embodiments of the present invention provide an entity relationship acquisition method, apparatus, device and storage medium for improving the accuracy of predicting entity relationships between entity phrases in a text corpus, and are suitable for application scenarios such as building knowledge graphs.
[0057] In order to enable those skilled in the art to better understand the solutions of the present invention, the embodiments of the present invention will be described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0058] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0059] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , an embodiment of the entity relationship acquisition method in the embodiment of the present invention includes:
[0060] 101. Perform entity extraction on the corpus text to be recognized to obtain corresponding entity phrases with entity relationships.
[0061] Specifically, the server extracts entities from the corpus text to be identified and obtains corresponding entity phrases with entity relationships. For example, if the corpus text to be identified is "Zhou composed and sang "Tornado", then through entity prediction, the phrases {"Zhou", "Tornado"} with subject-object relationships in the sentence can be obtained. In specific implementation, if the corpus text to be identified contains entity phrases with other entity relationships, the corresponding entity phrases with entity relationships can also be obtained.
[0062] 102. Use a preset word segmentation algorithm to segment the corpus text to be recognized to obtain corresponding preset word blocks.
[0063] Specifically, the server performs segmentation processing on the corpus text to be recognized by using a preset word segmentation algorithm to obtain corresponding preset word blocks. In specific implementation, if the corpus text to be recognized is "Zhou composed and sang "Tornado", the preset word blocks obtained by word segmentation processing include {"Zhou", "compose", "and", "sing", ""Tornado""}, and the present invention does not limit the word segmentation model or algorithm used in word segmentation preprocessing.
[0064] 103. Use a preset vector extraction model to perform word vector representation and extraction on the preset word blocks to obtain the word vector corresponding to the corpus text to be recognized.
[0065] Specifically, the server uses a preset vector extraction model to perform word vector representation and extraction on the preset word blocks, and obtains the word vector corresponding to the corpus text to be recognized. In specific implementation, the preset vector extraction model of the present invention can be at least one of a one-hot encoding model, a co-occurrence matrix model, and a word frequency-inverse text frequency index model. For example, if the corpus text to be recognized is "Zhou composed and sang "Tornado", the preset word blocks obtained after word segmentation processing include {"Zhou", "compose", "and", "sing", "", "Tornado"}, and further use the preset vector extraction model to vectorize and represent and extract the preset word blocks, and represent the above preset word blocks in the form of vectors or matrices, thereby achieving the representation of the corpus text to be recognized in a vectorized form. The present invention uses a preset vector extraction model for word vector representation and extraction, thereby obtaining the corresponding word vector, and achieving the representation of the corpus text to be recognized in a vectorized form, so as to facilitate the subsequent data processing for model training.
[0066] 104. Use a preset vector extraction model to perform word vector representation and extraction on the pre-obtained entity phrases to obtain word vectors for the entity phrases.
[0067] Specifically, the server also uses a preset vector extraction model to perform word vector representation and extraction on the pre-obtained entity phrases to obtain word vectors for the entity phrases. In specific implementation, the pre-obtained entity phrases are entity word blocks with entity relationships that are predicted based on the input of the corresponding model into the corpus text to be recognized. The server uses the above-mentioned preset vector extraction model to perform vectorization processing on the entity phrases with entity relationships to obtain corresponding word vectors, so as to facilitate fusion processing in the form of vectors in the subsequent model training process through this data form.
[0068] 105. Perform vector fusion processing on the word vectors of the corpus text to be recognized and the word vectors of the entity phrase to obtain a corresponding fusion vector. The vector fusion processing includes adopting at least one processing method of vector concatenation processing, vector averaging processing, vector pooling processing, vector weighted sum processing, or a combination of at least two processing methods.
[0069] Specifically, the server performs vector fusion processing on the word vector of the corpus text to be recognized and the word vector of the entity phrase to obtain a corresponding fusion vector. In specific implementation, the vector fusion processing includes adopting at least one processing method of vector splicing processing, vector averaging processing, vector pooling processing, and vector weighted sum processing, or a combination of at least two processing methods; the present invention performs vector fusion processing on multi-dimensional input vectors, and this fusion method is diverse, which can be splicing, averaging, pooling, weighted sum and other vector fusion processing methods.
[0070] The present invention obtains the optimal result of the prediction sequence of entity phrases through entity prediction. The entity phrases obtained by the present invention are used for further vector fusion processing with the word vectors extracted from the corpus text to be recognized. For example, the word vector corresponding to the preset word block in the corpus text to be recognized is a three-dimensional vector v1 = [1, 2, 3, ]; the word vector corresponding to the corresponding entity phrase obtained is a three-dimensional vector v2 = [4, 5, 6]. Therefore, a vector fusion method can be selected to connect and expand the above two three-dimensional vectors to form a six-dimensional vector [v1, v2] = [1, 2, 3,4, 5, 6]. The present invention can connect and expand the input vectors through vector fusion processing, so that the range of entity phrases to be predicted is wider, thereby improving the diversity of predictions of multiple entity relationships between entity phrases.
[0071] 106. Use a preset feature vector extraction model to extract feature vectors from the fusion vector to obtain corresponding feature vectors, where the feature vectors contain entity relationships.
[0072] Specifically, the server uses a preset feature vector extraction model to extract feature vectors from the fusion vector to obtain a corresponding feature vector, and the feature vector contains entity relationships. In specific implementation, the preset feature vector extraction model is at least one of a long short-term memory network model, a convolutional neural network model, an autoencoder model, and a recurrent neural network model. Further, the feature vector extraction model used in the present invention can be diverse, not limited to a long short-term memory network model, but also a deep learning model such as a convolutional neural network model, an autoencoder model, a recurrent neural network model, or an ordinary machine learning model. Since the feature vector contains entity relationships, for the above-mentioned corpus text to be identified is "Zhou composed and sang "Tornado", for the entity phrase: "Zhou" and "Tornado", the entity relationship between the two is the corresponding relationship between the subject and the object, then the corresponding feature vector is a four-dimensional vector, for example, the feature vector including the entity relationship is represented by a four-dimensional vector [0, 1, 1, 0]. The present invention uses a preset feature vector extraction model to extract feature vectors from the fusion vector, and can derive a feature vector containing entity relationships, so as to prepare for the next step of inputting a multi-category multi-label recognition model to predict entity relationships on the obtained feature vector.
[0073] 107. Use the preset multi-category multi-label recognition model to predict the feature vector and obtain the set of all entity relationships corresponding to the entity phrase.
[0074] Specifically, the server uses a preset multi-category multi-label recognition model to predict the feature vector and obtain a set of all entity relationships corresponding to the entity phrase. Furthermore, the preset multi-category multi-label recognition model extracts feature vectors from the corpus in the target domain corresponding to the corpus text to be recognized, and inputs them into the multi-category multi-label recognition model obtained by training the long short-term memory network model. Specifically, for the multi-category multi-label recognition model, a prediction module for the entity relationship obtained by inputting feature vectors to the output is input into the long short-term memory network model by obtaining certain training data in the target domain and inputting them into the long short-term memory network model. The training data includes the text corpus in the target domain and the labels for distinguishing entity types in the text corpus, thereby training the corresponding multi-category multi-label recognition model. The label of the entity type represents the entity relationship and is used to distinguish the entity relationship between entity phrases. Therefore, the feature vector corresponding to the corpus text to be recognized is input into the multi-category multi-label recognition model to obtain the corresponding entity phrase that identifies the entity relationship according to the label. For example, the entity phrases in the above-mentioned corpus to be identified: "Zhou Mou" and "tornado", the corresponding feature vector is [0, 1, 1, 0]. Then, by inputting the feature vector into the preset multi-category multi-label recognition model, the corresponding entity relationship label can be obtained. If there are several entity phrases in the corpus to be identified and there are several corresponding entity relationship labels, the preset multi-category multi-label recognition model can output the corresponding multiple entity relationship label sets.
[0075] From the above, it can be seen that the embodiment of the method of the present invention adopts a preset training model to predict the entity phrases in the text corpus to be recognized; and vectorizes the text corpus to be recognized and the predicted entity phrases to obtain the corresponding word vectors; further vectors are fused to obtain a fusion vector; and a feature vector extraction model is used to extract feature vectors from the fusion vector; finally, multi-label relationship prediction is performed on the feature vector through a multi-category and multi-label recognition model, so as to predict all relationship sets corresponding to the entity phrases. The present invention improves the accuracy of predicting entity relationships between entity phrases in text corpora by using multiple joint training models and combining multi-label classification strategies to predict entity relationships.
[0076] Optional, such as Figure 2 As shown, in another embodiment of the entity relationship acquisition method in the embodiment of the present invention, entity extraction is performed on the corpus text to be recognized to obtain corresponding entity phrases with entity relationships, including:
[0077] 201. Segment the corpus text to be recognized to obtain corresponding preset character blocks.
[0078] In a specific implementation, if the corpus text to be recognized is "Zhou composed and sang "Tornado", the preset character blocks obtained by direct segmentation include {"Zhou", "Jie", "Lun", "compose", "music", "and", "perform", "sing", "le", "dragon", "roll", "wind"}.
[0079] 202. Use labels containing at least two label types to perform label marking processing on the preset word blocks to obtain training data classified according to the label types, wherein the label types represent entity types of the corresponding preset word blocks, and the relationships between the label types represent entity relationships.
[0080] In specific implementation, in the process of labeling the preset word blocks, labels containing at least two label types are used to label the preset word blocks. The label type represents the entity type of the corresponding preset word block, and the relationship between the label types represents the entity relationship. For example, when processing ordinary entity recognition tasks, a label marking form such as "word label" is used. Taking the subject-object entity phrase as an example, when extracting the subject and object, since the same word may be both a subject and an object, the general label marking form cannot meet the requirement of capturing the information of both at the same time. Therefore, the label marking processing method used is divided into two columns of labels, and the labeling form is such as: "word subject label object label", that is, the labels that the entity may contain are uniformly marked. The present invention obtains the training data classified according to the label type by labeling the preset word blocks. Therefore, when the present invention is implemented, the words can be labeled to distinguish the entity types of each word. Different entity types can be used to know whether there is an entity relationship between words. The present invention simultaneously extracts all subjects and objects in the input text, which more effectively improves the recall rate of subject and object extraction compared to predicting the subject or object alone.
[0081] 203. Use a preset vector extraction model to vectorize and extract the training data, so as to obtain the word vector of the word block corresponding to each label type.
[0082] Specifically, the server also uses the above-mentioned preset vector extraction model to perform word vector representation and extraction on the training data, thereby obtaining a vector sequence for each word block, that is, obtaining a word vector for a word block corresponding to each label type. The specific implementation process is the same as that of step 101, except that the vectorized representation object is replaced with the training data obtained above.
[0083] 204. Input the word vectors of the word blocks corresponding to each label type into the first long short-term memory network-conditional random field model and the second long short-term memory network-conditional random field model for prediction processing to obtain a predicted label sequence corresponding to each label type.
[0084] Specifically, the server inputs the vector sequence of the word block corresponding to each label type into the first long short-term memory network-conditional random field model and the second long short-term memory network-conditional random field model for prediction processing. When the first long short-term memory network-conditional random field model and the second long short-term memory network-conditional random field model are trained, the training input corpus text is the same in the training data, and the training input "label sequence" is different. For example, the first long short-term memory network-conditional random field model outputs "the test label sequence of the subject", and the second long short-term memory network-conditional random field model outputs "the test label sequence of the subject". Therefore, in the output result, when the input corpus text to be identified is a sentence containing a subject-object relationship phrase, the prediction results of the two model trainings can be obtained at the same time, that is, the output "the test label sequence of the subject" and "the predicted label sequence of the object" are output.
[0085] Furthermore, when the server inputs the word vectors of the word blocks corresponding to each label type into the first long short-term memory network-conditional random field model and the second long short-term memory network-conditional random field model for prediction processing, the specific implementation includes: the server first inputs the word vectors of the word blocks corresponding to each label type into the first long short-term memory network model and the second long short-term memory network model for prediction processing to obtain the corresponding first prediction result and the second prediction result; then inputs the corresponding first prediction result and the second prediction result into the first conditional random field model and the second conditional random field model for prediction processing to obtain the prediction label sequence corresponding to each label type. The present invention inputs the representation vectors into the first long short-term memory network-conditional random field model and the second long short-term memory network-conditional random field model for entity phrase prediction, such as subject prediction and object prediction, during training, so as to obtain the prediction results of the two model trainings at the same time, and performs the next step of training based on the sum of the prediction results.
[0086] 205. Merge the predicted label sequences corresponding to each label type to obtain a merged predicted label sequence.
[0087] Specifically, the server adds the prediction results of the two prediction models to jointly train the long short-term memory network model and the conditional random field model to obtain the optimal prediction effect. The training implementation process will obtain the global optimal results of the subject prediction sequence and the object prediction sequence.
[0088] 206. Perform a de-labeling decoding process on the merged prediction label sequence to obtain entity phrases with entity relationships. The de-labeling decoding process is to perform a label deleting process on the merged prediction label sequence.
[0089] Specifically, when predicting the result, the server decodes the subject and object of the input sentence based on the merged prediction label sequence, for example, for the above-mentioned corpus text to be identified, the merged prediction label sequence is {"subject prediction label sequence", "object prediction label sequence"}, and obtains all the phrases with subject-object relationship in the sentence {"Zhou Mou", "tornado"}. In specific implementation, if the corpus text to be identified contains entity phrases with other entity relationships, then the phrases with entity relationships are fully permuted and combined for matching, and the corresponding entity phrases with entity relationships can also be obtained.
[0090] The above describes the entity relationship acquisition method in the embodiment of the present invention. The following describes the entity relationship acquisition device in the embodiment of the present invention. Figure 3 , an embodiment of the entity relationship acquisition device in the embodiment of the present invention includes:
[0091] The entity phrase acquisition module 301 is used to extract entities from the corpus text to be recognized and obtain corresponding entity phrases with entity relationships;
[0092] A preset word block acquisition module 302 is used to perform word segmentation processing on the corpus text to be recognized using a preset word segmentation algorithm to acquire corresponding preset word blocks;
[0093] The preset word block representation and extraction module 303 is used to use a preset vector extraction model to perform word vector representation and extraction on the preset word block to obtain the word vector corresponding to the corpus text to be recognized;
[0094] The entity phrase representation and extraction module 304 is used to use a preset vector extraction model to perform word vector representation and extraction on the pre-obtained entity phrase to obtain the word vector of the entity phrase;
[0095] The vector fusion processing module 305 is used to perform vector fusion processing on the word vector of the corpus text to be recognized and the word vector of the entity phrase to obtain a corresponding fusion vector, wherein the vector fusion processing includes at least one processing method of vector concatenation processing, vector averaging processing, vector pooling processing, and vector weighted sum processing, or a combination of at least two processing methods;
[0096] A feature vector extraction module 306 is used to extract feature vectors from the fusion vector using a preset feature vector extraction model to obtain corresponding feature vectors, where the feature vectors contain entity relationships;
[0097] The multi-label recognition module 307 is used to predict the feature vector using a preset multi-category multi-label recognition model to obtain a set of all entity relationships corresponding to the entity phrase.
[0098] See also Figure 4In another embodiment of the entity relationship acquisition device in the embodiment of the present invention, the entity phrase acquisition module 301 includes:
[0099] The preset word block acquisition unit 3011 is used to segment the corpus text to be recognized to obtain corresponding preset word blocks;
[0100] The training data acquisition unit 3012 is used to perform labeling processing on the preset word blocks using labels including at least two label types to obtain training data classified according to the label types, where the label types represent the entity types of the corresponding preset word blocks, and the relationships between the label types represent the entity relationships;
[0101] A vectorization representation unit 3013 is used to perform vectorization representation and extraction on the training data using a preset vector extraction model, so as to obtain a word vector for a word block corresponding to each label type;
[0102] The predicted label sequence acquisition unit 3014 is used to input the word vectors of the word blocks corresponding to each label type into the first long short-term memory network-conditional random field model and the second long short-term memory network-conditional random field model for prediction processing to obtain the predicted label sequence corresponding to each label type;
[0103] A merging unit 3015 is used to merge the predicted label sequences corresponding to each label type to obtain a merged predicted label sequence;
[0104] The de-labeling decoding processing unit 3016 is used to perform de-labeling decoding processing on the merged predicted label sequence to obtain entity phrases with entity relationships; the de-labeling decoding processing is to delete the label processing on the merged predicted label sequence.
[0105] Optionally, in another embodiment of the entity relationship acquisition device in the embodiment of the present invention, the prediction label sequence acquisition unit 3014 is specifically used to:
[0106] Inputting the word vectors of the word blocks corresponding to each label type into the first long short-term memory network model and the second long short-term memory network model for prediction processing to obtain the corresponding first prediction results and second prediction results;
[0107] The corresponding first prediction result and the second prediction result are respectively input into the first conditional random field model and the second conditional random field model for prediction processing to obtain a prediction label sequence corresponding to each label type.
[0108] Optionally, in another embodiment of the entity relationship acquisition device in the embodiment of the present invention, the preset vector extraction model is at least one of a one-hot encoding model, a co-occurrence matrix model, and a word frequency-inverse text frequency index model;
[0109] The preset feature vector extraction model is at least one of a long short-term memory network model, a convolutional neural network model, an autoencoder model, and a recurrent neural network model.
[0110] Optionally, in another embodiment of the entity relationship acquisition device in the embodiment of the present invention, a preset multi-category multi-label recognition model extracts feature vectors of the corpus in the target domain corresponding to the corpus text to be recognized, and inputs them into the multi-category multi-label recognition model obtained by training the long short-term memory network model.
[0111] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For device or system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0112] above Figure 3 and Figure 4 The entity relationship acquisition device in the embodiment of the present invention is described in detail from the perspective of modular functional entities. The entity relationship acquisition device in the embodiment of the present invention is described in detail from the perspective of hardware processing.
[0113] Figure 5 : is a structural diagram of an entity relationship acquisition device provided by an embodiment of the present invention. The entity relationship acquisition device 500 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 501 (for example, one or more processors) and a memory 509, and one or more storage media 508 (for example, one or more mass storage devices) storing application programs 507 or data 506. Among them, the memory 509 and the storage medium 508 can be short-term storage or permanent storage. The program stored in the storage medium 508 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in entity relationship acquisition. Furthermore, the processor 501 can be configured to communicate with the storage medium 508 to execute a series of instruction operations in the storage medium 508 on the entity relationship acquisition device 500.
[0114] The entity relationship acquisition device 500 may also include one or more power supplies 502, one or more wired or wireless network interfaces 503, one or more input and output interfaces 504, and / or one or more operating systems 505, such as Windows Serve, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art will appreciate that Figure 5 The entity relationship acquisition device structure shown in the figure does not constitute a limitation on the entity relationship acquisition device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0115] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0116] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0117] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0118] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0119] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the whole or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0120] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for acquiring entity relationships, characterized in that: include: Perform entity extraction on the corpus text to be recognized to obtain corresponding entity phrases with entity relationships; Using a preset word segmentation algorithm to perform word segmentation processing on the corpus text to be recognized, and obtaining corresponding preset word blocks; Using a preset vector extraction model to represent and extract word vectors for the preset word blocks, to obtain word vectors corresponding to the corpus text to be recognized; Using the preset vector extraction model to perform word vector representation and extraction on the pre-obtained entity phrase, to obtain the word vector of the entity phrase; Performing vector fusion processing on the word vectors of the corpus text to be recognized and the word vectors of the entity phrase to obtain a corresponding fusion vector, wherein the vector fusion processing includes at least one processing method selected from the group consisting of vector concatenation, vector averaging, vector pooling, and vector weighted sum processing, or a combination of at least two processing methods; Using a preset feature vector extraction model to extract feature vectors from the fusion vector to obtain corresponding feature vectors, wherein the feature vectors contain entity relationships; The feature vector is predicted using a preset multi-category multi-label recognition model to obtain a set of all entity relationships corresponding to the entity phrase.
2. The entity relationship acquisition method according to claim 1, characterized in that: The entity extraction is performed on the corpus text to be recognized to obtain corresponding entity phrases with entity relationships, including: Segment the corpus text to be recognized to obtain corresponding preset word blocks; Using labels including at least two label types to label the preset word blocks, to obtain training data classified according to the label types, wherein the label types represent entity types of the corresponding preset word blocks, and the relationships between the label types represent entity relationships; Using a preset vector extraction model to vectorize and extract the data to be trained, so as to obtain a word vector for each word block corresponding to the label type; Input the word vectors of the word blocks corresponding to each of the label types into the first long short-term memory network-conditional random field model and the second long short-term memory network-conditional random field model for prediction processing to obtain a predicted label sequence corresponding to each of the label types; Merging the predicted label sequences corresponding to each of the label types to obtain a merged predicted label sequence; The combined predicted label sequence is subjected to a de-labeling decoding process to obtain an entity phrase with an entity relationship; the de-labeling decoding process is to perform a label deleting process on the combined predicted label sequence.
3. The entity relationship acquisition method according to claim 2, characterized in that: The word vectors of the word blocks corresponding to each of the label types are input into the first long short-term memory network-conditional random field model and the second long short-term memory network-conditional random field model for prediction processing to obtain the predicted label sequence corresponding to each of the label types specifically includes: Inputting the word vectors of the word blocks corresponding to each of the label types into the first long short-term memory network model and the second long short-term memory network model for prediction processing to obtain the corresponding first prediction results and second prediction results; The corresponding first prediction result and the second prediction result are respectively input into the first conditional random field model and the second conditional random field model for prediction processing to obtain a prediction label sequence corresponding to each label type.
4. The entity relationship acquisition method according to claim 1, characterized in that: The preset vector extraction model is at least one of a one-hot encoding model, a co-occurrence matrix model, and a word frequency-inverse text frequency index model; The preset feature vector extraction model is at least one of a long short-term memory network model, a convolutional neural network model, an autoencoder model, and a recurrent neural network model.
5. The entity relationship acquisition method according to claim 1, characterized in that: The preset multi-category multi-label recognition model extracts feature vectors from the corpus in the target field corresponding to the corpus text to be recognized, and inputs the feature vectors into the multi-category multi-label recognition model obtained by training the long short-term memory network model.
6. An entity relationship acquisition device, characterized in that: include: The entity phrase acquisition module is used to extract entities from the corpus text to be recognized and obtain corresponding entity phrases with entity relationships; A preset word block acquisition module, used to perform word segmentation processing on the corpus text to be recognized using a preset word segmentation algorithm to acquire corresponding preset word blocks; A preset word block representation and extraction module, used to use a preset vector extraction model to perform word vector representation and extraction on the preset word block, and obtain the word vector corresponding to the corpus text to be recognized; An entity phrase representation and extraction module, used to use the preset vector extraction model to perform word vector representation and extraction on the pre-obtained entity phrase to obtain the word vector of the entity phrase; A vector fusion processing module, used for performing vector fusion processing on the word vector of the corpus text to be recognized and the word vector of the entity phrase to obtain a corresponding fusion vector, wherein the vector fusion processing includes at least one processing method selected from the group consisting of vector concatenation processing, vector averaging processing, vector pooling processing, and vector weighted sum processing, or a combination of at least two processing methods; A feature vector extraction module, used to extract feature vectors from the fusion vector using a preset feature vector extraction model to obtain corresponding feature vectors, wherein the feature vectors contain entity relationships; The multi-label recognition module is used to predict the feature vector using a preset multi-category multi-label recognition model to obtain a set of all entity relationships corresponding to the entity phrase.
7. The entity relationship acquisition device according to claim 6, characterized in that: The entity phrase acquisition module includes: A preset word block acquisition unit is used to segment the corpus text to be recognized to obtain corresponding preset word blocks; a to-be-trained data acquisition unit, configured to perform label marking processing on the preset character blocks using labels including at least two label types, to obtain to-be-trained data classified according to the label types, wherein the label types represent entity types of the corresponding preset character blocks, and the relationships between the label types represent entity relationships; A vectorization representation unit, used for performing vectorization representation and extraction on the data to be trained using a preset vector extraction model, so as to obtain a word vector for each word block corresponding to the label type; A predicted label sequence acquisition unit is used to input the word vectors of the word blocks corresponding to each of the label types into the first long short-term memory network-conditional random field model and the second long short-term memory network-conditional random field model for prediction processing to obtain a predicted label sequence corresponding to each of the label types; A merging unit, used to merge the predicted label sequences corresponding to each of the label types to obtain a merged predicted label sequence; The de-labeling decoding processing unit is used to perform de-labeling decoding processing on the merged predicted label sequence to obtain entity phrases with entity relationships; the de-labeling decoding processing is to delete labels from the merged predicted label sequence.
8. The entity relationship acquisition device according to claim 7, characterized in that: The predicted label sequence acquisition unit is specifically used for: Inputting the word vectors of the word blocks corresponding to each of the label types into the first long short-term memory network model and the second long short-term memory network model for prediction processing to obtain the corresponding first prediction results and second prediction results; The corresponding first prediction result and the second prediction result are respectively input into the first conditional random field model and the second conditional random field model for prediction processing to obtain a prediction label sequence corresponding to each label type.
9. An entity relationship acquisition device, characterized in that: The entity relationship acquisition device comprises: a memory and at least one processor, the memory stores instructions, and the memory and the at least one processor are interconnected via a line; The at least one processor calls the instructions in the memory to enable the entity relationship acquisition device to execute the method according to any one of claims 1-5.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Entity relation extraction method
CN108733792A
Keyword extraction method and system based on fence type long-short term memory neural network
CN110263323A
