Method, device, equipment and storage medium for extracting open entity relations

By preprocessing the relational classification data set and building an unsupervised generation model, data format conversion and entity relationship prediction are performed on the text, the problem that open relationship extraction technology is difficult to deal with uncertain types is solved, and efficient entity relationship extraction is achieved.

CN113011189BActive Publication Date: 2025-03-21ONE CONNECT SMART TECH CO LTD SHENZHEN
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110322883.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-26
Publication Date
2025-03-21
Estimated Expiration
2041-03-26

AI Technical Summary

Technical Problem

The existing open relationship extraction technology is difficult to deal with uncertain types of relationships, and there are problems such as high annotation cost, low computational efficiency and inability to deal with overlapping relationships.

Method used

By obtaining the pending relationship classification data set for preprocessing, an initial unsupervised generation model is constructed, and the text is converted through the target unsupervised generation model to perform data format conversion, hidden layer vector transformation, entity relationship prediction and text sequence generation to obtain the target entity relationship information.

Benefits of technology

The calculation efficiency problems of high labeling cost, low computing efficiency, inability to deal with overlapping samples and expand to open problems are solved, and the effective treatment of uncertain types of relationships is realized.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113011189B_ABST
    Figure CN113011189B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of artificial intelligence technology, and provides a method, device, equipment and storage medium for extracting open entity relationships, which are used to solve the problem that existing open relationship extraction is difficult to handle indefinite type relationships. The method for extracting open entity relationships includes: pre-processing the entity relationships, field lengths and relationship triples of the relationship classification data set to be processed to obtain the data set to be processed; constructing an initial unsupervised generation model through a pre-trained backbone model, and training and optimizing the initial unsupervised generation model through the data set to be processed to obtain a target unsupervised generation model; performing word segmentation and word pairing processing on the text to be processed to obtain a pre-processed text; performing hidden layer vector conversion, entity relationship prediction and text sequence generation on the pre-processed text through the target unsupervised generation model to obtain target entity relationship information. In addition, the present invention also relates to blockchain technology, and the relationship classification data set to be processed can be stored in the blockchain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence neural networks, and in particular to an open entity relationship extraction method, device, equipment and storage medium. Background Art

[0002] Entity relationship extraction technology is a technology that takes a piece of context text and two entities as input and outputs the type of relationship between the two entities in this context. It is widely used in fields such as information extraction, graph construction, and association discovery. However, traditional relationship extraction technology is difficult to put into practical application because of its fixed relationship type and difficulty in labeling data. Open relationship extraction technology has attracted attention because it can automatically output all possible relationship triplets from an input text.

[0003] At present, traditional open relationship extraction schemes generally adopt the rule template method, but the rule template method has the problems of openness and complexity, high dependence on expert knowledge, difficulty in migration and rigid matching; in order to solve the problems of the rule template method, a method of labeling according to semantic roles is proposed, but this method has the problems of few ready-made data sets, high labeling cost and difficulty in handling overlapping relationships; in order to solve the problem of being unable to handle overlapping relationships, it is proposed to first extract the head entity from the sentence, and then jointly extract the tail entity and determine the relationship type based on the output of the head entity and the hidden layer of the neural network, but this method needs to calculate a large matrix with the number of rows and columns equal to the length of the input sentence to solve the problem of open relationship extraction, which makes it difficult for the existing open relationship extraction to handle indefinite type relationships. Summary of the invention

[0004] The present invention provides an open entity relationship extraction method, device, equipment and storage medium, which are used to solve the problem that the existing open relationship extraction is difficult to handle indefinite type relationships.

[0005] A first aspect of the present invention provides a method for extracting an open entity relationship, comprising:

[0006] Acquire a relational classification data set to be processed, and preprocess the entity relationship, field length, and relation triples of the relational classification data set to be processed to obtain the data set to be processed;

[0007] Constructing an initial unsupervised generative model through a pre-trained backbone model, and training and optimizing the initial unsupervised generative model through the data set to be processed to obtain a target unsupervised generative model;

[0008] Acquire a text to be processed, and perform word segmentation and word pairing processing on the text to be processed to obtain a preprocessed text;

[0009] The target unsupervised generation model is used to perform data format conversion, hidden layer vector conversion, entity relationship prediction and text sequence generation on the preprocessed text to obtain target entity relationship information.

[0010] Optionally, in a first implementation of the first aspect of the present invention, the step of obtaining a relational classification data set to be processed, and preprocessing entity relationships, field lengths, and relation triples of the relational classification data set to be processed to obtain the data set to be processed includes:

[0011] Creating a synonym dictionary, and obtaining a relation classification data set to be processed, and a target synonym corresponding to the relation classification data set to be processed in the synonym dictionary;

[0012] Using the target synonyms, synonym replacement is performed on the relation classification dataset to be processed to obtain an enhanced dataset;

[0013] Filtering the enhanced data set according to a preset entity field length and a preset sentence length to obtain a filtered data set;

[0014] A set of relation triples of the filtered data set is obtained, and alignment and de-duplication processing is performed on the set of relation triples using a preset regular expression to obtain a data set to be processed.

[0015] Optionally, in a second implementation of the first aspect of the present invention, the creating of a synonym dictionary and obtaining a relation classification data set to be processed and a target synonym corresponding to the relation classification data set to be processed in the synonym dictionary include:

[0016] Obtain target word data that has undergone deduplication and fusion processing, and generate a character string for the target word data according to the configured synonym definition information to obtain a synonym dictionary;

[0017] Acquire a relational classification data set to be processed, and entities and entity relationships of the relational classification data set to be processed;

[0018] Performing part-of-speech tagging on the relation classification data set to be processed, and randomly selecting a target entity and a target entity relationship from the entities and the entity relationships;

[0019] The synonym dictionary is traversed according to the target entity and the target entity relationship to obtain a corresponding target synonym.

[0020] Optionally, in a third implementation manner of the first aspect of the present invention, filtering the enhanced data set according to a preset entity field length and a preset sentence length to obtain a filtered data set includes:

[0021] Based on a preset entity field length, the enhanced data set is classified to obtain a first data set and a second data set, wherein the first data set is used to indicate compliance with the preset entity field length, and the second data set is used to indicate non-compliance with the preset entity field length;

[0022] According to a preset sentence length, the first data set and the second data set are classified to obtain a target data set and a non-target data set, wherein the target data set is used to indicate that the preset sentence length is met, and the non-target data set is used to indicate that the preset sentence length is not met;

[0023] Performing gap filling and masking processing on the sentences in the non-target data set to obtain filled data;

