Overlapped entity relationship extraction method, system and equipment and storage medium

By using overlapping multi-entity markers, classification layers, rule modules and complex marking methods in the overlapping entity relationship extraction method, the error and deviation problems in the overlapping entity relationship task in the prior art are solved, and efficient entity relationship extraction is achieved.

CN119398043AInactive Publication Date: 2025-02-07NAT UNIV OF DEFENSE TECH
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510008222.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-03
Publication Date
2025-02-07
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

It is difficult for the prior art to realize low error and low deviation entity relationship extraction in overlapping entity relationship tasks.

Method used

A method of overlapping entity relationship extraction is adopted to determine the target entity information through overlapping multi-entity markers, and the entity category information is obtained in combination with the classification layer, and the preset rule module is injected to determine the candidate triplet set, and the target original output information is generated using complex marking methods. And input it to the relation extraction model to obtain the entity relationship extraction result.

Benefits of technology

It realizes the entity extraction effect that can extract all entities at the same time and give entity category information, solve the problem of nested entities, reduce errors, and reduce deviation exposure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119398043A_ABST
    Figure CN119398043A_ABST
Patent Text Reader

Abstract

The invention provides an overlapped entity relationship extraction method, system and device and a storage medium, and relates to the technical field of computers. The method comprises the following steps: when a to-be-extracted target is received, determining target entity information by overlapping a multi-entity marker; obtaining entity category information through the classification layer; injecting the entity category information into a preset rule module to determine a candidate triple set; target original output information is determined through a complex marking method in combination with the candidate triple set; and inputting the target original input information into a preset relation extraction model to obtain an entity relation extraction result. All entities can be extracted at the same time, entity category information is given, and the problem of entity nesting is solved. Furthermore, the entity extraction effect that errors can be reduced and deviation exposure can be relieved is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, system, device and storage medium for extracting overlapping entity relationships. Background Art

[0002] Entity recognition and relationship extraction, as important steps in text mining, have become a hot topic in recent years. Its main purpose is to automatically extract entities and related entity relationship structures from unstructured texts, which plays a vital role in natural language processing tasks such as knowledge graph construction, information retrieval and system question answering.

[0003] At present, most relation extraction models limit the task to the situation where a single sentence contains only a single triple, and the entities are not nested. However, this is too idealistic. Real corpora are often complex and overlapping, which requires further research.

[0004] Therefore, how to achieve low-error and low-bias entity relationship extraction in overlapping entity relationship tasks has become a technical problem that needs to be solved urgently. Summary of the invention

[0005] In order to achieve low-error, low-bias exposure entity relationship extraction in overlapping entity relationship tasks, the present application provides an overlapping entity relationship extraction method, system, device and storage medium.

[0006] In the first aspect, the present application provides a method for extracting overlapping entity relationships using the following technical solution: A method for extracting overlapping entity relations, comprising: When receiving the target to be extracted, passing the target to be extracted through an overlapping multi-entity marker to determine target entity information; Acquire entity category information corresponding to the target entity information through a classification layer; Injecting the entity category information into a preset rule module to determine a candidate triple set; Combining the candidate triplet set by a complex labeling method to determine the target original output information; The target original input information is input into a preset relationship extraction model to obtain entity relationship extraction results.

[0007] Optionally, when receiving the target to be extracted, the step of passing the target to be extracted through an overlapping multi-entity marker to determine target entity information includes: When receiving a target to be extracted, executing a character embedding strategy on the target to be extracted to determine a character vector; Execute a word embedding strategy on the target to be extracted to determine a word vector; Align the character vector with the word vector and obtain an alignment result; executing a position embedding strategy on the alignment result to generate a sentence encoding; Encode the sentence through a Bi-LSTM layer to obtain the target input embedding; The target input embedding is passed through an overlapping multi-entity tagger to determine the target entity information.

[0008] Optionally, the step of embedding the target input through an overlapping multi-entity tagger to determine target entity information comprises: embedding the target input through an overlapping multi-entity tagger so that the overlapping multi-entity tagger generates entity start probability information and entity end probability information, wherein the overlapping multi-entity tagger includes a first linear layer and a second linear layer; The first linear layer is used to calculate the entity beginning probability information according to the tag information in the input embedding; The second linear layer is used to calculate the entity ending probability information according to the tag information in the input embedding; Obtain a preset boundary threshold and combine the entity start probability information and the entity end probability information to determine the entity boundary; The target entity information is determined by combining the entity boundaries through the proximity principle.

