Entity relationship extraction method and device, equipment and storage medium thereof

By performing entity sequence processing, feature extraction, and fusion on the text to be processed, the problem of insufficient accuracy in entity relation extraction is solved, and a higher relation extraction accuracy is achieved.

CN111709240BActive Publication Date: 2026-06-30TENCENT TECH WUHAN

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TENCENT TECH WUHAN
Filing Date
2020-05-14
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

Existing technologies have poor entity relationship extraction performance and insufficient accuracy.

Method used

Entity sequences are obtained by performing entity processing on the text to be processed. Text feature vectors and knowledge feature vectors are extracted, fused, and then classified to obtain the correspondence between candidate entity pairs.

Benefits of technology

It improves the accuracy of entity relationship extraction by acquiring feature information from multiple dimensions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111709240B_ABST
    Figure CN111709240B_ABST
Patent Text Reader

Abstract

The application discloses an entity relation extraction method, device and equipment and a storage medium thereof. The method comprises the following steps: performing entity processing on a to-be-processed text to obtain an entity sequence, wherein the entity sequence comprises a plurality of candidate entity pairs; performing feature extraction on the to-be-processed text according to a feature item contained in the to-be-processed text to obtain a text feature vector; performing feature extraction on the candidate entity pairs and candidate relations between the candidate entity pairs to obtain a knowledge feature vector; performing fusion processing on the text feature vector and the knowledge feature vector to obtain a text knowledge fusion feature; and performing classification processing on the text knowledge fusion feature to obtain a corresponding relation of each candidate entity pair. The technical scheme provided by the embodiment of the application can obtain multiple dimensions of features of the to-be-processed text to improve the accuracy of entity relation extraction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application generally relates to the field of natural language processing technology, and in particular to methods, apparatus, devices and storage media for entity relation extraction. Background Technology

[0002] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning.

[0003] Natural Language Processing (NLP) is an important field within computer science and artificial intelligence. It studies various theories and methods for enabling effective communication between humans and computers using natural language. NLP is a science that integrates linguistics, computer science, and mathematics. In NLP, entity relation extraction is a crucial component of knowledge graph construction; however, related technologies often suffer from poor extraction performance. Summary of the Invention

[0004] In view of the above-mentioned defects or deficiencies in the prior art, it is desirable to provide an entity relation extraction method, apparatus, device and its storage medium to improve the accuracy of entity relation extraction.

[0005] On the one hand, embodiments of this application provide an entity relation extraction method, which includes:

[0006] Entity processing is performed on the text to be processed to obtain an entity sequence, which includes multiple candidate entity pairs;

[0007] Feature extraction is performed based on the feature terms contained in the text to be processed to obtain the text feature vector;

[0008] Feature extraction is performed based on candidate entity pairs and the relationships between them to obtain knowledge feature vectors.

[0009] The text feature vector and knowledge feature vector are fused to obtain the text-knowledge fusion feature;

[0010] The text knowledge fusion features are classified to obtain the correspondence of each candidate entity pair.

[0011] On one hand, embodiments of this application provide an entity relationship extraction apparatus, which includes:

[0012] The entity processing unit is used to perform entity processing on the text to be processed to obtain an entity sequence, which includes multiple candidate entity pairs.

[0013] The first feature extraction unit is used to extract features according to the feature terms contained in the text to be processed, and obtain the text feature vector;

[0014] The second feature extraction unit is used to extract features according to the candidate entity pairs and the relationship between the candidate entity pairs to obtain the knowledge feature vector.

[0015] The text knowledge feature fusion unit is used to fuse text feature vectors and knowledge feature vectors to obtain text knowledge fusion features;

[0016] The relation classification processing unit is used to classify the text knowledge fusion features to obtain the corresponding relation for each candidate entity pair.

[0017] On one hand, embodiments of this application provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described in embodiments of this application.

[0018] On one hand, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, the computer program being used for:

[0019] When the computer program is executed by a processor, it implements the method as described in the embodiments of this application.

[0020] The entity relation extraction method, apparatus, device, and storage medium provided in this application embodiment improve the accuracy of entity relation extraction by performing entity processing on the text to be processed to obtain an entity sequence, which includes multiple candidate entity pairs; extracting features according to the feature items contained in the text to be processed to obtain a text feature vector; extracting features according to the relationships between candidate entity pairs to obtain a knowledge feature vector; fusing the text feature vector and the knowledge feature vector to obtain a text knowledge fusion feature; and classifying the text knowledge fusion feature to obtain the correspondence of each candidate entity pair. This application embodiment improves the accuracy of entity relation extraction by obtaining features from multiple dimensions of the text to be processed. Attached Figure Description

[0021] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings:

[0022] Figure 1 This is a schematic diagram of the architecture of the entity relationship extraction system provided in the embodiments of this application;

[0023] Figure 2 A schematic diagram of the structure of a computer system suitable for implementing the embodiments of this application is shown;

[0024] Figure 3 A flowchart illustrating the entity relation extraction method provided in an embodiment of this application is shown.

[0025] Figure 4 A flowchart illustrating the entity relation extraction method provided in an embodiment of this application is shown.

[0026] Figure 5 The training process of the knowledge graph embedding model provided in the embodiments of this application is illustrated;

[0027] Figure 6 A flowchart illustrating the entity relation extraction method provided in an embodiment of this application is shown.

[0028] Figure 7 A complete flowchart of the entity relation extraction method provided in the embodiments of this application is shown;

[0029] Figure 8 A schematic diagram of the entity relationship extraction device provided in an embodiment of this application is shown. Detailed Implementation

[0030] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the relevant disclosure and not intended to limit the scope of the disclosure. Furthermore, it should be noted that, for ease of description, only the parts relevant to the disclosure are shown in the accompanying drawings.

