WO2021073119A1 - Method and apparatus for entity disambiguation based on intention recognition model, and computer device - Google Patents

Method and apparatus for entity disambiguation based on intention recognition model, and computer device Download PDF

Info

Publication number
WO2021073119A1
WO2021073119A1 PCT/CN2020/093428 CN2020093428W WO2021073119A1 WO 2021073119 A1 WO2021073119 A1 WO 2021073119A1 CN 2020093428 W CN2020093428 W CN 2020093428W WO 2021073119 A1 WO2021073119 A1 WO 2021073119A1
Authority
WO
WIPO (PCT)
Prior art keywords
sentence
preset
standard
word
entity
Prior art date
Application number
PCT/CN2020/093428
Other languages
French (fr)
Chinese (zh)
Inventor
张师琲
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2021073119A1 publication Critical patent/WO2021073119A1/en

Links

Images

Classifications

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

Definitions

  • This application relates to the field of artificial intelligence, and in particular to an entity disambiguation method, device, computer equipment and storage medium based on an intention recognition model.
  • Entity disambiguation is a key task in natural language processing. Since entity references (such as nouns) existing in massive data can usually correspond to multiple named entity concepts, this undoubtedly creates a great obstacle to entity disambiguation.
  • the task of entity disambiguation is to match these ambiguous entity references among a large number of candidate entities to match the corresponding target entities.
  • the inventor realizes that the accuracy of the current entity disambiguation scheme is insufficient. For example, using entity links for disambiguation requires linking the named entity to be disambiguated to the corresponding entity in the external knowledge base for disambiguation, so the accuracy depends on The records of external knowledge bases are not accurate enough to accurately distinguish entities in different contexts. Therefore, the accuracy of current entity disambiguation needs to be improved.
  • the main purpose of this application is to provide an entity disambiguation method, device, computer equipment and storage medium based on an intention recognition model, aiming to improve the accuracy of entity disambiguation.
  • this application proposes an entity disambiguation method based on an intention recognition model, which includes the following steps:
  • the preset standard sentence selection method select the designated standard sentence from the preset standard sentence database
  • the specified intent recognition model corresponding to the specified standard sentence is obtained according to the corresponding relationship between the preset standard sentence and the intent recognition model, wherein the specified intent recognition
  • the model is trained using sample data, and the sample data is only composed of sentences marked as a specified type of intent
  • the recognition result is successful, then according to the preset first sentence-standard sentence-intent recognition model-entity meaning corresponding relationship, the designated entity meaning corresponding to the first sentence is acquired, and the first sentence A disambiguation labeling operation is performed in the sentence, so that the entity word that is labeled as ambiguous is labeled with the specified entity meaning.
  • This application provides an entity disambiguation device based on an intention recognition model, including:
  • the entity word acquisition unit is used to acquire the first sentence to be disambiguated, and perform ambiguity labeling processing on the first sentence according to a preset ambiguity labeling method, so as to obtain the first sentence marked as ambiguous Entity words
  • the designated standard sentence acquisition unit is used to select the designated standard sentence from the preset standard sentence database according to the preset standard sentence selection method;
  • the first distance judgment unit is configured to calculate the first distance between the first sentence and the designated standard sentence according to a preset distance calculation formula, and determine whether the first distance is less than the preset first distance Threshold
  • a designated intent recognition model acquiring unit configured to, if the first distance is less than a preset first distance threshold, acquire the designated intent corresponding to the designated standard sentence according to the corresponding relationship between the preset standard sentence and the intent recognition model A recognition model, wherein the designated intent recognition model is trained using sample data, and the sample data is only composed of sentences marked as designated types of intents;
  • a recognition result obtaining unit configured to input the first sentence into the designated intent recognition model for calculation, thereby obtaining a recognition result output by the designated intent recognition model, wherein the recognition result includes recognition success or recognition failure;
  • a recognition result judging unit for judging whether the recognition result is a successful recognition
  • the designated entity meaning labeling unit is used to obtain the designated entity corresponding to the first sentence according to the preset correspondence relationship of the first sentence-standard sentence-intent recognition model-entity meaning Meaning, and perform a disambiguation labeling operation on the first sentence, so that the entity word labeled as ambiguous is labeled with the specified entity meaning.
  • the present application provides a computer device, including a memory and a processor, the memory stores a computer program, and the processor implements the steps of any one of the above methods when the computer program is executed.
  • the present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of any one of the methods described above are implemented.
  • the entity disambiguation method, device, computer equipment and storage medium based on the intention recognition model of the present application obtain the first sentence to be disambiguated, obtain the entity words marked as ambiguous in the first sentence; select the specified criteria Sentence; calculate the first distance between the first sentence and the specified standard sentence; if the first distance is less than the preset first distance threshold, obtain the specified intent recognition model; input the first sentence
  • the designated intent recognition model performs operations to obtain a recognition result, wherein the designated intent recognition model is trained using sample data, and the sample data is only composed of sentences marked as designated types of intents; if the recognition result For successful recognition, the meaning of the designated entity corresponding to the first sentence is obtained, and the disambiguation operation is performed on the first sentence, so that the entity word marked as ambiguous is marked with the designated entity meaning.
  • a new dimension intent recognition, is introduced to improve the accuracy of entity disambiguation.
  • Fig. 1 is a schematic flowchart of an entity disambiguation method based on an intention recognition model according to an embodiment of this application;
  • FIG. 2 is a schematic block diagram of the structure of an entity disambiguation apparatus based on an intention recognition model according to an embodiment of the application;
  • FIG. 3 is a schematic block diagram of the structure of a computer device according to an embodiment of the application.
  • an embodiment of the present application provides an entity disambiguation method based on an intention recognition model, including the following steps:
  • step S1 obtain the first sentence to be disambiguated, and perform ambiguity labeling processing on the first sentence according to the preset ambiguity labeling method, so as to obtain the first sentence marked as ambiguous Entity words.
  • entity disambiguation in this application is to obtain the true meaning of ambiguous entity words, so the ambiguous entity words need to be marked as ambiguous.
  • the preset ambiguity tagging method is, for example, that the first sentence is input into the bidirectional encoder in the preset ambiguity tagging model for processing, so that the first ambiguity corresponding to each word in the first sentence is one-to-one.
  • the ambiguity annotation model is composed of a two-way encoder and a support vector machine, and the two-way encoder includes a multi-layer conversion unit;
  • the set of hidden state vectors is input to the support vector machine for operation to obtain a second ambiguity tag sequence corresponding to each word in the first sentence one-to-one;
  • the first ambiguity is calculated according to a preset similarity value calculation method Mark the similarity value between the annotation sequence and the second ambiguous annotation sequence, and determine whether the similarity value is greater than a preset similarity threshold; if the similarity value is greater than the preset similarity threshold, obtain the first The entity words marked as ambiguous in the two-ambiguity tagging sequence.
  • the designated standard sentence is selected from the preset standard sentence database.
  • the standard sentence is used to select a suitable intent recognition model, so it is necessary to pick out the designated standard sentence that is similar to the first sentence.
  • the preset standard sentence selection method is, for example, according to the formula: Calculate the sentence similarity value sim between the first sentence and a standard sentence in the standard sentence database; determine whether the sentence similarity value sim is greater than the preset sentence similarity threshold in the standard sentence database Standard sentence
  • the standard sentence whose sentence similarity value sim is greater than the preset sentence similarity threshold is recorded as the designated standard sentence.
  • step S3 calculate the first distance between the first sentence and the specified standard sentence according to the preset distance calculation formula, and determine whether the first distance is less than the preset first distance threshold .
  • the first distance reflects the degree of similarity between the first sentence and the specified standard sentence. If the value of the first distance is smaller, the more similar is indicated. When the first sentence is exactly the same as the specified standard sentence, the The first distance is equal to zero.
  • the preset distance calculation formula is, for example, by querying a preset word vector library, obtaining a first word vector sequence I corresponding to the first sentence, and obtaining a second word vector sequence R corresponding to the specified standard sentence ; According to the formula:
  • the specified intent recognition model corresponding to the specified standard sentence is obtained according to the corresponding relationship between the preset standard sentence and the intent recognition model , wherein the designated intent recognition model is trained using sample data, and the sample data is only composed of sentences marked as designated types of intents. If the first distance is less than the preset first distance threshold, it indicates that there is an applicable intention recognition model, and according to the corresponding relationship between the preset standard sentence and the intention recognition model, the designated standard sentence corresponding to the designated standard sentence is obtained. Intent recognition model.
  • the designated intent recognition model used in this application is trained using sample data, and the sample data is only composed of sentences marked as designated types of intents, so that the size of the designated intent recognition model is smaller and the training data required is smaller. , It is easier to train, and the accuracy of intention recognition is higher for sentences within a limited range (that is, sentences similar to the specified standard sentence, such as the first sentence). Further, the sample data for training the specified intent recognition model consists of only a limited number of words, and the limited number of words is the same or similar to the words in the first sentence, so that the training is faster and the first sentence is more efficient.
  • Recognition is more accurate (because the number of words in the sample data is limited and is the same or similar to the words in the first sentence, so the sample data can find all training sentences by traversal method, so the first sentence must be in the training process Sentences that have appeared, so it is more accurate and faster to recognize the first sentence).
  • the first sentence is input into the designated intent recognition model to perform operations, so as to obtain a recognition result output by the designated intent recognition model, wherein the recognition result includes recognition success or recognition failure.
  • the designated intent recognition model can only recognize one type of intent (namely, the designated intent type), its successful recognition means that the first sentence is the designated intent type. If the recognition fails, other intent recognition models need to be adopted. Identify again.
  • step S6 it is determined whether the recognition result is successful. Because there are only two recognition results: recognition success or recognition failure.
  • recognition success it indicates that the first sentence is the designated intent type, otherwise, the intent type of the first sentence cannot be determined.
  • step S7 if the recognition result is successful, then according to the preset first sentence-standard sentence-intent recognition model-entity meaning correspondence relationship, the designated entity meaning corresponding to the first sentence is obtained , And perform a disambiguation labeling operation on the first sentence, so that the entity word labeled as ambiguous is labeled with the specified entity meaning.
  • Ambiguous entity words have different meanings in different intention contexts, and if the specific intention type can be identified, the exact meaning of ambiguous words can also be determined. Accordingly, this application obtains the specified entity meaning corresponding to the first sentence according to the preset correspondence relationship of the first sentence-standard sentence-intent recognition model-entity meaning, and disambiguates the first sentence Marking operation, so that the entity word marked as ambiguous is marked with the specified entity meaning. Therefore, the actual meaning of the entity words marked as ambiguous in the first sentence can be known from the meaning of the specified entity. For example, the first sentence is: My phone is broken, borrow your apple and use it.
  • the apple in the first sentence can be marked with the designated entity meaning (phone).
  • the step S1 of performing ambiguity labeling processing on the first sentence according to the preset ambiguity labeling method, so as to obtain the entity words marked as ambiguous in the first sentence includes:
  • the ambiguity annotation processing on the first sentence is implemented, so as to obtain the entity words marked as ambiguous in the first sentence.
  • This application uses an ambiguity annotation model with a special structure for ambiguity annotation.
  • the ambiguity labeling model is composed of a bidirectional encoder and a support vector machine, thereby improving the accuracy of ambiguity labeling.
  • the support vector machine is a model that can be used for labeling, but its input features need to be manually set, so the accuracy is low. Therefore, this application uses the hidden state vector set of the last layer of the conversion unit of the two-way encoder as the support vector machine The input improves the accuracy.
  • the bidirectional encoder includes a multi-layer conversion unit, wherein the conversion unit is composed of multiple encoders and decoders, and can output a first ambiguity annotation sequence, which is used as a reference for whether the second ambiguity annotation sequence is accurate. Then calculate the similarity value between the first ambiguous annotation sequence and the second ambiguous annotation sequence, and if the similarity value is greater than the preset similarity threshold, it indicates that the annotation of the ambiguous annotation model is accurate, and then the first ambiguous annotation sequence is obtained.
  • the entity words marked as ambiguous in the two-ambiguity tagging sequence may be any method, for example, a calculation method based on cosine similarity is adopted.
  • the step S2 of selecting a specified standard sentence from a preset standard sentence database according to a preset standard sentence selection method includes:
  • S202 Determine whether there is a standard sentence with the sentence similarity value sim greater than a preset sentence similarity threshold in the standard sentence database;
  • the specified standard sentence is selected from the preset standard sentence database.
  • This application is based on the formula: Calculate the sentence similarity value sim between the first sentence and a standard sentence in the standard sentence database; determine whether the sentence similarity value sim is greater than the preset sentence similarity threshold in the standard sentence database Standard sentence; if it exists, the standard sentence whose sentence similarity value sim is greater than the preset sentence similarity threshold is recorded as the designated standard sentence.
  • the sentence similarity value sim is used to measure the similarity between two sentences, and its maximum value is 1. When the value is 1, it indicates that the two sentences have exactly the same words.
  • the word frequency vector is composed of the number of occurrences of each word as the value of the sub-vector.
  • the sentence is: I say I want a book, then it has four words (I, say, want, book), which constitutes the word frequency
  • the vector is (2,1,1,1).
  • the step S3 of calculating the first distance between the first sentence and the designated standard sentence according to a preset distance calculation formula includes:
  • S301 Obtain a first word vector sequence I corresponding to the first sentence by querying a preset word vector library, and obtain a second word vector sequence R corresponding to the designated standard sentence;
  • the word vector library stores word vectors, which are used to convert words into vector forms to facilitate computer understanding.
  • the word vector database can be obtained by using an existing database, or by using the word vector training tool word2vec to train a pre-collected corpus. According to the formula:
  • the designated intent recognition corresponding to the designated standard sentence is obtained.
  • the training specified intent recognition model is realized.
  • This application uses sample data for training.
  • the sample data is only composed of sentences marked as specified types of intents, thereby reducing the amount of training data, and only one type of intent needs to be recognized, transforming complex multi-classification tasks It becomes a simple two-classification task, which improves the accuracy and speed of recognition.
  • the neural network model is, for example, VGG16 model, ResNet50 model, DPN131 model, InceptionV3 model, etc.
  • the stochastic gradient descent method refers to randomly sampling some training data for training, which can solve the problem of slow training speed caused by a large amount of training data.
  • the test data is then used to verify the intermediate intent recognition model, and if the verification is passed, the intermediate intent recognition is recorded as the designated intent recognition model.
  • the method includes:
  • the recognition result is recognition failure, obtain candidate standard sentences from a plurality of designated standard sentences, wherein the second distance between the candidate standard sentence and the first sentence is greater than the first sentence.
  • the distance threshold is and is smaller than the preset second distance threshold;
  • the second recognition result is that the recognition is successful, obtain the candidate entity meaning corresponding to the first sentence according to the preset correspondence relationship of the first sentence-standard sentence-intent recognition model-entity meaning, and A disambiguation labeling operation is performed on the first sentence, so that the entity words labeled as ambiguous are labeled with the candidate entity meaning.
  • the intent recognition model of the present application is a small volume model and can only recognize one type of intent, there are cases where the recognition of the designated intent recognition model fails.
  • the intent type can still be recognized.
  • This application adopts the method of adjusting the distance threshold to obtain a suitable model, specifically: obtaining candidate standard sentences from a plurality of designated standard sentences, wherein the second distance between the candidate standard sentence and the first sentence It is greater than the first distance threshold and less than the preset second distance threshold; according to the correspondence between the preset standard sentence and the intent recognition model, obtain the candidate intent recognition model corresponding to the candidate standard sentence.
  • the candidate intent recognition model can be successfully identified, it can also achieve the purpose of disambiguation. According to this, according to the preset first sentence-standard sentence-intent recognition model-entity meaning correspondence relationship, the first sentence is obtained Corresponding candidate entity meaning, and performing a disambiguation labeling operation on the first sentence, so that the entity word marked as ambiguous is marked with the candidate entity meaning.
  • the method includes:
  • S642 Determine whether the number of the designated standard sentences is greater than a preset number threshold
  • the second recognition result is recognition failure, and the number of specified standard sentences is not greater than the preset number threshold, it indicates that the first sentence has only one intention, that is, there is no ambiguity in the first sentence, so
  • the aforementioned ambiguous labeling is not accurate, and accordingly, a labeling modification operation is performed, wherein the labeling modification operation is used to modify the label of the entity word that is marked as ambiguous to an unambiguous label. Accordingly, the error of mislabeling of ambiguity can be prevented, and the ambiguity label can be corrected quickly.
  • an embodiment of the present application provides an entity disambiguation device based on an intention recognition model, including:
  • the entity word acquisition unit 10 is configured to acquire the first sentence to be disambiguated, and perform ambiguity labeling processing on the first sentence according to a preset ambiguity labeling method, so as to obtain the first sentence marked as ambiguous Entity words;
  • the designated standard sentence acquisition unit 20 is configured to select a designated standard sentence from a preset standard sentence database according to a preset standard sentence selection method;
  • the first distance judgment unit 30 is configured to calculate the first distance between the first sentence and the designated standard sentence according to a preset distance calculation formula, and determine whether the first distance is less than the preset first distance.
  • Distance threshold
  • the designated intent recognition model acquiring unit 40 is configured to, if the first distance is less than a preset first distance threshold, acquire the designated standard sentence corresponding to the designated standard sentence according to the corresponding relationship between the preset standard sentence and the intent recognition model An intent recognition model, wherein the designated intent recognition model is trained using sample data, and the sample data is only composed of sentences marked as designated types of intents;
  • the recognition result obtaining unit 50 is configured to input the first sentence into the designated intent recognition model to perform operations, thereby obtaining a recognition result output by the designated intent recognition model, wherein the recognition result includes recognition success or recognition failure;
  • the recognition result judging unit 60 is used to judge whether the recognition result is a successful recognition
  • the designated entity meaning labeling unit 70 is configured to, if the recognition result is successful, obtain the designated entity corresponding to the first sentence according to the preset correspondence relationship of the first sentence-standard sentence-intent recognition model-entity meaning Entity meaning, and perform a disambiguation labeling operation on the first sentence, so that the entity word that is labeled as ambiguous is labeled with the specified entity meaning.
  • the entity word acquiring unit 10 includes:
  • the two-way encoder processing subunit is used to input the first sentence into the two-way encoder in the preset ambiguity labeling model for processing, so that the first ambiguity label is one-to-one corresponding to each word in the first sentence Sequence, and obtain the hidden state vector set of the last-level conversion unit of the bidirectional encoder, wherein the ambiguity annotation model is composed of a bidirectional encoder and a support vector machine, and the bidirectional encoder includes a multilayer conversion unit;
  • the second ambiguity tag sequence acquisition subunit is used to input the hidden state vector set into the support vector machine for operation to obtain a second ambiguity tag sequence corresponding to each word of the first sentence one-to-one, wherein the support
  • the function used by the vector machine for calculation is among them Is the label value corresponding to the i-th word of the first sentence, y is the independent variable, yi is the label corresponding to the i-th word of the first sentence, w yi is the parameter vector corresponding to the i-th word, hi Is the hidden state vector corresponding to the i-th word, w yi and hi have the same number of component vectors;
  • the similarity value judgment subunit is used to calculate the similarity value between the first ambiguity annotation sequence and the second ambiguity annotation sequence according to a preset similarity value calculation method, and to determine whether the similarity value is greater than the expected value.
  • the entity word acquiring subunit is configured to acquire the entity word marked as ambiguous in the second ambiguous annotation sequence if the similarity value is greater than a preset similarity threshold.
  • the designated standard sentence obtaining unit 20 includes:
  • the sentence similarity value sim calculation subunit is used according to the formula: Calculate the sentence similarity value sim between the first sentence and a standard sentence in the standard sentence database, where A is the word frequency vector of the first sentence, B is the word frequency vector of the standard sentence, and Ai is the first The number of times the i-th word of the sentence appears in the whole sentence; Bi is the number of times the i-th word of the standard sentence appears in the whole sentence;
  • the sentence similarity value sim judgment subunit is used to judge whether there is a standard sentence whose sentence similarity value sim is greater than a preset sentence similarity threshold in the standard sentence database;
  • the designated standard sentence marking subunit is used to record the standard sentence with the sentence similarity value sim greater than the preset sentence similarity threshold as the designated standard sentence if it exists.
  • the first distance determining unit 30 includes:
  • the word vector database query subunit is used to query a preset word vector database to obtain a first word vector sequence I corresponding to the first sentence, and to obtain a second word vector sequence R corresponding to the specified standard sentence ;
  • the first distance D calculation subunit is used according to the formula:
  • the device includes:
  • the sample data dividing unit is used to obtain a plurality of pre-collected sample data, and divide the plurality of sample data into training data and test data; wherein, the sample data is a sentence marked as a specified type of intention;
  • the intermediate intent recognition model acquisition unit is used to input training data into the preset neural network model for training, where the training adopts the stochastic gradient descent method to obtain the intermediate intent recognition model;
  • the verification passing judgment unit is configured to verify the intermediate intention recognition model by using the test data, and judge whether the verification is passed;
  • the designated intent recognition model marking unit is used to record the intermediate intent recognition as the designated intent recognition model if the verification is passed.
  • the device includes:
  • the candidate standard sentence obtaining unit is configured to obtain a candidate standard sentence from a plurality of designated standard sentences if the recognition result is a recognition failure, wherein the first sentence between the candidate standard sentence and the first sentence 2.
  • the distance is greater than the first distance threshold and less than the preset second distance threshold;
  • the candidate intent recognition model obtaining unit is configured to obtain the candidate intent recognition model corresponding to the candidate standard sentence according to the preset corresponding relationship between the standard sentence and the intent recognition model;
  • the second recognition result acquisition unit is configured to input the first sentence into the candidate intent recognition model to perform operations, thereby obtaining a second recognition result output by the candidate intent recognition model, wherein the second recognition result Including recognition success or recognition failure;
  • the second recognition result judging unit is used to judge whether the second recognition result is a successful recognition
  • An alternative entity meaning labeling unit configured to, if the second recognition result is successful, obtain the corresponding relationship to the first sentence according to the preset correspondence relationship of the first sentence-standard sentence-intent recognition model-entity meaning The candidate entity meaning of, and a disambiguation labeling operation is performed on the first sentence, so that the entity word that is labeled as ambiguous is labeled with the candidate entity meaning.
  • the device includes:
  • a quantity acquiring unit configured to acquire the quantity of the designated standard sentence if the second recognition result is a recognition failure
  • a quantity threshold judging unit for judging whether the quantity of the specified standard sentences is greater than a preset quantity threshold
  • An annotation modification unit configured to perform an annotation modification operation if the number of the designated standard sentences is not greater than a preset number threshold, wherein the annotation modification operation is used to modify the annotations of the entity words that are marked as ambiguous to be unambiguous Label.
  • an embodiment of the present application also provides a computer device.
  • the computer device may be a server, and its internal structure may be as shown in the figure.
  • the computer equipment includes a processor, a memory, a network interface, and a database connected through a system bus. Among them, the processor designed by the computer is used to provide calculation and control capabilities.
  • the memory of the computer device includes a non-volatile 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 computer programs in the non-volatile storage medium.
  • the database of the computer equipment is used to store the data used in the entity disambiguation method based on the intention recognition model.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection.
  • the computer program is executed by the processor to realize an entity disambiguation method based on the intention recognition model.
  • the processor executes the above-mentioned entity disambiguation method based on the intention recognition model, wherein the steps included in the method respectively correspond to the steps of executing the entity disambiguation method based on the intention recognition model of the foregoing embodiment in a one-to-one correspondence, and will not be repeated here.
  • An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored.
  • a computer program When the computer program is executed by a processor, an entity disambiguation method based on an intention recognition model is implemented, and the storage medium is a volatile storage medium. Or a non-volatile storage medium, wherein the steps included in the method respectively correspond to the steps of performing the entity disambiguation method based on the intention recognition model of the foregoing embodiment, and will not be repeated here.

Abstract

The present invention relates to the field of artificial intelligence, and discloses a method and an apparatus for entity disambiguation based on an intention recognition model, and a computer device and a storage medium: acquiring a first sentence to be disambiguated, and acquiring an entity word labelled as ambiguous 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 less than a first distance threshold, then acquiring a specified intention recognition model; inputting the first sentence into the specified intention recognition model to obtain a recognition result, the specified intention recognition model being trained using sample data, and the sample data only being composed of sentences labelled as a specified type of intention; and, if the recognition result is successful recognition, then acquiring a specified entity meaning corresponding to the first sentence, and labelling the entity word with the specified entity meaning. A new dimension (intention recognition) is introduced into the process of disambiguation, increasing the accuracy of entity disambiguation.

Description

基于意图识别模型的实体消歧方法、装置和计算机设备Entity disambiguation method, device and computer equipment based on intention recognition model
本申请要求于2019年10月15日提交中国专利局、申请号为201910978260.9,发明名称为“基于意图识别模型的实体消歧方法、装置和计算机设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on October 15, 2019, the application number is 201910978260.9, and the invention title is "Method, Apparatus, and Computer Equipment for Entity Disambiguation Based on Intent Recognition Model", and its entire contents Incorporated in this application by reference.
技术领域Technical field
本申请涉及到人工智能领域,特别是涉及到一种基于意图识别模型的实体消歧方法、装置、计算机设备和存储介质。This application relates to the field of artificial intelligence, and in particular to an entity disambiguation method, device, computer equipment and storage medium based on an intention recognition model.
背景技术Background technique
实体消岐是自然语言处理中的关键任务。由于海量数据中存在的实体指称(例如名词)通常可以对应到多个命名实体概念,这无疑对实体消歧造成了很大的障碍。实体消歧的任务就是将这些存在歧义的实体指称在众多的候选实体中匹配出对应的目标实体。发明人意识到,目前实体消歧的方案的准确性不足,例如采用实体链接进行消歧,需要将待消歧命名实体指称链接到外部知识库中对应实体来进行消歧,从而准确性依赖于外部知识库的记载,对于不同语境下的实体的准确辨别不够准确。因此,目前的实体消歧的准确度有待提高。Entity disambiguation is a key task in natural language processing. Since entity references (such as nouns) existing in massive data can usually correspond to multiple named entity concepts, this undoubtedly creates a great obstacle to entity disambiguation. The task of entity disambiguation is to match these ambiguous entity references among a large number of candidate entities to match the corresponding target entities. The inventor realizes that the accuracy of the current entity disambiguation scheme is insufficient. For example, using entity links for disambiguation requires linking the named entity to be disambiguated to the corresponding entity in the external knowledge base for disambiguation, so the accuracy depends on The records of external knowledge bases are not accurate enough to accurately distinguish entities in different contexts. Therefore, the accuracy of current entity disambiguation needs to be improved.
技术问题technical problem
本申请的主要目的为提供一种基于意图识别模型的实体消歧方法、装置、计算机设备和存储介质,旨在提高实体消歧的准确度。The main purpose of this application is to provide an entity disambiguation method, device, computer equipment and storage medium based on an intention recognition model, aiming to improve the accuracy of entity disambiguation.
技术解决方案Technical solutions
为了实现上述目的,本申请提出一种基于意图识别模型的实体消歧方法,包括以下步骤:In order to achieve the above objective, this application proposes an entity disambiguation method based on an intention recognition model, which includes the following steps:
获取待消歧的第一句子,并根据预设的歧义标注方法,对所述第一句子进行歧义标注处理,从而获取所述第一句子中的被标注为歧义的实体词语;Acquire the first sentence to be disambiguated, and perform ambiguity labeling processing on the first sentence according to a preset ambiguity labeling method, so as to obtain the entity words labeled as ambiguous in the first sentence;
根据预设的标准句子挑选方法,从预设的标准句子数据库中选出指定标准句子;According to the preset standard sentence selection method, select the designated standard sentence from the preset standard sentence database;
根据预设的距离计算公式,计算所述第一句子与所述指定标准句子之间的第一距离,并判断所述第一距离是否小于预设的第一距离阈值;Calculate the 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 less than a preset first distance threshold;
若所述第一距离小于预设的第一距离阈值,则根据预设的标准句子与意图识别模型的对应关系,获取与所述指定标准句子对应的指定意图识别模型,其中所述指定意图识别模型采用样本数据训练而成,所述样本数据仅由被标注为指定类型意图的句子构成;If the first distance is less than the preset first distance threshold, the specified intent recognition model corresponding to the specified standard sentence is obtained according to the corresponding relationship between the preset standard sentence and the intent recognition model, wherein the specified intent recognition The model is trained using sample data, and the sample data is only composed of sentences marked as a specified type of intent;
将所述第一句子输入所述指定意图识别模型中进行运算,从而得到所述指定意图识别模型输出的识别结果,其中所述识别结果包括识别成功或者识别失败;Inputting the first sentence into the designated intent recognition model to perform operations, so as to obtain a recognition result output by the designated intent recognition model, wherein the recognition result includes recognition success or recognition failure;
判断所述识别结果是否为识别成功;Determine whether the recognition result is successful;
若所述识别结果为识别成功,则根据预设的第一句子-标准句子-意图识别模型-实体含义的对应关系,获取与所述第一句子对应的指定实体含义,并对所述第一句子中进行消歧标注操作,从而使所述被标注为歧义的实体词语被标 注上所述指定实体含义。If the recognition result is successful, then according to the preset first sentence-standard sentence-intent recognition model-entity meaning corresponding relationship, the designated entity meaning corresponding to the first sentence is acquired, and the first sentence A disambiguation labeling operation is performed in the sentence, so that the entity word that is labeled as ambiguous is labeled with the specified entity meaning.
本申请提供一种基于意图识别模型的实体消歧装置,包括:This application provides an entity disambiguation device based on an intention recognition model, including:
实体词语获取单元,用于获取待消歧的第一句子,并根据预设的歧义标注方法,对所述第一句子进行歧义标注处理,从而获取所述第一句子中的被标注为歧义的实体词语;The entity word acquisition unit is used to acquire the first sentence to be disambiguated, and perform ambiguity labeling processing on the first sentence according to a preset ambiguity labeling method, so as to obtain the first sentence marked as ambiguous Entity words
指定标准句子获取单元,用于根据预设的标准句子挑选方法,从预设的标准句子数据库中选出指定标准句子;The designated standard sentence acquisition unit is used to select the designated standard sentence from the preset standard sentence database according to the preset standard sentence selection method;
第一距离判断单元,用于根据预设的距离计算公式,计算所述第一句子与所述指定标准句子之间的第一距离,并判断所述第一距离是否小于预设的第一距离阈值;The first distance judgment unit is configured to calculate the first distance between the first sentence and the designated standard sentence according to a preset distance calculation formula, and determine whether the first distance is less than the preset first distance Threshold
指定意图识别模型获取单元,用于若所述第一距离小于预设的第一距离阈值,则根据预设的标准句子与意图识别模型的对应关系,获取与所述指定标准句子对应的指定意图识别模型,其中所述指定意图识别模型采用样本数据训练而成,所述样本数据仅由被标注为指定类型意图的句子构成;A designated intent recognition model acquiring unit, configured to, if the first distance is less than a preset first distance threshold, acquire the designated intent corresponding to the designated standard sentence according to the corresponding relationship between the preset standard sentence and the intent recognition model A recognition model, wherein the designated intent recognition model is trained using sample data, and the sample data is only composed of sentences marked as designated types of intents;
识别结果获取单元,用于将所述第一句子输入所述指定意图识别模型中进行运算,从而得到所述指定意图识别模型输出的识别结果,其中所述识别结果包括识别成功或者识别失败;A recognition result obtaining unit, configured to input the first sentence into the designated intent recognition model for calculation, thereby obtaining a recognition result output by the designated intent recognition model, wherein the recognition result includes recognition success or recognition failure;
识别结果判断单元,用于判断所述识别结果是否为识别成功;A recognition result judging unit for judging whether the recognition result is a successful recognition;
指定实体含义标注单元,用于若所述识别结果为识别成功,则根据预设的第一句子-标准句子-意图识别模型-实体含义的对应关系,获取与所述第一句子对应的指定实体含义,并对所述第一句子中进行消歧标注操作,从而使所述被标注为歧义的实体词语被标注上所述指定实体含义。The designated entity meaning labeling unit is used to obtain the designated entity corresponding to the first sentence according to the preset correspondence relationship of the first sentence-standard sentence-intent recognition model-entity meaning Meaning, and perform a disambiguation labeling operation on the first sentence, so that the entity word labeled as ambiguous is labeled with the specified entity meaning.
本申请提供一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现上述任一项所述方法的步骤。The present application provides a computer device, including a memory and a processor, the memory stores a computer program, and the processor implements the steps of any one of the above methods when the computer program is executed.
本申请提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述任一项所述的方法的步骤。The present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of any one of the methods described above are implemented.
有益效果Beneficial effect
本申请的基于意图识别模型的实体消歧方法、装置、计算机设备和存储介质,获取待消歧的第一句子,获取所述第一句子中的被标注为歧义的实体词语;选出指定标准句子;计算所述第一句子与所述指定标准句子之间的第一距离;若所述第一距离小于预设的第一距离阈值,则获取指定意图识别模型;将所述第一句子输入所述指定意图识别模型中进行运算,从而得到识别结果,其中所述指定意图识别模型采用样本数据训练而成,所述样本数据仅由被标注为指定类型意图的句子构成;若所述识别结果为识别成功,则获取与所述第一句子对应的指定实体含义,并对所述第一句子中进行消歧标注操作,从而使所述被标注为歧义的实体词语被标注上所述指定实体含义。从而在消歧的过程中,引入了新的维度(意图识别),从而提高实体消歧的准确性。The entity disambiguation method, device, computer equipment and storage medium based on the intention recognition model of the present application obtain the first sentence to be disambiguated, obtain the entity words marked as ambiguous in the first sentence; select the specified criteria Sentence; calculate the first distance between the first sentence and the specified standard sentence; if the first distance is less than the preset first distance threshold, obtain the specified intent recognition model; input the first sentence The designated intent recognition model performs operations to obtain a recognition result, wherein the designated intent recognition model is trained using sample data, and the sample data is only composed of sentences marked as designated types of intents; if the recognition result For successful recognition, the meaning of the designated entity corresponding to the first sentence is obtained, and the disambiguation operation is performed on the first sentence, so that the entity word marked as ambiguous is marked with the designated entity meaning. Thus, in the process of disambiguation, a new dimension (intent recognition) is introduced to improve the accuracy of entity disambiguation.
附图说明Description of the drawings
图1为本申请一实施例的基于意图识别模型的实体消歧方法的流程示意 图;Fig. 1 is a schematic flowchart of an entity disambiguation method based on an intention recognition model according to an embodiment of this application;
图2为本申请一实施例的基于意图识别模型的实体消歧装置的结构示意框图;2 is a schematic block diagram of the structure of an entity disambiguation apparatus based on an intention recognition model according to an embodiment of the application;
图3为本申请一实施例的计算机设备的结构示意框图。FIG. 3 is a schematic block diagram of the structure of a computer device according to an embodiment of the application.
本申请的最佳实施方式The best implementation of this application
参照图1,本申请实施例提供一种基于意图识别模型的实体消歧方法,包括以下步骤:1, an embodiment of the present application provides an entity disambiguation method based on an intention recognition model, including the following steps:
S1、获取待消歧的第一句子,并根据预设的歧义标注方法,对所述第一句子进行歧义标注处理,从而获取所述第一句子中的被标注为歧义的实体词语;S1. Obtain the first sentence to be disambiguated, and perform ambiguity labeling processing on the first sentence according to a preset ambiguity labeling method, so as to obtain the entity words marked as ambiguous in the first sentence;
S2、根据预设的标准句子挑选方法,从预设的标准句子数据库中选出指定标准句子;S2, according to the preset standard sentence selection method, select the designated standard sentence from the preset standard sentence database;
S3、根据预设的距离计算公式,计算所述第一句子与所述指定标准句子之间的第一距离,并判断所述第一距离是否小于预设的第一距离阈值;S3. Calculate the 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 less than a preset first distance threshold;
S4、若所述第一距离小于预设的第一距离阈值,则根据预设的标准句子与意图识别模型的对应关系,获取与所述指定标准句子对应的指定意图识别模型,其中所述指定意图识别模型采用样本数据训练而成,所述样本数据仅由被标注为指定类型意图的句子构成;S4. If the first distance is less than the preset first distance threshold, obtain a specified intent recognition model corresponding to the specified standard sentence according to the correspondence between the preset standard sentence and the intent recognition model, wherein the specified The intention recognition model is trained using sample data, and the sample data is only composed of sentences marked as specified types of intentions;
S5、将所述第一句子输入所述指定意图识别模型中进行运算,从而得到所述指定意图识别模型输出的识别结果,其中所述识别结果包括识别成功或者识别失败;S5. Input the first sentence into the designated intent recognition model to perform operations, thereby obtaining a recognition result output by the designated intent recognition model, where the recognition result includes recognition success or recognition failure;
S6、判断所述识别结果是否为识别成功;S6. Determine whether the recognition result is successful;
S7、若所述识别结果为识别成功,则根据预设的第一句子-标准句子-意图识别模型-实体含义的对应关系,获取与所述第一句子对应的指定实体含义,并对所述第一句子中进行消歧标注操作,从而使所述被标注为歧义的实体词语被标注上所述指定实体含义。S7. If the recognition result is that the recognition is successful, obtain the specified entity meaning corresponding to the first sentence according to the preset correspondence relationship of the first sentence-standard sentence-intent recognition model-entity meaning, and compare the A disambiguation labeling operation is performed in the first sentence, so that the entity words that are labeled as ambiguous are labeled with the specified entity meaning.
如上述步骤S1所述,获取待消歧的第一句子,并根据预设的歧义标注方法,对所述第一句子进行歧义标注处理,从而获取所述第一句子中的被标注为歧义的实体词语。本申请的实体消歧目的在于获取存在歧义的实体词语的真实含义,因此需要将存在歧义的实体词语标注为歧义。其中,预设的歧义标注方法例如为:所述第一句子输入预设的歧义标注模型中的双向编码器进行处理,从而与所述第一句子中的每个词语一一对应的第一歧义标注序列,并获取所述双向编码器的最后一层转换单元的隐藏状态向量集合,其中所述歧义标注模型由双向编码器和支持向量机构成,双向编码器包括多层转换单元;将所述隐藏状态向量集合输入所述支持向量机进行运算,得到与所述第一句子的每个词语一一对应的第二歧义标注序列;根据预设的相似程度值计算方法,计算所述第一歧义标注序列与所述第二歧义标注序列的相似程度值,并判断所述相似程度值是否大于预设的相似程度阈值;若所述相似程度值大于预设的相似程度阈值,则获取所述第二歧义标注序列中被标注为歧义的实体词语。As described in step S1 above, obtain the first sentence to be disambiguated, and perform ambiguity labeling processing on the first sentence according to the preset ambiguity labeling method, so as to obtain the first sentence marked as ambiguous Entity words. The purpose of entity disambiguation in this application is to obtain the true meaning of ambiguous entity words, so the ambiguous entity words need to be marked as ambiguous. The preset ambiguity tagging method is, for example, that the first sentence is input into the bidirectional encoder in the preset ambiguity tagging model for processing, so that the first ambiguity corresponding to each word in the first sentence is one-to-one. Annotate the sequence, and obtain the hidden state vector set of the last-level conversion unit of the two-way encoder, wherein the ambiguity annotation model is composed of a two-way encoder and a support vector machine, and the two-way encoder includes a multi-layer conversion unit; The set of hidden state vectors is input to the support vector machine for operation to obtain a second ambiguity tag sequence corresponding to each word in the first sentence one-to-one; the first ambiguity is calculated according to a preset similarity value calculation method Mark the similarity value between the annotation sequence and the second ambiguous annotation sequence, and determine whether the similarity value is greater than a preset similarity threshold; if the similarity value is greater than the preset similarity threshold, obtain the first The entity words marked as ambiguous in the two-ambiguity tagging sequence.
如上述步骤S2所述,根据预设的标准句子挑选方法,从预设的标准句子 数据库中选出指定标准句子。标准句子是用于选择适合的意图识别模型,因此需要挑出与第一句子相近的指定标准句子。预设的标准句子挑选方法例如为:根据公式:
Figure PCTCN2020093428-appb-000001
计算出所述第一句子和所述标准句子数据库中的一个标准句子的句子相似度值sim;判断所述标准句子数据库中是否存在所述句子相似度值sim大于预设的句子相似度阈值的标准句子;
As described in the above step S2, according to the preset standard sentence selection method, the designated standard sentence is selected from the preset standard sentence database. The standard sentence is used to select a suitable intent recognition model, so it is necessary to pick out the designated standard sentence that is similar to the first sentence. The preset standard sentence selection method is, for example, according to the formula:
Figure PCTCN2020093428-appb-000001
Calculate the sentence similarity value sim between the first sentence and a standard sentence in the standard sentence database; determine whether the sentence similarity value sim is greater than the preset sentence similarity threshold in the standard sentence database Standard sentence
若存在,则将所述句子相似度值sim大于预设的句子相似度阈值的标准句子记为指定标准句子。If it exists, the standard sentence whose sentence similarity value sim is greater than the preset sentence similarity threshold is recorded as the designated standard sentence.
如上述步骤S3所述,根据预设的距离计算公式,计算所述第一句子与所述指定标准句子之间的第一距离,并判断所述第一距离是否小于预设的第一距离阈值。第一距离反应了所述第一句子与所述指定标准句子的相似程度,若第一距离的数值越小,表明越相似,当所述第一句子与所述指定标准句子完全相同时,所述第一距离等于0。预设的距离计算公式例如为:通过查询预设的词向量库,获取与所述第一句子对应的第一词向量序列I,以及获取与所述指定标准句子对应的第二词向量序列R;根据公式:As described in step S3 above, calculate the first distance between the first sentence and the specified standard sentence according to the preset distance calculation formula, and determine whether the first distance is less than the preset first distance threshold . The first distance reflects the degree of similarity between the first sentence and the specified standard sentence. If the value of the first distance is smaller, the more similar is indicated. When the first sentence is exactly the same as the specified standard sentence, the The first distance is equal to zero. The preset distance calculation formula is, for example, by querying a preset word vector library, obtaining a first word vector sequence I corresponding to the first sentence, and obtaining a second word vector sequence R corresponding to the specified standard sentence ; According to the formula:
Figure PCTCN2020093428-appb-000002
计算所述第一句子与所述指定标准句子之间的第一距离D,其中|I|是所述第一词向量序列中的词语数;|R|是所述第二词向量序列中的词语数;w是词向量;α为调整两个词向量之间的余弦相似度的放大系数;max(α×cosDis(w,R)是计算第二词向量序列R中所有词语对应的词向量与第一词向量序列I中的词向量w的余弦相似度中的最大值。
Figure PCTCN2020093428-appb-000002
Calculate the first distance D between the first sentence and the specified standard sentence, where |I| is the number of words in the first word vector sequence; |R| is the number of words in the second word vector sequence The number of words; w is the word vector; α is the amplification factor for adjusting the cosine similarity between the two word vectors; max(α×cosDis(w, R) is the word vector corresponding to all words in the second word vector sequence R The maximum value of the cosine similarity with the word vector w in the first word vector sequence I.
如上述步骤S4所述,若所述第一距离小于预设的第一距离阈值,则根据预设的标准句子与意图识别模型的对应关系,获取与所述指定标准句子对应的指定意图识别模型,其中所述指定意图识别模型采用样本数据训练而成,所述样本数据仅由被标注为指定类型意图的句子构成。若所述第一距离小于预设的第一距离阈值,则表示存在适用的意图识别模型,据此根据预设的标准句子与意图识别模型的对应关系,获取与所述指定标准句子对应的指定意图识别模型。并且,本申请采用的指定意图识别模型采用样本数据训练而成,所述样本数据仅由被标注为指定类型意图的句子构成,从而指定意图识别模型的体量更小,需要的训练数据更小,更容易训练,对于有限范围(即与指定标准句子相近的句子,例如所述第一句子)之内的句子进行意图识别的准确性更高。进一步地,训练所述指定意图识别模型的样本数据仅由有限数量的词语构成,所述有限数量的词语与所述第一句子中的词语相同或相近,从而使训练更加快捷,第一句子的识别更为准确(因为样本数据的词语数量被限定,且与此第一句子中的词语相同或相近,因此样本数据可以通过遍历法找出所有的训练句子,从而第一句子肯定是训练过程中出现过的句子,因此识别所述第一句子时更准确更快捷)。As described in step S4 above, if the first distance is less than the preset first distance threshold, the specified intent recognition model corresponding to the specified standard sentence is obtained according to the corresponding relationship between the preset standard sentence and the intent recognition model , Wherein the designated intent recognition model is trained using sample data, and the sample data is only composed of sentences marked as designated types of intents. If the first distance is less than the preset first distance threshold, it indicates that there is an applicable intention recognition model, and according to the corresponding relationship between the preset standard sentence and the intention recognition model, the designated standard sentence corresponding to the designated standard sentence is obtained. Intent recognition model. In addition, the designated intent recognition model used in this application is trained using sample data, and the sample data is only composed of sentences marked as designated types of intents, so that the size of the designated intent recognition model is smaller and the training data required is smaller. , It is easier to train, and the accuracy of intention recognition is higher for sentences within a limited range (that is, sentences similar to the specified standard sentence, such as the first sentence). Further, the sample data for training the specified intent recognition model consists of only a limited number of words, and the limited number of words is the same or similar to the words in the first sentence, so that the training is faster and the first sentence is more efficient. Recognition is more accurate (because the number of words in the sample data is limited and is the same or similar to the words in the first sentence, so the sample data can find all training sentences by traversal method, so the first sentence must be in the training process Sentences that have appeared, so it is more accurate and faster to recognize the first sentence).
如上述步骤S5所述,将所述第一句子输入所述指定意图识别模型中进行运算,从而得到所述指定意图识别模型输出的识别结果,其中所述识别结果包括识别成功或者识别失败。由于所述指定意图识别模型只能识别出一种意图类型(即指定意图类型),因此其识别成功即表示所述第一句子为指定意图类型,若识别失败,则需要采用其他的意图识别模型再次进行识别。As described in step S5 above, the first sentence is input into the designated intent recognition model to perform operations, so as to obtain a recognition result output by the designated intent recognition model, wherein the recognition result includes recognition success or recognition failure. Since the designated intent recognition model can only recognize one type of intent (namely, the designated intent type), its successful recognition means that the first sentence is the designated intent type. If the recognition fails, other intent recognition models need to be adopted. Identify again.
如上述步骤S6所述,判断所述识别结果是否为识别成功。由于识别结果只有两种:识别成功或者识别失败。当识别成功时,表明所述第一句子为指定意图类型,反之,无法确定第一句子的意图类型。As described in step S6 above, it is determined whether the recognition result is successful. Because there are only two recognition results: recognition success or recognition failure. When the recognition is successful, it indicates that the first sentence is the designated intent type, otherwise, the intent type of the first sentence cannot be determined.
如上述步骤S7所述,若所述识别结果为识别成功,则根据预设的第一句子-标准句子-意图识别模型-实体含义的对应关系,获取与所述第一句子对应的指定实体含义,并对所述第一句子中进行消歧标注操作,从而使所述被标注为歧义的实体词语被标注上所述指定实体含义。As described in step S7 above, if the recognition result is successful, then according to the preset first sentence-standard sentence-intent recognition model-entity meaning correspondence relationship, the designated entity meaning corresponding to the first sentence is obtained , And perform a disambiguation labeling operation on the first sentence, so that the entity word labeled as ambiguous is labeled with the specified entity meaning.
具有歧义的实体词语在不同的意图语境中存在不同的含义,而若能识别出具体的意图类型,也就能确定歧义词语的准确含义了。据此,本申请根据预设的第一句子-标准句子-意图识别模型-实体含义的对应关系,获取与所述第一句子对应的指定实体含义,并对所述第一句子中进行消歧标注操作,从而使所述被标注为歧义的实体词语被标注上所述指定实体含义。从而第一句子中被标注为歧义的实体词语的实际意义即可由所述指定实体含义所得知。例如,第一句子为:我电话坏了,借你的苹果用一下。利用“我的手机没电了,能用一下你的苹果么?”这样的指定标准句子,获取相应的意图识别模型(用于识别出使用电话的意图),得出识别成功的识别结果,再根据第一句子-标准句子-意图识别模型-实体含义(电话)的对应关系,即可将所述第一句子中的苹果标注上指定实体含义(电话)。Ambiguous entity words have different meanings in different intention contexts, and if the specific intention type can be identified, the exact meaning of ambiguous words can also be determined. Accordingly, this application obtains the specified entity meaning corresponding to the first sentence according to the preset correspondence relationship of the first sentence-standard sentence-intent recognition model-entity meaning, and disambiguates the first sentence Marking operation, so that the entity word marked as ambiguous is marked with the specified entity meaning. Therefore, the actual meaning of the entity words marked as ambiguous in the first sentence can be known from the meaning of the specified entity. For example, the first sentence is: My phone is broken, borrow your apple and use it. Use the specified standard sentence like "My phone is dead, can I use your Apple?" to obtain the corresponding intent recognition model (used to recognize the intent to use the phone), and get the recognition result of successful recognition, and then According to the corresponding relationship of the first sentence-standard sentence-intent recognition model-entity meaning (phone), the apple in the first sentence can be marked with the designated entity meaning (phone).
在一个实施方式中,所述根据预设的歧义标注方法,对所述第一句子进行歧义标注处理,从而获取所述第一句子中的被标注为歧义的实体词语的步骤S1,包括:In one embodiment, the step S1 of performing ambiguity labeling processing on the first sentence according to the preset ambiguity labeling method, so as to obtain the entity words marked as ambiguous in the first sentence, includes:
S101、将所述第一句子输入预设的歧义标注模型中的双向编码器进行处理,从而与所述第一句子中的每个词语一一对应的第一歧义标注序列,并获取所述双向编码器的最后一层转换单元的隐藏状态向量集合,其中所述歧义标注模型由双向编码器和支持向量机构成,双向编码器包括多层转换单元;S101. Input the first sentence into a two-way encoder in a preset ambiguity labeling model for processing, so that a first ambiguity label sequence corresponding to each word in the first sentence one-to-one, and obtain the two-way A set of hidden state vectors of the conversion unit of the last layer of the encoder, wherein the ambiguity annotation model is composed of a bidirectional encoder and a support vector machine, and the bidirectional encoder includes a multi-layer conversion unit;
S102、将所述隐藏状态向量集合输入所述支持向量机进行运算,得到与所述第一句子的每个词语一一对应的第二歧义标注序列,其中支持向量机进行运算时使用的函数为
Figure PCTCN2020093428-appb-000003
其中
Figure PCTCN2020093428-appb-000004
为所述第一句子的第i个词语对应的标注值,y为自变量,yi为所述第一句子的第i个词语对应的标注,w yi为第i个词语对应的参数向量,hi为第i个词语对应的隐藏状态向量,w yi与hi具有相同数量的分向量;
S102. Input the set of hidden state vectors into the support vector machine for operation to obtain a second ambiguity tag sequence corresponding to each word of the first sentence one-to-one, where the function used by the support vector machine for operation is
Figure PCTCN2020093428-appb-000003
among them
Figure PCTCN2020093428-appb-000004
Is the label value corresponding to the i-th word of the first sentence, y is the independent variable, yi is the label corresponding to the i-th word of the first sentence, w yi is the parameter vector corresponding to the i-th word, hi Is the hidden state vector corresponding to the i-th word, w yi and hi have the same number of component vectors;
S103、根据预设的相似程度值计算方法,计算所述第一歧义标注序列与所述第二歧义标注序列的相似程度值,并判断所述相似程度值是否大于预设的相似程度阈值;S103. Calculate the similarity value between the first ambiguous annotation sequence and the second ambiguous annotation sequence according to a preset similarity value calculation method, and determine whether the similarity value is greater than a preset similarity threshold;
S104、若所述相似程度值大于预设的相似程度阈值,则获取所述第二歧义标注序列中被标注为歧义的实体词语。S104: If the similarity degree value is greater than a preset similarity degree threshold, obtain an entity word marked as ambiguous in the second ambiguous annotation sequence.
如上所述,实现了对所述第一句子进行歧义标注处理,从而获取所述第一句子中的被标注为歧义的实体词语。本申请采用具有特殊结构的歧义标注模型进行歧义标注。所述歧义标注模型由双向编码器和支持向量机构成,从而提高歧义标注的准确性。支持向量机是一种可用于标注的模型,但其输入特征需要人工设置,因此准确性较低,因此本申请以所述双向编码器的最后一层转换单元的隐藏状态向量集合作为支持向量机的输入,提高了准确性。所述双向编码器包括多层转换单元,其中转换单元由多个编码器和解码器构成,并且能够输出第一歧义标注序列,用于作为第二歧义标注序列是否准确的参照。再计算所述第一歧义标注序列与所述第二歧义标注序列的相似程度值,若所述相似程度值大于预设的相似程度阈值,则表明歧义标注模型的标注准确,则获取所述第二歧义标注序列中被标注为歧义的实体词语。其中,计算所述第一歧义标注序列与所述第二歧义标注序列的相似程度值可为任意方法,例如采用基于余弦相似度的计算方法。As described above, the ambiguity annotation processing on the first sentence is implemented, so as to obtain the entity words marked as ambiguous in the first sentence. This application uses an ambiguity annotation model with a special structure for ambiguity annotation. The ambiguity labeling model is composed of a bidirectional encoder and a support vector machine, thereby improving the accuracy of ambiguity labeling. The support vector machine is a model that can be used for labeling, but its input features need to be manually set, so the accuracy is low. Therefore, this application uses the hidden state vector set of the last layer of the conversion unit of the two-way encoder as the support vector machine The input improves the accuracy. The bidirectional encoder includes a multi-layer conversion unit, wherein the conversion unit is composed of multiple encoders and decoders, and can output a first ambiguity annotation sequence, which is used as a reference for whether the second ambiguity annotation sequence is accurate. Then calculate the similarity value between the first ambiguous annotation sequence and the second ambiguous annotation sequence, and if the similarity value is greater than the preset similarity threshold, it indicates that the annotation of the ambiguous annotation model is accurate, and then the first ambiguous annotation sequence is obtained. The entity words marked as ambiguous in the two-ambiguity tagging sequence. Wherein, calculating the similarity value between the first ambiguity annotation sequence and the second ambiguity annotation sequence may be any method, for example, a calculation method based on cosine similarity is adopted.
在一个实施方式中,所述根据预设的标准句子挑选方法,从预设的标准句子数据库中选出指定标准句子的步骤S2,包括:In one embodiment, the step S2 of selecting a specified standard sentence from a preset standard sentence database according to a preset standard sentence selection method includes:
S201、根据公式:
Figure PCTCN2020093428-appb-000005
计算出所述第一句子和所述标准句子数据库中的一个标准句子的句子相似度值sim,其中,A为所述第一句子的词频向量,B为标准句子的词频向量,Ai为第一句子的第i个词语在整个句子中出现的次数;Bi为标准句子的第i个词语在整个句子中出现的次数;
S201. According to the formula:
Figure PCTCN2020093428-appb-000005
Calculate the sentence similarity value sim between the first sentence and a standard sentence in the standard sentence database, where A is the word frequency vector of the first sentence, B is the word frequency vector of the standard sentence, and Ai is the first The number of times the i-th word of the sentence appears in the whole sentence; Bi is the number of times the i-th word of the standard sentence appears in the whole sentence;
S202、判断所述标准句子数据库中是否存在所述句子相似度值sim大于预设的句子相似度阈值的标准句子;S202: Determine whether there is a standard sentence with the sentence similarity value sim greater than a preset sentence similarity threshold in the standard sentence database;
S203、若存在,则将所述句子相似度值sim大于预设的句子相似度阈值的标准句子记为指定标准句子。S203: If it exists, record the standard sentence with the sentence similarity value sim greater than the preset sentence similarity threshold as the designated standard sentence.
如上所述,实现了从预设的标准句子数据库中选出指定标准句子。指定标准句子与第一句子越相似,最终的消歧效果越好。本申请根据公式:
Figure PCTCN2020093428-appb-000006
计算出所述第一句子和所述标准句子数据库中的一个标准句子的句子相似度值sim;判断所述标准句子数据库中是否存在所述句子相似度值sim大于预设的句子相似度阈值的标准句子;若存在,则将所述句子相似度值sim大于预设的句子相似度阈值的标准句子记为指定标准句子。其中,所述句子相似度值sim用于衡量两个句子间的相似程度,其最大值为1,当其值为1时,表明两个句子具有完全相同的词语。据此,挑选出与所述第一句子相近的指定标准句子。其中,所述词频向量由每个词语的出现次数作为分向量的数值而构成,例如句子为:我说我要书,那么其具有四个词语(我,说,要,书),构成的词频向量为(2,1,1,1)。
As described above, the specified standard sentence is selected from the preset standard sentence database. The more similar the designated standard sentence is to the first sentence, the better the final disambiguation effect. This application is based on the formula:
Figure PCTCN2020093428-appb-000006
Calculate the sentence similarity value sim between the first sentence and a standard sentence in the standard sentence database; determine whether the sentence similarity value sim is greater than the preset sentence similarity threshold in the standard sentence database Standard sentence; if it exists, the standard sentence whose sentence similarity value sim is greater than the preset sentence similarity threshold is recorded as the designated standard sentence. Wherein, the sentence similarity value sim is used to measure the similarity between two sentences, and its maximum value is 1. When the value is 1, it indicates that the two sentences have exactly the same words. Accordingly, a designated standard sentence similar to the first sentence is selected. Among them, the word frequency vector is composed of the number of occurrences of each word as the value of the sub-vector. For example, the sentence is: I say I want a book, then it has four words (I, say, want, book), which constitutes the word frequency The vector is (2,1,1,1).
在一个实施方式中,所述根据预设的距离计算公式,计算所述第一句子与 所述指定标准句子之间的第一距离的步骤S3,包括:In one embodiment, the step S3 of calculating the first distance between the first sentence and the designated standard sentence according to a preset distance calculation formula includes:
S301、通过查询预设的词向量库,获取与所述第一句子对应的第一词向量序列I,以及获取与所述指定标准句子对应的第二词向量序列R;S301: Obtain a first word vector sequence I corresponding to the first sentence by querying a preset word vector library, and obtain a second word vector sequence R corresponding to the designated standard sentence;
S302、根据公式:S302. According to the formula:
Figure PCTCN2020093428-appb-000007
计算所述第一句子与所述指定标准句子之间的第一距离D,其中|I|是所述第一词向量序列中的词语数;|R|是所述第二词向量序列中的词语数;w是词向量;α为调整两个词向量之间的余弦相似度的放大系数;max(α×cosDis(w,R)是计算第二词向量序列R中所有词语对应的词向量与第一词向量序列I中的词向量w的余弦相似度中的最大值。
Figure PCTCN2020093428-appb-000007
Calculate the first distance D between the first sentence and the specified standard sentence, where |I| is the number of words in the first word vector sequence; |R| is the number of words in the second word vector sequence The number of words; w is the word vector; α is the amplification factor for adjusting the cosine similarity between the two word vectors; max(α×cosDis(w, R) is the word vector corresponding to all words in the second word vector sequence R The maximum value of the cosine similarity with the word vector w in the first word vector sequence I.
如上所述,实现了计算所述第一句子与所述指定标准句子之间的第一距离。其中,词向量库存储有词向量,词向量用于将词语转换为向量形式便于计算机理解。所述词向量库可使用现有的数据库,也可以采用词向量训练工具word2vec对预先收集的语集进行训练得到。再根据公式:As described above, the calculation of the first distance between the first sentence and the specified standard sentence is realized. Among them, the word vector library stores word vectors, which are used to convert words into vector forms to facilitate computer understanding. The word vector database can be obtained by using an existing database, or by using the word vector training tool word2vec to train a pre-collected corpus. According to the formula:
Figure PCTCN2020093428-appb-000008
计算所述第一句子与所述指定标准句子之间的第一距离D。将查询得到的与所述第一句子对应的第一词向量序列I,以及与所述指定标准句子对应的第二词向量序列R代入上述公式,即可得到所述第一句子与所述指定标准句子之间的第一距离D。
Figure PCTCN2020093428-appb-000008
Calculate the first distance D between the first sentence and the specified standard sentence. Substituting the first word vector sequence I corresponding to the first sentence and the second word vector sequence R corresponding to the designated standard sentence into the above formula, the first sentence and the designated The first distance D between standard sentences.
在一个实施方式中,所述若所述第一距离小于预设的第一距离阈值,则根据预设的标准句子与意图识别模型的对应关系,获取与所述指定标准句子对应的指定意图识别模型,其中所述指定意图识别模型采用样本数据训练而成,所述样本数据仅由被标注为指定类型意图的句子构成的步骤S4之前,包括:In one embodiment, if the first distance is less than a preset first distance threshold, then according to the corresponding relationship between the preset standard sentence and the intent recognition model, the designated intent recognition corresponding to the designated standard sentence is obtained. A model, where the designated intent recognition model is trained using sample data, and the sample data is only composed of sentences marked as designated types of intents before step S4, including:
S31、获取预先收集的多个样本数据,并将所述多个样本数据划分为训练数据和测试数据;其中,所述样本数据为被标注为指定类型意图的句子;S31. Obtain multiple pre-collected sample data, and divide the multiple sample data into training data and test data; wherein the sample data is a sentence marked as a specified type of intention;
S32、将训练数据输入到预设的神经网络模型中进行训练,其中训练采用随机梯度下降法,从而得到中间意图识别模型;S32. Input the training data into a preset neural network model for training, where the training adopts a stochastic gradient descent method to obtain an intermediate intention recognition model;
S33、采用所述测试数据对所述中间意图识别模型进行验证,并判断验证是否通过;S33. Use the test data to verify the intermediate intention recognition model, and determine whether the verification passes;
S34、若验证通过,则将所述中间意图识别记为所述指定意图识别模型。S34. If the verification is passed, record the intermediate intent recognition as the designated intent recognition model.
如上所述,实现了训练指定意图识别模型。本申请采用样本数据进行训练,所述样本数据仅由被标注为指定类型意图的句子构成,从而缩小了训练数据的数量,并且只需对一种意图类型进行识别,将复杂的多分类任务转变成了简单的二分类任务,提高了识别准确性与速度。其中所述神经网络模型例如为:如VGG16模型、ResNet50模型、DPN131模型、InceptionV3模型等。随机梯度 下降法指随机取样一些训练数据进行训练,能够解决大量训练数据导致的训练速度缓慢的问题。再采用所述测试数据对所述中间意图识别模型进行验证,若验证通过,则将所述中间意图识别记为所述指定意图识别模型。As mentioned above, the training specified intent recognition model is realized. This application uses sample data for training. The sample data is only composed of sentences marked as specified types of intents, thereby reducing the amount of training data, and only one type of intent needs to be recognized, transforming complex multi-classification tasks It becomes a simple two-classification task, which improves the accuracy and speed of recognition. The neural network model is, for example, VGG16 model, ResNet50 model, DPN131 model, InceptionV3 model, etc. The stochastic gradient descent method refers to randomly sampling some training data for training, which can solve the problem of slow training speed caused by a large amount of training data. The test data is then used to verify the intermediate intent recognition model, and if the verification is passed, the intermediate intent recognition is recorded as the designated intent recognition model.
在一个实施方式中,所述指定标准句子存在多个,所述判断所述识别结果是否为识别成功的步骤S6之后,包括:In one embodiment, there are multiple designated standard sentences, and after the step S6 of determining whether the recognition result is a successful recognition, the method includes:
S61、若所述识别结果为识别失败,则从多个指定标准句子中获取备选标准句子,其中,所述备选标准句子与所述第一句子之间的第二距离大于所述第一距离阈值并且小于预设的第二距离阈值;S61. If the recognition result is recognition failure, obtain candidate standard sentences from a plurality of designated standard sentences, wherein the second distance between the candidate standard sentence and the first sentence is greater than the first sentence. The distance threshold is and is smaller than the preset second distance threshold;
S62、根据预设的标准句子与意图识别模型的对应关系,获取与所述备选标准句子对应的备选意图识别模型;S62. Obtain a candidate intent recognition model corresponding to the candidate standard sentence according to the preset corresponding relationship between the standard sentence and the intent recognition model;
S63、将所述第一句子输入所述备选意图识别模型中进行运算,从而得到所述备选意图识别模型输出的第二识别结果,其中所述第二识别结果包括识别成功或者识别失败;S63. Input the first sentence into the candidate intent recognition model to perform operations, so as to obtain a second recognition result output by the candidate intent recognition model, where the second recognition result includes recognition success or recognition failure;
S64、判断所述第二识别结果是否为识别成功;S64: Determine whether the second recognition result is successful in recognition;
S65、若所述第二识别结果为识别成功,则根据预设的第一句子-标准句子-意图识别模型-实体含义的对应关系,获取与所述第一句子对应的备选实体含义,并对所述第一句子中进行消歧标注操作,从而使所述被标注为歧义的实体词语被标注上所述备选实体含义。S65. If the second recognition result is that the recognition is successful, obtain the candidate entity meaning corresponding to the first sentence according to the preset correspondence relationship of the first sentence-standard sentence-intent recognition model-entity meaning, and A disambiguation labeling operation is performed on the first sentence, so that the entity words labeled as ambiguous are labeled with the candidate entity meaning.
如上所述,实现了利用备选意图识别模型再次识别意图。由于本申请的意图识别模型是小体量模型,仅能识别一种意图类型,因此存在指定意图识别模型识别失败的情况。此时若还有合适的意图识别模型能够对第一句子识别成功,那么仍能识别出意图类型。本申请采用调节距离阈值的方式以获取合适的模型,具体地:从多个指定标准句子中获取备选标准句子,其中,所述备选标准句子与所述第一句子之间的第二距离大于所述第一距离阈值并且小于预设的第二距离阈值;根据预设的标准句子与意图识别模型的对应关系,获取与所述备选标准句子对应的备选意图识别模型。若备选意图识别模型能够识别成功,那么同样能够实现消歧的目的,据此,根据预设的第一句子-标准句子-意图识别模型-实体含义的对应关系,获取与所述第一句子对应的备选实体含义,并对所述第一句子中进行消歧标注操作,从而使所述被标注为歧义的实体词语被标注上所述备选实体含义。As described above, it is possible to recognize the intent again using the alternative intent recognition model. Since the intent recognition model of the present application is a small volume model and can only recognize one type of intent, there are cases where the recognition of the designated intent recognition model fails. At this time, if there is a suitable intent recognition model that can successfully recognize the first sentence, then the intent type can still be recognized. This application adopts the method of adjusting the distance threshold to obtain a suitable model, specifically: obtaining candidate standard sentences from a plurality of designated standard sentences, wherein the second distance between the candidate standard sentence and the first sentence It is greater than the first distance threshold and less than the preset second distance threshold; according to the correspondence between the preset standard sentence and the intent recognition model, obtain the candidate intent recognition model corresponding to the candidate standard sentence. If the candidate intent recognition model can be successfully identified, it can also achieve the purpose of disambiguation. According to this, according to the preset first sentence-standard sentence-intent recognition model-entity meaning correspondence relationship, the first sentence is obtained Corresponding candidate entity meaning, and performing a disambiguation labeling operation on the first sentence, so that the entity word marked as ambiguous is marked with the candidate entity meaning.
在一个实施方式中,所述判断所述第二识别结果是否为识别成功的步骤S64之后,包括:In one embodiment, after the step S64 of judging whether the second recognition result is a successful recognition, the method includes:
S641、若所述第二识别结果为识别失败,则获取所述指定标准句子的数量;S641: If the second recognition result is a recognition failure, obtain the number of the specified standard sentences;
S642、判断所述指定标准句子的数量是否大于预设的数量阈值;S642: Determine whether the number of the designated standard sentences is greater than a preset number threshold;
S643、若所述指定标准句子的数量不大于预设的数量阈值,则执行标注修改操作,其中所述标注修改操作用于将被标注为歧义的实体词语的标注修改为无歧义标注。S643: If the number of the designated standard sentences is not greater than the preset number threshold, perform a tag modification operation, where the tag modification operation is used to modify the tag of an entity word that is tagged as ambiguous to an unambiguous tag.
如上所述,实现了标注反馈。若所述第二识别结果为识别失败,并且所述指定标准句子的数量不大于预设的数量阈值,则表明所述第一句子只有一种意 图,即所述第一句子不存在歧义,因此前述歧义标注并不准确,据此,执行标注修改操作,其中所述标注修改操作用于将被标注为歧义的实体词语的标注修改为无歧义标注。据此,能够防止歧义误标的错误,实现快速纠正歧义标注。As mentioned above, annotation feedback is realized. If the second recognition result is recognition failure, and the number of specified standard sentences is not greater than the preset number threshold, it indicates that the first sentence has only one intention, that is, there is no ambiguity in the first sentence, so The aforementioned ambiguous labeling is not accurate, and accordingly, a labeling modification operation is performed, wherein the labeling modification operation is used to modify the label of the entity word that is marked as ambiguous to an unambiguous label. Accordingly, the error of mislabeling of ambiguity can be prevented, and the ambiguity label can be corrected quickly.
参照图2,本申请实施例提供一种基于意图识别模型的实体消歧装置,包括:2, an embodiment of the present application provides an entity disambiguation device based on an intention recognition model, including:
实体词语获取单元10,用于获取待消歧的第一句子,并根据预设的歧义标注方法,对所述第一句子进行歧义标注处理,从而获取所述第一句子中的被标注为歧义的实体词语;The entity word acquisition unit 10 is configured to acquire the first sentence to be disambiguated, and perform ambiguity labeling processing on the first sentence according to a preset ambiguity labeling method, so as to obtain the first sentence marked as ambiguous Entity words;
指定标准句子获取单元20,用于根据预设的标准句子挑选方法,从预设的标准句子数据库中选出指定标准句子;The designated standard sentence acquisition unit 20 is configured to select a designated standard sentence from a preset standard sentence database according to a preset standard sentence selection method;
第一距离判断单元30,用于根据预设的距离计算公式,计算所述第一句子与所述指定标准句子之间的第一距离,并判断所述第一距离是否小于预设的第一距离阈值;The first distance judgment unit 30 is configured to calculate the first distance between the first sentence and the designated standard sentence according to a preset distance calculation formula, and determine whether the first distance is less than the preset first distance. Distance threshold
指定意图识别模型获取单元40,用于若所述第一距离小于预设的第一距离阈值,则根据预设的标准句子与意图识别模型的对应关系,获取与所述指定标准句子对应的指定意图识别模型,其中所述指定意图识别模型采用样本数据训练而成,所述样本数据仅由被标注为指定类型意图的句子构成;The designated intent recognition model acquiring unit 40 is configured to, if the first distance is less than a preset first distance threshold, acquire the designated standard sentence corresponding to the designated standard sentence according to the corresponding relationship between the preset standard sentence and the intent recognition model An intent recognition model, wherein the designated intent recognition model is trained using sample data, and the sample data is only composed of sentences marked as designated types of intents;
识别结果获取单元50,用于将所述第一句子输入所述指定意图识别模型中进行运算,从而得到所述指定意图识别模型输出的识别结果,其中所述识别结果包括识别成功或者识别失败;The recognition result obtaining unit 50 is configured to input the first sentence into the designated intent recognition model to perform operations, thereby obtaining a recognition result output by the designated intent recognition model, wherein the recognition result includes recognition success or recognition failure;
识别结果判断单元60,用于判断所述识别结果是否为识别成功;The recognition result judging unit 60 is used to judge whether the recognition result is a successful recognition;
指定实体含义标注单元70,用于若所述识别结果为识别成功,则根据预设的第一句子-标准句子-意图识别模型-实体含义的对应关系,获取与所述第一句子对应的指定实体含义,并对所述第一句子中进行消歧标注操作,从而使所述被标注为歧义的实体词语被标注上所述指定实体含义。The designated entity meaning labeling unit 70 is configured to, if the recognition result is successful, obtain the designated entity corresponding to the first sentence according to the preset correspondence relationship of the first sentence-standard sentence-intent recognition model-entity meaning Entity meaning, and perform a disambiguation labeling operation on the first sentence, so that the entity word that is labeled as ambiguous is labeled with the specified entity meaning.
在一个实施方式中,所述实体词语获取单元10,包括:In one embodiment, the entity word acquiring unit 10 includes:
双向编码器处理子单元,用于将所述第一句子输入预设的歧义标注模型中的双向编码器进行处理,从而与所述第一句子中的每个词语一一对应的第一歧义标注序列,并获取所述双向编码器的最后一层转换单元的隐藏状态向量集合,其中所述歧义标注模型由双向编码器和支持向量机构成,双向编码器包括多层转换单元;The two-way encoder processing subunit is used to input the first sentence into the two-way encoder in the preset ambiguity labeling model for processing, so that the first ambiguity label is one-to-one corresponding to each word in the first sentence Sequence, and obtain the hidden state vector set of the last-level conversion unit of the bidirectional encoder, wherein the ambiguity annotation model is composed of a bidirectional encoder and a support vector machine, and the bidirectional encoder includes a multilayer conversion unit;
第二歧义标注序列获取子单元,用于将所述隐藏状态向量集合输入所述支持向量机进行运算,得到与所述第一句子的每个词语一一对应的第二歧义标注序列,其中支持向量机进行运算时使用的函数为
Figure PCTCN2020093428-appb-000009
其中
Figure PCTCN2020093428-appb-000010
为所述第一句子的第i个词语对应的标注值,y为自变量,yi为所述第一句子的第i个词语对应的标注,w yi为第i个词语对应的参数向量,hi为第i个词语对应的隐藏状态向量,w yi与hi具有相同数量的分向量;
The second ambiguity tag sequence acquisition subunit is used to input the hidden state vector set into the support vector machine for operation to obtain a second ambiguity tag sequence corresponding to each word of the first sentence one-to-one, wherein the support The function used by the vector machine for calculation is
Figure PCTCN2020093428-appb-000009
among them
Figure PCTCN2020093428-appb-000010
Is the label value corresponding to the i-th word of the first sentence, y is the independent variable, yi is the label corresponding to the i-th word of the first sentence, w yi is the parameter vector corresponding to the i-th word, hi Is the hidden state vector corresponding to the i-th word, w yi and hi have the same number of component vectors;
相似程度值判断子单元,用于根据预设的相似程度值计算方法,计算所述第一歧义标注序列与所述第二歧义标注序列的相似程度值,并判断所述相似程 度值是否大于预设的相似程度阈值;The similarity value judgment subunit is used to calculate the similarity value between the first ambiguity annotation sequence and the second ambiguity annotation sequence according to a preset similarity value calculation method, and to determine whether the similarity value is greater than the expected value. Set the similarity threshold;
实体词语获取子单元,用于若所述相似程度值大于预设的相似程度阈值,则获取所述第二歧义标注序列中被标注为歧义的实体词语。The entity word acquiring subunit is configured to acquire the entity word marked as ambiguous in the second ambiguous annotation sequence if the similarity value is greater than a preset similarity threshold.
在一个实施方式中,所述指定标准句子获取单元20,包括:In one embodiment, the designated standard sentence obtaining unit 20 includes:
句子相似度值sim计算子单元,用于根据公式:
Figure PCTCN2020093428-appb-000011
计算出所述第一句子和所述标准句子数据库中的一个标准句子的句子相似度值sim,其中,A为所述第一句子的词频向量,B为标准句子的词频向量,Ai为第一句子的第i个词语在整个句子中出现的次数;Bi为标准句子的第i个词语在整个句子中出现的次数;
The sentence similarity value sim calculation subunit is used according to the formula:
Figure PCTCN2020093428-appb-000011
Calculate the sentence similarity value sim between the first sentence and a standard sentence in the standard sentence database, where A is the word frequency vector of the first sentence, B is the word frequency vector of the standard sentence, and Ai is the first The number of times the i-th word of the sentence appears in the whole sentence; Bi is the number of times the i-th word of the standard sentence appears in the whole sentence;
句子相似度值sim判断子单元,用于判断所述标准句子数据库中是否存在所述句子相似度值sim大于预设的句子相似度阈值的标准句子;The sentence similarity value sim judgment subunit is used to judge whether there is a standard sentence whose sentence similarity value sim is greater than a preset sentence similarity threshold in the standard sentence database;
指定标准句子标记子单元,用于若存在,则将所述句子相似度值sim大于预设的句子相似度阈值的标准句子记为指定标准句子。The designated standard sentence marking subunit is used to record the standard sentence with the sentence similarity value sim greater than the preset sentence similarity threshold as the designated standard sentence if it exists.
在一个实施方式中,所述第一距离判断单元30,包括:In one embodiment, the first distance determining unit 30 includes:
词向量库查询子单元,用于通过查询预设的词向量库,获取与所述第一句子对应的第一词向量序列I,以及获取与所述指定标准句子对应的第二词向量序列R;The word vector database query subunit is used to query a preset word vector database to obtain a first word vector sequence I corresponding to the first sentence, and to obtain a second word vector sequence R corresponding to the specified standard sentence ;
第一距离D计算子单元,用于根据公式:The first distance D calculation subunit is used according to the formula:
Figure PCTCN2020093428-appb-000012
计算所述第一句子与所述指定标准句子之间的第一距离D,其中|I|是所述第一词向量序列中的词语数;|R|是所述第二词向量序列中的词语数;w是词向量;α为调整两个词向量之间的余弦相似度的放大系数;max(α×cosDis(w,R)是计算第二词向量序列R中所有词语对应的词向量与第一词向量序列I中的词向量w的余弦相似度中的最大值。
Figure PCTCN2020093428-appb-000012
Calculate the first distance D between the first sentence and the specified standard sentence, where |I| is the number of words in the first word vector sequence; |R| is the number of words in the second word vector sequence The number of words; w is the word vector; α is the amplification factor for adjusting the cosine similarity between the two word vectors; max(α×cosDis(w, R) is the word vector corresponding to all words in the second word vector sequence R The maximum value of the cosine similarity with the word vector w in the first word vector sequence I.
在一个实施方式中,所述装置,包括:In one embodiment, the device includes:
样本数据划分单元,用于获取预先收集的多个样本数据,并将所述多个样本数据划分为训练数据和测试数据;其中,所述样本数据为被标注为指定类型意图的句子;The sample data dividing unit is used to obtain a plurality of pre-collected sample data, and divide the plurality of sample data into training data and test data; wherein, the sample data is a sentence marked as a specified type of intention;
中间意图识别模型获取单元,用于将训练数据输入到预设的神经网络模型中进行训练,其中训练采用随机梯度下降法,从而得到中间意图识别模型;The intermediate intent recognition model acquisition unit is used to input training data into the preset neural network model for training, where the training adopts the stochastic gradient descent method to obtain the intermediate intent recognition model;
验证通过判断单元,用于采用所述测试数据对所述中间意图识别模型进行验证,并判断验证是否通过;The verification passing judgment unit is configured to verify the intermediate intention recognition model by using the test data, and judge whether the verification is passed;
指定意图识别模型标记单元,用于若验证通过,则将所述中间意图识别记为所述指定意图识别模型。The designated intent recognition model marking unit is used to record the intermediate intent recognition as the designated intent recognition model if the verification is passed.
在一个实施方式中,所述指定标准句子存在多个,所述装置,包括:In one embodiment, there are multiple specified standard sentences, and the device includes:
备选标准句子获取单元,用于若所述识别结果为识别失败,则从多个指定 标准句子中获取备选标准句子,其中,所述备选标准句子与所述第一句子之间的第二距离大于所述第一距离阈值并且小于预设的第二距离阈值;The candidate standard sentence obtaining unit is configured to obtain a candidate standard sentence from a plurality of designated standard sentences if the recognition result is a recognition failure, wherein the first sentence between the candidate standard sentence and the first sentence 2. The distance is greater than the first distance threshold and less than the preset second distance threshold;
备选意图识别模型获取单元,用于根据预设的标准句子与意图识别模型的对应关系,获取与所述备选标准句子对应的备选意图识别模型;The candidate intent recognition model obtaining unit is configured to obtain the candidate intent recognition model corresponding to the candidate standard sentence according to the preset corresponding relationship between the standard sentence and the intent recognition model;
第二识别结果获取单元,用于将所述第一句子输入所述备选意图识别模型中进行运算,从而得到所述备选意图识别模型输出的第二识别结果,其中所述第二识别结果包括识别成功或者识别失败;The second recognition result acquisition unit is configured to input the first sentence into the candidate intent recognition model to perform operations, thereby obtaining a second recognition result output by the candidate intent recognition model, wherein the second recognition result Including recognition success or recognition failure;
第二识别结果判断单元,用于判断所述第二识别结果是否为识别成功;The second recognition result judging unit is used to judge whether the second recognition result is a successful recognition;
备选实体含义标注单元,用于若所述第二识别结果为识别成功,则根据预设的第一句子-标准句子-意图识别模型-实体含义的对应关系,获取与所述第一句子对应的备选实体含义,并对所述第一句子中进行消歧标注操作,从而使所述被标注为歧义的实体词语被标注上所述备选实体含义。An alternative entity meaning labeling unit, configured to, if the second recognition result is successful, obtain the corresponding relationship to the first sentence according to the preset correspondence relationship of the first sentence-standard sentence-intent recognition model-entity meaning The candidate entity meaning of, and a disambiguation labeling operation is performed on the first sentence, so that the entity word that is labeled as ambiguous is labeled with the candidate entity meaning.
在一个实施方式中,所述装置,包括:In one embodiment, the device includes:
数量获取单元,用于若所述第二识别结果为识别失败,则获取所述指定标准句子的数量;A quantity acquiring unit, configured to acquire the quantity of the designated standard sentence if the second recognition result is a recognition failure;
数量阈值判断单元,用于判断所述指定标准句子的数量是否大于预设的数量阈值;A quantity threshold judging unit for judging whether the quantity of the specified standard sentences is greater than a preset quantity threshold;
标注修改单元,用于若所述指定标准句子的数量不大于预设的数量阈值,则执行标注修改操作,其中所述标注修改操作用于将被标注为歧义的实体词语的标注修改为无歧义标注。An annotation modification unit, configured to perform an annotation modification operation if the number of the designated standard sentences is not greater than a preset number threshold, wherein the annotation modification operation is used to modify the annotations of the entity words that are marked as ambiguous to be unambiguous Label.
其中上述实施方式中的上述单元或子单元分别用于执行的操作与前述实施方式的基于意图识别模型的实体消歧方法的步骤一一对应,在此不再赘述。The operations performed by the aforementioned units or sub-units in the aforementioned embodiment respectively correspond to the steps of the entity disambiguation method based on the intention recognition model of the aforementioned embodiment, and will not be repeated here.
参照图3,本申请实施例中还提供一种计算机设备,该计算机设备可以是服务器,其内部结构可以如图所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设计的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储基于意图识别模型的实体消歧方法所用数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种基于意图识别模型的实体消歧方法。3, an embodiment of the present application also provides a computer device. The computer device may be a server, and its internal structure may be as shown in the figure. The computer equipment includes a processor, a memory, a network interface, and a database connected through a system bus. Among them, the processor designed by the computer is used to provide calculation and control capabilities. The memory of the computer device includes a non-volatile 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 computer programs in the non-volatile storage medium. The database of the computer equipment is used to store the data used in the entity disambiguation method based on the intention recognition model. The network interface of the computer device is used to communicate with an external terminal through a network connection. The computer program is executed by the processor to realize an entity disambiguation method based on the intention recognition model.
上述处理器执行上述基于意图识别模型的实体消歧方法,其中所述方法包括的步骤分别与执行前述实施方式的基于意图识别模型的实体消歧方法的步骤一一对应,在此不再赘述。The processor executes the above-mentioned entity disambiguation method based on the intention recognition model, wherein the steps included in the method respectively correspond to the steps of executing the entity disambiguation method based on the intention recognition model of the foregoing embodiment in a one-to-one correspondence, and will not be repeated here.
本申请一实施例还提供一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现基于意图识别模型的实体消歧方法,所述存储介质为易失性存储介质或非易失性存储介质,其中所述方法包括的步骤分别与执行前述实施方式的基于意图识别模型的实体消歧方法的步骤一一对应,在此不再赘述。An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, an entity disambiguation method based on an intention recognition model is implemented, and the storage medium is a volatile storage medium. Or a non-volatile storage medium, wherein the steps included in the method respectively correspond to the steps of performing the entity disambiguation method based on the intention recognition model of the foregoing embodiment, and will not be repeated here.

Claims (20)

  1. 一种基于意图识别模型的实体消歧方法,其中,包括:An entity disambiguation method based on intent recognition model, which includes:
    获取待消歧的第一句子,并根据预设的歧义标注方法,对所述第一句子进行歧义标注处理,从而获取所述第一句子中的被标注为歧义的实体词语;Acquire the first sentence to be disambiguated, and perform ambiguity labeling processing on the first sentence according to a preset ambiguity labeling method, so as to obtain the entity words labeled as ambiguous in the first sentence;
    根据预设的标准句子挑选方法,从预设的标准句子数据库中选出指定标准句子;According to the preset standard sentence selection method, select the designated standard sentence from the preset standard sentence database;
    根据预设的距离计算公式,计算所述第一句子与所述指定标准句子之间的第一距离,并判断所述第一距离是否小于预设的第一距离阈值;Calculate the 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 less than a preset first distance threshold;
    若所述第一距离小于预设的第一距离阈值,则根据预设的标准句子与意图识别模型的对应关系,获取与所述指定标准句子对应的指定意图识别模型,其中所述指定意图识别模型采用样本数据训练而成,所述样本数据仅由被标注为指定类型意图的句子构成;If the first distance is less than the preset first distance threshold, the specified intent recognition model corresponding to the specified standard sentence is obtained according to the corresponding relationship between the preset standard sentence and the intent recognition model, wherein the specified intent recognition The model is trained using sample data, and the sample data is only composed of sentences marked as specified types of intentions;
    将所述第一句子输入所述指定意图识别模型中进行运算,从而得到所述指定意图识别模型输出的识别结果,其中所述识别结果包括识别成功或者识别失败;Inputting the first sentence into the designated intent recognition model to perform operations, so as to obtain a recognition result output by the designated intent recognition model, wherein the recognition result includes recognition success or recognition failure;
    判断所述识别结果是否为识别成功;Determine whether the recognition result is successful;
    若所述识别结果为识别成功,则根据预设的第一句子-标准句子-意图识别模型-实体含义的对应关系,获取与所述第一句子对应的指定实体含义,并对所述第一句子中进行消歧标注操作,从而使所述被标注为歧义的实体词语被标注上所述指定实体含义。If the recognition result is successful, then according to the preset first sentence-standard sentence-intent recognition model-entity meaning corresponding relationship, the designated entity meaning corresponding to the first sentence is acquired, and the first sentence A disambiguation labeling operation is performed in the sentence, so that the entity word that is labeled as ambiguous is labeled with the specified entity meaning.
  2. 根据权利要求1所述的基于意图识别模型的实体消歧方法,其中,所述根据预设的歧义标注方法,对所述第一句子进行歧义标注处理,从而获取所述第一句子中的被标注为歧义的实体词语的步骤,包括:The entity disambiguation method based on the intent recognition model according to claim 1, wherein the first sentence is subjected to ambiguity labeling processing according to the preset ambiguity labeling method, so as to obtain the object in the first sentence The steps for marking ambiguous entity words include:
    将所述第一句子输入预设的歧义标注模型中的双向编码器进行处理,从而与所述第一句子中的每个词语一一对应的第一歧义标注序列,并获取所述双向编码器的最后一层转换单元的隐藏状态向量集合,其中所述歧义标注模型由双向编码器和支持向量机构成,双向编码器包括多层转换单元;The first sentence is input into the bidirectional encoder in the preset ambiguity annotation model for processing, so that the first ambiguity annotation sequence corresponding to each word in the first sentence one-to-one, and the bidirectional encoder is obtained The hidden state vector set of the last-level conversion unit of, wherein the ambiguity annotation model is composed of a bidirectional encoder and a support vector machine, and the bidirectional encoder includes a multilayer conversion unit;
    将所述隐藏状态向量集合输入所述支持向量机进行运算,得到与所述第一句子的每个词语一一对应的第二歧义标注序列,其中支持向量机进行运算时使用的函数为
    Figure PCTCN2020093428-appb-100001
    其中
    Figure PCTCN2020093428-appb-100002
    为所述第一句子的第i个词语对应的标注值,y为自变量,yi为所述第一句子的第i个词语对应的标注,w yi为第i个词语对应的参数向量,hi为第i个词语对应的隐藏状态向量,w yi与hi具有相同数量的分向量;
    The hidden state vector set is input into the support vector machine for operation, and a second ambiguous tag sequence corresponding to each word of the first sentence one-to-one is obtained, wherein the function used by the support vector machine for the operation is
    Figure PCTCN2020093428-appb-100001
    among them
    Figure PCTCN2020093428-appb-100002
    Is the label value corresponding to the i-th word of the first sentence, y is the independent variable, yi is the label corresponding to the i-th word of the first sentence, w yi is the parameter vector corresponding to the i-th word, hi Is the hidden state vector corresponding to the i-th word, w yi and hi have the same number of component vectors;
    根据预设的相似程度值计算方法,计算所述第一歧义标注序列与所述第二歧义标注序列的相似程度值,并判断所述相似程度值是否大于预设的相似程度阈值;Calculate the similarity value between the first ambiguous annotation sequence and the second ambiguous annotation sequence according to a preset similarity value calculation method, and determine whether the similarity value is greater than a preset similarity threshold;
    若所述相似程度值大于预设的相似程度阈值,则获取所述第二歧义标注序列中被标注为歧义的实体词语。If the similarity degree value is greater than the preset similarity degree threshold, acquiring the entity words marked as ambiguous in the second ambiguous annotation sequence.
  3. 根据权利要求1所述的基于意图识别模型的实体消歧方法,其中,所述根据预设的标准句子挑选方法,从预设的标准句子数据库中选出指定标准句子的步骤,包括:The entity disambiguation method based on the intent recognition model according to claim 1, wherein the step of selecting a specified standard sentence from a preset standard sentence database according to a preset standard sentence selection method includes:
    根据公式:
    Figure PCTCN2020093428-appb-100003
    计算出所述第一句子和所述标准句子数据库中的一个标准句子的句子相似度值sim,其中,A为所述第一句子的词频向量,B为标准句子的词频向量,Ai为第一句子的第i个词语在整个句子中出现的次数;Bi为标准句子的第i个词语在整个句子中出现的次数;
    According to the formula:
    Figure PCTCN2020093428-appb-100003
    Calculate the sentence similarity value sim between the first sentence and a standard sentence in the standard sentence database, where A is the word frequency vector of the first sentence, B is the word frequency vector of the standard sentence, and Ai is the first The number of times the i-th word of the sentence appears in the whole sentence; Bi is the number of times the i-th word of the standard sentence appears in the whole sentence;
    判断所述标准句子数据库中是否存在所述句子相似度值sim大于预设的句子相似度阈值的标准句子;Judging whether there is a standard sentence whose sentence similarity value sim is greater than a preset sentence similarity threshold in the standard sentence database;
    若存在,则将所述句子相似度值sim大于预设的句子相似度阈值的标准句子记为指定标准句子。If it exists, the standard sentence whose sentence similarity value sim is greater than the preset sentence similarity threshold is recorded as the designated standard sentence.
  4. 根据权利要求1所述的基于意图识别模型的实体消歧方法,其中,所述根据预设的距离计算公式,计算所述第一句子与所述指定标准句子之间的第一距离的步骤,包括:The entity disambiguation method based on the intent recognition model according to claim 1, wherein the step of calculating the first distance between the first sentence and the specified standard sentence according to a preset distance calculation formula, include:
    通过查询预设的词向量库,获取与所述第一句子对应的第一词向量序列I,以及获取与所述指定标准句子对应的第二词向量序列R;By querying a preset word vector library, obtaining a first word vector sequence I corresponding to the first sentence, and obtaining a second word vector sequence R corresponding to the designated standard sentence;
    根据公式:According to the formula:
    Figure PCTCN2020093428-appb-100004
    计算所述第一句子与所述指定标准句子之间的第一距离D,其中|I|是所述第一词向量序列中的词语数;|R|是所述第二词向量序列中的词语数;w是词向量;α为调整两个词向量之间的余弦相似度的放大系数;max(α×cosDis(w,R)是计算第二词向量序列R中所有词语对应的词向量与第一词向量序列I中的词向量w的余弦相似度中的最大值。
    Figure PCTCN2020093428-appb-100004
    Calculate the first distance D between the first sentence and the specified standard sentence, where |I| is the number of words in the first word vector sequence; |R| is the number of words in the second word vector sequence The number of words; w is the word vector; α is the magnification factor that adjusts the cosine similarity between the two word vectors; max(α×cosDis(w, R) is the word vector corresponding to all words in the second word vector sequence R The maximum value of the cosine similarity with the word vector w in the first word vector sequence I.
  5. 根据权利要求1所述的基于意图识别模型的实体消歧方法,其中,所述若所述第一距离小于预设的第一距离阈值,则根据预设的标准句子与意图识别模型的对应关系,获取与所述指定标准句子对应的指定意图识别模型,其中所述指定意图识别模型采用样本数据训练而成,所述样本数据仅由被标注为指定类型意图的句子构成的步骤之前,包括:The entity disambiguation method based on the intent recognition model according to claim 1, wherein if the first distance is less than a preset first distance threshold, according to the correspondence between the preset standard sentence and the intent recognition model Before the step of 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 sample data is only composed of sentences marked as designated types of intents, including:
    获取预先收集的多个样本数据,并将所述多个样本数据划分为训练数据和测试数据;其中,所述样本数据为被标注为指定类型意图的句子;Acquiring a plurality of sample data collected in advance, and dividing the plurality of sample data into training data and test data; wherein, the sample data is a sentence marked as a specified type of intent;
    将训练数据输入到预设的神经网络模型中进行训练,其中训练采用随机梯度下降法,从而得到中间意图识别模型;Input the training data into the preset neural network model for training, where the training adopts the stochastic gradient descent method to obtain the intermediate intention recognition model;
    采用所述测试数据对所述中间意图识别模型进行验证,并判断验证是否通过;Use the test data to verify the intermediate intention recognition model, and determine whether the verification passes;
    若验证通过,则将所述中间意图识别记为所述指定意图识别模型。If the verification is passed, the intermediate intent recognition is recorded as the designated intent recognition model.
  6. 根据权利要求1所述的基于意图识别模型的实体消歧方法,其中,所 述指定标准句子存在多个,所述判断所述识别结果是否为识别成功的步骤之后,包括:The entity disambiguation method based on an intent recognition model according to claim 1, wherein there are multiple specified standard sentences, and after the step of determining whether the recognition result is successful, the method includes:
    若所述识别结果为识别失败,则从多个指定标准句子中获取备选标准句子,其中,所述备选标准句子与所述第一句子之间的第二距离大于所述第一距离阈值并且小于预设的第二距离阈值;If the recognition result is recognition failure, obtain candidate standard sentences from a plurality of specified standard sentences, wherein the second distance between the candidate standard sentence and the first sentence is greater than the first distance threshold And is smaller than the preset second distance threshold;
    根据预设的标准句子与意图识别模型的对应关系,获取与所述备选标准句子对应的备选意图识别模型;Obtaining the candidate intent recognition model corresponding to the candidate standard sentence according to the preset corresponding relationship between the standard sentence and the intent recognition model;
    将所述第一句子输入所述备选意图识别模型中进行运算,从而得到所述备选意图识别模型输出的第二识别结果,其中所述第二识别结果包括识别成功或者识别失败;Inputting the first sentence into the candidate intent recognition model for calculation, thereby obtaining a second recognition result output by the candidate intent recognition model, where the second recognition result includes recognition success or recognition failure;
    判断所述第二识别结果是否为识别成功;Judging whether the second recognition result is a successful recognition;
    若所述第二识别结果为识别成功,则根据预设的第一句子-标准句子-意图识别模型-实体含义的对应关系,获取与所述第一句子对应的备选实体含义,并对所述第一句子中进行消歧标注操作,从而使所述被标注为歧义的实体词语被标注上所述备选实体含义。If the second recognition result is successful, then according to the preset correspondence relationship of the first sentence-standard sentence-intent recognition model-entity meaning, the candidate entity meaning corresponding to the first sentence is obtained, and the corresponding The disambiguation labeling operation is performed in the first sentence, so that the entity word that is labeled as ambiguous is labeled with the candidate entity meaning.
  7. 根据权利要求6所述的基于意图识别模型的实体消歧方法,其中,所述判断所述第二识别结果是否为识别成功的步骤之后,包括:The entity disambiguation method based on the intent recognition model according to claim 6, wherein after the step of determining whether the second recognition result is a successful recognition, the method comprises:
    若所述第二识别结果为识别失败,则获取所述指定标准句子的数量;If the second recognition result is a recognition failure, obtain the number of the specified standard sentences;
    判断所述指定标准句子的数量是否大于预设的数量阈值;Judging whether the number of specified standard sentences is greater than a preset number threshold;
    若所述指定标准句子的数量不大于预设的数量阈值,则执行标注修改操作,其中所述标注修改操作用于将被标注为歧义的实体词语的标注修改为无歧义标注。If the number of the designated standard sentences is not greater than the preset number threshold, a label modification operation is performed, wherein the label modification operation is used to modify the label of the entity word that is marked as ambiguous to an unambiguous label.
  8. 一种基于意图识别模型的实体消歧装置,其中,包括:An entity disambiguation device based on an intention recognition model, which includes:
    实体词语获取单元,用于获取待消歧的第一句子,并根据预设的歧义标注方法,对所述第一句子进行歧义标注处理,从而获取所述第一句子中的被标注为歧义的实体词语;The entity word acquisition unit is used to acquire the first sentence to be disambiguated, and perform ambiguity labeling processing on the first sentence according to a preset ambiguity labeling method, so as to obtain the first sentence marked as ambiguous Entity words
    指定标准句子获取单元,用于根据预设的标准句子挑选方法,从预设的标准句子数据库中选出指定标准句子;The designated standard sentence acquisition unit is used to select the designated standard sentence from the preset standard sentence database according to the preset standard sentence selection method;
    第一距离判断单元,用于根据预设的距离计算公式,计算所述第一句子与所述指定标准句子之间的第一距离,并判断所述第一距离是否小于预设的第一距离阈值;The first distance judgment unit is configured to calculate the first distance between the first sentence and the designated standard sentence according to a preset distance calculation formula, and determine whether the first distance is less than the preset first distance Threshold
    指定意图识别模型获取单元,用于若所述第一距离小于预设的第一距离阈值,则根据预设的标准句子与意图识别模型的对应关系,获取与所述指定标准句子对应的指定意图识别模型,其中所述指定意图识别模型采用样本数据训练而成,所述样本数据仅由被标注为指定类型意图的句子构成;A designated intent recognition model acquiring unit, configured to, if the first distance is less than a preset first distance threshold, acquire the designated intent corresponding to the designated standard sentence according to the corresponding relationship between the preset standard sentence and the intent recognition model A recognition model, wherein the designated intent recognition model is trained using sample data, and the sample data is only composed of sentences marked as designated types of intents;
    识别结果获取单元,用于将所述第一句子输入所述指定意图识别模型中进行运算,从而得到所述指定意图识别模型输出的识别结果,其中所述识别结果包括识别成功或者识别失败;A recognition result obtaining unit, configured to input the first sentence into the designated intent recognition model for calculation, thereby obtaining a recognition result output by the designated intent recognition model, wherein the recognition result includes recognition success or recognition failure;
    识别结果判断单元,用于判断所述识别结果是否为识别成功;A recognition result judging unit for judging whether the recognition result is a successful recognition;
    指定实体含义标注单元,用于若所述识别结果为识别成功,则根据预设的第一句子-标准句子-意图识别模型-实体含义的对应关系,获取与所述第一句子对应的指定实体含义,并对所述第一句子中进行消歧标注操作,从而使所述被标注为歧义的实体词语被标注上所述指定实体含义。The designated entity meaning labeling unit is used to obtain the designated entity corresponding to the first sentence according to the preset correspondence relationship of the first sentence-standard sentence-intent recognition model-entity meaning Meaning, and perform a disambiguation labeling operation on the first sentence, so that the entity word labeled as ambiguous is labeled with the specified entity meaning.
  9. 一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其中,所述处理器执行所述计算机程序时实现一种基于意图识别模型的实体消歧方法,所述方法包括:A computer device includes a memory and a processor, the memory stores a computer program, wherein the processor implements an entity disambiguation method based on an intent recognition model when the processor executes the computer program, and the method includes:
    获取待消歧的第一句子,并根据预设的歧义标注方法,对所述第一句子进行歧义标注处理,从而获取所述第一句子中的被标注为歧义的实体词语;Acquire the first sentence to be disambiguated, and perform ambiguity labeling processing on the first sentence according to a preset ambiguity labeling method, so as to obtain the entity words labeled as ambiguous in the first sentence;
    根据预设的标准句子挑选方法,从预设的标准句子数据库中选出指定标准句子;According to the preset standard sentence selection method, select the designated standard sentence from the preset standard sentence database;
    根据预设的距离计算公式,计算所述第一句子与所述指定标准句子之间的第一距离,并判断所述第一距离是否小于预设的第一距离阈值;Calculate the 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 less than a preset first distance threshold;
    若所述第一距离小于预设的第一距离阈值,则根据预设的标准句子与意图识别模型的对应关系,获取与所述指定标准句子对应的指定意图识别模型,其中所述指定意图识别模型采用样本数据训练而成,所述样本数据仅由被标注为指定类型意图的句子构成;If the first distance is less than the preset first distance threshold, the specified intent recognition model corresponding to the specified standard sentence is obtained according to the corresponding relationship between the preset standard sentence and the intent recognition model, wherein the specified intent recognition The model is trained using sample data, and the sample data is only composed of sentences marked as specified types of intentions;
    将所述第一句子输入所述指定意图识别模型中进行运算,从而得到所述指定意图识别模型输出的识别结果,其中所述识别结果包括识别成功或者识别失败;Inputting the first sentence into the designated intent recognition model to perform operations, so as to obtain a recognition result output by the designated intent recognition model, wherein the recognition result includes recognition success or recognition failure;
    判断所述识别结果是否为识别成功;Determine whether the recognition result is successful;
    若所述识别结果为识别成功,则根据预设的第一句子-标准句子-意图识别模型-实体含义的对应关系,获取与所述第一句子对应的指定实体含义,并对所述第一句子中进行消歧标注操作,从而使所述被标注为歧义的实体词语被标注上所述指定实体含义。If the recognition result is successful, then according to the preset first sentence-standard sentence-intent recognition model-entity meaning corresponding relationship, the designated entity meaning corresponding to the first sentence is acquired, and the first sentence A disambiguation labeling operation is performed in the sentence, so that the entity word that is labeled as ambiguous is labeled with the specified entity meaning.
  10. 根据权利要求9所述的计算机设备,其中,所述根据预设的歧义标注方法,对所述第一句子进行歧义标注处理,从而获取所述第一句子中的被标注为歧义的实体词语的步骤,包括:9. The computer device according to claim 9, wherein the first sentence is subjected to ambiguity labeling processing according to a preset ambiguity labeling method, so as to obtain the information of the entity words marked as ambiguous in the first sentence The steps include:
    将所述第一句子输入预设的歧义标注模型中的双向编码器进行处理,从而与所述第一句子中的每个词语一一对应的第一歧义标注序列,并获取所述双向编码器的最后一层转换单元的隐藏状态向量集合,其中所述歧义标注模型由双向编码器和支持向量机构成,双向编码器包括多层转换单元;The first sentence is input into the bidirectional encoder in the preset ambiguity annotation model for processing, so that the first ambiguity annotation sequence corresponding to each word in the first sentence one-to-one, and the bidirectional encoder is obtained The hidden state vector set of the last-level conversion unit of, wherein the ambiguity annotation model is composed of a bidirectional encoder and a support vector machine, and the bidirectional encoder includes a multilayer conversion unit;
    将所述隐藏状态向量集合输入所述支持向量机进行运算,得到与所述第一句子的每个词语一一对应的第二歧义标注序列,其中支持向量机进行运算时使用的函数为
    Figure PCTCN2020093428-appb-100005
    其中
    Figure PCTCN2020093428-appb-100006
    为所述第一句子的第i个词语对应的标注值,y为自变量,yi为所述第一句子的第i个词语对应的标注,w yi为第i个词语对应的参数向量,hi为第i个词语对应的隐藏状态向量,w yi与hi具有相同数量的分向量;
    The hidden state vector set is input into the support vector machine for operation, and a second ambiguous tag sequence corresponding to each word of the first sentence one-to-one is obtained, wherein the function used by the support vector machine for the operation is
    Figure PCTCN2020093428-appb-100005
    among them
    Figure PCTCN2020093428-appb-100006
    Is the label value corresponding to the i-th word of the first sentence, y is the independent variable, yi is the label corresponding to the i-th word of the first sentence, w yi is the parameter vector corresponding to the i-th word, hi Is the hidden state vector corresponding to the i-th word, w yi and hi have the same number of component vectors;
    根据预设的相似程度值计算方法,计算所述第一歧义标注序列与所述第二 歧义标注序列的相似程度值,并判断所述相似程度值是否大于预设的相似程度阈值;Calculate the similarity value between the first ambiguous annotation sequence and the second ambiguous annotation sequence according to a preset similarity value calculation method, and determine whether the similarity value is greater than a preset similarity threshold;
    若所述相似程度值大于预设的相似程度阈值,则获取所述第二歧义标注序列中被标注为歧义的实体词语。If the similarity degree value is greater than the preset similarity degree threshold, acquiring the entity words marked as ambiguous in the second ambiguous annotation sequence.
  11. 根据权利要求9所述的计算机设备,其中,所述根据预设的标准句子挑选方法,从预设的标准句子数据库中选出指定标准句子的步骤,包括:9. The computer device according to claim 9, wherein the step of selecting a specified standard sentence from a preset standard sentence database according to a preset standard sentence selection method comprises:
    根据公式:
    Figure PCTCN2020093428-appb-100007
    计算出所述第一句子和所述标准句子数据库中的一个标准句子的句子相似度值sim,其中,A为所述第一句子的词频向量,B为标准句子的词频向量,Ai为第一句子的第i个词语在整个句子中出现的次数;Bi为标准句子的第i个词语在整个句子中出现的次数;
    According to the formula:
    Figure PCTCN2020093428-appb-100007
    Calculate the sentence similarity value sim between the first sentence and a standard sentence in the standard sentence database, where A is the word frequency vector of the first sentence, B is the word frequency vector of the standard sentence, and Ai is the first The number of times the i-th word of the sentence appears in the whole sentence; Bi is the number of times the i-th word of the standard sentence appears in the whole sentence;
    判断所述标准句子数据库中是否存在所述句子相似度值sim大于预设的句子相似度阈值的标准句子;Judging whether there is a standard sentence whose sentence similarity value sim is greater than a preset sentence similarity threshold in the standard sentence database;
    若存在,则将所述句子相似度值sim大于预设的句子相似度阈值的标准句子记为指定标准句子。If it exists, the standard sentence whose sentence similarity value sim is greater than the preset sentence similarity threshold is recorded as the designated standard sentence.
  12. 根据权利要求9所述的计算机设备,其中,所述根据预设的距离计算公式,计算所述第一句子与所述指定标准句子之间的第一距离的步骤,包括:9. The computer device according to claim 9, wherein the step of calculating the first distance between the first sentence and the designated standard sentence according to a preset distance calculation formula comprises:
    通过查询预设的词向量库,获取与所述第一句子对应的第一词向量序列I,以及获取与所述指定标准句子对应的第二词向量序列R;By querying a preset word vector library, obtaining a first word vector sequence I corresponding to the first sentence, and obtaining a second word vector sequence R corresponding to the designated standard sentence;
    根据公式:According to the formula:
    Figure PCTCN2020093428-appb-100008
    计算所述第一句子与所述指定标准句子之间的第一距离D,其中|I|是所述第一词向量序列中的词语数;|R|是所述第二词向量序列中的词语数;w是词向量;α为调整两个词向量之间的余弦相似度的放大系数;max(α×cosDis(w,R)是计算第二词向量序列R中所有词语对应的词向量与第一词向量序列I中的词向量w的余弦相似度中的最大值。
    Figure PCTCN2020093428-appb-100008
    Calculate the first distance D between the first sentence and the specified standard sentence, where |I| is the number of words in the first word vector sequence; |R| is the number of words in the second word vector sequence The number of words; w is the word vector; α is the amplification factor for adjusting the cosine similarity between the two word vectors; max(α×cosDis(w, R) is the word vector corresponding to all words in the second word vector sequence R The maximum value of the cosine similarity with the word vector w in the first word vector sequence I.
  13. 根据权利要求9所述的计算机设备,其中,所述若所述第一距离小于预设的第一距离阈值,则根据预设的标准句子与意图识别模型的对应关系,获取与所述指定标准句子对应的指定意图识别模型,其中所述指定意图识别模型采用样本数据训练而成,所述样本数据仅由被标注为指定类型意图的句子构成的步骤之前,包括:9. The computer device according to claim 9, wherein if the first distance is less than a preset first distance threshold, the corresponding relationship between the preset standard sentence and the intent recognition model is obtained to obtain the corresponding relationship with the specified standard The specified intent recognition model corresponding to the sentence, wherein the specified intent recognition model is trained using sample data, and the sample data is only composed of sentences marked as the specified type of intent. Before the step, the steps include:
    获取预先收集的多个样本数据,并将所述多个样本数据划分为训练数据和测试数据;其中,所述样本数据为被标注为指定类型意图的句子;Acquiring a plurality of sample data collected in advance, and dividing the plurality of sample data into training data and test data; wherein, the sample data is a sentence marked as a specified type of intent;
    将训练数据输入到预设的神经网络模型中进行训练,其中训练采用随机梯度下降法,从而得到中间意图识别模型;Input the training data into the preset neural network model for training, where the training adopts the stochastic gradient descent method to obtain the intermediate intention recognition model;
    采用所述测试数据对所述中间意图识别模型进行验证,并判断验证是否通过;Use the test data to verify the intermediate intention recognition model, and determine whether the verification passes;
    若验证通过,则将所述中间意图识别记为所述指定意图识别模型。If the verification is passed, the intermediate intent recognition is recorded as the designated intent recognition model.
  14. 根据权利要求9所述的计算机设备,其中,所述指定标准句子存在多个,所述判断所述识别结果是否为识别成功的步骤之后,包括:9. The computer device according to claim 9, wherein there are multiple specified standard sentences, and after the step of judging whether the recognition result is successful, the method comprises:
    若所述识别结果为识别失败,则从多个指定标准句子中获取备选标准句子,其中,所述备选标准句子与所述第一句子之间的第二距离大于所述第一距离阈值并且小于预设的第二距离阈值;If the recognition result is recognition failure, obtain candidate standard sentences from a plurality of specified standard sentences, wherein the second distance between the candidate standard sentence and the first sentence is greater than the first distance threshold And is smaller than the preset second distance threshold;
    根据预设的标准句子与意图识别模型的对应关系,获取与所述备选标准句子对应的备选意图识别模型;Obtaining the candidate intent recognition model corresponding to the candidate standard sentence according to the preset corresponding relationship between the standard sentence and the intent recognition model;
    将所述第一句子输入所述备选意图识别模型中进行运算,从而得到所述备选意图识别模型输出的第二识别结果,其中所述第二识别结果包括识别成功或者识别失败;Inputting the first sentence into the candidate intent recognition model for calculation, thereby obtaining a second recognition result output by the candidate intent recognition model, where the second recognition result includes recognition success or recognition failure;
    判断所述第二识别结果是否为识别成功;Judging whether the second recognition result is a successful recognition;
    若所述第二识别结果为识别成功,则根据预设的第一句子-标准句子-意图识别模型-实体含义的对应关系,获取与所述第一句子对应的备选实体含义,并对所述第一句子中进行消歧标注操作,从而使所述被标注为歧义的实体词语被标注上所述备选实体含义。If the second recognition result is successful, then according to the preset correspondence relationship of the first sentence-standard sentence-intent recognition model-entity meaning, the candidate entity meaning corresponding to the first sentence is obtained, and the corresponding The disambiguation labeling operation is performed in the first sentence, so that the entity word that is labeled as ambiguous is labeled with the candidate entity meaning.
  15. 根据权利要求14所述的计算机设备,其中,所述判断所述第二识别结果是否为识别成功的步骤之后,包括:The computer device according to claim 14, wherein after the step of judging whether the second recognition result is a successful recognition, it comprises:
    若所述第二识别结果为识别失败,则获取所述指定标准句子的数量;If the second recognition result is a recognition failure, obtain the number of the specified standard sentences;
    判断所述指定标准句子的数量是否大于预设的数量阈值;Judging whether the number of specified standard sentences is greater than a preset number threshold;
    若所述指定标准句子的数量不大于预设的数量阈值,则执行标注修改操作,其中所述标注修改操作用于将被标注为歧义的实体词语的标注修改为无歧义标注。If the number of the designated standard sentences is not greater than the preset number threshold, a label modification operation is performed, wherein the label modification operation is used to modify the label of the entity word that is marked as ambiguous to an unambiguous label.
  16. 一种计算机可读存储介质,其上存储有计算机程序,其中,所述计算机程序被处理器执行时实现一种基于意图识别模型的实体消歧方法,所述方法包括:A computer-readable storage medium having a computer program stored thereon, wherein the computer program implements an entity disambiguation method based on an intention recognition model when the computer program is executed by a processor, and the method includes:
    获取待消歧的第一句子,并根据预设的歧义标注方法,对所述第一句子进行歧义标注处理,从而获取所述第一句子中的被标注为歧义的实体词语;Acquire the first sentence to be disambiguated, and perform ambiguity labeling processing on the first sentence according to a preset ambiguity labeling method, so as to obtain the entity words labeled as ambiguous in the first sentence;
    根据预设的标准句子挑选方法,从预设的标准句子数据库中选出指定标准句子;According to the preset standard sentence selection method, select the designated standard sentence from the preset standard sentence database;
    根据预设的距离计算公式,计算所述第一句子与所述指定标准句子之间的第一距离,并判断所述第一距离是否小于预设的第一距离阈值;Calculate the 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 less than a preset first distance threshold;
    若所述第一距离小于预设的第一距离阈值,则根据预设的标准句子与意图识别模型的对应关系,获取与所述指定标准句子对应的指定意图识别模型,其中所述指定意图识别模型采用样本数据训练而成,所述样本数据仅由被标注为指定类型意图的句子构成;If the first distance is less than the preset first distance threshold, the specified intent recognition model corresponding to the specified standard sentence is obtained according to the corresponding relationship between the preset standard sentence and the intent recognition model, wherein the specified intent recognition The model is trained using sample data, and the sample data is only composed of sentences marked as specified types of intentions;
    将所述第一句子输入所述指定意图识别模型中进行运算,从而得到所述指定意图识别模型输出的识别结果,其中所述识别结果包括识别成功或者识别失败;Inputting the first sentence into the designated intent recognition model to perform operations, so as to obtain a recognition result output by the designated intent recognition model, wherein the recognition result includes recognition success or recognition failure;
    判断所述识别结果是否为识别成功;Determine whether the recognition result is successful;
    若所述识别结果为识别成功,则根据预设的第一句子-标准句子-意图识别模型-实体含义的对应关系,获取与所述第一句子对应的指定实体含义,并对所述第一句子中进行消歧标注操作,从而使所述被标注为歧义的实体词语被标注上所述指定实体含义。If the recognition result is successful, then according to the preset first sentence-standard sentence-intent recognition model-entity meaning corresponding relationship, the designated entity meaning corresponding to the first sentence is acquired, and the first sentence A disambiguation labeling operation is performed in the sentence, so that the entity word that is labeled as ambiguous is labeled with the specified entity meaning.
  17. 根据权利要求16所述的计算机可读存储介质,其中,所述根据预设的歧义标注方法,对所述第一句子进行歧义标注处理,从而获取所述第一句子中的被标注为歧义的实体词语的步骤,包括:16. The computer-readable storage medium according to claim 16, wherein the first sentence is subjected to ambiguity labeling processing according to a preset ambiguity labeling method, so as to obtain the ambiguity in the first sentence The steps of entity words include:
    将所述第一句子输入预设的歧义标注模型中的双向编码器进行处理,从而与所述第一句子中的每个词语一一对应的第一歧义标注序列,并获取所述双向编码器的最后一层转换单元的隐藏状态向量集合,其中所述歧义标注模型由双向编码器和支持向量机构成,双向编码器包括多层转换单元;The first sentence is input into the bidirectional encoder in the preset ambiguity annotation model for processing, so that the first ambiguity annotation sequence corresponding to each word in the first sentence one-to-one, and the bidirectional encoder is obtained The hidden state vector set of the last-level conversion unit of, wherein the ambiguity annotation model is composed of a bidirectional encoder and a support vector machine, and the bidirectional encoder includes a multilayer conversion unit;
    将所述隐藏状态向量集合输入所述支持向量机进行运算,得到与所述第一句子的每个词语一一对应的第二歧义标注序列,其中支持向量机进行运算时使用的函数为
    Figure PCTCN2020093428-appb-100009
    其中
    Figure PCTCN2020093428-appb-100010
    为所述第一句子的第i个词语对应的标注值,y为自变量,yi为所述第一句子的第i个词语对应的标注,w yi为第i个词语对应的参数向量,hi为第i个词语对应的隐藏状态向量,w yi与hi具有相同数量的分向量;
    The hidden state vector set is input into the support vector machine for operation, and a second ambiguous tag sequence corresponding to each word of the first sentence one-to-one is obtained, wherein the function used by the support vector machine for the operation is
    Figure PCTCN2020093428-appb-100009
    among them
    Figure PCTCN2020093428-appb-100010
    Is the label value corresponding to the i-th word of the first sentence, y is the independent variable, yi is the label corresponding to the i-th word of the first sentence, w yi is the parameter vector corresponding to the i-th word, hi Is the hidden state vector corresponding to the i-th word, w yi and hi have the same number of component vectors;
    根据预设的相似程度值计算方法,计算所述第一歧义标注序列与所述第二歧义标注序列的相似程度值,并判断所述相似程度值是否大于预设的相似程度阈值;Calculate the similarity value between the first ambiguous annotation sequence and the second ambiguous annotation sequence according to a preset similarity value calculation method, and determine whether the similarity value is greater than a preset similarity threshold;
    若所述相似程度值大于预设的相似程度阈值,则获取所述第二歧义标注序列中被标注为歧义的实体词语。If the similarity degree value is greater than the preset similarity degree threshold, acquiring the entity words marked as ambiguous in the second ambiguous annotation sequence.
  18. 根据权利要求16所述的计算机可读存储介质,其中,所述根据预设的标准句子挑选方法,从预设的标准句子数据库中选出指定标准句子的步骤,包括:16. The computer-readable storage medium according to claim 16, wherein the step of selecting a specified standard sentence from a preset standard sentence database according to a preset standard sentence selection method comprises:
    根据公式:
    Figure PCTCN2020093428-appb-100011
    计算出所述第一句子和所述标准句子数据库中的一个标准句子的句子相似度值sim,其中,A为所述第一句子的词频向量,B为标准句子的词频向量,Ai为第一句子的第i个词语在整个句子中出现的次数;Bi为标准句子的第i个词语在整个句子中出现的次数;
    According to the formula:
    Figure PCTCN2020093428-appb-100011
    Calculate the sentence similarity value sim between the first sentence and a standard sentence in the standard sentence database, where A is the word frequency vector of the first sentence, B is the word frequency vector of the standard sentence, and Ai is the first The number of times the i-th word of the sentence appears in the whole sentence; Bi is the number of times the i-th word of the standard sentence appears in the whole sentence;
    判断所述标准句子数据库中是否存在所述句子相似度值sim大于预设的句子相似度阈值的标准句子;Judging whether there is a standard sentence whose sentence similarity value sim is greater than a preset sentence similarity threshold in the standard sentence database;
    若存在,则将所述句子相似度值sim大于预设的句子相似度阈值的标准句子记为指定标准句子。If it exists, the standard sentence whose sentence similarity value sim is greater than the preset sentence similarity threshold is recorded as the designated standard sentence.
  19. 根据权利要求16所述的计算机可读存储介质,其中,所述根据预设的距离计算公式,计算所述第一句子与所述指定标准句子之间的第一距离的步骤,包括:The computer-readable storage medium according to claim 16, wherein the step of calculating the first distance between the first sentence and the designated standard sentence according to a preset distance calculation formula comprises:
    通过查询预设的词向量库,获取与所述第一句子对应的第一词向量序列I, 以及获取与所述指定标准句子对应的第二词向量序列R;Obtaining a first word vector sequence I corresponding to the first sentence and obtaining a second word vector sequence R corresponding to the designated standard sentence by querying a preset word vector library;
    根据公式:According to the formula:
    Figure PCTCN2020093428-appb-100012
    计算所述第一句子与所述指定标准句子之间的第一距离D,其中|I|是所述第一词向量序列中的词语数;|R|是所述第二词向量序列中的词语数;w是词向量;α为调整两个词向量之间的余弦相似度的放大系数;max(α×cosDis(w,R)是计算第二词向量序列R中所有词语对应的词向量与第一词向量序列I中的词向量w的余弦相似度中的最大值。
    Figure PCTCN2020093428-appb-100012
    Calculate the first distance D between the first sentence and the specified standard sentence, where |I| is the number of words in the first word vector sequence; |R| is the number of words in the second word vector sequence The number of words; w is the word vector; α is the magnification factor that adjusts the cosine similarity between the two word vectors; max(α×cosDis(w, R) is the word vector corresponding to all words in the second word vector sequence R The maximum value of the cosine similarity with the word vector w in the first word vector sequence I.
  20. 根据权利要求16所述的计算机可读存储介质,其中,所述若所述第一距离小于预设的第一距离阈值,则根据预设的标准句子与意图识别模型的对应关系,获取与所述指定标准句子对应的指定意图识别模型,其中所述指定意图识别模型采用样本数据训练而成,所述样本数据仅由被标注为指定类型意图的句子构成的步骤之前,包括:The computer-readable storage medium according to claim 16, wherein, if the first distance is less than a preset first distance threshold, the corresponding relationship between the preset standard sentence and the intent recognition model is obtained. The specified intent recognition model corresponding to the specified standard sentence, wherein the specified intent recognition model is trained using sample data, and the sample data is only composed of sentences marked as the specified type of intent. Before the step, the steps include:
    获取预先收集的多个样本数据,并将所述多个样本数据划分为训练数据和测试数据;其中,所述样本数据为被标注为指定类型意图的句子;Acquiring a plurality of sample data collected in advance, and dividing the plurality of sample data into training data and test data; wherein, the sample data is a sentence marked as a specified type of intent;
    将训练数据输入到预设的神经网络模型中进行训练,其中训练采用随机梯度下降法,从而得到中间意图识别模型;Input the training data into the preset neural network model for training, where the training adopts the stochastic gradient descent method to obtain the intermediate intention recognition model;
    采用所述测试数据对所述中间意图识别模型进行验证,并判断验证是否通过;Use the test data to verify the intermediate intention recognition model, and determine whether the verification passes;
    若验证通过,则将所述中间意图识别记为所述指定意图识别模型。If the verification is passed, the intermediate intent recognition is recorded as the designated intent recognition model.
PCT/CN2020/093428 2019-10-15 2020-05-29 Method and apparatus for entity disambiguation based on intention recognition model, and computer device WO2021073119A1 (en)

Applications Claiming Priority (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
CN201910978260.9 2019-10-15

Publications (1)

Publication Number Publication Date
WO2021073119A1 true WO2021073119A1 (en) 2021-04-22

Family

ID=70310388

Family Applications (1)

Application Number Title Priority Date Filing Date
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

Country Status (2)

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

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
CN113761218A (en) * 2021-04-27 2021-12-07 腾讯科技(深圳)有限公司 Entity linking method, device, equipment and storage medium

Families Citing this family (6)

* 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
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 (4)

* 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
CN106407180A (en) * 2016-08-30 2017-02-15 北京奇艺世纪科技有限公司 Entity disambiguation method and apparatus
CN110287283A (en) * 2019-05-22 2019-09-27 中国平安财产保险股份有限公司 Intent model training method, intension recognizing method, device, equipment and medium
CN111079429A (en) * 2019-10-15 2020-04-28 平安科技(深圳)有限公司 Entity disambiguation method and device based on intention recognition model and computer equipment

Family Cites Families (2)

* 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
CN107861939B (en) * 2017-09-30 2021-05-14 昆明理工大学 Domain entity disambiguation method fusing word vector and topic model

Patent Citations (4)

* 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
CN106407180A (en) * 2016-08-30 2017-02-15 北京奇艺世纪科技有限公司 Entity disambiguation method and apparatus
CN110287283A (en) * 2019-05-22 2019-09-27 中国平安财产保险股份有限公司 Intent model training method, intension recognizing method, device, equipment and medium
CN111079429A (en) * 2019-10-15 2020-04-28 平安科技(深圳)有限公司 Entity disambiguation method and device based on intention recognition model and computer equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113761218A (en) * 2021-04-27 2021-12-07 腾讯科技(深圳)有限公司 Entity linking method, device, equipment and storage medium
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

Also Published As

Publication number Publication date
CN111079429A (en) 2020-04-28
CN111079429B (en) 2022-03-18

Similar Documents

Publication Publication Date Title
WO2021073119A1 (en) Method and apparatus for entity disambiguation based on intention recognition model, and computer device
CN111160017B (en) Keyword extraction method, phonetics scoring method and phonetics recommendation method
CN108874928B (en) Resume data information analysis processing method, device, equipment and storage medium
JP5346279B2 (en) Annotation by search
WO2022142613A1 (en) Training corpus expansion method and apparatus, and intent recognition model training method and apparatus
CN109446885B (en) Text-based component identification method, system, device and storage medium
CN111177345B (en) Intelligent question-answering method and device based on knowledge graph and computer equipment
CN110162771B (en) Event trigger word recognition method and device and electronic equipment
JP4699954B2 (en) Multimedia data management method and apparatus
CN110427612B (en) Entity disambiguation method, device, equipment and storage medium based on multiple languages
WO2022116436A1 (en) Text semantic matching method and apparatus for long and short sentences, computer device and storage medium
CN112364660A (en) Corpus text processing method and device, computer equipment and storage medium
CN111666427A (en) Entity relationship joint extraction method, device, equipment and medium
WO2022134805A1 (en) Document classification prediction method and apparatus, and computer device and storage medium
WO2021027125A1 (en) Sequence labeling method and apparatus, computer device and storage medium
US11507746B2 (en) Method and apparatus for generating context information
CN117076653B (en) Knowledge base question-answering method based on thinking chain and visual lifting context learning
CN113761208A (en) Scientific and technological innovation information classification method and storage device based on knowledge graph
CN111611452A (en) Method, system, device and storage medium for ambiguity recognition of search text
WO2022141872A1 (en) Document abstract generation method and apparatus, computer device, and storage medium
CN113449489B (en) Punctuation mark labeling method, punctuation mark labeling device, computer equipment and storage medium
CN111859042A (en) Retrieval method and device and electronic equipment
CN117077071A (en) Data analysis method and system based on data classification
CN111104503A (en) Construction engineering quality acceptance standard question-answering system and construction method thereof
JP7121819B2 (en) Image processing method and apparatus, electronic device, computer-readable storage medium, and computer program

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20876741

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20876741

Country of ref document: EP

Kind code of ref document: A1