Intent recognition method, device, storage medium and program product
By introducing an intention recognition method in intelligent customer service, using a preset model to determine whether the single sentence entered by the user has a dependency with the above, the problems of high operational costs and difficult semantic understanding in the existing technology are solved, and more efficient and accurate intention recognition is achieved, and user experience is improved.
Patent Information
- Application Number
- CN202110510666.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-11
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2041-05-11
AI Technical Summary
When the prior art is used to identify intentions in intelligent customer service, it is necessary to combine the user's above information, resulting in a large amount of labeled data required for model training, which is costly to be high, and it is difficult to understand the semantics of long context sentences, especially the single sentences entered by the user may have omitted or sentence-breaking.
A method of intention recognition is provided. By receiving the single sentence to be identified input by the user, the first preset model is used to obtain the predicted intention and confidence. If the confidence is not high, the second preset model is used to determine whether the single sentence has a dependency with the previous single sentence. If there is, the final intention is determined based on the intention of the previous single sentence, and if there is no, the final intention is determined by interacting with the user.
Reduces maintenance and operational costs for intent identification, improves the accuracy of the final intent, and improves the user experience.
Smart Images

Figure CN113240438B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of computer technology, and in particular, to an intent recognition method, device, storage medium, and program product. Background Art
[0002] In scenarios such as intelligent customer service, it is necessary to identify the intent of the questions input by the user, and the intelligent customer service will then perform corresponding processing based on the identified intent to solve the user's problem.
[0003] Since the questions input by users in each round are usually single sentences, the prior art usually needs to combine the user's previous information and adopt a text classification model for intent recognition. However, for the text classification model that combines the user's previous information for intent recognition, a large amount of labeled data is required during the model training process, and the scale of subsequent data cleaning is large, which is not conducive to maintenance and has high operating costs. In addition, in combining the user's previous information for intent recognition, it is difficult to understand the semantics of long sentences in the context, especially since the single sentences input by the user in each round are not complete, and there may be omissions or breaks, which increases the difficulty of intent recognition. Summary of the invention
[0004] The embodiments of the present invention provide a method, device, storage medium and program product for intent recognition. When identifying intent, it is not necessary to combine each single sentence with the previous context, thereby reducing the maintenance and operation costs of intent recognition.
[0005] In a first aspect, an embodiment of the present invention provides an intention recognition method, including:
[0006] Receive a single sentence to be recognized input by a user;
[0007] According to the single sentence to be identified and the first preset model, obtaining the predicted intent and the corresponding confidence of the single sentence to be identified;
[0008] If the confidence level is not higher than the first preset threshold, judging whether the sentence to be identified has a dependency relationship with the previous sentence according to the sentence to be identified and the second preset model;
[0009] If it is determined that the sentence to be identified has a dependency relationship with the previous sentence, the final intention of the sentence to be identified is determined according to the intention of the previous sentence; or
[0010] If it is determined that the single sentence to be identified has no dependency relationship with the previous context, the final intention of the single sentence to be identified is determined by interacting with the user.
[0011] In a second aspect, an embodiment of the present invention provides an intention recognition device, including:
[0012] A receiving unit, used for receiving a sentence to be recognized input by a user;
[0013] An intention recognition unit, used for obtaining the predicted intention and corresponding confidence of the single sentence to be recognized according to the single sentence to be recognized and the first preset model;
[0014] A dependency relationship identification unit, configured to determine whether the single sentence to be identified has a dependency relationship with a previous single sentence based on the single sentence to be identified and a second preset model if the confidence level is not higher than a first preset threshold;
[0015] A processing unit is used to determine the final intention of the sentence to be identified based on the intention of the previous sentence if it is determined that the sentence to be identified has a dependency relationship with the previous context; or, if it is determined that the sentence to be identified has no dependency relationship with the previous context, determine the final intention of the sentence to be identified by interacting with the user.
[0016] In a third aspect, an embodiment of the present invention provides an electronic device, including: at least one processor; and a memory;
[0017] The memory stores computer-executable instructions;
[0018] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method according to the first aspect.
[0019] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the method described in the first aspect is implemented.
[0020] In a fifth aspect, an embodiment of the present invention provides a computer program product, comprising computer instructions, which, when executed by a processor, implement the method described in the first aspect.
[0021] The intent recognition method, device, storage medium and program product provided in the embodiment of the present invention receive a single sentence to be recognized input by a user; obtain the predicted intent and corresponding confidence of the single sentence to be recognized according to the single sentence to be recognized and the first preset model; if the confidence is not higher than the first preset threshold, determine whether the single sentence to be recognized has a dependency relationship with the previous single sentence according to the single sentence to be recognized and the second preset model; if it is determined that the single sentence to be recognized has a dependency relationship with the previous context, determine the final intent of the single sentence to be recognized according to the intent of the previous single sentence; or, if it is determined that the single sentence to be recognized has no dependency relationship with the previous context, determine the final intent of the single sentence to be recognized by interacting with the user. In the embodiment of the present invention, the first preset model only needs to perform intent recognition of a single sentence, and does not need to perform intent recognition of a long sentence in the context, which reduces maintenance and operating costs. The second model is used to determine whether it depends on the previous context, which can effectively improve the accuracy of the final determined intent and enhance user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0023] Figure 1 An application scenario diagram of the intent recognition method provided by an embodiment of the present invention;
[0024] Figure 2 A flowchart of an intention recognition method provided by an embodiment of the present invention;
[0025] Figure 3 A schematic diagram of a first preset model of an intention recognition method provided by an embodiment of the present invention;
[0026] Figure 4 A flowchart of an intention recognition method provided by another embodiment of the present invention;
[0027] Figure 5 A structural diagram of an intention recognition device provided by an embodiment of the present invention;
[0028] Figure 6 A structural diagram of an electronic device provided by an embodiment of the present invention.
[0029] The above drawings show clear embodiments of the present disclosure, which will be described in more detail below. These drawings and text descriptions are not intended to limit the scope of the present disclosure in any way, but to illustrate the concepts of the present disclosure to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0030] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0031] In scenarios such as intelligent customer service, it is necessary to identify the intent of the questions input by the user, and the intelligent customer service will then perform corresponding processing based on the identified intent to solve the user's problem.
[0032] Since the questions input by users in each round are usually single sentences, the prior art usually needs to combine the user's previous context information and use a text classification model to identify the intent. That is, when identifying the single sentence input in the current round, the previous context information, i.e. the single sentence input in the previous round or several rounds and the current single sentence, need to be input into the text classification model.
[0033] However, for the text classification model that combines the user's previous context to identify the intent, a large amount of labeled data is required during the model training process, especially for a single sentence with the same intent, the previous context may be different. In order to accurately determine the same intent for the single sentence with the intent when combining the previous context in different situations, it is necessary to prepare a variety of different previous contexts for the single sentence with the intent as training data, so as to accurately train the text classification model; and, since the amount of training data is relatively large, there may be some inaccurate training data, and the scale of subsequent data cleaning is large, which is not conducive to maintenance and has high operating costs; and, in combining the user's previous context information for intent identification, it is difficult to understand the semantics of long sentences in the context, especially since the user's input of single sentences in each round is not complete, and there may be omissions or breaks, and the text classification model cannot accurately obtain the intent recognition result, which increases the difficulty of intent recognition.
[0034] In response to the above technical problems, in an embodiment of the present invention, after receiving a single sentence to be identified input by a user, the predicted intent and the corresponding confidence of the single sentence to be identified can be obtained through a first preset model. If the confidence is higher than the first preset threshold, the predicted intent can be directly used as the final intent of the single sentence to be identified; if the confidence is not higher than the first preset threshold, the second preset model is used to determine whether the single sentence to be identified has a dependency relationship with the previous sentence. Further, if it is determined that the single sentence to be identified has a dependency relationship with the previous sentence, the final intent of the single sentence to be identified is determined according to the intent of the previous sentence; if it is determined that the single sentence to be identified has no dependency relationship with the previous context, the final intent of the single sentence to be identified is determined by interacting with the user. In an embodiment of the present invention, the first preset model only needs to perform intent recognition of a single sentence, and does not need to perform intent recognition of a long sentence in the context, which reduces maintenance and operating costs. The second model is used to determine whether it depends on the previous context, which can effectively improve the accuracy of the final determined intent.
[0035] The specific application scenarios of the embodiments of the present invention are as follows Figure 1 As shown, it includes a user terminal 101 and a server 102. The user terminal 101 can send a question in the form of a single sentence to the server, and the server 102 receives the single sentence to be identified input by the user; according to the single sentence to be identified and the first preset model, the predicted intention and the corresponding confidence of the single sentence to be identified are obtained; it is determined whether the confidence is higher than the first preset threshold. If the confidence is higher than the first preset threshold, the predicted intention can be directly used as the final intention of the single sentence to be identified; if the confidence is not higher than the first preset threshold, it is determined whether the single sentence to be identified has a dependency relationship with the previous single sentence according to the single sentence to be identified and the second preset model; if it is determined that the single sentence to be identified has a dependency relationship with the previous text, the final intention of the single sentence to be identified is determined according to the intention of the previous single sentence; or, if it is determined that the single sentence to be identified has no dependency relationship with the previous text, the final intention of the single sentence to be identified is determined by interacting with the user. Further, the server 102 can also send a response message to the user terminal 101 according to the final intention of the single sentence to be identified.
[0036] The following specific embodiments are used to describe in detail the technical solutions of the present invention and how the technical solutions of the present application solve the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present invention will be described below in conjunction with the accompanying drawings.
[0037] Figure 2 This is a flow chart of the intention recognition method provided by an embodiment of the present invention. This embodiment provides an intention recognition method, the execution subject of which can be any electronic device such as a server or an intelligent robot. The specific steps of the intention recognition method are as follows:
[0038] S201: receiving a sentence to be recognized input by a user.
[0039] In this embodiment, in some application scenarios, the user can input a single sentence to be recognized on a terminal such as a mobile phone or tablet computer, and the terminal sends it to the server. For example, in the scenario where the user of an e-commerce platform interacts with the intelligent customer service, the user can send questions and other content to the intelligent customer service in the server, where the question input by the user is usually expressed as a single sentence. In other application scenarios, it can also be a process of interaction between a user and an intelligent robot, such as voice interaction. The intelligent robot can collect the voice of the user's question and convert it into a single sentence to be recognized. Of course, the embodiment of the present invention can also be applied to other application scenarios, and the user can then take the corresponding method to input the single sentence to be recognized, which will not be repeated here.
[0040] S202: According to the single sentence to be identified and a first preset model, obtain the predicted intent and corresponding confidence level of the single sentence to be identified.
[0041] In this embodiment, the first preset model may be any model that can realize single sentence intention recognition. By inputting the single sentence to be recognized into the first preset model, the predicted intention of the single sentence to be recognized and the corresponding confidence level are output.
[0042] In an optional embodiment, the first preset model is a BERT model encoder (Bidirectional Encoder Representation from Transformers). The BERT model encoder automatically segmentes the text input, initializes the model parameters, and then predicts the downstream classification task (i.e., single sentence intent classification). Figure 3 As shown in the figure, after the user inputs a single sentence to be recognized, it enters the BERT encoder, performs word segmentation on the sentence to be recognized, obtains the token-id of each word, and inputs it into the BERT encoder network layer. E represents the embedding representation of the word. After multiple layers of Transformer transformation, the final sentence representation T[CLS] is obtained, which can be directly used for text classification to obtain the intent category of the sentence to be recognized. Among them, the BERT encoder uses the word segmentation tool to perform word segmentation and inserts special separators ([CLS], used to separate samples) and separators ([SEP], used to separate different sentences in the sample).
[0043] The BERT model in this embodiment is a pretrained model. Compared with other language models, such as machine learning-based methods, such as Naive Bayes and support vector machines, or neural network-based methods, such as Text-CNN (text convolutional neural network), HAN (Hierarchical Attention Network, hierarchical attention mechanism network), etc., most of them require random initialization of network parameters and then training through the back propagation algorithm, while the pretrained model no longer needs to randomly initialize the parameters of the model. By designing specific tasks, the general network model parameters can be learned using massive unlabeled corpus data. Then, for downstream tasks, this set of parameters is directly used to initialize the model, thereby speeding up the training of the model and improving the effect of downstream tasks. The training of the first preset model can be implemented on the server, and can also be deployed on the server after training on other devices.
[0044] Of course, it should be noted that any other model that can realize single sentence intent recognition can also be used in this embodiment, which will not be described one by one here.
[0045] S203: If the confidence level is not higher than a first preset threshold, judging whether the sentence to be identified has a dependency relationship with a previous sentence based on the sentence to be identified and a second preset model.
[0046] In this embodiment, if the confidence level is high, for example, higher than the first preset threshold, the predicted intention of the sentence to be identified can be directly determined as the final intention of the sentence to be identified, and the intention identification method can be terminated; if the confidence level is not higher than the first preset threshold, the sentence to be identified is input into the second preset model to determine whether the sentence to be identified has a dependency relationship with the previous sentence.
[0047] Among them, the second preset model can be used to determine whether the sentence to be identified has a dependency relationship with the previous sentence, that is, to determine whether the sentence to be identified is dependent on the previous sentence.
[0048] In an optional embodiment, the second preset model is a binary classification model, that is, the input is a single sentence to be recognized, and the output is a judgment result of whether it depends on the previous context. For example, if it is determined that the single sentence to be recognized has a dependency relationship with the previous context, "1" can be output, and if it is determined that the single sentence to be recognized has no dependency relationship with the previous context, "0" can be output. Optionally, the second preset model can also be a BERT model encoder.
[0049] Furthermore, the second preset model can be trained through the following process:
[0050] Acquire positive samples and negative samples, and train the initial model of the binary classification model according to the positive samples and the negative samples to obtain the trained second preset model;
[0051] Among them, the positive sample includes a single sentence whose confidence is not higher than the second preset threshold when the predicted intent is obtained through the first preset model, and the final intent can be determined according to the intent of the previous single sentence; the negative sample includes a single sentence whose confidence is higher than the second preset threshold when the predicted intent is obtained through the first preset model, and / or, a single sentence whose confidence is not higher than the second preset threshold when the predicted intent is obtained through the first preset model, and the final intent cannot be determined according to the intent of the previous single sentence. The above positive samples and negative samples are used as training data for the second preset model to perform model training, and the specific training process is not repeated here.
[0052] The training of the second preset model can be implemented on the server, and can also be deployed on the server after training on other devices.
[0053] In other embodiments, the second preset model may also be used to determine whether the single sentence to be identified has a dependency relationship with the previous multiple single sentences, which can be achieved by training the second preset model.
[0054] On the basis of the above embodiment, if it is determined that the single sentence to be recognized has a dependency relationship with the previous text, S204 is executed; if it is determined that the single sentence to be recognized has no dependency relationship with the previous text, S205 is executed.
[0055] S204: If it is determined that the sentence to be identified has a dependency relationship with the previous sentence, the final intent of the sentence to be identified is determined according to the intent of the previous sentence.
[0056] In this embodiment, if it is determined that the sentence to be identified has a dependency relationship with the previous text, it means that the predicted intention of the sentence to be identified may have a certain inaccuracy, and the final intention of the sentence to be identified can be determined in combination with the intention of the previous sentence.
[0057] In an optional embodiment, the intention of the previous sentence may be directly determined as the final intention of the sentence to be recognized, so that the sentence to be recognized inherits the intention of the previous sentence.
[0058] In other optional embodiments, the previous sentence and the current sentence may be fused and re-input into the first preset model to obtain the predicted intent as the intent of the sentence to be identified.
[0059] Alternatively, the final intention of the sentence to be identified may be determined according to the intention of the previous sentence through any other means, which will not be described in detail here.
[0060] S205: If it is determined that the sentence to be identified has no dependency relationship with the previous text, the final intention of the sentence to be identified is determined by interacting with the user.
[0061] In this embodiment, if it is determined that there is no dependency relationship between the sentence to be identified and the previous text, including that the sentence to be identified has no association with the previous text, or the intention of the previous sentence is unreliable (that is, the intention of the previous sentence is higher than the first preset threshold), the final intention of the sentence to be identified can be further determined by interacting with the user in this embodiment. For example, the alternative intentions of the sentence to be identified can be determined based on the intentions of a predetermined number of previous sentences and displayed to the user; after receiving the user's selection instruction for any alternative intention, the final intention of the sentence to be identified is determined according to the selection instruction; or, an information supplement request is sent to the user; after receiving the supplementary information input by the user, the final intention of the sentence to be identified is determined based on the sentence to be identified and the supplementary information.
[0062] Of course, the method of determining the final intention is not limited to the optional embodiments listed above, and other possible methods are also possible.
[0063] On the basis of the above embodiment, after determining the final intention of the single sentence to be identified, a response message can also be sent to the user according to the final intention of the single sentence to be identified. For example, in the scenario where the user of the e-commerce platform interacts with the intelligent customer service, the intelligent customer service can send a response message to the user; in the process of voice interaction between the user and the intelligent robot, the intelligent robot can play the response message through voice or display the response message on the screen.
[0064] The graph recognition method provided in this embodiment receives a single sentence to be recognized input by a user; obtains the predicted intent and corresponding confidence of the single sentence to be recognized according to the single sentence to be recognized and the first preset model; if the confidence is not higher than the first preset threshold, determines whether the single sentence to be recognized has a dependency relationship with the previous single sentence according to the single sentence to be recognized and the second preset model; if it is determined that the single sentence to be recognized has a dependency relationship with the previous context, determines the final intent of the single sentence to be recognized according to the intent of the previous single sentence; or, if it is determined that the single sentence to be recognized has no dependency relationship with the previous context, determines the final intent of the single sentence to be recognized by interacting with the user. In the embodiment of the present invention, the first preset model only needs to perform intent recognition of a single sentence, and does not need to perform intent recognition of a long sentence in the context, which reduces maintenance and operating costs. The second model is used to determine whether it depends on the previous context, which can effectively improve the accuracy of the final determined intent and enhance the user experience.
[0065] Based on any of the above embodiments, after obtaining the predicted intent of the single sentence to be identified and the corresponding confidence level in S202, the method may further include:
[0066] If the confidence level is higher than a first preset threshold and the sentence to be identified is not an omitted sentence or a broken sentence, the predicted intent of the sentence to be identified is determined as the final intent of the sentence to be identified.
[0067] In this embodiment, for some elliptical sentences or punctuation sentences, there may only be some noun phrases, etc. For some elliptical sentences or punctuation sentences, a predicted intention may be obtained through the first preset model, and the confidence is higher than the first preset threshold, but in fact, the intentions of these elliptical sentences or punctuation sentences may not be complete, and the preset intention obtained by the first preset model is not accurate, so these elliptical sentences and punctuation sentences can be screened out. In addition to these elliptical sentences and punctuation sentences, if the confidence obtained by the first preset model is higher than the first preset threshold, and the single sentence to be identified does not belong to an elliptical sentence or punctuation sentence, it means that in the case of not being an elliptical sentence or punctuation sentence, the predicted intention of the single sentence to be identified obtained by the first preset model is relatively accurate, so the predicted intention of the single sentence to be identified obtained by the first preset model is determined as the final intention of the single sentence to be identified, and it is no longer necessary to judge whether the single sentence to be identified has a dependency relationship with the previous single sentence based on the single sentence to be identified and the second preset model.
[0068] In another optional embodiment, if Figure 4 As shown, if it is determined in S205 that the single sentence to be identified has no dependency relationship with the above context, then determining the final intention of the single sentence to be identified by interacting with the user may specifically include:
[0069] S401, determining the candidate intentions of the single sentence to be identified according to the intentions of a predetermined number of previous single sentences, and displaying them to the user;
[0070] S402: After receiving a selection instruction from the user for any candidate intention, determine the final intention of the single sentence to be identified according to the selection instruction.
[0071] In this embodiment, when it is determined by the second preset model that the single sentence to be identified does not have a dependency relationship with the above text, a predicted intention may be obtained for some elliptical sentences or punctuation sentences through the first preset model, and the confidence is lower than the first preset threshold, so these elliptical sentences and punctuation sentences can be screened out. In the case of no dependency relationship with the above text, when the final intention of the single sentence to be identified is determined according to the predicted intention of the single sentence to be identified and the confidence, if the confidence is lower than the first preset threshold, and the single sentence to be identified does not belong to an elliptical sentence or punctuation sentence, it means that the predicted intention of the single sentence to be identified obtained by the first preset model is inaccurate when it is not an elliptical sentence or punctuation sentence. At this time, the final intention of the single sentence to be identified can be further determined by asking the user or supplementing the information by the user. In an optional embodiment, the intention of a predetermined number of the single sentences in the above text can be used to determine the alternative intention of the single sentence to be identified, and displayed to the user, and the user selects the final intention from the alternative intentions. Of course, if the alternative intention does not have the intention required by the user, the user can also enter a new single sentence again. After receiving the new single sentence input by the user, the method flow of the above embodiment can be re-executed.
[0072] In other optional embodiments, an information supplement request may be sent to the user, for example, some preset corpus may be sent to the user to prompt the user to supplement information, such as "what does this sentence mean", "please re-enter", "what do you need to consult", etc. After receiving the supplementary information input by the user, the final intention of the sentence to be identified is determined according to the sentence to be identified and the supplementary information.
[0073] Based on any of the above embodiments, the method may further include:
[0074] If the sentence to be identified is an elliptical sentence, an information supplement request is sent to the user, and after receiving the supplementary information input by the user, the final intention of the sentence to be identified is determined according to the sentence to be identified and the supplementary information.
[0075] In this embodiment, it is possible to identify whether a sentence to be identified is an elliptical sentence. Optionally, it can be judged by a preset corpus, which may include various possible elliptical sentences or elliptical sentence rules, etc., and finally determine whether the sentence to be identified is an elliptical sentence through matching. Of course, it is also possible to determine whether the sentence to be identified is an elliptical sentence through some models, which will not be elaborated here. When it is determined that the sentence to be identified is an elliptical sentence, an information supplement request may be sent to the user, for example, some preset corpus may be sent to the user to prompt the user to supplement the information. For example, if the sentence to be identified input by the user is "invoice", a message such as "Hello, what question do you need to ask about the invoice" may be sent to the user to request the user to supplement the information. For another example, if the sentence to be identified input by the user is "the invoice was issued incorrectly", a message such as "Hello, what information on the invoice is issued incorrectly" may be sent to the user to request the user to supplement the information, and so on. The user may enter supplementary information, for example, supplement new information for the elliptical sentence, or enter a new sentence. After receiving the supplementary information entered by the user, the final intention of the sentence to be identified may be determined based on the sentence to be identified and the supplementary information, or the method flow of the above embodiment may be directly re-executed based on the new sentence input by the user to determine the user's intention.
[0076] Based on any of the above embodiments, the method may further include:
[0077] If the sentence to be identified is a fragmented sentence, wait for a predetermined time or send an information supplement request to the user, and after receiving the supplementary information input by the user, determine the final intention of the sentence to be identified according to the sentence to be identified and the supplementary information.
[0078] On the basis of the above embodiment, it is possible to identify whether the single sentence to be identified belongs to a segmentation. Optionally, it can be judged by a preset corpus, which may include various possible segmentations or segmentation rules, etc., and finally determine whether the single sentence to be identified belongs to a segmentation by matching. Of course, it is also possible to determine whether the single sentence to be identified belongs to a segmentation by some models, which will not be repeated here. When it is determined that the single sentence to be identified belongs to a segmentation, the user may split a sentence into multiple segments, and the current segmentation may be a part of it, so it is possible to wait for a predetermined time. If the user enters supplementary information, the final intention of the single sentence to be identified is determined according to the segmentation and the subsequent supplementary information. For example, the segmentation and the subsequent supplementary information are merged into a sentence and then the method flow in the above embodiment is executed; or an information supplement request can be sent to the user, such as sending some preset corpora to the user to prompt the user to supplement information, such as "what does this sentence mean", "please re-enter", etc. The user can enter the supplementary information; in addition, if the supplementary information entered by the user is not received after waiting for a predetermined time, an information supplement request can also be sent to the user.
[0079] Through the above embodiments, specific processing can be performed on phenomena such as elliptical sentences and punctuation, so as to better obtain user intentions and improve user experience.
[0080] Figure 5 The structure diagram of the intention recognition device provided by the embodiment of the present invention. The intention recognition device provided by this embodiment can execute the processing flow provided by the method embodiment, such as Figure 5 As shown, the intention recognition device 500 includes a receiving unit 501, an intention recognition unit 502, a dependency recognition unit 503, and a processing unit 504.
[0081] The receiving unit 501 is used to receive a sentence to be recognized input by a user;
[0082] The intention recognition unit 502 is used to obtain the predicted intention and the corresponding confidence of the single sentence to be recognized according to the single sentence to be recognized and the first preset model;
[0083] A dependency identification unit 503, configured to determine whether the sentence to be identified has a dependency relationship with a previous sentence according to the sentence to be identified and a second preset model if the confidence level is not higher than a first preset threshold;
[0084] Processing unit 504 is used to determine the final intention of the sentence to be identified based on the intention of the previous sentence if it is determined that the sentence to be identified has a dependency relationship with the previous context; or, if it is determined that the sentence to be identified has no dependency relationship with the previous context, determine the final intention of the sentence to be identified by interacting with the user.
[0085] Based on any of the above embodiments, when determining the final intention of the sentence to be identified according to the intention of the previous sentence, the processing unit 504 is configured to:
[0086] If the confidence level corresponding to the previous sentence is higher than the first preset threshold, the intention of the previous sentence is determined as the final intention of the sentence to be identified.
[0087] Based on any of the above embodiments, when determining the final intention of the to-be-identified single sentence through interaction with the user, the processing unit 504 is configured to:
[0088] Determine the candidate intentions of the sentence to be identified based on the intentions of a predetermined number of previous sentences, and present them to the user; after receiving a selection instruction from the user for any of the candidate intentions, determine the final intention of the sentence to be identified based on the selection instruction; or
[0089] Sending an information supplement request to the user; after receiving the supplement information input by the user, determining the final intention of the sentence to be identified according to the sentence to be identified and the supplement information.
[0090] Based on any of the above embodiments, when determining the final intention of the single sentence to be identified according to the predicted intention of the single sentence to be identified and the confidence, the processing unit 504 is used to:
[0091] If the confidence level is higher than a first preset threshold and the sentence to be identified is not an omitted sentence or a broken sentence, the predicted intent of the sentence to be identified is determined as the final intent of the sentence to be identified.
[0092] Based on any of the above embodiments, the processing unit 504 is further configured to:
[0093] If the sentence to be identified is an elliptical sentence, sending an information supplement request to the user, and after receiving the supplementary information input by the user, determining the final intention of the sentence to be identified according to the sentence to be identified and the supplementary information; or
[0094] If the sentence to be identified is a fragmented sentence, wait for a predetermined time or send an information supplement request to the user, and after receiving the supplementary information input by the user, determine the final intention of the sentence to be identified according to the sentence to be identified and the supplementary information.
[0095] Based on any of the above embodiments, the first preset model is a BERT model encoder.
[0096] Based on any of the above embodiments, the second preset model is a binary classification model; the second preset model is trained by the following process:
[0097] Get positive and negative samples.
[0098] According to the positive sample and the negative sample, the initial model of the binary classification model is trained to obtain the second preset model after training;
[0099] Among them, the positive example samples include single sentences whose confidence level is not higher than the second preset threshold when the predicted intent is obtained through the first preset model, and the final intent can be determined according to the intent of the previous sentence; the negative example samples include single sentences whose confidence level is higher than the second preset threshold when the predicted intent is obtained through the first preset model, and / or single sentences whose confidence level is not higher than the second preset threshold when the predicted intent is obtained through the first preset model, and the final intent cannot be determined according to the intent of the previous sentence.
[0100] Based on any of the above embodiments, the second preset model is a BERT model encoder.
[0101] On the basis of any of the above embodiments, after the processing unit 504 determines the final intention of the single sentence to be identified, it is further configured to:
[0102] According to the final intention of the single sentence to be identified, a response message is sent to the user.
[0103] The intention recognition device provided in this embodiment can be specifically used to perform the above Figure 2 Or the method embodiment provided in 4, the specific functions are not repeated here.
[0104] The intention recognition device provided in this embodiment receives a single sentence to be recognized input by a user; obtains the predicted intention and corresponding confidence of the single sentence to be recognized according to the single sentence to be recognized and the first preset model; if the confidence is not higher than the first preset threshold, determines whether the single sentence to be recognized has a dependency relationship with the previous single sentence according to the single sentence to be recognized and the second preset model; if it is determined that the single sentence to be recognized has a dependency relationship with the previous context, determines the final intention of the single sentence to be recognized according to the intention of the previous single sentence; or, if it is determined that the single sentence to be recognized has no dependency relationship with the previous context, determines the final intention of the single sentence to be recognized by interacting with the user. In the embodiment of the present invention, the first preset model only needs to perform intention recognition of a single sentence, and does not need to perform intention recognition of a long sentence in the context, which reduces maintenance and operating costs. The second model is used to determine whether it depends on the previous context, which can effectively improve the accuracy of the final determined intention and enhance the user experience.
[0105] Figure 6 The electronic device provided by the embodiment of the present invention can execute the processing flow provided by the embodiment of the intention recognition method, such as Figure 6 As shown, the electronic device 60 includes a memory 61, a processor 62, and a computer program; wherein the computer program is stored in the memory 61 and is configured so that the processor 62 executes the intention recognition method described in the above embodiment. In addition, the electronic device 60 may also have a communication interface 63, which may be used to transmit instructions and / or data.
[0106] Figure 6 The electronic device of the illustrated embodiment can be used to execute the technical solution of the above-mentioned intention recognition method embodiment, and its implementation principle and technical effects are similar and will not be repeated here.
[0107] In addition, this embodiment further provides a computer-readable storage medium on which a computer program is stored, wherein the computer program is executed by a processor to implement the intention recognition method described in the above embodiment.
[0108] In the several embodiments provided in the embodiments of the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0109] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0110] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0111] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.
[0112] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example for illustration. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0113] The above embodiments are only used to illustrate the technical solutions of the embodiments of the present invention, rather than to limit them. Although the embodiments of the present invention are described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention.
[0114] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be regarded as exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0115] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for intention recognition, characterized in that: include: Receive a single sentence to be recognized input by a user; According to the single sentence to be identified and the first preset model, obtaining the predicted intent and the corresponding confidence of the single sentence to be identified; If the confidence level is not higher than the first preset threshold, judging whether the sentence to be identified has a dependency relationship with the previous sentence based on the sentence to be identified and the second preset model; wherein the second preset model is used to determine whether the sentence to be identified is dependent on the previous sentence; If it is determined that the sentence to be identified has a dependency relationship with the previous sentence, then determining the final intent of the sentence to be identified according to the intent of the previous sentence; If it is determined that the sentence to be identified has no dependency relationship with the previous sentence, then determine the alternative intentions of the sentence to be identified according to the intentions of a predetermined number of previous sentences, and display them to the user; after receiving a selection instruction from the user for any alternative intention, determine the final intention of the sentence to be identified according to the selection instruction; or, send an information supplement request to the user; after receiving the supplementary information input by the user, determine the final intention of the sentence to be identified according to the sentence to be identified and the supplementary information; If the confidence level is higher than a first preset threshold and the single sentence to be identified is not an omitted sentence or a broken sentence, the predicted intention of the single sentence to be identified is determined as the final intention of the single sentence to be identified; If the confidence level is higher than a first preset threshold value and the sentence to be identified is an elliptical sentence, an information supplement request is sent to the user, and after receiving the supplementary information input by the user, a final intention of the sentence to be identified is determined according to the sentence to be identified and the supplementary information; If the confidence level is higher than a first preset threshold value and the sentence to be identified is a fragmented sentence, then wait for a predetermined time or send an information supplement request to the user. After receiving the supplementary information input by the user, determine the final intention of the sentence to be identified based on the sentence to be identified and the supplementary information.
2. The method according to claim 1, characterized in that Determining the final intention of the sentence to be identified according to the intention of the previous sentence includes: If the confidence level corresponding to the previous sentence is higher than the first preset threshold, the intention of the previous sentence is determined as the final intention of the sentence to be identified.
3. The method according to any one of claims 1 to 2, characterized in that: The first preset model is a BERT model encoder.
4. The method according to any one of claims 1 to 2, characterized in that: The second preset model is a binary classification model; the second preset model is trained through the following process: Get positive and negative samples. According to the positive sample and the negative sample, the initial model of the binary classification model is trained to obtain the second preset model after training; Among them, the positive example samples include single sentences whose confidence level is not higher than the second preset threshold when the predicted intent is obtained through the first preset model, and the final intent can be determined according to the intent of the previous sentence; the negative example samples include single sentences whose confidence level is higher than the second preset threshold when the predicted intent is obtained through the first preset model, and / or single sentences whose confidence level is not higher than the second preset threshold when the predicted intent is obtained through the first preset model, and the final intent cannot be determined according to the intent of the previous sentence.
5. The method according to claim 4, characterized in that The second preset model is a BERT model encoder.
6. The method according to any one of claims 1-2, characterized in that: After determining the final intention of the sentence to be identified, the method further includes: According to the final intention of the single sentence to be identified, a response message is sent to the user.
7. An intention recognition device, characterized in that: include: A receiving unit, used for receiving a sentence to be recognized input by a user; An intention recognition unit, used for obtaining the predicted intention and corresponding confidence of the single sentence to be recognized according to the single sentence to be recognized and the first preset model; A dependency identification unit, configured to determine whether the sentence to be identified has a dependency relationship with a previous sentence based on the sentence to be identified and a second preset model if the confidence level is not higher than a first preset threshold; wherein the second preset model is used to determine whether the sentence to be identified is dependent on the previous sentence; A processing unit, configured to determine the final intention of the sentence to be identified according to the intention of the previous sentence if it is determined that the sentence to be identified has a dependency relationship with the previous sentence; and to determine the final intention of the sentence to be identified by interacting with the user if it is determined that the sentence to be identified has no dependency relationship with the previous sentence; The processing unit is further configured to determine the predicted intention of the sentence to be identified as the final intention of the sentence to be identified if it is determined that the confidence level is higher than a first preset threshold and the sentence to be identified is not an omitted sentence or a broken sentence; The processing unit is specifically used to determine the alternative intentions of the sentence to be identified according to the intentions of a predetermined number of previous sentences if it is determined that the sentence to be identified has no dependency relationship with the previous sentence, and display them to the user; after receiving a selection instruction from the user for any alternative intention, determine the final intention of the sentence to be identified according to the selection instruction; or send an information supplement request to the user; after receiving the supplementary information input by the user, determine the final intention of the sentence to be identified according to the sentence to be identified and the supplementary information; The processing unit is further configured to send an information supplement request to the user if the confidence level is higher than a first preset threshold and the single sentence to be identified is an elliptical sentence, and after receiving the supplementary information input by the user, determine the final intention of the single sentence to be identified according to the single sentence to be identified and the supplementary information; If the confidence level is higher than a first preset threshold value and the sentence to be identified is a fragmented sentence, then wait for a predetermined time or send an information supplement request to the user. After receiving the supplementary information input by the user, determine the final intention of the sentence to be identified based on the sentence to be identified and the supplementary information.
8. An electronic device, characterized in that: include: at least one processor; and memory; The memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the method according to any one of claims 1 to 6 is implemented.
10. A computer program product comprising computer instructions, characterized in that: When the computer instructions are executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
User intention recognition method, user instruction execution method and system and equipment
CN110517672A
Intention recognition method, device and equipment and storage medium
CN111737987A