[0024] The filling data and the target data set are determined as a filtering data set.

[0025] Optionally, in a fourth implementation of the first aspect of the present invention, obtaining the relationship triple set of the filtered data set, aligning and deduplicating the relationship triple set through a preset regular expression to obtain the data set to be processed, includes:

[0026] Extracting an initial relation triple set from the filtered data set, and an initial relation phrase set corresponding to the initial relation triple set;

[0027] According to the initial relation phrase set, the initial relation triple set is aligned and analyzed to obtain a plurality of relation triples to be processed and a plurality of target relation triples, wherein the plurality of relation triples to be processed are used to indicate that the plurality of relation triples to be processed are the same triple, and the plurality of target relation triples are used to indicate that the plurality of target relation triples are not the same triple;

[0028] The multiple to-be-processed relation triplets are fused to obtain multiple fused relation triplets, and the multiple fused relation triplets and the multiple target relation triplets are determined as the to-be-processed data sets.

[0029] Optionally, in a fifth implementation of the first aspect of the present invention, the target unsupervised generation model is used to perform data format conversion, hidden layer vector conversion, entity relationship prediction, and text sequence generation on the preprocessed text to obtain target entity relationship information, including:

[0030] Converting the data format of the preprocessed text into the encoding input format of the target unsupervised generation model to obtain a converted text, wherein the target unsupervised generation model includes an encoder and a decoder;

[0031] Performing data fitting on the converted text by the encoder to obtain a hidden layer vector;

[0032] Obtaining the corresponding target word from a preset dictionary based on a preset greedy algorithm and the hidden layer vector through the decoder;

[0033] A text sequence is generated according to the target word to obtain target entity relationship information.

[0034] Optionally, in a sixth implementation of the first aspect of the present invention, the initial unsupervised generative model is constructed by using a pre-trained backbone model, and the initial unsupervised generative model is trained and optimized by using the data set to be processed to obtain a target unsupervised generative model, including:

[0035] Constructing an initial unsupervised generative model through a pre-trained backbone model, and dividing the data set to be processed into a training data set, a validation data set, and a test data set;

[0036] Training the initial unsupervised generative model using the training data set to obtain a candidate unsupervised generative model;

[0037] Through the candidate unsupervised generation model, the verification data set is subjected to hidden layer vector conversion, entity relationship prediction and text sequence generation to obtain a verification result;

[0038] Calculating a verification loss value of the verification result by using a preset loss function, and optimizing the candidate unsupervised generation model according to the verification loss value to obtain an optimized unsupervised generation model;

[0039] The optimized unsupervised generation model is tested using the test data set to obtain a test result, and a test loss value of the test result is calculated, and a target unsupervised generation model is determined based on the test loss value.

[0040] A second aspect of the present invention provides an open entity relationship extraction device, comprising:

[0041] A first preprocessing module is used to obtain a relational classification data set to be processed, and preprocess the entity relationship, field length and relation triple of the relational classification data set to be processed to obtain the data set to be processed;

[0042] A training optimization module is used to construct an initial unsupervised generative model through a pre-trained backbone model, and train and optimize the initial unsupervised generative model through the data set to be processed to obtain a target unsupervised generative model;

[0043] A second preprocessing module is used to obtain a text to be processed, and perform word segmentation and word pairing processing on the text to be processed to obtain a preprocessed text;

[0044] The extraction module is used to perform data format conversion, hidden layer vector conversion, entity relationship prediction and text sequence generation on the preprocessed text through the target unsupervised generation model to obtain target entity relationship information.

[0045] Optionally, in a first implementation of the second aspect of the present invention, the first preprocessing module includes:

[0046] Creating an acquisition unit, which is used to create a synonym dictionary, and acquire the relation classification data set to be processed, and the target synonyms corresponding to the relation classification data set to be processed in the synonym dictionary;

[0047] A replacement unit, configured to perform synonym replacement on the to-be-processed relation classification data set by using the target synonym to obtain an enhanced data set;

[0048] A filtering unit, configured to filter the enhanced data set according to a preset entity field length and a preset sentence length to obtain a filtered data set;

[0049] The processing unit is used to obtain the relationship triple set of the filtered data set, and perform alignment processing and de-duplication processing on the relationship triple set through a preset regular expression to obtain a data set to be processed.

[0050] Optionally, in a second implementation of the second aspect of the present invention, the creation and acquisition unit is specifically used to:

[0051] Obtaining target word data that has undergone deduplication and fusion processing, and generating character strings for the target word data according to the configured synonym definition information to obtain a synonym dictionary;

[0052] Acquire a relational classification data set to be processed, and entities and entity relationships of the relational classification data set to be processed;

[0053] Performing part-of-speech tagging on the relation classification data set to be processed, and randomly selecting a target entity and a target entity relationship from the entities and the entity relationships;

[0054] The synonym dictionary is traversed according to the target entity and the target entity relationship to obtain a corresponding target synonym.

[0055] Optionally, in a third implementation of the second aspect of the present invention, the filtering unit is specifically used for:

[0056] Based on a preset entity field length, the enhanced data set is classified to obtain a first data set and a second data set, wherein the first data set is used to indicate compliance with the preset entity field length, and the second data set is used to indicate non-compliance with the preset entity field length;

[0057] According to a preset sentence length, the first data set and the second data set are classified to obtain a target data set and a non-target data set, wherein the target data set is used to indicate that the preset sentence length is met, and the non-target data set is used to indicate that the preset sentence length is not met;

[0058] Performing gap filling and masking processing on the sentences in the non-target data set to obtain filled data;

[0059] The filling data and the target data set are determined as a filtering data set.

[0060] Optionally, in a fourth implementation manner of the second aspect of the present invention, the processing unit is specifically configured to:

[0061] Extracting an initial relation triple set from the filtered data set, and an initial relation phrase set corresponding to the initial relation triple set;

[0062] According to the initial relation phrase set, the initial relation triple set is aligned and analyzed to obtain a plurality of relation triples to be processed and a plurality of target relation triples, wherein the plurality of relation triples to be processed are used to indicate that the plurality of relation triples to be processed are the same triple, and the plurality of target relation triples are used to indicate that the plurality of target relation triples are not the same triple;

[0063] The multiple to-be-processed relation triplets are fused to obtain multiple fused relation triplets, and the multiple fused relation triplets and the multiple target relation triplets are determined as the to-be-processed data sets.

[0064] Optionally, in a fifth implementation of the second aspect of the present invention, the extraction module is specifically used to:

[0065] Converting the data format of the preprocessed text into the encoding input format of the target unsupervised generation model to obtain a converted text, wherein the target unsupervised generation model includes an encoder and a decoder;

[0066] Performing data fitting on the converted text by the encoder to obtain a hidden layer vector;

[0067] Obtaining the corresponding target word from a preset dictionary based on a preset greedy algorithm and the hidden layer vector through the decoder;

[0068] A text sequence is generated according to the target word to obtain target entity relationship information.

[0069] Optionally, in a sixth implementation manner of the second aspect of the present invention, the training optimization module is specifically used to:

[0070] Constructing an initial unsupervised generative model through a pre-trained backbone model, and dividing the data set to be processed into a training data set, a validation data set, and a test data set;

[0071] Training the initial unsupervised generative model using the training data set to obtain a candidate unsupervised generative model;

[0072] Through the candidate unsupervised generation model, the verification data set is subjected to hidden layer vector conversion, entity relationship prediction and text sequence generation to obtain a verification result;

[0073] Calculating a verification loss value of the verification result by using a preset loss function, and optimizing the candidate unsupervised generation model according to the verification loss value to obtain an optimized unsupervised generation model;

[0074] The optimized unsupervised generation model is tested using the test data set to obtain a test result, and a test loss value of the test result is calculated, and a target unsupervised generation model is determined based on the test loss value.

[0075] The third aspect of the present invention provides an open entity relationship extraction device, comprising: a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory so that the open entity relationship extraction device executes the above-mentioned open entity relationship extraction method.

[0076] 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 above-mentioned method for extracting open entity relationships.

[0077] In the technical solution provided by the present invention, a relation classification data set to be processed is obtained, and the entity relationship, field length and relationship triple of the relation classification data set to be processed are preprocessed to obtain the data set to be processed; an initial unsupervised generation model is constructed through a pre-trained backbone model, and the initial unsupervised generation model is trained and optimized through the data set to be processed to obtain a target unsupervised generation model; a text to be processed is obtained, and word segmentation and word pairing processing are performed on the text to be processed to obtain a preprocessed text; and data format conversion, hidden layer vector conversion, entity relationship prediction and text sequence generation are performed on the preprocessed text through the target unsupervised generation model to obtain target entity relationship information. In an embodiment of the present invention, by preprocessing the entity relations, field lengths and relation triples of the relation classification data set to be processed, an initial unsupervised generation model is constructed through a pre-trained backbone model, and the preprocessed text is converted into a data format, converted into a hidden layer vector, predicted into an entity relation and generated into a text sequence through a target unsupervised generation model, thereby solving the problems of high annotation cost, low computational efficiency, inability to process overlapping samples and the existence of the problem of calculating a large matrix with the number of rows and columns being the length of the input sentence when expanding to an open problem, thereby solving the problem that the existing open relation extraction is difficult to process relations of indefinite types. BRIEF DESCRIPTION OF THE DRAWINGS

[0078] Figure 1 A schematic diagram of an embodiment of a method for extracting an open entity relationship in an embodiment of the present invention;

[0079] Figure 2 It is a schematic diagram of another embodiment of the method for extracting open entity relationships in an embodiment of the present invention;

[0080] Figure 3 A schematic diagram of an embodiment of an open entity relationship extraction device in an embodiment of the present invention;

[0081] Figure 4 It is a schematic diagram of another embodiment of the device for extracting open entity relationships in an embodiment of the present invention;

[0082] Figure 5 The figure is a schematic diagram of an embodiment of an open entity relationship extraction device in an embodiment of the present invention. DETAILED DESCRIPTION

[0083] The embodiments of the present invention provide a method, device, equipment and storage medium for extracting an open entity relationship, which solves the problem that the existing open relationship extraction is difficult to handle indefinite type relationships.

[0084] 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.

[0085] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 An embodiment of the method for extracting open entity relationships in an embodiment of the present invention includes:

[0086] 101. Obtain a relational classification data set to be processed, pre-process the entity relationship, field length, and relation triple of the relational classification data set to be processed, and obtain the data set to be processed.

[0087] It is understandable that the execution subject of the present invention may be an open entity relationship extraction device, or a terminal or a server, which is not limited here. The embodiment of the present invention is described by taking a server as the execution subject as an example.

[0088] Among them, the relation classification datasets to be processed are open source, and the number of relation classification datasets to be processed includes one or more, for example: the relation classification datasets to be processed include the dataset SemEval-2010 Task8, the dataset ACE2003-2004, the dataset TACRED, the dataset FewRel and the Baidu information extraction set DuIE, etc. The relation classification datasets to be processed include text sentences and relation triples, and the relation classification datasets to be processed include entities and entity relationships between entities.

[0089] The server extracts relation classification data that has been entity labeled and entity relationship extracted and labeled from multiple open source libraries to obtain an initial relation classification data set, performs data cleaning and data attribute reduction on the initial relation classification data set to obtain a relation classification data set to be processed, extracts entities and entity relationships of the relation classification data set to be processed, performs synonym / nearby word enhancement processing on the entities and entity relationships in the relation classification data set to be processed to obtain an enhanced data set, the enhanced data set includes multiple triples (head entity, relationship and tail entity) and multiple augmented triples, the augmented triples include new triples with the same context, the same relationship type and different specific entity combinations obtained by randomly replacing components in the relation triples through a preset synonym dictionary, the sentence length of the text sentences in the augmented data set is processed according to a preset field length to obtain a processed data set, the multiple triples and the multiple augmented triples in the processed data set are divided into N samples to obtain sample data, and a preset number of data are selected from the sample data to obtain the data set to be processed.

[0090] 102. An initial unsupervised generative model is constructed through a pre-trained backbone model, and the initial unsupervised generative model is trained and optimized through the data set to be processed to obtain a target unsupervised generative model.

[0091] Among them, the pre-trained backbone model includes a unified language model (UniLM), a generative pre-training (GPT) model, a large language model GPT-2 based on a transformer transformer, or a pre-trained generative summary model PEGASUS, etc. In this embodiment, the pre-trained backbone model is preferably a unified language model UniLM, which is a pre-trained generative language model trained based on the pre-trained model BERT using three different mask mechanisms—bidirectional language model (BiLM), unidirectional language model (left-to-right language model, LRLM) and sequence to sequence language model (S2S LM). The initial unsupervised generation model constructed by the pre-trained backbone model includes an encoder and a decoder. The server divides the processing data set according to a preset division ratio, based on a preset random sampling algorithm or a stratified sampling algorithm, to obtain a training data set, a verification data set and a test data set, wherein the preset division ratio can be 8:1:1.