[0031] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0032] Technical Terminology Explanation

[0033] Candidate entity: refers to a distinguishable and independently existing entity. Examples include person names, place names, and products. A candidate entity pair is any combination of two or more candidate entities.

[0034] Relation extraction: Determine whether a relationship exists between two or more entities contained in a candidate entity pair.

[0035] Relationship Classification: When there are multiple relationships between two entities contained in a candidate entity pair, determine which type of relationship the candidate entity pair belongs to.

[0036] Feature terms refer to the collective term for the basic linguistic units contained in a text. These basic linguistic units can include characters, words, phrases, sentences, paragraphs, etc.

[0037] The entity relation extraction method provided in this application can be applied to, for example, Figure 1 The application environment shown. Please refer to... Figure 1 , Figure 1 This is a schematic diagram of the architecture of the entity relationship extraction system provided in the embodiments of this application. For example... Figure 1 As shown, user terminal 101 can communicate with server 103 via network 102. User terminal 101 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices.

[0038] User terminal 101 and server 103 are directly or indirectly connected via a wired or wireless communication network 102. Optionally, the aforementioned wireless or wired communication network may use standard communication technologies and / or protocols. The network is typically the Internet, but can also be any network, including but not limited to any combination of Local Area Network (LAN), Metropolitan Area Network (MAN), Wide Area Network (WAN), mobile, wired or wireless networks, private networks, or virtual private networks.

[0039] Server 103 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. Server 103 provides search results to terminal device 101.

[0040] When a search request is received from user terminal 101, the system can further analyze and understand the user's search intent by deeply mining the semantic information between entities based on a pre-built knowledge graph library. Therefore, the accuracy of the entity relationship extraction results in the knowledge graph library can affect the accuracy of the search results provided to user terminal 101.

[0041] The following is for reference. Figure 2 , Figure 2 A schematic diagram of the structure of a computer system suitable for implementing the embodiments of this application is shown.

[0042] like Figure 2As shown, the computer system includes a central processing unit (CPU) 201, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 202 or programs loaded from storage section 208 into random access memory (RAM) 203. RAM 203 also stores various programs and data required for system operation. CPU 201, ROM 202, and RAM 203 are interconnected via bus 204. Input / output (I / O) interface 205 is also connected to bus 504.

[0043] The following components are connected to I / O interface 205: an input section 206 including a keyboard, mouse, etc.; an output section 207 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 208 including a hard disk, etc.; and a communication section 209 including a network interface card such as a LAN card, modem, etc. The communication section 209 performs communication processing via a network such as the Internet. Drive 210 is also connected to I / O interface 205 as needed. Removable media 211, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 210 as needed so that computer programs read from them can be installed into storage section 208 as needed.

[0044] Specifically, according to embodiments of this application, reference is made below to flowchart illustrations. Figure 3 The described process can be implemented as a computer software program. For example, embodiments of this application include a computer program product comprising a computer program carried on a machine-readable medium, the computer program containing program code for performing the methods shown in the flowchart. In such embodiments, the computer program can be downloaded and installed from a network via communication section 209, and / or installed from removable medium 211. When the computer program is executed by central processing unit (CPU) 201, it performs the functions defined in the system of this application.

[0045] It should be noted that the computer-readable medium shown in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0046] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0047] The units or modules described in the embodiments of this application can be implemented in software or in hardware.

[0048] In some embodiments, the apparatus provided by the present invention can be implemented in software and stored in the storage portion 208 or the removable medium 211. It can be software in the form of programs and plug-ins, and can be arbitrarily combined or further divided according to the implemented functions. The functions of each module will be described below. The described units or modules can also be disposed in a processor. For example, it can be described as: a processor including an entity processing unit, a first feature extraction unit, a second feature extraction unit, a feature fusion unit, and a classification processing unit. The names of these units or modules do not necessarily constitute a limitation on the unit or module itself. For example, the entity processing unit can also be described as "a unit for performing entity processing on the text to be processed to obtain an entity sequence".

[0049] This application also provides a computer-readable storage medium, which may be included in the electronic device described in the following embodiments; or it may exist independently and not assembled into the electronic device. The aforementioned computer-readable storage medium stores one or more programs that are used by one or more processors to execute the entity relation extraction method described in this application. For example, the electronic device may implement... Figure 3 The steps shown.

[0050] In other embodiments, the apparatus provided in the embodiments of the present invention can be implemented in hardware, such as a processor in the form of a hardware decoding processor, which is programmed to execute the entity relation extraction method provided in the embodiments of the present invention.

[0051] The entity relation extraction method provided in this application embodiment can be applied to... Figure 1 The user terminal in the system can also be used on the server.

[0052] The following is combined with Figure 3 To understand the entity relation extraction method proposed in the embodiments of this application, we will use its application to a server as an example for explanation. Please refer to... Figure 3 , Figure 3 A flowchart illustrating the entity relation extraction method provided in an embodiment of this application is shown. Figure 3 As shown, the method includes:

[0053] Step 301: Perform entity processing on the text to be processed to obtain an entity sequence, which includes multiple candidate entity pairs;

[0054] Step 302: Extract features according to the feature terms contained in the text to be processed to obtain the text feature vector;

[0055] Step 303: Extract features according to candidate entity pairs and candidate relationships between candidate entity pairs to obtain knowledge feature vectors;

[0056] Step 304: The text feature vector and knowledge feature vector are fused to obtain the text knowledge fusion feature;

[0057] Step 305: Classify the text knowledge fusion features to obtain the correspondence of each candidate entity pair.

