Knowledge triple extraction method and device, electronic equipment and readable storage medium

By constructing a U-shaped entity-relational extraction model based on graph pooling network layer, graph convolutional network layer and graph anti-pooling network layer, the problem that the existing technology cannot effectively extract implicit and long-distance relationship triplets is solved, and more efficient knowledge triplet extraction is achieved.

CN119761489AInactive Publication Date: 2025-04-04TSINGHUA UNIVERSITY
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411713740.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2024-11-26
Filing Date
2024-11-27
Publication Date
2025-04-04
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing knowledge triplet extraction method cannot effectively extract implicit relationship triplets and long-distance relationship triplets in sentences.

Method used

The U-shaped entity-relational extraction model is adopted based on the graph pooling network layer, the graph convolutional network layer and the graph anti-pooling network layer. The target triplet is extracted by encoding the target text statements, dependent syntax analysis and multi-layer graph network processing.

Benefits of technology

Not only can it extract implicit relationship triplets in sentences, but it can also effectively identify long-distance relationship triplets in actual scenarios, improving the model's performance on the knowledge triplet extraction task.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119761489A_ABST
    Figure CN119761489A_ABST
Patent Text Reader

Abstract

The invention provides a knowledge triple extraction method and device, electronic equipment and a readable storage medium. The method comprises the steps of obtaining a target text statement to be subjected to triple extraction; based on a pre-trained U-shaped entity-relation extraction model, according to the target text statement, extracting to obtain a target triple; wherein the U-shaped entity-relation extraction model is constructed on the basis of a graph pooling network layer, a graph convolutional network layer and a graph anti-pooling network layer, and is obtained by training and optimizing a training sample set formed by text samples and corresponding triple labels thereof. According to the method, a target triad in a target text statement is extracted through a U-shaped entity-relation extraction model constructed based on a graph pooling network layer, a graph convolutional network layer and a graph anti-pooling network layer, so that not only can an implicit relation triad in the sentence be extracted, but also a remote relation triad in an actual scene can be effectively identified, and the extraction efficiency of the text statement is improved. The syntactic structure information is effectively utilized on the aspect of the entity relation triple extraction task, and the performance of the model on the aspect of the knowledge triple extraction task is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of natural language processing technology, and in particular to a knowledge triple extraction method, device, electronic device and readable storage medium. Background Art

[0002] Open source texts on the Internet contain a wealth of domain knowledge. This information is usually represented by entities in sentences and the relationships between entities. It is also scattered throughout a large amount of natural language text, making it difficult to effectively use and analyze. Therefore, extracting structured knowledge triples from these unstructured natural language texts is a key task in the field of natural language processing and an important foundation for building domain knowledge graphs. The task of extracting relation triples in specific domains aims to identify entity and relation information from domain texts and extract them in the form of relation triples. Through tasks such as entity fusion and entity alignment, a domain knowledge graph for the corresponding domain can be constructed based on the extracted knowledge triples, which has broad application value.

[0003] Existing knowledge triple extraction methods often rely on a large number of labeled samples for supervised learning and training of deep learning network models. However, in low-resource scenarios, the scarcity of labeled samples makes existing knowledge extraction methods unable to be applied in actual scenarios, and labeling data in professional domain scenarios also requires a lot of manpower and material resources. For example, some online reports pointed out that in order to construct a digital knowledge graph of ancient book resources, researchers have been labeling the corresponding ancient book corpus for ten years. Unlike labeling in general fields, sample labeling in professional fields often requires the full participation of experts in the corresponding field. The professional barriers of the field limit the scope of people who can label samples, making existing knowledge extraction technology unable to be directly used for domain knowledge triple extraction.

[0004] At the same time, the existing knowledge triple extraction methods still have the following two major defects.

[0005] On the one hand, existing technologies have difficulty identifying implicit relation triples in sentences. Specifically, in addition to explicit relation triples extracted directly from text, there are often implicit relation triples that require relational reasoning to extract. These implicit relation triples may not be explicitly expressed in the text description, but their existence must be determined through reasoning or logical inference. Existing technologies directly decode entities and relations in sentences, which can only identify relation type patterns that have already appeared in the model training set and cannot further explore the implicit relation descriptions in the sentence.