[0009] Optionally, the step of acquiring entity category information corresponding to the target entity information through a classification layer includes: Get the preset training model as the classification layer, and get the preset entity category information; Input the target entity information and the preset entity category information into the preset training model and generate a model output result through a fully connected layer; The entity category information is determined according to the binary cross entropy loss function combined with the model output result.

[0010] Optionally, the step of injecting the entity category information into a preset rule module to determine a candidate triple set includes: Injecting the entity category information into a preset rule module so that the preset rule module performs entity relationship judgment and generates a judgment result according to the ontology rules and the preset rule construction table; A candidate triple set is determined according to the judgment result.

[0011] Optionally, before the step of combining the candidate triplet set with a complex labeling method to determine the target original output information, the step further includes: Adding preset entity information and preset entity category information to generate a complex tag template; Through multi-granularity encoding, the character embedding strategy, word embedding strategy and position embedding strategy are integrated to generate a suspension coding strategy; A complex marking method is generated according to the complex marking template and the suspended coding strategy.

[0012] Optionally, the step of inputting the target original input information into a preset relationship extraction model to obtain an entity relationship extraction result includes: Input the target original input into a preset relationship extraction model, and determine the entity information in the target original input through the preset relationship extraction model using a cross entropy loss function; Calculating the relationship between each entity in the entity information to generate an entity relationship set; Selecting the label word with the highest probability in the entity relationship set to obtain a final relationship category; The final relationship category and the target original input are used as entity relationship extraction results.

[0013] In a second aspect, the present application provides an overlapping entity relationship extraction system, the overlapping entity relationship extraction system comprising: A target entity information module is used to, upon receiving a target to be extracted, pass the target to be extracted through an overlapping multi-entity marker to determine target entity information; An entity category information module, used to obtain entity category information corresponding to the target entity information through a classification layer; A candidate triple set module, used for injecting the entity category information into a preset rule module to determine a candidate triple set; A target original output information module, used for combining the candidate triplet set by a complex labeling method to determine the target original output information; The entity relationship extraction result module is used to input the target original input information into a preset relationship extraction model to obtain the entity relationship extraction result.

[0014] In a third aspect, the present application provides a computer device, comprising: a memory and a processor, wherein the processor executes the method described above when running computer instructions stored in the memory.

[0015] In a fourth aspect, the present application provides a computer-readable storage medium, comprising instructions, which, when executed on a computer, enable the computer to execute the method described above.

[0016] In summary, the present application includes the following beneficial technical effects: The present application determines the target entity information by overlapping multiple entity markers when receiving the target to be extracted; obtains the entity category information through the classification layer; injects the entity category information into the preset rule module to determine the candidate triple set; combines the candidate triple set with the complex labeling method to determine the target original output information; inputs the target original input information into the preset relationship extraction model to obtain the entity relationship extraction result. It realizes the ability to extract all entities at the same time and give entity category information, solving the problem of nested entities. It further realizes the entity extraction effect that can reduce errors and mitigate bias exposure. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 It is a schematic diagram of the computer device structure of the hardware operating environment involved in the embodiment of the present application.

[0018] Figure 2 It is a flowchart of the first embodiment of the overlapping entity relationship extraction method of the present application.

[0019] Figure 3 It is the overlapping type classification of the first embodiment of the overlapping entity relationship extraction method of the present application; Figure 4 This is an example diagram of a narrow field of view of the first embodiment of the overlapping entity relationship extraction method of the present application; Figure 5 It is an overlapping entity relationship extraction model based on complex labeling and rule-enhanced prompt learning of the first embodiment of the overlapping entity relationship extraction method of the present application; Figure 6 It is a character embedding and word embedding coding diagram of the first embodiment of the overlapping entity relationship extraction method of the present application; Figure 7 It is a complete input coding diagram of the first embodiment of the overlapping entity relationship extraction method of the present application; Figure 8 It is an entity recognition model diagram of the first embodiment of the overlapping entity relationship extraction method of the present application; Fig. 9 It is a rule construction table of the first embodiment of the overlapping entity relationship extraction method of the present application; Fig.10 This is a rule injection flow chart of the first embodiment of the overlapping entity relationship extraction method of the present application; Fig.11 It is a relationship template construction diagram of the first embodiment of the overlapping entity relationship extraction method of the present application; Fig.12 This is a diagram of a suspended marking method of the first embodiment of the overlapping entity relationship extraction method of the present application; Fig.13 This is a relationship classification model diagram of the first embodiment of the overlapping entity relationship extraction method of the present application; Fig.14 It is a structural block diagram of the first embodiment of the overlapping entity relationship extraction system of the present application. DETAILED DESCRIPTION