[0058] In the above steps, the server performs entity processing on the text to be processed. This can be triggered by a request sent by the user terminal or by the server based on pre-configured information. For example, the user terminal sends a request to the server to extract relations from the text to be processed. After receiving the request, the server generates a relation extraction task to extract relations from the text to be processed. Alternatively, the server generates a relation extraction task according to pre-configured information. The text to be processed can be text obtained by crawling the internet using a web crawling tool, or it can be other documents, such as text data stored in a database. The text to be processed can include one, two, or more texts.

[0059] Entity processing can utilize Named Entity Recognition (NER) to extract candidate entities from the text being processed. Other entity acquisition methods can also be used. Candidate entities identified by NER can include names of people, places, organizations, proper nouns, etc.

[0060] An entity sequence refers to the set of all candidate entities extracted from the text to be processed.

[0061] Entity extraction is performed on the text to be processed to obtain multiple candidate entities;

[0062] Combine any two of the multiple candidate entities to obtain an entity sequence.

[0063] After entity processing, multiple feature vectors are obtained by extracting features from the text to be processed from multiple dimensions. These multiple dimensions refer to textual information used to represent the text to be processed, or knowledge information used to extract features from the text. The multiple feature vectors can include textual feature vectors and knowledge feature vectors.

[0064] The text feature vector is extracted from the feature terms contained in the text to be processed. For example, character vectors are extracted from the characters contained in the text to be processed, and word vectors are extracted from the characters contained in the text to be processed.

[0065] Among them, the knowledge feature vector is extracted based on the candidate entity pairs and the relationships between them. For example, the text to be processed includes multiple candidate entity pairs {(s1, o1), ..., (s... m-1 o m-1 )}, where s is the first entity of the candidate entity pair and o is the last entity of the candidate entity pair. m-1 represents the number of candidate entity pairs constructed.

[0066] Suppose that for a candidate entity pair (s1, o1), a pre-built knowledge graph embedding model is used to process it, resulting in an entity vector corresponding to the candidate entity pair (s1, o1). And the candidate relation p corresponding to the candidate entity pair (s1, o1) i corresponding embedding vector Embedding vectors can also be called relation vectors corresponding to candidate relations. Based on the entity vectors and all embedding vectors, the knowledge feature vector corresponding to the candidate entity pair (s1, o1) is calculated. This knowledge feature vector can be represented as... in, p represents the score of the i-th candidate relation of candidate entity pair (s1, o1). i Let be the i-th candidate relation of the candidate entity pair (s1, o1). k represents the number of candidate relations between the candidate entity pair (s1, o1). A candidate relation refers to the existing relationship between candidate entity pairs in the pre-built knowledge graph embedding model.

[0067] Then, the text feature vector and knowledge feature vector are fused to obtain a fused feature. This fused feature can characterize the relationship between candidate entity pairs based on the textual and knowledge information contained in the text to be processed. Classification processing of the fused feature can obtain the candidate correspondence. This correspondence is determined based on the probability value of the candidate relationship, among the multiple candidate relationships between candidate entity pairs, by identifying the candidate relationship corresponding to the one with the highest probability value.

[0068] Classification processing refers to using multi-classification algorithms to determine the probability values ​​of multiple candidate relations corresponding to candidate entity pairs based on the fused features. For example, a multi-classification algorithm can be a softmax classification layer. A softmax classification layer includes a fully connected layer, meaning that the fused features can be input into a fully connected layer for multi-classification processing. Multi-classification algorithms can also be based on classification models built using convolutional neural networks or long short-term memory networks. These models perform multi-classification recognition on multiple candidate relations to obtain the correspondence between candidate entity pairs.

[0069] This application's embodiments achieve entity relationship extraction by extracting feature vectors from multiple dimensions. Compared with related technologies that only utilize the feature information of the text itself for relationship extraction, this application can effectively improve the accuracy of relationship extraction.

[0070] Please refer to Figure 4 , Figure 4 A flowchart illustrating the entity relation extraction method provided in an embodiment of this application is shown. Figure 4 As shown, the method includes:

[0071] Step 401: Perform entity processing on the text to be processed to obtain an entity sequence, which includes multiple candidate entity pairs.

[0072] Step 402: The text to be processed is segmented according to the feature term granularity to obtain a feature term sequence corresponding to the text to be processed. The feature term sequence includes multiple feature terms.

[0073] Step 403: Construct text feature vectors based on the feature term sequence;

[0074] Step 404 involves calling a pre-built knowledge graph embedding model to perform relation embedding processing on multiple candidate entity pairs, obtaining the knowledge feature vector corresponding to each candidate entity pair. The knowledge graph embedding model is trained using a training dataset obtained by annotating the text to be processed from a known knowledge graph.

[0075] Step 405: The text feature vector and knowledge feature vector are fused to obtain the text knowledge fusion feature;

[0076] Step 406: Classify the text knowledge fusion features to obtain the correspondence of each candidate entity pair.

[0077] The above steps can be divided into two processing directions for the text to be processed: extracting text feature vectors and extracting knowledge feature vectors. The extraction of text feature vectors can be achieved by first segmenting the text according to feature granularity and then calling a pre-built indicator graph embedding model to perform relation embedding processing on multiple candidate entities. The execution order of the segmentation and relation embedding steps is not limited. Preferably, the two steps are executed simultaneously, which helps save processing time and improve processing efficiency.

[0078] In this context, feature granularity refers to the unit at which the text to be processed is segmented. Feature granularity can be character-level, word-level, sentence-level, paragraph-level, etc., and can be any one of these segmentation units or a combination of multiple segmentation units. Preferably, feature granularity is a combination of character-level and word-level granularity. The text to be processed can be segmented according to character-level and word-level granularity respectively, resulting in character sequences and word sequences. Segmentation can be understood as word segmentation, where the segmentation object is a single Chinese character or a word composed of two Chinese characters. A character sequence refers to the set of characters obtained after segmenting the text to be processed. A word sequence refers to the set of words obtained after segmenting the text to be processed.

