CN116028634A - Method and device for constructing entity link, electronic equipment and readable storage medium - Google Patents

Method and device for constructing entity link, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN116028634A
CN116028634A CN202211182929.1A CN202211182929A CN116028634A CN 116028634 A CN116028634 A CN 116028634A CN 202211182929 A CN202211182929 A CN 202211182929A CN 116028634 A CN116028634 A CN 116028634A
Authority
CN
China
Prior art keywords
entity
natural language
information
language question
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.)
Pending
Application number
CN202211182929.1A
Other languages
Chinese (zh)
Inventor
杨春阳
邢启洲
李健
陈明
武卫东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Sinovoice Technology Co Ltd
Original Assignee
Beijing Sinovoice Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Sinovoice Technology Co Ltd filed Critical Beijing Sinovoice Technology Co Ltd
Priority to CN202211182929.1A priority Critical patent/CN116028634A/en
Publication of CN116028634A publication Critical patent/CN116028634A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Machine Translation (AREA)

Abstract

The embodiment of the invention provides a method and a device for constructing an entity link and a readable storage medium, wherein the method comprises the following steps: acquiring a natural language question text; performing entity analysis on the natural language question text to obtain entity information in the natural language question text; based on the entity information, calculating the similarity between the entity in the natural language question text and the entity in the knowledge base to obtain a candidate link result of the natural language question; and screening the candidate link result based on the dependency relationship information of the entity to obtain a final entity link. In the entity linking process, the entity naming entity information and the dependency relationship information in the text are combined, the relation between the entity and the context in the text is enhanced, the accuracy of entity linking is effectively improved, the problems of low accuracy and high recall rate of entity linking are solved, and the accuracy of knowledge graph question-answering is improved.

Description