[0020] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below through the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0021] Reference Figure 1 , Figure 1 A schematic diagram of the computer device structure of the hardware operating environment involved in the embodiment of the present application.

[0022] like Figure 1 As shown, the computer device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (Wireless-Fidelity, Wi-Fi) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM), or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk storage. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0023] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the computer device, and may include more or less components than shown in the figure, or combine some components, or arrange the components differently.

[0024] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and an overlapping entity relationship extraction program.

[0025] exist Figure 1In the computer device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the present application can be set in the computer device, and the computer device calls the overlapping entity relationship extraction program stored in the memory 1005 through the processor 1001, and executes the overlapping entity relationship extraction method provided in the embodiment of the present application.

[0026] The present application embodiment provides a method for extracting overlapping entity relationships. Figure 2 , Figure 2 This is a flowchart of the first embodiment of the overlapping entity relationship extraction method of the present application.

[0027] In this embodiment, the overlapping entity relationship extraction method includes the following steps: Step S10: When the target to be extracted is received, the target to be extracted is passed through an overlapping multi-entity marker to determine target entity information.

[0028] It should be noted that at present, the triple extraction problem is often divided into three types according to the entity overlap in the triple: Normal, SEO (Single Entity Overlap) and EPO (Entity Pair Overlap). Figure 3 As shown in the figure, the Normal type indicates that there is no entity overlap in the triples in the sentence. The SEO type is single entity overlap, which means that there is a single entity overlap in some triples in the sentence, but there is no overlapping entity pair, such as AdobeColdFusion appears in two triples in the example. The EPO type is entity pair overlap, which means that there is an entity pair overlap in some triples in the sentence, such as the has_vul and relate_to relationships between Android and sensitive information in the example.

[0029] As can be seen from the above examples, compared with the classic relationship extraction task, overlapping entity relationship extraction is more complex and difficult, and the following problems need to be solved: (1) Entity nesting problem. There are often nested entities in sentences, such as the nesting between the entities Adobe and AdobeColdFusion in the example. How to accurately identify entity boundaries and solve the nesting problem is one of the difficulties faced.

[0030] (2) Bias exposure problem. The entity recognition task and the relationship extraction task are cascaded. The real labels are used during training, and the predicted labels are used during prediction, which causes the error between tasks to be transmitted and cause error accumulation.

[0031] (3) Prediction redundancy problem. Most of the current mainstream overlapping relationship extraction models use decomposition strategies or relationship classification strategies as their main processing paradigm. The decomposition strategy advocates splitting the complex relationship extraction process into two subtasks. The first is entity recognition, that is, predicting the head entity or the tail entity. Then, for each relationship type, the recognized entity is combined to predict the corresponding entity. The relationship classification strategy focuses on calculating the probabilities of various relationship types that may exist between entity pairs. However, in practical applications, the actual relationship types that appear in sentences are often very limited, far less than the number of pre-defined relationship types in the dataset. Therefore, traditional relationship classification strategies often generate a large amount of redundant calculations, which not only increases the computational complexity, but also affects the performance of the model.

[0032] (4) The problem of narrow field of view. In the triple extraction task, the joint extraction model has always been considered to outperform the pipeline model. However, the pipeline model PURE in 2020 and the pipeline model PL-Marker in 2022 surpassed the joint extraction model and achieved the SOTA effect of the year. The joint extraction model has a problem of narrow field of view, that is, the fragment representation tends to pay more attention to the semantic information around itself. When dealing with complex relationship extraction, due to the long sentences and overlapping relationships, the model often focuses too much on local semantic information and has difficulty capturing global semantics, resulting in better recognition of close relationships and poor recognition of far relationships. For example Figure 4 As shown in the figure, the relation triples are (Morpa, parser, hyponym-of), (Morpa, text-to-speech, used-for). When extracting entities, Morpa’s representation will focus more on “is a”, which is helpful for judging the relation “hyponym-of”, but not conducive to judging the relation “used-for”.

[0033] Therefore, the overlapping entity relationship extraction method adopted in this embodiment selects a pipeline structure in the overall architecture, and sets up an entity recognition model and a relationship extraction model respectively to solve the problem of narrow field of view. The entity recognition model adopts a novel encoding method and sequence labeling method, which can extract all entities at the same time and give entity category information to solve the problem of nested entities. At the same time, an ontology rule injection module is designed to narrow the possible relationship types between entity pairs and reduce computational redundancy. For the problem of bias exposure, this paper reconstructs a high-quality Chinese small sample network security dataset, which can reduce errors and alleviate the problem of bias exposure.