[0079] After segmenting the text to be processed, constructing a text feature vector based on the feature term sequence may include the following steps: converting the feature term sequence into a feature term vector corresponding to the feature term sequence; obtaining the feature term position information corresponding to the feature term sequence; and performing convolutional pooling processing based on the feature term vector and the feature term position information to obtain the text feature vector.

[0080] Calling a pre-built knowledge graph embedding model to perform relation embedding processing on multiple candidate entity pairs can be understood as using the pre-built knowledge graph embedding model to extract features of various candidate relations between candidate entity pairs, which are then used as embedded relation vectors. The embedded relation vectors can use the relation score result corresponding to each candidate relation as elements. Specifically, each candidate entity pair can be input into the knowledge graph embedding model, which outputs a relation score result corresponding to each candidate entity pair; each relation score result is normalized, and its reciprocal is taken to obtain the relation feature value corresponding to each relation score result; each of these relation feature values ​​is then used as an element in the knowledge feature vector.

[0081] The training process of the knowledge graph embedding model is as follows: Figure 5 As shown. Figure 5 This illustration shows the training process of the knowledge graph embedding model provided in this application. A large amount of internet text is acquired using web crawling tools. Named entity recognition (NID) methods are used to extract training entity sequences contained in the internet text from natural text. Any two entities in the training entity sequence are used to construct a training entity pair. The data contained in the internet text is labeled using graph relations contained in the knowledge base; for example, graph relations are represented in the form of triples (s, p, o). Positive training sample labeling is performed on the training entity pair (s, o). That is, if the internet text contains the training entity pair (s, o), then the training entity pair (s, o) is labeled with relation p. If the internet text does not contain the training entity pair (s, o), then the relation "NA" is labeled.

[0082] Then, the entity type of the training entity pair (s, o) is used to restrict the labeling of negative training samples, and the entity type of the training entity pair is labeled as (T). s , T o Based on the knowledge base, obtain the set of relations (R) related to the training entity pair (s, o). s R o ), in relation set (R s R o A relation p′ is randomly selected from the set of relations R to serve as the relation for the training entity pair (s, o), and negative training samples (s, p′, o) are generated. The relation set is the set of relations R associated with the first training entity s. s The relation R related to the second training entity o o The union of the sets, i.e., R s ∪R o .

[0083] The training sample set, consisting of positive and negative training samples, is used to train the knowledge graph embedding model. Using a knowledge base as prior knowledge to train the knowledge graph embedding model can introduce additional information beyond the text. Compared to related technologies that only extract information from the text itself for relation extraction, this application's embodiment utilizes a knowledge graph embedding model to effectively extract predicted relation information between entity pairs in the text, thereby improving the accuracy of relation extraction.

[0084] Optionally, obtaining the feature term location information corresponding to the feature term sequence may further include the following steps:

[0085] Obtain the first relative position between each feature item and the first candidate entity in the candidate entity pair, and the second relative position between each feature item and the second candidate entity in the candidate entity pair;

[0086] The first relative position and the second relative position are concatenated to obtain position information that corresponds one-to-one with each feature item.

[0087] The position information corresponding to each feature item is concatenated to obtain the feature item position information corresponding to the feature item sequence.

[0088] Optionally, the convolutional pooling process based on feature term vectors and feature term location information to obtain text feature vectors may also include the following steps: fusing the feature term vectors and feature term location information to obtain a fused feature term vector; performing a one-dimensional convolution operation on the feature term vectors corresponding to the text to be processed to obtain a convolution result; performing segmented max pooling on the convolution result according to candidate entity pairs to obtain multiple pooling results; and concatenating the multiple pooling results to obtain the text feature vector.

[0089] The aforementioned fusion process refers to concatenating the feature term vector and the feature term position information. The following example, using a combination of multiple feature term granularities, further illustrates the entity relation extraction method provided in this application. Please refer to... Figure 6 , Figure 6 A flowchart illustrating the entity relationship extraction method provided in an embodiment of this application is shown.

[0090] Step 601: Perform entity processing on the text to be processed to obtain an entity sequence, which includes multiple candidate entity pairs;

[0091] Step 602a: The text to be processed is segmented according to the character granularity to obtain the character sequence corresponding to the text to be processed.

[0092] Step 602b: Segment the text to be processed according to word granularity and obtain the word sequence corresponding to the text to be processed.

[0093] Step 602c involves calling a pre-built knowledge graph embedding model to perform relation embedding processing on multiple candidate entity pairs, obtaining a knowledge feature vector corresponding to each candidate entity pair. The knowledge graph embedding model is trained using a training dataset obtained by annotating the text to be processed from a known knowledge graph.

[0094] Step 603a: Convert the character sequence into a character vector corresponding to the character sequence.

[0095] Step 603b: Convert the word sequence into word vectors corresponding to the word sequence.

[0096] Step 604a: Obtain the character position information corresponding to the character sequence.

[0097] Step 604b: Obtain the word position information corresponding to the word sequence.

[0098] Step 605a: Perform convolutional pooling on the character vectors and character position information to obtain the character feature vectors corresponding to the character sequence.

[0099] Step 605b involves performing convolutional pooling on the word vectors and word position information to obtain the word feature vectors corresponding to the word sequence.

[0100] Step 606: The character feature vector and the word feature vector are fused to obtain the character-word fusion feature;

[0101] Step 607: Perform linear processing on the word fusion features to obtain the text feature vector.

[0102] Step 608: The text feature vector and knowledge feature vector are fused to obtain the text knowledge fusion feature;

[0103] Step 609: Classify the text knowledge fusion features to obtain the correspondence of each candidate entity pair.

[0104] In the above steps, convolutional pooling is performed based on feature term vectors and feature term location information, and can be processed according to different feature term granularities.

[0105] The convolutional pooling process for character vectors and character position information may include the following steps:

[0106] The character vectors and character position information are fused to obtain character fusion features;

[0107] Perform a one-dimensional convolution operation on the character fusion features to obtain the first convolution result;

[0108] The first convolution result is segmented into maximum pooling based on candidate entity pairs to obtain multiple first pooling results.

[0109] The results of multiple first pooling operations are concatenated to obtain the character feature vector corresponding to the character sequence.

[0110] The convolutional pooling process for word vectors and word position information may include the following steps:

[0111] Word vectors and word position information are fused to obtain word fusion features;

[0112] A one-dimensional convolution operation is performed on the word fusion features to obtain the second convolution result;

[0113] The second convolution result is processed by segmented max pooling according to the candidate entity pairs to obtain multiple second pooling results;

[0114] Multiple second pooling results are concatenated to obtain the character feature vector corresponding to the word sequence.

[0115] Segmented max pooling of the convolution result according to the candidate entities can include: dividing the convolution result into multiple convolution segments according to the relative positional relationship between the character or word and the candidate entity pair. For example, the first convolution segment is the convolution result from the first character of the text to be processed to the first candidate entity of the candidate entity pair, the second convolution segment is the convolution result from the first candidate entity to the second candidate entity, and the third convolution segment is the convolution result from the second candidate entity to the last character of the text to be processed.

[0116] Max pooling is performed on each of the three convolutional segments to obtain three pooling results. The three pooling results are then concatenated to obtain the character feature vector.

[0117] Similarly, the same processing described above is applied to the second convolution result to obtain the word feature vector. Max pooling is then used to obtain a fixed-dimensional output.

[0118] The linear processing described above involves applying a linear transformation to the word-to-word fusion features. For example, the linear transformation of the word-to-word fusion feature f can be achieved using the following formula:

[0119] f′=σ(Gf+b)

[0120] Where G and b are linear parameters, and σ is the activation function.

[0121] The embodiments of this application consider character-level, word-level information and embedding relationship information between entity pairs in the relation extraction model, which can reduce the impact of word segmentation errors on the model and thus improve the extraction accuracy of the model.

[0122] The following is combined with Figure 7 The entity relationship extraction method provided in the embodiments of this application will be described in detail. Figure 7 A complete flowchart of the entity relation extraction method provided in this application embodiment is shown. The entity relation extraction method provided in this application embodiment can generally include two stages: a model training stage and a model application stage.

[0123] During the model training phase, through methods such as Figure 5 The model training method shown is used to construct a knowledge graph embedding model.

[0124] In the model application phase, after obtaining the input text, the named entity recognition method is used to identify multiple entities from the input text, resulting in an entity sequence composed of multiple entities.

[0125] The above input text is subjected to word embedding position encoding, character embedding position encoding, and construction of candidate entity pairs (s,o).

[0126] The character embedding position encoding process for the input text includes: segmenting the input text into characters to obtain a character sequence C = {c1, c2, ... c...} m}, obtain the text vector representation corresponding to the input text as in, This represents the character vector corresponding to the i-th character; concatenate the character vectors corresponding to the m characters to form the text character vector corresponding to the input text.

[0127] The text character position information corresponding to the input text is obtained based on the positional relationship between each character in the input text and the candidate entity pair (s,o). in, This represents the relative position of the i-th character and the candidate entity s. This represents the relative position of the i-th character and candidate entity o. That is, the input text is encoded according to its distance from the candidate entities, yielding positional encoding data corresponding to candidate entities s and o.

[0128] Then, the text character vectors and text character position information are fused to obtain the text character fusion features. in The character fusion feature corresponding to the i-th character is formed by concatenating the character vector corresponding to the i-th character, the position information of the i-th character relative to the candidate entity s, and the position information of the i-th character relative to the candidate entity o. The text character fusion feature is formed by concatenating all characters of the input text.

[0129] After obtaining the text word fusion features, a one-dimensional convolution process is performed on the text word fusion features to obtain the convolution result. Then the convolution result is divided into three segments, among which This represents the convolution result from the first character of the text to the candidate entity s;

[0130] This represents the convolution result from candidate entity s to candidate entity o;

[0131] This represents the convolution result from candidate entity 'o' to the last character of the text.

[0132] Max pooling is performed on the three convolutional segments mentioned above, and the pooling results represent the pooling results corresponding to the i-th convolutional segment. in, This represents the pooling result of the convolution of the i-th convolution segment with respect to the j-th convolution result. This represents the pooling result of the i-th convolutional kernel, where i takes any value from [1,3].

[0133] Then, the three pooling results are concatenated to obtain the character features.

[0134] Through the above one-dimensional convolution and segmented max pooling operations, the corresponding character feature vectors can be obtained based on the text character fusion features.

[0135] Similarly, open-source word segmentation tools can be used to segment the input text, that is, to segment it according to this granularity to obtain the word sequence W = {w1, w2, ..., w...}. n Open-source word segmentation tools can also be used to obtain text word vectors corresponding to word sequences.

[0136]

[0137] Following the same steps as the word processing described above, obtain the text word position information:

[0138]

[0139] Word fusion features can be obtained by fusing text word vectors and text word position information:

[0140]

[0141] in, The word fusion feature corresponding to the i-th word is formed by concatenating the word vector corresponding to the i-th word, the position information of the i-th word relative to the candidate entity s, and the position information of the i-th word relative to the candidate entity o. The text word fusion feature is formed by concatenating all words in the input text.

[0142] Following the same feature extraction steps as the word processing described above, the text word fusion features are subjected to one-dimensional convolution processing to obtain the convolution result. Then, the convolution result is divided into three segments, among which... This represents the convolution result from the first word of the text to the candidate entity s; This represents the convolution result from candidate entity s to candidate entity o;

[0143] This represents the convolution result from candidate entity 'o' to the last word of the text.

[0144] Max pooling is performed on the three convolutional segments mentioned above, and the pooling results represent the pooling results corresponding to the i-th convolutional segment. in, This represents the pooling result of the convolution of the i-th convolution segment with respect to the j-th convolution result. This represents the pooling result of the i-th convolutional kernel, where i takes any value from [1,3].

[0145] Then, the three pooling results are concatenated to obtain the character features.

[0146] Through the above one-dimensional convolution and segmented max pooling operations, the corresponding word feature vectors can be obtained based on the text word fusion features.

[0147] Reuse Figure 5 The knowledge graph embedding model is trained to obtain the embedding vectors between candidate entity pairs in the input text. That is, the candidate entity pairs are input into the knowledge graph embedding model, and the output is the entity vector corresponding to each candidate entity, i.e., the entity vector corresponding to the candidate entity pair. Candidate relation p corresponding to candidate entity pair (s1, o1) i corresponding embedding vector Then, based on the scoring function of the knowledge graph embedding model, the candidate relation p is evaluated. i Rate it:

[0148]

[0149] in, It is the entity vector corresponding to the candidate entity s obtained based on the knowledge graph embedding model. It is the entity vector corresponding to the candidate entity o obtained based on the knowledge graph embedding model. It is a candidate relation p between candidate entity pairs (s,o) obtained based on a knowledge graph embedding model. i The corresponding embedding vector.

[0150] Based on the scoring function described above, the candidate relation p of the candidate entity pairs is calculated. i The corresponding scoring result is then normalized using the following formula:

[0151]

[0152] Calculate the scores for all candidate relations of the candidate entity pair (s,o) respectively, and obtain the results. Where k is the number of relations corresponding to the candidate entity pair (s,o). Let f e As a knowledge feature vector.

[0153] After obtaining the character feature vector, word feature vector, and knowledge feature vector, the three are fused. This can be achieved by first concatenating the character feature vector and the word feature vector to obtain the concatenated character-word vector. Then, a linear transformation is used to concatenate the word vector f. WC Transforming it into k dimensions yields the text feature vector, i.e., f. WC ′=σ(Gf WC +b). Where G and b are linear parameters, and σ is the activation function.

[0154] The text feature vector f WC ′ and knowledge feature vector f e The text knowledge fusion features are obtained by performing fusion processing according to the following formula:

[0155] f=αf e +(1-α)f WC ′

[0156] Finally, the text knowledge fusion features are input into the softmax layer. The softmax layer is used to select the candidate relation with the highest probability value from multiple candidate relations as the relation corresponding to the candidate entity pair (s,o), and this is used as the output of the softmax layer.

[0157] Feeding the output back into the knowledge base can correct the relationship between candidate entity pairs (s,o), thus improving the accuracy of entity relationship extraction.

[0158] It should be noted that although the operations of the method proposed in this application are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. On the contrary, the steps depicted in the flowchart can be performed in a different order. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.

[0159] The entity relationship extraction apparatus provided in the embodiments of this application will be further described below. Please refer to... Figure 7 , Figure 7 This illustration shows a schematic diagram of the entity relation extraction device provided in an embodiment of this application. The device provided in this embodiment can be implemented using software or hardware methods, combined with… Figure 7 An entity relationship extraction device, exemplarily described, stored in a storage portion or removable medium, may include:

[0160] The entity processing unit 701 is used to perform entity processing on the text to be processed to obtain an entity sequence, which includes multiple candidate entity pairs.

[0161] The first feature extraction unit 702 is used to extract features according to the feature terms contained in the text to be processed, and obtain the text feature vector;

[0162] The second feature extraction unit 703 is used to extract features according to the candidate entity pairs and the relationship between the candidate entity pairs to obtain a knowledge feature vector.

[0163] The text knowledge feature fusion unit 704 is used to fuse text feature vectors and knowledge feature vectors to obtain text knowledge fusion features;

[0164] The relation classification processing unit 705 is used to classify the text knowledge fusion features to obtain the correspondence of each candidate entity pair.

[0165] The entity processing unit 701 may further include:

[0166] The entity extraction subunit is used to extract entities from the text to be processed, resulting in multiple candidate entities.

[0167] The entity combination subunit is used to combine any two of multiple candidate entities to obtain an entity sequence.

[0168] The first feature extraction subunit is used to extract text feature vectors from the text to be processed; the second feature extraction subunit is used to extract knowledge feature vectors from the text to be processed.

[0169] The first feature extraction subunit also includes:

[0170] The text segmentation module is used to segment the text to be processed according to the feature term granularity to obtain a feature term sequence corresponding to the text to be processed. This feature term sequence includes multiple feature terms.

[0171] The vector construction module is used to construct text feature vectors based on a sequence of feature terms.

[0172] The vector building block is also used for:

[0173] Each feature term contained in the feature term sequence is transformed into a feature term vector corresponding to each feature term;

[0174] Obtain the feature term location information corresponding to each feature term contained in the feature term sequence;

[0175] Convolutional pooling is performed based on the feature term vectors corresponding to the feature term sequence and the feature term position information corresponding to the feature term sequence to obtain the text feature vector.

[0176] The vector construction module is also used to: obtain the first relative position between each feature term and the first candidate entity in the candidate entity pair and the second relative position between each feature term and the second candidate entity in the candidate entity pair;

[0177] By concatenating the first relative position and the second relative position, we obtain the feature position information that corresponds one-to-one with each feature item.

[0178] The vector building block is also used for:

[0179] The feature term vectors corresponding to each feature term are concatenated to obtain the feature term vectors corresponding to the feature term sequence.

[0180] The feature item position information corresponding to each feature item is concatenated to obtain the feature item position information corresponding to the feature item sequence.

[0181] The feature term vector corresponding to the feature term sequence and the feature term position information corresponding to the feature term sequence are fused to obtain the feature term fusion vector.

[0182] Perform a one-dimensional convolution operation on the feature term fusion vector to obtain the convolution result;

[0183] The convolution results are segmented into maximum pooling based on candidate entity pairs to obtain multiple pooling results.

[0184] Multiple pooling results are concatenated to obtain the text feature vector.

[0185] Preferably, the feature granularity includes character granularity and word granularity, then the text segmentation module is used for:

[0186] The text to be processed is segmented at both the character level and the word level to obtain the character sequence and the word sequence corresponding to the text to be processed.

[0187] The feature sequence includes: the character sequence corresponding to the text to be processed and the word sequence corresponding to the text to be processed. The vector construction module is then used for:

[0188] Convert the character sequence and word sequence into character vectors and word vectors, respectively;

[0189] Obtain the character position information corresponding to the character sequence and the word position information corresponding to the word sequence;

[0190] Convolutional pooling is performed on the character vectors and character position information to obtain the character feature vectors corresponding to the character sequence.

[0191] Convolutional pooling is performed on word vectors and word position information to obtain word feature vectors corresponding to the word sequence.

[0192] The character feature vector and the word feature vector are fused to obtain the character-word fusion feature;

[0193] The text feature vector is obtained by linearly processing the fused word features.

[0194] The second feature extraction subunit is also used for:

[0195] The pre-built knowledge graph embedding model is invoked to perform relation embedding processing on multiple candidate entity pairs, obtaining a knowledge feature vector corresponding to each candidate entity pair. The knowledge graph embedding model is trained on a training dataset obtained by annotating the text to be processed using a known knowledge graph.

[0196] The knowledge feature extraction subunit is also used to: input each candidate entity pair into the knowledge graph embedding model and output the relation score result corresponding to each candidate entity pair; normalize each relation score result and then take the reciprocal to obtain the relation feature value corresponding to each relation score result; and use the relation feature value as an element contained in the knowledge feature vector.

[0197] The text knowledge feature fusion unit 703 is also used for:

[0198] Multiply the text feature vector by the text weight coefficient to obtain the first product result;

[0199] Multiply the knowledge feature vector by the knowledge weight coefficient to obtain the second product result;

[0200] The sum of the first and second product results is used to obtain the text knowledge fusion feature, and the sum of the knowledge weight coefficient and the text weight coefficient is 1.

[0201] It should be understood that the units or modules recorded in the entity relation extraction device are related to the reference. Figure 3 The steps in the described method correspond to each other. Therefore, the operations and features described above for the method also apply to the entity relation extraction device and the units contained therein, and will not be repeated here. The entity relation extraction device can be pre-implemented in the browser or other security applications of an electronic device, or it can be loaded into the browser or other security applications of an electronic device through download or other means. The corresponding units in the entity relation extraction device can cooperate with the units in the electronic device to implement the solution of the embodiments of this application.

[0202] The division of modules or units mentioned in the detailed description above is not mandatory. In fact, according to the embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0203] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of disclosure in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the foregoing disclosed concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.

Claims

1. An entity relation extraction method, characterized by, The method includes: The text to be processed is subjected to entity processing to obtain an entity sequence, which includes multiple candidate entity pairs; For the feature items contained in the text to be processed, feature extraction is performed on the feature items to obtain a feature item vector; the first relative position between the feature item and the first candidate entity in the corresponding candidate entity pair, and the second relative position between the feature item and the second candidate entity in the candidate entity pair are obtained; the first relative position and the second relative position are concatenated to obtain feature item position information; the feature item vector and the feature item position information are fused to obtain the fused feature corresponding to the feature item; the fused features corresponding to each feature item are fused to obtain the text feature vector; Based on the knowledge graph embedding model, the entity vector of each candidate entity in each candidate entity pair is calculated, the embedding vector corresponding to each candidate relation is determined based on each entity vector, the candidate relation is scored based on the scoring function of the knowledge graph embedding model itself, and the scoring results of each relation are normalized to obtain the knowledge feature vector corresponding to the candidate entity pair. The knowledge feature vector indicates the confidence score of each candidate relation predicted by the knowledge graph embedding model. The text feature vector and the knowledge feature vector are weighted and summed to obtain the text knowledge fusion feature; The text knowledge fusion features are classified to obtain the correspondence of each candidate entity pair.

2. The method of claim 1, wherein, Entity processing of the text to be processed to obtain an entity sequence includes: Entity extraction is performed on the text to be processed to obtain multiple candidate entities; The entity sequence is obtained by combining any two of the multiple candidate entities.

3. The method of claim 1, wherein, The method further includes: The text to be processed is segmented according to various different feature item granularities to obtain a feature item sequence corresponding to the text to be processed, and the feature item sequence includes multiple feature items.

4. The method according to claim 3, characterized in that, The fusion of the feature term vector and the feature term position information includes: Convolutional pooling is performed based on the feature term vector and the position information of the feature terms.

5. The method according to claim 3, characterized in that, The feature term vector and the feature term position information of the feature term are fused to obtain the fused feature corresponding to the feature term; the fused features corresponding to each feature term are fused to obtain the text feature vector, including: The feature term vectors corresponding to each of the feature terms are concatenated to obtain the feature term vectors corresponding to the feature term sequence. The feature item position information corresponding to each feature item is concatenated to obtain the feature item position information corresponding to the feature item sequence. The feature term vector corresponding to the feature term sequence and the feature term position information corresponding to the feature term sequence are fused to obtain the feature term fusion vector. Perform a one-dimensional convolution operation on the feature term fusion vector to obtain the convolution result; The convolution result is segmented into maximum pooling based on the candidate entity pairs to obtain multiple pooling results; The multiple pooling results are concatenated to obtain the text feature vector.