[0006] On the other hand, existing technologies struggle to identify long-range relation triplets in real-world scenarios. Specifically, in real-world relation triple extraction scenarios, entities are sparsely distributed, and pairs of entities with related relationships may be far apart. Existing technologies typically employ self-attention networks based on a multi-layer transformer structure to model features in long texts. However, the self-attention mechanism is inherently global and lacks a built-in local bias. This results in existing technologies being unable to effectively capture local contextual information in long texts, particularly in tasks requiring fine-grained extraction of entity relationships.

[0007] Therefore, how to solve the problem that existing knowledge triple extraction methods cannot effectively extract implicit relationship triplets and long-distance relationship triplets in sentences is an important issue that needs to be urgently solved in the field of natural language processing. Summary of the Invention

[0008] The present invention provides a knowledge triple extraction method, device, electronic device and readable storage medium to overcome the defect that the existing knowledge triple extraction method cannot effectively extract implicit relationship triples and long-distance relationship triples in sentences. It can not only extract implicit relationship triples in sentences, but also effectively identify long-distance relationship triples in actual scenarios.

[0009] On the one hand, the present invention provides a knowledge triple extraction method, including: obtaining a target text sentence to be subjected to triple extraction; extracting a target triple according to the target text sentence based on a pre-trained U-type entity-relationship extraction model; wherein the U-type entity-relationship extraction model is constructed based on a graph pooling network layer, a graph convolutional network layer, and a graph depooling network layer, and is obtained by training and optimizing a training sample set composed of text samples and their corresponding triple labels.

[0010] Furthermore, the U-shaped entity-relationship extraction model also includes a text encoder and a triple extractor; accordingly, based on the pre-trained U-shaped entity-relationship extraction model, the target triple is extracted according to the target text sentence, including: based on the text encoder, encoding the target text sentence into a corresponding contextual semantic representation; performing dependency syntactic analysis on the contextual semantic representation to construct a syntactic dependency tree; passing the syntactic dependency tree through a multi-layer graph pooling network layer, a multi-layer graph convolutional network layer and a multi-layer graph depooling network layer in sequence to obtain an output target topological graph; based on the triple extractor, performing triple extraction on the target topological graph to obtain a target triple.

[0011] Furthermore, the U-shaped entity-relationship extraction model is trained and optimized, specifically including: constructing a training sample set, each training sample in the training sample set includes a text sample and its corresponding triplet label; during training, the text sample is used as the model input, the predicted triplet is used as the model output, and the U-shaped entity-relationship extraction model is iteratively optimized through the target loss function to obtain a U-shaped entity-relationship extraction model that is trained to convergence.

[0012] Furthermore, the objective loss function includes extractor prediction loss, first structure matching loss and second structure matching loss.

[0013] Furthermore, the extractor prediction loss is defined as follows: ; in, Represents from the set The value in Indicates the starting position of the entity in the sentence, Indicates the end position of the entity in the sentence, Represents calculation y and p The cross entropy loss between represents the true probability distribution of the head entity at the starting position and the ending position, represents the predicted probability distribution of the head entity at the starting position and the ending position, Indicates the possible types of relations in a sentence, Indicates taking the head entity from the predicted head entity , Represents calculation and The cross entropy loss, For the head entity and relationships , tail entity The true probability distribution at the starting and ending positions, For the head entity and relationships , tail entity The predicted probability distribution at the starting and ending positions, Represents the tail entity.

[0014] Furthermore, the first structure matching loss is defined as follows: ; ; in, Indicates selecting the first node from the core topology node nodes, Indicates the number of core topology summary points, Indicates that in matching order Next The matching loss of nodes, Indicates selecting the first node from the core topology node nodes, Indicates that in matching order The real labels form the node parameter matrix, Represents the core topology after L-layer graph pooling The node parameter matrix of nodes, represents the learnable parameter matrix.

[0015] Furthermore, the second structure matching loss is defined as follows: ; in, represents the logarithmic loss, Indicates that in matching order The corresponding true labels below constitute the adjacent edge parameter matrix, Represents the core topology adjacency edge parameter matrix after L-layer graph pooling.

[0016] In the second aspect, the present invention also provides a knowledge triple extraction device, including: a target text sentence acquisition module, used to obtain the target text sentence to be tripled; a target triple extraction module, used to extract the target triple according to the target text sentence based on a pre-trained U-type entity-relationship extraction model; wherein, the U-type entity-relationship extraction model is constructed based on a graph pooling network layer, a graph convolutional network layer and a graph depooling network layer, and is obtained by training and optimization based on a training sample set composed of text samples and their corresponding triple labels.