[0092] 103. Obtain the text to be processed, and perform word segmentation and word pairing processing on the text to be processed to obtain a preprocessed text.

[0093] The server receives the text to be processed from the preset display interface or terminal, and performs word segmentation on the text to be processed through the preset open source library Jieba to obtain a word segmentation list, and then takes out the words from the word segmentation list in pairs according to the order of the word segmentation list to achieve word pairing processing to obtain the preprocessed text. The word pairing processing will not significantly affect the efficiency of the target unsupervised generation model. For example, if there are N words, then they need to be paired N (N-1) / 2 times. On average, N = 5 in a sentence, and 10 pairs are required. The model takes about 1 second to make an inference, and 10 seconds for 10 inferences. This order of magnitude will not significantly affect the efficiency of the model.

[0094] 104. Through the target unsupervised generation model, the preprocessed text is converted into data format, hidden layer vector, entity relationship prediction and text sequence generation to obtain the target entity relationship information.

[0095] The server converts the data format of the preprocessed text based on the input format of the target unsupervised generation model to obtain the converted text, converts the converted text into a hidden layer vector through the encoder in the target unsupervised generation model, matches the corresponding target words in the preset dictionary according to the entity relationship in the hidden layer vector through the decoder in the target unsupervised generation model based on the preset greedy algorithm or beam search algorithm, generates a new text sequence according to the preset sequence order and the target words, thereby obtaining the target entity relationship information, wherein the preset dictionary is a dictionary list composed of single Chinese characters, numbers or characters, and the list is obtained by calculating the term frequency-inverse document frequency index (TF-IDF) of the corpus based on a large amount of corpus, and comparing and analyzing the term frequency-inverse document frequency index TF-IDF with the predicted frequency value. A text sequence is generated directly according to the text to be processed and the two entities in the text to be processed, and the text sequence includes an entity relationship field. Since the entity relationship field is highly likely not to exist in the text to be processed, the problem that the existing open relationship extraction is difficult to handle indefinite type relationships is solved.

[0096] In an embodiment of the present invention, by preprocessing the entity relations, field lengths and relation triples of the relation classification data set to be processed, an initial unsupervised generation model is constructed through a pre-trained backbone model, and the preprocessed text is converted into a data format, converted into a hidden layer vector, predicted into an entity relation and generated into a text sequence through a target unsupervised generation model, thereby solving the problems of high annotation cost, low computational efficiency, inability to process overlapping samples and the existence of the problem of calculating a large matrix with the number of rows and columns being the length of the input sentence when expanding to an open problem, thereby solving the problem that the existing open relation extraction is difficult to process relations of indefinite types.

[0097] See also Figure 2 Another embodiment of the method for extracting an open entity relationship in the embodiment of the present invention includes:

[0098] 201. Create a synonym dictionary, and obtain the relation classification data set to be processed, and the target synonyms corresponding to the relation classification data set to be processed in the synonym dictionary.

[0099] Specifically, the server obtains target word data that has been processed by deduplication and fusion, generates a character string for the target word data according to the configured synonym definition information, and obtains a synonym dictionary; obtains the relational classification data set to be processed, and the entities and entity relationships of the relational classification data set to be processed; performs part-of-speech tagging on the relational classification data set to be processed, and randomly selects target entities and target entity relationships from the entities and entity relationships; traverses the synonym dictionary according to the target entities and target entity relationships to obtain corresponding target synonyms.

[0100] The configured synonym definition information may be the mapping type and corresponding relationship of the synonyms. The server downloads word data from the webpages or word libraries of github.com / fighting41lov / funNLP, github.com / liuhuanyong / ChineseSemanticKB and Harbin Institute of Technology Dictionary by calling a preset download interface or downloading plug-in, performs data preprocessing and de-duplication fusion processing on the word data, obtains the target word data after de-duplication fusion processing, and constructs a graph according to the data structure of the list composed of two-tuples (word, word) and the target word data, and stores the graph in json format to obtain a synonym dictionary, wherein in the graph, words with similar meanings are connected.

[0101] The server obtains the part of speech of synonyms in the synonym dictionary, i.e., the synonym part of speech, and extracts the entity relationship part of speech in the relationship classification dataset. The entity relationship field part of speech includes the part of speech of the entity and the part of speech of the field related to the entity relationship. The relationship classification dataset is tagged with the part of speech based on the synonym part of speech and the entity relationship part of speech to eliminate the ambiguity of the part of speech. For example, the word "swimming" can be used as a verb to represent an action in the context (the synonyms are "swimming" and "swimming"), or it can be used as a noun to represent an activity / project (the synonyms are "breaststroke" and "freestyle", etc.).

[0102] The server randomly selects a preset number of entities and entity relationships from the entities and entity relationships through a preset random selection algorithm to obtain target entities and target entity relationships, and matches the synonym dictionary based on the target entities and target entity relationships to obtain corresponding target synonyms, where the number of target synonyms includes one or more.

[0103] 202. Using target synonyms, synonym replacement is performed on the relation classification dataset to be processed to obtain an enhanced dataset.

[0104] The server modifies the word character string corresponding to the target synonym in the relation classification data set to be processed into the character string corresponding to the target synonym, thereby obtaining an enhanced data set.

[0105] 203. Filter the enhanced data set according to a preset entity field length and a preset sentence length to obtain a filtered data set.

[0106] Specifically, the server classifies the enhanced data set based on the preset entity field length to obtain a first data set and a second data set, the first data set is used to indicate compliance with the preset entity field length, and the second data set is used to indicate non-compliance with the preset entity field length; classifies the first data set and the second data set according to the preset sentence length to obtain a target data set and a non-target data set, the target data set is used to indicate compliance with the preset sentence length, and the non-target data set is used to indicate non-compliance with the preset sentence length; performs gap filling and masking processing on the sentences in the non-target data set to obtain filled data; and determines the filled data and the target data set as the filtered data set.

[0107] The server obtains the initial entity field length of the enhanced data set and the initial sentence length of the statement. The server uses an if-else judgment script to determine whether the initial entity field length is greater than the preset entity field length. If not, the field corresponding to the initial entity field length is determined as the entity to obtain a first data set that meets the preset entity field length. If so, the field corresponding to the initial entity field length is not determined as the entity to obtain a second data set that does not meet the preset entity field length. The preset entity field length is determined according to the statistical results. In the Chinese case, k=7 is generally taken. The server can also filter the fields of each statement in the enhanced data set based on the preset entity field length and the initial entity field length through a preset function (such as the filter function in the Python language). For example, the fields of each statement in the enhanced data set are a list lst. Through lst_new=list(filter(x:len(x)>7, lst)), the fields of each statement in the enhanced data set are filtered based on the preset entity field length and the initial entity field length.

