An entity relationship extraction method and device, electronic equipment and storage medium

By combining the embedding vectors of textual information and using a pre-trained classifier in entity relation extraction, the problems of entity nesting and entity pair overlap are solved, thereby improving the accuracy and recall of entity relation extraction.

CN115879449BActive Publication Date: 2026-05-12STATE GRID INFORMATION & TELECOMM BRANCH
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
STATE GRID INFORMATION & TELECOMM BRANCH
Filing Date
2022-11-07
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Existing technologies suffer from entity nesting and entity pair overlap in entity relationship extraction, leading to poor error and generalization, difficulty in effectively handling relationship overlap, and low recall.

Method used

By acquiring text information from a pre-defined text library, embedding vectors are determined. Any two embedding vector pairs are combined using an enumeration method and saved as a labeled combination result. A pre-trained classifier is used to determine entity relationships, ensuring the close correlation of each element during the triplet extraction process.

Benefits of technology

It improves the accuracy of entity relation extraction, reduces errors and poor generalization, and increases the recall rate of entity relation extraction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115879449B_ABST
    Figure CN115879449B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose an entity relation extraction method, device, electronic equipment and storage medium. The method comprises: obtaining at least one text information in a preset text library; determining an embedding vector corresponding to the text information; determining a vector pair corresponding to any two embedding vectors, and saving each vector pair to a label combination result; determining an entity relation corresponding to the text information according to the label combination result and a pre-trained classifier. In the embodiments of the present application, the pre-trained classifier is used to analyze the embedding vector of the text information, and the entity relation of the text information is extracted, so that the problems of entity nesting and entity pair overlap can be solved, the error can be reduced, the problem of poor generalization can be solved, and the accuracy of entity relation extraction is improved on the basis of ensuring the close correlation of each element in the triple extraction process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of natural language processing technology, and in particular to a method, apparatus, electronic device, and storage medium for extracting entity relationships. Background Technology

[0002] In recent years, the rapid development of internet information technology has led to the generation of massive amounts of new data daily on news, social networking, and other websites. This data contains a wide variety of content, much of which is highly valuable and plays a crucial role in people's lives. To extract and effectively utilize this valuable information, the concept of knowledge graphs has been proposed. Although existing knowledge graphs already contain hundreds of millions of data points, the amount of information on the internet continues to increase daily, necessitating continuous improvement and refinement of the information within knowledge graphs.

[0003] In existing technologies, the traditional pipeline method first identifies entities and then extracts a relation for each possible pair of entities. This framework makes the task easy to execute, but it ignores the interdependent and inseparable relationship between entities and relations, potentially leading to errors and poor generalization in the final identification results. Relation-based attention mechanisms optimize sentence feature representations by mapping relation extraction to entity pairs for joint extraction. This design addresses the relation overlap problem to some extent, but identifying entities based on relations is challenging, and it suffers from insufficient interactivity and difficulty in efficiently resolving relation overlap. Overall, while existing methods significantly improve the interactivity of entity relations, they neglect the close correlation between elements in the triple extraction process, potentially leading to errors, poor generalization, and low recall when dealing with relation overlap. Summary of the Invention

[0004] In view of this, the present invention provides an entity relation extraction method, apparatus, electronic device and storage medium, which can solve the problems of entity nesting and entity pair overlap, reduce errors and poor generalization while ensuring the close correlation of each element in the triple extraction process, and improve the accuracy of entity relation extraction.

[0005] According to one aspect of the present invention, an embodiment of the present invention provides an entity relation extraction method, the method comprising:

[0006] Retrieve at least one text message from a preset text library;

[0007] Determine the embedding vector corresponding to the text information;

[0008] Determine any two vector pairs corresponding to the embedded vectors, and save each vector pair to the tag combination result;

[0009] The entity relationships corresponding to the text information are determined based on the combination of the tags and the pre-trained classifier.

[0010] According to another aspect of the present invention, embodiments of the present invention also provide an entity relation extraction apparatus, the apparatus comprising:

[0011] The acquisition module is used to acquire at least one text information from a preset text library;

[0012] The first determining module is used to determine the embedding vector corresponding to the text information;

[0013] The second determining module is used to determine any two vector pairs corresponding to the embedded vectors and save each vector pair to the tag combination result;

