CN111079429B - Entity disambiguation method and device based on intention recognition model and computer equipment - Google Patents

Entity disambiguation method and device based on intention recognition model and computer equipment Download PDF

Info

Publication number
CN111079429B
CN111079429B CN201910978260.9A CN201910978260A CN111079429B CN 111079429 B CN111079429 B CN 111079429B CN 201910978260 A CN201910978260 A CN 201910978260A CN 111079429 B CN111079429 B CN 111079429B
Authority
CN
China
Prior art keywords
sentence
preset
word
entity
designated
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910978260.9A
Other languages
Chinese (zh)
Other versions
CN111079429A (en
Inventor
张师琲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201910978260.9A priority Critical patent/CN111079429B/en
Publication of CN111079429A publication Critical patent/CN111079429A/en
Priority to PCT/CN2020/093428 priority patent/WO2021073119A1/en
Application granted granted Critical
Publication of CN111079429B publication Critical patent/CN111079429B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures

Landscapes

  • Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Machine Translation (AREA)

Abstract

The application discloses an entity disambiguation method, an apparatus, a computer device and a storage medium based on an intention recognition model, the method comprising: acquiring a first sentence to be disambiguated, and acquiring entity words marked as ambiguity in the first sentence; selecting a specified standard sentence; calculating a first distance between the first sentence and the specified standard sentence; if the first distance is smaller than the first distance threshold value, acquiring a designated intention recognition model; inputting a first sentence into the designated intention recognition model so as to obtain a recognition result, wherein the designated intention recognition model is trained by sample data, and the sample data only consists of sentences marked as designated type intents; and if the recognition result is that the recognition is successful, acquiring the designated entity meaning corresponding to the first sentence, and labeling the designated entity meaning on the entity word. Thus, in the disambiguation process, a new dimension (intention identification) is introduced, thereby improving the accuracy of entity disambiguation.

Description

Entity disambiguation method and device based on intention recognition model and computer equipment
Technical Field
The present application relates to the field of computers, and in particular, to a method, an apparatus, a computer device, and a storage medium for entity disambiguation based on an intent recognition model.
Background
Entity disambiguation is a key task in natural language processing. Since entity references (e.g., nouns) present in mass data can generally correspond to multiple named entity concepts, this undoubtedly poses a significant obstacle to entity disambiguation. The task of entity disambiguation is to assign these ambiguous entities to match corresponding target entities among a plurality of candidate entities. The existing entity disambiguation scheme has insufficient accuracy, for example, entity links are adopted for disambiguation, named entities to be disambiguated need to be named and linked to corresponding entities in an external knowledge base for disambiguation, so that the accuracy depends on the record of the external knowledge base, and the accurate identification of the entities under different contexts is not accurate enough. Thus, the accuracy of current entity disambiguation is yet to be improved.
Disclosure of Invention
The present application provides a method, an apparatus, a computer device and a storage medium for entity disambiguation based on an intention recognition model, aiming to improve the accuracy of entity disambiguation.
In order to achieve the above object, the present application provides an entity disambiguation method based on an intent recognition model, comprising the following steps:
acquiring a first sentence to be disambiguated, and performing ambiguity labeling processing on the first sentence according to a preset ambiguity labeling method, so as to acquire entity words labeled as ambiguity in the first sentence;
selecting a specified standard sentence from a preset standard sentence database according to a preset standard sentence selection method;
calculating a first distance between the first sentence and the specified standard sentence according to a preset distance calculation formula, and judging whether the first distance is smaller than a preset first distance threshold value;
if the first distance is smaller than a preset first distance threshold, acquiring a designated intention recognition model corresponding to a designated standard sentence according to the corresponding relation between a preset standard sentence and an intention recognition model, wherein the designated intention recognition model is formed by training sample data, and the sample data only consists of sentences marked as designated type intents;
inputting the first sentence into the designated intention recognition model for operation, so as to obtain a recognition result output by the designated intention recognition model, wherein the recognition result comprises recognition success or recognition failure;
judging whether the identification result is successful or not;
if the recognition result is that the recognition is successful, acquiring a designated entity meaning corresponding to the first sentence according to a preset corresponding relation of the first sentence, the standard sentence, the intention recognition model and the entity meaning, and carrying out disambiguation labeling operation on the first sentence, so that the entity words labeled as the ambiguity are labeled with the designated entity meaning.
Further, the step of performing ambiguity labeling processing on the first sentence according to a preset ambiguity labeling method to obtain an entity word labeled as ambiguity in the first sentence includes:
inputting the first sentence into a bidirectional encoder in a preset ambiguity labeling model for processing to obtain a first ambiguity labeling sequence corresponding to each word in the first sentence one to one, and obtaining a hidden state vector set of a last layer of conversion units of the bidirectional encoder, wherein the ambiguity labeling model is composed of the bidirectional encoder and a support vector machine, and the bidirectional encoder comprises a plurality of layers of conversion units;
inputting the hidden state vector set into the support vector machine for operation to obtain a second ambiguous annotation sequence corresponding to each word of the first sentence one by one, wherein a function used by the support vector machine for operation is
Figure GDA0003412776050000021
Wherein
Figure GDA0003412776050000022
Is the labeled value corresponding to the ith word of the first sentence, y is an independent variable, yi is the label corresponding to the ith word of the first sentence, wyiIs the parameter vector corresponding to the ith word, hiFor the hidden state vector corresponding to the ith word, wyiAnd hiHave the same number of component amounts;
calculating the similarity degree value of the first ambiguity marking sequence and the second ambiguity marking sequence according to a preset similarity degree value calculation method, and judging whether the similarity degree value is greater than a preset similarity degree threshold value or not;
and if the similarity degree value is greater than a preset similarity degree threshold value, acquiring the entity words marked as ambiguity in the second ambiguity marking sequence.
Further, the step of selecting a specific standard sentence from a preset standard sentence database according to a preset standard sentence selection method includes:
according to the formula:
Figure GDA0003412776050000031
calculating a sentence similarity value sim of the first sentence and a standard sentence in the standard sentence database, wherein A is a word of the first sentenceThe frequency vector B is a word frequency vector of the standard sentence, and Ai is the number of times of the ith word of the first sentence appearing in the whole sentence; bi is the frequency of the ith word of the standard sentence appearing in the whole sentence;
judging whether a standard sentence with the sentence similarity value sim larger than a preset sentence similarity threshold exists in the standard sentence database;
and if so, marking the standard sentence with the sentence similarity value sim being larger than a preset sentence similarity threshold value as a specified standard sentence.
Further, the step of calculating a first distance between the first sentence and the specified standard sentence according to a preset distance calculation formula includes:
acquiring a first word vector sequence I corresponding to the first sentence and a second word vector sequence R corresponding to the specified standard sentence by inquiring a preset word vector library;
according to the formula:
Figure GDA0003412776050000032
calculating a first distance D between the first sentence and the specified standard sentence, wherein | I | is a number of words in the first word vector sequence; | R | is the number of words in the second word vector sequence; w is a word vector; alpha is an amplification coefficient for adjusting cosine similarity between two word vectors; max (α × cosDis (w, R)) is the maximum value in calculating the cosine similarity of the word vectors w corresponding to all words in the second word vector sequence R and the word vectors w corresponding to all words in the first word vector sequence I.
Further, if the first distance is smaller than a preset first distance threshold, obtaining a designated intention recognition model corresponding to a designated standard sentence according to a corresponding relationship between a preset standard sentence and an intention recognition model, where the designated intention recognition model is trained by using sample data, and the sample data is only composed of sentences labeled as designated type intents before the step of:
acquiring a plurality of pre-collected sample data, and dividing the sample data into training data and test data; wherein the sample data is a sentence labeled as a specified type intention;
inputting training data into a preset neural network model for training, wherein the training adopts a random gradient descent method so as to obtain an intermediate intention recognition model;
verifying the intermediate intention recognition model by adopting the test data, and judging whether the verification is passed;
and if the verification is passed, marking the intermediate intention identification model as the designated intention identification model.
Further, the step of determining whether the recognition result is a successful recognition includes:
if the recognition result is recognition failure, acquiring an alternative standard sentence from a plurality of specified standard sentences, wherein a second distance between the alternative standard sentence and the first sentence is greater than the first distance threshold and smaller than a preset second distance threshold;
acquiring an alternative intention recognition model corresponding to the alternative standard sentence according to the corresponding relation between a preset standard sentence and an intention recognition model;
inputting the first sentence into the alternative intention recognition model for operation, so as to obtain a second recognition result output by the alternative intention recognition model, wherein the second recognition result comprises recognition success or recognition failure;
judging whether the second identification result is successful;
if the second recognition result is successful, acquiring the alternative entity meaning corresponding to the first sentence according to the preset corresponding relation of the first sentence, the standard sentence, the intention recognition model and the entity meaning, and carrying out disambiguation labeling operation on the first sentence, so that the entity words labeled as the ambiguity are labeled with the alternative entity meaning.
Further, after the step of determining whether the second recognition result is a successful recognition, the method includes:
if the second recognition result is recognition failure, acquiring the number of the specified standard sentences;
judging whether the number of the specified standard sentences is greater than a preset number threshold value or not;
and if the number of the specified standard sentences is not greater than a preset number threshold, executing a label modification operation, wherein the label modification operation is used for modifying the label of the entity word labeled as ambiguous into an unambiguous label.
The application provides an entity disambiguation apparatus based on an intention recognition model, comprising:
the entity word acquisition unit is used for acquiring a first sentence to be disambiguated and carrying out ambiguity labeling processing on the first sentence according to a preset ambiguity labeling method so as to acquire an entity word labeled as ambiguity in the first sentence;
a designated standard sentence acquisition unit for selecting a designated standard sentence from a preset standard sentence database according to a preset standard sentence selection method;
a first distance judgment unit, configured to calculate a first distance between the first sentence and the specified standard sentence according to a preset distance calculation formula, and judge whether the first distance is smaller than a preset first distance threshold;
a designated intention recognition model obtaining unit, configured to obtain, if the first distance is smaller than a preset first distance threshold, a designated intention recognition model corresponding to a preset standard sentence according to a correspondence between the preset standard sentence and an intention recognition model, where the designated intention recognition model is trained using sample data, and the sample data is composed of only sentences labeled as designated types of intentions;
a recognition result obtaining unit, configured to input the first sentence into the designated intention recognition model for operation, so as to obtain a recognition result output by the designated intention recognition model, where the recognition result includes a recognition success or a recognition failure;
the identification result judging unit is used for judging whether the identification result is successful or not;
and the designated entity meaning marking unit is used for acquiring the designated entity meaning corresponding to the first sentence according to the preset corresponding relation of the first sentence, the standard sentence, the intention recognition model and the entity meaning if the recognition result is successful, and carrying out disambiguation marking operation on the first sentence, so that the entity words marked as ambiguity are marked with the designated entity meaning.
The present application provides a computer device comprising a memory storing a computer program and a processor implementing the steps of any of the above methods when the processor executes the computer program.
The present application provides a computer-readable storage medium having stored thereon a computer program which, when being executed by a processor, carries out the steps of the method of any of the above.
The entity disambiguation method, the device, the computer equipment and the storage medium based on the intention recognition model acquire a first sentence to be disambiguated, and acquire entity words marked as ambiguity in the first sentence; selecting a specified standard sentence; calculating a first distance between the first sentence and the specified standard sentence; if the first distance is smaller than a preset first distance threshold, acquiring a designated intention recognition model; inputting the first sentence into the designated intention recognition model for operation so as to obtain a recognition result, wherein the designated intention recognition model is trained by sample data, and the sample data only consists of sentences marked as designated type intents; and if the recognition result is successful, acquiring the designated entity meaning corresponding to the first sentence, and carrying out disambiguation labeling operation on the first sentence, so that the entity words labeled as ambiguity are labeled with the designated entity meaning. Thus, in the disambiguation process, a new dimension (intention identification) is introduced, thereby improving the accuracy of entity disambiguation.
Drawings
FIG. 1 is a schematic flowchart of an entity disambiguation method based on an intent recognition model according to an embodiment of the present application;
FIG. 2 is a block diagram illustrating an example of an entity disambiguation apparatus based on an intent recognition model according to an embodiment of the present application;
fig. 3 is a block diagram illustrating a structure of a computer device according to an embodiment of the present application.
The implementation, functional features and advantages of the objectives of the present application will be further explained with reference to the accompanying drawings.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
Referring to fig. 1, an embodiment of the present application provides an entity disambiguation method based on an intent recognition model, including the following steps:
s1, acquiring a first sentence to be disambiguated, and performing ambiguity labeling processing on the first sentence according to a preset ambiguity labeling method, so as to acquire entity words labeled as ambiguity in the first sentence;
s2, selecting a specified standard sentence from a preset standard sentence database according to a preset standard sentence selection method;
s3, calculating a first distance between the first sentence and the specified standard sentence according to a preset distance calculation formula, and judging whether the first distance is smaller than a preset first distance threshold value;
s4, if the first distance is smaller than a preset first distance threshold, acquiring a designated intention recognition model corresponding to a designated standard sentence according to the corresponding relation between a preset standard sentence and an intention recognition model, wherein the designated intention recognition model is formed by training sample data, and the sample data only consists of sentences marked as designated type intentions;
s5, inputting the first sentence into the designated intention recognition model for operation, thereby obtaining a recognition result output by the designated intention recognition model, wherein the recognition result comprises recognition success or recognition failure;
s6, judging whether the identification result is successful or not;
and S7, if the recognition result is that the recognition is successful, acquiring a designated entity meaning corresponding to the first sentence according to a preset corresponding relation of the first sentence, the standard sentence, the intention recognition model and the entity meaning, and carrying out disambiguation labeling operation on the first sentence, so that the entity words labeled as the ambiguity are labeled with the designated entity meaning.
As described in step S1, a first sentence to be disambiguated is obtained, and the first sentence is subjected to ambiguity labeling processing according to a preset ambiguity labeling method, so as to obtain an entity word labeled as ambiguous in the first sentence. The object of entity disambiguation in the present application is to obtain the true meaning of an ambiguous entity word, and thus the ambiguous entity word needs to be labeled as ambiguous. The preset ambiguity labeling method includes, for example: inputting the first sentence into a bidirectional encoder in a preset ambiguity labeling model for processing, so as to obtain a first ambiguity labeling sequence corresponding to each word in the first sentence one to one, and acquiring a hidden state vector set of a last layer of conversion units of the bidirectional encoder, wherein the ambiguity labeling model is composed of the bidirectional encoder and a support vector machine, and the bidirectional encoder comprises a plurality of layers of conversion units; inputting the hidden state vector set into the support vector machine for operation to obtain a second ambiguous annotation sequence corresponding to each word of the first sentence one by one; calculating the similarity degree value of the first ambiguity marking sequence and the second ambiguity marking sequence according to a preset similarity degree value calculation method, and judging whether the similarity degree value is greater than a preset similarity degree threshold value or not; and if the similarity degree value is greater than a preset similarity degree threshold value, acquiring the entity words marked as ambiguity in the second ambiguity marking sequence.
According to the above step S2, the sentence is selected according to the predetermined standardA specified standard sentence is selected from the sentence database. The standard sentence is used to select a suitable intention recognition model, and thus a specified standard sentence close to the first sentence needs to be picked up. The preset standard sentence selection method is, for example: according to the formula:
Figure GDA0003412776050000071
calculating a sentence similarity value sim of the first sentence and a standard sentence in the standard sentence database; judging whether a standard sentence with the sentence similarity value sim larger than a preset sentence similarity threshold exists in the standard sentence database;
and if so, marking the standard sentence with the sentence similarity value sim being larger than a preset sentence similarity threshold value as a specified standard sentence.
As described in step S3, a first distance between the first sentence and the designated standard sentence is calculated according to a preset distance calculation formula, and it is determined whether the first distance is smaller than a preset first distance threshold. The first distance reflects the similarity degree of the first sentence and the specified standard sentence, if the numerical value of the first distance is smaller, the similarity is more indicated, and when the first sentence is completely identical to the specified standard sentence, the first distance is equal to 0. The preset distance calculation formula is, for example: acquiring a first word vector sequence I corresponding to the first sentence and a second word vector sequence R corresponding to the specified standard sentence by inquiring a preset word vector library; according to the formula:
Figure GDA0003412776050000081
calculating a first distance D between the first sentence and the specified standard sentence, wherein | I | is a number of words in the first word vector sequence; | R | is the number of words in the second word vector sequence; w is a word vector; alpha is an amplification coefficient for adjusting cosine similarity between two word vectors; max (α × cosDis (w, R)) is the calculation of the word vectors w corresponding to all words in the second word vector sequence R and the word vectors w corresponding to all words in the first word vector sequence IIs measured in the mean square of the cosine similarity.
As described in step S4, if the first distance is smaller than the preset first distance threshold, the designated intent recognition model corresponding to the designated standard sentence is obtained according to the corresponding relationship between the preset standard sentence and the intent recognition model, where the designated intent recognition model is trained by using sample data, and the sample data is composed of only sentences labeled as designated type intents. If the first distance is smaller than a preset first distance threshold value, an applicable intention recognition model is represented, and accordingly, a specified intention recognition model corresponding to the specified standard sentence is obtained according to the corresponding relation between the preset standard sentence and the intention recognition model. Moreover, the designated intention recognition model adopted by the application is trained by adopting sample data, and the sample data is only composed of sentences marked as designated type intents, so that the designated intention recognition model has smaller volume, smaller required training data and easier training, and the accuracy of intention recognition on sentences in a limited range (namely sentences close to the designated standard sentences, such as the first sentence) is higher. Further, the sample data for training the specific intention recognition model is only composed of a limited number of words, the limited number of words are the same as or similar to the words in the first sentence, so that the training is faster, and the recognition of the first sentence is more accurate (since the number of words of the sample data is limited and is the same as or similar to the words in the first sentence, the sample data can find all the training sentences through a traversal method, so that the first sentence is certainly the sentence appeared in the training process, and therefore the first sentence is more accurate and faster in recognition).
As described in the above step S5, the first sentence is input into the designated intention recognition model for operation, so as to obtain a recognition result output by the designated intention recognition model, wherein the recognition result includes a recognition success or a recognition failure. Since the designated intention recognition model can only recognize one intention type (namely, the designated intention type), the successful recognition indicates that the first sentence is the designated intention type, and if the recognition fails, the recognition needs to be carried out again by adopting other intention recognition models.
As described in step S6, it is determined whether the recognition result is a successful recognition. Because the recognition results are only two types: identification is successful or identification is failed. When the recognition is successful, the first sentence is indicated as the designated intention type, otherwise, the intention type of the first sentence cannot be determined.
As described in the step S7, if the recognition result is successful, a designated entity meaning corresponding to the first sentence is obtained according to a preset correspondence relationship between the first sentence, the standard sentence, the intent recognition model and the entity meaning, and a disambiguation labeling operation is performed on the first sentence, so that the entity word labeled as an ambiguity is labeled with the designated entity meaning.
Ambiguous entity words have different meanings in different intent contexts, and if a specific intent type can be identified, the exact meaning of the ambiguous word can be determined. According to the method, according to the preset corresponding relation of the first sentence, the standard sentence, the intention recognition model and the entity meaning, the designated entity meaning corresponding to the first sentence is obtained, and disambiguation labeling operation is carried out on the first sentence, so that the entity words labeled as ambiguity are labeled with the designated entity meaning. So that the actual meaning of the entity word labeled as ambiguous in the first sentence is known from the specified entity meaning. For example, the first sentence is: i take the bad phone and borrow your apple to use. With "do my phone power off, can you use your apple? The apple in the first sentence can be labeled with the designated entity meaning (telephone) according to the corresponding relation of the first sentence, the standard sentence, the intention recognition model and the entity meaning (telephone).
In one embodiment, the step S1 of performing an ambiguous annotation process on the first sentence according to a preset ambiguous annotation method to obtain an entity word labeled as ambiguous in the first sentence includes:
s101, inputting the first sentence into a bidirectional encoder in a preset ambiguity labeling model for processing to obtain a first ambiguity labeling sequence corresponding to each word in the first sentence one to one, and acquiring a hidden state vector set of a last layer of conversion units of the bidirectional encoder, wherein the ambiguity labeling model is composed of the bidirectional encoder and a support vector machine, and the bidirectional encoder comprises a plurality of layers of conversion units;
s102, inputting the hidden state vector set into the support vector machine for operation to obtain a second ambiguity labeling sequence corresponding to each word of the first sentence one by one, wherein a function used by the support vector machine for operation is
Figure GDA0003412776050000101
Wherein
Figure GDA0003412776050000102
Is the labeled value corresponding to the ith word of the first sentence, y is an independent variable, yi is the label corresponding to the ith word of the first sentence, wyiIs the parameter vector corresponding to the ith word, hiFor the hidden state vector corresponding to the ith word, wyiAnd hiHave the same number of component amounts;
s103, calculating the similarity value of the first ambiguity label sequence and the second ambiguity label sequence according to a preset similarity value calculation method, and judging whether the similarity value is greater than a preset similarity threshold value or not;
and S104, if the similarity degree value is larger than a preset similarity degree threshold value, acquiring the entity words marked as ambiguity in the second ambiguity marking sequence.
As described above, the ambiguity labeling processing on the first sentence is realized, so that the entity words labeled as ambiguity in the first sentence are obtained. The method and the device adopt an ambiguity annotation model with a special structure to carry out ambiguity annotation. The ambiguity labeling model is composed of a bidirectional encoder and a support vector machine, so that the ambiguity labeling accuracy is improved. The support vector machine is a model which can be used for labeling, but the input characteristics of the support vector machine need to be manually set, so that the accuracy is low, and therefore the hidden state vector set of the last layer of conversion unit of the bidirectional encoder is used as the input of the support vector machine, so that the accuracy is improved. The bi-directional encoder includes a multi-layered conversion unit, wherein the conversion unit is formed of a plurality of encoders and decoders, and is capable of outputting a first ambiguous annotation sequence for accurate reference to a second ambiguous annotation sequence. And then calculating a similarity degree value between the first ambiguity labeling sequence and the second ambiguity labeling sequence, if the similarity degree value is greater than a preset similarity degree threshold value, indicating that the labeling of the ambiguity labeling model is accurate, and acquiring the entity words labeled as ambiguity in the second ambiguity labeling sequence. The calculating of the similarity degree value between the first ambiguous annotation sequence and the second ambiguous annotation sequence may be any method, for example, a calculating method based on cosine similarity is adopted.
In one embodiment, the step S2 of selecting the specific standard sentence from the preset standard sentence database according to the preset standard sentence selection method includes:
s201, according to a formula:
Figure GDA0003412776050000111
calculating a sentence similarity value sim of the first sentence and a standard sentence in the standard sentence database, wherein A is a word frequency vector of the first sentence, B is the word frequency vector of the standard sentence, and Ai is the number of times of the ith word of the first sentence appearing in the whole sentence; bi is the frequency of the ith word of the standard sentence appearing in the whole sentence;
s202, judging whether a standard sentence with the sentence similarity value sim larger than a preset sentence similarity threshold exists in the standard sentence database;
and S203, if the sentence similarity value sim is greater than the preset sentence similarity threshold value, marking the standard sentence as the specified standard sentence.
As described above, the slave pre-stage is realizedAnd selecting the specified standard sentence from the standard sentence database. The more similar the specified standard sentence is to the first sentence, the better the final disambiguation. The application is based on the formula:
Figure GDA0003412776050000112
calculating a sentence similarity value sim of the first sentence and a standard sentence in the standard sentence database; judging whether a standard sentence with the sentence similarity value sim larger than a preset sentence similarity threshold exists in the standard sentence database; and if so, marking the standard sentence with the sentence similarity value sim being larger than a preset sentence similarity threshold value as a specified standard sentence. The sentence similarity value sim is used for measuring the similarity between two sentences, the maximum value of the sentence similarity value sim is 1, and when the value of the sentence similarity value sim is 1, the two sentences are shown to have identical words. Accordingly, a specified standard sentence similar to the first sentence is selected. The term frequency vector is formed by using the occurrence frequency of each term as the numerical value of a component vector, for example, a sentence is: i say i want to book, then it has four words (i, say, want, book) and the word frequency vector formed is (2, 1, 1, 1).
In one embodiment, the step S3 of calculating the first distance between the first sentence and the specified standard sentence according to a preset distance calculation formula includes:
s301, acquiring a first word vector sequence I corresponding to the first sentence and a second word vector sequence R corresponding to the specified standard sentence by inquiring a preset word vector library;
s302, according to a formula:
Figure GDA0003412776050000113
calculating a first distance D between the first sentence and the specified standard sentence, wherein | I | is a number of words in the first word vector sequence; | R | is the number of words in the second word vector sequence; w is a word vector; alpha is an amplification coefficient for adjusting cosine similarity between two word vectors; max (α × cosDis (w, R))The maximum value in the cosine similarity between the word vectors w corresponding to all the words in the second word vector sequence R and the word vectors w corresponding to all the words in the first word vector sequence I is calculated.
As described above, calculating a first distance between the first sentence and the specified standard sentence is achieved. The word vector library stores word vectors, and the word vectors are used for converting words into vector forms so as to be convenient for a computer to understand. The word vector library can be obtained by using an existing database or by training a pre-collected language set by using a word vector training tool word2 vec. Then according to the formula:
Figure GDA0003412776050000121
a first distance D between the first sentence and the specified standard sentence is calculated. Substituting the first word vector sequence I corresponding to the first sentence and the second word vector sequence R corresponding to the specified standard sentence into the formula to obtain a first distance D between the first sentence and the specified standard sentence.
In an embodiment, if the first distance is smaller than a preset first distance threshold, the obtaining a designated intention recognition model corresponding to a designated standard sentence according to a corresponding relationship between a preset standard sentence and an intention recognition model, where the designated intention recognition model is trained using sample data, and the sample data is only composed of sentences labeled as designated type intents before step S4, includes:
s31, acquiring a plurality of pre-collected sample data, and dividing the sample data into training data and test data; wherein the sample data is a sentence labeled as a specified type intention;
s32, inputting training data into a preset neural network model for training, wherein the training adopts a random gradient descent method to obtain an intermediate intention recognition model;
s33, verifying the intermediate intention recognition model by adopting the test data, and judging whether the verification is passed;
and S34, if the verification is passed, marking the intermediate intention identification model as the designated intention identification model.
As described above, training a specified intent recognition model is achieved. The method and the device adopt sample data for training, the sample data is only composed of sentences marked as appointed type intents, so that the quantity of training data is reduced, only one intention type needs to be identified, a complex multi-classification task is converted into a simple two-classification task, and the identification accuracy and speed are improved. Wherein the neural network model is, for example: such as VGG16 model, ResNet50 model, DPN131 model, inclusion v3 model, etc. The stochastic gradient descent method refers to randomly sampling some training data for training, and can solve the problem of slow training speed caused by a large amount of training data. And verifying the intermediate intention recognition model by adopting the test data, and if the verification is passed, marking the intermediate intention recognition model as the specified intention recognition model.
In one embodiment, the step of determining whether the recognition result is a successful recognition step S6 includes:
s61, if the recognition result is that the recognition is failed, acquiring an alternative standard sentence from a plurality of specified standard sentences, wherein a second distance between the alternative standard sentence and the first sentence is greater than the first distance threshold and smaller than a preset second distance threshold;
s62, acquiring an alternative intention recognition model corresponding to the alternative standard sentence according to the corresponding relation between the preset standard sentence and the intention recognition model;
s63, inputting the first sentence into the alternative intention recognition model for operation, so as to obtain a second recognition result output by the alternative intention recognition model, wherein the second recognition result comprises recognition success or recognition failure;
s64, judging whether the second identification result is successful;
and S65, if the second recognition result is successful recognition, acquiring an alternative entity meaning corresponding to the first sentence according to a preset corresponding relation of the first sentence, the standard sentence, the intention recognition model and the entity meaning, and carrying out disambiguation labeling operation on the first sentence, so that the entity words labeled as ambiguity are labeled with the alternative entity meaning.
As described above, re-recognition of intent using an alternative intent recognition model is enabled. Since the intention recognition model of the present application is a small-volume model, only one kind of intention type can be recognized, there is a case where the designated intention recognition model fails in recognition. At this time, if an appropriate intention recognition model can be used to successfully recognize the first sentence, the intention type can still be recognized. This application adopts the mode of adjusting the distance threshold value in order to obtain suitable model, specifically: acquiring an alternative standard sentence from a plurality of specified standard sentences, wherein a second distance between the alternative standard sentence and the first sentence is greater than the first distance threshold and smaller than a preset second distance threshold; and acquiring an alternative intention recognition model corresponding to the alternative standard sentence according to the corresponding relation between the preset standard sentence and the intention recognition model. If the alternative intention recognition model can successfully recognize, the purpose of disambiguation can also be achieved, accordingly, according to the preset corresponding relation of the first sentence, the standard sentence, the intention recognition model and the entity meaning, the alternative entity meaning corresponding to the first sentence is obtained, and disambiguation labeling operation is carried out on the first sentence, so that the entity words marked as ambiguity are labeled with the alternative entity meaning.
In one embodiment, after the step S64 of determining whether the second recognition result is a successful recognition, the method includes:
s641, if the second recognition result is recognition failure, acquiring the number of the specified standard sentences;
s642, judging whether the number of the specified standard sentences is larger than a preset number threshold value;
s643, if the number of the specified standard sentences is not larger than a preset number threshold, executing annotation modification operation, wherein the annotation modification operation is used for modifying the annotation of the entity words marked as ambiguity into unambiguous annotation.
As described above, annotation feedback is implemented. If the second recognition result is recognition failure and the number of the specified standard sentences is not greater than the preset number threshold, it indicates that the first sentence has only one intention, i.e. the first sentence has no ambiguity, and therefore the aforementioned ambiguity label is not accurate, and accordingly, a label modification operation is performed, wherein the label modification operation is used for modifying the label of the entity word labeled as ambiguity into an unambiguous label. Therefore, the ambiguity label error can be prevented, and the ambiguity label can be quickly corrected.
The entity disambiguation method based on the intention recognition model obtains a first sentence to be disambiguated, and obtains entity words marked as ambiguity in the first sentence; selecting a specified standard sentence; calculating a first distance between the first sentence and the specified standard sentence; if the first distance is smaller than a preset first distance threshold, acquiring a designated intention recognition model; inputting the first sentence into the designated intention recognition model for operation so as to obtain a recognition result, wherein the designated intention recognition model is trained by sample data, and the sample data only consists of sentences marked as designated type intents; and if the recognition result is successful, acquiring the designated entity meaning corresponding to the first sentence, and carrying out disambiguation labeling operation on the first sentence, so that the entity words labeled as ambiguity are labeled with the designated entity meaning. Thus, in the disambiguation process, a new dimension (intention identification) is introduced, thereby improving the accuracy of entity disambiguation.
Referring to fig. 2, an embodiment of the present application provides an entity disambiguation apparatus based on an intent recognition model, including:
an entity word obtaining unit 10, configured to obtain a first sentence to be disambiguated, and perform an ambiguity tagging process on the first sentence according to a preset ambiguity tagging method, so as to obtain an entity word tagged as an ambiguity in the first sentence;
a designated standard sentence acquisition unit 20 for selecting a designated standard sentence from a preset standard sentence database according to a preset standard sentence selection method;
a first distance determining unit 30, configured to calculate a first distance between the first sentence and the specified standard sentence according to a preset distance calculation formula, and determine whether the first distance is smaller than a preset first distance threshold;
a designated intention recognition model obtaining unit 40, configured to, if the first distance is smaller than a preset first distance threshold, obtain a designated intention recognition model corresponding to a preset standard sentence according to a correspondence between the preset standard sentence and an intention recognition model, where the designated intention recognition model is trained using sample data, and the sample data is composed of only sentences labeled as designated type intents;
a recognition result obtaining unit 50, configured to input the first sentence into the designated intention recognition model for operation, so as to obtain a recognition result output by the designated intention recognition model, where the recognition result includes a recognition success or a recognition failure;
an identification result judging unit 60 for judging whether the identification result is successful;
and a designated entity meaning labeling unit 70, configured to, if the recognition result is that the recognition is successful, obtain a designated entity meaning corresponding to the first sentence according to a preset correspondence relationship between the first sentence, the standard sentence, the intention recognition model, and the entity meaning, and perform a disambiguation labeling operation on the first sentence, so that the entity word labeled as the ambiguity is labeled with the designated entity meaning.
The operations performed by the above units are in one-to-one correspondence with the steps of the entity disambiguation method based on the intent recognition model according to the foregoing embodiment, and are not described herein again.
In one embodiment, the entity word acquiring unit 10 includes:
the bidirectional encoder processing subunit is configured to input the first sentence into a bidirectional encoder in a preset ambiguous annotation model for processing, obtain a first ambiguous annotation sequence corresponding to each word in the first sentence one to one, and obtain a hidden state vector set of a last layer of conversion units of the bidirectional encoder, where the ambiguous annotation model is composed of the bidirectional encoder and a support vector machine, and the bidirectional encoder includes multiple layers of conversion units;
a second ambiguous annotation sequence obtaining subunit, configured to input the hidden state vector set into the support vector machine for operation, so as to obtain a second ambiguous annotation sequence corresponding to each word of the first sentence one by one, where a function used in the operation of the support vector machine is
Figure GDA0003412776050000161
Wherein
Figure GDA0003412776050000162
Is the labeled value corresponding to the ith word of the first sentence, y is an independent variable, yi is the label corresponding to the ith word of the first sentence, wyiIs the parameter vector corresponding to the ith word, hiFor the hidden state vector corresponding to the ith word, wyiAnd hiHave the same number of component amounts;
a similarity degree value judging subunit, configured to calculate, according to a preset similarity degree value calculation method, a similarity degree value between the first ambiguous label sequence and the second ambiguous label sequence, and judge whether the similarity degree value is greater than a preset similarity degree threshold;
and an entity word acquiring subunit, configured to acquire an entity word labeled as an ambiguity in the second ambiguity labeling sequence if the similarity degree value is greater than a preset similarity degree threshold.
The operations performed by the sub-units correspond to the steps of the entity disambiguation method based on the intent recognition model in the foregoing embodiment one by one, and are not described herein again.
In one embodiment, the specified standard sentence acquisition unit 20 includes:
sentence similarity value sim calculation subunitFor use in accordance with the formula:
Figure GDA0003412776050000163
calculating a sentence similarity value sim of the first sentence and a standard sentence in the standard sentence database, wherein A is a word frequency vector of the first sentence, B is the word frequency vector of the standard sentence, and Ai is the number of times of the ith word of the first sentence appearing in the whole sentence; bi is the frequency of the ith word of the standard sentence appearing in the whole sentence;
a sentence similarity value sim judging subunit, configured to judge whether a standard sentence with the sentence similarity value sim being greater than a preset sentence similarity threshold exists in the standard sentence database;
and the specified standard sentence marking subunit is used for marking the standard sentence with the sentence similarity value sim being larger than a preset sentence similarity threshold value as a specified standard sentence if the specified standard sentence exists.
The operations performed by the sub-units correspond to the steps of the entity disambiguation method based on the intent recognition model in the foregoing embodiment one by one, and are not described herein again.
In one embodiment, the first distance determining unit 30 includes:
a word vector library query subunit, configured to obtain a first word vector sequence I corresponding to the first sentence and obtain a second word vector sequence R corresponding to the specified standard sentence by querying a preset word vector library;
a first distance D calculation subunit configured to:
Figure GDA0003412776050000171
calculating a first distance D between the first sentence and the specified standard sentence, wherein | I | is a number of words in the first word vector sequence; | R | is the number of words in the second word vector sequence; w is a word vector; alpha is an amplification coefficient for adjusting cosine similarity between two word vectors; max (α × cosDis (w, R)) is the calculation of all words in the second word vector sequence RThe maximum value of the cosine similarity between the word vector w corresponding to the word and the word vectors w corresponding to all the words in the first word vector sequence I.
The operations performed by the sub-units correspond to the steps of the entity disambiguation method based on the intent recognition model in the foregoing embodiment one by one, and are not described herein again.
In one embodiment, the apparatus comprises:
the system comprises a sample data dividing unit, a data processing unit and a data processing unit, wherein the sample data dividing unit is used for acquiring a plurality of pre-collected sample data and dividing the sample data into training data and test data; wherein the sample data is a sentence labeled as a specified type intention;
the intermediate intention recognition model acquisition unit is used for inputting training data into a preset neural network model for training, wherein the training adopts a random gradient descent method so as to obtain an intermediate intention recognition model;
the verification passing judgment unit is used for verifying the intermediate intention identification model by adopting the test data and judging whether the verification passes;
and the designated intention recognition model marking unit is used for marking the intermediate intention recognition model as the designated intention recognition model if the verification is passed.
The operations performed by the above units are in one-to-one correspondence with the steps of the entity disambiguation method based on the intent recognition model according to the foregoing embodiment, and are not described herein again.
In one embodiment, the specified standard sentence is present in a plurality, and the apparatus includes:
a candidate standard sentence acquisition unit, configured to acquire a candidate standard sentence from a plurality of specified standard sentences if the recognition result is a recognition failure, where a second distance between the candidate standard sentence and the first sentence is greater than the first distance threshold and smaller than a preset second distance threshold;
the system comprises an alternative intention recognition model acquisition unit, a judgment unit and a judgment unit, wherein the alternative intention recognition model acquisition unit is used for acquiring an alternative intention recognition model corresponding to an alternative standard sentence according to the corresponding relation between a preset standard sentence and an intention recognition model;
a second recognition result obtaining unit, configured to input the first sentence into the alternative intention recognition model for operation, so as to obtain a second recognition result output by the alternative intention recognition model, where the second recognition result includes a recognition success or a recognition failure;
a second identification result judgment unit, configured to judge whether the second identification result is successful;
and the candidate entity meaning marking unit is used for acquiring a candidate entity meaning corresponding to the first sentence according to a preset corresponding relation of the first sentence, the standard sentence, the intention recognition model and the entity meaning if the second recognition result is successful in recognition, and carrying out disambiguation marking operation on the first sentence, so that the entity words marked as the ambiguity are marked with the candidate entity meaning.
The operations performed by the above units are in one-to-one correspondence with the steps of the entity disambiguation method based on the intent recognition model according to the foregoing embodiment, and are not described herein again.
In one embodiment, the apparatus comprises:
a quantity obtaining unit, configured to obtain the quantity of the specified standard sentences if the second recognition result is a recognition failure;
a quantity threshold value judging unit, configured to judge whether the quantity of the specified standard sentences is greater than a preset quantity threshold value;
and the annotation modifying unit is used for executing annotation modifying operation if the number of the specified standard sentences is not greater than a preset number threshold, wherein the annotation modifying operation is used for modifying the annotation of the entity words marked as ambiguity into unambiguous annotation.
The operations performed by the above units are in one-to-one correspondence with the steps of the entity disambiguation method based on the intent recognition model according to the foregoing embodiment, and are not described herein again.
The entity disambiguation device based on the intention recognition model acquires a first sentence to be disambiguated, and acquires entity words marked as ambiguity in the first sentence; selecting a specified standard sentence; calculating a first distance between the first sentence and the specified standard sentence; if the first distance is smaller than a preset first distance threshold, acquiring a designated intention recognition model; inputting the first sentence into the designated intention recognition model for operation so as to obtain a recognition result, wherein the designated intention recognition model is trained by sample data, and the sample data only consists of sentences marked as designated type intents; and if the recognition result is successful, acquiring the designated entity meaning corresponding to the first sentence, and carrying out disambiguation labeling operation on the first sentence, so that the entity words labeled as ambiguity are labeled with the designated entity meaning. Thus, in the disambiguation process, a new dimension (intention identification) is introduced, thereby improving the accuracy of entity disambiguation.
Referring to fig. 3, an embodiment of the present invention further provides a computer device, where the computer device may be a server, and an internal structure of the computer device may be as shown in the figure. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the computer designed processor is used to provide computational and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data for an entity disambiguation method based on an intent recognition model. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method of entity disambiguation based on an intent recognition model.
The processor executes the entity disambiguation method based on the intention recognition model, wherein the steps included in the method correspond to the steps of executing the entity disambiguation method based on the intention recognition model in the foregoing embodiment one to one, and are not described herein again.
It will be understood by those skilled in the art that the structures shown in the drawings are only block diagrams of some of the structures associated with the embodiments of the present application and do not constitute a limitation on the computer apparatus to which the embodiments of the present application may be applied.
The computer equipment acquires a first sentence to be disambiguated, and acquires entity words marked as ambiguity in the first sentence; selecting a specified standard sentence; calculating a first distance between the first sentence and the specified standard sentence; if the first distance is smaller than a preset first distance threshold, acquiring a designated intention recognition model; inputting the first sentence into the designated intention recognition model for operation so as to obtain a recognition result, wherein the designated intention recognition model is trained by sample data, and the sample data only consists of sentences marked as designated type intents; and if the recognition result is successful, acquiring the designated entity meaning corresponding to the first sentence, and carrying out disambiguation labeling operation on the first sentence, so that the entity words labeled as ambiguity are labeled with the designated entity meaning. Thus, in the disambiguation process, a new dimension (intention identification) is introduced, thereby improving the accuracy of entity disambiguation.
An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the method for entity disambiguation based on an intent recognition model is implemented, where the steps included in the method correspond to the steps of implementing the entity disambiguation method based on an intent recognition model in the foregoing embodiment one to one, and are not described herein again.
The computer-readable storage medium of the application acquires a first sentence to be disambiguated, and acquires entity words marked as ambiguity in the first sentence; selecting a specified standard sentence; calculating a first distance between the first sentence and the specified standard sentence; if the first distance is smaller than a preset first distance threshold, acquiring a designated intention recognition model; inputting the first sentence into the designated intention recognition model for operation so as to obtain a recognition result, wherein the designated intention recognition model is trained by sample data, and the sample data only consists of sentences marked as designated type intents; and if the recognition result is successful, acquiring the designated entity meaning corresponding to the first sentence, and carrying out disambiguation labeling operation on the first sentence, so that the entity words labeled as ambiguity are labeled with the designated entity meaning. Thus, in the disambiguation process, a new dimension (intention identification) is introduced, thereby improving the accuracy of entity disambiguation.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium provided herein and used in the examples may include non-volatile and/or volatile memory. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), double-rate SDRAM (SSRSDRAM), Enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and bus dynamic RAM (RDRAM).
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, apparatus, article, or method that includes the element.
The above description is only a preferred embodiment of the present application, and not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application, or which are directly or indirectly applied to other related technical fields, are also included in the scope of the present application.