[0034] It can be understood that the overlapping entity relationship extraction method of this embodiment is applied to Figure 5The overlapping entity relation extraction model based on complex labeling and rule-enhanced prompt learning is shown in the figure. This model is a pipeline model. First, a sequence annotation is constructed to identify all entities of a sentence, including nested entities, through an overlapping multi-entity tagger, and entity category information is obtained through a classification layer. Then, rules are injected to select a set of candidate triples. Finally, a complex labeling method is proposed to embed entity category information and position information into the original input. The template uses the text entity position to achieve suspension, making maximum use of global semantic information, thereby improving the accuracy of relation extraction.

[0035] Furthermore, in order to overcome the complexity and the risk of error accumulation, when a target to be extracted is received, the target to be extracted is passed through an overlapping multi-entity marker to determine the target entity information, including: when the target to be extracted is received, a character embedding strategy is executed on the target to be extracted to determine a character vector; a word embedding strategy is executed on the target to be extracted to determine a word vector; the character vector and the word vector are dimensionally aligned and the alignment result is obtained; a position embedding strategy is executed on the alignment result to generate a sentence encoding; the sentence encoding is passed through a Bi-LSTM layer to obtain a target input embedding; the target input embedding is passed through an overlapping multi-entity marker to determine the target entity information.

[0036] It is understandable that for Chinese cyberspace security corpus, entity relationships overlap a lot and the semantics are complex. Therefore, the embodiment adopts multi-granularity encoding, which integrates character embedding strategy, word embedding strategy and position embedding strategy. After the input layer inputs the corpus in units of characters, the character embedding layer randomly initializes the character vector to obtain the character vector, which is recorded as . Word embedding is the embedding of each phrase after word segmentation, denoted as . Word embedding first requires the network security text to be segmented. This example uses the pyhanlp Chinese word segmentation toolkit to segment words. Next, a Word2Vec model is trained to output the initial word vector Since there are fewer word segments than characters, the initial word vector The dimension of the character vector The dimensions are different and need to be aligned. The specific steps are as follows: (1) Copy n times. If the phrase contains n characters, the initial word vector of the phrase is Copy n times.

[0037] (2) Matrix transformation. Since the initial word vector The dimension of the character vector The dimensions are different, so a transformation matrix is ​​needed for alignment. The character vector of each word The dimension is i, the character vector of the word segmentation The dimension is n ; Initial word vector The dimension is j, after being replicated n times The dimension is n j; the dimension of the introduced transformation matrix is ​​j ,and After matrix multiplication, we get the word vector , dimension is n ,and Same dimensions.

[0038] (3) Vector addition. and The dimensions are the same, so just add them together. Figure 6 shown.

[0039] After the full vector is added, position embedding is performed and the position encoding is output .Will , , Add the three together to get the complete sentence encoding , d is the dimension of the complete embedding vector, and the formula is as follows.

[0040] = Finally, in order to make full use of the text context and integrate multi-granularity information, this embodiment adds a Bi-LSTM layer at the end of the encoding layer to represent the sentence Perform feature representation again to obtain the input embedding that integrates the context features , which can better extract entity relationships.

[0041] = The complete input code is as follows: Figure 7 shown.

[0042] It should be noted that the step of embedding the target input through an overlapping multi-entity marker to determine the target entity information includes: embedding the target input through an overlapping multi-entity marker so that the overlapping multi-entity marker generates entity start probability information and entity end probability information, wherein the overlapping multi-entity marker includes a first linear layer and a second linear layer; the first linear layer is used to calculate the entity start probability information based on the tag information in the input embedding; the second linear layer is used to calculate the entity end probability information based on the tag information in the input embedding; obtaining a preset boundary threshold combined with the entity start probability information and the entity end probability information to determine the entity boundary; and determining the target entity information by combining the entity boundary through the proximity principle.

[0043] In the specific implementation, Bi-LSTM can extract rich feature representations from text . In order to identify the starting position and the ending position of the entity, this embodiment designs two linear layers including: a first linear layer and a second linear layer. These two linear layers respectively perform binary classification on the output of the last layer of Bi-LSTM. The first linear layer is used to identify the starting position of the entity, that is, to determine whether each position is the beginning of an entity. If it is the beginning, it is marked as 1, otherwise it is marked as 0. The second linear layer is used to identify the ending position of the entity, that is, to determine whether each position is the end of an entity. If it is the end, it is marked as 1, otherwise it is marked as 0. The specific entity recognition model diagram is as follows Figure 8 As shown. During entity recognition, the entity tagger performs detailed operations on each tag. The calculation process can be expressed by the following formula: Indicates the probability that the i-th token in the sentence is the beginning of an entity, Indicates the probability that the i-th token in the sentence is the end. is the weight matrix of the first linear layer, is the weight matrix of the second linear layer, is the bias term. is the output feature vector of the Bi-LSTM at the i-th label. The preset boundary threshold in this embodiment is used for judgment. If the calculation result exceeds the preset boundary threshold, it is marked as 1, otherwise it is marked as 0. This sequence labeling method can efficiently identify entity boundaries.