[0017] In a third aspect, the present invention also provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for extracting knowledge triples as described above is implemented.

[0018] In a fourth aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described knowledge triple extraction methods.

[0019] The knowledge triple extraction method provided by the present invention obtains a target text sentence to be subjected to triple extraction, and extracts a target triple according to the target text sentence based on a pre-trained U-type entity-relationship extraction model; wherein the U-type entity-relationship extraction model is constructed based on a graph pooling network layer, a graph convolutional network layer, and a graph de-pooling network layer, and is obtained by training and optimizing a training sample set consisting of text samples and their corresponding triple labels. This method extracts target triples from the target text sentence through a U-type entity-relationship extraction model constructed based on a graph pooling network layer, a graph convolutional network layer, and a graph de-pooling network layer. It can not only extract implicit relationship triples in sentences, but also effectively identify long-distance relationship triples in actual scenarios, thereby realizing the effective use of syntactic structure information in the task of entity relationship triple extraction and improving the performance of the model in the task of knowledge triple extraction. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0021] Figure 1 It is a flowchart of the knowledge triple extraction method provided by an embodiment of the present invention.

[0022] Figure 2 This is an example diagram of extracting relation triples provided by an embodiment of the present invention.

[0023] Figure 3 It is a schematic diagram of the overall architecture of the U-shaped entity-relationship extraction model provided by an embodiment of the present invention.

[0024] Figure 4 3 is a training optimization diagram of the U-shaped entity-relationship extraction model provided by an embodiment of the present invention.

[0025] Figure 5 It is a schematic diagram of the overall process of the knowledge triple extraction method provided by an embodiment of the present invention.

[0026] Figure 6 It is a structural diagram of the knowledge triple extraction device provided by an embodiment of the present invention.

[0027] Figure 7 It is a schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0028] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.

[0029] It should be noted that existing knowledge triple extraction methods cannot effectively extract implicit relationship triplets in sentences and long-distance relationship triplets in actual scenarios.

[0030] Considering this, the present invention proposes a new knowledge triple extraction method. Specifically, Figure 1 The figure shows a flow chart of the knowledge triple extraction method provided by the embodiment of the present invention.

[0031] like Figure 1 As shown, the method includes steps S110-S120, and steps S110-S120 and related steps will be described in detail below.

[0032] S110: Obtain the target text sentence to be extracted.

[0033] S120, based on the pre-trained U-type entity-relationship extraction model, extract the target triples according to the target text sentence; wherein, the U-type entity-relationship extraction model is constructed based on a graph pooling network layer, a graph convolutional network layer and a graph depooling network layer, and is obtained by training and optimizing a training sample set composed of text samples and their corresponding triple labels.

[0034] It is easy to understand that in step S110 , the target text sentence to be extracted is first obtained, which can be any sentence set according to requirements and is not specifically limited here.

[0035] Then, in step S120, a pre-trained U-shaped entity-relationship extraction model is used to extract triples from the target text sentence to obtain output target triples.

[0036] The U-shaped entity-relationship extraction model includes a graph pooling network layer, a graph convolutional network layer, and a graph depooling network layer. Because the U-shaped entity-relationship extraction model has similar contraction and expansion paths to the encoder-decoder model, this embodiment names it the U-shaped entity-relationship extraction model.

[0037] The graph pooling network layer is designed to downsample or aggregate the nodes in the graph (the syntactic dependency tree corresponding to the target text sentence) in order to generate a smaller and more compact graph structure while retaining the key information of the graph. In traditional convolutional neural networks (CNNs), pooling layers (such as maximum pooling or average pooling) are used to reduce the spatial dimension of the image, thereby reducing computational complexity and preventing overfitting. Similarly, in graph neural networks, the number of nodes in the graph can be reduced by pooling operations while retaining the overall structural information of the graph, which is crucial for processing the long-distance relationship triple discrimination in this embodiment. In addition, it can also enable the model to focus on the global structure of the graph rather than relying too much on local details to avoid overfitting.

[0038] The graph convolutional network layer processes the graph data output by the graph pooling layer. It processes complex graph-structured data by applying convolution operations defined on the graph structure. A graph typically consists of nodes (vertices) and edges (edges), where nodes represent entities and edges represent relationships between entities. The core idea of ​​the graph convolutional network layer is to aggregate the features of each node with those of its neighboring nodes and then update the representation of that node. This allows for efficient learning of relationships between nodes (or graphs), enabling the model to reason about the types of implicit relationships in sentences.