[0014] The relationship determination module is used to determine the corresponding entity relationships in the text information based on the combination result and the pre-trained classifier.

[0015] According to another aspect of the present invention, embodiments of the present invention also provide an electronic device, the electronic device comprising:

[0016] At least one processor; and

[0017] A memory communicatively connected to the at least one processor; wherein,

[0018] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the entity relation extraction method according to any embodiment of the present invention.

[0019] According to another aspect of the present invention, embodiments of the present invention also provide a computer-readable storage medium storing computer instructions for causing a processor to execute and implement the entity relation extraction method described in any embodiment of the present invention.

[0020] The technical solution of this invention involves acquiring at least one text information from a preset text library; determining the embedding vector corresponding to the text information; determining vector pairs corresponding to any two embedding vectors; saving the label combination results for each vector pair; and determining the entity relationship corresponding to the text information based on the label combination results and a pre-trained classifier. This invention, by determining vector pairs corresponding to any two embedding vectors and saving the label combination results for each vector pair, and determining the entity relationship corresponding to the text information based on the label combination results and a pre-trained classifier, can solve the problems of entity nesting and entity pair overlap. While ensuring the close correlation of each element in the triplet extraction process, it reduces errors and poor generalization, thereby improving the accuracy of entity relationship extraction.

[0021] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 A flowchart of an entity relation extraction method provided in an embodiment of the present invention;

[0024] Figure 2 A flowchart illustrating another entity relation extraction method provided in an embodiment of the present invention;

[0025] Figure 3 A flowchart illustrating another entity relation extraction method provided in an embodiment of the present invention;

[0026] Figure 4 A model diagram of an entity relation extraction method provided in an embodiment of the present invention;

[0027] Figure 5 This is a visual illustration of a pairwise combination of tokens provided in an embodiment of the present invention;

[0028] Figure 6 This is a visual illustration of a classification label provided in an embodiment of the present invention;

[0029] Figure 7 This is a structural block diagram of an entity relation extraction device provided in an embodiment of the present invention;

[0030] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

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

[0032] It should be noted that the terms "first," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0033] In one embodiment, Figure 1 This is a flowchart of an entity relation extraction method according to an embodiment of the present invention. This embodiment is applicable to the joint extraction of entity relations. The method can be executed by an entity relation extraction device, which can be implemented in hardware and / or software and can be configured in an electronic device.

[0034] like Figure 1 As shown, the specific steps include:

[0035] S110. Obtain at least one text information from a preset text library.

[0036] The preset text library, also known as an information corpus, can be understood as a data repository containing multiple texts. This library can contain Chinese text, English text, and text information in other languages. Text information can be understood as structured text data that computers can recognize, and it can be various types of text data.

[0037] In this embodiment, one or more text messages can be obtained from an information corpus. The types of the obtained text messages can be the same or different, and this embodiment does not impose any restrictions. For example, the obtained text messages can be Chinese text messages or English text messages, such as "the Great Wall is one of the wonders of the world" or "Beijing is the capital of China", etc.

[0038] S120. Determine the embedding vector corresponding to the text information.

[0039] Among them, the embedding vector, also known as the token embedding, can be understood as a representation of entities in text information, or as a set of features extracted from entities.

[0040] In this embodiment, text information can be input into a corresponding pre-trained language model to encode the text information into multiple corresponding embedding vectors. In some embodiments, text content can also be converted into embedding vectors using a text embedding model. It should be noted that the text information may contain one or more words or terms, and each word or term corresponds to one or more token embedding vectors.

[0041] S130. Determine the vector pairs corresponding to any two embedded vectors and save the result of each vector pair to the tag combination.

[0042] In this context, a vector pair, also known as a token embedding vector pair, can be understood as a vector pair obtained by combining two embedding vectors corresponding to the text information. The token combination result can be understood as the combination result of vector pairs.

[0043] In this embodiment, after representing the text words in the text information as token embedding vectors using a pre-trained language model, the embedding vectors corresponding to each text in the text information can be combined pairwise according to a preset enumeration method to form vector pairs corresponding to any two embedding vectors. The result of combining each vector pair with a token is then saved. This can be understood as using an enumeration method to enumerate all possible combinations of the embedding vectors corresponding to the text information. It should be noted that for each piece of text information, the result of forming any two embedding vector pairs includes the start embedding vector pairs corresponding to the head and tail entities of the text information, as well as the end embedding vector pairs corresponding to the head and tail entities, respectively.

