Entity Relationship Extraction Method, Device, Electronic Device and Readable Storage Medium

Through text semantic feature extraction and entity embedding models, entity embedding information is screened and spliced ​​to improve the efficiency of entity relationship extraction, solving the problems of inefficiency and relying on manual screening in the prior art.

CN114492449BActive Publication Date: 2025-06-10PKU HKUST SHENZHEN HONGKONG INSTITUTION
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111564804.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-20
Publication Date
2025-06-10
Estimated Expiration
2041-12-20

AI Technical Summary

Technical Problem

The existing entity relationship extraction method is inefficient, relies on the quality of the initial seeds and corpus, and requires manual screening of low-frequency entity pairs, which is very troublesome.

Method used

By obtaining sentence instances and their bodies, performing text semantic features extraction to obtain sentence semantic vectors; input entities into standard entity embedding models for entity embedding to obtain entity embedding information; filtering standard embedding information from entity embedding information, splicing it with sentence semantic vectors, and inputting them to the relationship extraction module to obtain entity relationships.

Benefits of technology

It improves the efficiency of entity relationship extraction, reduces the dependence on the quality of initial seeds and corpus, reduces the need for manual screening, and improves the efficiency of extraction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114492449B_ABST
    Figure CN114492449B_ABST
Patent Text Reader

Abstract

The present application relates to a method for entity relationship extraction. The method includes: obtaining a sentence instance and entities in the sentence instance, extracting text semantic features from the sentence instance to obtain a sentence semantic vector; inputting the entities in the sentence instance into a standard entity embedding model for entity embedding to obtain entity embedding information; screening standard embedding information from the entity embedding information, splicing the standard embedding information with the sentence semantic vector and inputting the result into a preset relationship extraction module to obtain an entity relationship. In addition, the present application also relates to an entity relationship extraction device, equipment and storage medium. The present application can solve the problem of low efficiency in entity relationship extraction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of text processing, and in particular, to a method, apparatus, electronic device, and computer-readable storage medium for entity relationship extraction. Background Art

[0002] Currently, in order to extract effective information from corpora, in many cases, it is necessary to extract entity relationships in the corpus. Relationship extraction is a task based on entity recognition, and its core is to extract the relationship between entity pairs contained in a sentence.

[0003] The existing entity relationship extraction method is mainly unsupervised automatic extraction (Auto Extraction). Usually, under the condition of no determined relationship labels, it automatically extracts words or phrases that can describe the corresponding relationship from the text according to syntactic or semantic structures. However, this extraction method still depends on the quality of the initial seeds and the corpus, and it is very troublesome to manually screen low-frequency entity pairs, and the efficiency of entity relationship extraction is relatively low. Summary of the Invention

[0004] This application provides a method, apparatus, electronic device, and storage medium for entity relationship extraction to solve the problem of low efficiency of entity relationship extraction.

[0005] In a first aspect, this application provides a method for entity relationship extraction, the method comprising:

[0006] Obtain a sentence instance and entities in the sentence instance, perform text semantic feature extraction on the sentence instance to obtain a sentence semantic vector;

[0007] Input the entities in the sentence instance into a standard entity embedding model for entity embedding to obtain entity embedding information;

[0008] Screen standard embedding information from the entity embedding information, splice the standard embedding information with the sentence semantic vector and input the result into a preset relationship extraction module to obtain an entity relationship.

[0009] Specifically, the performing text semantic feature extraction on the sentence instance to obtain a sentence semantic vector includes:

[0010] Construct an input sequence according to a pre-obtained first identifier, second identifier, the sentence instance, and the entities in the sentence instance;

[0011] Perform mask replacement on multiple entities in the input sequence to obtain a mask sequence;

[0012] Input the mask sequence into a preset BERT model to obtain a sequence vector;

[0013] Perform state transformation on the sequence vector based on a preset bidirectional long short-term memory network to obtain a final semantic vector;

[0014] Identify the position of the first second identifier in the final semantic vector, and retain the sequence before the first second identifier in the final semantic vector to obtain a sentence semantic vector.

[0015] Specifically, the constructing an input sequence according to the pre-obtained first identifier, second identifier, the sentence instance, and the entities in the sentence instance includes:

[0016] Add the first identifier to the front of the sentence instance, and add the second identifier to the back of the sentence instance to obtain a preposed sequence;

[0017] Insert the second identifier into the entities included in the sentence instance to obtain a postposed sequence, and splice the preposed sequence and the postposed sequence to obtain an input sequence.

[0018] Specifically, before inputting the entities in the sentence instance into a standard entity embedding model for entity embedding, the method further includes:

[0019] Identify multiple entities in the pre-obtained training data and the relationships between the multiple entities to obtain multiple entity relationships;

[0020] Perform triple generation processing on the multiple entities and the entity relationships according to a preset triple generation method to obtain multiple training triples;

[0021] Splice the triples with the same entities in the multiple training triples to obtain a training knowledge graph;

[0022] Use the training knowledge graph to train a preset entity embedding model to obtain a trained standard entity embedding model.

[0023] Specifically, the using the training knowledge graph to train a preset entity embedding model to obtain a trained standard entity embedding model includes:

[0024] Extract the head entity and the tail entity in any one training triple in the training knowledge graph, and project the head entity and the tail entity into a preset Euclidean space by using the entity embedding model to obtain a head entity vector and a tail entity vector;

[0025] Calculate the Hadamard product between the head entity vector and the head entity to obtain a first Hadamard product, and calculate the Hadamard product between the tail entity vector and the head entity to obtain a second Hadamard product;

[0026] Construct a scoring function based on the first Hadamard product and the second Hadamard product, and calculate the score value corresponding to the scoring function;

[0027] When the score value is less than the score threshold, adjust the model parameters of the entity embedding model to obtain an entity embedding model with adjusted parameters, and re-execute the training step until the score value is greater than or equal to the score threshold;

[0028] When the score value is greater than or equal to the score threshold, output the entity embedding model as a trained standard entity embedding model.

[0029] Specifically, the screening of the standard embedding information from the entity embedding information includes:

[0030] Vectorize the entities in the sentence instance to obtain entity vectors, calculate the dot product between the entity embedding information and the entity vectors to obtain a similarity;

[0031] Based on the similarity, perform screening processing on the entity embedding information to obtain standard embedding information.

[0032] Specifically, the performing screening processing on the entity embedding information based on the similarity to obtain standard embedding information includes:

[0033] Use the activation function in the pre-obtained gated unit to normalize the similarity to obtain a normalized value;

[0034] Judge the magnitude between the normalized value and a preset hyperparameter;

[0035] When the normalized value is less than the hyperparameter, perform deletion processing on the entity embedding information. When the normalized value is greater than or equal to the hyperparameter, output the entity embedding information as standard embedding information.

[0036] In a second aspect, the present application provides an entity relationship extraction device, and the device includes:

[0037] A semantic feature extraction module, configured to obtain a sentence instance, and perform text semantic feature extraction on the sentence instance to obtain a sentence semantic vector;

[0038] An entity extraction module, configured to input the entities in the sentence instance into a standard entity embedding model for entity embedding to obtain entity embedding information;

[0039] A relationship extraction module, configured to screen standard embedding information from the entity embedding information, splice the standard embedding information with the sentence semantic vector and input the result into a preset relationship extraction module to obtain an entity relationship.

[0040] In a third aspect, an electronic device is provided, including a processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete communication with each other through the communication bus;

[0041] The memory is used to store a computer program;

[0042] The processor, when executing the program stored on the memory, implements the steps of the entity relationship extraction method described in any embodiment of the first aspect.

[0043] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the entity relationship extraction method described in any embodiment of the first aspect are implemented.

[0044] The above technical solutions provided by the embodiments of the present application have the following advantages compared with the prior art:

[0045] In the embodiment of the present invention, by extracting text semantic features from sentence instances, sentence semantic vectors are obtained. The text semantic feature extraction can make the obtained sentence semantic vectors have rich feature information. Entities in the sentence instances are input into a standard entity embedding model for entity embedding to obtain entity embedding information. The entity embedding information after entity extraction by the standard entity embedding model contains the association relationship features between other entities. Standard embedding information is screened from the entity embedding information, and the standard embedding information is concatenated with the sentence semantic vectors and input into a preset relationship extraction module to obtain entity relationships. The efficiency of entity relationship extraction is improved. Therefore, the entity relationship extraction method, device, electronic device, and computer-readable storage medium proposed by the present invention can solve the problem of low efficiency of entity relationship extraction. Description of the Drawings

