Text processing method and device based on ambiguous entity words
AssigneeBeijing Baidu Netcom Science Technology Co., Ltd.
InventorsZhifan Feng, Chao Lu, Yong Zhu, Ying Li
Life of this patent
Estimating the term…
Abstract
The present disclosure provides a text processing method and device based on ambiguous entity words. The method includes: obtaining a context of a text to be disambiguated and at least two candidate entities represented by the text to be disambiguated; generating a semantic vector of the context based on a trained word vector model; generating a first entity vector of each of the at least two candidate entities based on a trained unsupervised neural network model; determining a similarity between the context and each candidate entity; and determining a target entity represented by the text to be disambiguated in the context.
Claims14
A text processing method based on ambiguous entity words, comprising:
- obtaining a context of a text to be disambiguated and at least two candidate entities represented by the text to be disambiguated, wherein the at least two candidate entities have different semantics;
- generating a semantic vector of the context based on a trained word vector model;
- generating a first entity vector of each of the at least two candidate entities based on a trained unsupervised neural network model, wherein text semantics of respective entities and a relationship between respective entities have been learned by the unsupervised neural network model;
- determining a similarity between the context and each candidate entity according to the semantic vector of the context and the first entity vector of each of the at least two candidate entities;
- and
- determining a target entity represented by the text to be disambiguated in the context from the at least two candidate entities according to the similarity between the context and each candidate entity,
- wherein the unsupervised neural network model in which the text semantics of respective entities and the relationship between respective entities have been learned is obtained by the following steps:
- inputting a semantic vector corresponding to a text of each entity in a preset knowledge base to a trained supervised neural network model, to generate a second entity vector of the entity, wherein semantics of respective entities have been learned by the supervised neural network model, and the second entity vector of the entity is an entity semantic vector that has learned the semantic of the entity;
- initializing a first entity vector of each entity output by the unsupervised neural network model based on the second entity vector of the entity in the preset knowledge base;
- and
- training the initialized unsupervised neural network model based on an association relationship between respective entities,
- wherein, the determining the similarity between the context and each candidate entity according to the semantic vector of the context and the first entity vector of each of the at least two candidate entities comprises:
- inputting the semantic vector of the context to the unsupervised neural network model, to obtain the first entity vector corresponding to the context, so as to calculate the similarity between the first entity vector corresponding to the context and the first entity vectors corresponding to the at least two candidate entities in a same vector space,
- wherein generating a semantic vector of the context based on a trained word vector model comprises:
- inputting the context of the text to be disambiguated to the trained word vector model to obtain a semantic vector corresponding to each word in the context of the text to be disambiguated,
- wherein initializing the first entity vector of each entity output by the unsupervised neural network model based on the second entity vector of the entity in the preset knowledge base comprises:
- inputting each entity in the knowledge base to an untrained unsupervised neural network model to generate an initial first entity vector corresponding to the entity, wherein the initial first entity vector is a random number sequence generated randomly;
- and
- replacing the initial first entity vector of each entity output from the unsupervised neural network model by the second entity vector corresponding to the entity output from the supervised neural network model,
- wherein training the initialized unsupervised neural network model based on an association relationship between respective entities comprises:
- training the initialized unsupervised neural network model based on entities in the knowledge base that have the association relationship, and/or based on entities in a search log that have a co-occurrence relationship;
- and
- determining that training the unsupervised neural network model is finished when a distance between first entity vectors output by the unsupervised neural network model corresponds to a closeness between entities.
A text processing device based on ambiguous entity words, comprising:
- one or more processors;
- a memory;
- one or more programs, stored in the memory, when executed by the one or more processors, configured to perform following actions:
- obtaining a context of a text to be disambiguated and at least two candidate entities represented by the text to be disambiguated, wherein the at least two candidate entities have different semantics;
- generating a semantic vector of the context based on a trained word vector model;
- generating a first entity vector of each of the at least two candidate entities based on a trained unsupervised neural network model, wherein text semantics of respective entities and a relationship between respective entities have been learned by the unsupervised neural network model;
- determining a similarity between the context and each candidate entity according to the semantic vector of the context and the first entity vector of each of the at least two candidate entities;
- and
- determining a target entity represented by the text to be disambiguated in the context from the at least two candidate entities according to the similarity between the context and each candidate entity,
- wherein the unsupervised neural network model in which the text semantics of respective entities and the relationship between respective entities have been learned is obtained by the following steps:
- inputting a semantic vector corresponding to a text of each entity in a preset knowledge base to a trained supervised neural network model, to generate a second entity vector of the entity, wherein semantics of respective entities have been learned by the supervised neural network model, and the second entity vector of the entity is an entity semantic vector that has learned the semantic of the entity;
- initializing a first entity vector of each entity output by the unsupervised neural network model based on the second entity vector of the entity in the preset knowledge base;
- and
- training the initialized unsupervised neural network model based on an association relationship between respective entities,
- wherein, the determining the similarity between the context and each candidate entity according to the semantic vector of the context and the first entity vector of each of the at least two candidate entities comprises:
- inputting the semantic vector of the context to the unsupervised neural network model, to obtain the first entity vector corresponding to the context, so as to calculate the similarity between the first entity vector corresponding to the context and the first entity vectors corresponding to the at least two candidate entities in a same vector space,
- wherein generating a semantic vector of the context based on a trained word vector model comprises:
- inputting the context of the text to be disambiguated to the trained word vector model to obtain a semantic vector corresponding to each word in the context of the text to be disambiguated,
- wherein initializing the first entity vector of each entity output by the unsupervised neural network model based on the second entity vector of the entity in the preset knowledge base comprises:
- inputting each entity in the knowledge base to an untrained unsupervised neural network model to generate an initial first entity vector corresponding to the entity, wherein the initial first entity vector is a random number sequence generated randomly;
- replacing the initial first entity vector of each entity output from the unsupervised neural network model by the second entity vector corresponding to the entity output from the supervised neural network model,
- wherein training the initialized unsupervised neural network model based on an association relationship between respective entities comprises:
- training the initialized unsupervised neural network model based on entities in the knowledge base that have the association relationship, and/or based on entities in a search log that have a co-occurrence relationship;
- and
- determining that training the unsupervised neural network model is finished when a distance between first entity vectors output by the unsupervised neural network model corresponds to a closeness between entities.
A non-transitory computer readable storage medium, having stored therein computer programs that, when executed by a processor, implements the text processing method based on ambiguous entity words, wherein the method comprising:
- obtaining a context of a text to be disambiguated and at least two candidate entities represented by the text to be disambiguated, wherein the at least two candidate entities have different semantics;
- generating a semantic vector of the context based on a trained word vector model;
- generating a first entity vector of each of the at least two candidate entities based on a trained unsupervised neural network model, wherein text semantics of respective entities and a relationship between respective entities have been learned by the unsupervised neural network model;
- determining a similarity between the context and each candidate entity according to the semantic vector of the context and the first entity vector of each of the at least two candidate entities;
- and
- determining a target entity represented by the text to be disambiguated in the context from the at least two candidate entities according to the similarity between the context and each candidate entity,
- wherein the unsupervised neural network model in which the text semantics of respective entities and the relationship between respective entities have been learned is obtained by the following steps:
- generating a second entity vector of each entity in a preset knowledge base by using a trained supervised neural network model, wherein semantics of respective entities have been learned by the supervised neural network model;
- initializing first entity vectors of respective entities output by the unsupervised neural network model based on the second entity vector of each entity in the preset knowledge base;
- and
- training the initialized unsupervised neural network model based on an association relationship between respective entities,
- wherein, the determining the similarity between the context and each candidate entity according to the semantic vector of the context and the first entity vector of each of the at least two candidate entities comprises:
- inputting the semantic vector of the context to the unsupervised neural network model, to obtain the first entity vector corresponding to the context, so as to calculate the similarity between the first entity vector corresponding to the context and the first entity vectors corresponding to the at least two candidate entities in a same vector space,
- wherein generating a semantic vector of the context based on a trained word vector model comprises:
- inputting the context of the text to be disambiguated to the trained word vector model to obtain a semantic vector corresponding to each word in the context of the text to be disambiguated,
- wherein initializing the first entity vector of each entity output by the unsupervised neural network model based on the second entity vector of the entity in the preset knowledge base comprises:
- inputting each entity in the knowledge base to an untrained unsupervised neural network model to generate an initial first entity vector corresponding to the entity, wherein the initial first entity vector is a random number sequence generated randomly;
- replacing the initial first entity vector of each entity output from the unsupervised neural network model by the second entity vector corresponding to the entity output from the supervised neural network model,
- wherein training the initialized unsupervised neural network model based on an association relationship between respective entities comprises:
- training the initialized unsupervised neural network model based on entities in the knowledge base that have the association relationship, and/or based on entities in a search log that have a co-occurrence relationship;
- and
- determining that training the unsupervised neural network model is finished when a distance between first entity vectors output by the unsupervised neural network model corresponds to a closeness between entities.
Dependencies are inferred from the claim text.