[0044] S140. Determine the entity relationships corresponding to the text information based on the label combination results and the pre-trained classifier.

[0045] In this context, a pre-trained classifier can be understood as a pre-trained classifier obtained by using training samples and test samples, which can then be applied to predict entity relationships in textual information.

[0046] In this embodiment, the combined result of the vector pairs can be input into a pre-trained classifier. The pre-trained classifier determines the embedding vector labels corresponding to the start and end embedding vector pairs, respectively, and decodes the head entity, tail entity, and corresponding entity relationship type of the text information based on these embedding vector labels. It should be noted that the pre-trained classifier in this embodiment includes at least two types of classifiers, which can be used to classify the start embedding vector pairs corresponding to the head and tail entities of the text information, and to classify the end embedding vector pairs corresponding to the head and tail entities, respectively.

[0047] In this embodiment, the classifier training process can be achieved by designing the embedding vector labels corresponding to the start embedding vector pairs and end embedding vector pairs into three categories, respectively. The trained classifier is obtained by training the embedding vector labels corresponding to the start and end embedding vector pairs. For example, this embodiment uses the classification of start embedding vector pairs as an example. The start embedding vector pair labels are designed as three categories: 0, 1, and 2. 0 indicates that the start embedding vector pair does not belong to the head structure of the start embedding vector pair of the head and tail entities under a specific relation; 1 indicates that the start embedding vector pair belongs to the head structure of the entity pair under the specific relation; 2 indicates that the start embedding vector pair belongs to the head structure of the start embedding vector pair of the entity pair under the specific relation, but the head entity is located at the end of the text and the tail entity is located at the beginning of the text.

[0048] The technical solution of this invention involves acquiring at least one text information from a preset text library; determining the embedding vector corresponding to the text information; determining vector pairs corresponding to any two embedding vectors; saving the label combination results for each vector pair; and determining the entity relationships corresponding to the text information based on the label combination results and a pre-trained classifier. This invention, by using a pre-trained classifier to analyze the embedding vectors of the text information and extracting the entity relationships, solves the problems of entity nesting and entity pair overlap. While ensuring the close correlation of each element in the triplet extraction process, it reduces errors, solves the problem of poor generalization, and improves the accuracy of entity relationship extraction.

[0049] In one embodiment, before acquiring at least one text information from a preset text library, the method further includes:

[0050] Perform text preprocessing on the text information;

[0051] The text information obtained after text preprocessing is stored in a preset text library.

[0052] In this embodiment, unstructured text information can be preprocessed, and the preprocessed text information can be stored in a preset text library. The preprocessing includes at least word segmentation and part-of-speech tagging, deletion of stop words, syntactic analysis, deduplication, removal of URL characters, removal of punctuation marks, and removal of user identifiers.

[0053] In one embodiment, the text preprocessing method includes at least one of the following:

[0054] Use a word segmentation tool to segment at least one piece of text information and label the part-of-speech tag of each segmented word;

[0055] Remove at least one stop word from the text.

[0056] Perform syntactic structure analysis on at least one text message according to pre-configured syntactic processing rules, and obtain the analysis results;

[0057] A preset text similarity algorithm is used to remove duplicates from at least one text message.

[0058] The word segmentation tools can include ansj, hanlp, jieba, etc., which can perform word segmentation, part-of-speech tagging, and proper noun recognition. The preset text similarity algorithms can include Euclidean distance calculation and cosine similarity algorithms.

[0059] In this embodiment, the preprocessing of the information corpus includes word segmentation and part-of-speech tagging, stop word removal, and syntactic analysis. Specific preprocessing steps include: using regular expression matching to remove URL characters, punctuation marks, and user identifiers. Unstructured raw data is converted into structured data that a computer can recognize. Unlike English text, Chinese text does not have spaces to directly segment sentences into words. Word segmentation tools such as jieba and hanlp are used to segment the sentence text into multiple words. After word segmentation, the part-of-speech tagging of each segmented word is used to determine its part of speech, which may include, but is not limited to, verbs, nouns, adjectives, prepositions, and adverbs. In addition, stop words can be removed, including but not limited to prepositions, function words, and pronouns. Syntactic structure analysis can also be performed on at least one piece of acquired text information according to pre-configured grammatical processing rules to remove all unnecessary characters from the program. A preset text similarity algorithm is used to deduplicate at least one piece of text information, and simplified / traditional character conversion can also be performed. It should be noted that by using a word segmentation tool to divide at least one piece of text information and labeling the part-of-speech tag of each segmented word, long words can be further segmented, improving recall rate, making it suitable for word segmentation in search engines.

