CN111125377B - Entity relationship identification method, device and equipment - Google Patents

Entity relationship identification method, device and equipment Download PDF

Info

Publication number
CN111125377B
CN111125377B CN201911351183.0A CN201911351183A CN111125377B CN 111125377 B CN111125377 B CN 111125377B CN 201911351183 A CN201911351183 A CN 201911351183A CN 111125377 B CN111125377 B CN 111125377B
Authority
CN
China
Prior art keywords
entity
combination
target
entities
text
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.)
Active
Application number
CN201911351183.0A
Other languages
Chinese (zh)
Other versions
CN111125377A (en
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.)
Neusoft Corp
Original Assignee
Neusoft Corp
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 Neusoft Corp filed Critical Neusoft Corp
Priority to CN201911351183.0A priority Critical patent/CN111125377B/en
Publication of CN111125377A publication Critical patent/CN111125377A/en
Application granted granted Critical
Publication of CN111125377B publication Critical patent/CN111125377B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/367Ontology

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Animal Behavior & Ethology (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Machine Translation (AREA)

Abstract

The embodiment of the application discloses a method, a device and equipment for identifying entity relationship, which comprises the following steps: identifying entities and entity classes thereof in the text to be processed; generating a feature representation of a target entity combination according to feature values and entity categories of two entities in the target entity combination, wherein the target entity combination respectively takes two continuous entities in the text to be processed; inputting the characteristic representation of the target entity combination into a parallel relation judgment model to obtain a judgment result of whether the target entity combination is in a parallel relation; inputting the characteristic representation of the target entity combination into a dependency relationship judgment model to obtain a judgment result of whether the target entity combination is a dependency relationship; if the first entity and the second entity have a parallel relationship and the first entity and the third entity have an affiliation, determining that the second entity and the third entity have an affiliation; if the first entity and the second entity have a parallel relationship, the first entity and the third entity have a parallel relationship, and the second entity and the third entity have a parallel relationship.

Description

Entity relationship identification method, device and equipment
Technical Field
The present application relates to the field of data processing, and in particular, to a method, an apparatus, and a device for identifying an entity relationship.
Background
When structuring a data text, entity recognition and entity combination are generally required for the data text. The entity identification refers to identifying entities in the data text, and the entity combination refers to combining different entities according to entity relations, wherein the entity relations are used for representing relations (such as parallel relations and dependent relations) existing among the entities. Based on this, whether the entity relationship is accurate or not can affect the accuracy of the entity combination result. However, how to identify entity relationships still remains a technical problem to be solved.
Disclosure of Invention
In view of this, embodiments of the present application provide a method, an apparatus, and a device for identifying an entity relationship, which can accurately identify an entity relationship.
In order to solve the above problem, the technical solution provided by the embodiment of the present application is as follows:
a method of entity relationship identification, the method comprising:
identifying entities in a text to be processed and entity categories of the entities in the text to be processed;
generating a feature representation of a target entity combination according to feature values and entity categories of two entities in the target entity combination, wherein the target entity combination respectively takes two continuous entities in the text to be processed;
inputting the feature representation of the target entity combination into a parallel relation judgment model to obtain a judgment result of whether the target entity combination is in a parallel relation;
inputting the characteristic representation of the target entity combination into a subordinate relation judgment model to obtain a judgment result of whether the target entity combination is subordinate relation;
if the first entity and the second entity have the parallel relationship and the first entity and the third entity have the subordination relationship, determining that the second entity and the third entity have the subordination relationship, and if the first entity and the second entity have the parallel relationship and the first entity and the third entity have the parallel relationship, determining that the second entity and the third entity have the parallel relationship, wherein the first entity and the second entity are two continuous entities in the text to be processed, and the first entity and the third entity are two continuous entities in the text to be processed.
In one possible implementation, the method further includes:
determining that an entity in the text to be processed is a core word or a relation word, wherein the relation word is used for representing the attribute of the core word;
inputting the characteristic representation of the target entity combination into a parallel relation judgment model to obtain a judgment result of whether the target entity combination is in a parallel relation or not, wherein the judgment result comprises the following steps:
when both entities in the target entity combination are the core words or both entities in the target entity combination are the relation words, inputting the feature representation of the target entity combination into a parallel relation judgment model to obtain a judgment result of whether the target entity combination is in a parallel relation or not;
the step of inputting the feature representation of the target entity combination into a dependency relationship judgment model to obtain a judgment result of whether the target entity combination is a dependency relationship comprises the following steps:
and when one of the two entities in the target entity combination is the core word and the other one is the relation word, inputting the characteristic representation of the target entity combination into an affiliation judgment model to obtain a judgment result of whether the target entity combination is an affiliation.
In a possible implementation manner, the generating a feature representation of a target entity combination according to feature values and entity categories of two entities in the target entity combination includes:
acquiring characteristic values of two entities in a target entity combination and characteristic values of other participles between the two entities in the target entity combination;
calculating the characteristic values of the two entities in the target entity combination and the mean value of the characteristic values of other participles between the two entities in the target entity combination to serve as a first target characteristic value;
and combining the first target characteristic value and labels of entity categories of two entities in the target entity combination into a characteristic representation of the target entity combination.
In a possible implementation manner, the training process of the parallel relation judgment model includes:
acquiring an entity in a training text and an entity category of the entity in the training text;
generating feature representation of the target entity combination to be trained according to the feature values and entity categories of two entities in the entity combination to be trained, wherein the target entity combination to be trained respectively takes two continuous entities in the training text;
and training to generate a parallel relation judgment model by using the feature representation of the target entity combination to be trained and the classification label whether the target entity combination to be trained corresponds to the parallel relation or not.
In a possible implementation manner, the training process of the dependency relationship determination model includes:
acquiring an entity in a training text and an entity category of the entity in the training text;
generating feature representation of the target entity combination to be trained according to the feature values and entity categories of two entities in the entity combination to be trained, wherein the target entity combination to be trained respectively takes two continuous entities in the training text;
and training to generate a dependency relationship judgment model by using the feature representation of the target entity combination to be trained and the classification label whether the target entity combination to be trained corresponds to the dependency relationship.
In a possible implementation manner, the generating a feature representation of the target entity combination to be trained according to feature values and entity classes of two entities in the entity combination to be trained includes:
acquiring characteristic values of two entities in an entity combination to be trained and characteristic values of other participles between the two entities in the entity combination to be trained;
calculating the characteristic values of the two entities in the entity combination to be trained and the mean value of the characteristic values of other participles between the two entities in the entity combination to be trained to serve as a second target characteristic value;
and combining the second target characteristic value and labels of entity categories of two entities in the entity combination to be trained into the characteristic representation of the entity combination to be trained.
In one possible implementation, the method further includes:
calculating the probability of a second target entity behind a first target entity in a training text as the transition probability of the first target entity to the second target entity, wherein the first target entity is each entity in the training text, and the second target entity is each entity in the training text.
In one possible implementation, the method further includes:
calculating a first attribute score of the first target entity according to the transition probability of the first target entity to the second target entity;
determining the entity with the first attribute score larger than a first threshold value in the training text as a core word, and adding the core word in the training text to a core word list;
determining the entity with the first attribute score smaller than a second threshold value in the training text as a relation word, and adding the relation word in the training text to a relation word list; wherein the second threshold is less than or equal to the first threshold;
the determining that the entity in the text to be processed is a core word or a relation word includes:
determining an entity matched with the entity in the core word list in the text to be processed as a core word;
and determining the entity matched with the entity in the relation word list in the text to be processed as the relation word.
In a possible implementation manner, the determining that the entity in the text to be processed is a core word or a relation word includes:
acquiring transition probabilities from a third target entity to a fourth target entity from transition probabilities from the first target entity to the second target entity, wherein the third target entity is each entity in the text to be processed, and the fourth target entity is each entity in the text to be processed;
calculating a second attribute score of the third target entity according to the transition probability of the third target entity to the fourth target entity;
determining the entity of which the second attribute score is larger than a third threshold value in the text to be processed as a core word;
determining the entities with the second attribute scores smaller than a fourth threshold value in the text to be processed as related words; wherein the fourth threshold is less than or equal to the third threshold.
An entity relationship identification apparatus, the apparatus comprising:
the entity identification unit is used for identifying an entity in a text to be processed and an entity category of the entity in the text to be processed;
the feature generation unit is used for generating feature representation of the target entity combination according to feature values and entity categories of two entities in the target entity combination, and the target entity combination respectively takes two continuous entities in the text to be processed;
the parallel judgment unit is used for inputting the characteristic representation of the target entity combination into a parallel relation judgment model to obtain a judgment result of whether the target entity combination is in a parallel relation;
the subordinate judgment unit is used for inputting the characteristic representation of the target entity combination into a subordinate relation judgment model and obtaining a judgment result of whether the target entity combination is a subordinate relation;
a relationship determining unit, configured to determine that the subordinate relationship exists between the second entity and the third entity if the parallel relationship exists between the first entity and the second entity and the subordinate relationship exists between the first entity and the third entity, determine that the parallel relationship exists between the second entity and the third entity if the parallel relationship exists between the first entity and the second entity and the parallel relationship exists between the first entity and the third entity, where the first entity and the second entity are two consecutive entities in the text to be processed and the first entity and the third entity are two consecutive entities in the text to be processed.
An entity relationship identification device comprising: the entity relationship identification method comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the processor executes the computer program to realize the entity relationship identification method.
A computer-readable storage medium having stored therein instructions that, when run on a terminal device, cause the terminal device to execute the entity relationship identification method.
Therefore, the embodiment of the application has the following beneficial effects:
in the entity relationship identification method provided by the embodiment of the application, an entity in a text to be processed and an entity category of the entity in the text to be processed are identified, and a feature representation of a target entity combination is generated according to feature values and entity categories of two entities in the target entity combination, wherein the target entity combination respectively takes two continuous entities in the text to be processed; inputting the characteristic representation of the target entity combination into a parallel relation judgment model to obtain a judgment result of whether the target entity combination is in a parallel relation, and inputting the characteristic representation of the target entity combination into a subordinate relation judgment model to obtain a judgment result of whether the target entity combination is in a subordinate relation; at this time, if the first entity and the second entity have a parallel relationship and the first entity and the third entity have an affiliation, determining that the second entity and the third entity have an affiliation; and if the first entity and the second entity have a parallel relationship and the first entity and the third entity have a parallel relationship, determining that the second entity and the third entity have a parallel relationship. The first entity and the second entity are two continuous entities in the text to be processed, and the first entity and the third entity are two continuous entities in the text to be processed. Thus, the entity relation existing in the text to be processed is determined.
Because two continuous entities with parallel relations in the text to be processed can share an entity relation (for example, parallel relation or dependency relation), after the dependency relation corresponding to any one of the two entities is obtained, the entity relation corresponding to the other of the two entities can be directly generated according to the dependency relation, and after the parallel relation corresponding to any one of the two entities is obtained, the entity relation corresponding to the other of the two entities can be directly generated according to the parallel relation, so that the identification accuracy of the entity relation is improved.
Drawings
FIG. 1 is a schematic diagram of an entity tag of a text to be processed, namely "intermittent dizziness and chest distress for 2 days with running nose" provided in an embodiment of the present application;
fig. 2 is a flowchart of an entity relationship identification method according to an embodiment of the present application;
fig. 3 is a schematic diagram illustrating an entity of a text to be processed and an identification of an entity category thereof according to an embodiment of the present application;
fig. 4 is a flowchart of an embodiment of an entity relationship identification method according to an embodiment of the present application;
fig. 5 is a flowchart of a training process of a judgmental model of a parallel relationship according to an embodiment of the present disclosure;
fig. 6 is a flowchart of a process of training a dependency relationship determination model according to an embodiment of the present application;
fig. 7 is a schematic diagram of an entity relationship identification method according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an entity relationship identification apparatus according to an embodiment of the present application.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, embodiments accompanying figures and detailed description thereof are described in further detail below.
The inventor finds in the research of the traditional entity relationship identification method that the traditional entity relationship identification method cannot accurately identify the entity relationship in the text to be processed similar to the text with intermittent dizziness and chest stuffiness for 2 days with running nose. The following description is made with reference to examples.
As an example, as shown in fig. 1, when the text to be processed is "intermittent dizziness and chest distress for 2 days with running nose", the text to be processed includes entities "intermittent", "dizziness", "chest distress", "2 days" and "running nose"; and the entity category of "intermittent" is "frequency of occurrence", "the entity category of" dizziness "is" symptom "," the entity category of "chest distress" is "symptom", "the entity category of" 2 days "is" duration ", and the entity category of" running nose "is" accompanying symptom ". Based on these contents, the following entity attributes exist in the text to be processed: the "breaks" are the frequency of occurrence of "dizziness" and "chest distress", and the "2 days" are the duration of "dizziness" and "chest distress". Based on this, the following entity relationships exist in the text to be processed: the 'intermittence' is subordinate to 'dizziness', 'intermittence' is subordinate to 'chest distress', '2 days' are subordinate to 'dizziness', '2 days' are subordinate to 'chest distress', and 'dizziness' and 'chest distress' are parallel.
However, when the entity relationship recognition method is used to perform the entity relationship recognition on "intermittent dizziness and chest stuffiness for 2 days with running nose", because only the occurrence frequency that "intermittent" is "dizziness" and the duration time that "2 days" is "chest stuffiness" can be determined, the occurrence frequency that "intermittent" is "chest stuffiness" and the duration time that "2 days" is "dizziness" cannot be recognized, the conventional entity relationship recognition method can only recognize that "intermittent" belongs to "dizziness", "2 days" belongs to "chest stuffiness" and "dizziness" is juxtaposed with "chest stuffiness", but cannot recognize the entity relationship "2 days" belongs to "chest stuffiness" and "2 days" belongs to "dizziness" hidden in the text to be processed, and thus the conventional entity relationship recognition method cannot accurately recognize the entity relationship in the data text.
It should be noted that, the traditional entity relationship identification method cannot identify the entity relationship "dizziness" and "nausea" which are similar to those hidden in "intermittent dizziness and chest distress nausea for 2 days".
It should be noted that the dependency relationship is used to characterize the relationship between the relation word (e.g., the entity with the entity category of "occurrence frequency" or the like) and the core word (e.g., the entity with the entity category of "symptom"), and the relation word is subordinate to the core word.
In addition, in order to solve the technical problems in the background art and the above technical problems, an embodiment of the present application provides an entity relationship identification method, including: firstly, identifying an entity in a text to be processed and an entity category of the entity in the text to be processed, and generating a feature representation of a target entity combination according to feature values and the entity category of two entities in the target entity combination, wherein the target entity combination respectively takes two continuous entities in the text to be processed; inputting the characteristic representation of the target entity combination into a parallel relation judgment model to obtain a judgment result of whether the target entity combination is in a parallel relation, and inputting the characteristic representation of the target entity combination into a subordinate relation judgment model to obtain a judgment result of whether the target entity combination is in a subordinate relation; at this time, if the first entity and the second entity have a parallel relationship and the first entity and the third entity have an affiliation, determining that the second entity and the third entity have an affiliation; and if the first entity and the second entity have a parallel relationship and the first entity and the third entity have a parallel relationship, determining that the second entity and the third entity have a parallel relationship. The first entity and the second entity are two continuous entities in the text to be processed, and the first entity and the third entity are two continuous entities in the text to be processed. The two entities with the parallel relationship and the continuous positions can share the entity relationship (for example, the parallel relationship or the dependency relationship), so that after the entity relationship (for example, the parallel relationship or the dependency relationship) of any one of the two entities is obtained, the entity relationship corresponding to the other entity of the two entities can be directly generated according to the entity relationship, and thus the entity relationship hidden in the text to be processed, which is similar to 'intermittent dizziness and chest stuffiness for 2 days with running nose', can be accurately identified, and the identification accuracy of the entity relationship is improved.
In order to facilitate understanding of the present application, an entity relationship identification method provided in the embodiments of the present application is described below with reference to the accompanying drawings.
Referring to fig. 2, the figure is a flowchart of an entity relationship identification method provided in an embodiment of the present application, where the method includes steps S201 to S206:
s201: and identifying the entity in the text to be processed and the entity category of the entity in the text to be processed.
The embodiments of the present application do not limit the identification methods of the entities and the entity categories, and for example, any existing named entity identification labeling method may be used for implementation, or an entity labeling method based on a vocabulary may be used.
In the embodiment of the present application, after the text to be processed is obtained, an entity in the text to be processed and an entity category of the entity in the text to be processed may be identified by using a named entity identification tagging method (or an entity tagging method based on a vocabulary) (as shown in fig. 3).
S202: and generating the feature representation of the target entity combination according to the feature values and the entity categories of the two entities in the target entity combination, wherein the target entity combination respectively takes two continuous entities in the text to be processed.
The characteristic value of an entity is used for uniquely characterizing the entity; the embodiment of the present application does not limit the expression manner of the eigenvalue of the entity, for example, the eigenvalue of the entity may be a word vector of the entity, where the word vector of the entity may be obtained by word2 vec.
The feature represents relationship feature information for characterizing the existence of two entities in the target entity combination.
In addition, embodiments of the present application further provide an implementation manner of generating a feature representation of a target entity combination, and please refer to the following detailed implementation manner.
In the embodiment of the application, after the entities and the entity categories thereof in the text to be processed are identified, every two continuous entities in the text to be processed can be used as a target entity combination, so that the feature representation of the target entity combination can be generated according to the feature values and the entity categories of the two entities in the target entity combination, and thus the feature representations corresponding to every two continuous entities in the text to be processed can be obtained, and the entity relationship existing between every two continuous entities in the text to be processed can be determined based on the feature representations subsequently.
S203: and inputting the characteristic representation of the target entity combination into the parallel relation judgment model to obtain a judgment result of whether the target entity combination is in the parallel relation.
The parallel relation judgment model is used for judging whether parallel relation exists in the target entity combination according to the input characteristic representation of the target entity combination, namely judging whether parallel relation exists between two entities in the target entity combination.
In the embodiment of the present application, the model type of the parallel relationship determination model is not limited, and for example, the parallel relationship determination model may be any binary model (e.g., a logistic regression model).
For ease of understanding and explanation of S203, the following description is made with reference to an example.
Supposing that the parallel relation judgment model is a pre-trained logistic regression model; the sample to be processed comprises a 1 st entity combination and an Nth entity combination, and the characteristics of the 1 st entity combination are represented as
Figure BDA0002334702530000081
Characteristic for the 2 nd entity combination is denoted as +>
Figure BDA0002334702530000082
Characteristic of the Nth entity combination is denoted as +>
Figure BDA0002334702530000083
Figure BDA0002334702530000084
Wherein m represents the number of eigenvalues included in the feature representation of each entity combination.
As an example, based on the above assumptions, S203 may specifically be: respectively inputting the feature representation of the 1 st entity combination to the feature representation of the Nth entity combination into a previously trained logistic regression model to obtain a judgment result of whether the 1 st entity combination output by the logistic regression model is in a parallel relationship, a judgment result of whether the 2 nd entity combination is in a parallel relationship, \8230, and a judgment result of whether the Nth entity combination is in a parallel relationship.
The logistic regression model can generate the judgment result by using the formulas (1) to (3).
Figure BDA0002334702530000085
Figure BDA0002334702530000086
Figure BDA0002334702530000087
In the formula,
Figure BDA0002334702530000088
Representing the ith entity combination at the ith weight parameter theta i A lower regression value; theta.theta. i Represents an ith weight parameter corresponding to an ith entity combination and +>
Figure BDA0002334702530000089
x i A characteristic representation representing the i-th entity combination, and->
Figure BDA00023347025300000810
Figure BDA00023347025300000811
P(y=1|x ii ) Representing the probability of the existence of the parallel relation in the ith entity group; p (y =0 calucing x) ii ) Indicating the probability that no parallel relationship exists in the ith entity group.
In addition, the embodiment of the present application further provides a training process of the parallel relation judgment model, and the specific implementation manner is referred to below.
S204: and inputting the characteristic representation of the target entity combination into the dependency relationship judgment model to obtain a judgment result of whether the target entity combination is a dependency relationship.
The dependency relationship determination model is used for determining whether dependency relationship exists in the target entity combination according to the input feature representation of the target entity combination, that is, determining whether dependency relationship exists between two entities in the target entity combination.
In addition, the embodiment of the present application does not limit the model type of the dependency relationship determination model, for example, the dependency relationship determination model may be any binary classification model (such as a logistic regression model). When the dependency relationship determination model is a previously trained logistic regression model, the dependency relationship determination model may be implemented by the logistic regression model provided in S203, and only the "parallel relationship" in the implementation of the logistic regression model provided in S203 needs to be replaced by the "dependency relationship".
In addition, the embodiment of the present application further provides a training process of the dependency relationship determination model, and please refer to the following detailed description.
It should be noted that the execution sequence of S203 and S204 is not limited in the embodiment of the present application, and the execution sequence may be set according to an application scenario.
S205: and if the first entity and the second entity have a parallel relationship and the first entity and the third entity have an affiliation, determining that the second entity and the third entity have an affiliation, wherein the first entity and the second entity are two continuous entities in the text to be processed, and the first entity and the third entity are two continuous entities in the text to be processed.
It should be noted that two consecutive entities refer to two entities between which no other entity exists. For example, as shown in fig. 3, since there is no entity between the entity "thirst" and the entity "polydipsia", the entity "thirst" and the entity "polydipsia" are determined to be two consecutive entities; however, since there is an entity "polydipsia" between an entity "thirst" and an entity "none," it is determined that an entity "thirst" and an entity "none" are not two consecutive entities.
In the embodiment of the present application, the output result of the parallel relationship judgment model and the output result of the dependency relationship judgment model may be comprehensively utilized to determine the dependency relationship between the entities, which specifically includes: and if the first entity and the second entity have a parallel relationship and the first entity and the third entity have an affiliation, determining that the second entity and the third entity have an affiliation. It should be noted that, the embodiment of the present application does not limit the relative position of the first entity and the second entity, and specifically includes: the position of the second entity in the text to be processed may be before or after the position of the first entity.
For ease of understanding and explanation of S205, the following description is divided into cases.
The first condition is as follows: when the first entity and the second entity have a parallel relationship and the third entity is subordinate to the first entity, the third entity is determined to be subordinate to the second entity.
To facilitate understanding of case one, the following description is made in conjunction with two examples.
As a first example, assume that the text to be processed is "intermittent dizziness and chest distress for 2 days with running nose", the first entity is "chest distress", the second entity is "dizziness", and the third entity is "2 days". Based on this assumption, when there is a side-by-side relationship between the first entity "chest stuffiness" and the second entity "dizziness", and the third entity "2 days" is subordinate to the first entity "chest stuffiness", it is determined that the third entity "2 days" is subordinate to the second entity "dizziness". In addition, the second entity is located forward of the first entity in the first example.
As a second example, assume that the text to be processed is "intermittent dizziness and chest distress for 2 days with running nose", the first entity is "dizziness", the second entity is "chest distress", and the third entity is "intermittent". Based on the assumption, when the first entity dizziness and the second entity chest distress are in a parallel relationship, and the third entity discontinuity depends on the first entity dizziness, the third entity discontinuity is determined to depend on the second entity chest distress. In addition, the second entity is located behind the first entity in the second example.
Case two: when the first entity and the second entity have a parallel relationship and the first entity is subordinate to the third entity, the second entity is determined to be subordinate to the third entity.
To facilitate understanding of case two, the following description is made with reference to two examples.
As a first example, assume that the text to be processed is "2-day intermittent dizziness with chest stuffiness with running nose", the first entity is "intermittent", the second entity is "2-day", and the third entity is "dizziness". Based on the assumption, when the first entity is "intermittence" and the second entity is "2 days" in parallel relationship, and the first entity "intermittence" is subordinate to the third entity "dizziness", it is determined that the second entity "2 days" is subordinate to the third entity "dizziness". In addition, in the first example, the second entity is located forward of the first entity.
As a second example, assume that the text to be processed is "dizziness with chest stuffiness interrupted for 2 days with running nose", the first entity is "interrupted", the second entity is "2 days", and the third entity is "chest stuffiness". Based on this assumption, it can be known that when the first entity is "intermittent" and the second entity is "2 days" in parallel, and the first entity is "intermittent" and is "chest stuffy" in subordinate relationship to the third entity, it is determined that the second entity is "2 days" in subordinate relationship to the third entity. Additionally, in a second example, the second entity is located posterior to the first entity.
S206: and if the first entity and the second entity have a parallel relationship and the first entity and the third entity have a parallel relationship, determining that the second entity and the third entity have a parallel relationship, wherein the first entity and the second entity are two continuous entities in the text to be processed, and the first entity and the third entity are two continuous entities in the text to be processed.
In the embodiment of the present application, the parallel relationship between the entities may be determined only by using the output result of the parallel relationship determination model, which specifically includes: and if the first entity and the second entity have a parallel relationship and the first entity and the third entity have a parallel relationship, determining that the second entity and the third entity have a parallel relationship. For example, assume that the text to be processed is "intermittent dizziness and chest distress nausea for 2 days", the first entity is "chest distress", the second entity is "dizziness", and the third entity is "nausea". Based on the assumption, when the first entity 'chest stuffiness' and the second entity 'dizziness' have a parallel relationship, and the first entity 'chest stuffiness' and the third entity 'nausea' have a parallel relationship, the second entity 'dizziness' and the third entity 'nausea' are determined to have a parallel relationship.
Based on the contents of S201 to S206, it can be known that, in the entity relationship identification method provided in the embodiment of the present application, an entity in a text to be processed and an entity category of the entity in the text to be processed are identified first, and a feature representation of a target entity combination is generated according to feature values and the entity categories of two entities in the target entity combination, where the target entity combination respectively takes two consecutive entities in the text to be processed; inputting the characteristic representation of the target entity combination into a parallel relation judgment model to obtain a judgment result of whether the target entity combination is in a parallel relation, and inputting the characteristic representation of the target entity combination into a subordinate relation judgment model to obtain a judgment result of whether the target entity combination is in a subordinate relation; at this time, if the first entity and the second entity have a parallel relationship and the first entity and the third entity have an affiliation, determining that the second entity and the third entity have an affiliation; and if the first entity and the second entity have a parallel relationship and the first entity and the third entity have a parallel relationship, determining that the second entity and the third entity have a parallel relationship. The first entity and the second entity are two continuous entities in the text to be processed, and the first entity and the third entity are two continuous entities in the text to be processed.
The two continuous entities with the parallel relationship in the text to be processed can share the entity relationship (for example, the parallel relationship or the subordinate relationship), so that after the subordinate relationship corresponding to any one of the two entities is obtained, the entity relationship corresponding to the other one of the two entities can be directly generated according to the subordinate relationship, and also after the parallel relationship corresponding to any one of the two entities is obtained, the entity relationship corresponding to the other one of the two entities can be directly generated according to the parallel relationship, so that the entity relationship (for example, the parallel relationship or the subordinate relationship) hidden in the text to be processed, which is similar to "intermittent dizziness and chest stuffiness for 2 days with watery nasal discharge", can be accurately identified, and the identification accuracy of the entity relationship is improved.
In a possible implementation manner, another implementation manner of the entity relationship identification method is further provided, in this implementation manner, the entity relationship identification method further includes, in addition to the foregoing S201 to S206, S207:
s207: and determining the entity in the text to be processed as a core word or a relation word.
Wherein the relation words are used for representing the attributes of the core words. For example, a core word may refer to an entity whose entity category is "disorder," and a relational word may refer to an entity whose entity category is "duration" or "time interval," or the like.
In addition, the embodiment of the present application further provides an implementation manner for identifying an entity in a text to be processed as a core word or a relation word, and the specific implementation manner is referred to below.
In addition, for the target entity combination, if two entities in the target entity combination are both core words or two entities in the target entity combination are both relation words, it indicates that a parallel relationship may exist between the two entities in the target entity combination, and a dependency relationship may not exist, and at this time, it only needs to use the parallel relationship judgment model to judge whether a parallel relationship exists in the target entity combination, and it is not necessary to use the relationship judgment model to judge whether a dependency relationship exists in the target entity combination; however, if one entity in the target entity combination is the relation word and the other entity is the core word, it indicates that there may be a dependency relationship between the two entities in the target entity combination, and there may not be a parallel relationship. Therefore, the identification efficiency of the entity relationship can be improved.
Based on the above analysis content, when the entity relationship identification method includes S207, S203 may specifically be: and when the two entities in the target entity combination are both core words or the two entities in the target entity combination are both relation words, inputting the characteristic representation of the target entity combination into the parallel relation judgment model to obtain a judgment result of whether the target entity combination is in parallel relation or not. Meanwhile, S204 may specifically be: and when one of the two entities in the target entity combination is a core word and the other one is a relation word, inputting the characteristic representation of the target entity combination into the dependency relationship judgment model to obtain a judgment result of whether the target entity combination is a dependency relationship.
It should be noted that the embodiment of the present application does not limit the execution time of S207, and S207 only needs to be executed before executing S203 or S204. For example, S207 may be performed before S202 is performed (as shown in fig. 4), or may be performed after S202 is performed and before S203 or S204 is performed.
Based on the above-mentioned related contents of S204, S205, and S207, in the embodiment of the present application, after the entities in the text to be processed are identified, it may be determined that each entity in the text to be processed is a core word or a relation word, so that the target entity combination including two core words or the target entity combination including two relation words is only input into the parallel relation determination model for determining the parallel relation, and the target entity combination including one core word and one relation word is only input into the dependency relation determination model for determining the dependency relation, so that each target entity combination only needs to use one model to determine the relation existing between two entities in the target entity combination, and the identification efficiency of the entity relation is improved.
In one possible embodiment, an embodiment of generating a feature representation (i.e., S202) of a target entity combination is provided, which specifically includes the following three steps:
the first step is as follows: and acquiring the characteristic values of the two entities in the target entity combination and the characteristic values of other participles between the two entities in the target entity combination.
Other participles refer to words between two entities in the target entity combination in the text to be processed. For example, when the pending text is "no significant relief of nausea symptoms after vomiting" (as shown in fig. 3), and the target entity combination includes entities "vomiting" and "nausea," then "post" is the other participle between the two entities in the target entity combination.
The second step: and calculating the mean value of the characteristic values of the two entities in the target entity combination and the characteristic values of other participles between the two entities in the target entity combination to serve as a first target characteristic value.
The embodiment of the application can determine the first target characteristic value corresponding to each entity combination in the text to be processed by using a formula (4).
Figure BDA0002334702530000131
In the formula, F i In representing text to be processedA first target characteristic value corresponding to the ith entity combination;
Figure BDA0002334702530000132
a feature value representing one entity in the ith entity combination; />
Figure BDA0002334702530000133
A feature value representing another entity in the ith combination of entities; />
Figure BDA0002334702530000134
Representing a characteristic value of a j word segmentation between two entities in an i entity combination; j is an integer, and j is more than or equal to 1 and less than or equal to M; m represents the total number of other participles between two entities in the ith entity combination, and M is more than or equal to 0; i is an integer and i is less than or equal to N; n represents the total number of entity combinations in the text to be processed.
The third step: and combining the first target characteristic value and labels of the entity categories of the two entities in the target entity combination into the characteristic representation of the target entity combination.
The tags of an entity class of an entity are used to uniquely tag the entity class of the entity. For example, the entity class "symptom" is labeled 1, the entity class "negative word" is labeled 2, \8230; (and so on).
Assume that the first target feature value is [ C ] 1 ,C 2 ,……,C t ]A label for the entity class of one entity in the target entity combination may be added before the first target feature value and a label for the entity class of another entity in the target entity combination may be added after the first target feature value to form the feature representation of the target entity combination. For example, the entity class "symptom" is labeled 1 and the entity class "negation" is labeled 2. Based on this assumption, when the entity category of the first entity in the target entity combination is "symptom" and the entity category of the second entity is "negative word" and the first entity is located earlier in the text to be processed than the second entity, the feature of the target entity combination is represented as [1, C [ ] 1 ,C 2 ,……,C t ,2]。
Based on the content of the three steps, after the entities and the entity categories in the text to be processed are identified, the feature representation of the target entity combination can be generated according to the feature values of the two entities in the target entity combination and the feature values of other participles between the two entities in the target entity combination, so that the feature representation of the target entity combination can accurately represent the relationship feature information existing between the two entities in the target entity combination, and the accuracy of entity relationship identification is improved.
In a possible implementation manner, an embodiment of the present application further provides a training process of a judgmental model of a parallel relationship, as shown in fig. 5, which may specifically be that the training process includes S501 to S503:
s501: and acquiring the entity in the training text and the entity category of the entity in the training text.
S502: and generating the feature representation of the target entity combination to be trained according to the feature values and the entity classes of the two entities in the entity combination to be trained, wherein the target entity combination to be trained respectively takes two continuous entities in the training text.
It should be noted that, the embodiments of the present application also provide an implementation manner of generating a feature representation of a target entity combination to be trained, and please refer to the following specific implementation manner.
S503: and training to generate a parallel relation judgment model by using the feature representation of the target entity combination to be trained and the classification label of whether the target entity combination to be trained is in the parallel relation or not.
In this embodiment of the application, after the feature representation of the target entity combination to be trained is obtained, the feature representation of the target entity combination to be trained may be input to the current parallel relationship judgment model, a prediction parallel relationship classification result output by the current parallel relationship judgment model is obtained, and based on whether the prediction parallel relationship classification result and the classification label corresponding to the target entity combination to be trained are parallel relationships or not, the current parallel relationship judgment model is updated, and the feature representation of the target entity combination to be trained is input to the current parallel relationship judgment model and the subsequent steps are continuously executed until a stop condition is reached, and the current parallel relationship judgment model is used as the trained parallel relationship judgment model. In addition, in order to facilitate understanding of the training process of the parallel relation determination model, the following description is made with reference to an example.
As an example, when the parallel relation determination model is a logistic regression model, the training process of the parallel relation determination model may specifically include the following four steps:
the first step is as follows: and inputting the characteristic representation of the target entity combination to be trained into the logistic regression model to be trained to obtain a prediction parallel relation classification result corresponding to the target entity combination to be trained, which is output by the logistic regression model to be trained.
It should be noted that the logistic regression model to be trained can generate the prediction parallel relation classification result by using formulas (1) to (3).
The second step is that: judging whether a stopping condition is reached, if so, executing a fourth step; if not, executing the third step.
The stopping condition is not limited in the embodiment of the application, for example, the stopping condition may be that a difference between the predicted parallel relationship classification result corresponding to the target entity combination to be trained and the classification label corresponding to the target entity combination to be trained whether being in the parallel relationship is lower than a preset difference threshold, that a change rate of the predicted parallel relationship classification result corresponding to the target entity combination to be trained is lower than a preset change rate threshold, and that the update frequency of the logistic regression model to be trained reaches a preset frequency threshold.
The third step: and updating the logistic regression model to be trained based on the predicted parallel relation classification result corresponding to the target entity combination to be trained and the classification label whether the target entity combination to be trained corresponds to the parallel relation or not, and returning to execute the first step.
The fourth step: and taking the logistic regression model to be trained as a parallel relation judgment model.
The above is a training process of the parallel relation determination model when the parallel relation determination model is the logistic regression model.
Based on the contents in S501 to S503, in the embodiment of the present application, before the parallel relationship determination model is used to determine the parallel relationship of the target entity combination, the parallel relationship determination model may be trained based on the entity in the training text and the entity category of the entity in the training text, so that the trained parallel relationship determination model can more accurately determine whether the target entity combination is a parallel relationship, which is beneficial to improving the accuracy of identifying the entity relationship.
In a possible implementation manner, an embodiment of the present application further provides a process for training a dependency relationship determination model, as shown in fig. 6, which may specifically be that the process includes S601-S603:
s601: and acquiring the entity in the training text and the entity category of the entity in the training text.
S602: and generating the feature representation of the target entity combination to be trained according to the feature values and the entity classes of the two entities in the entity combination to be trained, wherein the target entity combination to be trained respectively takes two continuous entities in the training text.
The content of S602 is the same as that of S502.
S603: and training to generate a dependency relationship judgment model by using the feature representation of the target entity combination to be trained and the classification label whether the target entity combination to be trained corresponds to the dependency relationship.
In the embodiment of the application, after the feature representation of the target entity combination to be trained is obtained, the feature representation of the target entity combination to be trained may be input to the current dependency relationship determination model to obtain a predicted dependency relationship classification result output by the current dependency relationship determination model, and the current dependency relationship determination model is updated based on the predicted dependency relationship classification result and a classification label of whether the target entity combination to be trained is a dependency relationship or not, until a stop condition is reached, and the current dependency relationship determination model is used as the trained dependency relationship determination model.
Based on the contents in S601 to S603, in the embodiment of the present application, before the dependency relationship determination model is used to determine the dependency relationship of the target entity combination, the dependency relationship determination model may be trained based on the entity in the training text and the entity category of the entity in the training text, so that the trained dependency relationship determination model can more accurately determine whether the target entity combination is a dependency relationship, which is beneficial to improving the accuracy of identifying the entity relationship.
In one possible embodiment, an embodiment of generating a feature representation (i.e., S502 or S602) of a target entity combination to be trained is provided, which specifically includes the following three steps:
the first step is as follows: and acquiring the characteristic values of the two entities in the target entity combination to be trained and the characteristic values of other participles between the two entities in the target entity combination to be trained.
Other participles refer to words between two entities in the target entity combination to be trained in the training text.
The second step is that: and calculating the characteristic values of the two entities in the target entity combination to be trained and the mean value of the characteristic values of other participles between the two entities in the target entity combination to be trained to serve as a second target characteristic value.
It should be noted that, when the second target feature value is obtained, the specific implementation manner and the calculation formula used when the first target feature value is obtained may be adopted, and only the specific implementation manner and the "target entity combination" used when the first target feature value is obtained in the calculation formula need to be replaced by the "target entity combination to be trained", and the "text to be processed" needs to be replaced by the "training text", which is not described herein again.
The third step: and combining the second target characteristic value and labels of the entity categories of the two entities in the target entity combination to be trained into the characteristic representation of the target entity combination to be trained.
It should be noted that the feature representation of the target entity combination to be trained is similar to the feature representation of the target entity combination described above, and please refer to the above "feature representation of the target entity combination".
Based on the contents of the three steps, after the entities and the entity categories thereof in the training text are recognized, the feature representation of the target entity combination to be trained can be generated according to the feature values of the two entities in the target entity combination to be trained and the feature values of other participles between the two entities in the target entity combination to be trained, so that the feature representation of the target entity combination to be trained can accurately represent the relationship feature information existing between the two entities in the target entity combination to be trained, and the accuracy of entity relationship recognition can be improved.
In a possible implementation manner, another implementation manner of the entity relationship identification method is further provided, in this implementation manner, in addition to S201 to S207, the entity relationship identification method further includes S208:
s208: and calculating the probability of a second target entity behind the first target entity in the training text as the transition probability of the first target entity to the second target entity, wherein the first target entity is each entity in the training text, and the second target entity is each entity in the training text.
By the probability that a first target entity is followed by a second target entity is meant the probability that the first target entity and the second target entity co-occur for two consecutive entities in the training sample. And the position of the first target entity in the training text is earlier than the position of the second target entity.
The transition probability of a first target entity to a second target entity is used to characterize the likelihood of diversion from the first target entity to the second target entity.
In addition, the embodiment of the present application may utilize a transition matrix M r Representing the transition probability of one entity to another entity in the training text.
Figure BDA0002334702530000161
/>
Wherein, P (l) i ,l j ) Representing the transition probability of the ith entity to the jth entity in the training sample; i is a positive integer, and i is less than or equal to n; j is a positive integer, and j is not more than n; n is the total number of entities in the training text.
Based on the above-mentioned related content of S208, the transition probability from the first target entity to the second target entity may be determined based on the probability that the first target entity is followed by the second target entity in the training text.
In addition, the embodiment of the application also provides another two entity relationship identification methods on the basis of the entity relationship identification method comprising the step S208, so that the other two entity relationship identification methods can determine the core words and the relation words in the text to be processed by adopting different processes. The other two entity relationship identification methods will be described in turn below.
In a possible implementation manner, the embodiment of the present application provides a further implementation manner of the entity relationship identification method based on the entity relationship identification method including S208, in which the entity relationship identification method includes, in addition to S201 to S208, S209 to S211 (as shown in fig. 7):
s209: and calculating a first attribute score of the first target entity according to the transition probability of the first target entity to the second target entity.
The first attribute score is used for representing the possibility that the first target entity belongs to the core word or the relation word; moreover, when the first attribute score of the first target entity is larger, the probability that the first target entity belongs to the core word is more likely to be represented; when the first attribute score of the first target entity is smaller, it indicates that the first target entity has a higher probability of belonging to the related term.
The embodiment of the application can calculate the first attribute score of each entity by using formula (5).
Figure BDA0002334702530000171
In the formula, V represents a set of first attribute scores of all entities in the training text; m is a group of 0 Representing initial probability values of all entities in the training text; m is a group of r Representing the transition probability of one entity to another entity in the training text; d 1 Representation matrix M r The number of multiplications; v. of i First genus representing ith entity in training textA sexual score; i is a positive integer, i is less than or equal to n, and n represents the total number of entities in the training text.
S210: and determining the entity with the first attribute score larger than the first threshold value in the training text as a core word, and adding the core word in the training text to a core word list.
The first threshold may be set in advance according to an application scenario.
In the embodiment of the application, after the first attribute scores of the entities in the training text are obtained, the entities with the first attribute scores exceeding the first threshold value can be determined as the core words, and the core words in the training text are added to the core word list, so that the core word list can include the core words in the training text, and the core words in the text to be processed can be determined by using the core word list in the following process.
S211: and determining the entities with the first attribute scores smaller than a second threshold value in the training texts as the related words, and adding the related words in the training texts to a related word list.
The second threshold value can be preset according to the application scene; the second threshold value is equal to or less than the first threshold value.
In the embodiment of the application, after the first attribute scores of the entities in the training text are obtained, the entities with the first attribute scores lower than the second threshold value can be determined as the relation words, and the relation words in the training text are added to the relation word list, so that the relation word list can include the relation words in the training text, and the relation words in the text to be processed can be determined by using the relation word list in the subsequent process.
Based on the related contents of S209 to S210, the core word list may be used to determine the core word in the text to be processed, and the relation word list may be used to determine the relation word in the text to be processed. In this case, S207 may specifically be: and determining an entity matched with the entity in the core word list in the text to be processed as a core word, and determining an entity matched with the entity in the relation word list in the text to be processed as a relation word.
Based on the above-mentioned S207 and the related contents of S209 to S210, in the entity relationship identification method, a core word list and a relation word list may be generated according to the training text, so that the core word in the text to be processed may be determined by using the generated core word list, and the relation word in the text to be processed may be determined by using the relation word list. The core words and the relation words in the text to be processed can be accurately determined subsequently based on the core word list and the relation word list, and the identification accuracy of the entity relation can be improved.
In another possible implementation, the total number of entities in the training text is larger, so that the transition matrix M formed by the transition probability from the first target entity to the second target entity r Includes a large number of transition probabilities between entities, so that the transition matrix M is based on r Constructed core word list or based on transition matrix M r The constructed relation word lists all need to consume a large amount of time to complete construction. At this time, in order to improve the recognition efficiency of the core words and the relation words in the text to be processed, the transition matrix M may be directly utilized r The core word or the relation word may be determined according to the transition probability corresponding to the partial entities (especially, each entity in the text to be processed).
Based on this, the embodiment of the present application provides another implementation manner of the entity relationship identification method based on the entity relationship identification method including S208, in which the entity relationship identification method includes S201 to S208, where S207 may specifically include the following four steps:
the first step is as follows: and acquiring the transition probability from a third target entity to a fourth target entity from the transition probability from the first target entity to the second target entity, wherein the third target entity is each entity in the text to be processed, and the fourth target entity is each entity in the text to be processed.
In the embodiment of the application, a transition matrix M formed by transition probabilities from a first target entity to a second target entity is obtained r The transition matrix M may then be determined from the entities in the text to be processed r Select the entity transferTransition probabilities of moving to other entities so that each entity can subsequently be determined to belong to a core word or a relation word based on these picked inter-entity transition probabilities.
As an example, when the text to be processed includes the 1 st entity L 1 To the 3 rd entity L 3 Then, the step may specifically be: from the transfer matrix M r Respectively find out the 1 st entity L 1 To the 1 st entity L 1 Transition probability P (L) 1 ,L 1 ) 1 st entity L 1 To the 2 nd entity L 2 Transition probability P (L) 1 ,L 2 ) 1 st entity L 1 To the 3 rd entity L 3 Transition probability P (L) 1 ,L 3 ) 2 nd entity L 2 To the 1 st entity L 1 Transition probability P (L) 2 ,L 1 ) 2 nd entity L 2 To the 2 nd entity L 2 Transition probability P (L) 2 ,L 2 ) 2 nd entity L 2 To the 3 rd entity L 3 Transition probability P (L) 2 ,L 3 ) 3 rd entity L 3 To the 1 st entity L 1 Transition probability P (L) 3 ,L 1 ) 3 rd entity L 3 To the 2 nd entity L 2 Transition probability P (L) 3 ,L 2 ) And 3 rd entity L 3 To the 3 rd entity L 3 Transition probability P (L) 3 ,L 3 ) So that the transition probability matrix corresponding to the text to be processed can be generated based on the found probability values
Figure BDA0002334702530000191
And which matrix +>
Figure BDA0002334702530000192
Comprises the following steps:
Figure BDA0002334702530000193
the second step is that: and calculating a second attribute score of the third target entity according to the transition probability from the third target entity to the fourth target entity.
The second attribute score of the third target entity is used for representing the possibility that the third target entity belongs to the core word or the relation word; moreover, when the second attribute score of the third target entity is larger, it indicates that the third target entity has a higher possibility of belonging to the core word; when the second attribute score of the third target entity is smaller, it indicates that the second target entity has a higher probability of belonging to the related term.
The embodiment of the application can calculate the first attribute score of each entity by using formula (6).
Figure BDA0002334702530000194
In the formula, V s A set of second attribute scores representing entities in the text to be processed;
Figure BDA0002334702530000195
representing initial probability values of all entities in the text to be processed; />
Figure BDA0002334702530000196
Representing the transition probability of one entity in the text to be processed turning to another entity; d 2 Representing a matrix +>
Figure BDA0002334702530000197
The number of multiplications; />
Figure BDA0002334702530000198
A second attribute score representing an ith entity in the text to be processed; i is a positive integer, and i is not more than n s ,n s Representing the total number of entities in the text to be processed.
The third step: and determining the entity with the second attribute score larger than a third threshold value in the text to be processed as the core word.
The third threshold may be set in advance according to an application scenario.
The fourth step: and determining the entities with the second attribute scores smaller than a fourth threshold value in the text to be processed as the related words.
The fourth threshold may be set in advance according to an application scenario, and the fourth threshold is equal to or less than the third threshold.
Based on the specific implementation manner of S207, it can be known that in the embodiment of the present application, the transition matrix M including the transition probability of each entity in the training text is obtained r Thereafter, the matrix M may be transferred first r The transition probability of any entity in the text to be processed transferring to other entities is selected, then the second attribute score of any entity in the text to be processed is calculated based on the selected transition probability and a formula (6), so that the entity with the second attribute score larger than a third threshold value in the text to be processed is determined as a core word, and the entity with the second attribute score smaller than a fourth threshold value in the text to be processed is determined as a relation word. Wherein, the transition probability matrix corresponding to the text to be processed
Figure BDA0002334702530000201
Is much smaller than the transfer matrix M corresponding to the training text r Based on equation (6) and the corresponding transition probability matrix +>
Figure BDA0002334702530000202
Determining core words or relation words in the text to be processed without a transfer matrix M corresponding to the training text r And a core word list and a relation word list are constructed, so that the recognition efficiency of the core words and the relation words in the text to be processed can be improved, and the recognition efficiency of the entity relation can be improved.
Based on the entity relationship identification method provided by the above method embodiment, the embodiment of the present application further provides an entity relationship identification device, which will be described below with reference to the accompanying drawings.
Referring to fig. 8, this figure is a schematic structural diagram of an entity relationship identification apparatus according to an embodiment of the present application. As shown in fig. 8, the entity relationship identifying apparatus includes:
an entity identifying unit 801, configured to identify an entity in a text to be processed and an entity category of the entity in the text to be processed;
a feature generation unit 802, configured to generate a feature representation of a target entity combination according to feature values and entity categories of two entities in the target entity combination, where the target entity combination respectively takes two consecutive entities in the text to be processed;
a parallel judgment unit 803, configured to input the feature representation of the target entity combination into a parallel relationship judgment model, and obtain a judgment result of whether the target entity combination is in a parallel relationship;
a subordinate judgment unit 804, configured to input the feature representation of the target entity combination into a subordinate relationship judgment model, and obtain a judgment result of whether the target entity combination is a subordinate relationship;
a relationship determining unit 805, configured to determine that the subordinate relationship exists between the second entity and the third entity if the parallel relationship exists between the first entity and the second entity and the subordinate relationship exists between the first entity and the third entity, and determine that the parallel relationship exists between the second entity and the third entity if the parallel relationship exists between the first entity and the second entity and the parallel relationship exists between the first entity and the third entity, where the first entity and the second entity are two consecutive entities in the text to be processed, and the first entity and the third entity are two consecutive entities in the text to be processed.
In a possible implementation manner of the embodiment of the present application, the apparatus further includes:
the word class determining unit is used for determining that an entity in the text to be processed is a core word or a relation word, and the relation word is used for representing the attribute of the core word;
the parallel judgment unit 803 is specifically configured to: when both entities in the target entity combination are the core words or both entities in the target entity combination are the relation words, inputting the characteristic representation of the target entity combination into a parallel relation judgment model to obtain a judgment result of whether the target entity combination is in a parallel relation;
the slave determining unit 804 is specifically configured to: and when one of the two entities in the target entity combination is the core word and the other one is the relation word, inputting the characteristic representation of the target entity combination into an affiliation judgment model to obtain a judgment result of whether the target entity combination is an affiliation.
In a possible implementation manner of the embodiment of the present application, the feature generation unit 802 includes:
the characteristic value determining subunit is used for acquiring characteristic values of two entities in a target entity combination and characteristic values of other participles between the two entities in the target entity combination;
a mean value calculating subunit, configured to calculate a mean value of feature values of two entities in the target entity combination and feature values of other participles between the two entities in the target entity combination, as a first target feature value;
and the characteristic determining subunit is used for combining the first target characteristic value and the labels of the entity categories of the two entities in the target entity combination into a characteristic representation of the target entity combination.
In a possible implementation manner of the embodiment of the present application, a training process of the parallel relation determination model includes:
acquiring an entity in a training text and an entity category of the entity in the training text;
generating a feature representation of the target entity combination to be trained according to the feature values and entity categories of two entities in the entity combination to be trained, wherein the target entity combination to be trained respectively takes two continuous entities in the training text;
and training to generate a parallel relation judgment model by using the feature representation of the target entity combination to be trained and the classification label whether the target entity combination to be trained corresponds to the parallel relation or not.
In a possible implementation manner of the embodiment of the present application, a training process of the dependency relationship determination model includes:
acquiring an entity in a training text and an entity category of the entity in the training text;
generating a feature representation of the target entity combination to be trained according to the feature values and entity categories of two entities in the entity combination to be trained, wherein the target entity combination to be trained respectively takes two continuous entities in the training text;
and training to generate a dependency relationship judgment model by using the feature representation of the target entity combination to be trained and the classification label whether the target entity combination to be trained corresponds to the dependency relationship.
In a possible implementation manner of the embodiment of the present application, the generating a feature representation of the target entity combination to be trained according to feature values and entity categories of two entities in the entity combination to be trained includes:
acquiring characteristic values of two entities in an entity combination to be trained and characteristic values of other participles between the two entities in the entity combination to be trained;
calculating the characteristic values of the two entities in the entity combination to be trained and the mean value of the characteristic values of other participles between the two entities in the entity combination to be trained to serve as a second target characteristic value;
and combining the second target characteristic value and labels of entity categories of two entities in the entity combination to be trained into the characteristic representation of the entity combination to be trained.
In a possible implementation manner of the embodiment of the present application, the apparatus further includes:
and a probability calculating unit, configured to calculate a probability that a first target entity in a training text is a second target entity after the first target entity, as a transition probability from the first target entity to the second target entity, where the first target entity is each entity in the training text, and the second target entity is each entity in the training text.
In a possible implementation manner of the embodiment of the present application, the apparatus further includes:
the score calculation unit is used for calculating a first attribute score of the first target entity according to the transition probability of the first target entity to the second target entity;
the first generating unit is used for determining the entity with the first attribute score larger than a first threshold value in the training text as a core word and adding the core word in the training text to a core word list;
a second generating unit, configured to determine, as a related word, an entity in the training text whose first attribute score is smaller than a second threshold, and add the related word in the training text to a related word list; wherein the second threshold is less than or equal to the first threshold;
the part of speech determining unit includes:
the first matching subunit is used for determining an entity matched with the entity in the core word list in the text to be processed as a core word;
and the second matching subunit is used for determining an entity matched with the entity in the relation word list in the text to be processed as the relation word.
In a possible implementation manner of the embodiment of the present application, the part of speech determining unit includes:
a probability calculation subunit, configured to obtain, from transition probabilities of the first target entity to the second target entity, transition probabilities of a third target entity to a fourth target entity, where the third target entity is each entity in the text to be processed, and the fourth target entity is each entity in the text to be processed;
the score calculating subunit is configured to calculate a second attribute score of the third target entity according to a transition probability of the third target entity to the fourth target entity;
the first determining subunit is configured to determine, as a core word, an entity in the text to be processed, for which the second attribute score is greater than a third threshold;
the second determining subunit is configured to determine, as a related word, an entity in the text to be processed, for which the second attribute score is smaller than a fourth threshold; wherein the fourth threshold is less than or equal to the third threshold.
In addition, this application embodiment also provides a text information screening device, includes: the entity relationship identification method comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein when the processor executes the computer program, any implementation mode of the entity relationship identification method is realized.
In addition, an embodiment of the present application further provides a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, and when the instructions are run on a terminal device, the terminal device is caused to execute any implementation of the entity relationship identification method according to the foregoing embodiment.
It should be noted that, in the present specification, the embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other. For the system or the device disclosed by the embodiment, the description is simple because the system or the device corresponds to the method disclosed by the embodiment, and the relevant points can be referred to the method part for description.
It should be understood that in the present application, "at least one" means one or more, "a plurality" means two or more. "and/or" for describing an association relationship of associated objects, indicating that there may be three relationships, e.g., "a and/or B" may indicate: only A, only B and both A and B are present, wherein A and B may be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of single item(s) or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
It is further noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (12)

