CN117708266A - Intention recognition method, device, electronic equipment and storage medium - Google Patents

Intention recognition method, device, electronic equipment and storage medium Download PDF

Info

Publication number
CN117708266A
CN117708266A CN202211029991.7A CN202211029991A CN117708266A CN 117708266 A CN117708266 A CN 117708266A CN 202211029991 A CN202211029991 A CN 202211029991A CN 117708266 A CN117708266 A CN 117708266A
Authority
CN
China
Prior art keywords
intention
text
target
identified
recognition
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
CN202211029991.7A
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 Consumer Finance Co Ltd
Original Assignee
Mashang Consumer 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 Consumer Finance Co Ltd filed Critical Mashang Consumer Finance Co Ltd
Priority to CN202211029991.7A priority Critical patent/CN117708266A/en
Priority to PCT/CN2023/111242 priority patent/WO2024041350A1/en
Publication of CN117708266A publication Critical patent/CN117708266A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3344Query execution using natural language analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/35Clustering; Classification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/35Clustering; Classification
    • G06F16/353Clustering; Classification into predefined classes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting

Landscapes

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

Abstract

The embodiment of the specification provides an intention recognition method, an apparatus, an electronic device and a storage medium, wherein the intention recognition method comprises the following steps: acquiring a text to be identified; performing intention classification processing on the text to be identified to obtain intention types of the text to be identified; if the intention category is determined to be the appointed intention category, splicing the text to be identified and a preset template sentence to obtain a target text; the preset template sentences are used for representing intention prompt information; inputting the target text into an intention recognition model to obtain an intention recognition result of the text to be recognized; the intention recognition model is used for carrying out intention recognition processing on the text to be recognized based on the intention prompt information, so that the accuracy of intention recognition is improved.

Description