[0060] In one embodiment, Figure 2 This is a flowchart of another entity relation extraction method provided in an embodiment of the present invention. Based on the above embodiments, this embodiment further refines the following steps: determining the embedding vector corresponding to the text information; determining the vector pair corresponding to any two embedding vectors and saving each vector pair to the label combination result; and determining the entity relation corresponding to the text information based on the label combination result and the pre-trained classifier.

[0061] like Figure 2 As shown, the entity relationship extraction method in this embodiment may specifically include the following steps:

[0062] S210. Obtain at least one text information from a preset text library.

[0063] S220. Input the text information into the preset pre-trained language model.

[0064] The pre-trained language model can be one of several pre-trained language models, such as SpanBERT or RoBERTa.

[0065] In this embodiment, the bottom layer of the preset pre-trained language model is the word embedding layer, which can input one or more text information from the preset text library into the preset pre-trained language model to encode the text words corresponding to the input one or more text information into embedding vectors.

[0066] S230. Encode the text information into corresponding embedding vectors according to the preset pre-trained language model; wherein the text information contains at least one word, and each word corresponds to at least one embedding vector.

[0067] In this embodiment, a pre-trained language model, SpanBERT or RoBERTa, can be used to encode one or more input text information into corresponding embedding vectors. It should be noted that the text information contains at least one word, and each word corresponds to at least one embedding vector. It can be understood that since the pre-trained language model uses a byte pair encoder (BPE) tokenizer for at least one word in the text information, it may split a complete word into one or more token fragments (embedding vector fragments). It can be understood that the word sequence corresponding to the text information is input into the pre-trained language model to obtain a token-level embedding vector representation.

[0068] For example, in "beijing is the capital of china", "beijing" corresponds to 2 token embedding vectors and "is" corresponds to 1 token embedding vector, thus dividing each word in the text into its corresponding token embedding vector.

[0069] S240. Combine any two embedded vectors according to the enumeration method to form a corresponding vector pair; wherein there is at least one vector pair and the vector pair contains two embedded vectors.

[0070] Among them, the enumeration method, also known as the exhaustive method or the listing method, can be understood as combining any two embedding vectors corresponding to text information one by one and listing all possible combinations.

[0071] In this embodiment, any two embedding vectors corresponding to the text information can be combined pairwise using an enumeration method to form corresponding vector pairs. Each vector pair contains at least one vector pair and includes two embedding vectors. This can be understood as using an enumeration method to combine the tokens of each text in the text information pairwise to form token pairs, which is essentially combining the embedding vectors. For example, the text information is "beijing is the capital of china". This text information has seven corresponding embedding vectors: "bei", "jing", "is", "the", "capital", "of", and "china". By combining these embedding vectors pairwise, there are 21 possible combinations, each of which is a vector pair.

[0072] S250. Each vector pair is used as the corresponding tag combination result; wherein, the tag combination result includes the start embedding vectors corresponding to the head entity and tail entity of the text information, forming a start embedding vector pair, and the end embedding vectors corresponding to the head entity and tail entity, forming an end embedding vector pair.

[0073] Here, the head entity refers to the head of the entity in the text information, and the tail entity refers to the tail of the entity.

[0074] In this embodiment, an enumeration method is used to combine any two embedding vectors corresponding to text words in the text information pairwise to form corresponding vector pairs. Each vector pair can then be used as the corresponding tag combination result. In this embodiment, the start embedding vector can include the start embedding vector of the head entity and the start embedding vector of the tail entity. The vector pair consisting of the start embedding vectors of the head entity and the tail entity is the start embedding vector pair. The end embedding vector can include the end embedding vector of the head entity and the end embedding vector of the tail entity. The end embedding vector consisting of the end embedding vectors of the head entity and the tail entity can form the end embedding vector pair. For example, in the text information "beijing is the capital of china", the corresponding "bei" + "Ġchina" is the start embedding vector pair, and "jing" + "Ġchina" is the end embedding vector pair.

