CN114254622A - Intention identification method and device - Google Patents

Intention identification method and device Download PDF

Info

Publication number
CN114254622A
CN114254622A CN202111509161.XA CN202111509161A CN114254622A CN 114254622 A CN114254622 A CN 114254622A CN 202111509161 A CN202111509161 A CN 202111509161A CN 114254622 A CN114254622 A CN 114254622A
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.)
Pending
Application number
CN202111509161.XA
Other languages
Chinese (zh)
Inventor
李长林
蒋宁
王洪斌
吴海英
权佳成
曹磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
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/CN114254622A/en
Publication of CN114254622A publication Critical patent/CN114254622A/en
Pending legal-status Critical Current

Links

Images

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

Abstract

The invention discloses an intention identification method and device, which are used for solving the problem of inaccurate text intention identification. This scheme includes: acquiring an intention text set corresponding to a text to be recognized; selecting N first intention texts, wherein the confidence coefficient of the selected first intention texts is greater than that of the 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 obtained after the first text is deleted from 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 scheme, the plurality of intention texts are obtained, the optimal intention recognition result is selected from the N first intention texts in a mode of deleting the common first texts in 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 identification method and device
Technical Field
The present invention relates to the field of intention identification, and in particular, to an intention identification method and apparatus.
Background
Intent recognition refers to extracting the intent it expresses from a sentence. For example, with the official network of south navigation, a person may have different intentions of checking tickets, returning tickets, booking seats, and the like. Therefore, the intention recognition is a multi-classification problem, the input is characters, and the output is a specific intention. In short, when a user inputs a sentence or a text, the intention recognition can accurately recognize which domain the question is, and then the robot is assigned to the corresponding domain to perform secondary processing, which plays an important role in a search engine and intelligent question and answer.
In practical applications, the intention of the text characterization is often determined according to the classification result of the classification model. However, the intention recognition and classification are of many kinds, and some kinds of intentions are close to each other, so that it is difficult to accurately distinguish and recognize the intentions, and the requirement for a recognition model is high. In addition, semantic information contained in the text to be detected is complex, and the current rule or model-based method is difficult to accurately identify the intention of text expression.
How to improve the text intention identification accuracy is a technical problem to be solved by the application.
Disclosure of Invention
The embodiment of the application aims to provide an intention identification method and device, which are used for solving the problem of inaccurate text intention identification.
In a first aspect, an intention identification method is provided, including:
acquiring an intention text set corresponding to a text to be recognized, 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 the 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 obtained after the first text is deleted from 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, comprising:
the system comprises an acquisition module, a recognition module and a recognition module, wherein the acquisition module acquires an intention text set corresponding to a text to be recognized, and 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;
a first determining module, configured to determine a second intention text set if at least two of the first intention texts include the same first text, where the second intention text set is an intention text after the first text is deleted from the N first intention texts;
and the second determining module is used for determining the 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, an electronic device is provided, the electronic device comprising a processor, a memory and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the method according to the first aspect.
In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, which computer program, when being executed by a processor, realizes the steps of the method as in the first aspect.
In the embodiment of the application, an intention text set corresponding to a text to be recognized is obtained, 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 the 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 obtained after the first text is deleted from 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 scheme, multiple types of intention texts and corresponding confidence degrees of the intention texts are obtained, N first intention texts are selected based on the confidence degrees, and the selected first intention texts are relatively accurate intention texts in an intention text set because the confidence degrees can express the accuracy of the intention texts. And then, the difference among the N first intention texts is expanded in a mode of deleting the common first texts in the first intention texts, so that the first intention texts are simplified into second intention texts. And then, the similarity comparison is carried out on the second intention text and the text to be detected, the optimal intention recognition result can be selected from the N first intention texts, 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 not to limit the invention. In the drawings:
fig. 1 is a flow chart of an intention recognition method according to an embodiment of the present invention.
Fig. 2 is a second flowchart illustrating an intention recognition method according to an embodiment of the invention.
Fig. 3 is a third flowchart illustrating an intention recognition method according to an embodiment of the invention.
FIG. 4 is a fourth flowchart illustrating an intention recognition method according to an embodiment of the invention.
FIG. 5 is a fifth flowchart illustrating an intention recognition method according to an embodiment of the invention.
FIG. 6 is a sixth flowchart illustrating an intent recognition method according to an embodiment of the invention.
Fig. 7 is a seventh flowchart illustrating an intention recognition method according to an embodiment of the invention.
Fig. 8 is an eighth flowchart illustrating an intention recognition method according to an embodiment of the invention.
FIG. 9 is a ninth flowchart illustrating an intent recognition method according to an embodiment of the invention.
Fig. 10 is a schematic structural diagram of an intention identifying apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention. The reference numbers 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 is described in the specification.
In the field of intention recognition, an intention recognition method based on rules of dictionaries and templates does not have a universal function, the construction of the dictionaries and the templates needs a large amount of manpower and material resources, and the constructed dictionaries and the templates are only suitable for specific application scenes. Although the deep learning method can solve the disadvantages of the rules to a certain extent, the types of the output of the deep learning intention identification model are too many, some types of the intentions are similar, and the purposes are difficult to distinguish accurately in practical application and the identification is inaccurate. Moreover, the training of the model depends heavily on the labeled data, and the quality of the labeled data directly influences the effect of the model. In addition, the model is not friendly to maintainability and expansibility, and needs to be retrained if the recognition data is changed and the scene is changed, so that a non-professional algorithm person can hardly understand the principle of the model and can hardly be widely applied.
In order to solve the problems in the prior art, an embodiment of the present application provides an intention identifying method, as shown in fig. 1, including the following steps:
s11: the method comprises the steps of obtaining an intention text set corresponding to a text to be recognized, 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 recognized in the scheme can be words, phrases, sentences or paragraphs. Generally, the number of characters of the text to be recognized is related to the complexity of expressed intentions, and if the text to be recognized is too long, various intentions are included. In practical application, if the text to be recognized is too long, the text to be recognized may be segmented based on punctuations, spaces or special symbols in the text to be recognized. And recognizing the texts to be recognized of each segmented part one by one, and then integrating the intention recognition results of each part to determine the intention of the whole text to be recognized.
The text to be recognized in the scheme can be a text input by a user in real time, for example, the text can be a search word input in a search engine, timely communication content input in communication software, a consultation problem input on a shopping platform and the like.
Alternatively, the text to be recognized may also be non-instantaneous text obtained from a database, such as a sentence extracted from an article.
The text to be recognized may also be a text obtained by converting a file in another form, for example, a call content text obtained by recognizing a call voice file, a subtitle text obtained by recognizing a video file, a text obtained by recognizing a picture, and the like.
The intention text set in this step includes multiple types of intention texts and confidence degrees corresponding to the intention texts, wherein the intention texts can represent the intention of the text representation to be recognized. The confidence coefficient is a statistical concept, and in the scheme, the confidence coefficient represents the probability that the intention of the real character of the text to be recognized belongs to the intention type expressed by the intention text corresponding to the confidence coefficient. In short, the higher the confidence corresponding to the intention text indicates that the probability that the text to be recognized matches the intention text is higher.
S12: 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.
In this step, a plurality of intention texts are preliminarily screened based on the confidence degrees in the intention text set. Specifically, the multiple types of intention texts can be sorted according to the degree of confidence, and N intention texts with high degrees of confidence are selected as the first intention text. 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, comparing every two of the intention texts in the intention text set in a one-by-one comparison mode to select the N first intention texts with high confidence degrees.
The first selected intention texts are N intention texts with relatively high confidence degrees in the intention text set, which indicates that the first intention texts are intention texts with high probability of being matched with the text to be recognized in the intention text set. According to the scheme, subsequent screening and recognition are performed on the basis of the first intention texts, the intention texts with low matching probability with the texts to be recognized can be eliminated, and the calculation amount is effectively reduced.
Optionally, the N first intention texts selected in this step may also be intention texts with a confidence greater than a preset confidence. However, in practical application, the confidence value of the intended text is difficult to predict, and if the intention of the text to be recognized is clear, the confidence corresponding to the intended text is often higher. However, if the text to be recognized is expressed with a large number of intentions, or the intention of the expression is ambiguous, the confidence level of the intended text is usually low. If the first intended text is selected based on the preset confidence level, too much or too little number of the first intended texts may be selected, or even no intended text may be selected. Therefore, compared with a mode of selecting the intention texts according to the preset confidence level, the method for selecting the intention texts based on the preset number N has stronger stability, the first intention texts can be selected, the number of the selected first intention texts is consistent, and further screening processing is conveniently carried out subsequently.
S13: 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 the first text is deleted from the N first intention texts.
In practical application, a situation that a plurality of first intention texts in an intention text set are close to each other often occurs, and the first intention texts which are close to each other in terms of ideographs also often comprise the same text. For example, assuming that the text to be recognized is "how to solve the password is locked", assuming that the N value is 3, the 3 first intention texts and the confidence degrees corresponding to the first intention texts selected by the above steps are 0.910543; 0.743662 for password association; 0.578866 when password is lost.
Wherein, the three first intention texts all include the same first text "password", and the "password" in each first intention text is deleted in this step to obtain the simplified intention text of each first intention text: "password unlock" → "unlock", "password association" → "association", "password loss" → "loss". In the embodiments of the present application, these simplified intention texts are referred to as second intention texts.
In this step, the distinction between the plurality of first intention texts can be expanded by deleting the common text in the first intention text. Based on the above example, since the text to be recognized contains the keyword "password", this causes the corresponding N first intention texts to contain "password". In the step, the content except the first text is reserved by deleting the first text password shared by the first intention texts, so that the difference among the first intention texts is effectively expanded, and the intention recognition result which is most matched with the text to be recognized 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 similarity between the text to be recognized and the intention text in the second intention text set obtained in the above step is compared. For example, the similarity may be determined from the aspects of character consistency, character emotion, and similar/antisense words, and 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 in terms of word consistency, the second set of intended texts includes 3 intended texts: "unlock", "associate", "lost". In this step, the word consistency comparison is performed on the three simplified intention texts, namely "unlocked", "related" and "lost", which are how the password is locked, so that it can be determined that both the text to be recognized and the "unlocked" contain the "locked" and have the same words, and the text to be recognized and the other two simplified intention texts do not have the same words. Based on the fact that the unlocking is the simplified intention text with the highest similarity to the text to be recognized, the first intention text corresponding to the unlocking is password unlocking, and therefore the intention recognition result of the text to be recognized is password unlocking.
According to the scheme, multiple types of intention texts and corresponding confidence degrees of the intention texts are obtained, N first intention texts are selected based on the confidence degrees, and the selected first intention texts are relatively accurate intention texts in an intention text set because the confidence degrees can express the accuracy of the intention texts. Then, the difference among the N first intention texts is expanded in a mode of deleting the first texts which are common in the first intention texts, and the first intention texts are simplified into the second intention texts. And then, the similarity comparison is carried out on the second intention text and the text to be detected, the optimal intention recognition result can be selected from the N first intention texts, the output intention recognition result is effectively optimized, and the accuracy of the intention recognition result is improved.
Based on the solution provided by the foregoing embodiment, as shown in fig. 2, the optional foregoing step S14 includes:
s21: and 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 the multi-dimensional text features of each intention text.
In this step, the obtained second intention vector is used for characterizing the multi-dimensional text features of each intention text in the second intention text set. In other words, the feature values of the respective intention texts in the second intention text set on the plurality of text feature dimensions are expressed in the form of vectors in the present step. And any intention text in the second intention text set 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 multi-dimensional text features of the text to be recognized.
In this step, the obtained text vector to be recognized is used for representing the multi-dimensional text features of the text to be recognized. In other words, the feature values of the text to be recognized in a plurality of text feature dimensions are expressed in the form of vectors in the present step.
The vector representations of S21 and S22 may be implemented by: TF-IDF (term frequency-inverse document frequency), Word2vec (Word to vector), glove (Global Vectors for Word replication), ELMo (Emmarks from Language models), BERT (bidirectional Encode transformations), etc.
The TF-IDF is a weighting technique, where TF denotes a Term Frequency (Term Frequency) and IDF denotes an Inverse text Frequency index (Inverse Document Frequency). TF-IDF is used to assess how important a word is to one of a set of documents or a corpus. The importance of a word increases in proportion to the number of times it appears in a document, but at the same time decreases in inverse proportion to 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 dimension includes the word category included in the text, and the size in each dimension may be determined according to the frequency of occurrence of the word in the corresponding dimension.
The word2vec is a set of correlation models used to generate word vectors. These models are shallow, two-layer neural networks that are trained to reconstruct linguistic word text. The network is represented by words and the input words in adjacent positions are guessed, and the order of the words is unimportant under the assumption of the bag-of-words model in word2 vec. After training is completed, the word2vec model can be used to map each word to a vector, which can be used to represent word-to-word relationships, the vector being a hidden layer of the neural network.
The above glove is a word representation tool based on global word frequency statistics (count-based & overall statistics), which can represent a word as a vector consisting of real numbers, and these vectors capture some semantic characteristics between words, such as similarity (similarity), analogy (analogy), etc.
The ELMo is a method of representing a vocabulary in a word vector (vector) or word embedding (embedding). The word vectors for ELMo are calculated on a two-layer bidirectional language model (biolM). The model consists of two layers which are overlapped, and each layer has two iterations of forward (forward pass) and backward (backward pass). The input measurement of the bidirectional language model is characters instead of words, and the word vector output by the bidirectional language model can represent the internal structure information of the words.
The BERT described above is a transform-based bi-directional encoder characterization. The bidirectional meaning means that when a word is processed, the information of the words in front of and behind the word can be considered, so that the context semantics can be obtained, and the obtained vector can express the semantic relation of the word context to a certain extent.
In practical application, the above method or other methods may be selected to generate the vector corresponding to the text according to the practical application scenario and the text characteristics. Optionally, the vectors are generated in steps S21 and S22 in the same way, so as to improve the reliability of the similarity comparison performed on the vectors in the subsequent steps.
S23: and obtaining the similarity between each intention text and the text to be recognized according to the distance between the second intention vector corresponding to each intention text and the text vector to be recognized.
In this step, the similarity can be determined at equal distances according to the Euclidean distance, the cosine distance, and the Jacard distance. Herein, euclidean distance, also referred to as euclidean distance or euclidean metric, refers to the "normal" (i.e., straight line) distance between two vectors in space, and the distance is used to express the similarity between the two vectors. The cosine distance is also called cosine similarity, and refers to a cosine value of an included angle between two vectors, and the cosine value is used for expressing the similarity between the two vectors. The Jacard distance is that two vectors are respectively considered as a set, the numerical value of each dimension of the vector expresses whether an element exists in the dimension, namely the numerical value of the dimension is larger than 0 to express that the element exists in the dimension, and then the similarity of the two vectors is expressed based on the Jacard similarity coefficient. Although the magnitude of the vector in each dimension is not considered by jkade, the method has the advantage of high computational efficiency, and is particularly suitable for scenes with high dimension number and small 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 the intention recognition result of the text to be recognized.
The similarity determined in the above steps expresses the probability that the second intention text is matched with the text to be recognized, and the higher the similarity is, the higher the matching probability is. Since the second intention text is the simplified intention text obtained by deleting the first text, the different second intention texts have more obvious difference. In the step, the similarity between each second intention text and the text to be recognized 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 recognition result, and the accuracy of the determined intention recognition result can be effectively improved.
Based on the solution provided by the foregoing embodiment, as shown in fig. 3, after the foregoing step S12, optionally, the method further includes:
s31: and determining the maximum confidence value and the second maximum confidence value according to the confidence corresponding to each intention text.
Based on the examples given in the above embodiments, if the intention text set is 'password unlock': 0.910543; 0.743662 for password association; 0.578866, wherein the maximum confidence value is 0.910543 and the second largest confidence value is 0.743662.
S32: and if the difference value between the maximum confidence coefficient value and the second maximum confidence coefficient value is greater than a preset value, determining the intention text corresponding to the maximum confidence coefficient value as the intention recognition result of the text to be recognized.
The preset value may be preset according to actual requirements, and may be 0.5, for example. In this step, the difference between the intention text with the maximum confidence and the intention text with the second maximum confidence is judged based on a preset value.
In practical applications, since the similarity between the respective intention texts in the intention text set is high, a plurality of intention texts with high confidence may be output. In this step, whether the intention text with the maximum confidence degree is greatly different from the intention text with the second maximum confidence degree is judged based on a preset value, if the confidence degree difference between the two intention texts is large, the two intention texts are not similar, and the matching probability between the input text and the intention text with the maximum confidence degree is obviously greater than that between the input text and the intention text with the second maximum confidence degree. If the condition is met, the intention text corresponding to the maximum confidence coefficient 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 text, so that the scheme can realize the comparison of the prediction accuracy of two intention texts with the maximum confidence coefficient and the second maximum confidence coefficient by comparing the maximum confidence coefficient value with the second maximum confidence coefficient value, and if the conditions are met, the intention text with the maximum confidence coefficient can be directly output, so that the judgment process can be effectively simplified in practical application, and the efficiency of determining the intention recognition result is improved.
Based on the solution provided by the foregoing embodiment, optionally, after the foregoing step S12, as shown in fig. 4, the method further includes:
s41: determining the length of the N first intention texts and the N common maximum continuous characters of the text to be recognized.
The above-mentioned common maximum continuous character length refers to the maximum length of characters which are contained and continuous in both the first intention text and the text to be recognized. For example, based on the example given in the above embodiment, for the text to be recognized, "password is locked, how" 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 the intended text are all contained in the text to be recognized, and the consecutive characters are "password", "unlock" and "lock", respectively. Correspondingly, the lengths of the three consecutive characters are 2, 1, respectively, wherein the length of the total maximum consecutive character is 2.
S42: and if the maximum value of the lengths of the N common maximum continuous characters is unique, determining a first intention text corresponding to the maximum common maximum 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 magnitude, and the maximum value among the lengths of the plurality of 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 the intention recognition result of the text to be recognized.
According to the scheme provided by the embodiment of the application, the N first intention texts can be respectively compared with the text to be recognized based on the common maximum continuous character length, if the conditions are met, the most similar first intention text can be output as the intention recognition result, the judgment process can be effectively simplified in practical application, and the efficiency of determining the intention recognition result is improved.
Based on the solution provided by the foregoing embodiment, as shown in fig. 5, after the foregoing step S12, optionally, the method further includes:
s51: determining the number of N common characters of the N first intention texts and the text to be recognized.
The number of the common characters is a unit of a single character, and the N first intention texts and the text to be recognized are respectively compared in the step so as to determine the number of the common characters.
For example, based on the example given in the above embodiment, as for the text to be recognized, "how the password is locked" is related to the first intention text "password", the characters shared by the text to be recognized and the first intention text are "password" and "code", and it can be determined that the number of shared characters is 2.
For another example, for the first intention text "password unlock", 4 characters in the first intention text are all contained in the text to be recognized, so that the number of common characters in the first intention 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 given in the above embodiment, if the first intention text is "password unlock", "password association", and "password loss", respectively, the number of common characters corresponding to the first intention text determined based on the above steps is "password unlock" → 4, "password association" → 2, "password loss" → 2. It can be seen 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, i.e., it indicates that the first intention text corresponding to the maximum number of common characters 4 is unique. In this step, the corresponding first intention text "password unlock" may be output as an intention recognition result.
According to the scheme provided by the embodiment of the application, each first intention text can be compared with the text to be recognized based on the number of the common characters, the most similar first intention text can be output if the condition is met, the judgment process can be effectively simplified in practical application, and the efficiency of determining the intention recognition result is improved.
Based on the solution provided by the foregoing embodiment, optionally, as shown in fig. 6, the foregoing step S11 includes:
s61: inputting the text to be recognized into a trained intention recognition model to obtain multiple types of intention texts and corresponding confidence degrees of the multiple types of intention texts, and obtaining the intention text set.
The trained intention recognition model is used for performing classification according to input text, and the output intention text represents intention types of the input text representation. Optionally, the intention recognition model in the scheme can be a universal intention recognition model, special training for a specific application scene is not needed, and manpower and time consumed for training the intention recognition model are effectively reduced.
The intention recognition model outputs a plurality of types of intention texts and corresponding confidence degrees thereof according to the texts to be recognized, the intention texts represent the types to which the intentions of the texts to be recognized possibly belong, and the confidence degrees are used for expressing the reliability of the corresponding intention texts. In the scheme, the confidence coefficient represents the probability that the intention of the real character of the text to be recognized belongs to the intention type expressed by the intention text matched with the confidence coefficient. In short, the higher the confidence corresponding to the intention text indicates that the probability that the intention recognition model determines that the text to be recognized matches the intention text is higher.
In practical applications, since the classification results of the intention recognition model are complex and some of the classification results have similar meanings, the confidence degrees corresponding to a plurality of intention texts output by the intention recognition model may be high. In other words, the input text to be recognized is matched with a plurality of intention texts output by the intention recognition model with high probability. According to the scheme, the multiple intention texts output based on the intention recognition model in the subsequent steps are further matched and screened in the aspect of text similarity, so that the multiple intention texts can be finely matched, and the accuracy of the intention recognition result is improved.
Based on the solution provided by the foregoing embodiment, optionally, as shown in fig. 7, the foregoing step S61 includes;
s71: and selecting n types of intention texts in the multiple types of intention texts and the confidence degrees corresponding to the n types of intention texts to obtain the intention text set, wherein n is a positive integer.
The value of N in this step is not less than that in the above embodiment. Optionally, if the value of N in this step is equal to the value of N in the above embodiment, in step S12, each intention text in the intention text set in this step may be directly selected as the first intention text. Optionally, the value of n in this embodiment may be preset, and may be an integer not less than 1 and not greater than 5, for example. In addition, the n value may also be determined based on the confidence level of the model output intention label in the step of performing a test on the intention recognition model, which 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 and output the n types of intention texts, wherein the n types of intention texts are the n types of intention texts predicted by the intention recognition model and closest to the intention expressed by the text to be recognized.
By 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 outputs n types of reliable intention texts, the subsequent processes of selecting and comparing the intention texts can be effectively simplified, and the intention recognition efficiency is improved.
Based on the solution provided by the foregoing embodiment, optionally, before the foregoing step S16, the method may further perform optimization training on the intention recognition model, 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;
respectively inputting the test texts into the intention recognition model to obtain a plurality of test label groups output by the intention recognition model, wherein the test label groups correspond to the test texts one by one, and each test label group comprises at least one intention label output by the intention recognition model;
determining the identification accuracy of the intention identification 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, obtaining a plurality of abnormal labels, so that the test label group of the test text corresponding to the abnormal labels does not contain the intention label 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 intention recognition model may be obtained by pre-training a training set, where the test set and the training set both include texts and corresponding intention labels. The intention label corresponding to the text is used for representing the intention expressed by the corresponding text. 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 training samples is certain, 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 in the training set to the number of samples in the test set is 8: 2.
In this embodiment, a plurality of test texts in the test set are respectively input to the intention recognition model, and the intention recognition model recognizes the test texts to output predicted intention labels. In the scheme, for one test text, the intention recognition model outputs a plurality of predicted intention labels, and the intention labels are constructed into a test label group corresponding to the test text. The number of the intention labels contained in the test label group is related to the number of the intention labels output by the intention recognition model and the confidence coefficient, and each test label group comprises at least one intention label.
The set of test labels output by the intent recognition model includes the intent label results predicted by the intent recognition model. And matching the intention labels obtained by predicting the intention recognition model with real labels corresponding to the test texts 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 the recognition accuracy of the intention recognition model according to the matching degree between at least one intention tag in the test tag group and the intention tag of the test text corresponding to the test tag group includes:
determining the accuracy of each test label group 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;
and determining the identification accuracy of the intention identification model according to the accuracy of each test label group.
The determined identification accuracy is determined according to the matching degree between the real intention labels in the test set and the intention labels predicted by the model, and whether the intention labels predicted by the model are close to the real intention labels or not can be represented, so that the model prediction accuracy is expressed.
In the embodiment, each test tag group corresponds to one test text, and the accuracy of each test tag group is determined first. The accuracy of the test tag group refers to the matching degree of the intention tags contained in the test tag group and the real intention tags corresponding to the test text.
For example, for any test tag group, first, the matching degree between each intention tag in the test tag group and the real tag is determined, and if the test tag group includes an intention 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 to the real tag, the identification accuracy of the test tag group can be determined according to the actual similarity. If the difference between each intention label in the test label group and the real label is larger, the identification accuracy of the test label group can be determined according to the actual difference.
After the identification accuracy of each test label group is determined through the steps, the identification accuracy of the intention identification model is determined according to the identification accuracy of each test label group. For example, the benchmark recognition accuracy of the test tag group may be preset, such as 80%. And determining a test label group with the accuracy rate of not less than 80% as an identification accurate label group, and determining the proportion of the identification accurate label group in all the label groups as the accuracy rate of the intention identification model.
For example, suppose the intent recognition model outputs 10 test tag sets, of which 7 are the correct tag sets to be recognized. Then, the ratio of 7 identification-accurate tag groups to 10 test tag groups was determined as the accuracy of the intended identification model, i.e., 70%.
In addition to the manner in which the accuracy of the intended recognition model is determined based on the proportion of the accurate tag group number in the total tag group number provided by the above-described embodiments, the accuracy of the intended recognition 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 determined comprehensively according to statistical parameters such as the average, median, 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 actual requirements, and may be, for example, 95%. If the identification accuracy of the model is determined to be lower than the preset accuracy through the steps, the fact that the difference between the model prediction result and the real intention label is large is shown. Because the model is trained based on the training set, the prediction result of the model is also closely related to the quality of the training set, and the inaccuracy of the model prediction is often caused by inaccuracy of the intention labels in the training set. In the subsequent steps, the abnormal labels can be screened, the training intention recognition model is optimized by updating the abnormal labels, and the recognition accuracy of the intention recognition model is further improved.
Based on the above embodiment, if the recognition accuracy of the intention recognition model is lower than the preset accuracy, the training set may be subjected to label screening based on a preset algorithm 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, and may also be other algorithms.
In the step, abnormal labels can be screened based on a K-fold intersection algorithm, wherein the K-fold means that the data set is divided into K parts, K-1 part is used as a training set, and 1 part is used as a test set. Training the model based on the K-1 training set, executing the test based on 1 training set after the training is finished, selecting samples which are not matched with the 1 testing set in the model prediction result as abnormal samples, and enabling the labels of the abnormal samples to be abnormal labels. Then, another 1 part of sample different from the 1 part of test sample is taken as a test set, the rest K-1 part is taken as a training set, model training and testing are performed again, and an abnormal sample is output, wherein a label in the abnormal sample is an abnormal label. And (3) taking every 1 sample in the data set as a training set to execute K times of training and testing, so that abnormal samples in all samples are found, and abnormal labels can be automatically screened out. For the samples containing the abnormal labels, the labels can be updated, the labels of all the samples do not need to be updated, the efficiency of updating the samples is effectively improved, and the accuracy of the labels is improved. In the embodiment, the abnormal label is updated, so that the updated label is consistent with the corresponding text, and the intention of the text representation is accurately expressed. In the updated training set, the text correctly corresponds to the intention label, and then the text is used as the training set to train the intention recognition model, so that the recognition accuracy of the intention recognition model can be obviously improved.
Based on the steps, the test sample with the text correctly corresponding to the intention label can be obtained through updating, then, the training intention recognition model can be optimized based on the updated training set, the problem that the prediction recognition of the intention recognition model is inaccurate is effectively solved, and the prediction result of the intention recognition model is closer to the real intention expressed by the text.
Optionally, if the intention recognition model after the optimization training still does not meet the requirement, for example, the accuracy of the model is still lower than the preset accuracy, the above steps may be repeated to iteratively perform the updating of the label and the model optimization training until the recognition result of the intention recognition classification model meets the accuracy requirement.
Based on the solutions provided in the above embodiments, optionally, the test tag group further includes a confidence level corresponding to the intention tag output by the intention recognition model.
The concept of confidence level has been described in the above embodiments, and is not described herein.
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 the accuracy rate higher than the accuracy rate of a preset test label group from a plurality of intention labels output to a test text by the intention recognition model based on 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 label group according to the value of the n value.
The intention recognition model in this embodiment outputs a corresponding confidence for each intention label, and specifically, the intention labels may be sorted based on the magnitude of the confidence, for example, the intention labels are arranged in a descending order based on the magnitude of the confidence, and whether n intention labels output by the intention recognition model match with the intention labels of the test text is sequentially determined based on the descending order. Wherein the further forward the confidence ranking position indicates the closer to the true intent of the entered textual representation. Alternatively, the step of ranking the intention labels based on the confidence may also be implemented by pairwise comparison.
For example, assume that the predetermined test tag set accuracy is m%. For a test text, the intention recognition model outputs 5 intention labels in total and confidence degrees corresponding to the intention labels. After sorting based on the order of the confidence degrees from large to small, a sorting result of A, B, C, D, E is obtained. 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, that is, gradually increasing the value of n from n to 1.
Optionally, the matching degree between the intention tag a and the intention tag of the test text is determined, that is, whether the accuracy when n is 1 meets the preset accuracy m% of the test tag group is determined. If not, increasing the value of n, and determining the matching degree of the intention labels A and B and the intention labels of the test text, namely judging whether the accuracy rate m% of the preset test label group is met when n is 2. By analogy, the 5 intention labels are exhausted, and therefore 5 accuracy rates corresponding to the values of n being 1-5 can be determined respectively. Subsequently, n values with an accuracy greater than m% can be determined therefrom, and the corresponding n intent tags can be determined.
Optionally, if the number of n values satisfying that the accuracy is greater than or equal to the accuracy of the preset test tag group is multiple, determining the minimum n value satisfying that the accuracy is greater than the accuracy of the preset test tag group, and determining the accuracy of the test tag group according to the value of the minimum n value.
In this example, assume that the preset test tag set accuracy is m% and the accuracy of the n intention tags is Pn. Then, the step selects the minimum n value from the n values satisfying Pn ≧ m%. In practical applications, if the predicted intent tag is completely consistent with the true intent tag, or the predicted tag hits the true intent tag, the accuracy of the n intent tags including the predicted correct intent tag is greater than m% based on the confidence rankings.
In practical application, if a certain n value satisfies Pn ≧ m%, if n value continues to be expanded, the subsequent n values all satisfy Pn ≧ m%. This is because the correct intention label is included in the plurality of intention labels corresponding to the subsequent n values. For example, if Pn is less than m% for n ═ 2 and greater than or equal to m% for n ═ 3, then Pn is greater than or equal to m% for n ═ 4 and greater than or equal to m% for n ═ 5, and then n takes the value of 3.
In the above steps, the minimum n value with the accuracy greater than the preset accuracy 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 by prediction is, and the more accurate the recognition result of the intended 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-described manner of determining the n value after exhausting 5 intention tags, the accuracy Pn of n intention tags may be sequentially determined by gradually increasing from n to 1 based on the above confidence ranking. If the n value of a certain item meets the condition that Pn is larger than or equal to m%, the accuracy of a larger n value does not need to be determined continuously, the n value meeting the condition that Pn is larger than or equal to m% is directly determined as the minimum n value, and the accuracy of the test label group is determined based on the value of the minimum n value.
Optionally, the method further includes, if there is no n value that satisfies that the accuracy is greater than or equal to a preset accuracy of the test tag group, determining the accuracy of the test tag group according to a matching degree of each intention tag in the test tag group and an intention tag of the test text.
In this embodiment, if there is no n value satisfying the above condition, it indicates that each intention label in the test label group is greatly different from the real intention label of the test text, and the accuracy of the test label group is low. In this step, each intention tag in the test tag group may be compared with the intention tag of the test text, so as to determine the accuracy of each intention tag in the test tag group. The comparison may include a word consistency comparison, i.e., whether the intent tags in the test tag set contain words in the true intent tags of the test text. Alternatively, the alignment may also include a semantic consistency alignment, i.e., whether the semantics of the intent tag representations in the test tag set are similar to the semantics of the true intent tag expression 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 set can then be determined based on the statistical parameters. For example, the average, median, mode, or other statistical parameter of the accuracy of each of the intent tags is determined as the accuracy of the set of test tags.
Optionally, in order to improve the execution efficiency of the method according to the embodiment of the present application, if there is no n value that satisfies that the accuracy is greater than or equal to the accuracy of a preset test tag group, the test tag group is marked as an inaccurate-identification tag group. That is, in the embodiment of the present application, it is not necessary to determine the specific accuracy of the test tag group, and it can be determined through the above steps that the test tag group does not have the n value satisfying the above condition, that is, the difference between each intention tag in the test tag group and the intention tag in 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 test tag group can be determined not to belong to the tag group with accurate identification, 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 whether the fixed n value in the test tag group satisfies Pn ≧ m% or not is determined. The scheme provided by the embodiment of the application can obviously reduce the calculation amount, 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 the condition that Pn is larger than or equal to m%. Here, the fixed value of n in this embodiment may be the same as n in step S71 in the above embodiment.
The present scheme is further explained below with reference to fig. 8, based on the pre-trained intention recognition model, first obtaining a test set of the intention recognition model, and inputting a plurality of test texts in the test set into the intention recognition model, respectively, to obtain a plurality of intention labels and confidence thereof output by the intention recognition model for each test text. For any test text, sorting 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 sorting result and determining the accuracy rate Pn corresponding to Top n. For the test label group, if n values meeting Pn is larger than or equal to m%, the identification accuracy of the test label group meets the requirement. If n values meeting the Pn larger than or equal to m% do not exist, the identification accuracy of the test label group is not met.
Optionally, in order to further improve the accuracy of the intention identification model, if any one of the test tag groups output by the intention identification model does not have the value n meeting the requirement that Pn is greater than or equal to m%, the accuracy of the intention identification model is determined to be not meeting the requirement. And then optimizing the model by adjusting the abnormal tags in the data set, and outputting the model after iterative training until all test tag groups output by the model have n values meeting Pn which is more than or equal to m%.
The scheme is further explained with reference to fig. 9, first, text of a text to be recognized is obtained, and the text is input into an intention recognition model to obtain an intention tag output by the model and a corresponding confidence. And selecting Top n intention labels with high confidence from the output intention labels as n types of intention texts for forming an intention text set, wherein the selected Top n intention labels are the n types of intention texts selected in the step S71 in the embodiment. And if the difference value between the confidence coefficient of the intention text Max with the maximum confidence coefficient and the confidence coefficient of the intention text Submax with the second maximum confidence coefficient is larger than or equal to the preset value t, outputting the intention text corresponding to the maximum confidence coefficient as an intention recognition result. Otherwise, determining the common continuous character length of each intention text and the text to be recognized, and if the intention text corresponding to the maximum value of the common continuous character lengths is unique, outputting the intention text with the maximum common continuous character length as an intention recognition result. Otherwise, determining the number of common characters of each intention text and the text to be recognized, if the intention text corresponding to the maximum value of the number of common characters is unique, outputting the intention text with the maximum number of common characters as an intention recognition result, otherwise, determining the same characters included in the intention text as a first text, deleting the first text from each intention text to obtain a simplified intention text, 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 maximum similarity as the intention recognition result.
The scheme provided by the embodiment of the application screens the intention text output by the intention recognition model based on the rule, and the model optimization is carried out in a mode of updating the sample set, so that the accuracy rate of the intention recognition can be effectively improved.
In the aspect of model optimization, the Top n index of the model is optimized by improving the quality and quantity of the labeled data, so that the quality of the labeled data and the Top n index of the model reach a certain effect (Pn is more than or equal to m%), and the accuracy of the intention identification result output in the subsequent step can be effectively improved.
In the step of determining the intention identification result based on the rule, the problem of false identification of similar labels is solved by adopting a mode of model + rule, and the accuracy of intention identification is improved. According to the scheme, a plurality of implementation logics and corresponding judgment conditions are applied, the optimal intention label matched with the text to be recognized can be effectively selected, and the accuracy of the subsequently output intention recognition result is improved.
In addition, the scheme provided by the invention can be widely applied to various tasks and application scenes through fine adjustment, and other schemes can be embedded into implementation logic, so that the method has good mobility, universality and expandability.
For example, the fine-tuning may include adjusting the number of the selected first intention texts. The more the number of the selected first intention texts is, the larger the calculation amount is, and if the method is applied to an application scene with poor processing equipment performance, the overall calculation 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 to carry out the 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 identification 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 the first intention text is selected, the selection is performed based on the length of each intention text. Generally, the shorter the length of the intention text, the larger the range of intentions it describes. For example, the intent range described by "password" includes "forget password", "password lost", "password error", "password cannot be input", and the like. It follows that longer intent text can describe more specific intent. In the scheme, in order to improve the accuracy of the intention recognition result, in the step of selecting the first intention text, N first intention texts with the text length larger than the preset intention text length may be selected. This makes it possible to make the finally determined intention recognition result an intention text having a long text length, and to narrow the ideographic range of the finally determined intention recognition result, making the recognition result more accurate.
The scheme provided by the invention can improve the quality of the intention recognition model, solve the problem of false recognition 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 requirement on configuration resources, and particularly have the function of identifying the related intentions in a big data scene. The scheme can realize the update iteration of the related field intention recognition task at low cost. Moreover, the scheme provided by the scheme has the advantages of simplicity and easiness in understanding, and is convenient for service 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 identifying apparatus 100, as shown in fig. 10, including:
the acquiring module 101 acquires an intention text set corresponding to a text to be recognized, where the intention text set includes 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, wherein N is a positive integer greater than or equal to 2, and the confidence degrees of the selected N first intention texts are greater than the confidence degrees of the unselected intention texts;
a first determining module 103, configured to determine a second intention text set if at least two of the first intention texts include the same first text, where the second intention text set is an intention text after the first text is deleted 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 multiple types of intention texts and the corresponding confidence degrees are obtained, the 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. Then, the difference among the N first intention texts is expanded in a mode of deleting the first texts which are common in the first intention texts, and the first intention texts are simplified into the second intention texts. And then, the similarity comparison is carried out on the second intention text and the text to be detected, the optimal intention recognition result can be selected from the N first intention texts, the output intention recognition result is effectively optimized, and the accuracy of the intention recognition result is improved.
The modules in the device provided by the embodiment of the present application may also implement the method steps provided by the above method embodiment. Alternatively, the apparatus provided in the embodiment of the present application may further include other modules besides the modules described above, so as to implement the method steps provided in the foregoing method embodiment. The device provided by the embodiment of the application can achieve the technical effects achieved by the method embodiment.
Preferably, an embodiment of the present invention further provides an electronic device, which includes 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-mentioned embodiment of the intent recognition method, and can achieve the same technical effect, and details are not repeated here to avoid repetition.
The embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements each process of the embodiment of the intent recognition method, and can achieve the same technical effect, and in order to avoid repetition, the detailed description is omitted here. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
As will be appreciated by one skilled in the art, 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 flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams 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 a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
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 computer storage media 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 that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
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 an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, 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 above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should 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 recognized, 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 the 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 obtained after the first text is deleted from 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.
2. The method of claim 1, wherein determining the 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 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 multi-dimensional text features 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 the multi-dimensional text features of the text to be recognized;
according to the distance between the second intention vector corresponding to each intention text and the text vector to be recognized, obtaining the similarity between each intention text and the text to be recognized;
and determining the first intention text corresponding to the second intention text with the highest similarity as the intention recognition result of the text to be recognized.
3. The method of claim 1 or 2, after obtaining the intention text set corresponding to the text to be recognized, further comprising:
determining a maximum confidence value and a second maximum confidence value according to the confidence corresponding to each intention text;
and if the difference value between the maximum confidence coefficient value and the second maximum confidence coefficient value is greater than a preset value, determining the intention text corresponding to the maximum confidence coefficient value as the intention recognition result of the text to be recognized.
4. The method of claim 1 or 2, wherein after said selecting N first intention texts, further comprising:
determining the lengths of N common maximum continuous characters of 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 a first intention text corresponding to the maximum common maximum continuous character length as an intention recognition result of the text to be recognized.
5. The method of claim 1 or 2, wherein after selecting the N first intention texts, further comprising:
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 maximum number as an intention recognition result of the text to be recognized.
6. The method according to claim 1 or 2, wherein the obtaining of the intention text set corresponding to the text to be recognized comprises:
inputting the text to be recognized into a trained intention recognition model to obtain multiple types of intention texts and corresponding confidence degrees of 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 the trained intent recognition model results in multiple types of intent texts and respective corresponding confidences of the multiple types of intent texts, resulting in the set of intent texts, including;
and selecting n types of intention texts in the multiple types of intention texts and the confidence degrees corresponding to the n types of intention texts to obtain the intention text set, wherein n is a positive integer.
8. An intention recognition apparatus, comprising:
the system comprises an acquisition module, a recognition module and a recognition module, wherein the acquisition module acquires an intention text set corresponding to a text to be recognized, and 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;
a first determining module, configured to determine a second intention text set if at least two of the first intention texts include the same first text, where the second intention text set is an intention text after the first text is deleted from the N first intention texts;
and the second determining module is used for determining the 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.
9. An electronic device, comprising: memory, processor and computer program stored on the memory and executable on the processor, which computer program, when executed by the processor, carries out the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
CN202111509161.XA 2021-12-10 2021-12-10 Intention identification method and device Pending CN114254622A (en)