[0039] The graph unpooling layer is used to recover higher-resolution graph structures from graph representations after graph pooling and convolution operations. Unlike graph pooling (such as the pooling layer in a convolutional network), which reduces the size of the graph nodes or graph through downsampling, graph unpooling can restore the details or structure of the original graph through "unpooling", allowing the model to directly decode and extract relation triplets on the restored graph.

[0040] It should be noted that the number of graph pooling network layers, graph convolutional network layers, and graph depooling network layers in the U-shaped entity-relationship extraction model can be set according to actual needs and is not specifically limited here.

[0041] It should also be noted that in the U-shaped entity-relationship extraction model of this embodiment, symmetrical jump connections are added between the graph pooling network layer and the graph depooling network layer to combine semantic and syntactic information at different levels.

[0042] The U-shaped entity-relationship extraction model constructed based on the graph pooling network layer, the graph convolutional network layer and the graph depooling network layer can be trained and optimized by using a training sample set composed of text samples and their corresponding triple labels to obtain a trained U-shaped entity-relationship extraction model for practical application.

[0043] The target triplet finally extracted can be referenced Figure 2 , Figure 2 A schematic diagram of extracting relation triples provided by an embodiment of the present invention is shown.

[0044] like Figure 2 As shown, Figure 2 On the left are unstructured natural language texts from different fields, where green and blue represent the positions of the head entity and tail entity in the sentence, respectively, and the line between the two entities represents the corresponding relationship between the head entity and the tail entity. Figure 2 On the right is a series of relation triplets extracted from the text, which are a structural organization of the knowledge contained in the sentence.

[0045] Extracting relational triples from a large amount of text within a domain is a crucial step in digitizing and organizing the description of domain knowledge. Through tasks like entity fusion and entity alignment, the extracted knowledge triples can be used to construct a domain knowledge graph for the corresponding domain, which has broad application value.

[0046] In this embodiment, a target text sentence to be subjected to triple extraction is obtained, and based on a pre-trained U-type entity-relationship extraction model, a target triple is extracted according to the target text sentence; wherein, the U-type entity-relationship extraction model is constructed based on a graph pooling network layer, a graph convolutional network layer, and a graph de-pooling network layer, and is obtained by training and optimizing a training sample set consisting of text samples and their corresponding triple labels. This method extracts target triples from the target text sentence by using a U-type entity-relationship extraction model constructed based on a graph pooling network layer, a graph convolutional network layer, and a graph de-pooling network layer. It can not only extract implicit relationship triples in sentences, but also effectively identify long-distance relationship triples in actual scenarios, thereby realizing the effective use of syntactic structure information in the task of extracting entity relationship triples and improving the performance of the model in the task of extracting knowledge triples.

[0047] On the basis of the above embodiment, the process of extracting target triples using the U-shaped entity-relationship extraction model will be described in detail below.

[0048] Based on the pre-trained U-shaped entity-relation extraction model, target triples are extracted according to the target text sentences, including: encoding the target text sentences into corresponding contextual semantic representations based on the text encoder; performing dependency syntactic analysis on the contextual semantic representation to construct a syntactic dependency tree; passing the syntactic dependency tree through a multi-layer graph pooling network layer, a multi-layer graph convolutional network layer, and a multi-layer graph depooling network layer in sequence to obtain the output target topological graph; based on the triple extractor, triples are extracted from the target topological graph to obtain the target triples.

[0049] Figure 3A diagram showing an example of the overall architecture of a U-shaped entity-relationship extraction model provided by an embodiment of the present invention is shown.

[0050] like Figure 3 As shown in the figure, the U-shaped entity-relation extraction model includes a BERT encoder, a multi-layer graph pooling network layer, a multi-layer graph convolutional network, a multi-layer graph depooling network layer, and a triple extractor.

[0051] When extracting knowledge triples from a target text sentence, first, a pre-trained encoder such as a BERT encoder is used to encode the input target text sentence to obtain the contextual semantic representation corresponding to the target text sentence.