Method and device for constructing entity link, electronic equipment and readable storage medium
Technical Field
The present invention relates to the field of natural language processing technologies, and in particular, to a method and an apparatus for constructing an entity link, an electronic device, and a readable storage medium.
Background
In recent years, with the development of knowledge graphs, the automatic obtaining of answers to human natural language questions using given knowledge graph data has become a current research hotspot.
In the prior knowledge graph question and answer, the links between the entities are generally established according to the similarity by directly identifying the entities in the question text and then matching with the entities in the knowledge base.
However, in the method of establishing links only by matching the similarity between entities, redundant answers or answers with larger deviation often occur, and the recall rate of the entity links is higher, so that the accuracy of knowledge graph questions and answers is lower.
Disclosure of Invention
The embodiment of the invention provides a method and a device for constructing an entity link, electronic equipment and a readable storage medium, which can solve the problem of higher recall rate of the entity link.
In a first aspect, an embodiment of the present invention provides a method for constructing an entity link, where the method includes:
acquiring a natural language question text;
performing entity analysis on the natural language question text to obtain entity information in the natural language question text; the entity information comprises naming information of an entity and dependency relationship information of the entity;
Based on the entity information, calculating the similarity between the entity in the natural language question text and the entity in the knowledge base to obtain a candidate link result of the natural language question;
and screening the candidate link result based on the dependency relationship information of the entity to obtain a final entity link.
In a second aspect, an embodiment of the present invention provides an apparatus for building an entity link, where the apparatus includes:
the text acquisition module is used for acquiring a natural language question text;
the entity analysis module is used for carrying out entity analysis on the natural language question text to obtain entity information in the natural language question text; the entity information comprises naming information of an entity and dependency relationship information of the entity;
the preliminary link screening module is used for calculating the similarity between the entity in the natural language question text and the entity in the knowledge base based on the entity information to obtain a candidate link result of the natural language question;
and the entity link generation module is used for screening the candidate link result based on the dependency relationship information of the entity to obtain a final entity link.
In a third aspect, an embodiment of the present invention provides an electronic device, including: a processor and a memory, the processor executing a computer program stored in the memory, implementing the method of constructing an entity link as described in the first aspect.
In a fourth aspect, an embodiment of the present invention provides a readable storage medium, where computer instructions are stored, where the computer instructions, when executed by a processor, implement a method for constructing an entity link according to the first aspect.
In a fifth aspect, an embodiment of the present invention further provides a computer program product, including a computer program, where the computer program when executed by a processor implements a method for constructing the entity link.
The embodiment of the invention has the following advantages:
the invention provides an embodiment of a method for constructing an entity link. In the embodiment of the invention, a natural language question text is firstly obtained, then entity analysis is carried out on the natural language question text to obtain entity information in the natural language question text, then the similarity between the entity in the natural language question text and the entity in a knowledge base is calculated based on the entity information to obtain a candidate link result of the natural language question, and the candidate link result is screened based on the dependency relationship information of the entity to obtain a final entity link. According to the entity information, the similarity between the natural language problem text and the entity in the knowledge base is calculated, the entity to be linked is primarily screened based on the calculated similarity, and then the dependency relationship information of the entity is further screened, the entity naming entity information and the dependency relationship information in the text are combined in the entity linking process, so that the relation between the entity in the text and the context is enhanced, the accuracy of entity linking is effectively improved, the problems of low accuracy and high recall error rate of entity linking are solved, and the accuracy of knowledge graph question-answering is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments of the present invention will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of an embodiment of a method of constructing an entity link of the present invention;
FIG. 2 illustrates an embodiment of textual dependency information;
FIG. 3 shows an architecture diagram of a BERT model;
FIG. 4 shows a schematic diagram of an encoder of a transducer model;
FIG. 5 shows a diagram of a named entity model based on BERT-CRF;
FIG. 6 is a block diagram illustrating an embodiment of an apparatus for constructing an entity link in accordance with the present invention;
fig. 7 shows a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention. Moreover, it should be noted that, in the embodiment of the present application, the related processes of obtaining various data are all performed under the premise of conforming to the corresponding data protection rule policy of the country of the location and obtaining the authorization given by the owner of the corresponding device.
In recent years, with the development of knowledge graphs, the automatic obtaining of answers to human natural language questions using given knowledge graph data has become a current research hotspot.
In the prior knowledge graph question and answer, the links between the entities are generally established according to the similarity by directly identifying the entities in the question text and then matching with the entities in the knowledge base.
However, in the method of establishing links only by matching the similarity between entities, redundant answers or answers with larger deviation often occur, and the recall rate of the entity links is higher, so that the accuracy of knowledge graph questions and answers is lower.
In order to solve the problem of low accuracy of knowledge graph questions and answers caused by the entity links, the applicant invents a construction method of the entity links.
Referring to fig. 1, a flowchart of an embodiment of a method for constructing an entity link according to the present invention is shown, where the method may include:
and 101, acquiring a natural language question text.
Natural language generally refers to a language that naturally evolves with culture. In the embodiment of the invention, the natural language question text refers to questions posed by natural language in knowledge graph questions and answers, and is presented in the form of text, for example, when asking what is the nutrition of apples, what is the nutrition of apples belongs to the natural language question text.
The step of acquiring the natural language question text refers to acquiring a text form of a question raised by a user.
102, performing entity analysis on the natural language question text to obtain entity information in the natural language question text; the entity information includes naming information of the entity and dependency information of the entity.
The entities refer to objects which exist objectively and can be distinguished from each other, and the broad sense of the entities is not limited to specific objects such as trees, birds, machines and the like, but can also refer to abstract concepts, links and the like such as courses, teaching, lengths and the like. In embodiments of the present invention, the label designs for an entity can be categorized into the following categories: "small entity", "Guan Jici", "attributed term", "entity category", "condition type", "attribute value", "aggregation function", etc. The "small entity" is distinguished from a broad entity concept, and is a narrow entity concept, and refers to each entity node or target entity in a knowledge base, such as a specific name of a person, a specific name of a place, and the like.
The "entity category" refers to a subject category to which the "small entity" belongs, and meanwhile, the entity category can be understood as an abstract set of similar entities, such as "staff", "product line", etc., for example, "Beijing" is "city", and "city" can be used as the subject (category) to which the entity belongs. The term "relationship" and the term "attribute" refer to the attribute and relationship of the subject, and "Guan Jici" is mainly used for connecting two different entities, such as [ entity 1, guan Jici, entity 2 ]; and "attribute words" are used to connect entities and their corresponding attribute values, e.g., [ entity, 10cm (attribute value), length (attribute word) ]. "Condition type" refers to a shape such as greater than, less than, or equal to those conditional expressions for connecting attributes and attribute values; "attribute value" is a representation of the value corresponding to the attribute; an "aggregation function" is an expression that refers to the execution of an aggregation operation, such as maximum, minimum, count, etc., on a certain attribute value.
The naming information of the entity refers to text information of the name of the entity; the dependency relationship information of the entities refers to asymmetric dominant relationship between the entities in the sentence, and the output result can be represented by a directed arc, wherein the directed arc points to the dominant word (head) by the subordinate word (dep). Such as "what the age of Zhang Sanhe" is, where there is an attribute constraint relationship between the two. And the naming information and the association information of the entity constitute the entity information.
In an embodiment of the present invention, the dependencies may be categorized into the following categories: "constraint conditions", "principal constraint", "attribute relationship constraint", "aggregation function", "nonsensical component", "side-by-side relationship", "ROOT", and the like.
The dependency information shown in the text "what age the employee is about three" as shown in FIG. 2, where the arrow is directed by the subordinate entity to the dominant entity, can be used to interpret the above-described classification of dependencies. The ROOT refers to a main entity, namely a central entity of a question, the main entity points to a ROOT node, the ROOT is only a placeholder which does not exist in the original question, but the place of the beginning of the sentence is fixed, and the place is used for marking the central entity in the question; "subject constraint" refers to the constraint of an entity class on a main entity, such as the subject constraint of "employee" on "Zhang Sano", then the dominant entity is "Zhang Sano", and the subordinate entity is "employee"; the constraint condition refers to conditions which are larger than, smaller than and equal to each other, and are mainly used for connecting attribute values and attributes and pointing to the constrained attributes; "Attribute relationship constraint" refers to a query attribute corresponding to an entity being asked, which generally points to a constrained entity, such as "Zhang Sano" and "relationship between ages"; an "aggregation function" has a meaning consistent with named entity recognition, which points to a constrained attribute or relationship; "juxtaposition" is used to determine the relationship between entities, meaning juxtaposition, and typically other entities will point to the presence as the primary entity; "nonsensical component" refers to a portion of a question that has no actual meaning or redundancy, and that portion is not specifically pointed.
The entity analysis is to analyze the text in a Natural Language Processing (NLP) mode, identify the naming information of the entities in the text, and perform dependency analysis based on the naming information of the entities to identify the dependency relationship information among the text entities. Where dependency analysis is a type of syntactic analysis whose purpose is to identify word-to-word asymmetric dominance in sentences.
By naming information of the entity and assisting the dependency relationship information of the entity, the matching of the question text and the related entity in the knowledge base is more accurate when the knowledge map is asked and answered, the conditions that the question is not searched, the searched answer is wrong and the like are greatly reduced, and the accuracy rate and recall rate of entity linkage are improved.
And step 103, calculating the similarity between the entity in the natural language question text and the entity in the knowledge base based on the entity information to obtain a candidate link result of the natural language question.
In the embodiment of the invention, to construct the link between the natural language problem and the entity information in the knowledge base, the index table can be constructed according to the entity in the knowledge base, the entity in the problem text can inquire the corresponding entity in the index table according to the word of the entity in the query, and the similarity between the entity in the problem text and the entity in the knowledge base is considered for the entity which can be linked through the index, so that the similarity between the entity in the problem text and the entity in the knowledge base needs to be calculated to judge whether the entity in the problem text and the entity can be used as candidate link results of the natural language problem.
Specifically, for the dependency relationship information of the entity obtained in step 102, the similarity between the entity of the "nonsensical component" and the entity in the knowledge base is calculated. And calculating the similarity of entities such as 'small entities', 'attributes', 'relationships', and the like of the non-numerical classes, wherein the calculation method comprises but is not limited to methods of editing distance, clustering, and the like, and judging whether the corresponding entities of the knowledge base can be classified into candidate link results of natural language problems according to the similarity. For numeric class entities such as "attribute values" and the like, it is desirable to compute the similarity after numerical normalization, including but not limited to unity, digital text format unity and the like, such as nine hundred and 900, 100 cm and 1 meter, with respect to non-numeric class entities.
Through the calculation of the similarity, candidate link results of natural language problems can be rapidly and preliminarily screened, and the progress of the entity link process is quickened.
And 104, screening the candidate link result based on the dependency relationship information of the entity to obtain a final entity link.
The candidate link result of the natural language question obtained in step 103 is only matching of the naming information of the entity, and further screening of the candidate link result is required to be performed in order to improve recall rate of the entity link, while the dependency relationship information of the entity obtained in step 102 can reject and disambiguate, i.e. screen, redundant results in the candidate link result. For example, the query question is "how old the employee is, but in the candidate link result, the employee may be matched with a plurality of different" Zhang Sans "such as" athlete Zhang Sans "," actor Zhang Sans ", and" employee Zhang Sans ", so that the principal constraint of" employee "to" Zhang Sans "in the dependency relationship information of the entity is used for rejecting other ambiguous" Zhang Sans ", and the" employee Zhang Sans "is selected from the knowledge base for linking. The disambiguation modes of each entity type are different, the "entity" can disambiguate according to the corresponding "subject constraint", the "attribute" can disambiguate according to the "entity category" of the "entity" of the constraint, and meanwhile, the "attribute" can disambiguate according to the value type of the entity, for example, when the difference value is calculated, only the value of the value type can be calculated, so that the type of the corresponding value of the "attribute" can also be disambiguated. The value type refers to the type of the value corresponding to the attribute, such as a character string, a number, a date, and the like. Since the "relational term" is generally used to connect two entities, it may disambiguate according to the categories of entities that are constrained back and forth. Optionally, after screening the candidate link results, the "aggregation function" and the "constraint condition" are mounted on the corresponding attribute and relationship according to the dependency relationship information obtained in step 102, so as to obtain a final entity link result, for example, the problem is "who is the largest in the middle of the time" and after obtaining the final entity link result of the problem, the "largest" aggregation function is mounted on the attribute "age" so as to obtain the maximum value of the age according to the final entity link result, thereby obtaining the final entity link result.
On the basis of performing primary screening by using the naming information of the entity in step 103, the linked result is subjected to secondary screening, namely refusal and disambiguation, by combining the dependency relationship information of the entity obtained in step 102, in the linking process, the naming information of the entity is considered, and the context contact of the text, namely the dependency relationship among different entities, is combined, so that the problems of low accuracy and high recall error rate of entity linking are effectively solved.
Optionally, in step 102, performing entity analysis on the natural language question text to obtain entity information in the natural language question text, including:
and step S201, carrying out named entity recognition on the natural language question text by using a named entity model based on BERT-CRF to obtain named information of the entity in the natural language question text.
The BERT (Bidirectional Encoder Representation from Transformers) model is a language model based on a transducer model, as shown in the BERT model architecture of fig. 3. The BERT model may be regarded as a generic language model for implementing different downstream tasks.
In the figure, tran represents a transducer model, E1, E2, …, em represents text input in terms of words, and T1, T2, …, tm represents an output vector of the model.
The encoder part of the transducer model is shown in fig. 4, and the encoder of the transducer model is composed of multiple layers of units, each layer of units comprises two sub-layers, and the sub-layers in each layer of units are connected through residual errors so as to ensure that information can be completely transmitted:
wherein input and output are input and output, and the two sublayers are self attention layer (self attention) and feed forward neural network layer (feed forward), respectively.
The CRF, namely the conditional random field model (Conditional Random Fields, CRF), is a discriminant probability model constructed based on a maximum entropy model (Maximum Entropy Model, ME) and a hidden Markov model (Hidden Markov Model, HMM), and the model can better realize label prediction on a text sequence by using the concept of global optimization. Let a given set of input sequences a= (a) 1 ,a 2 ,…,a n ) The corresponding predicted sequence is y= (Y) 1 ,y 2 ,…,y n ) The score function of the predicted sequence is:
Figure SMS_1
where M is the transition score between tags,
Figure SMS_2
a score corresponding to the tag for each word.
In the model training process, a maximum likelihood optimization method is adopted for optimization, and the likelihood probability of a predicted sequence is obtained by the following formula:
Figure SMS_3
wherein Y is A Refers to all predicted tag sequences corresponding to one input sequence a.
In the model prediction stage, a Viterbi algorithm is adopted to obtain the output prediction sequence of the maximum score, wherein the prediction sequence comprises the following formula:
Figure SMS_4
from the above formula, it can be seen that the higher the s (A, y) score, the more accurate the prediction.
In the embodiment of the invention, the named entity model is an entity identification prediction model based on BERT-CRF, the model fully combines the advantages of the BERT model and the CRF model, acquires a context information sequence by using a BERT pre-training model, automatically learns the state characteristics of the sequence, connects the state characteristics to a full connection layer to output a state score, and then directly transmits the state score to a CRF network; constraint conditions are further added to the prediction result through the CRF network to ensure the rationality of the prediction result. The named entity model can be divided into three parts: an input layer, a BERT layer, and a prediction (CRF) layer.
As shown in the named entity model architecture in fig. 5, taking the sentence "my family in Tianjin …" as an example, the input of the named entity model is a set of vector sequences that each word in the text is converted by the query word vector table, and the input vector sequences are composed of three parts, namely, from top to bottom as shown in fig. 5: a word vector (token email), a segmentation vector (segment embedding), and a position vector (position embedding), wherein the word vector is a word vector or a word vector obtained by performing unsupervised training on a large-scale sample by a BERT model, the word vector is adopted in input shown in fig. 5, and the head and tail characters of an input sequence are filled by [ CLS ] and [ SEP ] labels, respectively. A segmentation vector is a sentence or paragraph used to divide text, and since only one sentence is used in the example, only E is present A The split vector is 0. The position vector is information indicating the position of the word in the current sentence.
The output of the BERT layer in the named entity model is the coding vector of each word, and the vector contains semantic information of the current position.
A full connection layer is arranged behind the BERT layer and is used for converting the coding sequence output by the BERT layer into a set of predictive labels, wherein the set of predictive labels is used as an input of the CRF layer.
In the CRF layer, different from the traditional method that the probability of each label is calculated by adopting a softmax function, and the label corresponding to the maximum probability is used as a final prediction result, the CRF can automatically learn the front and rear information of the label, and add a limiting condition to the prediction result to ensure the correctness of the prediction result. In the training process, the CRF layer actively learns all the limiting conditions, so that the wrong predicted sequence is greatly reduced, and finally, the identification class label of the entity in the text is output.
And constructing a named entity model based on BERT-CRF, and greatly reducing the error rate of a predicted sequence by using the strong feature extraction capability of BERT and the strong learning capability of CFR model on the limiting conditions during prediction.
And step S202, performing dependency analysis by using a BERT-based naming information and a BILSTM-based syntactic analysis model to obtain the dependency relationship information of the entity in the natural language question text.
In the embodiment of the invention, the syntactic analysis model adopts a classical dual-affine attention mechanism model (Deep Biaffine Attention for Neural Dependency Parsing), the model firstly codes the splice vector of the word and the part of speech through BiLSTM, and then two MLP heads are used for respectively coding corresponding h (arc-head) and h (arc-dep) vectors, so that redundant information is removed. Finally, the vectors at all times are spliced to obtain H (arc-head) and H (arc-dep), a unit vector is spliced on the H (arc-dep), an intermediate matrix U (arc) is added to carry out affine transformation to obtain a dot product number matrix S (arc) of dep and head, and head dependent words of each word are found according to the S (arc).
Optionally, before step S201, a training process of naming the entity model is further included:
step 2011, acquiring an original text data set of the named entity model;
step S2022, labeling the characters in the original text data set to obtain a labeled text data set; the noted categories include a start character, an intermediate character, and an irrelevant character;
step S2023, dividing the marked text data set into a training set, a testing set and a verification set in proportion;
step S2024, building the named entity model based on the training set, the testing set and the verification set.
Notably, the training dataset of the named entity model labels text as three classes, including a beginning character, an intermediate character, and an irrelevant character, i.e., a labeled version of the BIO. BIO, B, begin, indicates start; i, intermediate, which represents the middle; o, other, is used to mark unrelated characters, as shown in Table 1 as the text "West An developed well" label.
TABLE 1
Western medicine Anan (safety) Hair brush Exhibition device Obtaining the product Good (good)
B I O O O O
Through the marking mode of BIO, marks of initial, middle and irrelevant characters are added in text data, so that the model can learn the characteristics of the entity during training, the connection characteristics, position characteristics and the like of the entity and the context are further added, the feature mining scale is widened on the basis of the depth advantage of BERT model feature mining, the characteristics learned by the named entity model are deep enough, and the multi-characteristic learning capability is enhanced.
The labeling form of the BIO can be popularized to most machine learning models, and the multi-feature learning capacity of machine learning is improved.
Optionally, the similarity in step 103 includes similarity between the natural language question text and the numeric class entity in the knowledge base, and similarity between the natural language question text and the non-numeric class entity in the knowledge base.
Optionally, when calculating the similarity between the natural language question text and the entity in the knowledge base, step 103 calculates the similarity between the entity in the natural language question text and the entity in the knowledge base based on the entity information, so as to obtain a candidate link result of the natural language question, which includes:
and step 301, carrying out digital normalization processing on the entity class entities in the knowledge base in the calculated natural language question text based on the entity information.
And step S302, calculating the edit distance between the numerical value class entity in the natural language question text and the numerical value class entity in the knowledge base after the digital normalization processing, wherein the edit distance is used as the similarity between the numerical value class entity in the natural language question text and the numerical value class entity in the knowledge base.
And step 303, when the similarity is not greater than a first similarity threshold, drawing a numerical value class entity in a knowledge base corresponding to the similarity into a candidate link result of the natural language problem.
The first similarity threshold is used for judging whether the entity in the knowledge base achieves the entity link condition with the natural language question text, and can be adjusted according to the specific effect when the actual entity is linked.
The invention provides a question-answering method of a knowledge graph, which comprises the following steps:
step 201, the client receives a question and answer request of the user.
Step 202, the client sends the question-answer request to the server.
Step 203, the server builds entity links between the text information of the question-answer request and the knowledge base.
And 204, the server returns the entity information in the linked knowledge base to the client as an answer based on the entity link and presents the answer to the user.
In the embodiment of the present invention, the entity link in step 203 is constructed according to the method for constructing an entity link in fig. 1 and any one of the foregoing embodiments, and the method for constructing an entity link in fig. 1 is used to facilitate reduction of the return rate of the answer with low relevance to the question and increase the accuracy of the question and answer when the knowledge graph question and answer are performed.
In summary, the present invention provides an embodiment of a method for constructing an entity link. In the embodiment of the invention, a natural language question text is firstly obtained, then entity analysis is carried out on the natural language question text to obtain entity information in the natural language question text, then the similarity between the entity in the natural language question text and the entity in a knowledge base is calculated based on the entity information to obtain a candidate link result of the natural language question, and the candidate link result is screened based on the dependency relationship information of the entity to obtain a final entity link. According to the entity information, the similarity between the natural language problem text and the entity in the knowledge base is calculated, the entity to be linked is primarily screened based on the calculated similarity, and then the dependency relationship information of the entity is further screened, the entity naming entity information and the dependency relationship information in the text are combined in the entity linking process, so that the relation between the entity in the text and the context is enhanced, the accuracy of entity linking is effectively improved, the problems of low accuracy and high recall error rate of entity linking are solved, and the accuracy of knowledge graph question-answering is improved.
It should be noted that, for simplicity of description, the method embodiments are shown as a series of acts, but it should be understood by those skilled in the art that the embodiments are not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred embodiments, and that the acts are not necessarily required by the embodiments of the invention.
Referring to fig. 6, which shows a block diagram of an embodiment of an apparatus for building physical links of the present invention, the apparatus 300 may include:
a text obtaining module 301, configured to obtain a natural language question text;
the entity analysis module 302 is configured to perform entity analysis on the natural language question text to obtain entity information in the natural language question text; the entity information comprises naming information of an entity and dependency relationship information of the entity;
the preliminary link screening module 303 is configured to calculate, based on the entity information, a similarity between an entity in the natural language question text and an entity in a knowledge base, so as to obtain a candidate link result of the natural language question;
And the entity link generation module 304 is configured to filter the candidate link result based on the dependency relationship information of the entity, so as to obtain a final entity link.
Optionally, the entity analysis module may include:
the named entity recognition module is used for carrying out named entity recognition on the natural language question text by using a BERT-CRF-based named entity model to obtain named information of the entity in the natural language question text;
and the dependency analysis module is used for carrying out dependency analysis by utilizing the BERT-based naming information and utilizing a BiLSTM-based syntactic analysis model to obtain the dependency relationship information of the entity in the natural language question text.
Optionally, the training data of the named entity model in the named entity module is marked by a marking form of BIO; the BIO represents a start character, an end character, and an irrelevant character.
Optionally, the similarity in the preliminary link screening module includes similarity between the natural language question text and a numeric entity in the knowledge base, and similarity between the natural language question text and a non-numeric entity in the knowledge base.
Optionally, when calculating the similarity between the natural language question text and the digital class entity in the knowledge base, the preliminary link screening module may include:
The digital normalization module is used for carrying out digital normalization processing on the entity of the numerical class in the knowledge base in the text of the natural language question based on the entity information;
the editing distance calculation module is used for calculating the editing distance between the numerical value class entity in the natural language question text and the numerical value class entity in the knowledge base after the digital normalization processing, and taking the editing distance as the similarity between the numerical value class entity in the natural language question text and the numerical value class entity in the knowledge base;
and the candidate link result generation module is used for drawing the numerical value class entity in the knowledge base corresponding to the similarity into the candidate link result of the natural language problem when the similarity is not greater than a first similarity threshold value.
Optionally, the invention provides a question-answering device of a knowledge graph, which comprises:
the problem input module is used for receiving a question and answer request of a user by the client;
the request sending module is used for sending the question-answer request to the server by the client;
the entity link module is used for constructing entity links between the text information of the question-answer request and the knowledge base by the server;
the answer return module is used for returning the entity information in the linked knowledge base to the client as an answer based on the entity link and presenting the answer to the user;
The entity link in the entity link module is constructed according to the construction method of the entity link described in fig. 1.
In summary, the present invention provides an embodiment of an apparatus for building physical links. In the embodiment of the invention, a natural language question text is firstly obtained, then entity analysis is carried out on the natural language question text to obtain entity information in the natural language question text, then the similarity between the entity in the natural language question text and the entity in a knowledge base is calculated based on the entity information to obtain a candidate link result of the natural language question, and the candidate link result is screened based on the dependency relationship information of the entity to obtain a final entity link. According to the entity information, the similarity between the natural language problem text and the entity in the knowledge base is calculated, the entity to be linked is primarily screened based on the calculated similarity, and then the dependency relationship information of the entity is further screened, the entity naming entity information and the dependency relationship information in the text are combined in the entity linking process, so that the relation between the entity in the text and the context is enhanced, the accuracy of entity linking is effectively improved, the problems of low accuracy and high recall error rate of entity linking are solved, and the accuracy of knowledge graph question-answering is improved.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described by differences from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
Referring to fig. 7, an electronic device 600 may include one or more of the following components: a processing component 602, a memory 604, a power component 606, a multimedia component 608, an audio component 610, an input/output (I/O) interface 612, a sensor component 614, and a communication component 616.
The processing component 602 generally controls overall operation of the electronic device 600, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to perform all or part of the steps of the methods described above. Further, the processing component 602 can include one or more modules that facilitate interaction between the processing component 602 and other components. For example, the processing component 602 may include a multimedia module to facilitate interaction between the multimedia component 608 and the processing component 602.
The memory 604 is used to store various types of data to support operations at the electronic device 600. Examples of such data include instructions for any application or method operating on the electronic device 600, contact data, phonebook data, messages, pictures, multimedia, and so forth. The memory 604 may be implemented by any type or combination of volatile or nonvolatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
The power supply component 606 provides power to the various components of the electronic device 600. The power supply components 606 can include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 600.
The multimedia component 608 includes a screen between the electronic device 600 and the user that provides an output interface. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may not only sense demarcations of touch or sliding actions, but also detect durations and pressures associated with the touch or sliding operations. In some embodiments, the multimedia component 608 includes a front camera and/or a rear camera. When the electronic device 600 is in an operational mode, such as a shooting mode or a multimedia mode, the front-facing camera and/or the rear-facing camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
The audio component 610 is for outputting and/or inputting audio signals. For example, the audio component 610 includes a Microphone (MIC) for receiving external audio signals when the electronic device 600 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may be further stored in the memory 604 or transmitted via the communication component 616. In some embodiments, audio component 610 further includes a speaker for outputting audio signals.
The I/O interface 612 provides an interface between the processing component 602 and peripheral interface modules, which may be a keyboard, click wheel, buttons, etc. These buttons may include, but are not limited to: homepage button, volume button, start button, and lock button.
The sensor assembly 614 includes one or more sensors for providing status assessment of various aspects of the electronic device 600. For example, the sensor assembly 614 may detect an on/off state of the electronic device 600, a relative positioning of the components, such as a display and keypad of the electronic device 600, the sensor assembly 614 may also detect a change in position of the electronic device 600 or a component of the electronic device 600, the presence or absence of a user's contact with the electronic device 600, an orientation or acceleration/deceleration of the electronic device 600, and a change in temperature of the electronic device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact. The sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an acceleration sensor, a gyroscopic sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 616 is utilized to facilitate communication between the electronic device 600 and other devices, either in a wired or wireless manner. The electronic device 600 may access a wireless network based on a communication standard, such as WiFi, an operator network (e.g., 2G, 3G, 4G, or 5G), or a combination thereof. In one exemplary embodiment, the communication component 616 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communication component 616 further includes a Near Field Communication (NFC) module to facilitate short range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 600 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic elements for implementing a method of building an entity link as provided by embodiments of the disclosure.
In an exemplary embodiment, a non-transitory computer-readable storage medium is also provided, such as memory 604, including instructions executable by processor 620 of electronic device 600 to perform the above-described method. For example, the non-transitory storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
Embodiments of the present disclosure also provide a computer program product comprising a computer program which, when executed by a processor, implements the entity-based link construction method.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general-purpose systems may also be used with the teachings herein. The required structure for a construction of such a system is apparent from the description above. In addition, embodiments of the present disclosure are not directed to any particular programming language. It will be appreciated that the contents of the embodiments of the present disclosure described herein may be implemented using various programming languages, and the above description of specific languages is provided for disclosure of enablement and best mode of the embodiments of the present disclosure.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the disclosure may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the disclosure, various features of embodiments of the disclosure are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be construed as reflecting the intention that: i.e., an embodiment of the disclosure that claims require more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this disclosure.
Those skilled in the art will appreciate that the modules in the apparatus of the embodiments may be adaptively changed and disposed in one or more apparatuses different from the embodiments. The modules or units or components of the embodiments may be combined into one module or unit or component and, furthermore, they may be divided into a plurality of sub-modules or sub-units or sub-components. Any combination of all features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or units of any method or apparatus so disclosed, may be used in combination, except insofar as at least some of such features and/or processes or units are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings), may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Various component embodiments of the present disclosure may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that some or all of the functions of some or all of the components in a sorting device according to embodiments of the present disclosure may be implemented in practice using a microprocessor or Digital Signal Processor (DSP). Embodiments of the present disclosure may also be implemented as a device or apparatus program for performing part or all of the methods described herein. Such a program implementing embodiments of the present disclosure may be stored on a computer readable medium or may have the form of one or more signals. Such signals may be downloaded from an internet website, provided on a carrier signal, or provided in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the embodiments of the disclosure, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. Embodiments of the present disclosure may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, third, etc. do not denote any order. These words may be interpreted as names.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
The foregoing description of the preferred embodiments of the present disclosure is not intended to limit the embodiments of the present disclosure, but is intended to cover any modifications, equivalents, and improvements made within the spirit and principles of the embodiments of the present disclosure.
The foregoing is merely a specific implementation of the embodiments of the disclosure, but the protection scope of the embodiments of the disclosure is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the embodiments of the disclosure, and the changes or substitutions are intended to be covered by the protection scope of the embodiments of the disclosure. Therefore, the protection scope of the embodiments of the present disclosure shall be subject to the protection scope of the claims.