[0108] The server determines whether the initial sentence length is a preset sentence length, which may be the number of characters in a text sentence, for example: the preset sentence length is 128 characters, and a text sentence includes 128 characters. If so, a target data set that meets the preset sentence length is obtained; if not, a non-target data set that does not meet the preset sentence length is obtained, and characters of data in the non-target data set whose initial sentence length is greater than the preset sentence length are truncated to obtain truncated data, and data in the non-target data set whose initial sentence length is less than the preset sentence length are filled with spaces, and the filled spaces are masked to obtain filled data, thereby obtaining a filtered data set.

[0109] 204. Obtain a set of relation triples of the filtered data set, and perform alignment and de-duplication processing on the set of relation triples using a preset regular expression to obtain a data set to be processed.

[0110] Specifically, the server extracts an initial relation triple set and an initial relation phrase set corresponding to the initial relation triple set in the filtered data set; performs alignment analysis on the initial relation triple set according to the initial relation phrase set to obtain a plurality of relation triples to be processed and a plurality of target relation triples, wherein the plurality of relation triples to be processed are used to indicate that the plurality of relation triples to be processed are the same triple, and the plurality of target relation triples are used to indicate that the plurality of target relation triples are not the same triple; fuses the plurality of relation triples to be processed to obtain a plurality of fused relation triples, and determines the plurality of fused relation triples and the plurality of target relation triples as the data set to be processed.

[0111] The server extracts the initial relation triple set and the initial relation phrase set corresponding to the initial relation triple set from the filtered data set, and determines whether the relation phrases in the initial relation phrase set are consistent through a preset regular expression. If so, the corresponding relation phrase is determined to be the target relation phrase. If not, the determination continues.

[0112] Alternatively, the server extracts the initial relation triples (head entity, relation, tail entity) of each text sentence in the filtered data set to obtain an initial relation triple set, and extracts three initial relation phrases corresponding to each initial relation triple to obtain an initial relation phrase set. The server determines whether the three initial relation phrases between each initial relation triple are the same. If the three initial relation phrases between each initial relation triple are the same, then it determines whether the head entity and the tail entity between each initial relation triple are the same. If so, then it determines that the corresponding two initial relation triples are the same triple, thereby obtaining multiple relation triples to be processed. If not, then it determines that the corresponding two initial relation triples are not the same triple, thereby obtaining multiple target relation triples. If the three initial relation phrases between each initial relation triple are not the same, then the corresponding initial relation triple is determined as the target relation triple, thereby obtaining multiple target relation triples, and the multiple relation triples to be processed are fused, thereby obtaining a data set to be processed including multiple fused relation triples and multiple target relation triples, wherein the target relation triple set includes relation triples that have not been replaced by synonyms in the synonym dictionary and relation triples that have been replaced by synonyms in the synonym dictionary.

[0113] 205. An initial unsupervised generative model is constructed through a pre-trained backbone model, and the initial unsupervised generative model is trained and optimized through the data set to be processed to obtain a target unsupervised generative model.

[0114] Specifically, the server constructs an initial unsupervised generation model through a pre-trained backbone model, and divides the data set to be processed into a training data set, a verification data set and a test data set; the initial unsupervised generation model is trained through the training data set to obtain a candidate unsupervised generation model; the verification data set is subjected to hidden layer vector conversion, entity relationship prediction and text sequence generation through the candidate unsupervised generation model to obtain a verification result; the verification loss value of the verification result is calculated through a preset loss function, and the candidate unsupervised generation model is optimized according to the verification loss value to obtain an optimized unsupervised generation model; the optimized unsupervised generation model is tested through the test data set to obtain a test result, and the test loss value of the test result is calculated, and the target unsupervised generation model is determined according to the test loss value.

[0115] The server converts the data format of the training data set into the input format of the initial unsupervised generation model to obtain the training data set after format conversion, inputs the training data set after format conversion into the initial unsupervised generation model, and sequentially encodes and decodes the training data set after format conversion through the encoder and decoder in the initial unsupervised generation model, so that the parameters of the initial unsupervised generation model are suitable for the training data set, thereby achieving model fine-tuning of the initial unsupervised generation model, and obtaining a candidate unsupervised generation model.

[0116] The server converts the verification data set into a hidden layer vector set through the encoder in the candidate unsupervised generation model, and performs entity relationship prediction and text sequence generation on the hidden layer vector set through a preset dictionary to obtain the verification result.

[0117] The server uses a preset loss function, which includes but is not limited to a cross-entropy loss function, to calculate the cross entropy between the verification data set and the verification result, i.e., the verification loss value. According to the verification loss value, the server iteratively adjusts the hyperparameters and / or model network structure of the candidate unsupervised generation model until the loss function converges, thereby obtaining an optimized unsupervised generation model to improve the accuracy of the optimized unsupervised generation model.

[0118] The server optimizes the unsupervised generation model, performs hidden layer vector conversion, entity relationship prediction, and text sequence generation on the test data set to obtain the test results, and calculates the test loss value of the test results to determine whether the test loss value is greater than a preset threshold. If so, the optimized unsupervised generation model is iteratively optimized to obtain the target unsupervised generation model. If not, the optimized unsupervised generation model is determined as the target unsupervised generation model.

[0119] By directly generating a text sequence based on the text sentences and two entities in the relation classification dataset to be processed, the text sequence includes an entity relationship field, wherein the entity relationship field is highly likely not to exist in the input text (i.e., the text sentences in the relation classification dataset to be processed), thereby solving the problem that the existing open relation extraction is difficult to handle indefinite type relations.

[0120] 206. Obtain the text to be processed, and perform word segmentation and word pairing processing on the text to be processed to obtain a preprocessed text.

[0121] The server receives the text to be processed from the preset display interface or terminal, and performs word segmentation on the text to be processed through the preset open source library Jieba to obtain a word segmentation list, and then takes out the words from the word segmentation list in pairs according to the order of the word segmentation list to achieve word pairing processing to obtain the preprocessed text. The word pairing processing will not significantly affect the efficiency of the target unsupervised generation model. For example, if there are N words, then they need to be paired N (N-1) / 2 times. On average, N = 5 in a sentence, and 10 pairs are required. The model takes about 1 second to make an inference, and 10 seconds for 10 inferences. This order of magnitude will not significantly affect the efficiency of the model.