[0052] Next, dependency syntactic analysis is performed on the contextual semantic representation output by the BERT encoder to capture the corresponding syntactic structure information in the sentence. This allows the construction of a syntactic dependency tree corresponding to the target text sentence. The syntactic dependency tree can be viewed as a directed graph, and its structure can be represented using methods that describe directed graph features. In other words, the target text sentence to be triplet extracted can be constructed into a graph based on the structure of the syntactic dependency tree. The nodes in the graph represent the words in the target text sentence, and the lines between the nodes represent the syntactic dependencies between the words.

[0053] Among them, dependency syntactic analysis aims to analyze the dependency relationship between words in a sentence. It focuses on the direct relationship between words. Through dependency syntactic analysis, the model can better understand the structure and meaning of the sentence, identify the grammatical relationship between each word in the sentence, and thus more effectively extract the key information in the sentence.

[0054] For example, by encoding the target text sentence "Xiao Ming loves to eat apples" into a contextual semantic representation and then performing dependency syntactic analysis on it, a syntactic dependency tree can be constructed. In this tree structure, "like" is the root node, "like" has "Xiao Ming" and "eat" as its child nodes, "Xiao Ming" is a leaf node, "eat" has "apple" as its child node, and "apple" is a leaf node.

[0055] Subsequently, the constructed syntactic dependency tree is used as the input of the multi-layer graph pooling network layer to aggregate nodes with strong syntactic connections and similar semantic features. Specifically, the nodes in the syntactic dependency tree are clustered / downsampled through the multi-layer graph pooling network, and the strongly related nodes are aggregated together by outputting similar clusters. As a result, the original syntactic dependency tree is automatically pruned by the model into a small core topology graph containing semantic and syntactic information. On this basis, this embodiment uses a multi-layer graph convolutional network layer to capture the syntactic interaction features under the core topology and obtain a core triple topology graph.

[0056] Subsequently, because the downsampling process of the multi-layer graph pooling network layer retains strong syntactic association information while also losing entity boundary information in the syntactic dependency tree, it is impossible to extract the corresponding entity relationships from the core triple topology graph. To integrate the syntactic representation of the core triple topology graph with the contextual semantic representation of the target text sentence, this embodiment uses a directional extension path structure containing a graph unpooling operation to restore the number of nodes in the graph, thereby reconstructing a more detailed graph structure to obtain the target topology graph.

[0057] Finally, the target topology map is used as the input of the triplet extractor to obtain the predicted output, i.e., the extracted target triplet.

[0058] The above is the overall processing process of the U-shaped entity-relationship extraction model on the target text sentence, which can achieve accurate extraction of knowledge triples in the target text sentence.

[0059] In this embodiment, the target text sentence is encoded into the corresponding contextual semantic representation based on a text encoder, and the contextual semantic representation is subjected to dependency syntactic analysis to construct a syntactic dependency tree. The syntactic dependency tree is then sequentially passed through a multi-layer graph pooling network layer, a multi-layer graph convolutional network layer, and a multi-layer graph de-pooling network layer to obtain an output target topological graph. Thus, triples are extracted from the target topological graph based on a triple extractor to obtain target triples. This method extracts target triples from the target text sentence through a U-shaped entity-relationship extraction model constructed based on a graph pooling network layer, a graph convolutional network layer, and a graph de-pooling network layer. It can not only extract implicit relationship triples in sentences, but also effectively identify long-distance relationship triples in actual scenarios, thereby realizing the effective use of syntactic structure information in the entity-relationship triple extraction task and improving the performance of the model in the knowledge triple extraction task.

[0060] On the basis of the above embodiments, the training optimization process of the U-shaped entity-relationship extraction model will be described in detail below.

[0061] Training and optimizing a U-shaped entity-relationship extraction model specifically includes: constructing a training sample set, where each training sample in the training sample set includes a text sample and its corresponding triplet label; during training, using the text sample as the model input and the predicted triplet as the model output, iteratively optimizing the U-shaped entity-relationship extraction model through a target loss function to obtain a U-shaped entity-relationship extraction model that has been trained to convergence.

[0062] It's easy to understand that before training and optimizing the U-shaped entity-relation extraction model, a training sample set needs to be constructed. Each training sample in the training sample set includes a piece of text and its corresponding triplet label. These triplet labels help the model learn how to extract structured information from the text.

[0063] The training sample set in this embodiment can be directly applied to public datasets, such as ACE2005 (Automatic Content Extraction 2005), NYT-10, TACRED and other datasets, all of which contain a large number of entity type and relationship type annotations.