Claims (7)

1. An entity disambiguation method based on an intent recognition model, comprising:
acquiring a first sentence to be disambiguated, and performing ambiguity labeling processing on the first sentence according to a preset ambiguity labeling method, so as to acquire entity words labeled as ambiguity in the first sentence;
selecting a specified standard sentence from a preset standard sentence database according to a preset standard sentence selection method;
calculating a first distance between the first sentence and the specified standard sentence according to a preset distance calculation formula, and judging whether the first distance is smaller than a preset first distance threshold value;
if the first distance is smaller than a preset first distance threshold, acquiring a designated intention recognition model corresponding to a designated standard sentence according to the corresponding relation between a preset standard sentence and an intention recognition model, wherein the designated intention recognition model is formed by training sample data, and the sample data only consists of sentences marked as designated type intents;
inputting the first sentence into the designated intention recognition model for operation, so as to obtain a recognition result output by the designated intention recognition model, wherein the recognition result comprises recognition success or recognition failure;
judging whether the identification result is successful or not;
if the recognition result is successful, acquiring a designated entity meaning corresponding to a first sentence according to a preset corresponding relation of the first sentence, a standard sentence, an intention recognition model and an entity meaning, and carrying out disambiguation labeling operation on the first sentence, so that the entity words labeled as ambiguities are labeled with the designated entity meaning; wherein the content of the first and second substances,
the step of performing ambiguity labeling processing on the first sentence according to a preset ambiguity labeling method to obtain an entity word labeled as ambiguity in the first sentence includes:
inputting the first sentence into a bidirectional encoder in a preset ambiguity labeling model for processing to obtain a first ambiguity labeling sequence corresponding to each word in the first sentence one to one, and obtaining a hidden state vector set of a last layer of conversion units of the bidirectional encoder, wherein the ambiguity labeling model is composed of the bidirectional encoder and a support vector machine, and the bidirectional encoder comprises a plurality of layers of conversion units;
inputting the hidden state vector set into the support vector machine for operation to obtain a second ambiguous annotation sequence corresponding to each word of the first sentence one by one, wherein a function used by the support vector machine for operation is
Figure FDA0003412776040000011
Wherein
Figure FDA0003412776040000012
Is the labeled value corresponding to the ith word of the first sentence, y is an independent variable, yi is the label corresponding to the ith word of the first sentence, wyiIs the parameter vector corresponding to the ith word, hiFor the hidden state vector corresponding to the ith word, wyiAnd hiHave the same number of component amounts;
calculating the similarity degree value of the first ambiguity marking sequence and the second ambiguity marking sequence according to a preset similarity degree value calculation method, and judging whether the similarity degree value is greater than a preset similarity degree threshold value or not;
if the similarity degree value is larger than a preset similarity degree threshold value, acquiring entity words marked as ambiguity in the second ambiguity marking sequence;
the step of selecting the specified standard sentence from the preset standard sentence database according to the preset standard sentence selection method comprises the following steps:
according to the formula:
Figure FDA0003412776040000023
calculating a sentence similarity value sim of the first sentence and a standard sentence in the standard sentence database, wherein A is a word frequency vector of the first sentence, B is the word frequency vector of the standard sentence, and Ai is the number of times of the ith word of the first sentence appearing in the whole sentence; bi is the frequency of the ith word of the standard sentence appearing in the whole sentence;
judging whether a standard sentence with the sentence similarity value sim larger than a preset sentence similarity threshold exists in the standard sentence database;
if yes, marking the standard sentence with the sentence similarity value sim larger than a preset sentence similarity threshold value as a specified standard sentence;
the step of calculating the first distance between the first sentence and the specified standard sentence according to a preset distance calculation formula includes:
acquiring a first word vector sequence I corresponding to the first sentence and a second word vector sequence R corresponding to the specified standard sentence by inquiring a preset word vector library;
according to the formula:
Figure FDA0003412776040000022
calculating a first distance D between the first sentence and the specified standard sentence, wherein | I | is a number of words in the first word vector sequence; | R | is the number of words in the second word vector sequence; w is a word vector; alpha is an amplification coefficient for adjusting cosine similarity between two word vectors; max (α × cosDis (w, R)) is the calculation of the word vectors w corresponding to all words in the second word vector sequence R and all words in the first word vector sequence IThe maximum value of the cosine similarity of the corresponding word vector w.
2. The entity disambiguation method according to claim 1, wherein if the first distance is smaller than a preset first distance threshold, the method further comprises, according to a correspondence between a preset standard sentence and the intent recognition model, obtaining a designated intent recognition model corresponding to the designated standard sentence, wherein the designated intent recognition model is trained using sample data, and the step of the sample data consisting of only sentences labeled as designated type intents is preceded by the step of:
acquiring a plurality of pre-collected sample data, and dividing the sample data into training data and test data; wherein the sample data is a sentence labeled as a specified type intention;
inputting training data into a preset neural network model for training, wherein the training adopts a random gradient descent method so as to obtain an intermediate intention recognition model;
verifying the intermediate intention recognition model by adopting the test data, and judging whether the verification is passed;
and if the verification is passed, marking the intermediate intention identification model as the designated intention identification model.
3. The entity disambiguation method according to claim 1, wherein a plurality of said specified standard sentences exist, and said determining whether said recognition result is a recognition success includes:
if the recognition result is recognition failure, acquiring an alternative standard sentence from a plurality of specified standard sentences, wherein a second distance between the alternative standard sentence and the first sentence is greater than the first distance threshold and smaller than a preset second distance threshold;
acquiring an alternative intention recognition model corresponding to the alternative standard sentence according to the corresponding relation between a preset standard sentence and an intention recognition model;
inputting the first sentence into the alternative intention recognition model for operation, so as to obtain a second recognition result output by the alternative intention recognition model, wherein the second recognition result comprises recognition success or recognition failure;
judging whether the second identification result is successful;
if the second recognition result is successful, acquiring the alternative entity meaning corresponding to the first sentence according to the preset corresponding relation of the first sentence, the standard sentence, the intention recognition model and the entity meaning, and carrying out disambiguation labeling operation on the first sentence, so that the entity words labeled as the ambiguity are labeled with the alternative entity meaning.
4. The entity disambiguation method according to claim 3, wherein said determining whether said second recognition result was successfully recognized comprises:
if the second recognition result is recognition failure, acquiring the number of the specified standard sentences;
judging whether the number of the specified standard sentences is greater than a preset number threshold value or not;
and if the number of the specified standard sentences is not greater than a preset number threshold, executing a label modification operation, wherein the label modification operation is used for modifying the label of the entity word labeled as ambiguous into an unambiguous label.
5. An entity disambiguation apparatus based on an intent recognition model, comprising:
the entity word acquisition unit is used for acquiring a first sentence to be disambiguated and carrying out ambiguity labeling processing on the first sentence according to a preset ambiguity labeling method so as to acquire an entity word labeled as ambiguity in the first sentence;
a designated standard sentence acquisition unit for selecting a designated standard sentence from a preset standard sentence database according to a preset standard sentence selection method;
a first distance judgment unit, configured to calculate a first distance between the first sentence and the specified standard sentence according to a preset distance calculation formula, and judge whether the first distance is smaller than a preset first distance threshold;
a designated intention recognition model obtaining unit, configured to obtain, if the first distance is smaller than a preset first distance threshold, a designated intention recognition model corresponding to a preset standard sentence according to a correspondence between the preset standard sentence and an intention recognition model, where the designated intention recognition model is trained using sample data, and the sample data is composed of only sentences labeled as designated types of intentions;
a recognition result obtaining unit, configured to input the first sentence into the designated intention recognition model for operation, so as to obtain a recognition result output by the designated intention recognition model, where the recognition result includes a recognition success or a recognition failure;
the identification result judging unit is used for judging whether the identification result is successful or not;
a designated entity meaning labeling unit, configured to, if the recognition result is that recognition is successful, obtain a designated entity meaning corresponding to the first sentence according to a preset correspondence relationship between the first sentence, the standard sentence, the intention recognition model, and the entity meaning, and perform disambiguation labeling operation on the first sentence, so that the entity word labeled as ambiguity is labeled with the designated entity meaning; wherein the content of the first and second substances,
the entity word acquiring unit includes:
the bidirectional encoder processing subunit is configured to input the first sentence into a bidirectional encoder in a preset ambiguous annotation model for processing, obtain a first ambiguous annotation sequence corresponding to each word in the first sentence one to one, and obtain a hidden state vector set of a last layer of conversion units of the bidirectional encoder, where the ambiguous annotation model is composed of the bidirectional encoder and a support vector machine, and the bidirectional encoder includes multiple layers of conversion units;
the second ambiguous annotation sequence gets a sub-unit,the function used for inputting the hidden state vector set into the support vector machine for operation to obtain a second ambiguity labeling sequence corresponding to each word of the first sentence one by one, wherein the function used when the support vector machine performs operation is
Figure FDA0003412776040000051
Wherein
Figure FDA0003412776040000052
Is the labeled value corresponding to the ith word of the first sentence, y is an independent variable, yi is the label corresponding to the ith word of the first sentence, wyiIs the parameter vector corresponding to the ith word, hiFor the hidden state vector corresponding to the ith word, wyiAnd hiHave the same number of component amounts;
a similarity degree value judging subunit, configured to calculate, according to a preset similarity degree value calculation method, a similarity degree value between the first ambiguous label sequence and the second ambiguous label sequence, and judge whether the similarity degree value is greater than a preset similarity degree threshold;
an entity word obtaining subunit, configured to obtain, if the similarity degree value is greater than a preset similarity degree threshold, an entity word labeled as an ambiguity in the second ambiguity labeling sequence;
the specified standard sentence acquisition unit includes:
a sentence similarity value sim calculation subunit configured to:
Figure FDA0003412776040000053
calculating a sentence similarity value sim of the first sentence and a standard sentence in the standard sentence database, wherein A is a word frequency vector of the first sentence, B is the word frequency vector of the standard sentence, and Ai is the number of times of the ith word of the first sentence appearing in the whole sentence; bi is the frequency of the ith word of the standard sentence appearing in the whole sentence;
a sentence similarity value sim judging subunit, configured to judge whether a standard sentence with the sentence similarity value sim being greater than a preset sentence similarity threshold exists in the standard sentence database;
a specified standard sentence marking subunit, configured to mark, if the specified standard sentence exists, the standard sentence with the sentence similarity value sim being greater than a preset sentence similarity threshold as a specified standard sentence;
the first distance determination unit includes:
a word vector library query subunit, configured to obtain a first word vector sequence I corresponding to the first sentence and obtain a second word vector sequence R corresponding to the specified standard sentence by querying a preset word vector library;
a first distance D calculation subunit configured to:
Figure FDA0003412776040000061
calculating a first distance D between the first sentence and the specified standard sentence, wherein | I | is a number of words in the first word vector sequence; | R | is the number of words in the second word vector sequence; w is a word vector; alpha is an amplification coefficient for adjusting cosine similarity between two word vectors; max (α × cosDis (w, R)) is the maximum value in calculating the cosine similarity of the word vectors w corresponding to all words in the second word vector sequence R and the word vectors w corresponding to all words in the first word vector sequence I.
6. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 4 when executing the computer program.
7. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 4.
CN201910978260.9A 2019-10-15 2019-10-15 Entity disambiguation method and device based on intention recognition model and computer equipment Active CN111079429B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201910978260.9A CN111079429B (en) 2019-10-15 2019-10-15 Entity disambiguation method and device based on intention recognition model and computer equipment
PCT/CN2020/093428 WO2021073119A1 (en) 2019-10-15 2020-05-29 Method and apparatus for entity disambiguation based on intention recognition model, and computer device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910978260.9A CN111079429B (en) 2019-10-15 2019-10-15 Entity disambiguation method and device based on intention recognition model and computer equipment