Claims (10)

1. A method for constructing an entity link, comprising:
acquiring a natural language question text;
performing entity analysis on the natural language question text to obtain entity information in the natural language question text; the entity information comprises naming information of an entity and dependency relationship information of the entity;
based on the entity information, calculating the similarity between the entity in the natural language question text and the entity in the knowledge base to obtain a candidate link result of the natural language question;
And screening the candidate link result based on the dependency relationship information of the entity to obtain a final entity link.
2. The method of claim 1, wherein the performing entity analysis on the natural language question text to obtain entity information in the natural language question text includes:
performing named entity recognition on the natural language question text by using a named entity model based on BERT-CRF to obtain named information of entities in the natural language question text;
and performing dependency analysis on the naming information by using a syntax analysis model based on BiLSTM to obtain the dependency relationship information of the entity in the natural language question text.
3. The method of claim 2, further comprising, prior to step of performing named entity recognition on the natural language question text using a BERT-CRF based named entity model to obtain named information of entities in the natural language question text:
acquiring an original text data set of a named entity model;
labeling the characters in the original text data set to obtain a labeled text data set; the noted categories include a start character, an intermediate character, and an irrelevant character;
Dividing the marked text data set into a training set, a testing set and a verification set according to a proportion;
and building the named entity model based on the training set, the testing set and the verification set.
4. The method of claim 1, wherein the similarity comprises a similarity in the natural language question text to a numeric class entity in a knowledge base, a similarity in the natural language question text to a non-numeric class entity in a knowledge base.
5. The method according to claim 4, wherein when calculating the similarity between the natural language question text and the entity in the knowledge base, the calculating the similarity between the entity in the natural language question text and the entity in the knowledge base based on the entity information, to obtain the candidate link result of the natural language question, includes:
based on the entity information, carrying out digital normalization processing on the entity similar to the data in the knowledge base in the text of the natural language question;
calculating the editing distance between the numerical value class entity in the natural language question text and the numerical value class entity in the knowledge base after the digital normalization processing, wherein the editing distance is the similarity between the numerical value class entity in the natural language question text and the numerical value class entity in the knowledge base;
And when the similarity is not greater than a first similarity threshold, drawing the numerical value class entity in the knowledge base corresponding to the similarity into a candidate link result of the natural language problem.
6. The knowledge graph question-answering method is characterized by comprising the following steps of:
the client receives a question and answer request of a user;
the client sends the question-answer request to a server;
the server builds entity links between the text information of the question-answer request and the knowledge base;
the server returns the entity information in the linked knowledge base to the client as an answer based on the entity link and presents the answer to the user;
wherein the entity link is constructed according to the method for constructing an entity link according to any one of claims 1 to 5.
7. An apparatus for constructing an entity link, comprising:
the text acquisition module is used for acquiring a natural language question text;
the entity analysis module is used for carrying out entity analysis on the natural language question text to obtain entity information in the natural language question text; the entity information comprises naming information of an entity and dependency relationship information of the entity;
the preliminary link screening module is used for calculating the similarity between the entity in the natural language question text and the entity in the knowledge base based on the entity information to obtain a candidate link result of the natural language question;
And the entity link generation module is used for screening the candidate link result based on the dependency relationship information of the entity to obtain a final entity link.
8. An electronic device, comprising: a processor and a memory, the processor executing a computer program stored in the memory, implementing the method of any one of claims 1 to 5.
9. A readable storage medium, characterized in that instructions in said storage medium, when executed by a processor of an apparatus, enable the apparatus to perform the method of any one of the method claims 1 to 5.
10. A computer program product comprising a computer program, characterized in that the computer program, when executed by a processor, implements the method of any one of claims 1 to 5.
CN202211182929.1A 2022-09-27 2022-09-27 Method and device for constructing entity link, electronic equipment and readable storage medium Pending CN116028634A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211182929.1A CN116028634A (en) 2022-09-27 2022-09-27 Method and device for constructing entity link, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211182929.1A CN116028634A (en) 2022-09-27 2022-09-27 Method and device for constructing entity link, electronic equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN116028634A true CN116028634A (en) 2023-04-28