[0064] After constructing the training sample set, the U-shaped entity-relation extraction model is trained and optimized on the training sample set.

[0065] Figure 4 A schematic diagram of training optimization of the U-shaped entity-relationship extraction model provided by an embodiment of the present invention is shown.

[0066] like Figure 4 As shown in the figure, the input text (text sample) is used as the BERT encoder to obtain the contextual semantic representation of the text sample. Subsequently, the corresponding syntactic dependency tree is constructed based on the contextual semantic representation. The syntactic dependency tree is then passed through a multi-layer graph pooling network layer, a multi-layer graph convolutional network layer, and a multi-layer graph depooling network layer to obtain the target topology graph during training. Finally, the target topology graph during training is input into the triple extractor to obtain the predicted output during training, namely the predicted triple.

[0067] According to the triple labels corresponding to the text samples, the predicted triples, and the core topology of the graph convolutional network layer output, the value of the target loss function is calculated. Then, the model parameters are iteratively adjusted according to the target loss function, so that entity relationship triples can be stably extracted in multiple scenarios.

[0068] In this embodiment, the objective loss function includes extractor prediction loss, first structure matching loss and second structure matching loss.

[0069] The extractor prediction loss is defined as follows (1).

[0070] (1).

[0071] In formula (1), Represents from the set The value in Indicates the starting position of the entity in the sentence, Indicates the end position of the entity in the sentence, Represents calculation y and p The cross entropy loss between represents the true probability distribution of the head entity at the starting position and the ending position, represents the predicted probability distribution of the head entity at the starting position and the ending position, Indicates the possible types of relations in a sentence, Indicates taking the head entity from the predicted head entity , Represents calculation and The cross entropy loss, For the head entity and relationships , tail entity The true probability distribution at the starting and ending positions, For the head entity and relationships , tail entity The predicted probability distribution at the starting and ending positions, Represents the tail entity.

[0072] The first structure matching loss is defined as follows (2)-(3).

[0073] (2).

[0074] (3).

[0075] In formulas (2)-(3), Indicates selecting the first node from the core topology node nodes, Indicates the number of core topology summary points, Indicates that in matching order Next The matching loss of nodes, Indicates selecting the first node from the core topology node nodes, Indicates that in matching order The real labels form the node parameter matrix, Represents the core topology after L-layer graph pooling The node parameter matrix of nodes, represents the learnable parameter matrix.

[0076] The second structure matching loss is defined as follows (4).

[0077] (4).

[0078] In formula (4), represents the logarithmic loss, Indicates that in matching order The corresponding true labels below constitute the adjacent edge parameter matrix, Represents the core topology adjacency edge parameter matrix after L-layer graph pooling.

[0079] According to the above extractor prediction loss, the first structure matching loss and the second structure matching loss, the target loss function can be determined as follows (5).

[0080] (5).

[0081] In formula (5), 、 are the weight parameters of the first structure matching loss and the second structure matching loss respectively.

[0082] In this embodiment, a training sample set is constructed, where each training sample in the training sample set includes a text sample and its corresponding triple label. During training, the text sample is used as the model input and the predicted triple is used as the model output. The U-shaped entity-relationship extraction model is iteratively optimized through the target loss function to obtain a U-shaped entity-relationship extraction model that has been trained to convergence. This method extracts target triples from target text sentences using a U-shaped entity-relationship extraction model constructed based on a graph pooling network layer, a graph convolutional network layer, and a graph depooling network layer. It can not only extract implicit relationship triples in sentences, but also effectively identify long-distance relationship triples in actual scenarios, thereby achieving effective use of syntactic structure information in the task of extracting entity-relationship triples and improving the performance of the model in the task of extracting knowledge triples.

[0083] Additionally, in some other embodiments, Figure 5 The figure shows the overall process diagram of the knowledge triple extraction method provided by the embodiment of the present invention.

[0084] like Figure 5 As shown, the knowledge triple extraction method provided by the embodiment of the present invention mainly includes three steps, namely, syntactic dependency tree construction, syntactic dependency tree downsampling, and syntactic dependency tree upsampling.

[0085] In the syntactic dependency tree construction step, the target text sentence to be subjected to triple extraction is encoded and subjected to syntactic dependency analysis to construct a syntactic dependency tree.

