An intent recognition method, device, apparatus and medium

CN117520537BActive Publication Date: 2026-08-21HISENSE GRP HLDG CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210910818.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-29
Publication Date
2026-08-21
Estimated Expiration
2042-07-29

AI Technical Summary

Technical Problem

[0004]本申请提供了一种意图识别方法、装置、设备及介质,用以解决现有技术中意图识别的准确率不高,影响用户体验的问题

Benefits of technology

[0013]本申请实施例中,获得控制文本,并确定控制文本对应的文本矩阵,将文本矩阵输入到预先训练完成的意图识别模型中,基于文本矩阵以及预设数量个特征提取方法,分别对文本矩阵进行特征提取操作,确定预设数量个特征矩阵,将预设数量个对应的特征矩阵进行拼接,确定目标特征矩阵,基于目标特征矩阵进行意图分类,确定控制文本对应的预测意图。由于本申请实施例中,将控制文本对应的文本矩阵输入到意图识别模型中之后,该意图识别模型会基于预设数量个特征提取方法,分别对该文本矩阵进行特征提取操作,获得预设数量个特征矩阵,相比于现有技术中只基于一个特征提取方法对文本矩阵进行特征提取操作来说,本申请基于预设数量个特征提取方法提取的特征更准确,有效的提高了意图识别模型识别意图的准确率,提高了用户的体验。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117520537B_ABST
    Figure CN117520537B_ABST
Patent Text Reader

Abstract

The application discloses an intention recognition method, device, equipment and medium. In the embodiment of the application, after a text matrix corresponding to a control text is input into an intention recognition model, the intention recognition model performs feature extraction operations on the text matrix based on a preset number of feature extraction methods, and a preset number of feature matrices are obtained. Compared with the prior art in which only one feature extraction method is used to perform a feature extraction operation on a text matrix, the features extracted based on the preset number of feature extraction methods are more accurate, which effectively improves the accuracy of the intention recognition model in identifying an intention and improves the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of deep learning technology, and in particular to an intent recognition method, apparatus, device, and medium. Background Technology

[0002] When using a smart device, the user sends control text to the electronic device. The electronic device recognizes the corresponding intent based on the control text and sends the corresponding operation instruction to the smart device so that the smart device can perform the corresponding operation based on the operation instruction. The smart device can be a smart refrigerator, a smart washing machine, a smart TV, etc. The control text may correspond to one intent or multiple intents. For example, the control text "turn on the air conditioner switch" only corresponds to the intent "turn on the air conditioner", while the control text "turn on the air conditioner and adjust the temperature to 26 degrees" corresponds to both the intent "turn on the air conditioner" and the intent "adjust the temperature to 26 degrees".

[0003] To identify the intent corresponding to control text, pre-trained intent recognition models already exist in related technologies. However, when performing intent recognition on control text, these models often rely on only one feature extraction method, resulting in low accuracy. This can easily lead to inaccurate intent recognition, such as mismatch between the identified intent and the actual intent, or the inability to recognize only a portion of the intent for control text with multiple intents. Consequently, the accuracy of intent recognition is low, impacting the user experience. Summary of the Invention

[0004] This application provides an intent recognition method, apparatus, device, and medium to solve the problem that the accuracy of intent recognition in the prior art is not high, which affects the user experience.

[0005] This application provides an intent recognition method, the method comprising:

[0006] Obtain the control text and determine the text matrix corresponding to the control text;

[0007] The text matrix is ​​input into a pre-trained intent recognition model. Based on the text matrix and a preset number of feature extraction methods, feature extraction operations are performed on the text matrix to determine the preset number of feature matrices. The preset number of corresponding feature matrices are concatenated to determine the target feature matrix. Intent classification is performed based on the target feature matrix to determine the predicted intent corresponding to the control text.

[0008] This application embodiment also provides an intent recognition device, the device comprising:

[0009] A determination module is used to obtain control text and determine the text matrix corresponding to the control text;

[0010] The processing module is used to input the text matrix into a pre-trained intent recognition model, perform feature extraction operations on the text matrix based on the text matrix and a preset number of feature extraction methods, determine the preset number of feature matrices, concatenate the preset number of corresponding feature matrices to determine the target feature matrix, and perform intent classification based on the target feature matrix to determine the predicted intent corresponding to the control text.

[0011] This application also provides an electronic device, which includes a processor for executing a computer program stored in a memory to implement the steps of any of the above-described intent recognition methods.

[0012] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of any of the intent recognition methods described above.

[0013] In this embodiment, control text is obtained, and the corresponding text matrix is ​​determined. The text matrix is ​​then input into a pre-trained intent recognition model. Based on the text matrix and a preset number of feature extraction methods, feature extraction operations are performed on the text matrix to determine a preset number of feature matrices. These preset number of corresponding feature matrices are then concatenated to determine the target feature matrix. Intent classification is performed based on the target feature matrix to determine the predicted intent corresponding to the control text. In this embodiment, after the text matrix corresponding to the control text is input into the intent recognition model, the model performs feature extraction operations on the text matrix based on a preset number of feature extraction methods to obtain a preset number of feature matrices. Compared to existing technologies that only use one feature extraction method to extract features from the text matrix, the features extracted using a preset number of feature extraction methods are more accurate, effectively improving the accuracy of intent recognition and enhancing the user experience. Attached Figure Description

[0014] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0015] Figure 1 A schematic diagram illustrating the process of an intent recognition method provided in some embodiments of this application;

[0016] Figure 2 A schematic diagram illustrating the relationship between multi-intent control text and its corresponding intent, provided for some embodiments of this application;

[0017] Figure 3 A schematic diagram illustrating the convolutional layer of an intent recognition model provided in some embodiments of this application;

[0018] Figure 4 A schematic diagram illustrating the convolutional capsule layer of an intent recognition model provided in some embodiments of this application;

[0019] Figure 5 This is a schematic diagram illustrating an intent recognition model provided in related technologies;

[0020] Figure 6 A schematic diagram illustrating an intent recognition model provided for some embodiments of this application;

[0021] Figure 7 A schematic diagram illustrating the process of constructing an intent recognition model provided for some embodiments of this application;

[0022] Figure 8 This application provides a schematic diagram illustrating a process for determining target vectors corresponding to various actions in some embodiments.

[0023] Figure 9 A schematic diagram illustrating a process for determining the priority order of various intentions, provided for some embodiments of this application;

[0024] Figure 10 A schematic diagram of an intent recognition device structure is provided for some embodiments of this application;

[0025] Figure 11 This is a schematic diagram of the structure of an electronic device provided in some embodiments of this application. Detailed Implementation

[0026] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art are within the scope of protection of this application.

[0027] To improve the accuracy of intent recognition and enhance the user experience, embodiments of this application provide an intent recognition method, apparatus, device, and medium.

[0028] In this embodiment, control text is obtained, and the text matrix corresponding to the control text is determined. The text matrix is ​​input into a pre-trained intent recognition model. Based on the text matrix and a preset number of feature extraction methods, feature extraction operations are performed on the text matrix to determine a preset number of feature matrices. The preset number of corresponding feature matrices are concatenated to determine the target feature matrix. Intent classification is performed based on the target feature matrix to determine the predicted intent corresponding to the control text.