[0075] S260. Input the label combination result into a pre-trained classifier; wherein the classifier includes at least two classifiers.

[0076] In this embodiment, any two embedding vectors can be combined, and the resulting vector pairs are input into two pre-trained classifiers to obtain different results through different types of classifiers.

[0077] S270. Determine the first embedding vector label corresponding to the start embedding vector pair and the second embedding vector label corresponding to the end embedding vector pair based on the pre-trained classifier.

[0078] Here, the first embedding vector label refers to the embedding vector label corresponding to the starting embedding vector pair. The second embedding vector label refers to the embedding vector label corresponding to the ending embedding vector pair. It should be noted that the first and second embedding vector labels can be designed and trained manually based on experience.

[0079] In this embodiment, a first embedding vector label corresponding to the start embedding vector pair and a second embedding vector label corresponding to the end embedding vector pair are determined based on a pre-trained classifier. This can be understood as one classifier classifying the start embedding vector pair and another classifier classifying the end embedding vector pair; using two classifiers, the start embedding vector pair and its corresponding embedding vector label can be obtained respectively. In some embodiments, the first and second embedding vector labels contain at least three types of embedding vector labels. For example, the first embedding vector label is designed with three categories: 0, 1, and 2, with different types representing different meanings.

[0080] S280. Based on the first embedded vector label and the second embedded vector label, decode the head entity, tail entity and corresponding entity relationship type corresponding to the text information.

[0081] In this embodiment, the head entity, tail entity, and corresponding entity relation type corresponding to the text information can be decoded based on the first and second embedding vector labels. This can be understood as the decoding layer decoding the tags based on the tokens predicted by the classification layer, and the specific relation. Specifically, since each relation is predicted to have two sets of start embedding vector pairs and end embedding vector pairs, the head entity can be decoded based on the span between the start and end embedding vectors of the head entity, and the tail entity can be decoded based on the span between the start and end embedding vectors of the tail entity. Simultaneously, by extracting the entity relation type, the corresponding fact triple can be decoded.

[0082] The technical solution described in this embodiment combines any two embedding vectors using an enumeration method to form corresponding vector pairs. Each vector pair is then used as a corresponding label combination result, which is input into a pre-trained classifier. The pre-trained classifier determines the first embedding vector label corresponding to the starting embedding vector pair and the second embedding vector label corresponding to the ending embedding vector pair. Based on the first and second embedding vector labels, the head entity, tail entity, and corresponding entity relationship type corresponding to the text information are decoded. This approach can specifically address issues such as entity nesting and entity pair overlap. The classifier classification method can fully capture the dependencies between the elements of the triples, further improving the accuracy of entity relationship extraction.

[0083] In one embodiment, to facilitate a better understanding of the entity relation extraction method, Figure 3 This is a flowchart of another entity relation extraction method provided in an embodiment of the present invention. Figure 4 This is a model diagram of an entity relation extraction method provided in one embodiment of the present invention. This embodiment is based on a joint extraction model of entity pair classification. This model employs a relation enumeration and token pair integration approach, using a classifier to obtain the start and end token pairs of entity pairs, and decoding the entity pairs under specific relations. This can specifically solve problems such as entity nesting and entity pair overlap. The classifier classification method can fully capture the dependencies between the elements of the triples. By fully capturing the interdependencies of the elements of the triples, entities and relations are determined. This embodiment can be used as a preferred embodiment to further illustrate the entity relation extraction method.

[0084] In this embodiment, the pre-trained language model Roberta is represented as the pre-trained language model in the above embodiments; the text corpus is represented as the preset text library in the above embodiments; the token embedding is represented as the embedding vector in the above embodiments; the token pair is represented as the vector pair in the above embodiments; "HB-to-TB" represents the start embedding vector corresponding to the head entity and tail entity in the above embodiments; "HE-to-TE" represents the end embedding vector corresponding to the head entity and tail entity in the above embodiments; the token pair labels corresponding to "HB-to-TB" and "HE-to-TE" are respectively represented as the first embedding vector label and the second embedding vector label in the above embodiments.

[0085] like Figure 3 As shown, the specific process of the entity relation extraction method is as follows:

[0086] S310. Text preprocessing: Input unstructured text into a text corpus for text preprocessing. The unstructured text information is preprocessed through the text corpus, including word segmentation, part-of-speech tagging, stop word deletion, and syntactic analysis, to obtain the text corpus.

[0087] S320. Determine the embedding vector corresponding to the text information: Input at least one piece of text information from the text corpus into the pre-trained language model Roberta, and use the pre-trained language model Roberta to encode the at least one piece of text information into an embedding vector.

[0088] S330, Relation Enumeration: After representing at least one text word corresponding to the text information as a token embedding using the pre-trained language model Roberta, the relation enumeration method is used to combine the tokens of each text corresponding to the text information in pairs to form token pairs.

[0089] In this embodiment, to facilitate a convenient understanding of the token combination format, Figure 5 This is a visual illustration of a pairwise combination of tokens provided in an embodiment of the present invention. Figure 5 As shown, the embedded vectors are actually combined. Based on the enumeration method, the resulting combined token pairs are copied into two copies, one representing "HB-to-TB" and the other representing "HE-to-TE".

[0090] (1) "HB-to-TB": "HB" is an abbreviation for "Head Entity-Begin", representing the start token of the head entity; "TB" is an abbreviation for "Tail Entity-Begin", representing the start token of the tail entity. This set of tokens is embedded and will be used to predict the Begin tokens corresponding to the head and tail entities in each relation, for example... Figure 5 (1) "Be" + "ĠChina" is the content to be predicted by the "HB-to-TB" matrix; (2) "HE-to-TE": "HE" is the abbreviation of "HeadEntity-End", which represents the end token of the head entity, and "TE" is the abbreviation of "Tail Entity-End", which represents the end token of the tail entity. This set of tokens is embedded and will be used to predict the end tokens corresponding to the head and tail entities in each relation, such as Figure 5 The value in ("ijing" + "ĠChina") represents the content that the "HE-to-TE" matrix will predict the output of.

[0091] S340, Classification and Decoding: These combined token pairs are fed into a classifier to obtain the token pair labels of the "HB-to-TB" and "HE-to-TE" matrices. Finally, the head entity and tail entity are decoded, and the relation type is extracted, thus decoding the corresponding fact triples and the entities and relations corresponding to the unstructured text.

[0092] In this embodiment, to facilitate understanding of obtaining the token pair labels of the "HB-to-TB" and "HE-to-TE" matrices using a classifier, Figure 6 This is a visual illustration of a classification label provided in one embodiment of the present invention. Figure 6 As shown, the token pair representation after relation enumeration can be used to obtain the combined token pair representation corresponding to the text. Intuitively, this can be understood as enumerating all possible triple combinations. These combined token pairs are fed into two classifiers: one classifier is used to classify the "HB-to-TB" matrix, and the other classifier is used to classify the "HE-to-TE" matrix. The classifiers are used to obtain the token pair labels for the "HB-to-TB" and "HE-to-TE" matrices. Inspired by the encoding method of the joint prediction model, this method designs the token pair labels into three categories: 0, 1, and 2. Taking the token pair classification of "HB-to-TB" as an example, 0 indicates that the token pair does not belong to the head structure of the head and tail entity token pairs under a specific relation; 1 indicates that the token pair belongs to the head structure of the entity pair under a specific relation; 2 indicates that the token pair belongs to the head structure of the entity token pair under a specific relation, but the head entity is located after the text and the tail entity is located before the text. This is intuitively shown as follows: Figure 5 As shown, (“ĠChina”, “Be”) does not exist in the combined token pairs described above. Therefore, in the token pair (“Be”, “ĠChina”), under the contains relation, the position label is predicted as 2. This strategy allows enumeration of cases where the head entity is located after the tail entity. In this embodiment, the decoding layer decodes based on the token pair labels predicted by the classification layer and the specific relation. Specifically, since each relation is predicted to produce two sets of matrices (“HB-to-TB” and “HE-to-TE”), the head entity can be decoded based on the token span of “HB-HE”, and the tail entity can be decoded based on the token span of “TB-TE”. Simultaneously, by extracting the relation type, the corresponding fact triple can be decoded.

[0093] In one embodiment, Figure 7This is a structural block diagram of an entity relation extraction device according to an embodiment of the present invention. This device is suitable for joint extraction of entity relations and can be implemented in hardware or software. It can be configured in an electronic device to implement an entity relation extraction method according to an embodiment of the present invention. Figure 7 As shown, the device includes: an acquisition module 710, a first determination module 720, a second determination module 730, and a relationship determination module 740.

[0094] The acquisition module is used to acquire at least one text information from a preset text library.

[0095] The first determining module is used to determine the embedding vector corresponding to the text information;

[0096] The second determining module is used to determine any two vector pairs corresponding to the embedded vectors and save each vector pair to the tag combination result;

[0097] The relationship determination module is used to determine the corresponding entity relationships in the text information based on the combination result and the pre-trained classifier.

[0098] In this embodiment of the invention, the second determining module determines vector pairs corresponding to any two embedded vectors and saves the result of combining each vector pair with a label; the relation determining module determines the entity relations corresponding to the text information based on the label combination result and a pre-trained classifier. This solves the problems of entity nesting and entity pair overlap, and while ensuring the close correlation of each element in the triple extraction process, it reduces errors and poor generalization, thereby improving the accuracy of entity relation extraction.

[0099] In one embodiment, the device further includes:

[0100] The preprocessing module is used to preprocess the text information before acquiring at least one text information from the preset text library;

[0101] The storage module is used to store the text information obtained after text preprocessing into the preset text library.

[0102] In one embodiment, the text preprocessing method includes at least one of the following:

[0103] The at least one text information is segmented using a word segmentation tool, and the part-of-speech tag is assigned to each segmented word.

[0104] Remove stop words from the at least one text message;

[0105] The at least one text information is subjected to syntactic structure analysis according to pre-configured syntactic processing rules, and the analysis results are obtained;

[0106] A preset text similarity algorithm is used to perform a deduplication operation on the at least one text information.

[0107] In one embodiment, the first determining module 720 includes:

[0108] An input unit is used to input the text information into a preset pre-trained language model;

[0109] The encoding unit is used to encode the text information into a corresponding embedding vector according to the preset pre-trained language model; wherein the text information contains at least one word, and the word corresponds to at least one embedding vector.

[0110] In one embodiment, the second determining module 730 includes:

[0111] A combination unit is used to combine any two of the embedded vectors according to the entity enumeration method to form a corresponding vector pair; wherein, there is at least one vector pair, and the vector pair contains two of the embedded vectors;

[0112] The result determination unit is used to take each of the vector pairs as the corresponding tag combination result; wherein the tag combination result includes the start embedding vectors corresponding to the head entity and the tail entity corresponding to the text information, forming a start embedding vector pair, and the end embedding vectors corresponding to the head entity and the tail entity, forming an end embedding vector pair.

[0113] In one embodiment, the relationship determination module 740 includes:

[0114] An input unit is used to input the label combination result into the pre-trained classifier; wherein the classifier includes at least two classifiers;

[0115] The label determination unit is used to determine the first embedding vector label corresponding to the start embedding vector pair and the second embedding vector label corresponding to the end embedding vector pair based on the pre-trained classifier.

[0116] The decoding unit is used to decode the head entity, tail entity, and corresponding entity relationship type of the text information based on the first embedded vector label and the second embedded vector label.

[0117] In one embodiment, the first embedding vector label and the second embedding vector label contain at least three types of embedding vector labels.

[0118] The entity relation extraction device provided in this embodiment of the invention can execute the entity relation extraction method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method.

[0119] In one embodiment, Figure 8 This is a schematic diagram of an electronic device provided for an embodiment of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0120] like Figure 8 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0121] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0122] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as entity relation extraction methods.

[0123] In some embodiments, the entity relation extraction method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the entity relation extraction method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the entity relation extraction method by any other suitable means (e.g., by means of firmware).