[0044] Next, it is necessary to determine the entity based on the boundary marking. When matching the starting and ending positions of the entity, this embodiment adopts the principle of proximity. For each position marked as the beginning of the entity, search the position behind it until the first position marked as the end of the entity is found. In this way, the text segment between these two positions is regarded as an entity. If there are multiple positions marked as the end positions of the entity, it means that it is a nested entity and needs to be extracted separately. Through this matching method based on the principle of proximity, various complex entity structures, including nested entities and non-continuous entities, can be handled more flexibly. This method not only simplifies the process of entity recognition, but also improves the accuracy and robustness of entity recognition.

[0045] Step S20: Obtain entity category information corresponding to the target entity information through the classification layer.

[0046] It should be noted that the step of obtaining entity category information corresponding to the target entity information through the classification layer includes: obtaining a preset training model as the classification layer, and obtaining the preset entity category information at the same time; inputting the target entity information and the preset entity category information into the preset training model and generating the model output result through the fully connected layer; determining the entity category information according to the binary cross entropy loss function combined with the model output result.

[0047] In the specific implementation, in order to further improve the practicality and functionality of entity recognition, this embodiment adds an entity classification module. The main task of this module is to classify the identified entities in detail, so as to provide more accurate and useful information for the next step of relationship extraction. In order to realize entity classification, it is necessary to first define a series of entity categories. Similar to the above, the network security entity types are defined as "product", "version", "component", "vulnerability", "cause", "organization", "region", "method", etc. The entity recognition model uses the pre-trained model as a classifier, takes the output of Bi-LSTM and entity information as input, and predicts the entity category through the fully connected layer.

[0048] The entity recognition model uses the binary cross entropy loss function as the final entity recognition loss function.

[0049] It should be noted that the binary cross entropy loss function is widely used in binary classification problems in machine learning. It measures the difference between the predicted probability distribution and the true probability distribution. In the entity recognition task, each character is assigned a binary label (0 or 1) to indicate whether it belongs to the boundary of an entity. Therefore, this embodiment adds the losses of the entity head and tail markers as the entity recognition loss function. In this way, the model will consider the prediction results of the head and tail markers at the same time during the training process to minimize the overall prediction error. The calculation formula is as follows: is the predicted value, is the true value, N represents the sentence length Through the sequence labeling module and the entity classification module, the entity recognition model in this implementation can not only identify entities, but also classify them in detail. This will provide more accurate and useful information for subsequent relationship extraction tasks, and help further improve the performance and effect of natural language processing.

[0050] Step S30: injecting entity category information into a preset rule module to determine a candidate triple set.

[0051] In a specific implementation, the step of injecting entity category information into a preset rule module to determine a set of candidate triples includes: injecting entity category information into the preset rule module so that the preset rule module performs entity relationship judgment and generates a judgment result based on the ontology rules and the preset rule construction table; and determining a set of candidate triples based on the judgment result.

[0052] In the specific implementation, this embodiment also introduces ontology rules in the overlapping entity relationship extraction task, and first uses the rules to filter out the candidate relationship set, thereby reducing the complexity of relationship extraction calculation. The rule construction table in this embodiment is as follows Fig. 9 The specific rule naming and type are defined according to the specific usage, and this embodiment does not limit the rule construction content and relationship name.

[0053] It is understandable that if Fig.10 As shown in the rule injection flow chart, after the ontology rules are introduced, the entity categories are first preprocessed using these rules to determine whether there is a relationship between two entities according to the rules. If not, they are directly marked as "norelation"; if there is a relationship, the possible candidate relationship set is screened out. This step is crucial because it can exclude a large number of entity pairs that are irrelevant or obviously inconsistent with the target relationship at an early stage, thereby greatly reducing the computational complexity of subsequent relationship extraction.

[0054] Step S40: combining the candidate triplet set by a complex labeling method to determine the target original output information.

[0055] It can be understood that before the step of combining the candidate triple set with the complex labeling method to determine the target original output information, it also includes: adding preset entity information and preset entity category information to generate a complex labeling template; through multi-granularity encoding, fusing character embedding strategy, word embedding strategy and position embedding strategy to generate a suspended coding strategy; generating a complex labeling method based on the complex labeling template and the suspended coding strategy.

