CN114254622B - Intention recognition method and device - Google Patents

Intention recognition method and device Download PDF

Info

Publication number
CN114254622B
CN114254622B CN202111509161.XA CN202111509161A CN114254622B CN 114254622 B CN114254622 B CN 114254622B CN 202111509161 A CN202111509161 A CN 202111509161A CN 114254622 B CN114254622 B CN 114254622B
Authority
CN
China
Prior art keywords
intention
text
texts
recognized
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111509161.XA
Other languages
Chinese (zh)
Other versions
CN114254622A (en
Inventor
李长林
蒋宁
王洪斌
吴海英
权佳成
曹磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mashang Xiaofei Finance Co Ltd
Original Assignee
Mashang Xiaofei Finance Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Mashang Xiaofei Finance Co Ltd filed Critical Mashang Xiaofei Finance Co Ltd
Priority to CN202111509161.XA priority Critical patent/CN114254622B/en
Publication of CN114254622A publication Critical patent/CN114254622A/en
Application granted granted Critical
Publication of CN114254622B publication Critical patent/CN114254622B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • G06F40/211Syntactic parsing, e.g. based on context-free grammar [CFG] or unification grammars
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Molecular Biology (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Evolutionary Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Machine Translation (AREA)

Abstract

The invention discloses an intention recognition method and device, which are used for solving the problem of inaccurate text intention recognition. The scheme comprises the following steps: acquiring an intention text set corresponding to a text to be identified; selecting N first intention texts, wherein the confidence coefficient of the selected first intention texts is larger than that of unselected intention texts; if the at least two first intention texts comprise the same first text, determining a second intention text set, wherein the second intention text set is an intention text after deleting the first text in the N first intention texts; and determining an intention recognition result of the text to be recognized according to the similarity between each intention text in the second intention text set and the text to be detected. According to the method, the device and the system, the multiple intention texts are obtained, the optimal intention recognition result is selected from the N first intention texts by deleting the first texts shared by the intention texts and comparing the similarity, the output intention recognition result is effectively optimized, and the accuracy of the recognition result is improved.

Description

Intention recognition method and device
Technical Field
The present invention relates to the field of intent recognition, and in particular, to a method and apparatus for intent recognition.
Background
Intent recognition refers to extracting intent it expresses from a sentence. For example, to a southern airline official network, a person may have different intentions to check air tickets, to withdraw air tickets, to order seats, and the like. The intention recognition is a multi-classification problem, input as text, and output as a specific intention. In short, when a user inputs a sentence or a piece of text, the intention recognition can accurately recognize which domain is a problem, and then the problem is distributed to the corresponding domain robot for secondary processing, which plays an important role in search engines and intelligent question-answering.
In practical applications, the intent of the text characterization is often determined from the classification results of the classification model. However, the types of the intention recognition classification are many, the intention of some types is very similar, accurate distinguishing recognition is difficult to realize, and the requirement on a recognition model is high. In addition, the text to be tested often contains complicated semantic information, and the text expression intention is difficult to accurately identify by the conventional rule or model-based method.
How to improve the accuracy of text intention recognition is a technical problem to be solved by the application.
Disclosure of Invention
The embodiment of the application aims to provide an intention recognition method and device which are used for solving the problem of inaccurate text intention recognition.
In a first aspect, an intention recognition method is provided, including:
acquiring an intention text set corresponding to a text to be identified, wherein the intention text set comprises multiple types of intention texts and confidence degrees corresponding to the multiple types of intention texts;
Selecting N first intention texts, wherein N is a positive integer greater than or equal to 2, and the confidence coefficient of the selected N first intention texts is greater than that of unselected intention texts;
If at least two first intention texts comprise the same first text, determining a second intention text set, wherein the second intention text set is an intention text after deleting the first text in the N first intention texts;
And determining an intention recognition result of the text to be recognized according to the similarity between each intention text in the second intention text set and the text to be detected.
In a second aspect, there is provided an intention recognition apparatus including:
the acquisition module is used for acquiring an intention text set corresponding to the text to be identified, wherein the intention text set comprises multiple types of intention texts and confidence degrees corresponding to the intention texts;
The selecting module is used for selecting N first intention texts, wherein N is a positive integer greater than or equal to 2, and the confidence coefficient of the selected N first intention texts is greater than that of the unselected intention texts;
the first determining module is used for determining a second intention text set if at least two first intention texts comprise the same first text, wherein the second intention text set is an intention text after deleting the first text in the N first intention texts;
and the second determining module is used for determining an intention recognition result of the text to be recognized according to the similarity between each intention text in the second intention text set and the text to be detected.
In a third aspect, there is provided an electronic device comprising a processor, a memory and a computer program stored on the memory and executable on the processor, the computer program implementing the steps of the method as in the first aspect when executed by the processor.
In a fourth aspect, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method as in the first aspect.
In the embodiment of the application, through acquiring an intention text set corresponding to a text to be identified, the intention text set comprises multiple types of intention texts and confidence degrees corresponding to the multiple types of intention texts; selecting N first intention texts, wherein N is a positive integer greater than or equal to 2, and the confidence coefficient of the selected N first intention texts is greater than that of unselected intention texts; if at least two first intention texts comprise the same first text, determining a second intention text set, wherein the second intention text set is an intention text after deleting the first text in the N first intention texts; and determining an intention recognition result of the text to be recognized according to the similarity between each intention text in the second intention text set and the text to be detected. According to the method, multiple types of intention texts and the confidence degrees corresponding to the intention texts are obtained, N first intention texts are selected based on the confidence degrees, and the confidence degrees can express the accuracy of the intention texts, so that the selected first intention texts are relatively accurate intention texts in an intention text set. Subsequently, the distinction between the N first intention texts is enlarged by deleting the first text shared among the first intention texts, thereby simplifying the first intention text into the second intention text. And then, performing similarity comparison on the second intention text and the text to be detected, and selecting an optimal intention recognition result from the N first intention texts, so that the output intention recognition result is effectively optimized, and the accuracy of the intention recognition result is improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the invention and do not constitute a limitation on the invention. In the drawings:
FIG. 1 is a flow chart of an intent recognition method according to an embodiment of the present invention.
FIG. 2 is a second flow chart of an intent recognition method according to an embodiment of the present invention.
FIG. 3 is a third flow chart of an intent recognition method according to an embodiment of the present invention.
FIG. 4 is a flow chart of an intent recognition method according to an embodiment of the present invention.
FIG. 5 is a flowchart of an intent recognition method according to an embodiment of the present invention.
FIG. 6 is a flowchart of a method for intent recognition according to an embodiment of the present invention.
FIG. 7 is a flow chart of an intent recognition method according to an embodiment of the present invention.
FIG. 8 is a flowchart illustrating an intent recognition method according to an embodiment of the present invention.
FIG. 9 is a flowchart illustrating an intent recognition method according to an embodiment of the present invention.
Fig. 10 is a schematic structural view of an intention recognition apparatus according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application. The reference numerals in the present application are only used for distinguishing the steps in the scheme, and are not used for limiting the execution sequence of the steps, and the specific execution sequence controls the description in the specification.
In the field of intent recognition, the intent recognition method based on rules of a dictionary and a template does not have a function of universality, and the dictionary and the template are constructed by using a large amount of manpower and material resources, so that the constructed dictionary and template are only applicable to specific application scenes. Although the deep learning method can solve the defects of the rules to a certain extent, the types of the output types of the deep learning intention recognition models are too many, wherein the intentions of some types are similar, the actual application is difficult to accurately distinguish, and the recognition is inaccurate. Moreover, training of the model is seriously dependent on the labeling data, and the quality of the labeling data directly influences the effect of the model. In addition, the maintainability and expansibility of the model are not friendly, if the data change and scene replacement are recognized, the model needs to be retrained, and non-professional algorithm personnel can hardly understand the principle therein, so that the model is difficult to widely apply.
In order to solve the problems in the prior art, an embodiment of the present application provides an intent recognition method, as shown in fig. 1, including the following steps:
s11: and acquiring an intention text set corresponding to the text to be identified, wherein the intention text set comprises multiple types of intention texts and confidence degrees corresponding to the multiple types of intention texts.
The text to be identified in the scheme can be words, phrases, sentences or paragraphs. In general, the number of characters of a text to be recognized is related to the complexity of the intention of the expression, and if the text to be recognized is too long, various intents are often included. In practical application, if the text to be recognized is too long, the text to be recognized can be segmented based on punctuation, space or special symbols in the text to be recognized. And identifying the segmented texts to be identified of each part one by one, and then determining the intention of the whole text to be identified by integrating the intention identification results of each part.
The text to be identified in the scheme can be text input by a user in real time, for example, can be search words input in a search engine, timely communication content input in communication software, consultation problems input on a shopping platform and the like.
Or the text to be identified may be a non-immediate text obtained from a database, such as sentences extracted from articles.
The text to be identified may also be a text converted from other forms of files, for example, may be a text of a call content obtained by identifying a call voice file, a text of a caption obtained by identifying a video file, a text obtained by identifying a picture, and the like.
The intent text set in the step comprises multiple types of intent texts and confidence degrees corresponding to the intent texts, wherein the intent texts can represent the intentions of the text representation to be identified. The confidence is a statistical concept, and in the scheme, the confidence characterizes the probability that the intention of the true representation of the text to be identified belongs to the intention type expressed by the intention text corresponding to the confidence. In brief, a higher confidence level for an intended text indicates a greater probability that the text to be identified matches the intended text.
S12: n first intention texts are selected, wherein N is a positive integer greater than or equal to 2, and the confidence coefficient of the selected N first intention texts is greater than that of the unselected intention texts.
In this step, a preliminary screening is performed on the plurality of intention texts based on the confidence levels in the set of intention texts. Specifically, multiple types of intention texts can be ordered according to the confidence level, and N intention texts with high confidence level are selected as first intention texts. The value of N may be preset according to actual requirements, for example, the value of N may be a positive integer greater than 1 and not greater than 5.
Or the method can also adopt a mode of comparing one by one, and each intention text in the intention text set is compared with each other to select N first intention texts with high confidence.
The first intention texts obtained through selection are N intention texts with relatively high confidence in the intention text set, which shows that the first intention texts are intention texts with high probability of matching with texts to be identified in the intention text set. According to the scheme, subsequent screening and recognition are performed based on the first intention texts, so that the intention texts with low matching probability with the texts to be recognized can be eliminated, and the calculated amount is effectively reduced.
Optionally, the N first intention texts selected in the step may also be intention texts with confidence degrees greater than a preset confidence degree. However, in practical applications, the confidence value of the intention text is difficult to predict, and if the intention expressed by the text to be recognized is clear, the confidence corresponding to the intention text is often higher. But if the text to be recognized expresses a large variety of intentions or the expressed intentions are ambiguous, the confidence of the intended text is generally low. If the first intention text is selected based on the preset confidence, it is possible to select an excessive or insufficient number of the first intention text, or even to select no intention text. Therefore, compared with the mode of selecting the intention texts according to the preset confidence, the intention text selection based on the preset quantity N has stronger stability, the first intention texts can be ensured to be selected, and the quantity of the selected first intention texts is consistent, so that the follow-up further screening processing is facilitated.
S13: and if at least two first intention texts comprise the same first text, determining a second intention text set, wherein the second intention text set is the intention text after deleting the first text in the N first intention texts.
In practical applications, it may happen that a plurality of first intention texts in the intention text set are close to each other, and the first intention texts with the close ideas also include the same text. For example, assuming that the text to be identified is "how the password is locked for solving", assuming that the N value is 3, 3 first intention texts obtained through the selection of the steps and the respective corresponding confidence degrees are { "password unlock": 0.910543; "Cryptographic correlation": 0.743662; "password lost": 0.578866}.
The three first intention texts all comprise the same first text 'password', and the 'password' in each first intention text is deleted in the step to obtain the simplified intention text of each first intention text: "password unlock" → "unlock", "password correlation" → "correlation", "password loss" → "loss". In the embodiment of the present application, these simplified intention texts are referred to as second intention texts.
This step can enlarge the distinction between the plurality of first intention texts by deleting the common text among the first intention texts. Based on the above example, since the text to be recognized contains the keyword "password", the corresponding N first intention texts contain the "password". In the step, the first text password shared by the plurality of first intention texts is deleted, the content except the first texts is reserved, the distinction among the plurality of first intention texts is effectively enlarged, and the intention recognition result which is most matched with the recognition text to be selected is further selected in the subsequent step.
S14: and determining an intention recognition result of the text to be recognized according to the similarity between each intention text in the second intention text set and the text to be detected.
In this step, the text to be identified is compared with the intention text in the second intention text set obtained in the above step. For example, the similarity may be determined from the aspects of text consistency, text emotion, homonym/anticonsite, and the like, and then the first intention text corresponding to the simplified intention text with the highest similarity may be determined as the intention recognition result.
Based on the above example, assuming that the above similarity is determined from the word consistency aspect, the second set of intention texts includes 3 intention texts: "unlock", "correlate", "lose". In this step, comparing the text consistency of the simplified text of "how the password is locked" with "unlock", "related" and "lost" can be performed, and it can be determined that the text to be recognized and "unlock" both include "lock" with the same text, and the text to be recognized and the other two simplified text do not have the same text. Based on the method, the unlocking is the simplified intention text with highest similarity with the text to be identified, the first intention text corresponding to the unlocking is the password unlocking, and accordingly the intention identification result of the text to be identified is the password unlocking.
According to the method, multiple types of intention texts and the confidence degrees corresponding to the intention texts are obtained, N first intention texts are selected based on the confidence degrees, and the confidence degrees can express the accuracy of the intention texts, so that the selected first intention texts are relatively accurate intention texts in an intention text set. Subsequently, the distinction between the N first intention texts is enlarged by deleting the first text common to the first intention texts, thereby simplifying the first intention text into the second intention text. And then, performing similarity comparison on the second intention text and the text to be detected, and selecting an optimal intention recognition result from the N first intention texts, so that the output intention recognition result is effectively optimized, and the accuracy of the intention recognition result is improved.
Based on the solution provided in the foregoing embodiment, as shown in fig. 2, the optional step S14 includes:
s21: and obtaining a second intention vector corresponding to each intention text in the second intention text set, wherein the second intention vector is used for representing multidimensional text characteristics of each intention text.
In this step, the obtained second intention vector is used to characterize the multidimensional text feature of each intention text in the second set of intention texts. In other words, feature values of each intention text in the second set of intention texts over a plurality of text feature dimensions are expressed in terms of vectors in this step. Wherein any one of the set of second intention texts corresponds to a second intention vector.
S22: and determining a text vector to be recognized according to the text to be recognized, wherein the text vector to be recognized is used for representing the multidimensional text characteristics of the text to be recognized.
In this step, the obtained text vector to be recognized is used to characterize the multidimensional text feature of the text to be recognized. In other words, feature values of the text to be recognized in a plurality of text feature dimensions are expressed in the form of vectors in this step.
Among these, the vector representations of S21 and S22 may be :TF-IDF(term frequency–inverse document frequency)、word2vec(word to vector)、glove(Global Vectors for Word Representation)、ELMo(Embeddings from Language Models)、BERT(Bidirectional Encoder Representations from Transformers).
The TF-IDF is a weighting technique, TF represents word Frequency (Term Frequency), and IDF represents inverse text Frequency index (Inverse Document Frequency). The TF-IDF is used to evaluate the importance of a word to one of the documents in a document set or corpus. The importance of a word increases proportionally with the number of times it appears in the file, but at the same time decreases inversely with the frequency with which it appears in the corpus. In this step, a text vector may be constructed based on the word frequency of each word in the text, for example, the vector dimensions include the types of words contained in the text, and the size in each dimension may be determined according to the frequency of occurrence of words in the corresponding dimension.
The word2vec is a group of correlation models used to generate word vectors. These models are shallow, bi-layer neural networks that are used to train to reconstruct linguistic word text. The network is represented by words and guesses the input words in adjacent positions, and the order of the words is unimportant under the word bag model assumption in word2 vec. After training is completed, the word2vec model may be used to map each word to a vector, which may be used to represent word-to-word relationships, the vector being the hidden layer of the neural network.
The above glove is a global word frequency statistics (count-based & overall statistics) based word representation (word representation) tool that can represent a word as a vector of real numbers that captures some semantic characteristics between words, such as similarity, analogic, etc.
The above ELMo is a method of representing vocabulary in word vectors (vectors) or word embeddings (embedding). ELMo word vectors are computed on a two-layer bi-directional language model (two-layer bidirectional language model, biLM). The model is formed by stacking two layers, each having two iterations, forward (forward pass) and backward (backward pass). Wherein the input metrics of the bi-directional language model are characters rather than words, and word vectors output by the model can represent the internal structural information of words.
The above BERT is a transform-based bi-directional encoder characterization. Wherein, the bidirectional meaning means that when processing a word, the information of the words in front of and behind the word can be considered, thereby obtaining the semantic meaning of the context, and the obtained vector can express the semantic relation of the word context to a certain extent.
In practical application, the method or other methods can be selected according to the practical application scene and the text characteristics to generate the vector corresponding to the text. Optionally, the same method is selected to generate the vector in the steps S21 and S22, so as to improve the reliability of performing the similarity comparison of the vector in the subsequent step.
S23: and obtaining the similarity between each intention text and the text to be identified according to the distance between the second intention vector corresponding to each intention text and the text vector to be identified.
In this step, the similarity may be determined based on the euclidean distance, the cosine distance, and the jaccard distance equidistantly. The euclidean distance is also called euclidean distance or euclidean metric, and refers to a "normal" (i.e., straight line) distance between two vectors in space, where the distance is used to express the similarity between the two vectors. The cosine distance is also called cosine similarity, and refers to the cosine value of the included angle between two vectors, and the cosine value is used for expressing the similarity between the two vectors. The Jacquard distance is that two vectors are respectively regarded as a set, and the numerical value of each dimension of the vectors expresses whether elements exist in the dimension, namely, whether the numerical value is larger than 0 in the dimension expresses that the elements exist in the dimension, so that the similarity of the two vectors is expressed based on the Jacquard similarity coefficient. Although the value of the vector in each dimension is not considered by Jaccard, the method has the advantage of high calculation efficiency, and is particularly suitable for scenes with higher number of dimensions and smaller difference of the values of each dimension.
S24: and determining the first intention text corresponding to the second intention text with the highest similarity as an intention recognition result of the text to be recognized.
The similarity determined in the above step expresses the probability that the second intention text matches the text to be recognized, and the higher the similarity is, the greater the probability of matching. Since the second intention text is a simplified intention text obtained by deleting the first text, there is a more obvious distinction between different second intention texts. In the step, the similarity between each second intention text and the text to be identified can be determined by comparing the similarity, so that the first intention text corresponding to the most similar second intention text is determined as the intention identification result, and the accuracy of the determined intention identification result can be effectively improved.
Based on the solution provided in the foregoing embodiment, optionally, as shown in fig. 3, after step S12, the method further includes:
s31: and determining a confidence coefficient maximum value and a confidence coefficient next-greatest value according to the confidence coefficient corresponding to each intention text.
Based on the example set forth in the above embodiment, if the set of intent text is { "password unlock": 0.910543; "Cryptographic correlation": 0.743662; "password lost" 0.578866, where the confidence maximum is 0.910543 and the confidence next highest is 0.743662.
S32: and if the difference value between the confidence coefficient maximum value and the confidence coefficient next-largest value is larger than a preset value, determining the intention text corresponding to the confidence coefficient maximum value as an intention recognition result of the text to be recognized.
The preset value may be preset according to actual requirements, for example, may be 0.5. In this step, the distinction between the intention text with the highest confidence and the intention text with the next highest confidence is determined based on the preset value.
In practical applications, since the similarity between the respective intention texts in the set of intention texts is high, a plurality of intention texts with high confidence may be output. In the step, whether the intention text with the largest confidence coefficient is greatly different from the intention text with the next largest confidence coefficient or not is judged based on a preset value, if the confidence coefficient difference between the two intention texts is large, the two intention texts are dissimilar, and the matching probability of the input text and the intention text with the largest confidence coefficient is obviously larger than that of the input text and the intention text with the next largest confidence coefficient. If the condition is met, the intention text corresponding to the maximum confidence value can be directly determined to be the intention recognition result of the text to be recognized.
According to the scheme provided by the embodiment of the application, the confidence coefficient expresses the prediction accuracy of the intention texts, so that the scheme can realize the execution comparison of the prediction accuracy of the two intention texts with the maximum confidence coefficient and the second maximum confidence coefficient by comparing the maximum confidence coefficient with the second maximum confidence coefficient, and the intention text with the maximum confidence coefficient can be directly output if the condition is met, so that the judgment flow can be effectively simplified in practical application, and the efficiency of determining the intention recognition result is improved.
Based on the solution provided in the foregoing embodiment, optionally, after step S12, as shown in fig. 4, the method further includes:
S41: the lengths of N common maximum continuous characters of the N first intention texts and the text to be recognized are determined.
The common maximum continuous character length refers to the maximum length of continuous characters contained in both the first intended text and the text to be recognized. For example, based on the example illustrated in the above embodiment, how to solve the problem that the text "password to be recognized is locked" is related to the intended text "password", the common continuous character is "password", and the length of the continuous character "password" is 2.
For another example, for the intended text "password unlock", 4 characters in this intended text are all contained in the text to be recognized, with consecutive characters being "password", "unlock", "lock", respectively. Correspondingly, the lengths of the three consecutive characters are 2, 1, respectively, wherein the length of the common largest consecutive character is 2.
S42: and if the maximum value of the lengths of the N common maximum continuous characters is unique, determining the first intention text corresponding to the maximum common continuous character length as an intention recognition result of the text to be recognized.
In this step, the lengths of the common maximum continuous characters corresponding to the N first intention texts are compared in numerical value, and the maximum value among the lengths of the common maximum continuous characters is determined. And if the maximum value is unique in the lengths of the N common maximum continuous characters, only one first intention text corresponding to the length of the maximum common maximum continuous characters is indicated, the first intention text is further indicated to be closest to the text to be recognized, and the first intention text is determined as an intention recognition result of the text to be recognized.
According to the scheme provided by the embodiment of the application, N first intention texts can be respectively compared with the texts to be identified based on the common maximum continuous character length, and if the conditions are met, the nearest first intention text can be output as an intention identification result, so that the judgment flow can be effectively simplified in practical application, and the efficiency of determining the intention identification result is improved.
Based on the solution provided in the foregoing embodiment, optionally, as shown in fig. 5, after step S12, the method further includes:
s51: the number of N common characters of the N first intention texts and the text to be recognized is determined.
The number of the common characters is determined by comparing N first intention texts with texts to be identified in the step by taking a single character as a unit.
For example, based on the example illustrated in the above embodiment, how to solve the problem that the text to be recognized "password is locked" is related to the first intention text "password", the characters common to the text to be recognized and the first intention text are "secret" and "code", and thus it is possible to determine that the number of common characters is 2.
For another example, for a first intended text, "password unlock", 4 characters in this first intended text are all contained in the text to be recognized, so the number of common characters for this first intended text is 4.
S52: and if the maximum value of the number of the N common characters is unique, determining the first intention text corresponding to the common character with the maximum number as an intention recognition result of the text to be recognized.
Based on the example of the above embodiment, if the first intention text is "password unlock", "password related" and "password lost", respectively, the number of common characters corresponding to the first intention text determined based on the above steps is "password unlock" →4 "," password related "→2" password lost "→2. It follows that the maximum value of the number of common characters is 4, and the maximum value is unique among the number of N common characters, that is, the first intention text corresponding to the maximum number of common characters 4 is indicated to be unique. In this step, the corresponding first intention text "password unlock" may be output as the intention recognition result.
According to the scheme provided by the embodiment of the application, each first intention text can be respectively compared with the text to be identified based on the number of the common characters, and the nearest first intention text can be output if the conditions are met, so that the judging process can be effectively simplified in practical application, and the efficiency of determining the intention identification result is improved.
Based on the solution provided in the foregoing embodiment, optionally, as shown in fig. 6, step S11 includes:
s61: inputting the text to be recognized into a trained intention recognition model to obtain multiple types of intention texts and confidence degrees corresponding to the multiple types of intention texts, and obtaining the intention text set.
The trained intent recognition model is used to perform classification based on the input text, the output intent text characterizing the intent type of the input text characterization. Optionally, the intention recognition model in the scheme can be a general purpose intention recognition model, special training aiming at specific application scenes is not needed, and the manpower and time consumed for training the intention recognition model are effectively reduced.
The intention recognition model outputs multiple types of intention texts and corresponding confidence degrees thereof according to the texts to be recognized, the intention texts represent the types possibly of the intention of the text representation to be recognized, and the confidence degrees are used for expressing the reliability of the corresponding intention texts. In the scheme, the confidence represents the probability that the intention of the true representation of the text to be identified belongs to the intention type expressed by the intention text matched with the confidence. In brief, a higher confidence level corresponding to the intention text indicates a higher probability that the intention recognition model determines that the text to be recognized matches the intention text.
In practical application, because the classification result of the intention recognition model is complex, some classification results represent similar intentions, so that the situation that the confidence degrees corresponding to a plurality of intention texts output by the intention recognition model are higher may occur. In other words, the input text to be recognized matches with a high probability with the plurality of intention texts output by the intention recognition model. In the scheme, the multiple intention texts output based on the intention recognition model are subjected to further matching screening in terms of text similarity through the subsequent steps, so that the multiple intention texts can be subjected to fine matching, and the accuracy of the intention recognition result is improved.
Based on the solution provided in the foregoing embodiment, optionally, as shown in fig. 7, step S61 includes;
s71: and selecting n types of intention texts in the multiple types of intention texts and confidence degrees corresponding to the n types of intention texts respectively to obtain the intention text set, wherein n is a positive integer.
The value of N in this step is not smaller than that of N in the above-described embodiment. Alternatively, if the value of N in the present step is equal to the value of N in the above embodiment, each intention text in the set of intention texts in the present step may be directly selected as the first intention text in step S12. Alternatively, the value of n in this embodiment may be preset, for example, may be an integer not less than 1 and not more than 5. In addition, the n value may be determined based on the confidence level of the model output intention label in the step of performing the test on the intention recognition model, and the step of performing the test on the intention recognition model with respect to the model will be described in detail later.
The intention recognition model can predict n types of intention texts according to the input text to be recognized, wherein the n types of intention texts are n types of intention texts predicted by the intention recognition model to be closest to the intention expressed by the text to be recognized.
According to the scheme provided by the embodiment of the application, the intention text set output by the intention recognition model can be optimized and screened, so that the model can output n kinds of intention texts relatively reliably, the process of selecting and comparing the intention texts can be effectively simplified, and the intention recognition efficiency is improved.
Based on the solution provided in the foregoing embodiment, optionally, before the step S16, the intention recognition model may be further optimized and trained, that is, the intention recognition model may be tested and optimized, and the method may include the following steps:
Acquiring a test set of the intention recognition model, wherein the test set comprises a plurality of test texts and intention labels corresponding to the test texts;
Respectively inputting the plurality of test texts into the intention recognition model to obtain a plurality of test tag groups output by the intention recognition model, wherein the test tag groups are in one-to-one correspondence with the test texts, and the test tag groups comprise at least one intention tag output by the intention recognition model;
Determining the recognition accuracy of the intention recognition model according to the matching degree of at least one intention label in the test label group and the intention label of the test text corresponding to the test label group;
If the identification accuracy is lower than the preset accuracy, a plurality of abnormal labels are obtained, so that the test label group of the test text corresponding to the abnormal labels does not contain the intention labels of the test text;
Updating the training set of the intention recognition model according to the plurality of abnormal labels;
and training the intention recognition model according to the updated training set.
In this embodiment, the intent recognition model may be pre-trained by a training set, where both the test set and the training set include text and corresponding intent labels. The intention labels corresponding to the texts are used for representing the intention expressed by the corresponding texts. In the field of model training, text and corresponding labels may also be referred to as training samples. Under the condition that the number of the training samples is fixed, the training samples can be divided into two parts in advance, wherein one part is used for training the intention recognition model, and the other part is used for testing the trained intention recognition model. Optionally, the ratio of the number of samples of the training set to the number of samples of the test set is 8:2.
In this embodiment, a plurality of test texts in a test set are respectively input into an intention recognition model, and the intention recognition model recognizes the test texts to output predicted intention labels. In this scheme, for one test text, the intention recognition model outputs a plurality of predicted intention labels, and the intention labels are constructed as a test label group corresponding to the test text. Wherein the number of intention labels contained in the test label groups is related to the number of intention labels output by the intention recognition model and the confidence, and each test label group comprises at least one intention label.
The test tag group output by the intention recognition model comprises an intention tag result predicted by the intention recognition model. And matching the intention label predicted by the intention recognition model with the real label corresponding to the test text in the test set based on the test label group, and judging whether the recognition result of the intention recognition model is accurate or not according to the matching degree.
Based on the solution provided in the foregoing embodiment, optionally, determining, according to a matching degree of at least one intention tag in the test tag group and an intention tag of a test text corresponding to the test tag group, an identification accuracy of the intention identification model includes:
Determining the accuracy of each test tag group according to the matching degree of at least one intention tag in the test tag group and the intention tag of the test text corresponding to the test tag group;
and determining the recognition accuracy of the intention recognition model according to the accuracy of each test tag group.
The determined recognition accuracy is determined according to the matching degree between the real intention label in the test set and the intention label predicted by the model, and whether the intention label predicted by the model is close to the real intention label or not can be represented, so that the model prediction accuracy is expressed.
In this embodiment, each test tag group corresponds to a test text, and the accuracy of each test tag group is first determined. The accuracy of the test tag group refers to the matching degree of the intention tag contained in the test tag group and the actual intention tag corresponding to the test text.
For example, for any one of the test tag groups, first, the matching degree between each intended tag and the real tag in the test tag group is determined, and if the test tag group includes the intended tag completely consistent with the real tag, the identification accuracy of the test tag group is determined to be 100%. If the test tag group does not contain the real tag but contains the intention tag with high similarity with the real tag, the identification accuracy of the test tag group can be determined according to the actual similarity. If each intention label in the test label group is greatly different from the actual label, the identification accuracy of the test label group can be determined according to the actual difference.
After the identification accuracy of each test tag group is determined through the steps, the identification accuracy of the intended identification model is determined according to the identification accuracy of each test tag group. For example, the reference recognition accuracy of the test tag group may be preset, for example, may be 80%. And determining the test tag group with the accuracy rate not lower than 80% as the tag group with accurate identification, and determining the duty ratio of the tag group with accurate identification in all tag groups as the accuracy rate of the intended identification model.
For example, if the intent recognition model outputs 10 test tag groups, 7 of the test tag groups are recognition accurate tag groups. Then, the ratio of 7 recognition-accurate tag groups to 10 test tag groups was determined as the accuracy of the intended recognition model, i.e., 70%.
In addition to the manner of determining the accuracy of the intent-to-identify model based on the ratio of the number of accurate tag groups to the total number of tag groups provided in the above embodiment, the accuracy of the intent-to-identify model may also be determined from the accuracy of each test tag group based on statistical parameters. For example, the accuracy of the intention recognition model is comprehensively determined according to the statistical parameters such as the average number, the median, the quartile and the like of the accuracy of each test tag group.
In addition, the preset accuracy in this embodiment may be preset according to the actual requirement, for example, may be 95%. If the identification accuracy of the model is lower than the preset accuracy, the model prediction result is larger than the actual intention label. Because the model is trained based on the training set, the prediction result of the model is closely related to the quality of the training set, and the inaccuracy of model prediction is often caused by inaccuracy of the intention label in the training set. In the subsequent steps, the abnormal labels can be screened, and the training intention recognition model is optimized by updating the abnormal labels, so that the recognition accuracy of the intention recognition model is improved.
Based on the above embodiment, if the recognition accuracy of the intent recognition model is lower than the preset accuracy, in this embodiment, the training set may be subjected to label screening based on a preset algorithm, so as to select an abnormal label. And the test label group of the test text corresponding to the abnormal label does not contain the intention label of the test text. That is, the prediction result of the intention recognition model on the test text is greatly different from the real intention label corresponding to the test text. The preset algorithm in this embodiment may be a K-fold intersection algorithm, but may also be other algorithms.
In the step, abnormal labels can be screened based on a K-fold intersection algorithm, wherein K-fold means that a data set is divided into K parts, wherein K-1 parts are used as a training set, and 1 part is used as a test set. Based on K-1 training set training models, after training is completed, based on 1 execution test, samples which are not matched with 1 test set in model prediction results are selected as abnormal samples, and labels of the abnormal samples are abnormal labels. Then, another 1 sample different from the 1 test samples is taken as a test set, the rest K-1 samples are taken as a training set, model training and testing are executed again, and then an abnormal sample is output, wherein the labels in the abnormal sample are abnormal labels. And taking each 1 sample in the data set as a training set to execute K times of training and testing, thus finding out abnormal samples in all samples and automatically screening out abnormal labels. For the samples containing the abnormal labels, the labels can be updated without updating the labels of all the samples, so that the efficiency of updating the samples is effectively improved, and the accuracy of the labels is improved. In this embodiment, updating is performed on the abnormal tag, so that the updated tag matches with the corresponding text, and the intention of text characterization is accurately expressed. The updated training set is used for training the intention recognition model by using the text and the intention label which are correctly corresponding to each other, so that the recognition accuracy of the intention recognition model can be remarkably improved.
Based on the steps, the test sample which is correctly corresponding to the text and the intention label can be updated, then, the intention recognition model can be optimized and trained based on the updated training set, the problem that the intention recognition model is inaccurate in prediction and recognition is effectively solved, and the prediction result of the intention recognition model is closer to the true intention expressed by the text.
Optionally, if the intent recognition model after optimization training still does not meet the requirement, for example, the accuracy of the model is still lower than the preset accuracy, the steps can be repeated to iteratively execute updating of the label and model optimization training until the recognition result of the intent recognition classification model meets the accuracy requirement.
Based on the solution provided in the foregoing embodiment, optionally, the test tag group further includes a confidence level output by the intent recognition model and corresponding to the intent tag.
The concept related to the confidence level is described in the above embodiments, and will not be described here again.
The determining the accuracy of each test tag group according to the matching degree of at least one intention tag in the test tag group and the intention tag of the test text corresponding to the test tag group may include the following steps:
Selecting n intention labels with accuracy rate larger than that of a preset test label group from a plurality of intention labels output by the intention recognition model on the basis of the confidence coefficient, wherein n is a positive integer, and the accuracy rate of the n intention labels represents the matching degree of the n intention labels and the intention labels of the test text;
And determining the accuracy of the test tag group according to the numerical value of the n value.
The intent recognition model in this embodiment outputs a corresponding confidence level for each intent label, specifically, the intent labels may be ordered based on the magnitude of the confidence level, for example, the intent labels are ordered in order from large to small based on the magnitude of the confidence level, and it is sequentially determined whether n intent labels output by the intent recognition model match with the intent labels of the test text based on the order from large to small. Wherein the more forward the confidence ranking position is, the closer to the true intent of the entered text expression is indicated. Or the step of ordering the intention labels based on the confidence level can be realized in a pairwise comparison mode.
For example, assume that the preset test tag set accuracy is m%. For one test text, the intention recognition model is assumed to output 5 intention labels in total and confidence degrees corresponding to the intention labels. And sorting the images according to the order from the high confidence level to the low confidence level, and obtaining a sorting result A, B, C, D, E. Based on the sorting result, it is sequentially determined whether the intention label matches the intention label of the test text, starting from the intention label a with the highest confidence, i.e., gradually increasing the value of n from n=1.
Optionally, the matching degree of the intention label a and the intention label of the test text is determined, that is, whether the accuracy when n=1 meets the accuracy m% of the preset test label group is judged. If the accuracy of the preset test label group is not met, the value of n is increased, the matching degree of the intention labels A and B and the intention labels of the test text is determined, namely whether the accuracy m% of the preset test label group is met when n=2 is judged. And the like until the 5 intention labels are exhausted, so that 5 accuracy rates corresponding to the values of n from 1 to 5 can be respectively determined. Then, n values with accuracy greater than m% can be determined therefrom, and corresponding n intention tags can be determined.
Optionally, if the number of n satisfying the accuracy rate is greater than or equal to the accuracy rate of the preset test tag group is multiple, determining a minimum n value satisfying the accuracy rate is greater than the accuracy rate of the preset test tag group, and determining the accuracy rate of the test tag group according to the number of the minimum n value.
In this example, assume that the preset test tag group accuracy is m, and the accuracy of n intention tags is Pn. Then, this step selects the smallest value of n among the values of n satisfying Pn.gtoreq.m%. In practical application, if the predicted intention label is completely consistent with the actual intention label, or the predicted label hits the actual intention label, the accuracy of n intention labels including the predicted correct intention label is greater than m% based on the confidence ranking.
In practical application, if a certain n value satisfies Pn not less than m%, if n value is continuously enlarged, the subsequent n values satisfy Pn not less than m%. This is because the correct intention label is included in the plurality of intention labels corresponding to the subsequent n value. For example, if Pn corresponding to n=2 is less than m%, and Pn corresponding to n=3 is greater than or equal to m%, both Pn corresponding to n=4 and Pn corresponding to n=5 are greater than or equal to m%, where n takes a value of 3.
In the above steps, the minimum n value satisfying the accuracy rate being greater than the preset accuracy rate is determined, and in practical application, the smaller the value of the minimum n value is, the higher the confidence of the correct label obtained through prediction is, and further the more accurate the recognition result of the intention recognition model is. In this step, the accuracy of the test tag group may be determined based on the magnitude of the minimum n value.
Alternatively, in addition to the above manner of determining the n value after exhausting 5 intention labels, the accuracy Pn of n intention labels may be sequentially determined by gradually increasing from n=1 based on the above confidence ranking. If a certain n value meets Pn not less than m%, the accuracy of a larger n value is not required to be continuously determined, the n value meeting Pn not less than m% is directly determined to be the minimum n value, and the accuracy of the test tag group is further determined based on the value of the minimum n value.
Optionally, if the n value meeting the accuracy rate is greater than or equal to the accuracy rate of the preset test tag group does not exist, determining the accuracy rate of the test tag group according to the matching degree of each intention tag in the test tag group and the intention tag of the test text.
In this embodiment, if the n value satisfying the above condition does not exist, it indicates that each intention label in the test label group has a larger difference from the actual intention label of the test text, and the accuracy of the test label group is lower. In this step, each intention label in the test label group may be compared with the intention label of the test text, respectively, so as to determine the accuracy of each intention label in the test label group. The comparison may include a text consistency comparison, i.e., whether the intent tags in the test tag group contain text in the actual intent tags of the test text. Or the comparison may also include a semantic consistency comparison, i.e., whether the semantics of the intent tag representation in the test tag group are similar to the semantics of the actual intent tag representation of the test text.
Through the steps, the accuracy of each intention label in the test label group can be determined. The accuracy of the test tag population may then be determined based on the statistical parameters. For example, the average, median, mode, or other statistical parameter value of the accuracy of each intended tag is determined as the accuracy of the test tag set.
Optionally, in order to improve the execution efficiency of the method according to the embodiment of the present application, if no n value satisfying the accuracy rate is greater than or equal to the accuracy rate of a preset test tag group, the test tag group is marked as a tag group with inaccurate identification. That is, in the embodiment of the present application, it is not necessary to determine the specific accuracy of the test tag group, and through the above steps, it has been determined that the test tag group does not have an n value that satisfies the above condition, that is, the difference between each intention tag in the test tag group and the intention tag of the test text is large. In the step of calculating the accuracy of the identification model, based on the marks made in the step, the fact that the test tag group does not belong to the tag group with accurate identification can be determined, the accuracy of the intention identification model can be determined only according to the ratio of the tag group with accurate identification to the total number of the test tag group, and the efficiency of determining the accuracy of the intention identification model is effectively improved.
Optionally, in order to improve the execution efficiency of the method according to the embodiment of the present application, a fixed n value may be preset, and it may be determined whether the fixed n value in the test tag group satisfies Pn being greater than or equal to m%. According to the scheme provided by the embodiment of the application, the calculated amount can be obviously reduced, and for any test tag group, only one calculation is executed according to the fixed n value to determine whether the test tag group meets Pn being more than or equal to m percent. The fixed n value in this embodiment may be the same as n in step S71 in the above embodiment.
The scheme is further described below with reference to fig. 8, based on a pre-trained intent recognition model, a test set of the intent recognition model is first obtained, and a plurality of test texts in the test set are respectively input into the intent recognition model, so as to obtain a plurality of intent labels and confidence levels of the intent labels output by the intent recognition model for each test text. And for any test text, sequencing each intention label in the test label group according to the confidence coefficient output by the intention recognition model, selecting Top n intention labels with high confidence coefficient in the sequencing result, and determining the accuracy Pn corresponding to the Top n. For the test tag group, if n values meeting Pn being larger than or equal to m% exist, the identification accuracy of the test tag group meets the requirement. If the n value meeting Pn is not more than m%, the identification accuracy of the test tag group does not meet the requirement.
Optionally, in order to further improve the accuracy of the intent recognition model, if any one of the test tag groups output by the intent recognition model does not have an n value satisfying Pn being greater than or equal to m%, determining that the accuracy of the intent recognition model does not satisfy the requirement. And then optimizing the model by adjusting the abnormal labels in the data set, and iteratively training until all the test label groups output by the model have n values meeting Pn being more than or equal to m percent, and then outputting the model.
In the following, the scheme is further described with reference to fig. 9, firstly, text to be recognized is obtained, text is input into an intention recognition model to obtain an intention label and a corresponding confidence coefficient of model output. The Top n intention labels with high confidence are selected from the output intention labels as n kinds of intention texts, and are used for forming an intention text set, wherein the selected Top n intention labels are n kinds of intention texts selected in step S71 in the embodiment. If the difference between the confidence level of the intention text Max with the largest confidence level and the confidence level of the intention text Submax with the next largest confidence level is larger than or equal to the preset value t, the intention text corresponding to the largest confidence level is output as an intention recognition result. Otherwise, determining the common continuous character length of each intention text and the text to be recognized, and outputting the intention text with the maximum common continuous character length as an intention recognition result if the intention text corresponding to the maximum value of the common continuous character length is unique. Otherwise, determining the common character number of each intention text and the text to be recognized, outputting the intention text with the largest common character number as an intention recognition result if the intention text corresponding to the largest common character number is unique, otherwise, determining the same character included in the intention text as a first text, deleting the first text from each intention text to obtain simplified intention texts, further determining the similarity between each simplified intention text and the text to be recognized, and outputting the intention text corresponding to the simplified intention text with the largest similarity as the intention recognition result.
According to the scheme provided by the embodiment of the application, the intention text output by the intention recognition model is screened based on the rule, and model optimization is performed in a mode of updating the sample set, so that the accuracy of intention recognition can be effectively improved.
In the aspect of model optimization, the Top index of the model is optimized by improving the quality and the quantity of the labeling data, so that the quality of the labeling data and the Top index of the model reach a certain effect (Pn is more than or equal to m%), and the accuracy of the intention recognition result output by the subsequent step can be improved more effectively.
In the step of determining the intention recognition result based on the rule, the problem of misrecognition of similar labels is solved by adopting a model and rule mode, and the accuracy of intention recognition is improved. According to the scheme, a plurality of implementation logics and corresponding discrimination conditions are applied, so that the optimal intention label matched with the text to be recognized can be effectively selected, and the accuracy of the intention recognition result output later is improved.
In addition, the scheme provided by the invention can be widely applied to various tasks and application scenes through fine tuning, and other schemes can be embedded into implementation logic, so that the scheme has good migration, universality and expandability.
For example, the fine tuning may include adjusting the number of the selected first intention text. The more the number of the first intention texts is selected, the larger the calculated amount is, and if the method is applied to an application scene with poor processing equipment performance, the whole calculated amount can be reduced by reducing the N value. In addition, if the method is applied to an application scene with better processing equipment performance, the N value can be increased appropriately to select more first intention texts for subsequent steps, and the more first intention texts can provide more data support for the subsequent steps, so that the accuracy of the determined intention recognition result is further improved.
In addition, the selection of the N first intention texts may also be performed based on more selection conditions based on actual requirements. For example, when selecting the first intention text, the selection is made based on the length of each intention text. In general, the shorter the length of the intention text, the greater the range of intentions it describes. For example, the intended scope of "password" includes "forget password", "lose password", "wrong password", "unable to input password", and the like. It follows that longer intent text can describe more specific intent. In the scheme, in order to improve accuracy of the intention recognition result, in the step of selecting the first intention text, N first intention texts with lengths greater than the length of the preset intention text may be selected. Therefore, the finally determined intention recognition result is the intention text with longer text length, the ideographic range of the finally determined intention recognition result can be reduced, and the recognition result is more accurate.
The scheme provided by the invention can improve the quality of the intention recognition model, solve the problem of misrecognition of similar labels, and further improve the accuracy of the intention recognition result. The method and the device provided by the invention have the advantages of simple structure, high efficiency, easiness in deployment and low resource allocation requirement, and particularly identify tasks for related intention under a big data scene. The scheme can realize the update iteration for completing the task of the intention recognition of the related field at low cost. Moreover, the scheme provided by the scheme has the advantages of simple method and easy understanding, and is convenient for business personnel in the field to use and perfect.
In order to solve the problems in the prior art, an embodiment of the present application further provides an intention recognition apparatus 100, as shown in fig. 10, including:
the acquisition module 101 acquires an intention text set corresponding to a text to be identified, wherein the intention text set comprises multiple types of intention texts and confidence degrees corresponding to the multiple types of intention texts;
The selecting module 102 selects N first intention texts, where N is a positive integer greater than or equal to 2, and the confidence level of the selected N first intention texts is greater than the confidence level of the unselected intention texts;
A first determining module 103, configured to determine a second set of intention texts if at least two of the first intention texts include the same first text, where the second set of intention texts is an intention text after deleting the first text from the N first intention texts;
the second determining module 104 determines an intention recognition result of the text to be recognized according to the similarity between each intention text in the second intention text set and the text to be detected.
According to the device provided by the embodiment of the application, the N first intention texts are selected based on the confidence degrees by acquiring the multiple types of intention texts and the confidence degrees corresponding to the intention texts, and the confidence degrees can express the accuracy of the intention texts, so that the selected first intention texts are relatively accurate intention texts in the intention text set. Subsequently, the distinction between the N first intention texts is enlarged by deleting the first text common to the first intention texts, thereby simplifying the first intention text into the second intention text. And then, performing similarity comparison on the second intention text and the text to be detected, and selecting an optimal intention recognition result from the N first intention texts, so that the output intention recognition result is effectively optimized, and the accuracy of the intention recognition result is improved.
The above modules in the apparatus provided by the embodiment of the present application may further implement the method steps provided by the foregoing method embodiment. Or the device provided by the embodiment of the application may further include other modules besides the above modules, so as to implement the method steps provided by the embodiment of the method. The device provided by the embodiment of the application can realize the technical effects achieved by the embodiment of the method.
Preferably, the embodiment of the present invention further provides an electronic device, including a processor, a memory, and a computer program stored in the memory and capable of running on the processor, where the computer program when executed by the processor implements each process of the above embodiment of an intent recognition method, and the same technical effects can be achieved, and for avoiding repetition, a description is omitted herein.
The embodiment of the invention also provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements the processes of the above embodiment of the intent recognition method, and can achieve the same technical effects, so that repetition is avoided, and no further description is given here. The computer readable storage medium is, for example, a Read-Only Memory (ROM), a random access Memory (Random Access Memory RAM), a magnetic disk or an optical disk.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and variations of the present application will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. which come within the spirit and principles of the application are to be included in the scope of the claims of the present application.

Claims (10)

1. An intent recognition method, comprising:
acquiring an intention text set corresponding to a text to be identified, wherein the intention text set comprises multiple types of intention texts and confidence degrees corresponding to the multiple types of intention texts;
Selecting N first intention texts, wherein N is a positive integer greater than or equal to 2, and the confidence coefficient of the selected N first intention texts is greater than that of unselected intention texts;
If at least two first intention texts comprise the same first text, determining a second intention text set, wherein the second intention text set is an intention text after deleting the first text in the N first intention texts;
and determining an intention recognition result of the text to be recognized according to the similarity between each intention text in the second intention text set and the text to be recognized, wherein the intention recognition result comprises a first intention text corresponding to the intention text with the highest similarity with the text to be recognized in the second intention text set.
2. The method of claim 1, wherein determining an intent recognition result for the text to be recognized based on a similarity of each intent text in the second set of intent texts to the text to be recognized, comprises:
Acquiring a second intention vector corresponding to each intention text in the second intention text set, wherein the second intention vector is used for representing multidimensional text characteristics of each intention text;
Determining a text vector to be recognized according to the text to be recognized, wherein the text vector to be recognized is used for representing multidimensional text characteristics of the text to be recognized;
obtaining the similarity between each intention text and the text to be identified according to the distance between the second intention vector corresponding to each intention text and the text vector to be identified;
and determining the first intention text corresponding to the second intention text with the highest similarity as an intention recognition result of the text to be recognized.
3. The method according to claim 1 or 2, further comprising, after obtaining the set of intention texts corresponding to the text to be identified:
Determining a confidence coefficient maximum value and a confidence coefficient secondary maximum value according to the confidence coefficient corresponding to each intention text;
And if the difference value between the confidence coefficient maximum value and the confidence coefficient next-largest value is larger than a preset value, determining the intention text corresponding to the confidence coefficient maximum value as an intention recognition result of the text to be recognized.
4. The method of claim 1 or 2, further comprising, after the selecting N first intention texts:
Determining the lengths of N maximum continuous characters shared by the N first intention texts and the text to be recognized;
and if the maximum value of the lengths of the N common maximum continuous characters is unique, determining the first intention text corresponding to the maximum common continuous character length as an intention recognition result of the text to be recognized.
5. The method of claim 1 or 2, further comprising, after the selecting N first intention texts:
determining the number of N common characters of the N first intention texts and the text to be recognized;
And if the maximum value of the number of the N common characters is unique, determining the first intention text corresponding to the common character with the largest number as an intention recognition result of the text to be recognized.
6. The method according to claim 1 or 2, wherein the obtaining the set of intention texts corresponding to the text to be identified includes:
inputting the text to be recognized into a trained intention recognition model to obtain multiple types of intention texts and confidence degrees corresponding to the multiple types of intention texts, and obtaining the intention text set.
7. The method of claim 6, wherein the inputting the text to be recognized into a trained intent recognition model results in a plurality of types of intent texts and respective confidence levels of the plurality of types of intent texts, and the obtaining the intent text set includes;
And selecting n types of intention texts in the multiple types of intention texts and confidence degrees corresponding to the n types of intention texts respectively to obtain the intention text set, wherein n is a positive integer.
8. An intent recognition device, comprising:
The acquisition module is used for acquiring an intention text set corresponding to the text to be identified, wherein the intention text set comprises multiple types of intention texts and confidence degrees corresponding to the multiple types of intention texts;
The selecting module is used for selecting N first intention texts, wherein N is a positive integer greater than or equal to 2, and the confidence coefficient of the selected N first intention texts is greater than that of the unselected intention texts;
the first determining module is used for determining a second intention text set if at least two first intention texts comprise the same first text, wherein the second intention text set is an intention text after deleting the first text in the N first intention texts;
And the second determining module is used for determining an intention recognition result of the text to be recognized according to the similarity between each intention text in the second intention text set and the text to be recognized, wherein the intention recognition result of the text to be recognized comprises an intention text with the highest similarity with the text to be recognized in the second intention text set.
9. An electronic device, comprising: memory, a processor and a computer program stored on the memory and executable on the processor, which when executed by the processor, performs the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 7.
CN202111509161.XA 2021-12-10 2021-12-10 Intention recognition method and device Active CN114254622B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111509161.XA CN114254622B (en) 2021-12-10 2021-12-10 Intention recognition method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111509161.XA CN114254622B (en) 2021-12-10 2021-12-10 Intention recognition method and device

Publications (2)

Publication Number Publication Date
CN114254622A CN114254622A (en) 2022-03-29
CN114254622B true CN114254622B (en) 2024-06-14

Family

ID=80794766

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111509161.XA Active CN114254622B (en) 2021-12-10 2021-12-10 Intention recognition method and device

Country Status (1)

Country Link
CN (1) CN114254622B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116453522B (en) * 2023-06-19 2023-08-29 北京中关村科金技术有限公司 Speech recognition method, device, electronic equipment and readable storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106663424A (en) * 2014-03-31 2017-05-10 三菱电机株式会社 Device and method for understanding user intent
CN111881672A (en) * 2020-06-18 2020-11-03 升智信息科技(南京)有限公司 Intention identification method

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10621976B2 (en) * 2018-09-18 2020-04-14 International Business Machines Corporation Intent classification from multiple sources when building a conversational system
CN111563208B (en) * 2019-01-29 2023-06-30 株式会社理光 Method and device for identifying intention and computer readable storage medium
CN109871446B (en) * 2019-01-31 2023-06-06 平安科技(深圳)有限公司 Refusing method in intention recognition, electronic device and storage medium
CN110147445A (en) * 2019-04-09 2019-08-20 平安科技(深圳)有限公司 Intension recognizing method, device, equipment and storage medium based on text classification
CN111639181A (en) * 2020-04-30 2020-09-08 深圳壹账通智能科技有限公司 Paper classification method and device based on classification model, electronic equipment and medium
CN111611383A (en) * 2020-05-26 2020-09-01 深圳壹账通智能科技有限公司 User intention recognition method and device, computer equipment and storage medium
CN111597320A (en) * 2020-05-26 2020-08-28 成都晓多科技有限公司 Intention recognition device, method, equipment and storage medium based on hierarchical classification
CN111933127B (en) * 2020-07-31 2024-06-25 升智信息科技(南京)有限公司 Intention recognition method and intention recognition system with self-learning capability
CN112328758A (en) * 2020-10-27 2021-02-05 创泽智能机器人集团股份有限公司 Session intention identification method, device, equipment and storage medium
CN112380870A (en) * 2020-11-19 2021-02-19 平安科技(深圳)有限公司 User intention analysis method and device, electronic equipment and computer storage medium
CN112949297A (en) * 2021-02-25 2021-06-11 深圳追一科技有限公司 Intention recognition method, device, computer equipment and computer readable storage medium
CN113051385B (en) * 2021-04-28 2023-05-26 杭州网易再顾科技有限公司 Method, medium, device and computing equipment for intention recognition

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106663424A (en) * 2014-03-31 2017-05-10 三菱电机株式会社 Device and method for understanding user intent
CN111881672A (en) * 2020-06-18 2020-11-03 升智信息科技(南京)有限公司 Intention identification method

Also Published As

Publication number Publication date
CN114254622A (en) 2022-03-29

Similar Documents

Publication Publication Date Title
CN111160017B (en) Keyword extraction method, phonetics scoring method and phonetics recommendation method
CN111444320B (en) Text retrieval method and device, computer equipment and storage medium
CN112131920B (en) Data structure generation for table information in scanned images
US20230039496A1 (en) Question-and-answer processing method, electronic device and computer readable medium
CN112711660B (en) Method for constructing text classification sample and method for training text classification model
CN111708869B (en) Processing method and device for man-machine conversation
CN110968725B (en) Image content description information generation method, electronic device and storage medium
CN112732871A (en) Multi-label classification method for acquiring client intention label by robot
US20230153534A1 (en) Generating commonsense context for text using knowledge graphs
CN110781687A (en) Same intention statement acquisition method and device
CN114997288A (en) Design resource association method
CN115544303A (en) Method, apparatus, device and medium for determining label of video
CN116861269A (en) Multi-source heterogeneous data fusion and analysis method in engineering field
US11868714B2 (en) Facilitating generation of fillable document templates
CN110795942B (en) Keyword determination method and device based on semantic recognition and storage medium
CN117390497A (en) Category prediction method, device and equipment based on large language model
CN115526171A (en) Intention identification method, device, equipment and computer readable storage medium
CN111368066B (en) Method, apparatus and computer readable storage medium for obtaining dialogue abstract
CN114254622B (en) Intention recognition method and device
CN114282513A (en) Text semantic similarity matching method and system, intelligent terminal and storage medium
CN113723077A (en) Sentence vector generation method and device based on bidirectional characterization model and computer equipment
CN116644148A (en) Keyword recognition method and device, electronic equipment and storage medium
CN115203206A (en) Data content searching method and device, computer equipment and readable storage medium
CN114398482A (en) Dictionary construction method and device, electronic equipment and storage medium
CN113673237A (en) Model training method, intent recognition method, device, electronic equipment and storage medium

Legal Events

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