[0086] In the syntactic dependency tree downsampling step, the syntactic dependency tree is used as the input of the graph pooling network layer. After passing through multiple layers of graph pooling network layers and then multiple layers of graph convolutional network layers, the core triple topology graph is obtained.

[0087] In the syntactic dependency tree upsampling step, the core triple topology is used as the input to the graph depooling network layer. After passing through multiple layers of graph depooling network layers, the target topology is obtained. Finally, the knowledge triples in the target topology are extracted by the triple extractor to obtain the target triples.

[0088] It is worth mentioning that a single-layer graph convolutional neural network automatically aggregates the relationship information of neighbor nodes during the extraction process, achieving the aggregation of first-degree relationships. A two-layer graph convolutional neural network can aggregate the relationship information of neighbor nodes of neighbors, achieving the aggregation of second-degree relationships. The U-shaped entity-relationship extraction model provided by the embodiment of the present invention uses a multi-layer graph convolutional neural network, so it can achieve the nesting of composite relationship information, thereby realizing the reasoning of implicit relationship types in sentences.

[0089] In addition, since the U-shaped entity-relationship extraction model is built on the basis of the syntactic dependency tree (syntactic structure tree), and the syntactic structure can shorten the distance between two distant entities through syntactic association relationships, the present invention performs better in long text scenarios.

[0090] Corresponding to the knowledge triple extraction method described in the above embodiments, the present invention also proposes a knowledge triple extraction device.

[0091] Specifically, Figure 6 A schematic structural diagram of a knowledge triple extraction device provided by an embodiment of the present invention is shown.

[0092] like Figure 6 As shown, the device includes: a target text sentence acquisition module 610, which is used to obtain the target text sentence to be tripled; a target triplet extraction module 620, which is used to extract the target triple according to the target text sentence based on a pre-trained U-type entity-relationship extraction model; wherein the U-type entity-relationship extraction model is constructed based on a graph pooling network layer, a graph convolutional network layer and a graph depooling network layer, and is obtained by training and optimizing a training sample set composed of text samples and their corresponding triplet labels.

[0093] In this embodiment, the target text sentence to be tripled is obtained by the target text sentence acquisition module 610, and the target triple extraction module 620 obtains the target triple according to the target text sentence based on the pre-trained U-type entity-relationship extraction model; wherein the U-type entity-relationship extraction model is constructed based on the graph pooling network layer, the graph convolutional network layer and the graph de-pooling network layer, and is obtained by training and optimizing the training sample set composed of text samples and their corresponding triple labels. The device extracts the target triples in the target text sentence by using the U-type entity-relationship extraction model constructed based on the graph pooling network layer, the graph convolutional network layer and the graph de-pooling network layer. It can not only extract the implicit relationship triples in the sentence, but also effectively identify the long-distance relationship triples in the actual scene, thereby realizing the effective use of syntactic structure information in the entity relationship triple extraction task and improving the performance of the model in the knowledge triple extraction task.

[0094] It should be noted that the knowledge triple extraction device provided in the embodiment of the present invention and the knowledge triple extraction method described in the above embodiments can be referred to each other, and will not be described in detail here.

[0095] Figure 7 An example of a physical structure diagram of an electronic device is shown below. Figure 7 As shown, the electronic device may include: a processor 710, a communications interface 720, a memory 730, and a communication bus 740, wherein the processor 710, the communications interface 720, and the memory 730 communicate with each other via the communication bus 740. The processor 710 may call the logic instructions in the memory 730 to execute a knowledge triple extraction method, which includes: obtaining a target text sentence to be subjected to triple extraction; extracting target triples from the target text sentence based on a pre-trained U-type entity-relationship extraction model; wherein the U-type entity-relationship extraction model is constructed based on a graph pooling network layer, a graph convolutional network layer, and a graph depooling network layer, and is obtained by training and optimizing a training sample set consisting of text samples and their corresponding triple labels.

[0096] Furthermore, the logic instructions in the aforementioned memory 730 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product, stored in a storage medium, includes instructions for enabling 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 described in various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0097] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the knowledge triple extraction method provided by the above-mentioned methods, the method comprising: obtaining a target text sentence to be subjected to triple extraction; extracting a target triple according to the target text sentence based on a pre-trained U-type entity-relationship extraction model; wherein the U-type entity-relationship extraction model is constructed based on a graph pooling network layer, a graph convolutional network layer, and a graph depooling network layer, and is obtained by training and optimizing a training sample set consisting of text samples and their corresponding triple labels.