1. An entity relationship identification method, characterized in that the method comprises:
identifying entities in a text to be processed and entity categories of the entities in the text to be processed;
generating a feature representation of a target entity combination according to feature values and entity categories of two entities in the target entity combination, wherein the target entity combination respectively takes two continuous entities in the text to be processed;
inputting the characteristic representation of the target entity combination into a parallel relation judgment model to obtain a judgment result of whether the target entity combination is in a parallel relation;
inputting the characteristic representation of the target entity combination into a dependency relationship judgment model to obtain a judgment result of whether the target entity combination is a dependency relationship;
if the first entity and the second entity have the parallel relationship and the first entity and the third entity have the subordination relationship, determining that the second entity and the third entity have the subordination relationship, and if the first entity and the second entity have the parallel relationship and the first entity and the third entity have the parallel relationship, determining that the second entity and the third entity have the parallel relationship, wherein the first entity and the second entity are two continuous entities in the text to be processed, and the first entity and the third entity are two continuous entities in the text to be processed.
2. The method of claim 1, further comprising:
determining that an entity in the text to be processed is a core word or a relation word, wherein the relation word is used for representing the attribute of the core word;
inputting the characteristic representation of the target entity combination into a parallel relation judgment model to obtain a judgment result of whether the target entity combination is in a parallel relation or not, wherein the judgment result comprises the following steps:
when both entities in the target entity combination are the core words or both entities in the target entity combination are the relation words, inputting the feature representation of the target entity combination into a parallel relation judgment model to obtain a judgment result of whether the target entity combination is in a parallel relation or not;
the step of inputting the characteristic representation of the target entity combination into a dependency relationship judgment model to obtain a judgment result of whether the target entity combination is a dependency relationship includes:
and when one of the two entities in the target entity combination is the core word and the other one is the relation word, inputting the characteristic representation of the target entity combination into an affiliation judgment model to obtain a judgment result of whether the target entity combination is an affiliation.
3. The method according to claim 1 or 2, wherein the generating the feature representation of the target entity combination according to the feature values and the entity classes of the two entities in the target entity combination comprises:
obtaining characteristic values of two entities in a target entity combination and characteristic values of other participles between the two entities in the target entity combination;
calculating the characteristic values of the two entities in the target entity combination and the mean value of the characteristic values of other participles between the two entities in the target entity combination to serve as a first target characteristic value;
and combining the first target characteristic value and labels of entity categories of two entities in the target entity combination into a characteristic representation of the target entity combination.
4. The method according to claim 1, wherein the training process of the parallel relation judgment model comprises:
acquiring an entity in a training text and an entity category of the entity in the training text;
generating a feature representation of the target entity combination to be trained according to the feature values and entity categories of two entities in the entity combination to be trained, wherein the target entity combination to be trained respectively takes two continuous entities in the training text;
and training to generate a parallel relation judgment model by using the feature representation of the target entity combination to be trained and the classification label whether the target entity combination to be trained corresponds to the parallel relation or not.
5. The method of claim 1, wherein the process of training the dependency judgment model comprises:
acquiring an entity in a training text and an entity category of the entity in the training text;
generating a feature representation of the target entity combination to be trained according to the feature values and entity categories of two entities in the entity combination to be trained, wherein the target entity combination to be trained respectively takes two continuous entities in the training text;
and training to generate a dependency relationship judgment model by using the feature representation of the target entity combination to be trained and the classification label of whether the target entity combination to be trained corresponds to the dependency relationship.
6. The method according to claim 4 or 5, wherein the generating the feature representation of the target entity combination to be trained according to the feature values and the entity classes of two entities in the entity combination to be trained comprises:
acquiring characteristic values of two entities in an entity combination to be trained and characteristic values of other participles between the two entities in the entity combination to be trained;
calculating the characteristic values of the two entities in the entity combination to be trained and the mean value of the characteristic values of other participles between the two entities in the entity combination to be trained to serve as a second target characteristic value;
and combining the second target characteristic value and labels of entity categories of two entities in the entity combination to be trained into a characteristic representation of the entity combination to be trained.
7. The method of claim 2, further comprising:
calculating the probability of a second target entity behind a first target entity in a training text as the transition probability of the first target entity to the second target entity, wherein the first target entity is each entity in the training text, and the second target entity is each entity in the training text.
8. The method of claim 7, further comprising:
calculating a first attribute score of the first target entity according to the transition probability of the first target entity to the second target entity;
determining the entity with the first attribute score larger than a first threshold value in the training text as a core word, and adding the core word in the training text to a core word list;
determining the entity with the first attribute score smaller than a second threshold value in the training text as a relation word, and adding the relation word in the training text to a relation word list; wherein the second threshold is less than or equal to the first threshold;
the determining that the entity in the text to be processed is a core word or a relation word includes:
determining an entity matched with the entity in the core word list in the text to be processed as a core word;
and determining the entity matched with the entity in the relation word list in the text to be processed as the relation word.
9. The method of claim 7, wherein the determining that the entity in the text to be processed is a core word or a relation word comprises:
obtaining transition probabilities from a third target entity to a fourth target entity from transition probabilities from the first target entity to the second target entity, where the third target entity is each entity in the text to be processed, and the fourth target entity is each entity in the text to be processed;
calculating a second attribute score of the third target entity according to the transition probability of the third target entity to the fourth target entity;
determining the entity with the second attribute score larger than a third threshold value in the text to be processed as a core word;
determining the entities with the second attribute scores smaller than a fourth threshold value in the text to be processed as related words; wherein the fourth threshold is less than or equal to the third threshold.
10. An entity relationship identification apparatus, the apparatus comprising:
the entity identification unit is used for identifying entities in the text to be processed and entity categories of the entities in the text to be processed;
the feature generation unit is used for generating feature representation of the target entity combination according to feature values and entity categories of two entities in the target entity combination, and the target entity combination respectively takes two continuous entities in the text to be processed;
the parallel judgment unit is used for inputting the characteristic representation of the target entity combination into a parallel relation judgment model to obtain a judgment result of whether the target entity combination is in a parallel relation;
the subordinate judgment unit is used for inputting the characteristic representation of the target entity combination into a subordinate relation judgment model to obtain a judgment result of whether the target entity combination is subordinate relation;
a relationship determining unit, configured to determine that the subordinate relationship exists between the second entity and the third entity if the parallel relationship exists between the first entity and the second entity and the subordinate relationship exists between the first entity and the third entity, determine that the parallel relationship exists between the second entity and the third entity if the parallel relationship exists between the first entity and the second entity and the parallel relationship exists between the first entity and the third entity, where the first entity and the second entity are two consecutive entities in the text to be processed and the first entity and the third entity are two consecutive entities in the text to be processed.
11. An entity relationship identification device, comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the entity relationship identification method as claimed in any one of claims 1 to 9 when executing the computer program.
12. A computer-readable storage medium having stored therein instructions that, when run on a terminal device, cause the terminal device to perform the entity relationship identification method of any one of claims 1-9.
CN201911351183.0A 2019-12-24 2019-12-24 Entity relationship identification method, device and equipment Active CN111125377B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911351183.0A CN111125377B (en) 2019-12-24 2019-12-24 Entity relationship identification method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911351183.0A CN111125377B (en) 2019-12-24 2019-12-24 Entity relationship identification method, device and equipment

Publications (2)

Publication Number Publication Date
CN111125377A CN111125377A (en) 2020-05-08
CN111125377B true CN111125377B (en) 2023-04-07

Family

ID=70502094

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911351183.0A Active CN111125377B (en) 2019-12-24 2019-12-24 Entity relationship identification method, device and equipment

Country Status (1)

Country Link
CN (1) CN111125377B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109582975A (en) * 2019-01-31 2019-04-05 北京嘉和美康信息技术有限公司 It is a kind of name entity recognition methods and device
CN110427623A (en) * 2019-07-24 2019-11-08 深圳追一科技有限公司 Semi-structured document Knowledge Extraction Method, device, electronic equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109582975A (en) * 2019-01-31 2019-04-05 北京嘉和美康信息技术有限公司 It is a kind of name entity recognition methods and device
CN110427623A (en) * 2019-07-24 2019-11-08 深圳追一科技有限公司 Semi-structured document Knowledge Extraction Method, device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN111125377A (en) 2020-05-08

Similar Documents

Publication Publication Date Title
CN109582949B (en) Event element extraction method and device, computing equipment and storage medium
CN110580335B (en) User intention determining method and device
US20200302118A1 (en) Korean Named-Entity Recognition Method Based on Maximum Entropy Model and Neural Network Model
US20150095017A1 (en) System and method for learning word embeddings using neural language models
CN112164391A (en) Statement processing method and device, electronic equipment and storage medium
CN109522412B (en) Text emotion analysis method, device and medium
CN106547875B (en) Microblog online emergency detection method based on emotion analysis and label
CN111522915A (en) Extraction method, device and equipment of Chinese event and storage medium
CN110990532A (en) Method and device for processing text
US11669740B2 (en) Graph-based labeling rule augmentation for weakly supervised training of machine-learning-based named entity recognition
CN112926308B (en) Method, device, equipment, storage medium and program product for matching text
CN113326702B (en) Semantic recognition method, semantic recognition device, electronic equipment and storage medium
CN114218945A (en) Entity identification method, device, server and storage medium
US10331789B2 (en) Semantic analysis apparatus, method, and non-transitory computer readable storage medium thereof
CN113282754A (en) Public opinion detection method, device, equipment and storage medium for news events
CN112699685A (en) Named entity recognition method based on label-guided word fusion
CN111125377B (en) Entity relationship identification method, device and equipment
CN107729509B (en) Discourse similarity determination method based on recessive high-dimensional distributed feature representation
WO2023173554A1 (en) Inappropriate agent language identification method and apparatus, electronic device and storage medium
Sun Research on product attribute extraction and classification method for online review
Majumder et al. Event extraction from biomedical text using crf and genetic algorithm
CN112988699B (en) Model training method, and data label generation method and device
Devkota et al. Knowledge of the ancestors: Intelligent ontology-aware annotation of biological literature using semantic similarity
JP2021163477A (en) Method, apparatus, electronic device, computer-readable storage medium, and computer program for image processing
CN111382247A (en) Content pushing optimization method, content pushing optimization device and electronic equipment

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
GR01 Patent grant
GR01 Patent grant