Intention recognition method, device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of artificial intelligence, and in particular, to an intent recognition method, apparatus, electronic device, and storage medium.
Background
With the development of electronic technology, robots are becoming more and more popular. For example, the automatic response of the customer problem is realized through the robot customer service, so that a large amount of manpower resources can be saved, and the communication efficiency is improved. However, before responding to the customer problem, the robot customer service needs to recognize the intention based on the text of the customer problem, and the purpose of the customer is clarified.
In practice, customer questions may relate to a wide variety of intent categories. For a part of customer questions with low appearance frequency and intention type, if the corresponding intention recognition model is trained by a labeling mode, the number requirement of model training on training samples is higher, the number of the customer questions can hardly reach the preset requirement, the recognition effect of the intention recognition model is extremely poor, the reply cow heads of the robot customer service do not have bad experience on the horse mouth, and the workload of the manual customer service is indirectly improved.
Disclosure of Invention
The embodiment of the application provides an intention recognition method, an intention recognition device, electronic equipment and a storage medium, so that the accuracy of intention recognition is improved.
In a first aspect, an embodiment of the present application provides an intent recognition method, including:
acquiring a text to be identified;
performing intention classification processing on the text to be identified to obtain the intention category of the text to be identified;
if the intention category is determined to be the appointed intention category, splicing the text to be identified and a preset template sentence to obtain a target text; the preset template statement is used for representing intention prompt information;
Inputting the target text into an intention recognition model to obtain an intention recognition result of the text to be recognized, wherein the intention recognition model is used for carrying out intention recognition processing on the text to be recognized based on the intention prompt information.
In a second aspect, an embodiment of the present application provides a training method for an intent recognition model, including:
acquiring an initial training text; the intention category of the initial training text is a designated intention category;
splicing the initial training text and a preset template sentence to obtain a target training text; the preset template statement is used for representing intention prompt information;
and inputting the target training text into an initial intention recognition model for iterative training to obtain the intention recognition model.
In a third aspect, an embodiment of the present application provides an intent recognition method applied to a digital person, including:
acquiring a text to be identified input by a user;
identifying the intention of the text to be identified according to the intention identification method in the first aspect, and obtaining the intention of the user;
and acquiring target text corresponding to the user intention in the digital person system according to the user intention, and displaying the target text.
In a fourth aspect, an embodiment of the present application provides an intent recognition device, including:
the first acquisition unit is used for acquiring the text to be identified;
the classifying unit is used for carrying out intention classifying treatment on the text to be recognized to obtain intention categories of the text to be recognized;
the first splicing unit is used for carrying out splicing processing on the text to be identified and a preset template sentence if the intention category is determined to be the appointed intention category, so as to obtain a target text; the preset template statement is used for representing intention prompt information;
the first recognition unit is used for inputting the target text into an intention recognition model to obtain an intention recognition result of the text to be recognized, and the intention recognition model is used for carrying out intention recognition processing on the text to be recognized based on the intention prompt information.
In a fifth aspect, embodiments of the present application provide a training apparatus for an intent recognition model, including:
the second acquisition unit is used for acquiring an initial training text; the intention category of the initial training text is a designated intention category;
the second splicing unit is used for splicing the initial training text and a preset template sentence to obtain a target training text; the preset template statement is used for representing intention prompt information;
And the training unit is used for inputting the target training text into the initial intention recognition model for iterative training to obtain the intention recognition model.
In a sixth aspect, embodiments of the present application provide an intention recognition device applied to a digital person, including:
the third acquisition unit is used for acquiring a text to be identified input by a user;
a second recognition unit, configured to recognize the intention of the text to be recognized according to the intention recognition method according to the first aspect, to obtain a user intention;
and the display unit is used for acquiring a target text corresponding to the user intention in the digital person system according to the user intention and displaying the target text.
In a seventh aspect, embodiments of the present application provide an electronic device, including: a processor; and a memory configured to store computer-executable instructions that, when executed, cause the processor to perform the method of intent recognition as described in the first aspect, or the training method of an intent recognition model as described in the second aspect, or the method of intent recognition as described in the third aspect applied to a digital person.
In an eighth aspect, embodiments of the present application provide a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the method for intent recognition as described in the first aspect, or the training method for an intent recognition model as described in the second aspect, or the method for intent recognition as described in the third aspect applied to a digital person.
It can be seen that in the embodiment of the present application, first, a text to be identified is obtained; secondly, carrying out intention classification processing on the text to be identified to obtain the intention category of the text to be identified; then, if the intention category is determined to be the appointed intention category, splicing the text to be identified and a preset template sentence to obtain a target text; the preset template sentences are used for representing intention prompt information; and finally, inputting the target text into an intention recognition model to obtain an intention recognition result of the text to be recognized, wherein the intention recognition model is used for carrying out intention recognition processing on the text to be recognized based on the intention prompt information. Therefore, through carrying out intention classification processing on the text to be identified and determining the intention type of the text to be identified, whether the text to be identified is the appointed intention type can be determined, and then splicing processing is carried out only on the text to be identified with the appointed intention type and a preset template sentence to obtain input data of an intention recognition model, so that the intention recognition result is obtained through carrying out intention recognition on the target text through the intention recognition model based on intention prompt information represented by the preset template sentence, and the accuracy of the intention recognition of the appointed intention type is improved.
Drawings
For a clearer description of embodiments of the present application or of the solutions of the prior art, the drawings that are required to be used in the description of the embodiments or of the prior art will be briefly described, it being obvious that the drawings in the description below are only some of the embodiments described in the present specification, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art;
FIG. 1 is a process flow diagram of an intent recognition method provided in an embodiment of the present application;
FIG. 2 is a process flow diagram of another intent recognition method provided by an embodiment of the present application;
FIG. 3 is a process flow diagram of a method for identifying a non-long tail intention according to an embodiment of the present application;
FIG. 4 is a process flow diagram of a method for identifying an important long tail intention according to an embodiment of the present application;
FIG. 5 is a mapping relationship diagram between mask values and intent labels provided in an embodiment of the present application;
fig. 6 is a process flow diagram of a response method provided in an embodiment of the present application;
FIG. 7 is a process flow diagram of a training method for an intent recognition model provided in an embodiment of the present application;
FIG. 8 is a schematic diagram of an intent recognition device according to an embodiment of the present application;
FIG. 9 is a schematic diagram of a training device for an intent recognition model according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to better understand the technical solutions in the embodiments of the present application, the following description will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present specification, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
In practical applications of robots (including digital persons) with automatic response functions, the category of intention of the user involved in the customer problem is very rich. On one hand, the intention recognition model has good recognition effect on the client problems of the intention category with higher appearance frequency because of sufficient sample quantity; on the other hand, due to lack of enough samples, the intention recognition model has poor recognition effect on the client problems of the intention type with low occurrence frequency, so that the robot ox head for automatically responding based on the intention recognition result of the intention recognition model does not have to face the horse mouth, bad experience is left for the client, the client has to transfer the manual work to obtain accurate response, and the workload of manual customer service is indirectly improved by the robot.
In order to overcome the above problems, embodiments of the present application provide an intent recognition method.
The intent recognition method presented in the present application may be performed by an electronic device, in particular by a processor in the electronic device. The electronic device mentioned herein may be a terminal device such as a smart phone, a tablet computer, a desktop computer, a smart voice interaction device, a wearable device, a robot, a car terminal, etc.; alternatively, the electronic device may also be a server, such as a stand-alone physical server, a server cluster composed of a plurality of servers, or a cloud server capable of cloud computing.
The method of intent recognition presented in this application will be described in detail below by way of several examples.
Referring to fig. 1, a process flow diagram of an intent recognition method is provided in an embodiment of the present application. As shown in fig. 1, the intention recognition method provided in the embodiment of the present application may specifically include the following steps:
step S102, acquiring a text to be recognized.
The text to be recognized can be obtained by obtaining the voice data to be recognized, converting the voice data into a text form, and obtaining the text to be recognized, or obtaining the text to be recognized input by a user, or obtaining the text with intention recognition requirements in other modes. The text to be recognized entered by the user may be simply referred to as the input text.
Step S104, carrying out intention classification processing on the text to be identified to obtain the intention category of the text to be identified.
Taking the robot auto-answer scenario as an example, the intent involved in a customer problem may include a small number of main intents and a large number of long tail intents. The main intent is to represent a small number of intentions but the covered traffic is extremely high, and the long tail intent is to represent a large number of intentions but each occupies only a very small traffic. If a special intention response operation is configured for each long-tail intention, the workload is huge and the cost performance is extremely low, but if intention recognition is performed on all texts uniformly, the recognition accuracy of the long-tail intention is likely to be lower than that of the main intention because the number of corresponding samples of the long-tail intention in the historical data is far smaller than that of the main intention. For this reason, different intention recognition models need to be adopted for different intention categories, so as to ensure that the intention categories with different characteristics can all obtain better intention recognition results.
The intent category of the text to be identified includes, but is not limited to: non-long tail intent, important long tail intent, and non-important long tail intent.
Among them, the non-long tail intention may be the main intention, i.e., the one that is small in number but extremely high in the flow rate covered; the important long tail intention can be a great number of intentions with extremely low occupied flow rate and strong importance; the non-important long tail intent may be a large number but each occupying very low traffic and of weak importance.
On the one hand, non-long tails are intended to have a small number of features but very high flow rates are covered. For non-long tail intention, the intention recognition can be carried out by adopting a pre-trained language model and a non-long tail intention recognition model formed by a multi-layer perceptron. The pre-trained language model includes, but is not limited to: BERT (Bidirectional Encoder Representations from Transformers) model, or RoBERTa (a Robustly Optimized BERT Pretraining Approach) model, etc.
The BERT model is a language representation model and is represented by a bidirectional encoder of a transducer, and the training process of the BERT model can be divided into a pre-training part and a model fine-tuning part, wherein the model fine-tuning part uses the pre-trained BERT model to carry out model fine-tuning training, and the method is widely applied to tasks such as text classification, text matching and the like.
The pre-training and model fine tuning can be illustrated by the following examples: assuming that an A training set exists, firstly, the A training set is used for pre-training a network, network parameters are learned on an A task, then the network parameters are saved for later use, when a new task B is adopted, the same network structure is adopted, the well-learned parameters of the A can be loaded when the network parameters are initialized, other high-level parameters are randomly initialized, then training data of the B task are used for training the network, and when the loaded parameters are changed continuously along with the training of the B task, the loaded parameters are called fine-tuning, namely, the parameters are better adjusted to be more suitable for the current B task.
The Roberta model is similar to the BERT model, and mainly performs several adjustments based on the BERT: 1) Longer training time, larger batch size and more training data; 2) Next predict loss is removed; 3) The training sequence is longer; 4) The masking mechanism is dynamically adjusted. They are widely used in NLP (Natural Language Processing ) tasks because they perform better than BERT models in many scenarios.
The model fine adjustment of the pre-trained language model can be realized by arranging the non-long tail intention recognition model to comprise the pre-trained language model, the multi-layer perceptron and the normalized exponential function, namely the Softmax function, which are sequentially connected.
The non-long tail intention has the characteristic of smaller quantity but extremely high covered flow, namely, the occurrence frequency of the non-long tail intention in the historical intention data is extremely high, so a large quantity of training samples corresponding to the non-long tail intention can be obtained from the historical intention data. Furthermore, the accuracy of the non-long tail intention recognition model obtained by training in a training mode of model fine adjustment on the intention recognition of the non-long tail intention is high.
On the other hand, if the non-important long-tail intention has a feature that the number of the non-important long-tail intentions is large, each occupying flow is extremely low, and the importance is weak, the accuracy requirement for the non-important long-tail intention recognition is not high, and the subsequent complicated steps are not involved, so that a non-important long-tail intention recognition model can be configured, the non-important long-tail intention recognition model can directly use keywords to realize the intention recognition, and the matching condition can be set to be more strict when the keywords are set.
On the other hand, if the important long tail intention has the characteristics of a large number but extremely low occupied flow rate and high importance, the accuracy requirement for the intention recognition is high for the important long tail intention, and if the intention recognition is performed by adopting a model structure which is not the same as the long tail intention recognition model, the model training effect is poor due to the small number of samples, and the recognition accuracy of the important long tail intention is low. Therefore, there is a need for improving the accuracy of intent recognition for important long tail intent.
In a specific embodiment, performing intention classification processing on a text to be identified to obtain an intention category of the text to be identified, including: counting the number of the history texts included in a prestored history text set to obtain a first number; determining the number of the historical texts belonging to the same intention as the text to be identified in the historical text set to obtain a second number; determining the occurrence frequency of the intention corresponding to the text to be identified in the historical text set according to the first quantity and the second quantity to obtain a target frequency value; and determining the intention category of the text to be identified according to the comparison result of the target frequency value and the preset frequency threshold value.
The pre-stored set of history text may include a plurality of history text, each history text corresponding to an intent. The intent of the two history texts may be the same intent or may be different intent. The two history texts belonging to the same intention may be texts with completely identical content or texts with different content. Whether any two history texts belong to the same intention can be represented by the similarity between the two texts.
Counting the number of the history texts included in a prestored history text set to obtain a first number; and determining the number of the historical texts belonging to the same intention as the text to be identified in the historical text set, and obtaining a second number. And calculating the appearance frequency of the intention corresponding to the text to be identified in the historical text set through the first quantity and the second quantity to obtain a target frequency value.
The target frequency value may be a ratio of the first number to the second number, or may be calculated based on a preset coefficient, the first number, and the second number.
In a specific embodiment, determining, in the set of historical texts, a number of historical texts belonging to the same intention as the text to be identified, to obtain a second number includes: calculating the similarity between the text to be identified and each historical text in the historical text set to obtain target similarity; if the target similarity is greater than or equal to a preset similarity threshold, determining that the text to be identified and the historical text corresponding to the target similarity belong to the same intention; and counting the number of the historical texts which belong to the same intention as the text to be identified, and obtaining a second number.
If the similarity between two texts is high, it can be considered that the two texts belong to the same intention.
For example, the text to be recognized is "listen to say that a product is doing something recently? That coupon is what is meant. "history text 1 is: "is product a recently active, there is a large coupon? And determining that the text to be recognized and the historical text 1 belong to the same intention if the target similarity of the text to be recognized and the historical text 1 is a percent and the a percent is larger than a preset similarity threshold A.
And counting the historical texts which belong to the same intention as the text to be identified, and obtaining a second quantity, wherein the second quantity can reflect the quantity of the intention of the text to be identified in the historical text set.
In a particular embodiment, the intent category of the text to be identified includes one of a non-long tail intent, an important long tail intent, and a non-important long tail intent; according to the comparison result of the target frequency value and the preset frequency threshold value, determining the intention category of the text to be identified comprises the following steps: if the target frequency value is greater than or equal to a preset frequency threshold value, determining that the intention type of the text to be identified is a non-long tail intention; if the target frequency value is smaller than the preset frequency threshold, judging whether the importance parameter of the intention of the text to be recognized is larger than or equal to the preset parameter threshold according to the business rule corresponding to the text to be recognized; the importance parameter is used for representing the importance degree of the intention of the text to be identified; if yes, determining the intention type of the text to be identified as an important long tail intention; if not, determining the intention type of the text to be recognized as non-important long tail intention.
If the target frequency value is greater than or equal to the preset frequency threshold, the fact that the appearance frequency of the intention corresponding to the text to be identified in the historical text set is high is indicated, so that the intention type of the text to be identified can be determined to be a non-long tail intention; if the target frequency value is smaller than the preset frequency threshold value, the fact that the appearance frequency of the intention corresponding to the text to be recognized in the historical text set is lower is indicated, so that the intention type of the text to be recognized can be determined to be long tail intention.
After determining that the intention type of the text to be recognized is long tail intention, judging whether an importance parameter of the intention of the text to be recognized is greater than or equal to a preset parameter threshold according to a business rule corresponding to the text to be recognized. Different business rules are applicable to different application scenes. The business rule may be preconfigured with a judging condition for judging whether the intention is important or not, or may be configured with a generating method of the importance parameter and a preset parameter threshold. Further, judging whether an importance parameter of the intention of the text to be identified is larger than or equal to a preset parameter threshold value, if so, determining that the importance of the intention of the text to be identified is higher, wherein the intention type of the text to be identified is an important long tail intention; if not, determining that the importance of the intention of the text to be recognized is lower, wherein the intention type of the text to be recognized is a non-important long tail intention.
Step S106, if the intention category is determined to be the appointed intention category, splicing the text to be identified and a preset template sentence to obtain a target text; the preset template sentences are used for representing the intention prompt information.
The specified intent category may be long tail intent, important long tail intent, or other intent categories with a small number of samples available for model training.
In an artificial intelligence scenario, each robot performing the intent recognition method provided by the embodiments of the present application may be preconfigured with a preset template sentence corresponding to a service. The preset template statement can reflect the intention prompt information of the service. The function of the preset template sentence is to reconstruct the text to be recognized so as to generate a target text which comprises the text to be recognized and the target text with the intention prompt information. The intent hint information may be reflected by the mask (mask) and the context of the mask.
For example, the text to be recognized is: x=listen to a product is recently doing the work of java? That coupon is what is meant.
The templates of the target text are: x+ preset template statements.
The preset template statement is as follows: (that, I want [ mask ])
Then the text to be identified and the preset template sentence are spliced, and a target text can be obtained: listening to the A product is doing the work of "Java" recently? That coupon is what is meant. That, I want [ mask ].
The following briefly describes prompt learning: prompt Learning (Prompt Learning) is a new paradigm of recently proposed NLP training Learning. Unlike pre-training models+model fine-tuning, which is commonly used today, prompt learning does not adapt the pre-trained Language Model (LM) to downstream tasks through target engineering, but rather reforms the downstream tasks to make them look more like tasks solved during original LM training with the help of text prompt.
For example, input: i like this movie;
and (3) outputting: "positive" or "negative".
While the task may become "complete fill" if solved with promt Learning.
For example, input: i like this movie, which is a movie as a whole;
and (3) outputting: "interesting" or "boring".
The intention prompt information is the text prompt adopted in prompt learning.
Step S108, inputting the target text into an intention recognition model to obtain an intention recognition result of the text to be recognized, wherein the intention recognition model is used for carrying out intention recognition processing on the text to be recognized based on the intention prompt information.
In a specific embodiment, the preset template sentence is composed of a preset sentence pattern and a mask; the intention recognition model comprises a predictor model and a label determining module which are connected in sequence; the predictor model is used for carrying out value prediction processing on the mask according to the target text to obtain a corresponding mask predicted value; the tag determining module is used for determining a target intention tag with a mapping relation with the mask predicted value according to the mask predicted value corresponding to the target text and the mapping relation between the pre-configured mask value and the intention tag, and determining the target intention tag as an intention recognition result of the text to be recognized.
The preset sentence pattern may be a fixed sentence pattern preset based on a service scenario. For example, the robot is mainly used to handle the problem of the counseling and preferential activities of the clients, the fixed sentence pattern may be "me wants to ask_preferential", or the electronic device is mainly used to handle the complaints of the clients, the fixed sentence pattern may be "me's opinion of_is_and so on. The mask may be used to characterize an unknown number to be predicted, corresponding to the region to be filled in the fixed pattern. For example, the preset template statement may be "I want to ask [ mask ] offer," or "I'm's view of [ mask1] is [ mask2]". In a preset template sentence, the number of masks may be one or more.
Unlike normal deep learning, the mask predicted value is no longer a digital class of 0,1,2, etc., but the predictor model is allowed to select the answer that it considers most likely from the mask value space, and the mask value space needs to be configured with a plurality of preset mask values in advance, after the predictor model outputs the mask predicted value, a label determining module is needed to map the mask predicted value into a label space based on a mapping relationship between a preconfigured mask value and an intention label, and the label space includes a plurality of intention labels.
For example, [ mask ] in the target text is predicted by the predictor model, resulting in a mask predictor "coupon". In one embodiment, the mask predictor "coupon" may be substituted into the mask to obtain a substituted result: "listening to the A product was doing the work of Java recently? That coupon is what is meant. That, I want to ask the coupon. And determining the intention label with the mapping relation based on the substitution result by a label determination module. In another embodiment, the mask predicted value "coupon inquiry" may be directly output, and the intent tag having the mapping relationship may be directly determined by the tag determination module according to the mask predicted value without substitution. For example, the intention label having a mapping relation with the mask predictive value "inquiry coupon" is "consultation coupon".
In a specific embodiment, the predictor model is specifically configured to: determining the probability that the value of the mask is each preset mask value in a preset mask value set according to the target text, and obtaining the prediction probability corresponding to each preset mask value; sequencing each preset mask value according to the numerical value of the prediction probability to obtain a sequencing result; and based on the sorting result, determining a preset mask value with the highest numerical value of the prediction probability as a mask prediction value corresponding to the target text.
In another embodiment, the text to be recognized may be text entered by the target user. The predictor model can determine the probability that the value of the mask is each preset mask value in a preset mask value set according to the target text, and obtain the prediction probability corresponding to each preset mask value; sequencing each preset mask value according to the numerical value of the prediction probability to obtain a sequencing result; and determining a preset number of preset mask values with highest prediction probability as mask prediction values based on the sequencing results, and further, outputting the preset number of intention recognition results by the intention recognition model so as to feed back intention confirmation information carrying the preset number of intention recognition results to the target user, and responding pertinently after receiving an intention selection instruction of the target user.
The preset number may be a natural number greater than 1. For example, in an application scenario of a voice service robot, a target user may be a client who asks a question to the voice service robot, which may be text input by the target user.
The preset mask values with the highest prediction probability are determined to be mask predicted values, so that a plurality of intention recognition results are obtained through prediction, and a plurality of intentions with the highest prediction probability can be fed back to a target user for selection by the user, so that the intention recognition accuracy is improved by combining the subjective selection operation of the target user.
In a specific embodiment, the predictive sub-model is obtained by inputting training text data into an initial predictive sub-model for iterative training; the training text data is obtained by splicing training texts and preset template sentences filled with sample mask values.
According to the training method, a training sample input into an initial predictor model is not a text to be recognized and an intention label corresponding to the text to be recognized, but a target text obtained by splicing the text to be recognized and a preset template sentence filled with a mask value.
The initial predictor model may be a pre-trained model. In particular, the initial predictor model may be a pre-trained language characterization model, such as a BERT model, or a RoBERTa model, or the like. Illustratively, in the area of financial questioning, the initial predictor model may also be a pre-trained open source model, such as the finbert model, or the mengzi-fin model, and so forth.
The pre-training model often uses a large amount of sample data to perform the complete filling task in the pre-training stage, so the pre-training model has strong word filling capability. The method for setting the preset template sentences through the training mode of prompt learning enables the pre-training model to recall corresponding answers, and the expression capacity of the pre-training model can be improved under the condition that the number of samples of important long tail intention is small. On the basis, if a training mode of prompt learning is adopted to train the pre-training model, namely, training texts and training texts obtained by splicing preset template sentences filled with sample mask values are input into an initial predictor model to carry out iterative training, even if the number of the training texts is small, a better model training effect can be obtained, and the accuracy of the mask predicted value obtained by predicting the trained intention recognition model after the training intention recognition model is put into use is higher.
Otherwise, if the training mode of fine tuning is adopted to train the pre-training model, namely, the text to be identified carrying the intention label is input into the initial predictor model to carry out iterative training, the number of samples required by the training mode is extremely large, a small number of samples cannot meet the training requirement, and the prediction result of the intention identification model obtained by training is likely to be inaccurate.
In a specific embodiment, if the text to be recognized is a text input by the target user and the number of intention recognition results of the text to be recognized is a plurality of, performing intention recognition processing on the input intention recognition model of the target text, and after obtaining the intention recognition result of the text to be recognized, the intention recognition method further includes: feeding back intention confirmation information to the target user; the intention confirming information carries a plurality of intention identifying results; receiving an intention selection instruction of a target user, and determining the intention selected by the intention selection instruction as a target intention; and executing corresponding intention response operation according to the target intention.
The intention confirmation information carries a plurality of intention recognition results, and a plurality of intentions to be selected can be displayed to a target user through a display interface so as to enable the user to select the real intention. Each intention to be selected corresponds to one intention recognition result. For example, the intention confirmation information may be: you want to consult or not: 1. a coupon; 2. b, preferential activities; 3. discount on goods C.
And receiving an intention selecting instruction of the target user in the display interface, and determining the intention selected by the intention selecting instruction as the target intention.
Target intents include, but are not limited to: consultation, help, complaints, shopping, and the like. For example, if the target intention is a consultation for a coupon, the intention response operation corresponding to the target intention may be to reply to the coupon introduction information; if the target intention is to seek help for lost, the intention response operation corresponding to the target intention can be to acquire the current position information and the destination position information of the target user and push the corresponding navigation route to the target user; if the target intention is customer complaint, the intention response operation corresponding to the target intention can be to reply a preset pacifying operation to the target user and record corresponding complaint information; if the target intention is shopping, the intention response operation corresponding to the target intention may be pushing shopping price information and shopping links to the target user, and so on.
In another embodiment, a plurality of intention recognition modules, which are "non-long tail intention recognition module", "important long tail intention recognition module", and "non-important long tail intention recognition module", may also be constructed in advance, which are sequentially connected in series. If the 'non-long tail intention recognition module' determines that the intention category of the received text to be recognized is a non-long tail intention, the intention recognition can be carried out on the text to be recognized based on the 'non-long tail intention recognition module', and an intention label is output; if the non-long tail intention recognition module determines that the intention category of the received text to be recognized is not the non-long tail intention, the recognition fails, and the text to be recognized is continuously transmitted to the important long tail intention recognition module; if the important long tail intention recognition module determines that the intention category of the received text to be recognized is an important long tail intention, the intention recognition can be carried out on the text to be recognized based on the important long tail intention recognition module, and an intention label is output; if the important long tail intention recognition module determines that the intention category of the received text to be recognized is not an important long tail intention, the recognition fails, and the text to be recognized is continuously transmitted to the non-important long tail intention recognition module; if the 'non-important long tail intention recognition module' determines that the intention category of the received text to be recognized is non-important long tail intention, the intention recognition can be carried out on the text to be recognized based on the 'non-important long tail intention recognition module', and an intention label can be output; if the "non-important long tail intention recognition module" determines that the intention category of the received text to be recognized is not a non-important long tail intention, the recognition fails, and a spam answer may be output, for example, "your question cannot be recognized, asking you if you need to switch to a manual service.
The structure of the non-long tail intention recognition module can refer to the non-long tail intention recognition model; the important long tail intention recognition module can refer to an intention recognition model provided by the embodiment of the application; the non-important long tail intention recognition module may refer to the non-important long tail intention recognition model described above.
By adopting different intention recognition modes for texts to be recognized of different graph categories, the recognition requirement of each intention category can be met, and the recognition accuracy is improved.
In the embodiment shown in fig. 1, first, a text to be recognized is acquired; secondly, carrying out intention classification processing on the text to be identified to obtain the intention category of the text to be identified; then, if the intention category is determined to be the appointed intention category, splicing the text to be identified and a preset template sentence to obtain a target text; the preset template sentences are used for representing intention prompt information; and finally, inputting the target text into an intention recognition model to obtain an intention recognition result of the text to be recognized, wherein the intention recognition model is used for carrying out intention recognition processing on the text to be recognized based on the intention prompt information. Therefore, through carrying out intention classification processing on the text to be identified and determining the intention type of the text to be identified, whether the text to be identified is the appointed intention type can be determined, and then splicing processing is carried out only on the text to be identified with the appointed intention type and a preset template sentence to obtain input data of an intention recognition model, so that the intention recognition result is obtained through carrying out intention recognition on the target text through the intention recognition model based on intention prompt information represented by the preset template sentence, and the accuracy of the intention recognition of the appointed intention type is improved.
The present embodiment also provides another intention recognition method, for the same technical concept as the method embodiment of fig. 1. Fig. 2 is a process flow diagram of another intent recognition method according to an embodiment of the present application.
Step S202, a text is input.
Step S202 corresponds to step S102 in the embodiment of fig. 1. The text input in step S202 may be text to be recognized.
Step S204, judging whether the non-long tail intention recognition module is successful in recognition.
The non-long tail intention recognition module can comprise a non-long tail intention recognition model which is trained by a labeling mode, and the recognition accuracy of the non-long tail intention recognition model to texts with intention categories of the non-long tail model is extremely high. If the text is input into the non-long tail intention recognition model to perform intention recognition processing, and the obtained intention recognition result is used for representing that the intention type of the text is a non-long tail intention, the non-long tail intention recognition module is determined to be successful in recognition; if the text is input into the non-long tail intention recognition model to perform intention recognition processing, and the obtained intention recognition result is used for representing the result of the intention category of the text except for the non-long tail intention, the non-long tail intention recognition module is determined to be unsuccessful in recognition.
If the recognition of the non-long tail intention recognition module is successful, executing step S210; if the long tail intention recognition module is unsuccessful, step S206 is performed.
Step S206, judging whether the important long tail intention recognition module is successful in recognition.
The step S204 may be referred to for determining whether the important long tail intention recognition module is successful. If yes, go to step S210; if not, go to step S208.
Step S208, judging whether the non-important long tail intention recognition module is successful in recognition.
The step S204 may be referred to for determining whether the non-important long tail intention recognition module is successful.
If yes, go to step S210; if not, go to step S212.
Step S210, outputting the intention label.
Step S204, step S206, and step S210 may replace step S104, step 106, and step S108 in the embodiment of fig. 1, specifically, after the text to be identified is obtained, the text to be identified may be input into a non-long tail intention identifying module to perform the intention identifying process, so as to obtain a non-long tail intention identifying result of the text to be identified; if the non-long tail intention recognition result is used for representing that the recognition of the non-long tail intention recognition module is unsuccessful, splicing the text to be recognized with a preset template sentence to obtain a target text; the preset template sentences are used for representing intention prompt information; inputting the target text into an important long tail intention recognition module for intention recognition processing to obtain an important long tail intention recognition result of the text to be recognized; if the important long tail intention recognition result is used for representing that the important long tail intention recognition module is successful in recognition, outputting the important long tail intention recognition result as an intention label of the text to be recognized.
The important long tail intent recognition module in the embodiment of fig. 2 may include the various structural components in the intent recognition model provided by the embodiment of fig. 1 and perform the same functions.
Step S212, outputting a spam answer. The spam answer can be a transfer manual or other preset response modes, for example, a prompt message for suggesting the user to dial a manual customer service call is generated.
The embodiment of the application also provides a method for identifying the non-long tail intention, which is based on the same technical conception as the embodiment of the method. Fig. 3 is a process flow diagram of a method for identifying a non-long tail intention according to an embodiment of the present application.
The non-long tail intention, i.e., the main intention, has the characteristics of a smaller proportion of the number of intentions to all intentions and a larger occupied flow. As shown in fig. 3, the input text may be input into a non-long tail intention recognition model to perform an intention prediction process, so as to obtain an intention prediction result. The non-long tail intent recognition model may include a pre-trained model, a multi-layered perceptron, and a normalized exponential function, i.e., softmax function, connected in sequence. The categorized number of Softmax functions may include the number of all common questions plus "other questions".
Illustratively, intent prediction results include, but are not limited to: 1. inquiring the loan balance; 2. how to pay in advance; 3. WeChat deduction problem; 4. which loan products are available, and so on.
The embodiment of the application also provides a method for identifying the important long tail intention, which is based on the same technical conception as the embodiment of the method. Fig. 4 is a process flow diagram of a method for identifying an important long tail intention according to an embodiment of the present application.
Step S402, a text is input.
Step S402 corresponds to step S102 in the embodiment of fig. 1.
The text entered may be text to be identified.
Step S404, a preset template sentence is established.
The preset template statement is established and can be preset template statement corresponding to the service.
Specifically, the syntactic characteristics of the important long tail intention corresponding to the robot in the application scene of the current robot can be integrated to configure a preset template sentence. Step S406, constructing a mapping relation.
Fig. 5 is a mapping relationship diagram between mask values and intent labels provided in an embodiment of the present application.
As shown in FIG. 5, the intent tag space includes a plurality of intent tags, such as "consultation coupons", "customer complaints", and the like. The mask value space includes a plurality of preset mask values, for example, "ask coupons", "event of coupons", "report", "complaint", "report you", and so on.
The intention label "consultation coupon" can respectively establish a mapping relation with a preset mask value "ask coupon" and a preset mask value "ask coupon" respectively; the intent label "customer complaints" can respectively establish a mapping relation with the preset mask value "report", "complaint" and "report you".
Step S408, generating a text carrying a preset template sentence.
Step S408 corresponds to step S106 in the embodiment of fig. 1.
In step S410, mask value prediction is performed.
Step S412, outputting a model prediction result based on the mapping relation.
Step S410 and step S412 correspond to step S108 in the embodiment of fig. 1.
The embodiment of the application also provides a response method which can be applied to the field of artificial intelligence, and the technical conception is the same as that of the embodiment of the method. Fig. 6 is a process flow diagram of a response method according to an embodiment of the present application.
Step S602, converting the customer speech problem into text.
Step S604, performing intention recognition on the text input intention recognition model.
Step S606, mapping the answer corresponding to the intention.
Step S608, the answer is converted to speech output.
In step S610, the robot plays the corresponding voice call to answer the client.
The embodiment of the application also provides a training method of the intention recognition model in view of the same technical conception as the embodiment of the method.
Fig. 7 is a process flow diagram of a training method for an intent recognition model according to an embodiment of the present application.
As shown in fig. 7, step S702, an initial training text is acquired; the intention category of the initial training text is a specified intention category.
Step S704, splicing the initial training text and a preset template sentence to obtain a target training text; the preset template sentences are used for representing the intention prompt information.
Step S706, inputting the target training text into the initial intention recognition model for iterative training to obtain the intention recognition model.
In specific implementation, the preset template sentence may be a preset sentence pattern filled with a sample mask value; the intention recognition model comprises a predictor model and a label determining module which are connected in sequence; the predictive sub-model can be obtained by inputting a target training text into an initial predictive sub-model for iterative training; the label determining model can be obtained by inputting the mask predicted value into an initial label determining module for iterative training; the mask predictor is generated by a predictor model.
According to the training method, a training sample of an initial predictor model is input, and is not an initial training text and an intention label corresponding to the initial training text, but a target training text obtained by splicing the initial training text with a preset template sentence filled with a mask value.
The initial predictor model may be a pre-trained model. In particular, the initial predictor model may be a pre-trained language characterization model, such as a BERT model, or a RoBERTa model, or the like. Illustratively, in the area of financial questioning, the initial predictor model may also be a pre-trained open source model, such as the finbert model, or the mengzi-fin model, and so forth.
The pre-training model often uses a large amount of sample data to perform the complete filling task in the pre-training stage, so the pre-training model has strong word filling capability. The method for setting the preset template sentences through the training mode of prompt learning enables the pre-training model to recall corresponding answers, and the expression capacity of the pre-training model can be improved under the condition that the number of samples of important long tail intention is small. On the basis, if a training mode of prompt learning is adopted to train the pre-training model, namely, the template training text obtained by splicing the initial training text and the preset template sentence filled with the sample mask value is input into the initial predictor model to carry out iterative training, even if the number of training texts is small, a better model training effect can be obtained, and the accuracy of the mask predicted value obtained by predicting the trained intention recognition model after the training intention recognition model is put into use is higher.
Otherwise, if the pre-training model is trained by adopting a fine-tuning training mode, namely, the initial training text carrying the intention label is input into the initial predictor model for iterative training, the number of samples required by the training mode is extremely large, a small number of samples cannot meet the training requirement, and the prediction result of the intention recognition model obtained by training is likely to be inaccurate.
The tag determination model is obtained by inputting the mask predicted value into an initial tag determination module for iterative training. The mask predictors may be generated by inputting target training text into a predictor model.
The present application also provides an intention recognition method applied to a digital person, which includes:
and acquiring the text to be recognized input by the user.
And identifying the intention of the text to be identified according to the intention identification method in any embodiment, so as to obtain the intention of the user.
And acquiring target text corresponding to the user intention in the digital person system according to the user intention, and displaying the target text.
In this embodiment, the text to be recognized input by the user includes the text to be recognized input by the user during the interface operation, the audio played by the user, the text to be recognized obtained by recognizing the audio, or the text to be recognized manually input by the user.
In this embodiment, obtaining, in the system of the digital person, a target text corresponding to the user intention according to the user intention includes: searching content matching the user intention in the system of the digital person according to the user intention, and taking the content obtained by matching as the target text; and displaying the target text, wherein the target text is broadcasted by the digital person or displayed on a display interface of the digital person by the digital person.
In the above-described embodiments, an intention recognition method is provided, and an intention recognition apparatus is provided correspondingly, which is described below with reference to the accompanying drawings.
Fig. 8 is a schematic diagram of an intention recognition device according to an embodiment of the present application.
The present embodiment provides an intention recognition apparatus 800 including:
a first obtaining unit 801, configured to obtain a text to be identified;
the classifying unit 802 is configured to perform intent classification processing on the text to be identified, so as to obtain an intent category of the text to be identified;
a first splicing unit 803, configured to, if it is determined that the intention category is the specified intention category, splice the text to be identified with a preset template sentence to obtain a target text; the preset template sentences are used for representing intention prompt information;
The first recognition unit 804 is configured to input the target text into an intent recognition model, so as to perform intent recognition processing on the text to be recognized based on the intent prompt information, and obtain an intent recognition result of the text to be recognized.
Optionally, the preset template sentence is composed of a preset sentence pattern and a mask; the intention recognition model comprises a predictor model and a label determining module which are connected in sequence;
the predictor model is used for carrying out value prediction processing on the mask according to the target text to obtain a corresponding mask predicted value;
the tag determining module is used for determining a target intention tag with a mapping relation with the mask predicted value according to the mask predicted value corresponding to the target text and the mapping relation between the pre-configured mask value and the intention tag, and determining the target intention tag as an intention recognition result of the text to be recognized.
Optionally, the predictor model is specifically used for:
determining the probability that the value of the mask is each preset mask value in a preset mask value set according to the target text, and obtaining the prediction probability corresponding to each preset mask value;
sequencing each preset mask value according to the numerical value of the prediction probability to obtain a sequencing result;
And based on the sorting result, determining a preset mask value with the highest numerical value of the prediction probability as a mask prediction value corresponding to the target text.
Optionally, the classification unit 802 includes:
the statistics subunit is used for counting the number of the history texts included in the prestored history text set to obtain a first number;
the first determining subunit is used for determining the number of the historical texts belonging to the same intention as the text to be identified in the historical text set to obtain a second number;
the second determining subunit is used for determining the appearance frequency of the intention corresponding to the text to be identified in the historical text set according to the first quantity and the second quantity to obtain a target frequency value;
and the third determining subunit is used for determining the intention category of the text to be identified according to the comparison result of the target frequency value and the preset frequency threshold value.
Optionally, the first determining subunit is specifically configured to:
calculating the similarity between the text to be identified and each historical text in the historical text set to obtain target similarity;
if the target similarity is greater than or equal to a preset similarity threshold, determining that the text to be identified and the historical text corresponding to the target similarity belong to the same intention;
and counting the number of the historical texts which belong to the same intention as the text to be identified, and obtaining a second number.
Optionally, the intent category of the text to be identified includes one of a non-long tail intent, an important long tail intent, and a non-important long tail intent; the third determining subunit is specifically configured to:
if the target frequency value is greater than or equal to a preset frequency threshold value, determining that the intention type of the text to be identified is a non-long tail intention;
if the target frequency value is smaller than the preset frequency threshold, judging whether the importance parameter of the intention of the text to be recognized is larger than or equal to the preset parameter threshold according to the business rule corresponding to the text to be recognized; the importance parameter is used for representing the importance degree of the intention of the text to be identified;
if yes, determining the intention type of the text to be identified as an important long tail intention;
if not, determining the intention type of the text to be recognized as non-important long tail intention.
Optionally, if the text to be recognized is a text input by the target user and the number of intention recognition results of the text to be recognized is a plurality of, the intention recognition device 800 further includes:
the feedback unit is used for feeding back intention confirmation information to the target user; the intention confirming information carries a plurality of intention identifying results;
a receiving unit configured to receive an intention selection instruction of a target user, and determine an intention selected by the intention selection instruction as a target intention;
And the execution unit is used for executing corresponding intention response operation according to the target intention.
The intention recognition device provided by the embodiment of the application comprises a first acquisition unit, a classification unit, a first splicing unit and a first recognition unit, wherein the first acquisition unit is used for acquiring texts to be recognized; the classifying unit is used for carrying out intention classifying treatment on the text to be recognized to obtain intention category of the text to be recognized; the first splicing unit is used for carrying out splicing processing on the text to be identified and a preset template sentence if the intention category is determined to be the appointed intention category, so as to obtain a target text; the preset template sentences are used for representing intention prompt information; the first recognition unit is used for inputting the target text into an intention recognition model to obtain an intention recognition result of the text to be recognized, and the intention recognition model is used for carrying out intention recognition processing on the text to be recognized based on the intention prompt information. Therefore, through carrying out intention classification processing on the text to be identified and determining the intention type of the text to be identified, whether the text to be identified is the appointed intention type can be determined, and then splicing processing is carried out only on the text to be identified with the appointed intention type and a preset template sentence to obtain input data of an intention recognition model, so that the intention recognition result is obtained through carrying out intention recognition on the target text through the intention recognition model based on intention prompt information represented by the preset template sentence, and the accuracy of the intention recognition of the appointed intention type is improved.
In the foregoing embodiments, a training method of an intent recognition model is provided, and a training device of an intent recognition model is provided correspondingly, which is described below with reference to the accompanying drawings.
Fig. 9 is a schematic diagram of a training device for an intent recognition model according to an embodiment of the present application.
The present embodiment provides a training apparatus 900 for an intention recognition model, including:
a second obtaining unit 901, configured to obtain an initial training text; the intention category of the initial training text is a designated intention category;
the second splicing unit 902 is configured to splice the initial training text and a preset template sentence to obtain a target training text; the preset template sentences are used for representing intention prompt information;
the training unit 903 is configured to input a target training text into the initial intention recognition model for iterative training, so as to obtain the intention recognition model.
In the above-described embodiments, there is provided an intention recognition method applied to a digital person, and in correspondence therewith, there is also provided an intention recognition apparatus applied to a digital person, including:
the third acquisition unit is used for acquiring a text to be identified input by a user;
a second recognition unit, configured to recognize the intention of the text to be recognized according to the intention recognition method according to the first aspect, to obtain a user intention;
And the display unit is used for acquiring a target text corresponding to the user intention in the digital person system according to the user intention and displaying the target text.
The embodiment of the application further provides an electronic device for executing the provided intent recognition method, or the training method of the provided intent recognition model, based on the same technical concept, the embodiment of the application further provides an electronic device for executing the provided training method of the intent recognition model, or the intent recognition method applied to the digital person, based on the same technical concept. Fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
As shown in fig. 10, the electronic device may have a relatively large difference due to different configurations or performances, and may include one or more processors 1001 and a memory 1002, where the memory 1002 may store one or more storage applications or data. Wherein the memory 1002 may be transient storage or persistent storage. The application programs stored in the memory 1002 may include one or more modules (not shown), each of which may include a series of computer-executable instructions in the electronic device. Still further, the processor 1001 may be configured to communicate with the memory 1002 and execute a series of computer executable instructions in the memory 1002 on an electronic device. The electronic device may also include one or more power supplies 1003, one or more wired or wireless network interfaces 1004, one or more input/output interfaces 1005, one or more keyboards 1006, etc.
In one particular embodiment, an electronic device includes a memory, and one or more programs, where the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer-executable instructions for the electronic device, and execution of the one or more programs by one or more processors includes instructions for:
acquiring a text to be identified;
performing intention classification processing on the text to be identified to obtain intention types of the text to be identified;
if the intention category is determined to be the appointed intention category, splicing the text to be identified and a preset template sentence to obtain a target text; the preset template sentences are used for representing intention prompt information;
inputting the target text into an intention recognition model to obtain an intention recognition result of the text to be recognized, wherein the intention recognition model is used for carrying out intention recognition processing on the text to be recognized based on intention prompt information.
In another particular embodiment, an electronic device includes a memory, and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer-executable instructions for the electronic device, and configured to be executed by one or more processors, the one or more programs comprising computer-executable instructions for:
Acquiring an initial training text; the intention category of the initial training text is a designated intention category;
splicing the initial training text and a preset template sentence to obtain a target training text; the preset template sentences are used for representing intention prompt information;
and inputting the target training text into the initial intention recognition model for iterative training to obtain the intention recognition model.
In yet another particular embodiment, an electronic device includes a memory, and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer-executable instructions for the electronic device, and configured to be executed by one or more processors, the one or more programs comprising computer-executable instructions for:
acquiring a text to be identified input by a user;
identifying the intention of the text to be identified according to the intention identification method described in the embodiment of each intention identification method, so as to obtain the intention of the user;
and acquiring target text corresponding to the user intention in the digital person system according to the user intention, and displaying the target text.
An intention recognition method corresponding to the above description, or a training method of an intention recognition model, or an intention recognition method applied to a digital person, based on the same technical concept, is also provided in the embodiments of the present application.
In a specific embodiment, the computer readable storage medium provided in this embodiment is configured to store computer executable instructions, where the computer executable instructions when executed by a processor implement the following procedures:
acquiring a text to be identified;
performing intention classification processing on the text to be identified to obtain intention types of the text to be identified;
if the intention category is determined to be the appointed intention category, splicing the text to be identified and a preset template sentence to obtain a target text; the preset template sentences are used for representing intention prompt information;
inputting the target text into an intention recognition model to obtain an intention recognition result of the text to be recognized, wherein the intention recognition model is used for carrying out intention recognition processing on the text to be recognized based on intention prompt information.
In another specific embodiment, the computer readable storage medium provided in this embodiment is configured to store computer executable instructions, which when executed by a processor implement the following procedures:
Acquiring an initial training text; the intention category of the initial training text is a designated intention category;
splicing the initial training text and a preset template sentence to obtain a target training text; the preset template sentences are used for representing intention prompt information;
and inputting the target training text into the initial intention recognition model for iterative training to obtain the intention recognition model.
In yet another specific embodiment, the computer readable storage medium provided in this embodiment is configured to store computer executable instructions that, when executed by a processor, implement the following:
acquiring a text to be identified input by a user;
identifying the intention of the text to be identified according to the intention identification method described in the embodiment of each intention identification method, so as to obtain the intention of the user;
and acquiring target text corresponding to the user intention in the digital person system according to the user intention, and displaying the target text.
It should be noted that, in the present specification, an embodiment of the computer readable storage medium and an embodiment of the training method of the intention recognition method or the intention recognition model are based on the same inventive concept, so that a specific implementation of the embodiment may refer to an implementation of the foregoing corresponding method, and a repetition is omitted.
The foregoing describes specific embodiments of the present disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present embodiments may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present description can take the form of a computer program product on one or more computer-readable storage media (including, but not limited to, magnetic disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The present description is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the specification. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable 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 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 apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises an element.
Embodiments of the application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. One or more embodiments of the specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments.
The foregoing description is by way of example only and is not intended to limit the present disclosure. Various modifications and changes may occur to those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. that fall within the spirit and principles of the present document are intended to be included within the scope of the claims of the present document.

Claims (12)

1. An intent recognition method, comprising:
acquiring a text to be identified;
performing intention classification processing on the text to be identified to obtain the intention category of the text to be identified;
if the intention category is determined to be the appointed intention category, splicing the text to be identified and a preset template sentence to obtain a target text; the preset template statement is used for representing intention prompt information;
inputting the target text into an intention recognition model to obtain an intention recognition result of the text to be recognized, wherein the intention recognition model is used for carrying out intention recognition processing on the text to be recognized based on the intention prompt information.
2. The method of claim 1, wherein the preset template sentence is composed of a preset sentence pattern and a mask; the intention recognition model comprises a predictor model and a label determining module which are connected in sequence;
the predictor model is used for carrying out value prediction processing on the mask according to the target text to obtain a corresponding mask predicted value;
the tag determining module is configured to determine, according to a mask predicted value corresponding to the target text and a mapping relationship between a preconfigured mask value and an intention tag, a target intention tag having a mapping relationship with the mask predicted value, and determine the target intention tag as an intention recognition result of the text to be recognized.
3. The method according to claim 2, wherein the predictor model is specifically configured to:
determining the probability that the value of the mask is each preset mask value in a preset mask value set according to the target text, and obtaining the prediction probability corresponding to each preset mask value;
sorting each preset mask value according to the numerical value of the prediction probability to obtain a sorting result;
and based on the sorting result, determining a preset mask value with the highest numerical value of the prediction probability as a mask prediction value corresponding to the target text.
4. The method according to claim 1, wherein the performing the intention classification processing on the text to be identified to obtain the intention class of the text to be identified includes:
counting the number of the history texts included in a prestored history text set to obtain a first number;
determining the number of the historical texts belonging to the same intention as the text to be identified in the historical text set to obtain a second number;
determining the occurrence frequency of the intention corresponding to the text to be identified in the historical text set according to the first quantity and the second quantity to obtain a target frequency value;
And determining the intention category of the text to be identified according to the comparison result of the target frequency value and a preset frequency threshold value.
5. The method of claim 4, wherein determining, in the set of historical texts, a second number of historical texts belonging to the same intent as the text to be identified comprises:
calculating the similarity between the text to be identified and each historical text in the historical text set to obtain target similarity;
if the target similarity is greater than or equal to a preset similarity threshold, determining that the text to be identified and the historical text corresponding to the target similarity belong to the same intention;
and counting the number of the historical texts which belong to the same intention as the text to be identified, and obtaining the second number.
6. The method of claim 4, wherein the intent category of the text to be identified includes one of a non-long tail intent, an important long tail intent, and a non-important long tail intent; and determining the intention category of the text to be identified according to the comparison result of the target frequency value and a preset frequency threshold value. Comprising the following steps:
if the target frequency value is greater than or equal to a preset frequency threshold, determining that the intention type of the text to be identified is a non-long tail intention;
If the target frequency value is smaller than a preset frequency threshold, judging whether an importance parameter of the intention of the text to be identified is larger than or equal to a preset parameter threshold according to a business rule corresponding to the text to be identified; the importance parameter is used for representing the importance degree of the intention of the text to be identified;
if yes, determining the intention category of the text to be identified as an important long tail intention;
if not, determining the intention type of the text to be recognized as a non-important long tail intention.
7. The method according to any one of claims 1 to 6, wherein if the text to be recognized is a text input by a target user and the number of intention recognition results of the text to be recognized is a plurality of, performing the intention recognition processing on the target text input intention recognition model to obtain the intention recognition result of the text to be recognized, further includes:
feeding back intention confirmation information to the target user; the intention confirming information carries a plurality of intention identifying results;
receiving an intention selection instruction of the target user, and determining the intention selected by the intention selection instruction as a target intention;
and executing corresponding intention response operation according to the target intention.
8. A method of training an intent recognition model, comprising:
acquiring an initial training text; the intention category of the initial training text is a designated intention category;
splicing the initial training text and a preset template sentence to obtain a target training text; the preset template statement is used for representing intention prompt information;
and inputting the target training text into an initial intention recognition model for iterative training to obtain the intention recognition model.
9. An intention recognition method applied to a digital person, comprising:
acquiring a text to be identified input by a user;
identifying the intention of the text to be identified according to the intention identification method of any one of claims 1 to 7, resulting in a user intention;
and acquiring target text corresponding to the user intention in the digital person system according to the user intention, and displaying the target text.
10. An intent recognition device, comprising:
the first acquisition unit is used for acquiring the text to be identified;
the classifying unit is used for carrying out intention classifying treatment on the text to be recognized to obtain intention categories of the text to be recognized;
The first splicing unit is used for carrying out splicing processing on the text to be identified and a preset template sentence if the intention category is determined to be the appointed intention category, so as to obtain a target text; the preset template statement is used for representing intention prompt information;
the recognition unit is used for inputting the target text into an intention recognition model to obtain an intention recognition result of the text to be recognized, and the intention recognition model is used for carrying out intention recognition processing on the text to be recognized based on the intention prompt information.
11. An electronic device, comprising:
a processor; and a memory configured to store computer-executable instructions that, when executed, cause the processor to perform the intent recognition method as recited in any one of claims 1-7, or the training method of an intent recognition model as recited in claim 8, or the intent recognition method applied to a digital person as recited in claim 9.
12. A computer readable storage medium storing computer executable instructions which, when executed by a processor, implement the method of intent recognition as claimed in any one of claims 1 to 7, or the training method of an intent recognition model as claimed in claim 8, or the method of intent recognition applied to a digital person as claimed in claim 9.
CN202211029991.7A 2022-08-25 2022-08-25 Intention recognition method, device, electronic equipment and storage medium Pending CN117708266A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202211029991.7A CN117708266A (en) 2022-08-25 2022-08-25 Intention recognition method, device, electronic equipment and storage medium
PCT/CN2023/111242 WO2024041350A1 (en) 2022-08-25 2023-08-04 Intention recognition method and apparatus, electronic device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211029991.7A CN117708266A (en) 2022-08-25 2022-08-25 Intention recognition method, device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117708266A true CN117708266A (en) 2024-03-15

Family

ID=90012488

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211029991.7A Pending CN117708266A (en) 2022-08-25 2022-08-25 Intention recognition method, device, electronic equipment and storage medium

Country Status (2)

Country Link
CN (1) CN117708266A (en)
WO (1) WO2024041350A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118210926A (en) * 2024-05-21 2024-06-18 山东云海国创云计算装备产业创新中心有限公司 Text label prediction method and device, electronic equipment and storage medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11184298B2 (en) * 2019-08-28 2021-11-23 International Business Machines Corporation Methods and systems for improving chatbot intent training by correlating user feedback provided subsequent to a failed response to an initial user intent
CN112380861B (en) * 2020-11-13 2024-06-21 北京京东尚科信息技术有限公司 Model training method and device and intention recognition method and device
CN112989035B (en) * 2020-12-22 2023-08-15 深圳市中保信息技术有限公司 Method, device and storage medium for identifying user intention based on text classification
CN114357973B (en) * 2021-12-10 2023-04-07 马上消费金融股份有限公司 Intention recognition method and device, electronic equipment and storage medium
CN114528844B (en) * 2022-01-14 2024-09-06 中国平安人寿保险股份有限公司 Intention recognition method, device, computer equipment and storage medium
CN114757176B (en) * 2022-05-24 2023-05-02 上海弘玑信息技术有限公司 Method for acquiring target intention recognition model and intention recognition method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118210926A (en) * 2024-05-21 2024-06-18 山东云海国创云计算装备产业创新中心有限公司 Text label prediction method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
WO2024041350A1 (en) 2024-02-29

Similar Documents

Publication Publication Date Title
US12014379B2 (en) Automating communications using an intent classifier
CN112632961B (en) Natural language understanding processing method, device and equipment based on context reasoning
CN111737411A (en) Response method in man-machine conversation, conversation system and storage medium
US11875125B2 (en) System and method for designing artificial intelligence (AI) based hierarchical multi-conversation system
CN112948534A (en) Interaction method and system for intelligent man-machine conversation and electronic equipment
CN102549654A (en) Speech translation system, control apparatus and control method
JP7488871B2 (en) Dialogue recommendation method, device, electronic device, storage medium, and computer program
CN113094481A (en) Intention recognition method and device, electronic equipment and computer readable storage medium
CN116863935B (en) Speech recognition method, device, electronic equipment and computer readable medium
CN112509562A (en) Method, apparatus, electronic device and medium for text post-processing
CN112052316B (en) Model evaluation method and device, storage medium and electronic equipment
WO2024041350A1 (en) Intention recognition method and apparatus, electronic device, and storage medium
CN115129878A (en) Conversation service execution method, device, storage medium and electronic equipment
CN116933800B (en) Template-based generation type intention recognition method and device
JP7182584B2 (en) A method for outputting information of parsing anomalies in speech comprehension
CN111339770B (en) Method and device for outputting information
CN115114281A (en) Query statement generation method and device, storage medium and electronic equipment
CN112632241A (en) Method, device, equipment and computer readable medium for intelligent conversation
CN117972222B (en) Enterprise information retrieval method and device based on artificial intelligence
US20220138427A1 (en) System and method for providing voice assistant service regarding text including anaphora
CN117933387A (en) Dialogue data generation method, dialogue data generation system, model training method and dialogue processing method
Hunt et al. Artificial Intelligence for Customer Experience and Care
CN117453273A (en) Intelligent program code complement method and device
NZ785406A (en) System and method for designing artificial intelligence (ai) based hierarchical multi-conversation system
CN116304317A (en) Dialogue recommendation model training method, dialogue recommendation method, device and equipment

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