6. The method according to claim 3, characterized in that, The method further includes: The text to be processed is segmented at both the character granularity and word granularity to obtain the character sequence and word sequence corresponding to the text to be processed.

7. The method according to claim 6, characterized in that, The feature term sequence includes: a character sequence corresponding to the text to be processed and a word sequence corresponding to the text to be processed. The method for obtaining the text feature vector includes: The character sequence and the word sequence are converted into character vectors and word vectors, respectively. Obtain the character position information corresponding to the character sequence and the word position information corresponding to the word sequence; The character vector and the character position information are subjected to convolutional pooling to obtain the character feature vector corresponding to the character sequence; The word vectors and word position information are subjected to convolutional pooling to obtain word feature vectors corresponding to the word sequence. The character feature vector and the word feature vector are fused to obtain the character-word fusion feature; The text feature vector is obtained by linearly processing the fused word features.

8. The method according to claim 1, characterized in that, The knowledge graph embedding model is trained using a training dataset obtained by annotating the text to be processed with a known knowledge graph.

9. The method according to claim 8, characterized in that, The method for obtaining the knowledge feature vector also includes: After normalizing each relation score result, the reciprocal is taken to obtain the relation feature value corresponding to each relation score result; The relational feature values ​​are included as elements in the knowledge feature vector.

10. The method according to claim 1, characterized in that, The text feature vector and the knowledge feature vector are weighted and summed to obtain the text knowledge fusion features, which include: Multiply the text feature vector by the text weight coefficient to obtain the first product result; Multiply the knowledge feature vector by the knowledge weight coefficient to obtain the second product result; The first product result and the second product result are summed to obtain the text knowledge fusion feature, and the sum of the knowledge weight coefficient and the text weight coefficient is 1.

11. An entity relation extraction device, characterized in that, The device includes: An entity processing unit is used to perform entity processing on the text to be processed to obtain an entity sequence, wherein the entity sequence includes multiple candidate entity pairs; The first feature extraction unit is configured to: extract features from the feature items contained in the text to be processed to obtain a feature item vector; obtain a first relative position between the feature item and the first candidate entity in the corresponding candidate entity pair, and a second relative position between the feature item and the second candidate entity in the candidate entity pair; concatenate the first relative position and the second relative position to obtain feature item position information; fuse the feature item vector and the feature item position information to obtain the fused feature corresponding to the feature item; and fuse the fused features corresponding to each feature item to obtain a text feature vector. The second feature extraction unit is used to calculate the entity vector of each candidate entity in each candidate entity pair based on the knowledge graph embedding model, determine the embedding vector corresponding to each candidate relation based on each entity vector, score the candidate relation based on the scoring function of the knowledge graph embedding model itself, and normalize the scoring results of each relation to obtain the knowledge feature vector corresponding to the candidate entity pair. The knowledge feature vector indicates the confidence score of each candidate relation predicted by the knowledge graph embedding model. The text knowledge feature fusion unit is used to perform a weighted summation of the text feature vector and the knowledge feature vector to obtain the text knowledge fusion feature; The relation classification processing unit is used to classify the text knowledge fusion features to obtain the corresponding relationship of each candidate entity pair.

12. The apparatus according to claim 11, characterized in that, The entity processing unit includes: The entity extraction subunit is used to extract entities from the text to be processed to obtain multiple candidate entities; The entity combination subunit is used to combine any two of the multiple candidate entities to obtain an entity sequence.

13. The apparatus according to claim 11, characterized in that, The first feature extraction unit further includes: The text segmentation module is used to segment the text to be processed according to the feature item granularity to obtain a feature item sequence corresponding to the text to be processed, wherein the feature item sequence includes multiple feature items.

14. The apparatus according to claim 13, characterized in that, The first feature extraction unit is used for: Convolutional pooling is performed based on the feature term vector and the position information of the feature terms.

15. The apparatus according to claim 13, characterized in that, The first feature extraction unit is used for: The feature term vectors corresponding to each feature term are concatenated to obtain the feature term vectors corresponding to the feature term sequence. The feature item position information corresponding to each feature item is concatenated to obtain the feature item position information corresponding to the feature item sequence. The feature term vector corresponding to the feature term sequence and the feature term position information corresponding to the feature term sequence are fused to obtain the feature term fusion vector. Perform a one-dimensional convolution operation on the feature term fusion vector to obtain the convolution result; The convolution results are segmented into maximum pooling based on candidate entity pairs to obtain multiple pooling results; The multiple pooling results are concatenated to obtain the text feature vector.

16. The apparatus according to claim 13, characterized in that, The text segmentation module is used for: The text to be processed is segmented at both the character granularity and word granularity to obtain the character sequence and word sequence corresponding to the text to be processed.

17. The apparatus according to claim 11, characterized in that, The text knowledge feature fusion unit is used for: Multiply the text feature vector by the text weight coefficient to obtain the first product result; Multiply the knowledge feature vector by the knowledge weight coefficient to obtain the second product result; The first product result and the second product result are summed to obtain the text knowledge fusion feature, and the sum of the knowledge weight coefficient and the text weight coefficient is 1.

18. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1-10.

19. A computer-readable storage medium having a computer program stored thereon, the computer program, when executed by a processor, implementing the method as described in any one of claims 1-10.

20. A computer program product comprising a computer program carried on a machine-readable medium, the computer program containing program code for the method of any one of claims 1-10.