CN115309855A - Method for determining entity relationship, storage medium and processor - Google Patents

Method for determining entity relationship, storage medium and processor Download PDF

Info

Publication number
CN115309855A
CN115309855A CN202110497247.9A CN202110497247A CN115309855A CN 115309855 A CN115309855 A CN 115309855A CN 202110497247 A CN202110497247 A CN 202110497247A CN 115309855 A CN115309855 A CN 115309855A
Authority
CN
China
Prior art keywords
text
characteristic information
information
target
relation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110497247.9A
Other languages
Chinese (zh)
Inventor
许璐
邴立东
黄非
陆巍
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Innovation Co
Singapore University of Technology and Design
Original Assignee
Singapore University of Technology and Design
Alibaba Singapore Holdings Pte Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Singapore University of Technology and Design, Alibaba Singapore Holdings Pte Ltd filed Critical Singapore University of Technology and Design
Priority to CN202110497247.9A priority Critical patent/CN115309855A/en
Publication of CN115309855A publication Critical patent/CN115309855A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3344Query execution using natural language analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/35Clustering; Classification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/367Ontology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Artificial Intelligence (AREA)
  • Databases & Information Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Computing Systems (AREA)
  • Molecular Biology (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Evolutionary Computation (AREA)
  • Biophysics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Animal Behavior & Ethology (AREA)
  • Machine Translation (AREA)

Abstract

The invention discloses a method for determining entity relationship, a storage medium and a processor. Wherein, the method comprises the following steps: acquiring a text to be processed and a target entity of a relation to be determined in the text to be processed; acquiring text characteristic information of the text to be processed and first characteristic information related to the target entity; determining second feature information based on the text feature information and the first feature information through an attention mechanism; and classifying the relation between the target entities of the relation to be determined according to the second characteristic information. The method and the device solve the technical problem of low accuracy in determining the relationship between the entities in the prior art.

Description

Method for determining entity relationship, storage medium and processor
Technical Field
The present invention relates to the field of natural language processing, and in particular, to a method, a storage medium, and a processor for determining an entity relationship.
Background
Entity-based relationship analysis is an important application in information extraction, and its goal is to analyze the relationship between two entities from unstructured text. At present, many models use a dependency analyzer to obtain a dependency tree of each sentence, find a shortest dependency path between two entities according to the obtained dependency tree, and then determine a relationship between the two entities according to information on the path. However, since some critical information may appear outside the shortest dependency relationship path, information loss may occur only depending on the shortest dependency path, and further, misjudgment may occur.
In order to solve the problem of excessively depending on the shortest dependency relationship path, a method for pruning a dependency relationship tree is also provided at present, the method reserves the shortest dependency relationship path, reserves a direct connection word of a word on the shortest dependency relationship path, and extracts the characteristics between two entity words through the operation of a graph neural network. That is, the current dependency tree-based method may have a situation of wrong iteration, and if the quality of the dependency tree extracted by the dependency extractor is not good, these wrong relationships may be difficult to be corrected by the subsequent neural network model. Therefore, although the dependency tree can find the connection between two entities, the quality of the dependency tree may affect the effect of the final relationship classification, thereby causing misjudgment of the relationship between the entities.
Aiming at the problem of low accuracy in determining the relationship between entities in the prior art, no effective solution is provided at present.
Disclosure of Invention
Embodiments of the present invention provide a method, a storage medium, and a processor for determining an entity relationship, so as to at least solve the technical problem in the prior art that the accuracy is low when determining a relationship between entities.
According to an aspect of the embodiments of the present invention, there is provided a method for determining an entity relationship, including: acquiring a text to be processed and a target entity of a relation to be determined in the text to be processed; acquiring text characteristic information of a text to be processed and first characteristic information related to a target entity; determining second feature information based on the text feature information and the first feature information by an attention mechanism; and classifying the relation between the target entities to be determined according to the second characteristic information.
According to another aspect of the embodiments of the present invention, there is also provided a storage medium, where the storage medium includes a stored program, and when the program runs, the apparatus on which the storage medium is located is controlled to execute the method for determining entity relationships described above.
According to another aspect of the embodiments of the present invention, a processor is further provided, where the processor is configured to execute the program, where the program executes the method for determining the entity relationship.
According to another aspect of the embodiments of the present invention, there is also provided a method for determining an entity relationship, including: acquiring user data, and determining a target entity of a relation to be determined in the user data, wherein the target entity comprises a product name; classifying the relation of the target entities based on a relation classification model, wherein the relation classification model acquires text characteristic information of user data and first characteristic information related to the target entities, determines second characteristic information based on the text characteristic information and the first characteristic information through an attention mechanism, and classifies the relation between the target entities to be determined according to the second characteristic information; marking out a product name in the user data based on the classification result; and performing emotion analysis on the user data marked with the product name according to the classification result, determining user preference, and recommending the product to the user according to the user preference.
According to another aspect of the embodiments of the present invention, there is also provided a method for determining an entity relationship, including: acquiring data information in a preset platform, and determining a target entity of a relation to be determined in the data information, wherein the target entity comprises a person name; classifying the relation of the target entities based on a relation classification model, wherein the relation classification model acquires text characteristic information of data information and first characteristic information related to the target entities, determines second characteristic information based on the text characteristic information and the first characteristic information through an attention mechanism, and classifies the relation between the target entities to be determined according to the second characteristic information; marking out the name of the person in the data information based on the classification result; and analyzing the data information marked with the character name based on the classification result according to a preset analysis strategy to obtain an analysis result corresponding to the character name.
According to another aspect of the embodiments of the present invention, there is also provided a method for determining an entity relationship, including: acquiring medical data information, and determining a target entity of a relation to be determined in the medical data information, wherein the target entity is used for representing a medical name; classifying the relation of the target entities based on a relation classification model, wherein the relation classification model acquires text characteristic information of data information and first characteristic information related to the target entities, determines second characteristic information based on the text characteristic information and the first characteristic information through an attention mechanism, and classifies the relation between the target entities to be determined according to the second characteristic information; and highlighting the target entity in the medical data information based on the classification result.
In the embodiment of the invention, a text to be processed and a plurality of target entities in the text to be processed are obtained, wherein the target entities are entities with a relation to be determined; acquiring text characteristic information and first characteristic information, wherein the text characteristic information comprises a text characteristic vector of each word in a text to be processed, and the first characteristic information is determined according to the text characteristic vectors of a plurality of target entities; determining second characteristic information through an attention mechanism based on the text characteristic information and the first characteristic information, wherein the second characteristic information comprises the text characteristic information of the text to be processed and the entity characteristic information of the target entity; and classifying the relationships among the target entities according to the second characteristic information to obtain the relationships among the target entities. The scheme provides a model based on an attention mechanism, firstly, the scheme does not need a dependency relationship graph to extract the relationship between entities, so that wrong iteration caused by poor dependency relationship extractors can be avoided, in order to better find text information shared between two entities, a multi-head attention mechanism is introduced, so that text information more relevant to a target entity can be found, the relationship of the target entity can be more accurately judged, and the technical problem of low accuracy in determining the relationship between the entities in the prior art is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 illustrates a block diagram of a hardware architecture of a computing device (or mobile device) for implementing a method of determining entity relationships;
FIG. 2 is a flow chart of a method for determining entity relationships according to embodiment 1 of the present application;
FIG. 3 is a schematic diagram of an entity relationship classification model according to embodiment 1 of the present application;
FIG. 4a is a comparison of the effect evaluated by Scierc-DS and CoNLL04-S according to example 1 of the present application;
FIG. 4b is a graph showing a comparison of the effects of TACRED and KBP37 on the evaluation of TACRED and KBP37 according to example 1 of the present application;
FIG. 5a is a diagram illustrating the results of processing data with different amounts of context between target entities in a middle TACRED dataset;
FIG. 5b is a graph illustrating the comparison of the results of processing sentences containing single and multiple relationships in the TACRED dataset;
FIG. 6 is a schematic diagram of an apparatus for determining entity relationships according to embodiment 2 of the present application;
FIG. 7 is a block diagram of a computing device according to embodiment 4 of the present invention;
FIG. 8 is a flowchart of a method for determining entity relationships according to embodiment 6 of the present application;
FIG. 9 is a flowchart of a method for determining entity relationships according to embodiment 7 of the present application;
FIG. 10 is a flowchart of a method for determining entity relationships according to embodiment 8 of the present application;
fig. 11 is a schematic diagram of an apparatus for determining entity relationships according to embodiment 9 of the present application;
FIG. 12 is a diagram of an apparatus for determining entity relationships according to embodiment 10 of the present application;
fig. 13 is a schematic diagram of an apparatus for determining entity relationships according to embodiment 11 of the present application.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
First, some terms or terms appearing in the description of the embodiments of the present application are applicable to the following explanations:
attention Mechanism (Attention Mechanism) a Mechanism for analyzing two individual relationships is used to focus Attention on important points in a plurality of information, select key information and ignore other unimportant information.
The Dependency Tree (Dependency Tree) is a Tree structure diagram showing the relationship between words.
Shortest dependent Path (Shortest Dependency Path) the Shortest dependent Path between two entities is found from the Dependency graph.
BERT (Bidirectional Encoder replies from transformations): a text information extraction model.
Bi-LSTM (Bi-Long Short-Term Memory) Long and Short Term Memory networks are commonly used to extract textual information.
Example 1
There is also provided, in accordance with an embodiment of the present invention, an embodiment of a method for determining entity relationships, it being noted that the steps illustrated in the flowchart of the drawings may be performed in a computer system such as a set of computer-executable instructions, and that while a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than here.
The method provided by the first embodiment of the present application may be executed in a mobile terminal, a computing device, or a similar computing device. Fig. 1 shows a hardware configuration block diagram of a computing device (or mobile device) for implementing the method of determining entity relationships. As shown in fig. 1, computing device 10 (or mobile device 10) may include one or more (shown in the figures as 102a, 102b, … …,102 n) processors 102 (processors 102 may include, but are not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA, etc.), memory 104 for storing data, and a transmission module 106 for communication functions. Besides, the method can also comprise the following steps: a display, an input/output interface (I/O interface), a Universal Serial Bus (USB) port (which may be included as one of the ports of the I/O interface), a network interface, a power source, and/or a camera. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration and is not intended to limit the structure of the electronic device. For example, computing device 10 may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
It should be noted that the one or more processors 102 and/or other data processing circuitry described above may be referred to generally herein as "data processing circuitry". The data processing circuitry may be embodied in whole or in part in software, hardware, firmware, or any combination thereof. Further, the data processing circuitry may be a single, stand-alone processing module, or incorporated in whole or in part into any of the other elements in the computing device 10 (or mobile device). As referred to in the embodiments of the application, the data processing circuit acts as a processor control (e.g. selection of a variable resistance termination path connected to the interface).
The memory 104 may be used to store software programs and modules of application software, such as program instructions/data storage devices corresponding to the method for determining entity relationships in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implementing the method for determining entity relationships of the application programs described above. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, memory 104 may further include memory located remotely from processor 102, which may be connected to computing device 10 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission module 106 is used to receive or transmit data via a network. Specific examples of such networks may include wireless networks provided by a communications provider of computing device 10. In one example, the transmission module 106 includes a Network adapter (NIC) that can be connected to other Network devices through a base station to communicate with the internet. In one example, the transmission module 106 may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
The display may be, for example, a touch screen-type Liquid Crystal Display (LCD) that may enable a user to interact with a user interface of computing device 10 (or mobile device).
It should be noted here that in some alternative embodiments, the computer device (or mobile device) shown in fig. 1 described above may include hardware elements (including circuitry), software elements (including computer code stored on a computer-readable medium), or a combination of both hardware and software elements. It should be noted that fig. 1 is only one example of a particular specific example and is intended to illustrate the types of components that may be present in the computer device (or mobile device) described above.
In the above operating environment, the present application provides a method for determining entity relationships as shown in fig. 2. Fig. 2 is a flowchart of a method for determining an entity relationship according to embodiment 1 of the present application.
Step S21, obtaining a text to be processed and a target entity of a relation to be determined in the text to be processed.
Specifically, the target entities may be used to represent entity words, and both the subject and the object in a sentence are usually entities. For example, xiaoming is 12 years old this year, wherein Xiaoming and 12 years old are both entities. The text to be processed comprises a plurality of entities, and the target entity is all or part of the entities in the text to be processed. And when the relation between two entities in the text to be processed needs to be determined, taking the two entities as the target entities.
In an optional embodiment, the text to be processed may be a text introduced by itself from the recruitment network, and an entity associated with the user in the text introduced by itself may be marked as a target entity to determine a relationship between the user and another entity, so as to obtain information related to the user, and based on the information, position recommendation and the like a may be performed on the user.
In another optional embodiment, the text to be processed may also be a social news text, and the objects of interest may be marked as target entities to determine relationships between the objects of interest, so as to generate a relationship graph between the objects, where the objects of interest serve as nodes in the graph, and the relationships between the objects of interest serve as edges between the nodes. After obtaining the map, a preset downstream task may be performed based on the map. For example, in a review knowledge graph in a particular domain, given starbucks and appointment places, the relationships between them may be connected by "context".
Step S23, acquiring text characteristic information of the text to be processed and first characteristic information related to the target entity.
Specifically, the text feature information may be a text feature sequence. Each element in the text feature sequence corresponds to a text feature vector of a word in the text to be processed. In an optional embodiment, each word of the text to be processed is generated into a corresponding text feature vector, and then the text feature vector corresponding to each word constitutes the text feature information. The way of generating the text feature vector may be word2vec, etc., and is not limited herein.
In an optional embodiment, the first feature information may be determined according to feature vectors of a plurality of target entities, and a corresponding text feature vector may be obtained for each word in a text to be processed to obtain text feature information, and then the text feature vectors corresponding to the target entities are extracted from the text feature information, and then feature fusion is performed on the text feature vectors of the plurality of target entities to obtain the first feature information.
Step S25, determining second characteristic information based on the text characteristic information and the first characteristic information through an attention mechanism.
Specifically, the second feature information includes text feature information of the text to be processed and entity feature information of the target entity.
The attention mechanism may be a multi-head attention mechanism (multi-head attention) that uses multiple queries to compute in parallel the selection of multiple information from the input information. Each focusing on a different part of the input information. In the above scheme, the corresponding text feature vector is selected from the text feature information through a multi-head attention mechanism.
In the steps, the attention mechanism is introduced, and the text characteristic information is used as the text information shared among the entities of the target entities, so that the characteristic information of the target entities in the context of the text to be processed, namely the second characteristic information, is obtained. The relationships among the target entities are classified by the second characteristic information obtained in the step, and the relationships between the target entities and the text to be processed can be determined on the basis of the shared information of the target entities in the text to be processed without depending on the dependency relationship tree.
And S27, classifying the relationship between the target entities with the relationship to be determined according to the second characteristic information.
In particular, the above classification is used to represent a relationship classification, i.e., determining the relationship between the target entities by classification may be implemented by a classifier. The above scheme is actually a classification problem that determines the relationship between target entities by classification.
When emotion classification is performed, a simple three-classification or five-classification problem is generally caused, but the relationship analysis covers more categories, such as speaking place, birth date, work, position and the like, and the categories can be adjusted according to different scenes.
In an alternative embodiment, the above scheme may be used to build a user repository. Various attributes of the user are found out through the relation classification task, and then a user database is formed. For example, for the text "i am 20 this year", by the relationship classification, it can be judged that the user is 20 years old. Therefore, the relation classification can help each platform to establish a better user database and help each field to establish a corresponding knowledge graph, so that more suitable products and services can be recommended to different users.
The above-mentioned scheme in this embodiment may implement the above steps through an entity relationship classification model, where the entity relationship classification model at least includes a feature extraction layer, a feature fusion layer, an attention mechanism layer, and a full connection layer. The system comprises a feature extraction layer, a feature fusion layer, an attention mechanism layer and a full connection layer, wherein the feature extraction layer is used for obtaining text feature information of each word in a text to be processed, the feature fusion layer is used for performing feature fusion on a text feature vector of a target entity to obtain first feature information, the attention mechanism layer is used for obtaining second feature information of shared text information through a multi-head attention mechanism according to the text feature information and the first feature information, and finally the full connection layer is used as a classifier to classify previous relations of a plurality of target entities according to the second feature information.
It should be noted that if the attention mechanism is used to alleviate the defect of poor quality of the dependency tree, the model may obtain the relationship between each word and each word, and then extract the features between the entities through the neural network, but still need the dependency analyzer to obtain the dependency graph, and then initialize the neural network according to the dependency graph, and if the relationship between the entities is predicted by using only the information at the sentence level, but the feature vector of the entity contains more relationship information, using this way may result in poor performance of the model due to ignoring the information of a given target entity, and if there are multiple pairs of target entities in a sentence, it may not be possible to distinguish different pairs of target entities by using only the information at the sentence level.
The method includes the steps that a text to be processed and a target entity of a relation to be determined in the text to be processed are obtained; acquiring text characteristic information of the text to be processed and first characteristic information related to the target entity; determining second feature information based on the text feature information and the first feature information through an attention mechanism; and classifying the relation between the target entities of the relation to be determined according to the second characteristic information. The scheme provides a model based on an attention mechanism, firstly, the scheme does not need a dependency relationship graph to extract the relationship between entities, so that wrong iteration caused by poor dependency relationship extractors can be avoided, in order to better find text information shared between two entities, a multi-head attention mechanism is introduced, so that text information more relevant to a target entity can be found, the relationship of the target entity can be more accurately judged, and the technical problem of low accuracy in determining the relationship between the entities in the prior art is solved.
As an optional embodiment, before obtaining a text to be processed and a target entity of a relationship to be determined in the text to be processed, the method further includes: extracting entities in the text to be processed, and marking target entities in the entities; the method for acquiring the text to be processed and the target entity of the relation to be determined in the text to be processed comprises the following steps: and acquiring a text to be processed, and determining a target entity in the text to be processed through the mark.
The target entity is an entity needing to acquire the relationship between the target entity and the text to be processed. When the text to be processed includes a plurality of entities, the relationship between each entity does not necessarily need to be obtained, so that the target entity may be labeled before the entities in the text to be processed are subjected to relationship classification, so that the entity relationship classification model can determine the object subjected to relationship classification.
In an optional embodiment, when the text to be processed only includes two target entities whose relationship needs to be determined, the two target entities are labeled, and when the text to be processed includes a plurality of target entities whose relationship needs to be determined, the target entities can be labeled respectively to form target entity pairs, and the entity relationship classification model determines the objects for performing relationship classification according to the target entity pairs.
For example, the text to be processed is "xiaoming this year 12 years old, last six years level", wherein the entities include "xiaoming", "12 years old", "six years old", and in order to determine the relationship between "xiaoming" and "12 years old", the "xiaoming" and "12 years old" may be marked as target entities; to determine the relationship of "Xiaoming" and "sixth grade," Xiaoming "and" sixth grade "may be labeled as target entities. If it is necessary to determine both the relationship between Xiaoming and the age of 12 and the relationship between Xiaoming and the age of six, the Xiaoming and the age of 12 can be labeled in one way to form a target entity pair, and the Xiaoming and the age of six can be labeled in the same way to form a target entity pair.
As an optional embodiment, before obtaining a text to be processed and a target entity of a relationship to be determined in the text to be processed, the method further includes: and under the condition that the text to be processed is in a preset language, performing word segmentation on the text to be processed, wherein the preset language at least comprises Chinese.
The structures of the texts in different languages are different, and the texts in some languages take words as minimum units, such as English, french and the like, so that word segmentation is not needed. However, for some languages with the minimum unit of characters, such as chinese, it is necessary to perform word segmentation on the text to be processed in the chinese, and then mark the target entity in the word segmentation result.
As an optional embodiment, the acquiring text feature information includes: and performing feature extraction on each word of the text to be processed through a preset feature extraction network to obtain a text feature vector corresponding to each word.
Specifically, the above steps may be implemented by a feature extraction network.
In an alternative embodiment, the relationship of the target entity in the text to be processed may be classified by an entity relationship classification model. The entity classification model comprises a feature extraction layer, wherein the feature extraction layer is formed by a feature extraction network and is used for extracting features of each word in a text to be processed. The feature extraction network may be BERT or Bi-LSTM.
Fig. 3 is a schematic diagram of an entity relationship classification model according to an embodiment of the present application, which is shown in fig. 3, in this example, a text to be processed is "she is 61 years old", whereThe target entities are 'she' and '61', and the 'she' and '61' are respectively marked as e 1 And e 2 . Firstly, using BERT or Bi-LSTM as a feature extraction network, and extracting features of each word in a text to be processed to obtain a text feature vector corresponding to each word, namely h corresponding to' she 0 H corresponding to "is 1 H corresponding to "61 2 H corresponding to "year 3 And h corresponding to "old 4 ,h 0 、h 1 、h 2 、h 3 And h 4 I.e. constituting the text characteristic information mentioned above.
As an alternative embodiment, the obtaining of the first feature information related to the target entity includes: extracting a text feature vector of a target entity from the text feature information; performing maximum pooling on the text feature vector of the target entity to obtain a text feature vector after dimension reduction; first feature information is determined based on the reduced-dimension text feature vectors of the plurality of target entities.
Because the target entity in the text to be processed is marked before the text to be processed is subjected to the relation classification, the text feature vector corresponding to the marked target entity can be extracted from the text feature information after the text feature information is obtained.
Because the lengths of the target entities are different, the dimensionality of the text feature vector corresponding to each target entity is not necessarily the same, after the text feature vector of the target entity is obtained, the text feature vector of the target entity is subjected to dimensionality reduction through the pooling layer, so that the text feature vector of the target entity after dimensionality reduction has the same dimensionality, and feature fusion is performed based on the text feature vector of the target entity after dimensionality reduction, so that the first feature information can be obtained.
In an alternative embodiment, still referring to fig. 3, the text feature vectors corresponding to "she" and "61" are h 0 And h 2 ,h 0 And h 2 May be different, extract h 0 And h 2 And are respectively aligned with h 0 And h 2 Performing a pooling treatment (max-pool) for h 0 And h 2 Reducing the dimension to obtain h after the pooling treatment e1 And h e2 ,h e1 And h e2 The first feature information is obtained by feature fusion with the same dimension.
As an alternative embodiment, determining the first feature information based on the reduced-dimension text feature vectors of the target entities includes: connecting the dimensionality-reduced text feature vectors of a plurality of target entities to obtain a connection feature vector; and performing feature fusion on the connection feature vector through a single-layer neural network to obtain first feature information.
In the above scheme, because the text feature vectors after the dimensionality reduction of the multiple target entities have the same dimensionality, feature-adjacent connection can be performed, and feature fusion is performed on feature information of the multiple target entities through a single-layer neural network to obtain the first feature information.
In an alternative embodiment, still referring to FIG. 3, h is obtained after passing through the pooling layer e1 And h e2 Then, in order to fuse the feature information of the two target entities, the text feature vectors of the two target entities can be spliced and then transmitted to a single-layer neural network, so as to obtain a feature vector h fusing the feature information of the two target entities dual_e ,h dual_e Namely the first characteristic information. E.g. h e1 And h e2 The feature vectors with the dimension of 300 are all feature vectors with the dimension of 600 after connection is carried out, feature extraction is carried out on the connection feature vectors through a single-layer neural network, text feature vectors of two target entities are fused in a dimension reduction mode, the feature vector with the dimension of 300 is obtained again, the feature vector with the dimension of 300 is first feature information, and the entity feature information comprises feature information of two target entities, namely 'she' and '61'.
The text characteristic vector h of each target entity after pooling is obtained through the scheme in a pooling processing mode e1 And h e2 H is to be e1 And h e2 After splicing, obtaining fused first characteristic information h through a single-layer neural network dual_e Therefore, under the condition of not utilizing the dependency relationship tree, the feature vector also fuses text information to be processed and entity information of a target entity at the same time.
As an alternative embodiment, determining the second feature information based on the text feature information and the first feature information by an attention mechanism includes: and determining the first characteristic information as a query parameter, determining the text characteristic information as a key parameter and a value parameter, and determining the second characteristic information through an attention mechanism.
The input of the attention mechanism comprises query and key-value pairs, wherein the query parameter is query, and the key parameter and value parameter are key-value. For a query, the attention mechanism calculates an attention score with each key and performs weight normalization, the output vector is weighted sum of values, and the weight calculated by each key corresponds to the value one by one.
In an alternative embodiment, still referring to FIG. 3, the text feature information h is used 0 、h 1 、h 2 、h 3 And h 4 And first characteristic information h dual_e Input to a multi-head attention mechanism (attention) in which h is added dual_e As a query parameter, h 0 、h 1 、h 2 、h 3 And h 4 As key parameter and value parameter, h of multi-head attention mechanism output can be obtained dual_e_att ,h dual_e_att I.e. the second characteristic information.
The scheme firstly fuses the text feature vectors of two target entities, and fuses the text feature vectors of the two target entities under the condition of not using a dependency relationship tree to obtain a vector which simultaneously fuses text information and entity information.
In order to better find out the shared text and information between two target entities, the scheme adds a multi-head attention mechanism, so that the text characteristic information more relevant to the target entities can be found in the context of the text to be processed. Finally, the feature vector h _ dual _ e _ att is input into a classifier to carry out final relation classification immediately.
As an optional embodiment, the texts in different fields have corresponding classifiers and relationship sets, and the classifying the relationship between the target entities whose relationship is to be determined according to the second feature information includes: determining a field to which a text to be processed belongs; and classifying the text to be processed according to the second characteristic information by using a classifier corresponding to the field to which the text belongs so as to determine the relationship among the target entities from the corresponding relationship set.
In the above scheme, the classifier of each domain is used to classify the relationship of the target entity in the relationship combination corresponding to the classifier. The domains herein may be divided into different domains.
In an alternative embodiment, the division may be performed according to the requirement, for example, when the scene is a job recommendation of the job hunting platform, the setting of the relationship may include: name, academic, work experience, skill, etc., and the classifier in the field classifies the relationship of the target entity in this relationship set. When the scene is a product recommendation of the e-commerce platform, the setting of the relationship combination comprises: birth place, date of birth, job, position, etc.
FIG. 4a is a comparison of effects of Scierc-DS and CoNLL04-S evaluation according to the embodiment of the present application, and FIG. 4b is a comparison of effects of TACRED and KBP37 evaluation according to the embodiment of the present application. Scierc-DS, coNLL04-S, TACRED and KBP37 are four different data sets, where Dev F1 is used to represent F1 on each model development set (depth set), P is used to represent precision (precision), and R is used to represent recall (recall), and it can be seen that the model proposed in this embodiment (Dual-E-ATT) is used BERT ) Has better performance for different data sets.
Shared information between target entities that are far away is more difficult to capture, and fig. 5a is a diagram illustrating the results of processing data with different amounts of context between target entities in the TACRED data set. Referring to FIG. 5, the abscissa indicates the number of contexts between target entities and the ordinate indicates Dev F1 (%), it is clear that the model proposed in the present application is comparable to other modelsForm (Dual-E-ATT) BERT ) Has better performance.
The method model provided by the application is based on the extraction of shared information among entities, so that the relationship is more complex when a plurality of entities appear in a sentence. FIG. 5b is a schematic diagram comparing the processing results of sentences containing single relations and multiple relations in TACRED data set, and shown in FIG. 5b, the abscissa is Max-P, max-P + EE, dual-E, dual-E, dual-E-ATT, and Dual-E-ATT BERT AGGCN and SpanBERT, dev F1 (%) in ordinate, it is clear that the model proposed in this application (Dual-E-ATT) is more target entities in the sentence BERT ) Still has good performance effect.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
Example 2
According to an embodiment of the present invention, there is further provided an apparatus for determining an entity relationship, which is used for implementing the method for determining an entity relationship, fig. 6 is a schematic diagram of an apparatus for determining an entity relationship according to an embodiment of the present application, and with reference to fig. 6, the apparatus 600 includes:
the first obtaining module 60 is configured to obtain a to-be-processed text and a plurality of target entities in the to-be-processed text, where the target entities are entities with a relationship to be determined.
A second obtaining module 62, configured to obtain text feature information of the text to be processed, and first feature information related to the target entity.
A determining module 64 for determining second feature information based on the text feature information and the first feature information by an attention mechanism.
And the classification module 66 is configured to classify the relationship between the target entities with the relationship to be determined according to the second feature information.
It should be noted here that the first obtaining module 60, the second obtaining module 62, the determining module 64 and the classifying module 66 correspond to steps S21 to S27 in embodiment 1, and the four modules are the same as the corresponding steps in the implementation example and application scenario, but are not limited to the disclosure in the first embodiment. It should be noted that the above modules as part of the apparatus may be run in the computing device 10 provided in the first embodiment.
As an optional embodiment, the apparatus further comprises: the extraction module is used for extracting the entities in the text to be processed and marking the target entities in the entities before the text to be processed and the target entities in the text to be processed are obtained; the first acquisition module includes: the obtaining sub-module is used for obtaining the text to be processed and at least two target entities in the text to be processed, and comprises the following steps: and acquiring a text to be processed, and determining a target entity in the text to be processed through the mark.
As an alternative embodiment, the apparatus further comprises: the word segmentation module is used for performing word segmentation on the text to be processed under the condition that the text to be processed is in a preset language before acquiring the text to be processed and a target entity to be determined in the relation between the text to be processed and the target entity, wherein the preset language at least comprises Chinese.
As an alternative embodiment, acquiring text feature information includes: and the extraction submodule is used for extracting the characteristics of each word of the text to be processed through a preset characteristic extraction network to obtain a text characteristic vector corresponding to each word.
As an alternative embodiment, the second obtaining module includes: the extraction submodule is used for extracting the text characteristic vector of the target entity from the text characteristic information; the pooling processing submodule is used for performing maximum pooling processing on the text feature vector of the target entity to obtain the text feature vector after dimension reduction; and the first determining submodule is used for determining first characteristic information based on the reduced text characteristic vectors of the target entities.
As an alternative embodiment, the first determination submodule includes: the connection unit is used for connecting the reduced-dimension text feature vectors of the target entities to obtain connection feature vectors; and the characteristic extraction unit is used for carrying out characteristic fusion on the connection characteristic vector through a single-layer neural network to obtain first characteristic information.
As an alternative embodiment, the determining module includes: and the second determining submodule is used for determining the first characteristic information as a query parameter, the text characteristic information as a key parameter and a value parameter, and determining the second characteristic information through an attention mechanism.
As an alternative embodiment, texts in different domains have corresponding classifiers and relationship sets, and the classification module includes: the third determining submodule is used for determining the field of the text to be processed; and the classification sub-module is used for classifying the second characteristic information by using a classifier corresponding to the field to which the text to be processed belongs so as to determine the relationship among the target entities from the corresponding relationship set.
Example 3
Embodiments of the present invention may provide a system for determining entity relationships, including:
a processor; and
a memory coupled to the processor for providing instructions to the processor for processing the following processing steps:
acquiring a text to be processed and a target entity of a relation to be determined in the text to be processed;
acquiring text characteristic information of the text to be processed and first characteristic information related to the target entity;
determining second feature information based on the text feature information and the first feature information through an attention mechanism;
and classifying the relation between the target entities of the relation to be determined according to the second characteristic information.
It should be noted that the memory in this embodiment is also used to provide the processor with instructions for processing other steps in embodiment 1, which is not described herein again.
Example 4
Embodiments of the invention may provide a computing device that may be any one of a group of computing devices. Optionally, in this embodiment, the computing device may also be replaced with a terminal device such as a mobile terminal.
Optionally, in this embodiment, the computing device may be located in at least one network device of a plurality of network devices of a computer network.
In this embodiment, the above-mentioned computing device may execute program code of the following steps in the method for determining entity relationships of an application: acquiring a text to be processed and a target entity of a relation to be determined in the text to be processed; acquiring text characteristic information of the text to be processed and first characteristic information related to the target entity; determining second feature information based on the text feature information and the first feature information through an attention mechanism; and classifying the relation between the target entities of the relation to be determined according to the second characteristic information.
Alternatively, fig. 7 is a block diagram of a computing device according to embodiment 4 of the present invention. As shown in fig. 7, the computing device a may include: one or more (only one of which is shown) processors 702, memory 706, and a peripheral interface 708.
The memory may be used to store software programs and modules, such as program instructions/modules corresponding to the method and apparatus for determining an entity relationship in the embodiments of the present invention, and the processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, implementing the above method for determining an entity relationship. The memory may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory may further include memory remotely located from the processor, and these remote memories may be connected to terminal a through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The processor can call the information and application program stored in the memory through the transmission device to execute the following steps: acquiring a text to be processed and a target entity of a relation to be determined in the text to be processed; acquiring text characteristic information of the text to be processed and first characteristic information related to the target entity; determining second feature information based on the text feature information and the first feature information by an attention mechanism; and classifying the relation between the target entities of the relation to be determined according to the second characteristic information.
Optionally, the processor may further execute the program code of the following steps: before obtaining a text to be processed and a target entity of a relation to be determined in the text to be processed, extracting the entity in the text to be processed, and marking the target entity in the entity; the method for acquiring the text to be processed and the target entity of the relation to be determined in the text to be processed comprises the following steps: and acquiring a text to be processed, and determining a target entity in the text to be processed through the mark.
Optionally, the processor may further execute the program code of the following steps: before obtaining a text to be processed and a target entity of a relation to be determined in the text to be processed, performing word segmentation on the text to be processed under the condition that the text to be processed is in a preset language, wherein the preset language at least comprises Chinese.
Optionally, the processor may further execute the program code of the following steps: and performing feature extraction on each word of the text to be processed through a preset feature extraction network to obtain a text feature vector corresponding to each word.
Optionally, the processor may further execute the program code of the following steps: extracting a text feature vector of a target entity from the text feature information; performing maximum pooling on the text feature vector of the target entity to obtain a text feature vector after dimension reduction; first feature information is determined based on the reduced-dimension text feature vectors of the plurality of target entities.
Optionally, the processor may further execute the program code of the following steps: connecting the reduced-dimension text feature vectors of a plurality of target entities to obtain a connection feature vector; and performing feature fusion on the connection feature vector through a single-layer neural network to obtain first feature information.
Optionally, the processor may further execute the program code of the following steps: and determining the first characteristic information as a query parameter, determining the text characteristic information as a key parameter and a value parameter, and determining the second characteristic information through an attention mechanism.
Optionally, the texts in different domains have corresponding classifiers and relationship sets, and the processor may further execute program codes of the following steps: determining a field to which a text to be processed belongs; and classifying the text to be processed according to the second characteristic information by using a classifier corresponding to the field to which the text belongs so as to determine the relationship among the target entities from the corresponding relationship set.
The embodiment of the invention provides a text processing scheme. Obtaining a text to be processed and a target entity of a relation to be determined in the text to be processed; acquiring text characteristic information of the text to be processed and first characteristic information related to the target entity; determining second feature information based on the text feature information and the first feature information through an attention mechanism; and classifying the relation between the target entities of the relation to be determined according to the second characteristic information. The scheme provides a model based on an attention mechanism, firstly, the scheme does not need a dependency relationship graph to extract the relationship between entities, so that wrong iteration caused by poor dependency relationship extractors can be avoided, in order to better find text information shared between two entities, a multi-head attention mechanism is introduced, so that text information more relevant to a target entity can be found, the relationship of the target entity can be more accurately judged, and the technical problem of low accuracy in determining the relationship between the entities in the prior art is solved.
It will be understood by those skilled in the art that the structure shown in fig. 7 is only an example, and the computing device may also be a terminal device such as a smart phone (e.g., an Android phone, an iOS phone, etc.), a tablet computer, a palmtop computer, and a Mobile Internet Device (MID), PAD, etc. Fig. 7 is a diagram illustrating a structure of the electronic device. For example, computing device A may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in FIG. 7, or have a different configuration than shown in FIG. 7.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, read-Only memories (ROMs), random Access Memories (RAMs), magnetic or optical disks, and the like.
Example 5
The embodiment of the invention also provides a storage medium. Optionally, in this embodiment, the storage medium may be configured to store a program code executed by the method for determining an entity relationship provided in the first embodiment.
Optionally, in this embodiment, the storage medium may be located in any one of computing devices in a computing device group in a computer network, or in any one of mobile terminals in a mobile terminal group.
Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps: acquiring a text to be processed and a target entity of a relation to be determined in the text to be processed; acquiring text characteristic information of the text to be processed and first characteristic information related to the target entity; determining second feature information based on the text feature information and the first feature information through an attention mechanism; and classifying the relation between the target entities of the relation to be determined according to the second characteristic information.
Example 6
The present application provides a method of determining entity relationships as shown in fig. 8. Fig. 8 is a flowchart of a method for determining entity relationships according to embodiment 6 of the present application.
Step S81, user data are obtained, a target entity of the relation to be determined in the user data is determined, and the target entity comprises a product name.
Specifically, the user data may be corpora obtained from the e-commerce platform, such as commodity comment information, communication information between the user and the merchant, communication information between the user and the e-commerce customer service, and the like. The target entity of the relationship to be determined in the user data may be a preset entity word in the user data. These target entities may be obtained by performing entity word recognition on the user data.
And S83, classifying the relation of the target entities based on a relation classification model, wherein the relation classification model acquires text characteristic information of the user data and first characteristic information related to the target entities, determines second characteristic information based on the text characteristic information and the first characteristic information through an attention mechanism, and classifies the relation between the target entities of which the relation is to be determined according to the second characteristic information.
Specifically, the relationship classification model may determine the relationship of the target entity by performing the steps in embodiment 1.
In an alternative embodiment, a plurality of target entities in the user data may be identified, and in the case that the target entities include product names, the relationship between other entities and the product names may be determined through the above steps.
And S85, marking the product name in the user data based on the classification result.
In the above steps, the product name is marked in the user data to determine the current analysis object.
And S87, performing emotion analysis on the user data marked with the product name according to the classification result, determining user preference, and recommending products to the user according to the user preference.
Specifically, the user data marked with the product name is the corpus containing the product. In the above steps, the marked product name is the name of the product to be analyzed. And analyzing the user preference for the user data marked with the product name, so as to determine the washing degree of the user for the product to which the marked product name is positioned. By analyzing a large amount of user data, the preference of a user for a certain product, the preference of the user for a certain brand and the like can be obtained.
In an alternative embodiment, the emotion analysis result can be represented by a numerical value between (0,1), wherein the closer the emotion analysis result is to 1, the higher the preference degree, or by two numerical values of 0 and 1, wherein 0 represents a negative emotion and 1 represents a positive emotion.
After the user preference is obtained, the product recommendation can be carried out on the user according to the user preference by the preset recommendation algorithm, so that the accuracy of recommending the product is improved.
The method includes the steps that user data are obtained, a target entity of a relation to be determined in the user data is determined, and the target entity comprises a product name; classifying the relation of the target entities based on a relation classification model, wherein the relation classification model acquires text characteristic information of the user data and first characteristic information related to the target entities, determines second characteristic information based on the text characteristic information and the first characteristic information through an attention mechanism, and classifies the relation between the target entities of which the relation is to be determined according to the second characteristic information; annotating the product name in the user data based on a classification result; and performing emotion analysis on the user data marked with the product name according to the classification result, determining user preference, and recommending products to the user according to the user preference. According to the scheme, the relation between the target entities in the user data is classified by using the relation classification model, so that the user data is subjected to emotion analysis according to the classification result to obtain the preference of the user, the product is recommended to the user according to the preference of the user, and the technical effect of improving the accuracy of product recommendation is achieved.
Example 7
The present application provides a method of determining entity relationships as shown in fig. 9. Fig. 9 is a flowchart of a method for determining entity relationships according to embodiment 7 of the present application, where the method includes:
step S91, data information in a preset platform is obtained, and a target entity of a relation to be determined in the data information is determined, wherein the target entity comprises a person name.
Specifically, the preset platform may be a music platform, a video communication platform, a ticket selling platform, a discussion platform, or the like. The target entity of the relationship to be determined in the data information may be a preset entity word in the data information. The target entities can be obtained by performing entity word recognition on the data information. The names of the characters can be names of actors, singers, names of characters in movie and television plays, and the like.
And S93, classifying the relation of the target entities based on a relation classification model, wherein the relation classification model acquires text characteristic information of the data information and first characteristic information related to the target entities, determines second characteristic information based on the text characteristic information and the first characteristic information through an attention mechanism, and classifies the relation between the target entities of which the relation is to be determined according to the second characteristic information.
Specifically, the relationship classification model may determine the relationship of the target entity by performing the steps in embodiment 1.
In an alternative embodiment, a plurality of target entities in the data information may be identified, and in the case that the target entities include the names of the persons, the relationships between the other entities and the names of the persons may be determined through the above steps.
Step S95, labeling the person name in the data information based on the classification result.
In the above step, the person name is marked in the data information to determine the current analysis object.
And step S97, analyzing the data information marked with the character name based on the classification result according to a preset analysis strategy to obtain an analysis result corresponding to the character name.
In the above steps, the data information is analyzed based on the classification result, so that the attention of the user to the characters represented by the character names and the comments of the user to the characters in each dimension can be obtained, and information such as character popularity ranking, skill ranking, singing skill ranking and the like can be obtained. And for the user, the preference of the user to the character can be analyzed and obtained, so that the film and television works can be recommended to the user in a preset platform according to the preference of the user. For example, the preference ranking of the user to each person may be analyzed, and the works of persons with higher preference ranking may be recommended to the user.
As can be seen from the above, in the embodiment of the present application, data information in a preset platform is obtained, and a target entity of a relationship to be determined in the data information is determined, where the target entity includes a name of a person; classifying the relation of the target entities based on a relation classification model, wherein the relation classification model acquires text data information of the user data and first characteristic information related to the target entities, determines second characteristic information based on the text characteristic information and the first characteristic information through an attention mechanism, and classifies the relation between the target entities of which the relation is to be determined according to the second characteristic information; marking out the name of the person in the data information based on the classification result; and analyzing the data information marked with the person name based on the classification result according to a preset analysis strategy to obtain an analysis result corresponding to the person name. According to the scheme, the target entities in the data information including the character names in the preset platform are subjected to relationship classification, so that the character names are analyzed according to the classification result, the preference of the user to each character is obtained, and then the related works can be recommended to the user according to the preference of the user to each character, and the effect of improving the recommendation accuracy is achieved.
Example 8
The present application provides a method of determining entity relationships as shown in fig. 10. Fig. 10 is a flowchart of a method for determining entity relationships according to embodiment 8 of the present application, where the method includes:
step S101, acquiring medical data information, and determining a target entity of a relation to be determined in the medical data information, wherein the target entity is used for representing a medical name.
Specifically, the medical data information may include a diagnostic book, a laboratory sheet, and the like. The target entity of the relationship to be determined in the medical data information may be an entity word preset in the medical data information. The medical names represented by the target entities can be obtained by performing entity word recognition on the medical data information, and for example, the medical names may include: drug name, disease name, treatment name, etc.
Step S103, classifying the relation of the target entities based on a relation classification model, wherein the relation classification model obtains text feature information of the data information and first feature information related to the target entities, determines second feature information based on the text feature information and the first feature information through an attention mechanism, and classifies the relation between the target entities of which the relation is to be determined according to the second feature information.
Specifically, the relationship classification model may determine the relationship of the target entity by performing the steps in embodiment 1.
Step S105, highlighting the target entity in the medical data information based on the classification result.
In the above scheme, highlighting the medical name in the medical data information based on the classification result may be displaying the target entities with a certain relationship in the same color, for example, the medication of the disease X1 is Y1, the dosage is Z1, the medication of the disease X2 is Y2, the dosage is Z2, and the determined relationship is: since Y1 is the treatment means X1, Z1 is the method of using Y1, Y2 is the treatment means X2, and Z2 is the method of using Y2, X1, Y1, and Z1 are displayed in the same manner (in the same color, font, or background), and X2, Y2, and Z2 are displayed in the same manner. Therefore, medical staff can read effective information from the medical data information quickly and accurately.
As can be seen from the above, in the embodiment of the present application, medical data information is obtained, and a target entity of a relationship to be determined in the medical data information is determined; classifying the relation of the target entities based on a relation classification model, wherein the relation classification model acquires text characteristic information of the data information and first characteristic information related to the target entities, determines second characteristic information based on the text characteristic information and the first characteristic information through an attention mechanism, and classifies the relation between the target entities of which the relation is to be determined according to the second characteristic information; highlighting the target entity in the medical data information based on the classification result. According to the scheme, the target entities in the medical data information are subjected to relation classification, and the medical names are marked in the medical data information based on the relation classification result, so that the effect of conveniently and accurately reading effective information from the medical data information by medical workers is achieved.
Example 9
According to an embodiment of the present invention, there is further provided an apparatus for determining an entity relationship, configured to perform the method for determining an entity relationship in embodiment 6, where fig. 11 is a schematic diagram of an apparatus for determining an entity relationship according to embodiment 9 of the present application, and with reference to fig. 11, the apparatus 1100 includes:
an obtaining module 1102, configured to obtain user data and determine a target entity of a relationship to be determined in the user data, where the target entity includes a product name;
a classification module 1104, configured to classify the relationship of the target entities based on a relationship classification model, where the relationship classification model obtains text feature information of the user data and first feature information related to the target entities, determines second feature information based on the text feature information and the first feature information through an attention mechanism, and classifies the relationship between the target entities of which the relationship is to be determined according to the second feature information;
a labeling module 1106, configured to label the product name in the user data based on the classification result;
an analysis module 1108, configured to perform emotion analysis on the user data marked with the product name according to the classification result, determine user preferences, and perform product recommendation to the user according to the user preferences.
It should be noted that the acquiring module 1102, the classifying module 1104, the labeling module 1106 and the analyzing module 1108 correspond to steps S81 to S87 in embodiment 6, and the four modules are the same as the corresponding steps in the implementation example and the application scenario, but are not limited to the disclosure in the first embodiment. It should be noted that the modules described above as part of the apparatus may be run in the computing device 10 provided in the first embodiment.
Example 10
According to an embodiment of the present invention, there is further provided an apparatus for determining an entity relationship, for performing the method for determining an entity relationship in embodiment 7, and fig. 12 is a schematic diagram of an apparatus for determining an entity relationship according to embodiment 10 of the present application, and with reference to fig. 12, the apparatus 1200 includes:
an obtaining module 1202, configured to obtain data information in a preset platform, and determine a target entity of a relationship to be determined in the data information, where the target entity includes a name of a person;
a classification module 1204, configured to classify a relationship of the target entities based on a relationship classification model, where the relationship classification model obtains text feature information of the data information and first feature information related to the target entities, determines second feature information based on the text feature information and the first feature information through an attention mechanism, and classifies a relationship between the target entities of which the relationship is to be determined according to the second feature information;
a labeling module 1206, configured to label a person name in the data information based on the classification result;
the analysis module 1208 is configured to analyze the data information marked with the person name based on the classification result according to a preset analysis policy, so as to obtain an analysis result corresponding to the person name.
It should be noted here that the obtaining module 1202, the classifying module 1204, the labeling module 1206 and the analyzing module 1208 correspond to steps S91 to S97 in the embodiment 7, and the four modules are the same as the corresponding steps in the implementation example and the application scenario, but are not limited to the disclosure in the first embodiment. It should be noted that the above modules as part of the apparatus may be run in the computing device 10 provided in the first embodiment.
Example 11
According to an embodiment of the present invention, there is further provided an apparatus for determining an entity relationship, configured to perform the method for determining an entity relationship in embodiment 8, where fig. 13 is a schematic diagram of an apparatus for determining an entity relationship according to embodiment 11 of the present application, and with reference to fig. 13, the apparatus 1300 includes:
an obtaining module 1302, configured to obtain medical data information, and determine a target entity to be determined in the medical data information, where the target entity is used to represent a medical name;
an analysis module 1304, configured to classify the relationship of the target entity based on a relationship classification model, where the relationship classification model obtains text feature information of the data information and first feature information related to the target entity, determines second feature information based on the text feature information and the first feature information through an attention mechanism, and classifies the relationship between the target entities of which the relationship is to be determined according to the second feature information;
a display module 1306, configured to highlight the target entity in the medical data information based on the classification result.
It should be noted here that the acquiring module 1302, the analyzing module 1304 and the displaying module 1306 correspond to steps S101 to S105 in embodiment 8, and the four modules are the same as the corresponding steps in the implementation example and application scenario, but are not limited to the disclosure in the first embodiment. It should be noted that the above modules as part of the apparatus may be run in the computing device 10 provided in the first embodiment.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (12)

1. A method of determining entity relationships, comprising:
acquiring a text to be processed and a target entity of a relation to be determined in the text to be processed;
acquiring text characteristic information of the text to be processed and first characteristic information related to the target entity;
determining second feature information based on the text feature information and the first feature information through an attention mechanism;
and classifying the relationship between the target entities of the relationship to be determined according to the second characteristic information.
2. The method of claim 1,
before obtaining a text to be processed and a target entity of a relation to be determined in the text to be processed, the method further includes: extracting entities in the text to be processed, and marking target entities in the entities;
the method for acquiring the text to be processed and the target entity of the relation to be determined in the text to be processed comprises the following steps: and acquiring the text to be processed, and determining a target entity in the text to be processed through marking.
3. The method according to claim 1, wherein before obtaining the text to be processed and the target entities of the relationship to be determined in the text to be processed, the method further comprises:
and under the condition that the text to be processed is in a preset language, performing word segmentation on the text to be processed, wherein the preset language at least comprises Chinese.
4. The method of claim 1, wherein obtaining first profile information associated with the target entity comprises:
extracting a text feature vector of the target entity from the text feature information;
performing maximum pooling on the text feature vector of the target entity to obtain a text feature vector after dimension reduction;
determining the first feature information based on the reduced-dimension text feature vectors of a plurality of target entities.
5. The method of claim 4, wherein determining the first feature information based on the reduced-dimension text feature vectors of the plurality of target entities comprises:
connecting the dimensionality-reduced text feature vectors of a plurality of target entities to obtain a connection feature vector;
and performing feature fusion on the connection feature vector through a single-layer neural network to obtain the first feature information.
6. The method of claim 1, wherein determining second feature information based on the textual feature information and the first feature information via an attention mechanism comprises:
and determining the first characteristic information as a query parameter, determining the text characteristic information as a key parameter and a value parameter, and determining the second characteristic information through the attention mechanism.
7. The method according to claim 1, wherein texts in different domains have corresponding classifiers and relationship sets, and classifying the relationship between the target entities of which the relationship is to be determined according to the second feature information comprises:
determining the domain to which the text to be processed belongs;
and classifying according to the second characteristic information by using a classifier corresponding to the field to which the text to be processed belongs so as to determine the relationship among the target entities from the corresponding relationship set.
8. A storage medium, characterized in that the storage medium comprises a stored program, wherein when the program runs, a device in which the storage medium is located is controlled to execute the method for determining entity relationships according to any one of claims 1 to 7.
9. A processor, characterized in that the processor is configured to run a program, wherein the program when running performs the method of determining entity relationships of any one of claims 1 to 7.
10. A method of determining entity relationships, comprising:
acquiring user data, and determining a target entity of a relation to be determined in the user data, wherein the target entity comprises a product name;
classifying the relation of the target entities based on a relation classification model, wherein the relation classification model acquires text characteristic information of the user data and first characteristic information related to the target entities, determines second characteristic information based on the text characteristic information and the first characteristic information through an attention mechanism, and classifies the relation between the target entities of which the relation is to be determined according to the second characteristic information;
annotating the product name in the user data based on a classification result;
and performing sentiment analysis on the user data marked with the product name according to the classification result, determining user preference, and performing product recommendation to the user according to the user preference.
11. A method of determining entity relationships, comprising:
acquiring data information in a preset platform, and determining a target entity to be determined in the data information, wherein the target entity comprises a person name;
classifying the relation of the target entities based on a relation classification model, wherein the relation classification model acquires text characteristic information of the data information and first characteristic information related to the target entities, determines second characteristic information based on the text characteristic information and the first characteristic information through an attention mechanism, and classifies the relation between the target entities of which the relation is to be determined according to the second characteristic information;
marking out the name of the person in the data information based on the classification result;
and analyzing the data information marked with the character name based on the classification result according to a preset analysis strategy to obtain an analysis result corresponding to the character name.
12. A method of determining entity relationships, comprising:
acquiring medical data information, and determining a target entity of a relation to be determined in the medical data information, wherein the target entity is used for representing a medical name;
classifying the relation of the target entities based on a relation classification model, wherein the relation classification model acquires text characteristic information of the data information and first characteristic information related to the target entities, determines second characteristic information based on the text characteristic information and the first characteristic information through an attention mechanism, and classifies the relation between the target entities of which the relation is to be determined according to the second characteristic information;
highlighting the target entity in the medical data information based on the classification result.
CN202110497247.9A 2021-05-07 2021-05-07 Method for determining entity relationship, storage medium and processor Pending CN115309855A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110497247.9A CN115309855A (en) 2021-05-07 2021-05-07 Method for determining entity relationship, storage medium and processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110497247.9A CN115309855A (en) 2021-05-07 2021-05-07 Method for determining entity relationship, storage medium and processor

Publications (1)

Publication Number Publication Date
CN115309855A true CN115309855A (en) 2022-11-08

Family

ID=83853358

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110497247.9A Pending CN115309855A (en) 2021-05-07 2021-05-07 Method for determining entity relationship, storage medium and processor

Country Status (1)

Country Link
CN (1) CN115309855A (en)

Similar Documents

Publication Publication Date Title
CN108319888B (en) Video type identification method and device and computer terminal
CN111831911A (en) Query information processing method and device, storage medium and electronic device
CN111310440A (en) Text error correction method, device and system
CN109086420B (en) Method, device and storage medium for selecting reading material
CN110287405B (en) Emotion analysis method, emotion analysis device and storage medium
CN110858353B (en) Method and system for obtaining case judge result
CN113282762A (en) Knowledge graph construction method and device, electronic equipment and storage medium
CN113032520A (en) Information analysis method and device, electronic equipment and computer readable storage medium
CN115455151A (en) AI emotion visual identification method and system and cloud platform
CN113204643B (en) Entity alignment method, device, equipment and medium
CN110647504B (en) Method and device for searching judicial documents
WO2024114681A1 (en) Search result display method and apparatus, and computer device and storage medium
CN111597296A (en) Commodity data processing method, device and system
CN111460808A (en) Synonymous text recognition and content recommendation method and device and electronic equipment
CN115861606B (en) Classification method, device and storage medium for long-tail distributed documents
CN115309855A (en) Method for determining entity relationship, storage medium and processor
CN110929519A (en) Entity attribute extraction method and device
CN111860606B (en) Image classification method, device and storage medium
CN111723566B (en) Product information reconstruction method and device
CN110956034B (en) Word acquisition method and device and commodity search method
CN112541357A (en) Entity identification method and device and intelligent equipment
CN114117110A (en) Commodity data processing method and device, storage medium and processor
CN112446202A (en) Text analysis method and device
CN112559732A (en) Text processing method, device and system
CN110826313A (en) Information extraction method, electronic equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20240523

Address after: # 03-06, Lai Zan Da Building 1, 51 Belarusian Road, Singapore

Applicant after: Alibaba Innovation Co.

Country or region after: Singapore

Applicant after: Singapore University of technology and design

Address before: Room 01, 45th Floor, AXA Building, 8 Shanton Road, Singapore

Applicant before: Alibaba Singapore Holdings Ltd.

Country or region before: Singapore

Applicant before: Singapore University of technology and design