[0056] It should be noted that the complex tag template is a prompt template for the relationship. Its design is as follows, adding entity information and entity category information. Indicates the subject information. Indicates the subject category, Indicates object information. Indicates the object category. Multiple relation templates are arranged in sequence after the original input. The relation prompt template and label word set can be expressed as: like Fig.11As shown in the relation template construction diagram, the sentence contains two relations, has_vul and has_product. Therefore, two relation prompts are added after the sentence, which perfectly integrates the entity category information and semantic information.

[0057] In the specific implementation, in order to further strengthen the connection between entities and sentences, this embodiment designs a suspended coding strategy. The relationship recognition task still uses multi-granularity coding and integrates character embedding. , word embedding and position embedding . Randomly initialized by the character embedding layer. is the embedding of each phrase after word segmentation. The model uses the pyhanlp Chinese word segmentation toolkit to perform Chinese word segmentation and convert the character vector Copy n (word length) times, and To make the template more closely connected with the input text and fully obtain the context information, the position information of the entity in the template is aligned with the entity position in the sentence, without the need to re-label the position information. Fig.12 As shown, this embodiment proposes a method of floating marking, using the start position and end position of the entity to represent the position information of the template. The position code is the start position code of the subject , in the template The position code is the end position code of the subject , the position encoding of the object in the template can be obtained in the same way. The representation is as follows: , , final, , and Add the three together to get the complete sentence encoding , d is the dimension of the complete embedding vector, and the formula is as follows.

[0058] Step S50: Input the target original input information into a preset relationship extraction model to obtain entity relationship extraction results.

[0059] Furthermore, in order to solve the problem of narrow field of view, the step of inputting the target original input information into the preset relationship extraction model to obtain the entity relationship extraction result includes: The target original input is input into the preset relationship extraction model, and the entity information in the target original input is determined by the preset relationship extraction model through the cross entropy loss function; the relationship between each entity in the entity information is calculated to generate an entity relationship set; the label word with the highest probability is selected in the entity relationship set to obtain the final relationship category; the final relationship category and the target original input are used as the entity relationship extraction result.

[0060] In a specific implementation, examples of predefined relationship types are: "no_relation", "has_element", "has_vul", "has_version", "lead_to_consequence", "use_means_of", "is_product_of", "exploit", and "because_of".

[0061] During the training process, the cross entropy loss function is used to train the entity recognition model and the relationship extraction model. The loss function is calculated as follows, where represents the real entity label, Represents the true relationship label, and the two model losses are calculated separately.

[0062] During the test, we first calculate all entities contained in the sentence, and then determine whether there is a relationship between each entity pair and what kind of relationship exists. The calculation formula is as follows: in, It means to find the maximum probability. The probability is calculated separately in the entity category set. The category with the maximum probability is the entity category. in It is to know entity s, entity category t, and calculate the relationship between two entities i and j.

[0063] Finally, based on the prompt learning, the label word set at the relation prompt [MASK] is generated, and the label word with the highest probability is calculated. After mapping, the final relation category is obtained. The relation category and entity information together constitute the knowledge triple. At this point, complex entity relation triples can be extracted. The specific relation classification model is as follows: Fig.13 shown.

[0064] It should be noted that this implementation aims to solve the problems of narrow field of view, nested entity problem, prediction redundancy and bias exposure in the overlapping entity relationship extraction task, and designs a triple extraction model based on complex labeling and rule-enhanced prompt learning. This model is a pipeline model. The entity recognition model uses a sequence labeling method to identify all entities of a sentence, including nested entities, through an overlapping multi-entity marker, and obtains entity category information through a classification layer. Then the rules are injected to select a set of candidate triples. Finally, a complex labeling method is designed to explicitly embed entity category information and position into the original input. The template uses the text entity position to achieve suspension, making the most of global semantic information, thereby improving the accuracy of relationship extraction. Finally, the effectiveness of the model is verified in the general dataset DuIE2.0 and the Chinese overlapping entity relationship dataset.

[0065] This embodiment determines the target entity information by overlapping multiple entity markers when receiving the target to be extracted; obtains entity category information through the classification layer; injects the entity category information into the preset rule module to determine the candidate triple set; determines the target original output information by combining the candidate triple set through a complex labeling method; and inputs the target original input information into the preset relationship extraction model to obtain the entity relationship extraction result. It is achieved that all entities can be extracted at the same time and entity category information is given, solving the nested entity problem. It is further achieved that the entity extraction effect can reduce errors and mitigate bias exposure.