[0046] The drawings here are incorporated into the description and form a part of this description, showing embodiments consistent with the present invention and used together with the description to explain the principles of the present invention.

[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative efforts.

[0048] Figure 1 It is a schematic flowchart of an entity relationship extraction method provided by an embodiment of the present application;

[0049] Figure 2Schematic diagram of modules of an apparatus for entity relationship extraction provided by an embodiment of the present application;

[0050] Figure 3 Schematic diagram of the structure of an electronic device for implementing an entity relationship extraction method provided by an embodiment of the present application. Detailed implementation manners

[0051] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Apparently, the described embodiments are some but not all of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.

[0052] Figure 1 Flow chart of an entity relationship extraction method provided by an embodiment of the present application. In this embodiment, the entity relationship extraction method includes:

[0053] S1. Obtain a sentence instance and entities in the sentence instance, extract text semantic features from the sentence instance, and obtain a sentence semantic vector.

[0054] In an embodiment of the present invention, the sentence instance refers to a sentence for which entity relationship extraction is required. A preset text semantic feature extraction module can be used to extract text semantic features from the sentence instance.

[0055] Optionally, the text semantic feature module is composed of a BERT (Bidirectional Encoder Representations from Transformers) model and a Bi-LSTM (Bi-directional Long Short-Term Memory) model.

[0056] Specifically, the extracting text semantic features from the sentence instance to obtain a sentence semantic vector includes:

[0057] Construct an input sequence according to a pre-obtained first identifier, a second identifier, the sentence instance, and entities in the sentence instance;

[0058] Perform mask replacement on multiple entities in the input sequence to obtain a masked sequence;

[0059] Input the masked sequence into a preset BERT model to obtain a sequence vector;

[0060] Perform state transformation on the sequence vector based on a preset bidirectional long short-term memory network to obtain a final semantic vector;

[0061] Identify the position of the first second identifier in the final semantic vector, and retain the sequence before the first second identifier in the final semantic vector to obtain a sentence semantic vector.

[0062] Further, the constructing an input sequence according to the pre-obtained first identifier, second identifier, the sentence instance, and the entities in the sentence instance includes:

[0063] Add the first identifier to the front of the sentence instance, and add the second identifier to the end of the sentence instance to obtain a preposed sequence;

[0064] Insert the second identifier into the entities included in the sentence instance to obtain a postposed sequence, and splice the preposed sequence and the postposed sequence to obtain an input sequence.

[0065] Specifically, a first identifier representing the start and a second identifier representing the interval can be added. For example, the first identifier is [CLS], and the second identifier is [SEP].

[0066] Specifically, add the first identifier [CLS] to the front of the sentence instance, add the second identifier [SEP] to the end of the sentence instance, and the obtained preposed sequence is "[[CLS] sentence instance [SEP]]". Insert the second identifier [SEP] into the entities included in the sentence instance to obtain a postposed sequence [entity A [SEP] entity B [SEP]], and splice the preposed sequence and the postposed sequence to obtain an input sequence [[CLS] sentence instance [SEP] entity A [SEP] entity B [SEP]].

[0067] Specifically, multiple entities in the sentence instance can be identified by a pre-trained entity recognition model, or multiple entities in the sentence instance can be identified based on the definition of the entity.

[0068] In this embodiment, mask replacement is to replace multiple identified entities with preset mask parameters. For example, if S-ORG represents entity A and O-PER represents entity B, the obtained mask sequence is "[[CLS] sentence instance [SEP] S-ORG [SEP] O-PER [SEP]]".

[0069] Further, vector transformation, matrix transformation and other processes are performed using the BERT model, so that the masked sequence is output as a sequence vector. Based on a preset bidirectional long short-term memory network, state transformation is performed on the sequence vector to obtain a final semantic vector. The bidirectional long short-term memory network includes an input gate, an output gate, and a state gate. State transformation is performed on the sequence vector based on different modules to obtain a final semantic vector, and this final semantic vector contains rich feature information.

[0070] S2. Input the entities in the sentence instance into a standard entity embedding model for entity embedding to obtain entity embedding information.

[0071] In an embodiment of the present invention, the entities in the sentence instance are input into a standard entity embedding model for entity embedding to obtain entity embedding information. Among them, the standard entity embedding model adopted in this solution can be the PairRE model.

[0072] Among them, compared with the distance-based TransE model, TransH model, TransD model, and TransR model, the PairRE model can simultaneously encode complex relationships and multiple relationship patterns, and can well capture the semantic connections between relationship vectors, is more efficient, and can be applied to large-scale data sets.

[0073] Specifically, before inputting the entities in the sentence instance into a standard entity embedding model for entity embedding, the method further includes:

[0074] Identify multiple entities in the pre-acquired training data and the relationships between the multiple entities to obtain multiple entity relationships;

[0075] Perform triple generation processing on the multiple entities and the entity relationships according to a preset triple generation method to obtain multiple training triples;

[0076] Concatenate the triples with the same entities in the multiple training triples to obtain a training knowledge graph;

[0077] Use the training knowledge graph to train a preset entity embedding model to obtain a trained standard entity embedding model.

[0078] Specifically, the pre-acquired training data can be entity data from a Chinese general encyclopedia. The entities can be specific things such as people, places, organizations, concepts, etc. The relationships between entities can refer to relationships between people, relationships between people and organizations, relationships between concepts and certain objects, etc. Among them, entities can be divided into head entities and tail entities. The head entity refers to the first entity identified in the training data, and the corresponding tail entity and the relationship between entities are identified nearby. The relationship between entities is usually determined based on the nearby head entity and tail entity. After identifying the head entity, entity relationship, and tail entity, the entity accessed again is re-determined as the head entity, and the above operations are repeated until triples are obtained.

[0079] In this embodiment, triple generation processing is performed on the multiple entities and the entity relationships according to a preset triple generation method, that is, training triples are constructed according to the order of the head entity, entity relationship, and tail entity. For example, the training triple is: [head entity, entity relationship, tail entity].

[0080] Specifically, if the multiple training triples are [head entity A, entity relationship AB, tail entity B], [head entity A, entity relationship AC, tail entity C], and [head entity D, entity relationship DE, tail entity E] respectively. Since the training triple [head entity A, entity relationship AB, tail entity B] and the training triple [head entity A, entity relationship AC, tail entity C] contain the same head entity A, then [head entity A, entity relationship AB, tail entity B] and [head entity A, entity relationship AC, tail entity C] are spliced together, with head entity A as the center, and entity relationships AB and AC as connection lines to connect the corresponding tail entities, obtaining a training knowledge graph.

[0081] Furthermore, training the preset entity embedding model using the training knowledge graph to obtain a trained standard entity embedding model includes:

[0082] Extract the head entity and tail entity in any one of the training triples in the training knowledge graph, and project the head entity and the tail entity into a preset Euclidean space using the entity embedding model to obtain a head entity vector and a tail entity vector;

[0083] Calculate the Hadamard product between the head entity vector and the head entity to obtain a first Hadamard product, and calculate the Hadamard product between the tail entity vector and the head entity to obtain a second Hadamard product;

[0084] Construct a scoring function based on the first Hadamard product and the second Hadamard product, and calculate the scoring value corresponding to the scoring function;

[0085] When the scoring value is less than the scoring threshold, adjust the model parameters of the entity embedding model to obtain an entity embedding model with adjusted parameters, and re-execute the training step until the scoring value is greater than or equal to the scoring threshold;

[0086] When the scoring value is greater than or equal to the scoring threshold, output the entity embedding model as a trained standard entity embedding model.

[0087] Specifically, if any training triple is (h, r, t), where h is the head entity, r is the entity relationship, and t is the tail entity. Use the entity embedding model to project the head entity and the tail entity into a preset Euclidean space to obtain the head entity vector r H and the tail entity vector r T . Calculate the Hadamard product between the head entity vector and the head entity, that is, calculate the Hadamard product between the two, which can be denoted as °.

[0088] Specifically, the constructing the scoring function according to the first Hadamard product and the second Hadamard product includes:

[0089] f r (h,t) = -|h ο r H - t ο r T |

[0090] where, f r (h,t) is the scoring value, h ο r H is the first Hadamard product, t ο r T is the second Hadamard product, h is the head entity, r is the entity relationship, t is the tail entity, r H is the head entity vector, r T is the tail entity vector.

[0091] Furthermore, compare the scoring value with the scoring threshold. When the scoring value is less than the scoring threshold, adjust the model parameters of the entity embedding model to obtain an entity embedding model with adjusted parameters, and re-execute the training step until the scoring value is greater than or equal to the scoring threshold. When the scoring value is greater than or equal to the scoring threshold, output the entity embedding model as a trained standard entity embedding model.

[0092] S3. Screen standard embedding information from the entity embedding information, splice the standard embedding information with the sentence semantic vector and input it into a preset relationship extraction module to obtain an entity relationship.

[0093] In the embodiment of the present invention, the screening standard embedding information from the entity embedding information includes:

[0094] Vectorize the entities in the sentence instance to obtain entity vectors, calculate the dot product between the entity embedding information and the entity vectors to obtain the similarity;

[0095] Based on the similarity, perform screening processing on the entity embedding information to obtain standard embedding information.

[0096] Specifically, the performing screening processing on the entity embedding information based on the similarity to obtain standard embedding information includes:

[0097] Use the activation function in the pre-acquired gating unit to normalize the similarity to obtain a normalized value;

[0098] Judge the magnitude between the normalized value and a preset hyperparameter;

[0099] When the normalized value is less than the hyperparameter, perform deletion processing on the entity embedding information. When the normalized value is greater than or equal to the hyperparameter, output the entity embedding information as standard embedding information.

[0100] Specifically, the activation function is the softmax function. The softmax function is used in the classification module.

[0101] Among them, the entity relationship refers to the entity relationship between two entities in the sentence instance. Different entities may have different entity relationships. The method of simply judging whether there is an entity relationship based on the distance between two entities has insufficient accuracy. The relationship extraction module can ensure the accuracy of relationship extraction while improving the efficiency of relationship extraction.

[0102] For example, the sentence instance is "To promote the common development of two companies, Company A and Company B reached a cooperation relationship this year, with first-class services, first-class technologies, and first-class products, using intelligent technology to give wings to users to take off." Extract the text semantic features of the sentence instance to obtain the sentence semantic vector F. Input the sentence instance into the standard entity embedding model for entity extraction to obtain the entity embedding S. Perform entity screening processing on the entity embedding S to obtain the standard entity embedding G. Concatenate the standard entity embedding G and the sentence semantic vector F and input them into the preset relationship extraction module to obtain that the two entities are Company A and Company B, and the entity relationship is a cooperation relationship, that is, the entity relationship between Company A and Company B is a cooperation relationship.

[0103] In the embodiments of the present invention, by extracting text semantic features from sentence instances, sentence semantic vectors are obtained. The text semantic feature extraction can make the obtained sentence semantic vectors have rich feature information. The entities in the sentence instances are input into a standard entity embedding model for entity embedding to obtain entity embedding information. The entity embedding information after entity extraction by the standard entity embedding model includes the correlation relationship features among other entities. Standard embedding information is screened from the entity embedding information, and the standard embedding information is concatenated with the sentence semantic vector and input into a preset relationship extraction module to obtain entity relationships. The efficiency of entity relationship extraction is improved. Therefore, the entity relationship extraction method, device, electronic device, and computer-readable storage medium proposed by the present invention can solve the problem of low efficiency of entity relationship extraction.

[0104] As Figure 2 shown, an embodiment of the present application provides a schematic diagram of modules of an entity relationship extraction device 10. The entity relationship extraction device 10 includes: a semantic feature extraction module 11, an entity extraction module 12, and a relationship extraction module 13.

[0105] The semantic feature extraction module 11 is configured to obtain a sentence instance, extract text semantic features from the sentence instance, and obtain a sentence semantic vector;

[0106] The entity extraction module 12 is configured to input the entities in the sentence instance into a standard entity embedding model for entity embedding to obtain entity embedding information;

[0107] The relationship extraction module 13 is configured to screen standard embedding information from the entity embedding information, concatenate the standard embedding information with the sentence semantic vector, and input the result into a preset relationship extraction module to obtain entity relationships.

[0108] Specifically, each module in the entity relationship extraction device 10 in the embodiments of the present application uses the same technical means as the Figure 1 entity relationship extraction method described above and can produce the same technical effects, which will not be elaborated here.

[0109] As Figure 3 shown, an embodiment of the present application provides an electronic device, including a processor 111, a communication interface 112, a memory 113, and a communication bus 114. Among them, the processor 111, the communication interface 112, and the memory 113 complete communication with each other through the communication bus 114;

[0110] The memory 113 is used to store a computer program;

[0111] In an embodiment of the present application, when the processor 111 executes the program stored on the memory 113, it implements the entity relationship extraction method provided by any one of the foregoing method embodiments, including:

[0112] Obtain a sentence instance and the entities in the sentence instance, extract text semantic features from the sentence instance to obtain a sentence semantic vector;

[0113] Input the entities in the sentence instance into a standard entity embedding model for entity embedding to obtain entity embedding information;

[0114] Screen standard embedding information from the entity embedding information, splice the standard embedding information with the sentence semantic vector and input it into a preset relationship extraction module to obtain an entity relationship.

[0115] The above communication bus 114 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus 114 can be divided into an address bus, a data bus, a control bus, etc. For the sake of representation, only a thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0116] The communication interface 112 is used for communication between the above electronic device and other devices.