Publications (2)

Publication Number Publication Date
CN111079429A CN111079429A (en) 2020-04-28
CN111079429B true CN111079429B (en) 2022-03-18

Family

ID=70310388

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910978260.9A Active CN111079429B (en) 2019-10-15 2019-10-15 Entity disambiguation method and device based on intention recognition model and computer equipment

Country Status (2)

Country Link
CN (1) CN111079429B (en)
WO (1) WO2021073119A1 (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111079429B (en) * 2019-10-15 2022-03-18 平安科技(深圳)有限公司 Entity disambiguation method and device based on intention recognition model and computer equipment
CN111737962A (en) * 2020-06-24 2020-10-02 平安科技(深圳)有限公司 Entity revision method, entity revision device, computer equipment and readable storage medium
CN112650859A (en) * 2020-12-29 2021-04-13 北京欧拉认知智能科技有限公司 User intention identification method, user intention identification equipment and model construction method
CN113157890A (en) * 2021-04-25 2021-07-23 深圳壹账通智能科技有限公司 Intelligent question and answer method and device, electronic equipment and readable storage medium
CN113761218B (en) * 2021-04-27 2024-05-10 腾讯科技(深圳)有限公司 Method, device, equipment and storage medium for entity linking
CN113269244A (en) * 2021-05-18 2021-08-17 上海睿翎法律咨询服务有限公司 Disambiguation processing method, system, device, processor and storage medium thereof aiming at cross-enterprise personnel rename in business and commerce registration information
CN115238701B (en) * 2022-09-21 2023-01-10 北京融信数联科技有限公司 Multi-field named entity recognition method and system based on subword level adapter
CN115599900B (en) * 2022-12-12 2023-03-21 深圳市人马互动科技有限公司 Distribution processing method of ambiguous user input and related device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105677639A (en) * 2016-01-10 2016-06-15 齐鲁工业大学 English word sense disambiguation method based on phrase structure syntax tree
CN106407180A (en) * 2016-08-30 2017-02-15 北京奇艺世纪科技有限公司 Entity disambiguation method and apparatus
CN107861939A (en) * 2017-09-30 2018-03-30 昆明理工大学 A kind of domain entities disambiguation method for merging term vector and topic model

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9245015B2 (en) * 2013-03-08 2016-01-26 Accenture Global Services Limited Entity disambiguation in natural language text
CN110287283B (en) * 2019-05-22 2023-08-01 中国平安财产保险股份有限公司 Intention model training method, intention recognition method, device, equipment and medium
CN111079429B (en) * 2019-10-15 2022-03-18 平安科技(深圳)有限公司 Entity disambiguation method and device based on intention recognition model and computer equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105677639A (en) * 2016-01-10 2016-06-15 齐鲁工业大学 English word sense disambiguation method based on phrase structure syntax tree
CN106407180A (en) * 2016-08-30 2017-02-15 北京奇艺世纪科技有限公司 Entity disambiguation method and apparatus
CN107861939A (en) * 2017-09-30 2018-03-30 昆明理工大学 A kind of domain entities disambiguation method for merging term vector and topic model

Also Published As

Publication number Publication date
CN111079429A (en) 2020-04-28
WO2021073119A1 (en) 2021-04-22

Similar Documents

Publication Publication Date Title
CN111079429B (en) Entity disambiguation method and device based on intention recognition model and computer equipment
CN111160017B (en) Keyword extraction method, phonetics scoring method and phonetics recommendation method
CN109783604B (en) Information extraction method and device based on small amount of samples and computer equipment
CN110688853B (en) Sequence labeling method and device, computer equipment and storage medium
CN111563051B (en) Crawler-based data verification method and device, computer equipment and storage medium
CN111177345B (en) Intelligent question-answering method and device based on knowledge graph and computer equipment
CN110674319A (en) Label determination method and device, computer equipment and storage medium
CN111666399A (en) Intelligent question and answer method and device based on knowledge graph and computer equipment
WO2022116436A1 (en) Text semantic matching method and apparatus for long and short sentences, computer device and storage medium
CN110569486B (en) Sequence labeling method and device based on double architectures and computer equipment
CN111160032A (en) Named entity extraction method and device, electronic equipment and storage medium
CN113536735B (en) Text marking method, system and storage medium based on keywords
CN113449489B (en) Punctuation mark labeling method, punctuation mark labeling device, computer equipment and storage medium
CN111368506B (en) Text processing method and device
CN114595158A (en) Test case generation method, device, equipment and medium based on artificial intelligence
CN111124898B (en) Question-answering system testing method and device, computer equipment and storage medium
CN110555165B (en) Information identification method and device, computer equipment and storage medium
CN110413994B (en) Hot topic generation method and device, computer equipment and storage medium
CN112541739B (en) Method, device, equipment and medium for testing question-answer intention classification model
CN113255343A (en) Semantic identification method and device for label data, computer equipment and storage medium
CN112364620B (en) Text similarity judging method and device and computer equipment
CN113255351B (en) Sentence intention recognition method and device, computer equipment and storage medium
CN115345166A (en) Method, device, equipment and storage medium for identifying disease diagnosis name of medical text
CN114723986A (en) Text image matching method, device, equipment and storage medium
CN114756666A (en) Cross-modal retrieval method, device, equipment and storage medium based on artificial intelligence

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant