Generative model-based intention recognition method and system, and storage medium

By pre-training the generative model through semantic matching and concatenated text input, and combining multi-layer attention mechanism and feedforward neural network calculation, the parameters of the generative model are optimized, which solves the problem of low intent recognition accuracy and achieves higher intent recognition accuracy.

CN119443113AActive Publication Date: 2025-02-14GUANGXI GUIYUNTONG TECH CO LTD

Patent Information

Application Number
CN202411523056.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2025-02-14
Estimated Expiration
2044-10-29

AI Technical Summary

Technical Problem

Existing intent recognition methods suffer from low accuracy and fail to effectively understand the true needs of users when interacting with computer systems.

Method used

By semantically matching the text to be identified with a corpus of samples, similar samples are identified and concatenated. A pre-trained generative model is used for intent classification. The parameters of the generative model are optimized by combining a multi-layer attention mechanism and a feedforward neural network to improve the accuracy of intent recognition.

Benefits of technology

It improves the accuracy of intent recognition, enabling better identification of user intent categories and enhancing the system's response precision.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119443113A_ABST
    Figure CN119443113A_ABST
Patent Text Reader

Abstract

The invention provides an intention recognition method and system based on a generative model and a storage medium, and the method comprises the steps: carrying out the semantic matching of a to-be-recognized text and a corpus sample library, and obtaining a semantic similarity; determining similar samples in a corpus sample library according to the semantic similarity, and splicing the similar samples and the to-be-recognized text to obtain a spliced text; the spliced text is input into a pre-trained generation model for intention classification, an intention classification result is obtained, and a target sample in the spliced text is determined according to the intention classification result; and determining the intention category of the to-be-recognized text according to the intention code of the target sample. According to the embodiment of the invention, a plurality of texts with intention codes, which are similar to the semantics of the to-be-recognized texts, are input into the pre-trained generation model together, so that the generation model can better recognize the semantic information of the to-be-recognized texts, and the intention recognition accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of speech recognition technology, and in particular to a method, system and storage medium for intention recognition based on a generative model. Background Art

[0002] Intent recognition is a natural language processing technology that aims to understand the real needs or purposes expressed by users when interacting with computer systems, applications or smart devices. Specifically, the computer device identifies the user's intent category from the user's input information (such as text, voice commands, etc.), so that the system can provide more accurate responses or services that meet the user's expectations. With the increasing richness of business scenarios and the gradual popularization of big data, user needs often show characteristics such as diversity and continuity, which makes the issue of user intent recognition accuracy increasingly important.

[0003] In the existing intent recognition process, the text to be recognized is generally directly classified for intent, resulting in low intent recognition accuracy. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide a method, system and storage medium for intent recognition based on a generative model to solve the problem of low accuracy of intent recognition in the prior art.

[0005] The embodiment of the present invention is implemented as follows: a method for identifying intentions based on a generative model, the method comprising:

[0006] Acquire a text to be recognized, and perform semantic matching between the text to be recognized and a corpus sample library to obtain semantic similarity;

[0007] Determine similar samples in the corpus sample library according to the semantic similarity, and concatenate the similar samples with the text to be recognized to obtain a concatenated text;

[0008] Inputting the concatenated text into a pre-trained generative model for intent classification to obtain an intent classification result, and determining a target sample in the concatenated text according to the intent classification result;

[0009] The intent category of the text to be recognized is determined according to the intent encoding of the target sample.

[0010] Preferably, before inputting the concatenated text into the pre-trained generative model for intent classification, the method further includes:

[0011] Generating text for the training sample according to the generative model to obtain generated text, and performing word embedding processing on the generated text to obtain a word vector;

[0012] Performing a multi-layer attention mechanism calculation on the word vector to obtain an attention feature, and performing a feedforward neural network calculation on the attention feature to obtain a feedforward calculation feature;

[0013] Performing full connection processing on the feedforward calculation features to obtain predicted intention features, and performing classification prediction on the predicted intention features to obtain intention prediction classification;

[0014] The model loss is determined according to the intent prediction classification and the predicted intent features, and the parameters of the generative model are updated according to the model loss until the generative model converges to obtain the pre-trained generative model.

[0015] Preferably, word embedding processing is performed on the generated text to obtain a word vector, and then the following steps are further included:

[0016] Performing global feature extraction on the word vector to obtain global text features, and performing full connection processing on the global text features to obtain the predicted intent features;

[0017] Performing classification prediction on the predicted intent features to obtain the intent prediction classification, and determining the model loss according to the intent prediction classification;

[0018] The parameters of the generative model are updated according to the model loss until the generative model converges to obtain the pre-trained generative model.

[0019] Preferably, performing global feature extraction on the word vector to obtain global features of the text includes:

[0020] Obtain an update gate weight matrix and a reset gate weight matrix, and perform a gate operation on the word vector according to the update gate weight matrix and the reset gate weight matrix to obtain a first time step degree and a second time step degree;

[0021] Obtaining a hidden weight matrix, and calculating a hidden state relationship according to the hidden weight matrix, the first time step degree and the second time step degree;

[0022] Feature mapping is performed on the word vector according to the hidden state relationship to obtain the global feature of the text.

[0023] Preferably, determining the target sample in the concatenated text according to the intention classification result includes:

[0024] Input the text to be recognized into the pre-trained generation model for intent classification to obtain a first intent label, and obtain the sample label of the similar sample to obtain a second intent label;

[0025] Obtaining the intent label in the intent classification result to obtain a third intent label, and mapping the first intent label, the second intent label, and the third intent label according to a preset mapping relationship to obtain a first label mapping, a second label mapping, and a third label mapping;

[0026] Calculating the similarity between the first label mapping and the third label mapping to obtain a first similarity, and calculating the similarity between the second label mapping and the third label mapping to obtain a second similarity;

[0027] For the same concatenated text, weighted operation is performed on the first similarity and the second similarity to obtain a total similarity, and the concatenated text corresponding to the maximum total similarity is determined as a preferred text;

[0028] The similar sample in the preferred text is determined as the target sample.

[0029] Preferably, determining the model loss according to the intent prediction classification and the predicted intent feature includes:

[0030] Calculating the loss between the standard intent classification and the predicted intent classification to obtain a first loss, and calculating the loss between the standard intent feature and the predicted intent feature to obtain a second loss;

[0031] A weighted operation is performed on the first loss and the second loss to obtain the model loss.

[0032] Preferably, semantic matching is performed between the text to be recognized and the corpus sample library to obtain semantic similarity, including:

[0033] Acquire text features of the text to be recognized and the corpus sample in the corpus sample library to obtain a first text feature and a second text feature;

[0034] The first text feature and the second text feature are vector-converted to obtain a first text vector and a second text vector, and the similarity between the first text vector and the second text vector is calculated to obtain the semantic similarity.

[0035] Another object of an embodiment of the present invention is to provide an intention recognition system based on a generative model, the system comprising:

[0036] A semantic matching module is used to obtain a text to be recognized, and to perform semantic matching between the text to be recognized and a corpus sample library to obtain semantic similarity;

[0037] A text splicing module, used for determining similar samples in the corpus sample library according to the semantic similarity, and splicing the similar samples with the text to be recognized to obtain a spliced ​​text;

[0038] An intention classification module is used to input the concatenated text into a pre-trained generation model for intention classification, obtain an intention classification result, and determine a target sample in the concatenated text according to the intention classification result;

[0039] The intention recognition module is used to determine the intention category of the text to be recognized according to the intention code of the target sample.

[0040] Preferably, the intention classification module is also used for:

[0041] Generating text for the training sample according to the generative model to obtain generated text, and performing word embedding processing on the generated text to obtain a word vector;

[0042] Performing a multi-layer attention mechanism calculation on the word vector to obtain an attention feature, and performing a feedforward neural network calculation on the attention feature to obtain a feedforward calculation feature;

[0043] Performing full connection processing on the feedforward calculation features to obtain predicted intention features, and performing classification prediction on the predicted intention features to obtain intention prediction classification;

[0044] The model loss is determined according to the intent prediction classification and the predicted intent features, and the parameters of the generative model are updated according to the model loss until the generative model converges to obtain the pre-trained generative model.

[0045] In an embodiment of the present invention, by semantically matching the text to be recognized with a corpus sample library, the semantic similarity between the text to be recognized and the corpus sample can be effectively calculated, and similar samples in the corpus sample library can be effectively determined based on the semantic similarity. By splicing similar samples with the text to be recognized, texts with similar semantics to the text to be recognized can be effectively combined to obtain a spliced ​​text. By inputting the spliced ​​text into a pre-trained generation model for intent classification, the intent classification result of the spliced ​​text can be effectively obtained. Based on the intent classification result, the target sample in the spliced ​​text can be effectively determined, and based on the intent coding of the target sample, the intent category of the text to be recognized can be effectively determined. In this embodiment, by inputting multiple texts with intent coding that are semantically similar to the text to be recognized into a pre-trained generation model together, the generation model can better recognize the semantic information of the text to be recognized, thereby improving the accuracy of intent recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 is a flow chart of the intention recognition method based on the generative model provided by the first embodiment of the present invention;

[0047] Figure 2is a schematic diagram of the structure of an intention recognition system based on a generative model provided in a second embodiment of the present invention;

[0048] Figure 3 It is a schematic diagram of the structure of a terminal device provided in the third embodiment of the present invention. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0050] In order to illustrate the technical solution of the present invention, a specific embodiment is provided below for illustration.

[0051] Embodiment 1

[0052] See also Figure 1 , is a flow chart of a method for identifying intentions based on a generative model provided in a first embodiment of the present invention. The method for identifying intentions based on a generative model can be applied to any device or system. The method for identifying intentions based on a generative model comprises the following steps:

[0053] Step S10, obtaining a text to be recognized, and performing semantic matching between the text to be recognized and a corpus sample library to obtain semantic similarity;

[0054] Among them, given corpus sample library:

[0055] D={(d0, l0), (d1, l1),..., (d n-1 , l n-1 )}

[0056] d0 represents the oth corpus sample in D, and l0 represents the intention encoding of the oth corpus sample in D. In this step, the semantic similarity between the text to be recognized and the corpus sample library is calculated by semantically matching the text to be recognized with the corpus sample library.

[0057] Optionally, semantic matching is performed between the text to be recognized and the corpus sample library to obtain semantic similarity, including:

[0058] Acquire text features of the text to be recognized and the corpus sample in the corpus sample library to obtain a first text feature and a second text feature; wherein the text features include word frequency, word embedding, syntactic features, text statistical features, etc.;

[0059] The first text feature and the second text feature are vectorized to obtain a first text vector and a second text vector, and the similarity between the first text vector and the second text vector is calculated to obtain the semantic similarity; wherein, by performing vectorization on the first text feature and the second text feature, the text features can be effectively vectorized to obtain the first text vector and the second text vector.

[0060] Specifically, in this step, for each corpus sample in D, the corresponding vector representation is obtained, which is:

[0061]

[0062] Among them, E is the second text vector, e i is the i-th corpus sample d i The corresponding representation vector, M gen It is a generative model, and embedding is the embedding layer in the generative model.

[0063] Calculate the semantic similarity between the text to be recognized t and the corpus sample:

[0064]

[0065]

[0066] Among them, sim i is the semantic similarity between the text to be identified t and the i-th corpus sample, e t It is the second text vector corresponding to the text to be recognized t.

[0067] Step S20, determining similar samples in the corpus sample library according to the semantic similarity, and concatenating the similar samples with the text to be recognized to obtain a concatenated text;

[0068] Among them, corpus samples with semantic similarity greater than the similarity threshold are determined as similar samples. The similarity threshold can be set according to needs. By splicing similar samples and the text to be recognized, multiple texts with intentional encodings that are semantically similar to the text to be recognized can be effectively combined to obtain a spliced ​​text.

[0069] Specifically, in this step, k samples with the highest semantic similarity to the text to be recognized t are selected from D to obtain similar samples, and C = {(d0, l0)…(d k-1 , l k-1 )} represents the set of k similar samples with the highest similarity selected from D. The similar samples in C and the text to be recognized t are concatenated into a character sequence according to the preset format. The concatenated text I can be specifically expressed as:

[0070] Example 1: d0\tl0\n, Example 2: d1\tl1\n…\n, Example k: d k-1 \tl k-1 \nt.

[0071] Step S30, inputting the concatenated text into the pre-trained generation model for intent classification to obtain an intent classification result, and determining a target sample in the concatenated text according to the intent classification result;

[0072] Among them, by inputting the spliced ​​text into the pre-trained generative model for intent classification, multiple texts with intent encoding that are semantically similar to the text to be recognized can be effectively input into the pre-trained generative model together, which can enable the generative model to better recognize the semantic information of the text to be recognized and improve the accuracy of intent recognition.

[0073] Optionally, before inputting the concatenated text into the pre-trained generative model for intent classification, the method further includes:

[0074] Generating text for the training sample according to the generative model to obtain generated text, and performing word embedding processing on the generated text to obtain word vectors; wherein, by performing word embedding processing on the generated text, the word vectors in the generated text can be effectively extracted;

[0075] Performing multi-layer attention mechanism calculation on the word vector to obtain attention features, and performing feedforward neural network calculation on the attention features to obtain feedforward calculation features; wherein, by performing multi-layer attention mechanism calculation on the word vector, the semantic correlation between the word vectors can be effectively obtained, and by feedforward calculation, features can be extracted from different spaces, which effectively improves the representation effect of the output vector;

[0076] The feedforward calculation features are fully connected to obtain predicted intent features, and the predicted intent features are classified and predicted to obtain intent prediction classifications; wherein, by fully connecting the feedforward calculation features, the feedforward calculation features can be effectively combined to obtain predicted intent features, and the predicted intent features are classified and predicted to obtain intent prediction classifications representing classification results corresponding to the concatenated text;

[0077] The model loss is determined according to the intent prediction classification and the predicted intent features, and the parameters of the generative model are updated according to the model loss until the generative model converges to obtain the pre-trained generative model; wherein, by determining the model loss, the parameter update of the generative model is effectively guaranteed, the accuracy of the generative model is improved, and the pre-trained generative model can effectively perform intent recognition.

[0078] Further, word embedding processing is performed on the generated text to obtain a word vector, and then the following steps are further included:

[0079] Performing global feature extraction on the word vector to obtain global features of the text, and performing full connection processing on the global features of the text to obtain the predicted intention features; wherein, by performing global feature extraction on the word vector, the global features of the text of the generated text can be effectively obtained;

[0080] Performing classification prediction on the predicted intent features to obtain the intent prediction classification, and determining the model loss according to the intent prediction classification;

[0081] The parameters of the generative model are updated according to the model loss until the generative model converges to obtain the pre-trained generative model.

[0082] Furthermore, global features are extracted from the word vector to obtain global features of the text, including:

[0083] Obtain an update gate weight matrix and a reset gate weight matrix, and perform a gate operation on the word vector according to the update gate weight matrix and the reset gate weight matrix to obtain the first time step degree and the second time step degree; wherein the update gate weight matrix and the reset gate weight matrix can be set according to demand, and the gate operation on the word vector can be performed by updating the gate weight matrix and resetting the gate weight matrix, so as to effectively obtain the influence degree between the current time step and the previous time step;

[0084] Obtain a hidden weight matrix, calculate a hidden state relationship according to the hidden weight matrix, the first time step degree and the second time step degree, perform feature mapping on the word vector according to the hidden state relationship, and obtain the global feature of the text, wherein the hidden weight matrix can be set according to demand, and by calculating the hidden state relationship, the word vector can be effectively feature mapped to obtain the global feature of the text that retains the hidden relationship, thereby improving the accuracy of the global feature of the text.

[0085] Preferably, determining the target sample in the concatenated text according to the intention classification result includes:

[0086] Input the text to be recognized into the pre-trained generative model for intent classification to obtain a first intent label, and obtain the sample label of the similar sample to obtain a second intent label; wherein, by inputting the text to be recognized into the pre-trained generative model for intent classification, the text to be recognized can be effectively classified for intent to obtain the first intent label;

[0087] Obtaining the intent label in the intent classification result, obtaining a third intent label, and mapping the first intent label, the second intent label, and the third intent label according to a preset mapping relationship, to obtain a first label mapping, a second label mapping, and a third label mapping; wherein, by mapping the first intent label, the second intent label, and the third intent label, the first intent label, the second intent label, and the third intent label can be effectively mapped to representations within a specified area, to obtain a first label mapping, a second label mapping, and a third label mapping;

[0088] Calculating the similarity between the first label mapping and the third label mapping to obtain a first similarity, and calculating the similarity between the second label mapping and the third label mapping to obtain a second similarity;

[0089] For the same concatenated text, a weighted operation is performed on the first similarity and the second similarity to obtain a total similarity, and the concatenated text corresponding to the maximum total similarity is determined as a preferred text, and the similar sample in the preferred text is determined as the target sample; wherein, when the total similarity is larger, the semantics between the text to be recognized and the similar text in the corresponding concatenated text are closer, therefore, the concatenated text corresponding to the maximum total similarity is determined as a preferred text, and the similar sample in the preferred text is the target sample closest to the text to be recognized.

[0090] In this embodiment, determining the model loss according to the intent prediction classification and the predicted intent feature includes:

[0091] Calculating the loss between the standard intent classification and the predicted intent classification to obtain a first loss, and calculating the loss between the standard intent feature and the predicted intent feature to obtain a second loss;

[0092] The first loss and the second loss are weightedly calculated to obtain the model loss; wherein, during the weighted calculation process, the weighting coefficients of the first loss and the second loss can be set according to demand, and the accuracy of the model loss is effectively improved by performing weighted calculation on the first loss and the second loss.

[0093] Step S40, determining the intent category of the to-be-recognized text according to the intent coding of the target sample;

[0094] The intent code is matched with the intent query table to obtain the intent category. The intent query table stores the correspondence between different intent codes and corresponding intent categories. In this step, the formulas used to obtain the intent code corresponding to the text t to be recognized include:

[0095] l t =M gen (I)

[0096] Among them, l t and is the intent category of the text to be recognized, l t ∈C.

[0097] In this embodiment, by semantically matching the text to be recognized with the corpus sample library, the semantic similarity between the text to be recognized and the corpus sample can be effectively calculated, and based on the semantic similarity, similar samples in the corpus sample library can be effectively determined. By splicing similar samples with the text to be recognized, texts with similar semantics to the text to be recognized can be effectively combined to obtain a spliced ​​text. By inputting the spliced ​​text into a pre-trained generation model for intent classification, the intent classification result of the spliced ​​text can be effectively obtained. Based on the intent classification result, the target sample in the spliced ​​text can be effectively determined. Based on the intent coding of the target sample, the intent category of the text to be recognized can be effectively determined. In this embodiment, by inputting multiple texts with intent coding that are semantically similar to the text to be recognized into the pre-trained generation model together, the generation model can better recognize the semantic information of the text to be recognized, thereby improving the accuracy of intent recognition.

[0098] Embodiment 2

[0099] See also Figure 2 , is a schematic diagram of the structure of the intention recognition system 100 based on the generative model provided in the second embodiment of the present invention, including:

[0100] The semantic matching module 10 is used to obtain the text to be recognized, and perform semantic matching between the text to be recognized and the corpus sample library to obtain semantic similarity.

[0101] Optionally, the semantic matching module 10 is further used to: obtain text features of the text to be recognized and the corpus sample in the corpus sample library to obtain a first text feature and a second text feature;

[0102] The first text feature and the second text feature are vector-converted to obtain a first text vector and a second text vector, and the similarity between the first text vector and the second text vector is calculated to obtain the semantic similarity.

[0103] The text concatenation module 11 is used to determine similar samples in the corpus sample library according to the semantic similarity, and concatenate the similar samples with the text to be recognized to obtain a concatenated text.

[0104] The intention classification module 12 is used to input the concatenated text into the pre-trained generation model for intention classification, obtain the intention classification result, and determine the target sample in the concatenated text according to the intention classification result.

[0105] Optionally, the intention classification module 12 is further used for:

[0106] Generating text for the training sample according to the generative model to obtain generated text, and performing word embedding processing on the generated text to obtain a word vector;

[0107] Performing a multi-layer attention mechanism calculation on the word vector to obtain an attention feature, and performing a feedforward neural network calculation on the attention feature to obtain a feedforward calculation feature;

[0108] Performing full connection processing on the feedforward calculation features to obtain predicted intention features, and performing classification prediction on the predicted intention features to obtain intention prediction classification;

[0109] The model loss is determined according to the intent prediction classification and the predicted intent features, and the parameters of the generative model are updated according to the model loss until the generative model converges to obtain the pre-trained generative model.

[0110] Furthermore, the intention classification module 12 is also used to: perform global feature extraction on the word vector to obtain text global features, and perform full connection processing on the text global features to obtain the predicted intention features;

[0111] Performing classification prediction on the predicted intent features to obtain the intent prediction classification, and determining the model loss according to the intent prediction classification;

[0112] The parameters of the generative model are updated according to the model loss until the generative model converges to obtain the pre-trained generative model.

[0113] Furthermore, the intention classification module 12 is further used to: obtain an update gate weight matrix and a reset gate weight matrix, and perform a gate operation on the word vector according to the update gate weight matrix and the reset gate weight matrix to obtain a first time step degree and a second time step degree;

[0114] Obtaining a hidden weight matrix, and calculating a hidden state relationship according to the hidden weight matrix, the first time step degree and the second time step degree;

[0115] Feature mapping is performed on the word vector according to the hidden state relationship to obtain the global feature of the text.

[0116] Preferably, the intention classification module 12 is further used to: input the text to be recognized into the pre-trained generation model for intention classification to obtain a first intention label, and obtain the sample label of the similar sample to obtain a second intention label;

[0117] Obtaining the intent label in the intent classification result to obtain a third intent label, and mapping the first intent label, the second intent label, and the third intent label according to a preset mapping relationship to obtain a first label mapping, a second label mapping, and a third label mapping;

[0118] Calculating the similarity between the first label mapping and the third label mapping to obtain a first similarity, and calculating the similarity between the second label mapping and the third label mapping to obtain a second similarity;

[0119] For the same concatenated text, weighted operation is performed on the first similarity and the second similarity to obtain a total similarity, and the concatenated text corresponding to the maximum total similarity is determined as a preferred text;

[0120] The similar sample in the preferred text is determined as the target sample.

[0121] In this embodiment, the intent classification module 12 is further used to: calculate the loss between the intent standard classification and the intent prediction classification to obtain a first loss, and calculate the loss between the standard intent feature and the predicted intent feature to obtain a second loss;

[0122] A weighted operation is performed on the first loss and the second loss to obtain the model loss.

[0123] The intention recognition module 13 is used to determine the intention category of the text to be recognized according to the intention code of the target sample.

[0124] In this embodiment, by semantically matching the text to be recognized with the corpus sample library, the semantic similarity between the text to be recognized and the corpus sample can be effectively calculated, and based on the semantic similarity, similar samples in the corpus sample library can be effectively determined. By splicing similar samples with the text to be recognized, texts with similar semantics to the text to be recognized can be effectively combined to obtain a spliced ​​text. By inputting the spliced ​​text into a pre-trained generation model for intent classification, the intent classification result of the spliced ​​text can be effectively obtained. Based on the intent classification result, the target sample in the spliced ​​text can be effectively determined. Based on the intent coding of the target sample, the intent category of the text to be recognized can be effectively determined. In this embodiment, by inputting multiple texts with intent coding that are semantically similar to the text to be recognized into the pre-trained generation model together, the generation model can better recognize the semantic information of the text to be recognized, thereby improving the accuracy of intent recognition.

[0125] Embodiment 3

[0126] Figure 3 2 is a block diagram of a terminal device 2 provided in the third embodiment of the present application. Figure 3As shown, the terminal device 2 of this embodiment includes: a processor 20, a memory 21, and a computer program 22 stored in the memory 21 and executable on the processor 20, such as a program of the intent recognition method based on the generative model. When the processor 20 executes the computer program 22, the steps in each embodiment of the intent recognition method based on the generative model are implemented.

[0127] Exemplarily, the computer program 22 may be divided into one or more modules, which are stored in the memory 21 and executed by the processor 20 to complete the present application. The one or more modules may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 22 in the terminal device 2. The terminal device may include, but is not limited to, a processor 20 and a memory 21.

[0128] The processor 20 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0129] The memory 21 may be an internal storage unit of the terminal device 2, such as a hard disk or memory of the terminal device 2. The memory 21 may also be an external storage device of the terminal device 2, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 2. Further, the memory 21 may also include both an internal storage unit and an external storage device of the terminal device 2. The memory 21 is used to store the computer program and other programs and data required by the terminal device. The memory 21 may also be used to temporarily store data that has been output or is to be output.

[0130] In addition, each functional module in each embodiment of the present application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional unit.

[0131] If the integrated module is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Among them, the computer-readable storage medium can be non-volatile or volatile. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in computer-readable storage media can be appropriately increased or decreased according to the requirements of legislation and patent practices in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practices, computer-readable storage media do not include electrical carrier signals and telecommunication signals.

[0132] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A method for intention recognition based on a generative model, characterized in that: The method comprises: Acquire a text to be recognized, and perform semantic matching between the text to be recognized and a corpus sample library to obtain semantic similarity; Determine similar samples in the corpus sample library according to the semantic similarity, and concatenate the similar samples with the text to be recognized to obtain a concatenated text; Inputting the concatenated text into a pre-trained generative model for intent classification to obtain an intent classification result, and determining a target sample in the concatenated text according to the intent classification result; The intent category of the text to be recognized is determined according to the intent encoding of the target sample.

2. The method for intention recognition based on a generative model as claimed in claim 1, characterized in that: Before inputting the concatenated text into the pre-trained generative model for intent classification, the method further includes: Generating text for the training sample according to the generative model to obtain generated text, and performing word embedding processing on the generated text to obtain a word vector; Performing a multi-layer attention mechanism calculation on the word vector to obtain an attention feature, and performing a feedforward neural network calculation on the attention feature to obtain a feedforward calculation feature; Performing full connection processing on the feedforward calculation features to obtain predicted intention features, and performing classification prediction on the predicted intention features to obtain intention prediction classification; The model loss is determined according to the intent prediction classification and the predicted intent features, and the parameters of the generative model are updated according to the model loss until the generative model converges to obtain the pre-trained generative model.

3. The method for intention recognition based on a generative model as claimed in claim 2, characterized in that: The generated text is subjected to word embedding processing to obtain a word vector, and then the following steps are further included: Performing global feature extraction on the word vector to obtain global text features, and performing full connection processing on the global text features to obtain the predicted intent features; Performing classification prediction on the predicted intent features to obtain the intent prediction classification, and determining the model loss according to the intent prediction classification; The parameters of the generative model are updated according to the model loss until the generative model converges to obtain the pre-trained generative model.

4. The method for intention recognition based on a generative model as claimed in claim 3, characterized in that: Perform global feature extraction on the word vector to obtain global features of the text, including: Obtain an update gate weight matrix and a reset gate weight matrix, and perform a gate operation on the word vector according to the update gate weight matrix and the reset gate weight matrix to obtain a first time step degree and a second time step degree; Obtaining a hidden weight matrix, and calculating a hidden state relationship according to the hidden weight matrix, the first time step degree and the second time step degree; Feature mapping is performed on the word vector according to the hidden state relationship to obtain the global feature of the text.

5. The method for intention recognition based on a generative model as claimed in claim 1, characterized in that: Determining a target sample in the concatenated text according to the intent classification result includes: Input the text to be recognized into the pre-trained generation model for intent classification to obtain a first intent label, and obtain the sample label of the similar sample to obtain a second intent label; Obtaining the intent label in the intent classification result to obtain a third intent label, and mapping the first intent label, the second intent label, and the third intent label according to a preset mapping relationship to obtain a first label mapping, a second label mapping, and a third label mapping; Calculating the similarity between the first label mapping and the third label mapping to obtain a first similarity, and calculating the similarity between the second label mapping and the third label mapping to obtain a second similarity; For the same concatenated text, weighted operation is performed on the first similarity and the second similarity to obtain a total similarity, and the concatenated text corresponding to the maximum total similarity is determined as a preferred text; The similar sample in the preferred text is determined as the target sample.

6. The method for intention recognition based on a generative model as claimed in claim 2, characterized in that: Determining a model loss according to the intent prediction classification and the predicted intent feature includes: Calculating the loss between the standard intent classification and the predicted intent classification to obtain a first loss, and calculating the loss between the standard intent feature and the predicted intent feature to obtain a second loss; A weighted operation is performed on the first loss and the second loss to obtain the model loss.

7. The method for intention recognition based on a generative model as claimed in claim 1, characterized in that: Semantically matching the text to be recognized with the corpus sample library to obtain semantic similarity includes: Acquire text features of the text to be recognized and the corpus sample in the corpus sample library to obtain a first text feature and a second text feature; The first text feature and the second text feature are vector-converted to obtain a first text vector and a second text vector, and the similarity between the first text vector and the second text vector is calculated to obtain the semantic similarity.

8. An intention recognition system based on a generative model, characterized in that: The system comprises: A semantic matching module is used to obtain a text to be recognized, and to perform semantic matching between the text to be recognized and a corpus sample library to obtain semantic similarity; A text splicing module, used for determining similar samples in the corpus sample library according to the semantic similarity, and splicing the similar samples with the text to be recognized to obtain a spliced ​​text; An intention classification module is used to input the concatenated text into a pre-trained generation model for intention classification, obtain an intention classification result, and determine a target sample in the concatenated text according to the intention classification result; The intention recognition module is used to determine the intention category of the text to be recognized according to the intention code of the target sample.

9. The intention recognition system based on generative model as claimed in claim 8, characterized in that: The intent classification module is also used to: Generating text for the training sample according to the generative model to obtain generated text, and performing word embedding processing on the generated text to obtain a word vector; Performing a multi-layer attention mechanism calculation on the word vector to obtain an attention feature, and performing a feedforward neural network calculation on the attention feature to obtain a feedforward calculation feature; Performing full connection processing on the feedforward calculation features to obtain predicted intention features, and performing classification prediction on the predicted intention features to obtain intention prediction classification; The model loss is determined according to the intent prediction classification and the predicted intent features, and the parameters of the generative model are updated according to the model loss until the generative model converges to obtain the pre-trained generative model.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • User intention recognition method and device based on outbound robot, and electronic equipment

    CN116303890A

  • Intention recognition method and apparatus, electronic device, and storage medium

    WO2024041350A1

Cited By

  • Request intention recognition method and device, equipment, medium and computer program product

    CN119782827A