[0122] 207. Through the target unsupervised generation model, the preprocessed text is converted into data format, hidden layer vector, entity relationship prediction and text sequence generation to obtain the target entity relationship information.

[0123] Specifically, the server converts the data format of the preprocessed text into the encoding input format of the target unsupervised generation model to obtain the converted text, and the target unsupervised generation model includes an encoder and a decoder; the encoder performs data fitting on the converted text to obtain a hidden layer vector; the decoder obtains the corresponding target words from a preset dictionary based on a preset greedy algorithm and hidden layer vector; and generates a text sequence according to the target words to obtain target entity relationship information.

[0124] For example, the server converts the data format of the preprocessed text into the encoding input format of the target unsupervised generation model: [CLS]XXX<entity_head> XXX< / entity_head> XXX<entity_tail>

[0125] XXX< / entity_tail> XXX[SEP]YYY , where [CLS] is the classification bit and has no practical meaning; [SEP] is the partition bit, the content before [SEP] is the input content during reasoning, and the content after [SEP] is the generated content; is the termination bit, indicating the end of relationship generation; <tag> and< / tag>The enclosed part is the mention of the entity in the sentence; the content enclosed by [SEP] and is the generated entity relationship; the converted text is data fitted through the embedding layer and multi-layer neural network of the encoder in the target unsupervised generation model, that is, the converted text is converted into a hidden vector to obtain a hidden vector, which includes multiple word vectors. The server calculates the joint probability between every two word vectors in the hidden vector through the decoder in the target unsupervised generation model, and selects the corresponding target words from the preset dictionary according to the joint probability through a preset greedy algorithm, and generates a text sequence for the target words according to the sequence order of the word vectors, thereby obtaining the target entity relationship information, that is, selecting the most suitable character (that is, the position corresponding to the maximum probability value (maximum value of the joint probability) predicted by the target unsupervised generation model) from the preset dictionary table attached to the backbone model and connecting it to the text to be processed, so as to realize the extraction, prediction and regeneration sequence of the entity relationship of the text to be processed.

[0126] In an embodiment of the present invention, by preprocessing the entity relations, field lengths and relation triples of the relation classification data set to be processed, an initial unsupervised generation model is constructed through a pre-trained backbone model, and the preprocessed text is converted into a data format, converted into a hidden layer vector, predicted into an entity relation and generated into a text sequence through a target unsupervised generation model, thereby solving the problems of high annotation cost, low computational efficiency, inability to process overlapping samples and the existence of the problem of calculating a large matrix with the number of rows and columns being the length of the input sentence when expanding to an open problem, thereby solving the problem that the existing open relation extraction is difficult to process relations of indefinite types.

[0127] The above describes the method for extracting an open entity relationship in an embodiment of the present invention. The following describes the device for extracting an open entity relationship in an embodiment of the present invention. Figure 3 , an embodiment of an open entity relationship extraction device in an embodiment of the present invention includes:

[0128] The first preprocessing module 301 is used to obtain a relation classification data set to be processed, and preprocess the entity relationship, field length and relation triple of the relation classification data set to be processed to obtain the data set to be processed;

[0129] The training optimization module 302 is used to construct an initial unsupervised generation model through a pre-trained backbone model, and train and optimize the initial unsupervised generation model through a data set to be processed to obtain a target unsupervised generation model;

[0130] The second preprocessing module 303 is used to obtain the text to be processed, and perform word segmentation and word pairing processing on the text to be processed to obtain a preprocessed text;

[0131] The extraction module 304 is used to perform data format conversion, hidden layer vector conversion, entity relationship prediction and text sequence generation on the preprocessed text through the target unsupervised generation model to obtain the target entity relationship information.

[0132] The functional implementation of each module in the above-mentioned open entity relationship extraction device corresponds to each step in the above-mentioned open entity relationship extraction method embodiment, and its functions and implementation processes will not be repeated here one by one.

[0133] In an embodiment of the present invention, by preprocessing the entity relations, field lengths and relation triples of the relation classification data set to be processed, an initial unsupervised generation model is constructed through a pre-trained backbone model, and the preprocessed text is converted into a data format, converted into a hidden layer vector, predicted into an entity relation and generated into a text sequence through a target unsupervised generation model, thereby solving the problems of high annotation cost, low computational efficiency, inability to process overlapping samples and the existence of the problem of calculating a large matrix with the number of rows and columns being the length of the input sentence when expanding to an open problem, thereby solving the problem that the existing open relation extraction is difficult to process relations of indefinite types.

[0134] See also Figure 4 Another embodiment of the device for extracting an open entity relationship in the embodiment of the present invention includes:

[0135] The first preprocessing module 301 is used to obtain a relation classification data set to be processed, and preprocess the entity relationship, field length and relation triple of the relation classification data set to be processed to obtain the data set to be processed;

[0136] The first preprocessing module 301 specifically includes:

[0137] Creating an acquisition unit 3011, used to create a synonym dictionary, and acquire the relation classification data set to be processed, and the target synonyms corresponding to the relation classification data set to be processed in the synonym dictionary;

[0138] A replacement unit 3012 is used to perform synonym replacement on the relation classification data set to be processed by using the target synonym to obtain an enhanced data set;

[0139] A filtering unit 3013, configured to filter the enhanced data set according to a preset entity field length and a preset sentence length to obtain a filtered data set;

[0140] The processing unit 3014 is used to obtain a set of relation triples of the filtered data set, and perform alignment and deduplication processing on the set of relation triples through a preset regular expression to obtain a data set to be processed;

[0141] The training optimization module 302 is used to construct an initial unsupervised generation model through a pre-trained backbone model, and train and optimize the initial unsupervised generation model through a data set to be processed to obtain a target unsupervised generation model;

[0142] The second preprocessing module 303 is used to obtain the text to be processed, and perform word segmentation and word pairing processing on the text to be processed to obtain a preprocessed text;

[0143] The extraction module 304 is used to perform data format conversion, hidden layer vector conversion, entity relationship prediction and text sequence generation on the preprocessed text through the target unsupervised generation model to obtain the target entity relationship information.

[0144] Optionally, the creation and acquisition unit 3011 may also be specifically used for:

[0145] Obtain target word data that has undergone deduplication and fusion processing, generate character strings for the target word data according to the configured synonym definition information, and obtain a synonym dictionary;

[0146] Obtaining a relational classification data set to be processed, and entities and entity relationships of the relational classification data set to be processed;

[0147] Perform part-of-speech tagging on the relation classification dataset to be processed, and randomly select target entities and target entity relationships from entities and entity relationships;