[0124] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0125] Computer programs used to implement the methods of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable entity-relation extraction device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The computer programs can be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0126] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0127] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0128] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0129] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0130] In implementing the computer program product, computer program code for performing the operations of this invention can be written in one or more programming languages ​​or a combination thereof. Programming languages ​​include object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0131] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0132] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method for extracting entity relations, characterized in that, include: Retrieve at least one text message from a preset text library; Determine the embedding vector corresponding to the text information; Determine any two vector pairs corresponding to the embedded vectors, and save each vector pair to the tag combination result; The entity relationships corresponding to the text information are determined based on the tag combination results and the pre-trained classifier; The step of determining any two vector pairs corresponding to the embedded vectors and saving each vector pair to the tag combination result includes: Any two of the embedding vectors are combined according to the enumeration method to form a corresponding vector pair; wherein, there is at least one vector pair, and the vector pair contains two of the embedding vectors; Each vector pair is used as a corresponding tag combination result; wherein, the tag combination result includes the start embedding vectors corresponding to the head entity and the tail entity of the text information, forming a start embedding vector pair, and the end embedding vectors corresponding to the head entity and the tail entity, forming an end embedding vector pair; wherein, the head entity is the head of the entity in the text information, and the tail entity is the tail of the entity in the text information; the start embedding vectors corresponding to the head entity or the tail entity are the embedding vectors corresponding to the starting positions in the token sequences corresponding to the head entity or the tail entity in the text information, and the end embedding vectors corresponding to the head entity or the tail entity are the embedding vectors corresponding to the ending positions in the token sequences corresponding to the head entity or the tail entity in the text information. The step of determining the entity relationship corresponding to the text information based on the tag combination result and the pre-trained classifier includes: The combined label result is input into the pre-trained classifier; wherein the classifier includes at least two classifiers; The first embedding vector label corresponding to the start embedding vector pair and the second embedding vector label corresponding to the end embedding vector pair are determined based on the pre-trained classifier. Based on the first embedded vector label and the second embedded vector label, the head entity, tail entity and corresponding entity relationship type corresponding to the text information are decoded.

2. The method according to claim 1, characterized in that, Before retrieving at least one text message from a preset text library, the process also includes: The text information is preprocessed. The text information obtained after the text preprocessing is stored in the preset text library.

3. The method according to claim 2, characterized in that, The text preprocessing method includes at least one of the following: The at least one text information is segmented using a word segmentation tool, and the part-of-speech tag is assigned to each segmented word. Remove stop words from the at least one text message; The at least one text information is subjected to syntactic structure analysis according to pre-configured syntactic processing rules, and the analysis results are obtained; A preset text similarity algorithm is used to perform a deduplication operation on the at least one text information.

4. The method according to claim 1, characterized in that, Determining the embedding vector corresponding to the text information includes: The text information is input into a preset pre-trained language model; The text information is encoded into a corresponding embedding vector according to the preset pre-trained language model; wherein the text information contains at least one word, and the word corresponds to at least one embedding vector.

5. The method according to claim 1, characterized in that, The first embedding vector label and the second embedding vector label contain at least three types of embedding vector labels.

6. An entity relation extraction device, characterized in that, include: The acquisition module is used to acquire at least one text information from a preset text library; The first determining module is used to determine the embedding vector corresponding to the text information; The second determining module is used to determine any two vector pairs corresponding to the embedded vectors and save each vector pair to the tag combination result; A relationship determination module is used to determine the corresponding entity relationships in the text information based on the combination result and a pre-trained classifier. The second determining module includes: A combination unit is used to combine any two of the embedded vectors according to an enumeration method to form a corresponding vector pair; wherein, there is at least one vector pair, and the vector pair contains two of the embedded vectors; The result determination unit is used to take each of the vector pairs as a corresponding tag combination result; wherein, the tag combination result includes the start embedding vectors corresponding to the head entity and the tail entity of the text information, forming a start embedding vector pair, and the end embedding vectors corresponding to the head entity and the tail entity, forming an end embedding vector pair; wherein, the head entity is the head of the entity in the text information, and the tail entity is the tail of the entity in the text information; the start embedding vectors corresponding to the head entity or the tail entity are the embedding vectors corresponding to the starting positions in the token sequences corresponding to the head entity or the tail entity in the text information, and the end embedding vectors corresponding to the head entity or the tail entity are the embedding vectors corresponding to the ending positions in the token sequences corresponding to the head entity or the tail entity in the text information. The relationship determination module includes: An input unit is used to input the label combination result into the pre-trained classifier; wherein the classifier includes at least two classifiers; The label determination unit is used to determine the first embedding vector label corresponding to the start embedding vector pair and the second embedding vector label corresponding to the end embedding vector pair based on the pre-trained classifier. The decoding unit is used to decode the head entity, tail entity, and corresponding entity relationship type of the text information based on the first embedded vector label and the second embedded vector label.

7. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the entity relation extraction method according to any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the entity relation extraction method according to any one of claims 1-5.