[0066] In addition, an embodiment of the present application further proposes a computer-readable storage medium, on which a program for extracting overlapping entity relationships is stored. When the program for extracting overlapping entity relationships is executed by a processor, the steps of the method for extracting overlapping entity relationships as described above are implemented.

[0067] Reference Fig.14 , Fig.14 This is a structural block diagram of the first embodiment of the overlapping entity relationship extraction system of the present application.

[0068] like Fig.14 As shown, the overlapping entity relationship extraction system proposed in the embodiment of the present application includes: The target entity information module 10 is used to determine the target entity information by passing the target to be extracted through an overlapping multi-entity marker when receiving the target to be extracted; An entity category information module 20, used to obtain entity category information corresponding to target entity information through a classification layer; A candidate triple set module 30, for injecting entity category information into a preset rule module to determine a candidate triple set; A target original output information module 40 is used to determine the target original output information by combining the candidate triplet set through a complex labeling method; The entity relationship extraction result module 50 is used to input the target original input information into a preset relationship extraction model to obtain the entity relationship extraction result.

[0069] It should be understood that the above is only an example and does not constitute any limitation on the technical solution of the present application. In specific applications, technicians in this field can make settings as needed, and the present application does not impose any limitation on this.

[0070] This embodiment determines the target entity information by overlapping multiple entity markers when receiving the target to be extracted; obtains entity category information through the classification layer; injects the entity category information into the preset rule module to determine the candidate triple set; determines the target original output information by combining the candidate triple set through a complex labeling method; and inputs the target original input information into the preset relationship extraction model to obtain the entity relationship extraction result. It is achieved that all entities can be extracted at the same time and entity category information is given, solving the nested entity problem. It is further achieved that the entity extraction effect can reduce errors and mitigate bias exposure.

[0071] In one embodiment, the target entity information module 10 is also used to, when receiving a target to be extracted, execute a character embedding strategy on the target to be extracted to determine a character vector; execute a word embedding strategy on the target to be extracted to determine a word vector; dimensionally align the character vector with the word vector and obtain the alignment result; execute a position embedding strategy on the alignment result to generate a sentence encoding; pass the sentence encoding through a Bi-LSTM layer to obtain a target input embedding; and pass the target input embedding through an overlapping multi-entity marker to determine the target entity information.

[0072] In one embodiment, the target entity information module 10 is also used to embed the target input through an overlapping multi-entity marker so that the overlapping multi-entity marker generates entity start probability information and entity end probability information, wherein the overlapping multi-entity marker includes a first linear layer and a second linear layer; the first linear layer is used to calculate the entity start probability information based on the tag information in the input embedding; the second linear layer is used to calculate the entity end probability information based on the tag information in the input embedding; a preset boundary threshold is obtained in combination with the entity start probability information and the entity end probability information to determine the entity boundary; and the target entity information is determined by combining the entity boundary through the proximity principle.

[0073] In one embodiment, the target entity information module 10 is also used to obtain a preset training model as a classification layer, and simultaneously obtain preset entity category information; input the target entity information and the preset entity category information into the preset training model and generate a model output result through a fully connected layer; determine the entity category information based on the binary cross entropy loss function combined with the model output result.

[0074] In one embodiment, the candidate triple set module 30 is further used to inject entity category information into the preset rule module so that the preset rule module performs entity relationship judgment and generates judgment results according to the ontology rules and the preset rule construction table; and determines the candidate triple set according to the judgment results.

[0075] In one embodiment, the target original output information module 40 is also used to add preset entity information and preset entity category information to generate a complex labeling template; through multi-granularity encoding, the character embedding strategy, word embedding strategy and position embedding strategy are integrated to generate a suspended coding strategy; a complex labeling method is generated according to the complex labeling template and the suspended coding strategy.

[0076] In one embodiment, the entity relationship extraction result module 50 is also used to input the target original input into a preset relationship extraction model, determine the entity information in the target original input through the preset relationship extraction model through a cross entropy loss function; calculate the relationship between each entity in the entity information to generate an entity relationship set; select the label word with the highest probability in the entity relationship set to obtain the final relationship category; and use the final relationship category and the target original input as the entity relationship extraction result.

[0077] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of the present application. In practical applications, technicians in this field can select part or all of it according to actual needs to achieve the purpose of the present embodiment, and no limitation is made here.

[0078] In addition, for technical details not fully described in this embodiment, please refer to the method for extracting overlapping entity relationships provided in any embodiment of the present application, and will not be repeated here.

[0079] In addition, it should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0080] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0081] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory (ROM) / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods of each embodiment of the present application.

[0082] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A method for extracting overlapping entity relationships, characterized in that: include: When receiving the target to be extracted, passing the target to be extracted through an overlapping multi-entity marker to determine target entity information; Acquire entity category information corresponding to the target entity information through a classification layer; Injecting the entity category information into a preset rule module to determine a candidate triple set; Combining the candidate triplet set by a complex labeling method to determine the target original output information; The target original input information is input into a preset relationship extraction model to obtain entity relationship extraction results.

2. The overlapping entity relationship extraction method according to claim 1, characterized in that: The step of determining target entity information by passing the target to be extracted through an overlapping multi-entity marker upon receiving the target to be extracted comprises: When receiving a target to be extracted, executing a character embedding strategy on the target to be extracted to determine a character vector; Execute a word embedding strategy on the target to be extracted to determine a word vector; Align the character vector with the word vector and obtain an alignment result; executing a position embedding strategy on the alignment result to generate a sentence encoding; Encode the sentence through a Bi-LSTM layer to obtain the target input embedding; The target input embedding is passed through an overlapping multi-entity tagger to determine the target entity information.

3. The overlapping entity relationship extraction method according to claim 2, characterized in that: The step of embedding the target input through an overlapping multi-entity tagger to determine target entity information comprises: embedding the target input through an overlapping multi-entity tagger so that the overlapping multi-entity tagger generates entity start probability information and entity end probability information, wherein the overlapping multi-entity tagger includes a first linear layer and a second linear layer; The first linear layer is used to calculate the entity beginning probability information according to the tag information in the input embedding; The second linear layer is used to calculate the entity ending probability information according to the tag information in the input embedding; Obtain a preset boundary threshold and combine the entity start probability information and the entity end probability information to determine the entity boundary; The target entity information is determined by combining the entity boundaries through the proximity principle.

4. The overlapping entity relationship extraction method according to claim 3 is characterized in that: The step of obtaining entity category information corresponding to the target entity information through the classification layer includes: Get the preset training model as the classification layer, and get the preset entity category information; Input the target entity information and the preset entity category information into the preset training model and generate a model output result through a fully connected layer; The entity category information is determined according to the binary cross entropy loss function combined with the model output result.

5. The overlapping entity relationship extraction method according to claim 1, characterized in that: The step of injecting the entity category information into a preset rule module to determine a candidate triple set includes: Injecting the entity category information into a preset rule module so that the preset rule module performs entity relationship judgment and generates a judgment result according to the ontology rules and the preset rule construction table; A candidate triple set is determined according to the judgment result.

6. The overlapping entity relationship extraction method according to claim 1, characterized in that: Before the step of combining the candidate triplet set with the complex labeling method to determine the target original output information, the method further includes: Adding preset entity information and preset entity category information to generate a complex tag template; Through multi-granularity encoding, the character embedding strategy, word embedding strategy and position embedding strategy are integrated to generate a suspension coding strategy; A complex marking method is generated according to the complex marking template and the suspended coding strategy.

7. The overlapping entity relationship extraction method according to claim 1, characterized in that: The step of inputting the target original input information into a preset relationship extraction model to obtain an entity relationship extraction result includes: Input the target original input into a preset relationship extraction model, and determine the entity information in the target original input through the preset relationship extraction model using a cross entropy loss function; Calculating the relationship between each entity in the entity information to generate an entity relationship set; Selecting the label word with the highest probability in the entity relationship set to obtain a final relationship category; The final relationship category and the target original input are used as entity relationship extraction results.

8. An overlapping entity relationship extraction system, characterized in that: The overlapping entity relationship extraction system comprises: A target entity information module is used to, upon receiving a target to be extracted, pass the target to be extracted through an overlapping multi-entity marker to determine target entity information; An entity category information module, used to obtain entity category information corresponding to the target entity information through a classification layer; A candidate triple set module, used for injecting the entity category information into a preset rule module to determine a candidate triple set; A target original output information module, used for combining the candidate triplet set by a complex labeling method to determine the target original output information; The entity relationship extraction result module is used to input the target original input information into a preset relationship extraction model to obtain the entity relationship extraction result.

9. A computer device, characterized in that: The device comprises: a memory and a processor, and when the processor runs the computer instructions stored in the memory, the processor executes the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The method comprises instructions, which, when executed on a computer, cause the computer to execute the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Entity relation joint extraction method based on global pointer network

    CN114417839A

  • Entity recognition method based on fine-grained suspension mark and nested entity diagram

    CN116861908A

  • Network space knowledge extraction method and device based on rule enhancement prompt learning

    CN117391083A

  • Entity identification and relation extraction method

    CN118428369A