[0148] Traverse the synonym dictionary according to the target entity and the target entity relationship to obtain the corresponding target synonym.

[0149] Optionally, the filtering unit 3013 may also be specifically used for:

[0150] Based on the preset entity field length, the enhanced data set is classified to obtain a first data set and a second data set, the first data set is used to indicate compliance with the preset entity field length, and the second data set is used to indicate non-compliance with the preset entity field length;

[0151] According to the preset sentence length, the first data set and the second data set are classified to obtain a target data set and a non-target data set, wherein the target data set is used to indicate that the preset sentence length is met, and the non-target data set is used to indicate that the preset sentence length is not met;

[0152] Perform gap filling and masking processing on the sentences in the non-target data set to obtain filled data;

[0153] Identify the fill data and the target data set as the filter data set.

[0154] Optionally, the processing unit 3014 may also be specifically configured to:

[0155] Extracting an initial relation triple set from the filtered data set and an initial relation phrase set corresponding to the initial relation triple set;

[0156] According to the initial relation phrase set, an alignment analysis is performed on the initial relation triple set to obtain a plurality of relation triples to be processed and a plurality of target relation triples, wherein the plurality of relation triples to be processed are used to indicate that the plurality of relation triples to be processed are the same triple, and the plurality of target relation triples are used to indicate that the plurality of target relation triples are not the same triple;

[0157] A plurality of relation triplets to be processed are fused to obtain a plurality of fused relation triplets, and the plurality of fused relation triplets and a plurality of target relation triplets are determined as a data set to be processed.

[0158] Optionally, the extraction module 304 may also be specifically used for:

[0159] Convert the data format of the preprocessed text into the encoding input format of the target unsupervised generation model to obtain the converted text, where the target unsupervised generation model includes an encoder and a decoder;

[0160] The encoder is used to fit the converted text to obtain the hidden layer vector.

[0161] Through the decoder, based on the preset greedy algorithm and hidden layer vector, the corresponding target word is obtained from the preset dictionary;

[0162] Generate a text sequence based on the target word to obtain the target entity relationship information.

[0163] Optionally, the training optimization module 302 may also be specifically used for:

[0164] Build an initial unsupervised generative model through the pre-trained backbone model, and divide the dataset to be processed into training dataset, validation dataset and test dataset;

[0165] The initial unsupervised generation model is trained through the training data set to obtain a candidate unsupervised generation model;

[0166] Through the candidate unsupervised generation model, the validation data set is subjected to hidden layer vector conversion, entity relationship prediction, and text sequence generation to obtain validation results.

[0167] The verification loss value of the verification result is calculated by a preset loss function, and the candidate unsupervised generation model is optimized according to the verification loss value to obtain an optimized unsupervised generation model;

[0168] The optimized unsupervised generation model is tested through the test data set to obtain the test results, and the test loss value of the test results is calculated. The target unsupervised generation model is determined according to the test loss value.

[0169] The functional implementation of each module and each unit in the above-mentioned open entity relationship extraction device corresponds to each step in the above-mentioned open entity relationship extraction method embodiment, and their functions and implementation processes are no longer repeated here.

[0170] In an embodiment of the present invention, by preprocessing the entity relations, field lengths and relation triples of the relation classification data set to be processed, an initial unsupervised generation model is constructed through a pre-trained backbone model, and the preprocessed text is converted into a data format, converted into a hidden layer vector, predicted into an entity relation and generated into a text sequence through a target unsupervised generation model, thereby solving the problems of high annotation cost, low computational efficiency, inability to process overlapping samples and the existence of the problem of calculating a large matrix with the number of rows and columns being the length of the input sentence when expanding to an open problem, thereby solving the problem that the existing open relation extraction is difficult to process relations of indefinite types.

[0171] above Figure 3 and Figure 4 The apparatus for extracting the open entity relationship in the embodiment of the present invention is described in detail from the perspective of modular functional entities. The apparatus for extracting the open entity relationship in the embodiment of the present invention is described in detail from the perspective of hardware processing.

[0172] Figure 5 1 is a schematic diagram of the structure of an open entity relationship extraction device provided by an embodiment of the present invention. The open entity relationship extraction device 500 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 510 (for example, one or more processors) and a memory 520, and one or more storage media 530 (for example, one or more mass storage devices) storing application programs 533 or data 532. Among them, the memory 520 and the storage medium 530 can be short-term storage or permanent storage. The program stored in the storage medium 530 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the open entity relationship extraction device 500. Furthermore, the processor 510 can be configured to communicate with the storage medium 530 to execute a series of instruction operations in the storage medium 530 on the open entity relationship extraction device 500.

[0173] The open entity relationship extraction device 500 may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input and output interfaces 560, and / or one or more operating systems 531, such as Windows Serve, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art will appreciate that Figure 5 The illustrated structure of the open entity relationship extraction device does not constitute a limitation on the open entity relationship extraction device, and may include more or fewer components than illustrated, or a combination of certain components, or a different arrangement of components.

[0174] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium, and when the instructions are executed on a computer, the computer executes the steps of the method for extracting open entity relationships.

[0175] Furthermore, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.

[0176] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0177] 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.

[0178] 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 for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of various embodiments 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, etc., various media that can store program codes.

[0179] 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 extracting open entity relationships, characterized in that: The method for extracting the open entity relationship includes: Acquire a relational classification data set to be processed, and preprocess the entity relationship, field length, and relation triples of the relational classification data set to be processed to obtain the data set to be processed; The step of obtaining a relational classification data set to be processed and preprocessing the entity relationship, field length and relation triples of the relational classification data set to be processed to obtain the data set to be processed includes: Creating a synonym dictionary, and obtaining a relation classification data set to be processed, and a target synonym corresponding to the relation classification data set to be processed in the synonym dictionary; Using the target synonyms, synonym replacement is performed on the relation classification dataset to be processed to obtain an enhanced dataset; Filtering the enhanced data set according to a preset entity field length and a preset sentence length to obtain a filtered data set; Acquire a set of relation triples of the filtered data set, and perform alignment and de-duplication processing on the set of relation triples using a preset regular expression to obtain a data set to be processed; Constructing an initial unsupervised generative model through a pre-trained backbone model, and training and optimizing the initial unsupervised generative model through the data set to be processed to obtain a target unsupervised generative model; Acquire a text to be processed, and perform word segmentation and word pairing processing on the text to be processed to obtain a preprocessed text; Through the target unsupervised generation model, the preprocessed text is subjected to data format conversion, hidden layer vector conversion, entity relationship prediction and text sequence generation to obtain target entity relationship information; The method of performing data format conversion, hidden layer vector conversion, entity relationship prediction and text sequence generation on the preprocessed text through the target unsupervised generation model to obtain target entity relationship information includes: Converting the data format of the preprocessed text into the encoding input format of the target unsupervised generation model to obtain a converted text, wherein the target unsupervised generation model includes an encoder and a decoder; Performing data fitting on the converted text by the encoder to obtain a hidden layer vector; Obtaining the corresponding target word from a preset dictionary based on a preset greedy algorithm and the hidden layer vector through the decoder; A text sequence is generated according to the target word to obtain target entity relationship information.

2. The method for extracting open entity relationships according to claim 1, characterized in that: The step of creating a synonym dictionary and obtaining a relation classification data set to be processed and a target synonym corresponding to the relation classification data set to be processed in the synonym dictionary includes: Obtaining target word data that has undergone deduplication and fusion processing, and generating character strings for the target word data according to the configured synonym definition information to obtain a synonym dictionary; Acquire a relational classification data set to be processed, and entities and entity relationships of the relational classification data set to be processed; Performing part-of-speech tagging on the relation classification data set to be processed, and randomly selecting a target entity and a target entity relationship from the entities and the entity relationships; The synonym dictionary is traversed according to the target entity and the target entity relationship to obtain a corresponding target synonym.

3. The method for extracting open entity relationships according to claim 1, characterized in that: The step of filtering the enhanced data set according to the preset entity field length and the preset sentence length to obtain the filtered data set includes: Based on a preset entity field length, the enhanced data set is classified to obtain a first data set and a second data set, wherein the first data set is used to indicate compliance with the preset entity field length, and the second data set is used to indicate non-compliance with the preset entity field length; According to a preset sentence length, the first data set and the second data set are classified to obtain a target data set and a non-target data set, wherein the target data set is used to indicate that the preset sentence length is met, and the non-target data set is used to indicate that the preset sentence length is not met; Performing gap filling and masking processing on the sentences in the non-target data set to obtain filled data; The filling data and the target data set are determined as a filtering data set.

4. The method for extracting open entity relationships according to claim 1, characterized in that: The step of obtaining a set of relation triples of the filtered data set, and performing alignment and deduplication processing on the set of relation triples by using a preset regular expression to obtain a data set to be processed includes: Extracting an initial relation triple set from the filtered data set, and an initial relation phrase set corresponding to the initial relation triple set; According to the initial relation phrase set, the initial relation triple set is aligned and analyzed to obtain a plurality of relation triples to be processed and a plurality of target relation triples, wherein the plurality of relation triples to be processed are used to indicate that the plurality of relation triples to be processed are the same triple, and the plurality of target relation triples are used to indicate that the plurality of target relation triples are not the same triple; The multiple to-be-processed relation triplets are fused to obtain multiple fused relation triplets, and the multiple fused relation triplets and the multiple target relation triplets are determined as the to-be-processed data sets.

5. The method for extracting open entity relationships according to any one of claims 1 to 4, characterized in that: The initial unsupervised generative model is constructed by using the pre-trained backbone model, and the initial unsupervised generative model is trained and optimized by using the data set to be processed to obtain a target unsupervised generative model, including: Constructing an initial unsupervised generative model through a pre-trained backbone model, and dividing the data set to be processed into a training data set, a validation data set, and a test data set; Training the initial unsupervised generative model using the training data set to obtain a candidate unsupervised generative model; Through the candidate unsupervised generation model, the verification data set is subjected to hidden layer vector conversion, entity relationship prediction and text sequence generation to obtain a verification result; Calculating a verification loss value of the verification result by using a preset loss function, and optimizing the candidate unsupervised generation model according to the verification loss value to obtain an optimized unsupervised generation model; The optimized unsupervised generation model is tested using the test data set to obtain a test result, and a test loss value of the test result is calculated, and a target unsupervised generation model is determined based on the test loss value.

6. An open entity relationship extraction device, characterized in that: The open entity relationship extraction device comprises: The first preprocessing module is used to obtain a relational classification data set to be processed, and preprocess the entity relationship, field length and relationship triple of the relational classification data set to be processed to obtain the relational classification data set to be processed; wherein, the obtaining of the relational classification data set to be processed, and preprocessing the entity relationship, field length and relationship triple of the relational classification data set to be processed to obtain the relational classification data set to be processed, includes: creating a synonym dictionary, and obtaining the relational classification data set to be processed, and target synonyms corresponding to the relational classification data set to be processed in the synonym dictionary; performing synonym replacement on the relational classification data set to be processed by the target synonyms to obtain an enhanced data set; filtering the enhanced data set according to a preset entity field length and a preset sentence length to obtain a filtered data set; obtaining a relation triple set of the filtered data set, and performing alignment processing and deduplication processing on the relation triple set by a preset regular expression to obtain the relational classification data set to obtain the relational classification data set to be processed; A training optimization module is used to construct an initial unsupervised generative model through a pre-trained backbone model, and train and optimize the initial unsupervised generative model through the data set to be processed to obtain a target unsupervised generative model; A second preprocessing module is used to obtain a text to be processed, and perform word segmentation and word pairing processing on the text to be processed to obtain a preprocessed text; The extraction module is used to perform data format conversion, hidden layer vector conversion, entity relationship prediction and text sequence generation on the preprocessed text through the target unsupervised generation model to obtain target entity relationship information; wherein, the data format conversion, hidden layer vector conversion, entity relationship prediction and text sequence generation on the preprocessed text through the target unsupervised generation model to obtain target entity relationship information includes: converting the data format of the preprocessed text into the encoding input format of the target unsupervised generation model to obtain converted text, the target unsupervised generation model includes an encoder and a decoder; performing data fitting on the converted text through the encoder to obtain a hidden layer vector; obtaining the corresponding target word from a preset dictionary through the decoder based on a preset greedy algorithm and the hidden layer vector; generating a text sequence according to the target word to obtain the target entity relationship information.

7. An open entity relationship extraction device, characterized in that: The open entity relationship extraction device comprises: a memory and at least one processor, wherein the memory stores instructions; The at least one processor calls the instructions in the memory to enable the open entity relationship extraction device to execute the open entity relationship extraction method as described in any one of claims 1-5.

8. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed by the processor, a method for extracting open entity relationships as described in any one of claims 1-5 is implemented.

Citation Information

Patent Citations

  • Dependency semantic-based Chinese unsupervised open entity relationship extraction method

    CN107291687A

  • Character relationship extraction method and device, computer device and computer readable memory medium

    CN108959418A