Priority Applications (1)

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

Applications Claiming Priority (1)

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

Publications (1)

Publication Number Publication Date
CN114254622A true CN114254622A (en) 2022-03-29

Family

ID=80794766

Family Applications (1)

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

Country Status (1)

Country Link
CN (1) CN114254622A (en)

Cited By (1)

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

Cited By (2)

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

Similar Documents

Publication Publication Date Title
CN112084337B (en) Training method of text classification model, text classification method and equipment
CN110413780B (en) Text emotion analysis method and electronic equipment
CN108304468B (en) Text classification method and text classification device
US20230039496A1 (en) Question-and-answer processing method, electronic device and computer readable medium
CN112732871B (en) Multi-label classification method for acquiring client intention labels through robot induction
CN116089873A (en) Model training method, data classification and classification method, device, equipment and medium
CN114416979A (en) Text query method, text query equipment and storage medium
CN114997288A (en) Design resource association method
CN115544303A (en) Method, apparatus, device and medium for determining label of video
CN114282513A (en) Text semantic similarity matching method and system, intelligent terminal and storage medium
CN116522912B (en) Training method, device, medium and equipment for package design language model
CN114254622A (en) Intention identification method and device
CN116861269A (en) Multi-source heterogeneous data fusion and analysis method in engineering field
CN115660695A (en) Customer service personnel label portrait construction method and device, electronic equipment and storage medium
CN115203206A (en) Data content searching method and device, computer equipment and readable storage medium
CN112749530B (en) Text encoding method, apparatus, device and computer readable storage medium
CN114398482A (en) Dictionary construction method and device, electronic equipment and storage medium
AU2019290658B2 (en) Systems and methods for identifying and linking events in structured proceedings
CN114036289A (en) Intention identification method, device, equipment and medium
KR102215259B1 (en) Method of analyzing relationships of words or documents by subject and device implementing the same
CN113673237A (en) Model training method, intent recognition method, device, electronic equipment and storage medium
CN114239555A (en) Training method of keyword extraction model and related device
CN112579774A (en) Model training method, model training device and terminal equipment
US11934794B1 (en) Systems and methods for algorithmically orchestrating conversational dialogue transitions within an automated conversational system
CN112308453B (en) Risk identification model training method, user risk identification method and related devices

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