Disclosure of Invention
In order to improve the accuracy of an entity link task, the embodiment of the disclosure provides an entity disambiguation method, an entity disambiguation device, an entity link method, an entity link device, an electronic device, and a storage medium.
In a first aspect, an embodiment of the present disclosure provides an entity disambiguation method, including:
acquiring an entity to be disambiguated in a target text and associated attribute information of the entity to be disambiguated and an associated entity, wherein the associated attribute is a sub-attribute of a key attribute of the entity;
constructing a text description corresponding to each candidate entity of the entity to be disambiguated based on the key attribute information and the associated attribute information of the entity;
and determining a target entity from the candidate entities according to the text description.
In some embodiments, the target text comprises SPO triple text; the obtaining of the entity to be disambiguated in the target text and the associated attribute information of the entity to be disambiguated and the associated entity comprises:
acquiring an entity to be disambiguated and an associated entity associated with the entity to be disambiguated in the SPO triple text;
and determining the associated attribute information of the entity to be disambiguated and the associated entity according to the SPO triple text.
In some embodiments, the constructing a text description corresponding to each candidate entity of the entity to be disambiguated based on the key attribute information and the associated attribute information of the entity includes:
acquiring the key attribute information of each candidate entity in a knowledge base;
constructing a first text corresponding to the candidate entity according to the key attribute information;
and constructing the text description corresponding to the candidate entity according to the first text, the target text and the associated attribute information.
In some embodiments, the obtaining the key attribute information of each candidate entity in the knowledge base includes:
and determining the key attribute information of each candidate entity according to the information of each candidate entity in the knowledge base under the key attribute of a preset category.
In some embodiments, the determining a target entity from the candidate entities according to the textual description includes:
extracting text information of the text description and position information of the entity to be disambiguated in the text description;
according to the text information and the position information, determining the similarity between the candidate entity corresponding to the text description and the entity to be disambiguated;
and determining the target entity from the candidate entities according to the similarity ranking corresponding to each text description.
In some embodiments, the determining a target entity from the candidate entities according to the textual description includes:
inputting each text description into a pre-trained entity disambiguation network, wherein the entity disambiguation network extracts text information of the text description and position information of the entity to be disambiguated in the text description;
the entity disambiguation network determines the similarity between the candidate entity corresponding to the text description and the entity to be disambiguated according to the text information and the position information;
and the entity disambiguation network determines the target entity from the candidate entities according to the similarity ranking corresponding to each text description.
In some embodiments, the process of training the entity disambiguating network comprises the steps of:
acquiring a text sample set; each text sample in the text sample set comprises a text description and label information corresponding to the text description;
inputting the text sample set into an untrained entity disambiguation network to obtain an output result output by the entity disambiguation network;
and adjusting the network parameters of the entity disambiguation network according to the difference between the output result and the label information until a convergence condition is met.
In a second aspect, an embodiment of the present disclosure provides an entity linking method, including:
entity linking is carried out on an entity to be disambiguated in the target text and the target entity; wherein the target entity is obtained according to the entity disambiguation method of any of the embodiments of the first aspect.
In a third aspect, an embodiment of the present disclosure provides an entity disambiguation apparatus, including:
the obtaining module is configured to obtain an entity to be disambiguated in a target text and associated attribute information of the entity to be disambiguated and an associated entity, wherein the associated attribute is a sub-attribute of a key attribute of the entity;
the text construction module is configured to construct a text description corresponding to each candidate entity of the entity to be disambiguated based on the key attribute information of the entity and the associated attribute information;
a determination module configured to determine a target entity from the candidate entities based on the textual description.
In some embodiments, the target text comprises SPO triple text, and the obtaining module is specifically configured to:
acquiring an entity to be disambiguated and an associated entity associated with the entity to be disambiguated in the SPO triple text;
and determining the associated attribute information of the entity to be disambiguated and the associated entity according to the SPO triple text.
In some embodiments, the text construction module is specifically configured to:
acquiring the key attribute information of each candidate entity in a knowledge base;
constructing a first text corresponding to the candidate entity according to the key attribute information;
and constructing the text description corresponding to the candidate entity according to the first text, the target text and the associated attribute information.
In some embodiments, the text construction module is specifically configured to:
and determining the key attribute information of each candidate entity according to the information of each candidate entity in the knowledge base under the key attribute of a preset category.
In some embodiments, the determining module is specifically configured to:
extracting text information of the text description and position information of the entity to be disambiguated in the text description;
according to the text information and the position information, determining the similarity between the candidate entity corresponding to the text description and the entity to be disambiguated;
and determining the target entity from the candidate entities according to the similarity ranking corresponding to each text description.
In some embodiments, the determining module is specifically configured to:
inputting each text description into a pre-trained entity disambiguation network, wherein the entity disambiguation network extracts text information of the text description and position information of the entity to be disambiguated in the text description;
the entity disambiguation network determines the similarity between the candidate entity corresponding to the text description and the entity to be disambiguated according to the text information and the position information;
and the entity disambiguation network determines the target entity from the candidate entities according to the similarity ranking corresponding to each text description.
In some embodiments, the entity disambiguation apparatus of embodiments of the present disclosure further comprises a training module configured to:
acquiring a text sample set; each text sample in the text sample set comprises a text description and label information corresponding to the text description;
inputting the text sample set into an untrained entity disambiguation network to obtain an output result output by the entity disambiguation network;
and adjusting the network parameters of the entity disambiguation network according to the difference between the output result and the label information until a convergence condition is met.
In a fourth aspect, an embodiment of the present disclosure provides an entity linking apparatus, including:
the entity linking module is configured to perform entity linking on the entity to be disambiguated in the target text and the target entity; wherein the target entity is obtained according to the entity disambiguation method of any of the embodiments of the first aspect.
In a fifth aspect, the present disclosure provides an electronic device, including:
a processor; and
a memory storing computer instructions readable by the processor, the processor performing the method according to any of the embodiments of the first and second aspects when the computer instructions are read.
In a sixth aspect, the disclosed embodiments provide a storage medium for storing computer-readable instructions for causing a computer to perform the method according to any one of the embodiments of the first and second aspects.
The entity disambiguation method comprises the steps of obtaining an entity to be disambiguated in a target text and associated attribute information of the entity to be disambiguated and an associated entity, constructing text description corresponding to each candidate entity of the entity to be disambiguated based on key attribute information and the associated attribute information of the entity, and determining the target entity from the candidate entities according to the text description. The embodiment of the disclosure better assists entity disambiguation by combining the associated attribute information between the entity to be tested and the associated entity and utilizing the associated attribute information, thereby improving the accuracy of entity disambiguation.
Detailed Description
The technical solutions of the present disclosure will be described clearly and completely with reference to the accompanying drawings, and it is to be understood that the described embodiments are only some embodiments of the present disclosure, but not all embodiments. All other embodiments, which can be derived by one of ordinary skill in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure. In addition, technical features involved in different embodiments of the present disclosure described below may be combined with each other as long as they do not conflict with each other.
In practical applications, entity linking mainly includes two steps of entity identification and entity disambiguation. Entity identification refers to extracting or identifying entities included in the target text, such as extracting or identifying entities like a person name, a place name, an organization name, a date and time, etc. from the target text.
However, for each entity extracted or identified from the target text, there may be multiple entities of the same name in the knowledge base and each entity of the same name in the knowledge base has a different meaning. For example, for multiple synchronized entities named "high definition" in the knowledge base, it may represent a person's name, and it may also represent the display resolution. Thus, entity disambiguation refers to determining which of the same-name entities in the knowledge base the entity extracted or identified in the target text is.
The important point of the embodiment of the present disclosure is to disambiguate an entity to be disambiguated in a target text, that is, to determine which entity in a knowledge base the displacement refers to when an entity (displacement) to be disambiguated in the target text is identified, and then link the displacement with a correct entity in the knowledge base through entity linking.
In a first aspect, the embodiments of the present disclosure provide an entity disambiguation method, which may be applied to an electronic device such as a server, a computer, or the like, and implement accurate disambiguation on of an entity to be disambiguated in a target text, so that the entity to be disambiguated may be accurately linked to an entity determined in a knowledge base.
As shown in fig. 1, in some embodiments, an entity disambiguation method of examples of the present disclosure includes:
s110, acquiring an entity to be disambiguated in the target text and associated attribute information of the entity to be disambiguated and the associated entity.
It is understood that the repository is a structured semantic database, the basic constituent unit of the repository is an SPO triple, which stores data in the form of Subject Predicate, including Subject (Subject), Predicate (Predicate), and Object (Object), where Subject (S) and Object (O) correspond to different entities, and Predicate (P) represents the existing correlation between entity S and entity O. Thus, in some definitions, an SPO triple may also be defined as "entity (S) -associated attribute-entity (O)". For example, in one example, a certain SPO triplet corresponds to a target text of "xiaoming wife is xiaohong" and its structured data corresponds to "xiaoming-wife-xiaohong".
In the knowledge base field, the subject, the predicate and the object should be understood in a broad sense, and are not limited to the subject-predicate structure in the grammatical structure, but should be understood as the logical relationship between the entities represented by the subject-predicate object structure.
Still taking the target text "a small bright wife is a small red" as an example, in the disclosed embodiment, a given entity to be disambiguated (maintenance) is required. For ease of understanding, the meaning of fragment appearing in the following is defined herein to mean the entity to be disambiguated.
For example, in one example, "minired" is the annotation of the target text. There are several entities with the same name as "Xiaohong" in the knowledge base, such as "basketball player Xiaohong", "office clerk Xiaohong" in a certain city a "," director Xiaohong "in a certain city B, etc. By the method of the embodiment of the disclosure, the comment in the target text is only and accurately pointed to' the basketball player is red.
After determining that the target text "Xiaoming wife is Xiaohong" Mi hong "is an annotation, the entity" Xiaoming "is an associated entity associated with the annotation, and the associated attribute between the two is" wife ".
In addition, in the embodiment of the disclosure, it is considered that the description text of the entity in the knowledge base is generally long, and the information contribution of the entity to various attribute contents of the entity is different. Therefore, in the embodiment of the present disclosure, a keyword table of the entity is predefined, and the keyword table includes a plurality of keyword attributes.
In one example, taking the example that the entity is a human, the key attributes corresponding to the entity may include: gender, age, native place, representative work, social relationship, etc., wherein each sub-attribute corresponds to a corresponding value, such as "gender-male/female", "age-X year", "representative work-" XXX ", etc.
Therefore, for the above example, the "wife of Xiaoming is Xiaohong", wherein the "wife" is one of the various key attributes of Xiaoming and Xiaohong, and represents the association relationship between the two.
It is understood that in S110, for the target text, the opinion of the target text, the associated entity associated with the opinion, and the associated attribute information therebetween can be acquired.
S120, constructing text descriptions corresponding to each candidate entity of the entity to be disambiguated based on the key attribute information and the associated attribute information of the entity.
It is to be appreciated that after determining the ention of the target text, a plurality of candidate entities can be determined from the knowledge base. For example, in the foregoing example, the ention of the target text is "minired", so that a plurality of homonymous entities named "minired", which are candidate entities for the ention, can be determined from the knowledge base.
In addition, based on the foregoing, for each entity in the knowledge base, it includes a plurality of key attributes, each key attribute including corresponding key attribute information. For example, for one of the candidate entities "red", the corresponding key attribute information may be as shown in the following table one:
table one:
thus, for the candidate entity, the respective key attribute information of the candidate entity may be acquired.
It is worth mentioning that the first text corresponding to the candidate entity can be constructed according to the key attribute information of the candidate entity, for example, in the above example, the first text of "Xiaohong" of the candidate entity can be obtained, such as "sex woman, born in 11/20 of 1981, Xiaoming wife, 1996, enter … …".
However, in the embodiment of the present disclosure, the text description of the candidate entity is not constructed only according to the key attribute information of the candidate entity, and meanwhile, the association attribute information between the entity to be disambiguated and the association entity is also combined. That is, in conjunction with the association attribute information "wife" between the entity to be disambiguated "minired" and the associated entity "minig" in the foregoing example, the association attribute information "wife" may be spliced at the beginning of the first text of the candidate entity "minired" and separated by a separation symbol, and together with the foregoing first text, constitute a complete text description of the candidate entity.
In some embodiments, when a text description corresponding to a candidate entity is constructed, a first text may be constructed according to key attribute information of the candidate entity, and the first text, a target text, and associated attribute information are jointly constructed as the text description corresponding to the candidate entity. The following embodiments of the present disclosure will be described in detail, and will not be described in detail here.
And S130, determining a target entity from the candidate entities according to the text description.
Specifically, in S120, the description text corresponding to each candidate entity may be determined, so that the target entity pointed to by the entity to be disambiguated may be determined according to each description text.
In some embodiments, the text descriptions may be input into a pre-trained entity disambiguation network, resulting in a probability corresponding to each text description output by the entity disambiguation network. The probability represents the similarity between the candidate entity corresponding to the text description and the entity to be disambiguated, and the higher the probability is, the more similar the candidate entity and the entity to be disambiguated are represented, so that the target entity with the highest similarity can be determined according to the probability sorting. The following embodiments of the present disclosure will be described in detail, and will not be described in detail here.
Therefore, in the embodiment of the disclosure, when entity disambiguation is performed, not only key attribute information of the entity is focused on, but also associated attribute information between the entity to be tested and the associated entity is combined, and the associated attribute information is utilized to better assist entity disambiguation, so that accuracy of entity disambiguation is improved.
In the embodiment of the present disclosure, based on the foregoing, the basic constituent unit in the knowledge base is an SPO triple, and the text corresponding to the SPO triple is defined as an SPO triple text, that is, the target of the embodiment of the present disclosure is that the text is an SPO triple text. The SPO triple text comprises an entity S, an entity O and associated attribute information P of the entity S and the entity O.
As shown in fig. 2, in some embodiments, in the entity disambiguation method of the example of the present disclosure, the process of acquiring the entity to be disambiguated and the associated attribute information includes:
s210, acquiring the entity to be disambiguated and the associated entity associated with the entity to be disambiguated in the SPO triple text.
S220, determining the associated attribute information of the entity to be disambiguated and the associated entity according to the SPO triple text.
Specifically, still taking the SPO triple text as "wife with little bright is small red" as an example, the SPO triple text includes "entity S-little bright", "entity O-small red", and "key attribute information P-wife".
As can be seen from the foregoing, the method according to the embodiment of the present disclosure is to disambiguate the candidate entity given the fact, that is, in the embodiment of the present disclosure, the fact in the SPO triple text is predetermined. For example, in one example, the entity O "minired" is an annotation of the SPO triple text, and thus the entity S "minibright" is an associated entity of the annotation, and the "wife" in the SPO triple text is associated attribute information between the two entities.
As shown in fig. 3, in some embodiments, in the entity disambiguation method of examples of the present disclosure, the process of constructing a textual description for each candidate entity includes:
s310, obtaining key attribute information of each candidate entity in the knowledge base.
Specifically, as described above, each candidate entity stores a plurality of types of key attribute information in the knowledge base, for example, as shown in one of the tables, so that the key attribute information of each candidate entity can be acquired.
It should be noted that, for a candidate entity, there are multiple kinds of key attribute information, but the information contribution degree of each kind of key attribute information to the candidate entity is different, for example, the information contribution degree of key attributes such as "gender", "age", "occupation", "work", "social relationship" and the like to the entity is high, and the information contribution degree of key attributes such as "educational experience" and the like to the entity is relatively low.
Therefore, in some embodiments of the present disclosure, the key attribute information of each candidate entity in the knowledge base may be determined according to the information of the candidate entity under the key attribute of the preset category. It can be understood that the key attribute of the preset category may be a key attribute of several categories having a large information contribution degree to the entity, so that the data volume may be reduced, and the disambiguation processing efficiency may be improved. Two methods of extracting key attributes of candidate entities are given in the present disclosure:
1) and matching word lists.
A keyword table with a high contribution degree to entity information can be pre-constructed, and the keyword table comprises a plurality of keyword attributes, so that the keyword attribute information of candidate entities corresponding to the keyword attributes can be extracted from a knowledge base.
2) And (6) fragment matching.
The key attribute information of the candidate entity can be retrieved based on the entity to be disambiguated, and if the entity to be disambiguated appears in certain key attribute information, the key attribute information is reserved.
The above description is made on the process of acquiring the key attribute information of one candidate entity, and the process is sequentially repeated for a plurality of candidate entities, so that the key attribute information corresponding to each candidate entity can be acquired.
In some embodiments of the present disclosure, by screening the key attribute information of the candidate entity, the data size of the subsequently constructed text description can be reduced on the basis of ensuring higher accuracy, and the entity disambiguation efficiency is improved.
And S320, constructing a first text corresponding to the candidate entity according to the key attribute information.
In one example, the aforementioned entity to be disambiguated is illustrated as "small red".
The key attribute of one candidate entity "red small" in the knowledge base and the key attribute information corresponding to each key attribute are shown in the above table one, so that the key attribute information of the preset category can be acquired based on the process of S310, and the first text of the candidate entity is constructed according to the acquired key attribute information.
For example, according to each key attribute information in table one, a first text corresponding to the candidate entity "Xiaohong" is constructed as "sex woman, born in 11/20 of 1981, Xiaoming wife, 1996, enter … …".
S330, constructing text description corresponding to the candidate entity according to the first text, the target text and the associated attribute information.
Specifically, as can be seen from the foregoing, in the embodiments of the present disclosure, the first text is not directly used as the text description of the candidate entity, and the association attribute information between the fact and the associated entity is also combined.
Still taking the foregoing as an example, the first text of the candidate entity corresponding to the above table obtained in S320 is "sex woman, born in 11/20 of 1981, xiaoming wife, 1996, enter … …"; the target text is "Xiaoming wife is Xiaohong"; the association attribute information of the comment "Xiaohong" and the association entity "Xiaoming" is "wife".
The first text, the target text and the associated attribute information can be constructed as text descriptions of the candidate entities, and can be separated by a special separator [ SEP ]. For example, in this example, the resulting text is described as:
"wife (SEP) Xiaoming wife is a Xiaohong (SEP) Xiaohong sex woman who is born in 11/20 of 1981, and enters … … in 1996.
While the process of constructing the text description for one of the candidate entities is described above, those skilled in the art will understand that the text description corresponding to each candidate entity can be obtained by sequentially performing the above processes for a plurality of candidate entities in the knowledge base.
Therefore, in the embodiment of the disclosure, when constructing the text description of the candidate entity, the method not only focuses on the key attribute information of the entity, but also combines the associated attribute information between the entity to be tested and the associated entity, so as to facilitate the subsequent utilization of the associated attribute information to better assist in entity disambiguation, thereby improving the accuracy of entity disambiguation.
After the text description corresponding to each candidate entity is determined, the text description can be used as the input of the entity disambiguation network, the similarity between the output candidate entities and the comments is preset by the entity disambiguation network, and then the candidate entity with the highest similarity is determined as the target entity according to the similarity sequence corresponding to each candidate entity.
In the related art, in the field of NLP (Natural Language Processing), the entity disambiguation network for the entity link task may generally adopt a BERT, an ALBERT or an ERNIE network based on a transform architecture.
It is worth noting that in some embodiments of the present disclosure, in order to improve the identification precision of the entity disambiguation network, the entity disambiguation network in the prior art is improved, and the network can better utilize the text context semantic information and improve the network accuracy by fusing the location information of the segmentation.
Specifically, fig. 4 shows a network structure of an entity disambiguation network according to some embodiments of the present disclosure, and in the example of fig. 4, the entity disambiguation network is based on BERT, and the following describes the example of the present disclosure in detail with reference to the network structure of fig. 4.
As shown in fig. 4, an entity disambiguation network of examples of the present disclosure may generally include four modules: vector extraction module 410, BERT processing module 420, full connectivity layer 430, and sort output module 440. The BERT processing module 420 includes a plurality of processing sub-modules, and the structure of each processing sub-module is shown in fig. 5.
Referring to fig. 5, the processing submodule includes a self-attention layer 421, a maintenance attention layer 422, a text coding layer 423, and a feedforward neural network layer 424 in sequence, and normalization and residual connection may be used between the network layers. The comment attention layer 422 is a sublayer newly added in the embodiment of the present disclosure, and can extract position information of a comment through an attention mechanism, so that the network focuses more on context semantic information of the comment position in a text, and the purpose of improving the accuracy of network output is achieved.
Based on the entity disambiguation network structures of fig. 4 and 5, the entity disambiguation method of the embodiment of the present disclosure is specifically described below.
As shown in fig. 6, in some embodiments, in the entity disambiguation method of examples of the present disclosure, the process of determining a target entity from the textual description includes:
s610, extracting text information of the text description and position information of the entity to be disambiguated in the text description.
S620, according to the text information and the position information, determining the similarity between the candidate entity corresponding to the text description and the entity to be disambiguated.
And S630, sequencing according to the similarity corresponding to each text description, and determining a target entity from the candidate entities.
In the disclosed embodiments, the position of the increment in the text description can be specially marked when constructing the text description of the candidate entity.
For example, in the example of fig. 4, the target text takes "a wife of a certain liu is a zhuo (a certain character)" as an example, where the "zhuo (a certain character)" is an entity to be disambiguated, and the first text corresponding to a certain candidate entity in the knowledge base is "a zhuo (a certain character) originated from … …". Therefore, based on the foregoing embodiment of fig. 3, a text description corresponding to the candidate entity can be constructed as follows:
"[ CLS ] wife [ SEP ] Liu certain wife is/Zhu certain/[ SEP ] Zhu certain Sheng from … …"
Where the location of the entity to be disambiguated is shown with the special mark "/".
After obtaining the text description corresponding to the candidate entity, the vector extraction module 410 may extract the text information and the position information of the text description. Specifically, the vector extraction module 410 may extract a word vector (token embedding), a sentence vector (segment embedding), and a position vector (position embedding) of the text description, and finally the input of the BERT processing module is the sum of the word vector, the sentence vector, and the position vector.
The BERT processing module 420 extracts the position information of the entity to be disambiguated based on the newly added mention attention layer 424 according to the input vector containing the text information and the position information and performs fusion processing, thereby sufficiently fusing the context semantics of the position of the mention in the text.
The fully connected layer 430 mainly performs the refinement of the downstream task for different task types, for example, in the example of fig. 4, the fully connected layer 430 may perform text classification according to the output of the BERT processing module 420, and output the prediction probability. It can be understood that the prediction probability represents the similarity between the candidate entity corresponding to the text description and the entity to be disambiguated, and a higher prediction probability represents a higher similarity between the candidate entity and the annotation, and vice versa.
As described above for the processing procedure of one candidate entity, for a plurality of candidate entities, the entity disambiguation network sequentially outputs the similarity corresponding to each candidate entity through the fully-connected layer 430. The ranking output module 440 may rank according to each similarity from high to low, and determine the candidate entity corresponding to the highest similarity as the target entity and output the target entity.
Therefore, in the embodiment of the disclosure, by fusing the position information of the entity to be disambiguated, the network focuses more on the context semantic information of the position of the annotation in the text, and the accuracy of network prediction is improved.
In some embodiments, the entity disambiguation method of the examples of the present disclosure further includes a process of network training the entity disambiguation network described above, which is described in detail below with reference to fig. 7.
As shown in fig. 7, in some embodiments, in the entity disambiguation method of examples of the present disclosure, the training process for the entity disambiguation network includes:
and S710, acquiring a text sample set.
Specifically, the text sample set includes a plurality of text samples, where each text sample includes a text description and tag information corresponding to the text description, and the tag information indicates a true value corresponding to the text sample.
In some embodiments, the text sample data may be obtained from a knowledge base, in which some high-quality rules or manually labeled data are stored, and after data cleaning and processing, the text sample data may be obtained as shown in table two below
Table two:
after data cleaning and processing, the process of the foregoing embodiment may be utilized to construct a text description of each text sample, which is not repeated in this disclosure.
S720, inputting the text sample set into the untrained entity disambiguation network to obtain an output result output by the entity disambiguation network.
Referring to fig. 4 and 5, the network structure of the entity disambiguation network may be obtained by inputting a text sample set into the entity disambiguation network to be trained, and outputting an output result corresponding to each text sample after processing each text sample by the entity disambiguation network.
And S730, adjusting the network parameters of the entity disambiguation network according to the difference between the output result and the label information until a convergence condition is met.
The output result represents the similarity between the candidate entity predicted by the entity disambiguation network to be trained and the comment, and the label information represents the true value of the candidate entity, so that the difference, namely the loss, between the output result and the label information can be obtained according to the output result and the label information. And then adjusting the network parameters of the entity disambiguation network according to the difference feedback, and circularly iterating until the network convergence condition is met. The convergence condition may be set according to specific requirements, for example, when the difference between the output result and the label information satisfies the training requirement, it may be determined that the convergence condition is satisfied, and the network training is stopped to obtain the trained entity disambiguation network.
In the related art, common evaluation indexes for measuring entity disambiguation tasks include precision, call, and f1 indexes. In some embodiments of the present disclosure, the entity disambiguation network of the present disclosure has a precision score of 0.92, a recall score of 0.90, and an f1 score of 0.91 on 20000 test sets, and it can be seen that the entity disambiguation network of embodiments of the present disclosure has a relatively high score, which is expected. Moreover, through further manual evaluation of randomly extracting partial data, the output effect of the entity disambiguation network in the embodiment of the disclosure on 3500 text samples is shown as the accuracy rate of 0.95, and the entity disambiguation network meets the warehousing standard.
It is to be understood that the entity disambiguation network in the above embodiments is based on the BERT network structure, and in other embodiments, the entity disambiguation network may also be any other network structure suitable for implementation, such as ALBERT or ERNIE, and the like, which is not limited by the present disclosure.
Therefore, in the embodiment of the disclosure, the entity disambiguation network enables the network to focus on the context semantic information of the position of the annotation in the text by fusing the position information of the entity to be disambiguated, and the accuracy of network prediction is improved.
In a second aspect, the disclosed embodiments provide an entity linking method. In some embodiments, an entity linking method of an example of the present disclosure includes:
and carrying out entity link on the entity to be disambiguated in the target text and the target entity.
Specifically, as described in any one of the embodiments of the first aspect, the obtained target entity represents an entity of the same entity as the annotation of the target text in the candidate entities of the knowledge base, so that the entity to be disambiguated is linked to the target entity, and the entity link of the entity to be disambiguated is realized.
Therefore, in the embodiment of the disclosure, when entity disambiguation is performed, not only key attribute information of the entity is focused on, but also associated attribute information between the entity to be tested and the associated entity is combined, and the associated attribute information is utilized to better assist entity disambiguation, so that accuracy of entity disambiguation is improved. By fusing the position information of the entity to be disambiguated, the network can focus on the context semantic information of the position of the comment in the text, and the accuracy of network prediction is improved.
In a third aspect, the disclosed embodiments provide an entity disambiguation apparatus. As shown in fig. 8, in some embodiments, an entity disambiguation apparatus of examples of the present disclosure includes:
the obtaining module 810 is configured to obtain an entity to be disambiguated in the target text and associated attribute information of the entity to be disambiguated and an associated entity, wherein the associated attribute is a sub-attribute of a key attribute of the entity;
a text construction module 820 configured to construct a text description corresponding to each candidate entity of the entity to be disambiguated based on the key attribute information and the associated attribute information of the entity;
a determining module 830 configured to determine a target entity from the candidate entities according to the textual description.
Therefore, in the embodiment of the disclosure, when entity disambiguation is performed, not only key attribute information of the entity is focused on, but also associated attribute information between the entity to be tested and the associated entity is combined, and the associated attribute information is utilized to better assist entity disambiguation, so that accuracy of entity disambiguation is improved.
In some embodiments, the target text comprises SPO triple text, and the obtaining module 810 is specifically configured to:
acquiring an entity to be disambiguated and an associated entity associated with the entity to be disambiguated in the SPO triple text;
and determining the association attribute information of the entity to be disambiguated and the associated entity according to the SPO triple text.
In some embodiments, text construction module 820 is specifically configured to:
acquiring key attribute information of each candidate entity in a knowledge base;
constructing a first text corresponding to the candidate entity according to the key attribute information;
and constructing text description corresponding to the candidate entity according to the first text, the target text and the associated attribute information.
In some embodiments, text construction module 820 is specifically configured to:
and determining the key attribute information of the candidate entities according to the information of each candidate entity in the knowledge base under the key attribute of the preset category.
In some embodiments of the present disclosure, by screening the key attribute information of the candidate entity, the data size of the subsequently constructed text description can be reduced on the basis of ensuring higher accuracy, and the entity disambiguation efficiency is improved.
In some embodiments, the determining module 830 is specifically configured to:
extracting text information of the text description and position information of an entity to be disambiguated in the text description;
according to the text information and the position information, determining the similarity between the candidate entity corresponding to the text description and the entity to be disambiguated;
and determining a target entity from the candidate entities according to the similarity ranking corresponding to each text description.
In some embodiments, the determining module 830 is specifically configured to:
inputting each text description into a pre-trained entity disambiguation network, wherein the entity disambiguation network extracts text information of the text description and position information of an entity to be disambiguated in the text description;
the entity disambiguation network determines the similarity between the candidate entity corresponding to the text description and the entity to be disambiguated according to the text information and the position information;
and the entity disambiguation network determines a target entity from the candidate entities according to the similarity ranking corresponding to each text description.
In some embodiments, the entity disambiguation apparatus of embodiments of the present disclosure further comprises a training module configured to:
acquiring a text sample set; each text sample in the text sample set comprises a text description and label information corresponding to the text description;
inputting the text sample set into an untrained entity disambiguation network to obtain an output result output by the entity disambiguation network;
and adjusting the network parameters of the entity disambiguation network according to the difference between the output result and the label information until the convergence condition is met.
In a fourth aspect, an embodiment of the present disclosure provides an entity linking apparatus, including:
the entity linking module is configured to perform entity linking on the entity to be disambiguated in the target text and the target entity; wherein the target entity is obtained according to the entity disambiguation method of any of the embodiments of the first aspect.
In a fifth aspect, the present disclosure provides an electronic device, including:
a processor; and
a memory storing computer instructions readable by a processor, the processor performing a method according to any one of the embodiments of the first and second aspects when the computer instructions are read.
In a sixth aspect, the disclosed embodiments provide a storage medium for storing computer-readable instructions for causing a computer to perform a method according to any one of the embodiments of the first and second aspects.
Specifically, fig. 9 shows a schematic structural diagram of a computer system 600 suitable for implementing the method of the present disclosure, and the corresponding functions of the processor and the storage medium can be implemented by the system shown in fig. 9.
As shown in fig. 9, the computer system 600 includes a processor 601 that can perform various appropriate actions and processes according to a program stored in a memory 602 or a program loaded from a storage section 608 into the memory 602. In the memory 602, various programs and data required for the operation of the system 600 are also stored. The processor 601 and the memory 602 are connected to each other by a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
In particular, the above method processes may be implemented as a computer software program according to embodiments of the present disclosure. For example, embodiments of the present disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for performing the above-described method. In such embodiments, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
It should be understood that the above embodiments are only examples for clearly illustrating the present invention, and are not intended to limit the present invention. Other variations and modifications will be apparent to persons skilled in the art in light of the above description. And are neither required nor exhaustive of all embodiments. And obvious variations or modifications of the present disclosure may be made without departing from the scope of the present disclosure.