[0098] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.

[0099] Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented using software plus a necessary general-purpose hardware platform, or of course, hardware. Based on this understanding, the essence of the above technical solution, or the portion that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, or an optical disk, and includes a number of instructions for causing a computer device (such as a personal computer, server, or network device) to execute the methods described in each embodiment or certain portions of the embodiments.

[0100] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. 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 various embodiments of the present invention.

Claims

1. A knowledge triple extraction method, characterized in that: include: Obtain the target text sentence to be subjected to triple extraction; Based on a pre-trained U-type entity-relation extraction model, target triples are extracted according to the target text sentence; wherein the U-type entity-relation extraction model is constructed based on a graph pooling network layer, a graph convolutional network layer and a graph depooling network layer, and is obtained by training and optimizing a training sample set consisting of text samples and their corresponding triplet labels.

2. The knowledge triple extraction method according to claim 1, characterized in that: The U-shaped entity-relation extraction model also includes a text encoder and a triple extractor; Accordingly, based on the pre-trained U-type entity-relation extraction model, the target triples are extracted according to the target text sentence, including: Based on the text encoder, encoding the target text sentence into a corresponding contextual semantic representation; Performing dependency syntactic analysis on the context semantic representation to construct a syntactic dependency tree; The syntactic dependency tree is sequentially passed through a multi-layer graph pooling network layer, a multi-layer graph convolutional network layer, and a multi-layer graph de-pooling network layer to obtain an output target topological graph; Based on the triplet extractor, triplet extraction is performed on the target topological graph to obtain target triplet.

3. The knowledge triple extraction method according to claim 1, characterized in that: Training and optimizing the U-shaped entity-relation extraction model specifically includes: Constructing a training sample set, wherein each training sample in the training sample set includes a text sample and its corresponding triplet label; During training, the text sample is used as the model input, and the predicted triple is used as the model output. The U-shaped entity-relation extraction model is iteratively optimized through the target loss function to obtain a U-shaped entity-relation extraction model that is trained to convergence.

4. The knowledge triple extraction method according to claim 3, characterized in that: The objective loss function includes an extractor prediction loss, a first structure matching loss, and a second structure matching loss.

5. The knowledge triple extraction method according to claim 4, characterized in that: The extractor prediction loss is defined as follows: ; in, Represents from the set Take the value in Indicates the starting position of the entity in the sentence, Indicates the end position of the entity in the sentence, Representation calculation y and p The cross entropy loss between represents the true probability distribution of the head entity at the starting position and the ending position, represents the predicted probability distribution of the head entity at the starting position and the ending position, Indicates the possible types of relations in a sentence, Indicates taking the head entity from the predicted head entity , Representation calculation and The cross entropy loss is For the head entity and relationship , tail entity The true probability distribution at the starting and ending positions, For the head entity and relationship , tail entity The predicted probability distribution at the starting and ending positions, Represents the tail entity.

6. The knowledge triple extraction method according to claim 4, characterized in that: The first structure matching loss is defined as follows: ; ; in, Indicates selecting the first node from the core topology node nodes, Indicates the number of core topology summary points. Indicates in matching order Next The matching loss of nodes is Indicates selecting the first node from the core topology node nodes, Indicates in matching order The actual labels form the node parameter matrix, Represents the core topology after L-layer graph pooling The node parameter matrix of nodes, represents the learnable parameter matrix.

7. The knowledge triple extraction method according to claim 4, characterized in that: The second structure matching loss is defined as follows: ; in, represents the logarithmic loss, Indicates in matching order The corresponding true labels below constitute the adjacent edge parameter matrix, Represents the core topology adjacent edge parameter matrix after L-layer graph pooling.

8. A knowledge triple extraction device, characterized in that: include: A target text sentence acquisition module is used to acquire the target text sentence to be subjected to triple extraction; A target triple extraction module, used for extracting target triples according to the target text sentence based on a pre-trained U-type entity-relation extraction model; Among them, the U-type entity-relationship extraction model is constructed based on a graph pooling network layer, a graph convolutional network layer and a graph depooling network layer, and is obtained by training and optimizing a training sample set composed of text samples and their corresponding triple labels.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the knowledge triple extraction method according to any one of claims 1 to 7 is implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the knowledge triple extraction method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Traffic event knowledge graph construction method based on multilayer semantic graph convolutional neural network

    CN117312577A