[0029] Figure 1 This application provides a schematic diagram of an intent recognition method according to some embodiments, the process including the following steps:

[0030] S101: Obtain the control text and determine the text matrix corresponding to the control text.

[0031] The intent recognition method provided in this application is applied to an electronic device, which may be a smart terminal, a PC, or a server, etc.

[0032] To obtain the text of the intent to be identified, i.e., control text, electronic devices can obtain the control text input by the user through interaction. This control text may carry one intent or multiple intents. For example, the control text could be "turn on the refrigerator" or "turn on the air conditioner and set the temperature to 26 degrees Celsius," and so on.

[0033] Specifically, when electronic devices interact with users, they can obtain control text input by the user through text interaction. For example, the user can input control text into the electronic device through the chat page of the electronic device. Alternatively, they can obtain the user's voice input first through voice interaction, and then convert the voice input into text, i.e., control text.

[0034] The process of converting speech to text is existing technology and will not be elaborated here.

[0035] Figure 2 This application provides a schematic diagram illustrating the relationship between multi-intent control text and its corresponding intent in some embodiments. The following is a description of this concept. Figure 2 Please provide an explanation.

[0036] If the multi-intention control text is "Check the weather in Qingdao and book a flight to Beijing", the corresponding intentions are "Check the weather" and "Book a flight"; if the multi-intention control text is "Is the Lantern Festival coming soon? How to make tangyuan?", the corresponding intentions are "Date lookup" and "Recipe lookup"; if the multi-intention control text is "Turn on the air conditioner and set it to cooling mode", the corresponding intentions are "Turn on the air conditioner" and "Air conditioner cooling"; if the multi-intention control text is "Wash my duvet cover in 20 minutes", the corresponding intentions are "Schedule the washing machine" and "Wash large items in the washing machine".

[0037] In order to determine the intent corresponding to the control text, in this embodiment of the application, the control text can be quantified first, that is, converted into a text matrix that can be recognized by the machine. In one possible implementation, each keyword of the control text can be extracted first, and then for each keyword, the keyword is input into a pre-trained word vector determination model to obtain the word vector corresponding to the keyword output by the word vector determination model. Then, the word vectors corresponding to each keyword are concatenated to obtain the text matrix.

[0038] The process of determining the word vectors corresponding to keywords based on the word vector model is existing technology and will not be elaborated here.

[0039] S102: Input the text matrix into the pre-trained intent recognition model, perform feature extraction operations on the text matrix based on the text matrix and a preset number of feature extraction methods, and determine the preset number of feature matrices; concatenate the preset number of corresponding feature matrices to determine the target feature matrix; perform intent classification based on the target feature matrix to determine the predicted intent corresponding to the control text.

[0040] In this embodiment, to accurately determine the intent corresponding to the control text, a pre-trained intent recognition model is pre-deployed in the electronic device. Based on this intent recognition model, a preset number of feature extraction methods are used to extract features from the text matrix, resulting in a preset number of feature matrices. Each feature extraction method yields one feature matrix. The preset number of feature extraction methods are all different, and the preset number can be 2, 3, 4, etc., and can be set according to requirements. The feature matrices obtained by each feature extraction method have the same specifications; for example, they can all be N×M matrices, where N is the number of rows and M is the number of columns.

[0041] After determining a preset number of feature matrices based on a preset number of feature extraction methods, these preset number of feature matrices can be concatenated to determine the target feature matrix.

[0042] In one possible implementation, the target feature matrix can be determined by horizontally concatenating the preset number of feature matrices. In this case, the number of rows corresponding to the target feature matrix is ​​the same as the number of rows corresponding to each feature matrix in the preset number of feature matrices, and the number of columns corresponding to the target feature matrix is ​​equal to the sum of the number of columns corresponding to each feature matrix in the preset number of feature matrices. That is, the target feature matrix obtained by concatenating N A×B feature matrices has a size of A×(B*N).

[0043] In another possible implementation, the target feature matrix can be determined by vertically concatenating the preset number of feature matrices. The number of columns of the target feature matrix is ​​the same as the number of columns of each feature matrix in the preset number of feature matrices, and the number of rows of the target feature matrix is ​​equal to the sum of the number of rows of each feature matrix in the preset number of feature matrices. That is, the target feature matrix obtained by concatenating N A×B feature matrices has a size of (A*N)×B.

[0044] Finally, intent classification is performed based on the target feature matrix to determine the predicted intent corresponding to the control text. This predicted intent can be one or multiple. Specifically, each predicted intent corresponding to the control text can be determined based on the fully connected capsule layer in the intent recognition model and the target feature matrix. The process of classifying intent based on the target feature matrix and the fully connected capsule layer to determine the predicted intent corresponding to the control text is an existing process and will not be elaborated upon here.

[0045] In this embodiment, to improve the accuracy of intent recognition, a training set is pre-set. The original intent recognition model is trained based on this training set to obtain a high-precision intent recognition model. The training set contains multiple training samples, each pre-labeled with its corresponding intent. To train the original recognition model, any training sample in the sample set is input into the original intent recognition model to obtain the predicted intent output by the model. Then, based on this predicted intent and the pre-labeled intent, the original intent recognition model is trained. Specifically, the network parameters in the intent recognition model can be adjusted using gradient descent to optimize its performance.

[0046] It should be noted that when training the original intent recognition model, the quantity and quality of training samples in the training set are crucial to the training results. In this embodiment, to obtain training samples, intent text data can be extracted from the open-source library (SNIP-nlu) as training samples, or a portion of intent text data can be selected from the background data of the electronic device. The intent text data in the background data can be historical text data representing the user's intent when interacting with the electronic device. The intent text data selected from both SNIP-nlu and the background data is Chinese text. The number of text data points selected from SNIP-nlu and the background data can be set according to requirements. For example, 445 text data points can be extracted from SNIP-nlu and 20,000 text data points can be selected from the background data, resulting in 20,445 training texts in the training set.

[0047] To ensure that there are enough training samples in the training set to train the original intent recognition model, in this embodiment of the application, in addition to using the intent text data selected from SNIP-nlu and the background data as training samples in the training set, data augmentation processing can also be performed on the intent text data selected from SNIP-nlu and the background data, and the text obtained after data augmentation processing can also be added to the training set as training samples, so that the training set contains more training samples.

[0048] In order to perform data augmentation on each intent text data, in one possible implementation, operations such as synonym replacement, random insertion, random swap, and random deletion can be performed on each intent text data using words that are pre-stored in the database, thereby achieving data augmentation on each intent text data.