[0117] The memory 113 may include a Random Access Memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. Optionally, the memory 113 may also be at least one storage device located far from the foregoing processor 111.

[0118] The above-mentioned processor 111 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0119] An embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the entity relationship extraction method provided in any of the foregoing method embodiments are implemented.

[0120] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions according to the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from a website, computer, server, or data center to another website, computer, server, or data center in a wired manner (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wirelessly (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer, or a data storage device such as a server or data center that includes one or more integrated available media. The available medium can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid-state disk (SSD)).

[0121] It should be noted that in this document, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including", or any other variant thereof is intended to cover a non-exclusive inclusion, such that a process, method, article, or device including a series of elements includes not only those elements, but also other elements not expressly listed, or elements inherent to such process, method, article, or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article, or device including the element.

[0122] The above are only specific embodiments of the present invention, enabling those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to these embodiments shown herein, but rather will be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. An entity relationship extraction method, characterized in that, the method includes: Obtaining a sentence instance and entities in the sentence instance, extracting text semantic features from the sentence instance to obtain a sentence semantic vector; Inputting the entities in the sentence instance into a standard entity embedding model for entity embedding to obtain entity embedding information; Screening standard embedding information from the entity embedding information, splicing the standard embedding information with the sentence semantic vector and inputting it into a preset relationship extraction module to obtain an entity relationship; Before inputting the entities in the sentence instance into a standard entity embedding model for entity embedding, the method further includes: Identifying multiple entities in pre-obtained training data and the relationships between the multiple entities to obtain multiple entity relationships; Performing triple generation processing on the multiple entities and the entity relationships according to a preset triple generation method to obtain multiple training triples; Splicing the triples with the same entities in the multiple training triples to obtain a training knowledge graph; Using the training knowledge graph to train a preset entity embedding model to obtain a trained standard entity embedding model; The screening of the standard embedding information from the entity embedding information includes: Vectorizing the entities in the sentence instance to obtain entity vectors, calculating the dot product between the entity embedding information and the entity vectors to obtain a similarity; Normalizing the similarity using an activation function in a pre-obtained gated unit to obtain a normalized value; Judging the size between the normalized value and a preset hyperparameter; When the normalized value is less than the hyperparameter, performing deletion processing on the entity embedding information, and when the normalized value is greater than or equal to the hyperparameter, outputting the entity embedding information as standard embedding information.

2. The entity relationship extraction method according to claim 1, characterized in that, the extracting text semantic features from the sentence instance to obtain a sentence semantic vector includes: Constructing an input sequence according to a pre-obtained first identifier, second identifier, the sentence instance and the entities in the sentence instance; Performing mask replacement on multiple entities in the input sequence to obtain a mask sequence; Inputting the mask sequence into a preset BERT model to obtain a sequence vector; Performing state transformation on the sequence vector based on a preset bidirectional long short-term memory network to obtain a final semantic vector; Identifying the position of the first second identifier in the final semantic vector, and retaining the sequence before the first second identifier in the final semantic vector to obtain a sentence semantic vector.

3. The entity relationship extraction method according to claim 2, characterized in that, the constructing an input sequence according to a pre-obtained first identifier, second identifier, the sentence instance and the entities in the sentence instance includes: Adding the first identifier to the front of the sentence instance and adding the second identifier to the back of the sentence instance to obtain a prefixed sequence; Insert the second identifier into the entities included in the sentence instance to obtain a post-sequence, and splice the pre-sequence and the post-sequence to obtain an input sequence.

4. The entity relationship extraction method according to claim 1, characterized in that the training of the preset entity embedding model using the training knowledge graph to obtain a trained standard entity embedding model includes: Extract the head entity and the tail entity in any training triple in the training knowledge graph, and project the head entity and the tail entity into a preset Euclidean space using the entity embedding model to obtain a head entity vector and a tail entity vector; Calculate the Hadamard product between the head entity vector and the head entity to obtain a first Hadamard product, and calculate the Hadamard product between the tail entity vector and the head entity to obtain a second Hadamard product; Construct a scoring function based on the first Hadamard product and the second Hadamard product, and calculate the scoring value corresponding to the scoring function; When the scoring value is less than the scoring threshold, adjust the model parameters of the entity embedding model to obtain an entity embedding model with adjusted parameters, and re-execute the training step until the scoring value is greater than or equal to the scoring threshold; When the scoring value is greater than or equal to the scoring threshold, output the entity embedding model as a trained standard entity embedding model.

5. An entity relationship extraction device, characterized in that the device includes: A semantic feature extraction module, configured to obtain a sentence instance, extract text semantic features from the sentence instance, and obtain a sentence semantic vector; An entity extraction module, configured to input the entities in the sentence instance into a standard entity embedding model for entity embedding to obtain entity embedding information; A relationship extraction module, configured to screen standard embedding information from the entity embedding information, splice the standard embedding information with the sentence semantic vector, and input the result into a preset relationship extraction module to obtain an entity relationship; Before inputting the entities in the sentence instance into the standard entity embedding model for entity embedding, the entity extraction module further includes: Identify multiple entities in the pre-acquired training data and the relationships between the multiple entities to obtain multiple entity relationships; Perform triple generation processing on the multiple entities and the entity relationships according to a preset triple generation method to obtain multiple training triples; Splice the triples with the same entities in the multiple training triples to obtain a training knowledge graph; Use the training knowledge graph to train a preset entity embedding model to obtain a trained standard entity embedding model; The screening of the standard embedding information from the entity embedding information includes: Vectorize the entities in the sentence instance to obtain entity vectors, calculate the dot product between the entity embedding information and the entity vectors to obtain a similarity; Normalize the similarity using the activation function in the pre-acquired gating unit to obtain a normalized value; Judge the magnitude relationship between the normalized value and a preset hyperparameter; When the normalized value is less than the hyperparameter, perform deletion processing on the entity embedding information. When the normalized value is greater than or equal to the hyperparameter, output the entity embedding information as standard embedding information.

6. An electronic device, characterized in that it includes a processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete mutual communication through the communication bus; the memory is used for storing a computer program; the processor is used for implementing the steps of the entity relationship extraction method described in any one of claims 1-4 when executing the program stored on the memory.

7. A computer-readable storage medium, on which a computer program is stored, characterized in that when the computer program is executed by a processor, the steps of the entity relationship extraction method described in any one of claims 1-4 are implemented.

Citation Information

Patent Citations

  • Relation extraction method and system based on pre-trained convolutional neural network

    CN112084790A