Family

ID=86080216

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211182929.1A Pending CN116028634A (en) 2022-09-27 2022-09-27 Method and device for constructing entity link, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN116028634A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118093788A (en) * 2024-04-22 2024-05-28 成都同步新创科技股份有限公司 Construction and search method of knowledge base of small and medium enterprises based on large model

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118093788A (en) * 2024-04-22 2024-05-28 成都同步新创科技股份有限公司 Construction and search method of knowledge base of small and medium enterprises based on large model

Similar Documents

Publication Publication Date Title
CN111339774B (en) Text entity relation extraction method and model training method
CN108038103B (en) Method and device for segmenting text sequence and electronic equipment
CN108984683B (en) Method, system, equipment and storage medium for extracting structured data
WO2019100350A1 (en) Providing a summary of a multimedia document in a session
CN111241237B (en) Intelligent question-answer data processing method and device based on operation and maintenance service
WO2018028077A1 (en) Deep learning based method and device for chinese semantics analysis
WO2021135469A1 (en) Machine learning-based information extraction method, apparatus, computer device, and medium
CN107330120A (en) Inquire answer method, inquiry answering device and computer-readable recording medium
CN112016313B (en) Spoken language element recognition method and device and warning analysis system
CN110991176B (en) Cross-language non-standard word recognition method and device
WO2024099037A1 (en) Data processing method and apparatus, entity linking method and apparatus, and computer device
CN114328838A (en) Event extraction method and device, electronic equipment and readable storage medium
US20230153522A1 (en) Image captioning
US20230094730A1 (en) Model training method and method for human-machine interaction
CN116975218A (en) Text processing method, device, computer equipment and storage medium
CN117786086A (en) Reply text generation method, reply text generation device, computer equipment and readable storage medium
CN116028634A (en) Method and device for constructing entity link, electronic equipment and readable storage medium
CN117009503A (en) Text classification method and device
CN112380865A (en) Method, device and storage medium for identifying entity in text
CN117056451A (en) New energy automobile complaint text aspect-viewpoint pair extraction method based on context enhancement
CN114969360A (en) Text information processing method, device, equipment and storage medium
CN115129893A (en) Entity and/or relationship linking method based on prompt learning
US11574246B2 (en) Updating training examples for artificial intelligence
CN111046153B (en) Voice assistant customization method, voice assistant customization device and intelligent equipment
US11914844B2 (en) Automated processing and dynamic filtering of content for display

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