[0049] In another possible implementation, data augmentation processing can also be performed on each intent text data based on the method of back translation. That is, the intent text data is translated into text data in other languages, and then the text data in other languages is translated back into text in the same language as the intent text data. The other languages can be English, Chinese, Japanese, and so on. Specifically, for each intent text data, the intent text data can be continuously subjected to language conversion for a target number of times to obtain multiple texts. For example, if the target number of times is 3, and the other languages include Japanese and Korean, and the intent text data is "Check the weather in Qingdao and book a flight to Beijing", then the intent text data can first be converted into Japanese text, which is "青島の天気をチェックし、北京行きのフライトを予約する", and then the Japanese text is converted into Korean text, which is Then the Korean text is converted into Chinese text, which is "查看青岛天气并预订飞往北京的航班".

[0050] In the embodiments of the present application, after the text matrix corresponding to the control text is input into the intent recognition model, the intent recognition model will perform feature extraction operations on the text matrix respectively based on a preset number of feature extraction methods to obtain a preset number of feature matrices. Compared with the prior art where only one feature extraction method is used to perform feature extraction operations on the text matrix, the features extracted based on the preset number of feature extraction methods in the present application are more accurate, effectively improving the accuracy of the intent recognition model in recognizing intents and enhancing the user experience.

[0051] To determine the text matrix corresponding to the control text, based on the above embodiments, in the embodiments of the present application, determining the text matrix corresponding to the control text includes;

[0052] Segment the control text into multiple segments according to a preset word segmentation method;

[0053] For each segment, input the segment into a pre-trained word vector determination model to output the word vector corresponding to the segment;

[0054] Concatenate the word vectors corresponding to each segment to determine the text matrix.

[0055] To determine the text matrix corresponding to the control text, in this embodiment, the control text can first be segmented into multiple words based on a preset word segmentation method. This preset word segmentation method can be a dictionary-based word segmentation algorithm or a grammar-based word segmentation method. Alternatively, the control text can be segmented into multiple words using tools such as jieba (Chinese word segmentation tool), HanLanguage Processing (hanlp), or Natural Language Toolkit (NLTK).

[0056] For example, if the control text is "Check the weather in Qingdao and book a flight to Beijing", then the multiple word segments that the control text can be are "check", "Qingdao weather", "and", "book", "to", "Beijing", "of", and "flight".

[0057] After segmenting the control text into multiple words, in order to determine the text matrix corresponding to the control text, in this embodiment, for each word segment, the word segment is input into a pre-trained word vector determination model. The word vector determination model outputs the word vector corresponding to the word segment. Then, the word vectors corresponding to each word segment are concatenated to determine the text matrix corresponding to the control text. The word vectors corresponding to each word segment have the same dimension. The word vector determination model can be a word2vec model, a CBOW model, a skip-gram model, a fasttext model, etc.

[0058] To facilitate feature extraction from the text matrix based on the contextual relationships between the segmented words, in this embodiment, when concatenating the word vectors corresponding to each segmented word, the segmented words can be sorted sequentially from front to back according to their positions in the control text to obtain a sorting result. For each segmented word in the sorting result, the segmented word that is adjacent to it and is ranked first in the sorting result is concatenated to the line above the vector corresponding to that segmented word, and the segmented word that is adjacent to it and is ranked last in the sorting result is concatenated to the line below the vector corresponding to that segmented word.

[0059] For example, if the control text is "Check the weather in Qingdao", then the control text is segmented into four words: "Check", "Qingdao", "of", and "weather". Based on the position of these four words in the control text, the sorted result is: "Check", "Qingdao", "of", and "weather". If the word vector corresponding to "Check" is (a1, a2, a... 3, a4, a5), the word vector corresponding to "Qingdao" is (b1, b2, b 3,b4, b5), the word vector corresponding to "的" is (c1, c2, c 3, c4, c5), the word vector corresponding to "天气" is (d1, d2, d 3, d4, d5), then the text matrix corresponding to the control text is

[0060] In order to accurately extract features from the text matrix, based on the above embodiments, in the embodiments of the present application, the preset number of feature extraction methods are respectively used to perform feature extraction operations on the text matrix to determine the preset number of feature matrices, including:

[0061] For each of the preset number of feature extraction methods, perform the first preset target number of n-gram feature extractions on the text matrix to obtain the first preset target number of column vectors, splice the first preset target number of column vectors into a candidate matrix, perform the second preset target number of m-gram feature extractions on the candidate matrix to obtain the second preset target number of column vectors, and splice the second preset target number of column vectors to determine the feature matrix corresponding to this feature extraction method, where n is different for different feature extraction methods, m is different, and the sum of n and m corresponding to each feature extraction method is the same.

[0062] In the embodiments of the present application, in order to accurately extract features from the text matrix, for each of the preset number of feature extraction methods, perform the first preset target number of n-gram feature extractions on the text matrix to obtain the first preset target number of column vectors. Specifically, perform the first preset target number of n-gram feature extractions on the text matrix based on a filter. Among them, each n-gram feature extraction corresponds to a column vector, and the dimensions of each column vector in the first preset target number of column vectors are the same. The dimension of the column vector corresponding to each feature extraction method is L - n + 1, where L is the number of columns of the text matrix. Among them, n can be 1, 2, 3, 4, 5, etc. Specifically, n can be set according to requirements.

[0063] For example, if the text matrix is ​​a 7×8 matrix, and the preset number is 3, that is, there are 3 feature extraction methods. For the first feature extraction method, if the text matrix is ​​subjected to 3 times of 1-gram feature extraction, the first feature extraction method will obtain 3 7×1 column vectors. For the second feature extraction method, if the text matrix is ​​subjected to 3 times of 3-gram feature extraction, the second feature extraction method will obtain 3 5×1 column vectors. For the third feature extraction method, if the text matrix is ​​subjected to 3 times of 5-gram feature extraction, the second feature extraction method will obtain 3 3×1 column vectors.

[0064] It should be noted that, for each of the preset number of feature extraction methods, the process of performing a first preset target number of n-gram feature extractions on the text matrix to obtain the first preset target number of column vectors can be performed in the convolutional layer of the intent recognition model.

[0065] Figure 3 This is a schematic diagram showing the convolutional layer of the intent recognition model provided in some embodiments of this application. Now, regarding... Figure 3 Please provide an explanation.

[0066] The number of convolutional layers in the intent recognition model corresponds to the number of feature extraction methods. For example, if three feature extraction methods are used to extract n-gram features from the text matrix a first preset target number of times, then the intent recognition model will have three convolutional layers. In each convolutional layer, the number of n-gram features extracted is different. For example, the first convolutional layer has n=1, the second convolutional layer has n=3, and the third convolutional layer has n=5. That is, the first convolutional layer extracts 1-gram features a first preset target number of times, the second convolutional layer extracts 3-gram features a first preset target number of times, and the third convolutional layer extracts 5-gram features a first preset target number of times.

[0067] To facilitate subsequent feature extraction operations and improve accuracy, in this embodiment, after obtaining a first preset target number of column vectors, these vectors are concatenated into a candidate matrix. If the column vectors are of N×1 size and the first preset target number is M, then the size of the concatenated candidate matrix is ​​N×M. Then, a second preset target number of m-gram feature extractions are performed on the candidate matrix to obtain a second preset target number of column vectors. Specifically, a second preset target number of m-gram feature extractions are performed on the text matrix based on a filter. Finally, these second preset target number of column vectors are concatenated to determine the feature matrix corresponding to this feature extraction method. Each m-gram feature extraction corresponds to one column vector, and each column vector in the second preset target number of column vectors has the same dimension. The dimension of the column vectors corresponding to each feature extraction method is L-m+1, where L is the number of columns in the candidate matrix. m can be 1, 2, 3, 4, 5, etc., and can be set according to requirements.

[0068] Since each of the predetermined number of feature extraction methods is different, the values ​​of n and m will differ depending on the method used. To ensure that the dimension of the feature matrix obtained under each feature extraction method is the same, the sum of n and m is the same for each method.

[0069] It should be noted that, for each of the preset number of feature extraction methods, the process of performing a second preset number of m-gram feature extractions on the candidate matrix to obtain the second preset number of column vectors can be performed in the convolutional capsule layer of the intent recognition model.

[0070] Figure 4 This is a schematic diagram showing the convolutional capsule layer of the intent recognition model provided in some embodiments of this application. Now, regarding... Figure 4 Please provide an explanation.

[0071] The number of convolutional layers and convolutional capsules in the intent recognition model corresponds to the number of feature extraction methods. For example, if there are 3 feature extraction methods, the intent recognition model will have 3 convolutional layers and 3 convolutional capsules. For each convolutional layer, the candidate matrix output by that layer is input into a convolutional capsule, where a second preset target number of m-gram feature extractions are performed. Different convolutional layers' candidate matrices are input into different convolutional capsules. Furthermore, the value of m is different when performing the second preset target number of m-gram feature extractions in each convolutional capsule. For instance, if n is 1 for the first convolutional layer, 3 for the second, and 5 for the third, then the m value in the first capsule input from the first convolutional layer's candidate matrix will be 5, the m value in the first capsule input from the second convolutional layer's candidate matrix will be 3, and the m value in the first capsule input from the third convolutional layer's candidate matrix will be 1.

[0072] To improve the accuracy of feature extraction, based on the above embodiments, in this embodiment, after concatenating the first preset target number of column vectors into a candidate matrix, and before performing a second preset target number of m-gram feature extractions on the candidate matrix, the method further includes:

[0073] The candidate matrix is ​​subjected to n-gram feature extraction with a preset third preset target number of times to obtain the third preset target number of column vectors, and the matrix obtained by concatenating the third preset target number of column vectors is updated as the candidate matrix.

[0074] In this embodiment of the application, after concatenating the first preset target number of column vectors into a candidate matrix based on the convolutional layer, and before performing the second preset target number of m-gram feature extractions on the candidate matrix based on the convolutional capsule layer, further special extractions can be performed on the candidate matrix. Specifically, the candidate matrix is ​​subjected to a preset third preset target number of n-grams to obtain the third preset target number of column vectors, and the matrix obtained by concatenating the third preset target number of column vectors is updated as the candidate matrix.

[0075] It should be noted that, for each of the preset number of feature extraction methods, the process of performing n-gram feature extraction on the candidate matrix for a preset third preset number of times can be performed in the primary capsule layer of the intent recognition model.

[0076] This process is similar to the method of n-gram feature extraction in convolutional layers, and will not be elaborated here.

[0077] To accurately determine the column vectors obtained in each n-gram feature extraction, based on the above embodiments, in this embodiment, the step of performing a first preset target number of n-gram feature extractions on the text matrix for each of the preset number of feature extraction methods to obtain the first preset target number of column vectors includes:

[0078] For each n-gram feature extraction under a preset number of feature extraction methods, the pre-saved network parameter matrix corresponding to that n-gram feature extraction under that feature extraction method is used as the convolution kernel to perform a convolution operation on the text matrix, thereby obtaining the column vector corresponding to that n-gram feature extraction under that feature extraction method. Here, the pre-saved network parameter matrix is ​​an n×k matrix, where k is the same as the number of columns in the text matrix.

[0079] In this embodiment of the application, in order to determine the column vector obtained under each n-gram feature extraction under each of the preset number of feature extraction methods, the pre-saved network parameter matrix corresponding to each n-gram feature extraction under the preset number of feature extraction methods is first used as the convolution kernel for each n-gram feature extraction under that feature extraction method. The network parameter matrices corresponding to different n-gram feature extractions under different feature extraction methods are not completely the same, and the network parameter matrices corresponding to different n-gram feature extractions under the same feature extraction method are also not completely the same.

[0080] Then, a convolution operation is performed on the text matrix to obtain the column vector corresponding to the n-gram feature extraction under this feature extraction method. The pre-saved network parameter matrix is ​​an n×k matrix, where k is the same as the number of columns in the text matrix.

[0081] To improve the accuracy of the image recognition model, in this embodiment, after performing a convolution operation on the text matrix and obtaining the column vector corresponding to the n-gram feature extraction under the feature extraction method, the sum vector of the column vector and the preset bias vector can be determined, and the sum column vector is used to update the column vector.

[0082] To increase the nonlinearity of the intent recognition model, in this embodiment, after performing a convolution operation on the text matrix to obtain the column vector corresponding to the n-gram feature extraction under this feature extraction method, the column vector can be input into an activation function to introduce a nonlinear factor. This activation function can be a linear rectified function (ReLU).

[0083] Specifically, the column vector corresponding to this n-gram feature extraction under this feature extraction method can be determined according to the following formula:

[0084] feature = f(L*W+b)

[0085] Where feature is the column vector corresponding to the n-gram feature extraction under this feature extraction method, L is the text matrix, W is the pre-saved network parameter matrix corresponding to the n-gram feature extraction under this feature extraction method, b is the preset bias vector, L*W represents the convolution operation on L based on W, and f(x) is the activation function.

[0086] Figure 5 This is a schematic diagram illustrating an intent recognition model provided in related technologies. Figure 6 This application provides a schematic diagram of an intent recognition model based on some embodiments. Figure 5 and Figure 6 Please provide an explanation.

[0087] Intent recognition models in related technologies include: an input layer, a convolutional layer, a primary capsule layer, and a fully connected capsule layer, such as... Figure 5 As shown, the intent recognition model in this application embodiment includes: an input layer, a preset number of convolutional layers, a preset number of primary capsule layers, and a fully connected capsule layer, as follows. Figure 6 As shown.

[0088] The following specific example illustrates the process of intent recognition using an intent recognition model:

[0089] The intent recognition model in this application includes: an input layer, three convolutional layers, three primary capsule layers, and a fully connected capsule layer.

[0090] Assuming the text matrix is ​​an a×b matrix, the text matrix is ​​first input into the input layer of the intent recognition model, and then the text matrix is ​​input into three convolutional layers respectively. For ease of description, these three convolutional layers are called convolutional layer 1, convolutional layer 2, and convolutional layer 3.

[0091] Convolutional layer 1 performs A 1-gram feature extractions on the text matrix, obtaining A column vectors with dimension a. These A column vectors with dimension a are then concatenated to obtain an a×A candidate matrix. Convolutional layer 2 performs A 3-gram feature extractions on the text matrix, obtaining A column vectors with dimension a-2. These A column vectors with dimension a-2 are then concatenated to obtain a (a-2)×A candidate matrix. Convolutional layer 3 performs A 5-gram feature extractions on the text matrix, obtaining A column vectors with dimension a-4. These A column vectors with dimension a-4 are then concatenated to obtain a (a-4)×A candidate matrix.

[0092] For ease of description, these three primary capsule layers are referred to as primary capsule layer 1, primary capsule layer 2, and primary capsule layer 3. The candidate matrix of a×A output by convolutional layer 1 is input into primary capsule layer 1, the candidate matrix of (a-2)×A output by convolutional layer 2 is input into primary capsule layer 2, and the candidate matrix of (a-4)×A output by convolutional layer 3 is input into primary capsule layer 3.

[0093] Primary capsule layer 1 performs B 1-gram feature extractions on the a×A candidate matrix to obtain B column vectors with dimension a. These B column vectors with dimension a are then concatenated to obtain an a×B candidate matrix. Primary capsule layer 2 performs B 3-gram feature extractions on the (a-2)×A candidate matrix to obtain B column vectors with dimension a-2. These B column vectors with dimension a-2 are then concatenated to obtain an (a-2)×B candidate matrix. Primary capsule layer 3 performs B 5-gram feature extractions on the (a-4)×A candidate matrix to obtain B column vectors with dimension a-4. These B column vectors with dimension a-4 are then concatenated to obtain an (a-4)×B candidate matrix.

[0094] For ease of description, these three convolutional capsule layers are referred to as convolutional capsule layer 1, convolutional capsule layer 2, and convolutional capsule layer 3. The candidate matrix of a×B output by primary capsule layer 1 is input into convolutional capsule layer 1, the candidate matrix of (a-2)×B output by primary capsule layer 2 is input into convolutional capsule layer 2, and the candidate matrix of (a-4)×B output by primary capsule layer 3 is input into convolutional capsule layer 3.

[0095] Convolutional capsule layer 1 performs C times of 5-gram feature extraction on the a×B candidate matrix, obtaining C column vectors with a-4 dimensions. These C column vectors with a-4 dimensions are then concatenated to obtain a (a-4)×C feature matrix. Convolutional capsule layer 2 performs C times of 3-gram feature extraction on the (a-2)×B candidate matrix, obtaining C column vectors with a-4 dimensions. These C column vectors with a-4 dimensions are then concatenated to obtain a (a-4)×C feature matrix. Convolutional capsule layer 3 performs C times of 1-gram feature extraction on the (a-4)×B candidate matrix, obtaining C column vectors with a-4 dimensions. These B column vectors with a-4 dimensions are then concatenated to obtain a (a-4)×C feature matrix.

[0096] Then, the (a-4)×C feature matrices obtained from convolutional capsule layer 1, convolutional capsule layer 2, and convolutional capsule layer 3 are concatenated to determine the target feature matrix. Finally, based on this fully connected capsule layer, the target feature matrix is ​​classified to determine the predicted intent corresponding to the control text.

[0097] Figure 7 This application provides a flowchart illustrating the construction of an intent recognition model according to some embodiments. The following is a summary of the process. Figure 7 Please provide an explanation.

[0098] First, intent text data is selected from SNIP-nlu and backend data, and then this intent text data is determined as training samples and added to the training set. Then, data augmentation processing is performed on each intent text data, and the text obtained after data augmentation is also added to the training set as a training sample. Finally, the corresponding sample intent is labeled for each training sample in the training set.

[0099] Then, based on each training sample, the training sample is segmented into multiple sample words, and the word vector corresponding to each sample word is determined. The word vectors of each word are concatenated to obtain a sample text matrix. This sample text matrix is ​​then input into the original intent recognition model, which passes through an input layer, multiple convolutional layers, multiple primary capsule layers, and multiple convolutional capsule layers for feature extraction. Finally, it passes through a fully connected capsule layer for intent classification to determine the predicted intent of the training sample. Based on the predicted intent and the labeled intent, the original intent recognition model is trained.

[0100] To accurately determine the execution order of target actions corresponding to multiple intents, based on the above embodiments, in this embodiment, after classifying intents based on the target feature matrix to determine the predicted intent corresponding to the control text, the method further includes:

[0101] If the control text corresponds to at least two predicted intentions, then for each predicted intention, the predicted intention is input into a pre-trained word vector determination model to obtain the word vector corresponding to the predicted intention; the target vectors corresponding to various types of actions and the similarity of the word vectors are determined in advance, and the class action corresponding to the maximum similarity is determined as the target class action corresponding to the predicted intention; wherein, for each type of action, the target vector corresponding to the pre-saved class action is determined based on the average of the word vectors corresponding to all actions included under that class action;

[0102] Based on the pre-saved priority order of various actions and the target action corresponding to each predicted intent, determine the priority order of each predicted intent;

[0103] Execute the target actions corresponding to each predicted intent in descending order of priority.

[0104] In this embodiment of the application, if the predicted intent corresponding to the control text includes at least two, then the target execution actions corresponding to each of the at least two predicted intents have a sequential order. For example, if the control text is "turn on the air conditioner to set it to cooling mode", then the predicted intent corresponding to the control text includes two predicted intents: "turn on the air conditioner" and "air conditioner cooling". The target execution action corresponding to "turn on the air conditioner" must be executed first before the target execution action corresponding to "air conditioner cooling" can be executed. If the target execution action corresponding to "air conditioner cooling" is executed first, then the target execution action corresponding to "turn on the air conditioner" cannot be executed.

[0105] To ensure accurate determination of the execution order of target actions corresponding to each predictive intent when the control text corresponds to multiple predictive intents, this embodiment of the application pre-stores the priority order of various action executions. These actions include: power-on actions, pause actions, start actions, execution actions, and power-off actions, etc., with the priority order from highest to lowest as follows: power-on actions, execution actions, start actions, pause actions, and power-off actions. Then, the target action corresponding to each of the multiple predictive intents for the control text is determined; that is, each predictive intent is assigned to a specific action category within the given action categories.

[0106] To determine the target action corresponding to each predicted intent, in one possible implementation, keywords of each action contained in a certain action can be pre-stored for each type of action. Then, for each predicted intent, it is determined whether there is a case where the keywords of each action contained in a certain action class match the keywords of the action corresponding to the predicted intent. If so, the action class to which the matched keywords belong is determined as the target action corresponding to the predicted intent.

[0107] In another possible implementation, the electronic device may pre-store target vectors corresponding to various actions. For each type of action, the pre-stored target vector is determined by the average vector of the word vectors corresponding to all actions within that type of action. For example, for "open" actions, actions such as "turn on power," "power on," "open," "power on," and "point" may be included. For "execute" actions, actions such as "change working mode," "adjust temperature," and "adjust function" may be included. The word vector corresponding to each action can be obtained by inputting the text corresponding to that action into a pre-trained word vector determination model.

[0108] Then, for each predicted intent, the predicted intent is input into a pre-trained word vector determination model to obtain the word vector corresponding to the predicted intent. Then, the target vectors corresponding to various pre-saved actions and the similarity of the word vectors are determined.

[0109] In one possible implementation, the similarity between the target vectors and word vectors corresponding to various actions can be determined based on the Euclidean distance between them and the target vectors. The Euclidean distance is inversely proportional to the similarity.

[0110] In another possible implementation, the cosine similarity between the target vectors corresponding to various actions and the word vectors can be determined as the similarity between the target vectors corresponding to various actions and the word vectors, wherein the cosine similarity is proportional to the similarity.

[0111] After determining the target vectors corresponding to various pre-saved actions and the similarity of the word vectors, the action class corresponding to the maximum similarity is determined as the target action class corresponding to the prediction intent.

[0112] Figure 8 This application provides a schematic diagram illustrating a process for determining target vectors corresponding to various actions, based on some embodiments. The following is a description of the process. Figure 8 Please provide an explanation.

[0113] For each type of action, identify all actions included in that type of action, and determine the word vector corresponding to each action in that type of action. Specifically, determine the word vector corresponding to action 1, action 2, action 3, ..., action n-1, and action n. Then, determine the mean vector of the word vectors corresponding to action 1, action 2, action 3, ..., action n-1, and action n, and use this mean vector as the target vector corresponding to that type of action.

[0114] To determine the execution order of the target actions corresponding to each predicted intent, the priority order of each predicted intent is first determined based on the pre-saved priority order of various actions and the target actions corresponding to each predicted intent. The higher the priority of the target action corresponding to the predicted intent in the pre-saved priority order of various actions, the higher the priority of the predicted intent. Finally, the target actions corresponding to each predicted intent are executed in order of priority from high to low.

[0115] For example, the control text corresponds to two predicted intents: "turn on the air conditioner" and "air conditioner cools down". The target actions corresponding to these two predicted intents are "turn on action" and "execute action". Since the priority of "turn on action" is higher than that of "execute action" in the pre-saved priority order of various actions, the priority of the predicted intent for "turn on the air conditioner" is higher than that for "air conditioner cools down". Therefore, the target execution action corresponding to "turn on the air conditioner" is executed first, and then the target execution action corresponding to "air conditioner cools down" is executed.

[0116] Figure 9 This application provides a schematic diagram illustrating a process for determining the priority order of various intentions, based on some embodiments of the present application. Figure 9 Please provide an explanation.

[0117] First, the control text with multiple intentions is input into a pre-trained intention recognition model to determine each predicted intention corresponding to the control text. For example, if three predicted intentions are determined, they are: Figure 1 ,meaning Figure 2 and Figure 3 And determine the meaning Figure 1 ,meaning Figure 2 and Figure 3 The corresponding word vectors, where the meaning Figure 1 The corresponding word vector is word vector 1, which means... Figure 2 The corresponding word vector is word vector 2, which means... Figure 3 The corresponding word vector is word vector 3.

[0118] Next, determine the similarity 1 between word vector 1 and the target vectors corresponding to various pre-saved actions, and the similarity 1 between word vector 2 and the target vectors corresponding to various pre-saved actions, and the similarity 2 between word vector 2 and word vector 3, and determine the similarity 3 between word vector 3 and the target vectors corresponding to various pre-saved actions. The action class corresponding to the maximum similarity 1 is then determined as the intention. Figure 1 The corresponding target action, and the action class corresponding to the maximum similarity score of 2 is determined as the intention. Figure 2 The corresponding target action is identified by determining the action class corresponding to the highest similarity score of 3. Figure 3 The corresponding target action.

[0119] Based on the pre-saved priority order of various actions, Figure 1 Corresponding target-type actions, intentions Figure 2 Corresponding target-type actions and intentions Figure 3 The corresponding target action, determine the intent. Figure 1 ,meaning Figure 2 and Figure 3 The corresponding priority order is then used to execute the target actions corresponding to each predicted intent in descending order of priority. For example, if the intent is to... Figure 1 ,meaning Figure 2 and Figure 3 The corresponding priority order from high to low is as follows: Figure 2 ,meaning Figure 3 and Figure 1 So, execute the intention first. Figure 2 The corresponding target action is executed, and then the intention is executed. Figure 3 The corresponding target action is executed, and the final execution intention is... Figure 1 The corresponding target action is executed.

[0120] Figure 10 This application provides a schematic diagram of an intent recognition device structure, which includes:

[0121] The determining module 1001 is used to obtain the control text and determine the text matrix corresponding to the control text;

[0122] The processing module 1002 is used to input the text matrix into a pre-trained intent recognition model, perform feature extraction operations on the text matrix based on the text matrix and a preset number of feature extraction methods, determine the preset number of feature matrices, concatenate the preset number of corresponding feature matrices to determine the target feature matrix, and perform intent classification based on the target feature matrix to determine the predicted intent corresponding to the control text.

[0123] In one possible implementation, the determining module 1001 is specifically used to segment the control text into multiple words according to a preset word segmentation method; for each word, input the word segment into a pre-trained word vector determining model, and output the word vector corresponding to the word segment; and concatenate the word vectors corresponding to each word to determine the text matrix.

[0124] In one possible implementation, the processing module 1002 is specifically configured to perform a first preset target number of n-gram feature extractions on the text matrix for each of the preset number of feature extraction methods, to obtain the first preset target number of column vectors, to concatenate the first preset target number of column vectors into a candidate matrix, to perform a second preset target number of m-gram feature extractions on the candidate matrix, to obtain the second preset target number of column vectors, and to concatenate the second preset number of column vectors to determine the feature matrix corresponding to that feature extraction method. The n and m values ​​are different for different feature extraction methods, and the sum of n and m is the same for each feature extraction method.

[0125] In one possible implementation, the processing module 1002 is further configured to perform n-gram feature extraction on the candidate matrix for a preset third preset target number of times, obtain the third preset target number of column vectors, and update the matrix obtained by concatenating the third preset target number of column vectors to the candidate matrix.

[0126] In one possible implementation, the processing module 1002 is specifically used to perform a convolution operation on the text matrix for each n-gram feature extraction under each of the preset number of feature extraction methods, using the pre-saved network parameter matrix corresponding to the n-gram feature extraction under that feature extraction method as the convolution kernel, to obtain the column vector corresponding to the n-gram feature extraction under that feature extraction method. The pre-saved network parameter matrix is ​​an n×k matrix, where k is the same as the number of columns in the text matrix.

[0127] In one possible implementation, the processing module 1002 is further configured to perform a preset third preset target number of n-grams on the candidate matrix to obtain the third preset target number of column vectors, and update the matrix obtained by concatenating the third preset target number of column vectors to the candidate matrix.

[0128] In one possible implementation, the processing module 1002 is further configured to: if there are at least two predicted intentions corresponding to the control text, input the predicted intention into a pre-trained word vector determination model for each predicted intention to obtain the word vector corresponding to the predicted intention; determine the target vectors corresponding to various types of actions and the similarity of the word vectors, and determine the class action corresponding to the maximum similarity as the target class action corresponding to the predicted intention; wherein, for each type of action, the target vector corresponding to the pre-saved class action is determined based on the average value of the word vectors corresponding to all actions included under that class action; determine the priority order of each predicted intention according to the priority order of the pre-saved various types of actions and the target class action corresponding to each predicted intention; and execute the target execution actions corresponding to each predicted intention in descending order of priority.

[0129] Based on the above embodiments, this application also provides an electronic device. Figure 11 This application provides a schematic diagram of an electronic device structure, such as... Figure 11 As shown, it includes: processor 1101, communication interface 1102, memory 1103 and communication bus 1104, wherein processor 1101, communication interface 1102 and memory 1103 communicate with each other through communication bus 1104.

[0130] The memory 1103 stores a computer program, which, when executed by the processor 1101, causes the processor 1101 to perform the following steps:

[0131] Obtain the control text and determine the text matrix corresponding to the control text;

[0132] The text matrix is ​​input into a pre-trained intent recognition model. Based on the text matrix and a preset number of feature extraction methods, feature extraction operations are performed on the text matrix to determine the preset number of feature matrices. The preset number of corresponding feature matrices are concatenated to determine the target feature matrix. Intent classification is performed based on the target feature matrix to determine the predicted intent corresponding to the control text.

[0133] In one possible implementation, the processor 1101 is specifically configured to segment the control text into multiple words according to a preset word segmentation method; for each word, input the word segment into a pre-trained word vector determination model, and output the word vector corresponding to the word segment; and concatenate the word vectors corresponding to each word to determine the text matrix.

[0134] In one possible implementation, the processor 1101 is specifically configured to perform a first preset target number of n-gram feature extractions on the text matrix for each of the preset number of feature extraction methods, to obtain the first preset target number of column vectors, concatenate the first preset target number of column vectors into a candidate matrix, perform a second preset target number of m-gram feature extractions on the candidate matrix, to obtain the second preset target number of column vectors, and concatenate the second preset number of column vectors to determine the feature matrix corresponding to that feature extraction method. The n and m values ​​are different for different feature extraction methods, and the sum of n and m is the same for each feature extraction method.

[0135] In one possible implementation, the processor 1101 is further configured to perform n-gram feature extraction on the candidate matrix for a preset third preset target number of times, obtain the third preset target number of column vectors, and update the matrix obtained by concatenating the third preset target number of column vectors to the candidate matrix.

[0136] In one possible implementation, the processor 1101 is specifically configured to perform a convolution operation on the text matrix for each n-gram feature extraction under each of the preset number of feature extraction methods, using the pre-saved network parameter matrix corresponding to the n-gram feature extraction under that feature extraction method as the convolution kernel, to obtain the column vector corresponding to the n-gram feature extraction under that feature extraction method. The pre-saved network parameter matrix is ​​an n×k matrix, where k is the same as the number of columns in the text matrix.

[0137] In one possible implementation, the processor 1101 is further configured to perform a preset third preset target number of n-gram operations on the candidate matrix to obtain the third preset target number of column vectors, and update the matrix obtained by concatenating the third preset target number of column vectors to the candidate matrix.

[0138] In one possible implementation, the processor 1101 is further configured to: if there are at least two predicted intentions corresponding to the control text, input the predicted intention into a pre-trained word vector determination model for each predicted intention to obtain the word vector corresponding to the predicted intention; determine the target vectors corresponding to various types of actions and the similarity of the word vectors, and determine the class action corresponding to the maximum similarity as the target class action corresponding to the predicted intention; wherein, for each type of action, the target vector corresponding to the pre-saved class action is determined based on the average of the word vectors corresponding to all actions included under that class action; determine the priority order of each predicted intention according to the priority order of the pre-saved various types of actions and the target class action corresponding to each predicted intention; and execute the target execution actions corresponding to each predicted intention in descending order of priority.

[0139] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.

[0140] The communication interface 1102 is used for communication between the aforementioned electronic device and other devices. The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0141] The processors mentioned above can be general-purpose processors, including central processing units, network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits, field-programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0142] Based on the above embodiments, this invention also provides a computer-readable storage medium storing a computer program executable by a processor. When the program runs on the processor, it causes the processor to perform the following steps:

[0143] Obtain the control text and determine the text matrix corresponding to the control text;

[0144] The text matrix is ​​input into a pre-trained intent recognition model. Based on the text matrix and a preset number of feature extraction methods, feature extraction operations are performed on the text matrix to determine the preset number of feature matrices. The preset number of corresponding feature matrices are concatenated to determine the target feature matrix. Intent classification is performed based on the target feature matrix to determine the predicted intent corresponding to the control text.

[0145] Further, determining the text matrix corresponding to the control text includes:

[0146] The control text is segmented into multiple words according to a preset word segmentation method;

[0147] For each word segment, the segment is input into a pre-trained word vector determination model, which outputs the word vector corresponding to the segment.

[0148] The word vectors corresponding to each word segment are concatenated to determine the text matrix.

[0149] Furthermore, the step of performing feature extraction operations on the text matrix based on the text matrix and a preset number of feature extraction methods to determine the preset number of feature matrices includes:

[0150] For each of the preset number of feature extraction methods, the text matrix is ​​subjected to a first preset target number of n-gram feature extractions to obtain the first preset target number of column vectors. The first preset target number of column vectors are concatenated to form a candidate matrix. The candidate matrix is ​​subjected to a second preset target number of m-gram feature extractions to obtain the second preset target number of column vectors. The second preset number of column vectors are concatenated to determine the feature matrix corresponding to that feature extraction method. The n and m are different for different feature extraction methods, and the sum of n and m is the same for each feature extraction method.

[0151] Furthermore, after concatenating the first preset target number of column vectors into a candidate matrix, and before performing a second preset target number of m-gram feature extractions on the candidate matrix, the method further includes:

[0152] The candidate matrix is ​​subjected to n-gram feature extraction with a preset third preset target number of times to obtain the third preset target number of column vectors, and the matrix obtained by concatenating the third preset target number of column vectors is updated as the candidate matrix.

[0153] Further, for each of the preset number of feature extraction methods, the text matrix is ​​subjected to a first preset target number of n-gram feature extractions to obtain the first preset target number of column vectors, including:

[0154] For each n-gram feature extraction under a preset number of feature extraction methods, the pre-saved network parameter matrix corresponding to that n-gram feature extraction under that feature extraction method is used as the convolution kernel to perform a convolution operation on the text matrix, thereby obtaining the column vector corresponding to that n-gram feature extraction under that feature extraction method. Here, the pre-saved network parameter matrix is ​​an n×k matrix, where k is the same as the number of columns in the text matrix.

[0155] Furthermore, after concatenating the first preset target number of column vectors into a candidate matrix, and before performing a second preset target number of m-gram feature extractions on the candidate matrix, the method further includes:

[0156] The candidate matrix is ​​subjected to an n-gram with a preset third preset target number of times to obtain the third preset target number of column vectors, and the matrix obtained by concatenating the third preset target number of column vectors is updated as the candidate matrix.

[0157] Furthermore, after classifying the intent based on the target feature matrix to determine the predicted intent corresponding to the control text, the method further includes:

[0158] If the control text corresponds to at least two predicted intentions, then for each predicted intention, the predicted intention is input into a pre-trained word vector determination model to obtain the word vector corresponding to the predicted intention; the target vectors corresponding to various types of actions and the similarity of the word vectors are determined in advance, and the class action corresponding to the maximum similarity is determined as the target class action corresponding to the predicted intention; wherein, for each type of action, the target vector corresponding to the pre-saved class action is determined based on the average of the word vectors corresponding to all actions included under that class action;

[0159] Based on the pre-saved priority order of various actions and the target action corresponding to each predicted intent, determine the priority order of each predicted intent;

[0160] Execute the target actions corresponding to each predicted intent in descending order of priority.

[0161] In this embodiment, after the text matrix corresponding to the control text is input into the intent recognition model, the intent recognition model will perform feature extraction operations on the text matrix based on a preset number of feature extraction methods to obtain a preset number of feature matrices. Compared with the prior art, which only performs feature extraction operations on the text matrix based on a single feature extraction method, the features extracted by this application based on a preset number of feature extraction methods are more accurate, effectively improving the accuracy of the intent recognition model in recognizing intent and enhancing the user experience.

[0162] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0163] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0164] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0165] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0166] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. An intent recognition method, characterized in that, The method includes: Obtain the control text and determine the text matrix corresponding to the control text; The text matrix is ​​input into a pre-trained intent recognition model. Based on the text matrix and a preset number of feature extraction methods, feature extraction operations are performed on the text matrix to determine the preset number of feature matrices. The preset number of corresponding feature matrices are concatenated to determine the target feature matrix. Intent classification is performed based on the target feature matrix to determine the predicted intent corresponding to the control text. Specifically, the step of performing feature extraction operations on the text matrix and a preset number of feature extraction methods to determine the preset number of feature matrices includes: For each of the preset number of feature extraction methods, the text matrix is ​​subjected to a first preset target number of n-gram feature extractions to obtain a first preset target number of column vectors. The first preset target number of column vectors are concatenated to form a candidate matrix. The candidate matrix is ​​subjected to a second preset target number of m-gram feature extractions to obtain a second preset target number of column vectors. The second preset target number of column vectors are concatenated to determine the feature matrix corresponding to that feature extraction method. Here, the n and m are different for different feature extraction methods, and the sum of n and m is the same for each feature extraction method. The method further includes, after concatenating the first preset number of column vectors into a candidate matrix and before performing a second preset number of m-gram feature extractions on the candidate matrix, the method further includes: The candidate matrix is ​​subjected to n-gram feature extraction with a preset third preset target number of times to obtain the third preset target number of column vectors, and the matrix obtained by concatenating the third preset target number of column vectors is updated as the candidate matrix; Specifically, for each of the preset number of feature extraction methods, the text matrix is ​​subjected to a first preset target number of n-gram feature extractions to obtain the first preset target number of column vectors, including: For each n-gram feature extraction under a predetermined number of feature extraction methods, the pre-saved network parameter matrix corresponding to that n-gram feature extraction under that feature extraction method is used as the convolution kernel to perform a convolution operation on the text matrix, thereby obtaining the column vector corresponding to that n-gram feature extraction under that feature extraction method. Here, the pre-saved network parameter matrix is ​​n... The matrix k is the same as the number of columns in the text matrix.

2. The method according to claim 1, characterized in that, Determining the text matrix corresponding to the control text includes: The control text is segmented into multiple words according to a preset word segmentation method; For each word segment, the segment is input into a pre-trained word vector determination model, which outputs the word vector corresponding to the segment. The word vectors corresponding to each word segment are concatenated to determine the text matrix.

3. The method according to claim 1, characterized in that, After classifying the intent based on the target feature matrix to determine the predicted intent corresponding to the control text, the method further includes: If the control text corresponds to at least two predicted intentions, then for each predicted intention, the predicted intention is input into a pre-trained word vector determination model to obtain the word vector corresponding to the predicted intention; the target vectors corresponding to various types of actions and the similarity of the word vectors are determined in advance, and the class action corresponding to the maximum similarity is determined as the target class action corresponding to the predicted intention; wherein, for each type of action, the target vector corresponding to the pre-saved class action is determined based on the average of the word vectors corresponding to all actions included under that class action; Based on the pre-saved priority order of various actions and the target action corresponding to each predicted intent, determine the priority order of each predicted intent; Execute the target actions corresponding to each predicted intent in descending order of priority.

4. An intent recognition device, characterized in that, The device includes: A determination module is used to obtain control text and determine the text matrix corresponding to the control text; The processing module is used to input the text matrix into a pre-trained intent recognition model, perform feature extraction operations on the text matrix based on the text matrix and a preset number of feature extraction methods, determine the preset number of feature matrices, concatenate the preset number of corresponding feature matrices to determine the target feature matrix, and perform intent classification based on the target feature matrix to determine the predicted intent corresponding to the control text. The processing module is specifically used to perform a first preset target number of n-gram feature extractions on the text matrix for each of the preset number of feature extraction methods, to obtain the first preset target number of column vectors, to concatenate the first preset target number of column vectors into a candidate matrix, to perform a second preset target number of m-gram feature extractions on the candidate matrix, to obtain the second preset target number of column vectors, and to concatenate the second preset target number of column vectors to determine the feature matrix corresponding to the feature extraction method. Here, the n and m are different for different feature extraction methods, and the sum of n and m is the same for each feature extraction method. The processing module is further configured to perform n-gram feature extraction on the candidate matrix for a preset third preset target number of times, obtain the third preset target number of column vectors, and update the matrix obtained by concatenating the third preset target number of column vectors to the candidate matrix; The processing module is specifically used to perform a convolution operation on the text matrix for each n-gram feature extraction under each of a preset number of feature extraction methods, using the pre-saved network parameter matrix corresponding to that n-gram feature extraction under that feature extraction method as the convolution kernel, to obtain the column vector corresponding to that n-gram feature extraction under that feature extraction method. Here, the pre-saved network parameter matrix is ​​n... The matrix k is the same as the number of columns in the text matrix.

5. The apparatus according to claim 4, characterized in that, The determining module is specifically used to segment the control text into multiple words according to a preset word segmentation method; for each word, input the word segment into a pre-trained word vector determining model, and output the word vector corresponding to the word segment; and concatenate the word vectors corresponding to each word to determine the text matrix.

6. An electronic device, characterized in that, The electronic device includes a processor that executes a computer program stored in a memory to implement the steps of the intent recognition method as described in any one of claims 1-3.

7. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the steps of the intent recognition method as described in any one of claims 1-3.

Citation Information

Patent Citations

  • User intention guiding method for household appliance customer service and intelligent household appliance

    CN112446405A

  • Intention recognition method and device, computer equipment, and storage medium

    CN114036943A