Text intent recognition method, device and related equipment
By extracting and fusion features from word level to sentence level in text intent recognition technology, combined with intent classification model, the intent recognition error problem under complex dialogue content is solved, and the recognition accuracy and customer experience are improved.
Patent Information
- Application Number
- CN202011309413.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-20
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2040-11-20
AI Technical Summary
Existing text intention recognition technologies are prone to intent recognition errors when processing complex and diverse conversation content, resulting in inaccurate responses from customer robots and reducing customer experience and service quality.
By obtaining voice information and converting it into text to be recognized, combining each text in the text queue, features are extracted from word level to sentence level, feature fusion is performed, and intention classification is used to improve the accuracy of intention recognition.
It effectively solves the intent recognition error problem caused by the complexity and diversity in intent recognition of single-sentence conversations, improves the accuracy and accuracy of text intent recognition, and improves customer experience and service quality.
Smart Images

Figure CN112417855B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to text intent recognition, and in particular to a text intent recognition method, apparatus and related equipment. Background Art
[0002] With the increasing popularity of computer network technology, text intent recognition is widely used in products such as intelligent voice assistants and intelligent conversational robots. In order to better understand customer needs, respond more accurately, and improve customer satisfaction, a machine dialogue system is required to accurately and completely identify the actual intention of a sentence sent by a customer.
[0003] At present, text intent recognition mainly involves the intelligent customer service system performing voice recognition on the customer's voice to obtain the recognized text, further determining the customer's meaning through text intent recognition, and then replying to the customer based on the intent matching corresponding text. Using only a single sentence for intent recognition may identify the wrong intent. For example, the customer's current words may be based on the previous sentences as a premise. When the premise is not met, the intent expressed by the current sentence may be completely different, which will cause the customer robot to make an incorrect reply, which not only reduces the customer experience, but also provides customers with wrong services. Summary of the invention
[0004] The present application provides a text intent recognition method and system, which effectively solves the problem of intent recognition errors caused by the complexity and diversity of conversation content in previous single-sentence conversation intent recognition.
[0005] In a first aspect, an embodiment of the present application provides a method for text intent recognition, including: acquiring voice information and a text queue, converting the voice information into text to be recognized, the text queue including one or more texts; extracting features from the text to be recognized and each text in the text queue to obtain text features of the text to be recognized and text features corresponding to each text; obtaining fused features corresponding to the text to be recognized based on the text features of the text to be recognized and the text features corresponding to each text; performing intent classification on the fused features through an intent classification model to obtain the intent corresponding to the text to be recognized.
[0006] In the second aspect, an embodiment of the present application provides a text intent recognition device, including: an acquisition unit, used to acquire voice information and a text queue; a preprocessing unit, used to convert the voice information into text to be recognized and add it to the text queue; a feature extraction unit, used to extract features from the text to be recognized and each text in the text queue, and obtain text features of the text to be recognized and text features corresponding to each text; a fusion unit, used to obtain fused features of the text to be recognized based on the text features of the text to be recognized and the text features of each text; a classification unit, used to classify the fused features through an intent classification model, and obtain the intent corresponding to the text to be recognized.
[0007] In a third aspect, an embodiment of the present application provides a text intent recognition device, including: a processor and a memory, wherein the processor executes the code in the memory to execute the method provided in any one of the implementation modes of the first aspect.
[0008] In a fourth aspect, a computer-readable storage medium includes instructions, which, when executed on a computer, cause the computer to execute a method provided in any one of the implementations of the first aspect.
[0009] The embodiment of the present application captures context matching information of the text to be recognized with each text in the text queue from word level to sentence level, and thus performs feature fusion on different texts at different granularities, which can make full use of historical semantic information, achieve fusion of context information, and combine word-level features with sentence-level features to obtain a more discriminative feature, thereby improving the accuracy of text intent recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the background technology, the drawings required for use in the embodiments of the present application or the background technology will be described below.
[0011] Figure 1 This is a schematic diagram of a workflow of a text intent recognition intelligent customer service system provided by an embodiment of the present invention;
[0012] Figure 2 is a flow chart of a text intent recognition method provided by an embodiment of the present invention;
[0013] Figure 3 It is a schematic diagram of a model for extracting text sentence level features provided by an embodiment of the present invention;
[0014] Figure 4 is a schematic diagram of the structure of a text intent recognition device provided by an embodiment of the present invention;
[0015] Figure 5 is a structural schematic diagram of a feature extraction provided by an embodiment of the present invention;
[0016] Figure 6 It is a structural schematic diagram of a text intent recognition device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0017] The terms used in the embodiments of the present application are only used to explain the specific embodiments of the present invention, but are not intended to limit the present invention.
[0018] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0019] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0020] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0021] It should be further understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0022] The text mentioned in this embodiment includes words or sentences. Words are the collective name of words and phrases, including words (including single words and compound words) and phrases (also known as phrases), which are the smallest word group structure form units that make up sentences and articles. Sentences are the basic units of language use. They are composed of words and phrases (phrases) and can express a complete meaning, such as telling others something, asking a question, expressing a request or stopping, expressing a certain emotion, and expressing the continuation or omission of a paragraph.
[0023] First, the embodiments of the present application involve an intelligent customer service system for performing text intent recognition.
[0024] Figure 1A schematic diagram of the workflow of a text intent recognition system is shown, and the framework describes the overall workflow of the intelligent customer service system. In this embodiment, the customer's voice information is first obtained, voice recognition is performed, and the text to be recognized is obtained, and the text to be recognized is added to the text queue, wherein the text queue includes one or more texts to be recognized; then, features are extracted from the text to be recognized and each text in the text queue, and the text features of the text to be recognized and the text features of each text in the text queue are obtained, wherein the text features include word-level features and sentence-level features; according to the text features of the text to be recognized and the text features of each text in the text queue, the fused features corresponding to the text to be recognized are obtained; the fused features are classified by intent to obtain the intent corresponding to the text to be recognized; finally, the intelligent customer service system can select appropriate reply words to reply according to the current process link and customer intent category.
[0025] In a specific embodiment, Figure 2 As shown, a flowchart of a text intent recognition method is provided, and the method is applied to Figure 1 The intelligent customer service system in the example is used to illustrate, including the following steps:
[0026] S101, obtaining voice information and a text queue, and converting the voice information into text to be recognized.
[0027] In a specific embodiment of the present application, voice information input by the customer is obtained, and the voice information is used by the intelligent customer service system to convert the voice information into text to be recognized, and obtain the text classification intention, that is, the corresponding customer demand intention. For example, the user inputs "I want to listen to Zhou XX's song", and the intelligent customer service system converts the voice input by the customer into text to be recognized, and obtains the demand intention for listening to the song. After obtaining the customer's voice information, the speech recognition algorithm wav2letter++ algorithm is used for speech recognition to convert the voice input by the customer into the corresponding text to be recognized. At the same time, a text queue is obtained, wherein the text queue includes one or more texts. The text queue can accommodate The way to add text to the text queue is: after converting the voice information into the text to be recognized, when the number of texts in the text queue is less than When the text to be recognized is added to the text queue, the text in the text queue The texts are arranged in the order of time they were added; when the number of texts in the text queue is equal to When the text queue is reached, the text that is first added to the text queue is deleted, and the text to be recognized is added to the text queue.
[0028] For example, if the size of the text queue is 5, the texts in the text queue are sorted in order of entry, as {1, 2, 3, 4, 5}, where 1 represents the first text added to the text queue, and 2, 3, 4, 5 and so on. When the number of texts in the text queue does not exceed 5, the texts to be recognized are directly added to the text queue in order. When the number of texts in the text queue is 5, text 1 is deleted first, and then the texts to be recognized are added.
[0029] S102, extracting features from the text to be recognized and each text in the text queue to obtain text features of the text to be recognized and text features corresponding to each text.
[0030] In a specific embodiment, for each text in the recognition text and the text queue, first, extract the word-level features, and then use An attention model is used to extract sentence-level features. Finally, the word-level features and sentence-level features corresponding to the text to be recognized are combined as the features of the text to be recognized.
[0031] The specific steps for extracting features from each text in the recognition text and text queue include:
[0032] The first step is to extract word-level features
[0033] Specifically, first, use the word segmentation tool to segment each text in the text queue to obtain the word , where the word segmentation tool can be jieba, SnowNLP, THULAC, NLPIR, etc. This embodiment of the present application does not constitute any limitation to this. After word segmentation, we can get the word Then, of the recognized text Words Mapping to word embedding matrix Get word vector Finally, connect The word vector is obtained Word vector matrix for recognized text As word-level features. After processing, the text can be obtained word vector matrix It can be understood that after the above processing of the text to be recognized, the word-level features of the text to be recognized can be obtained. .
[0034] Among them, the word embedding matrix It can be obtained by training the Word2vec model on 3 million text data, or it can be obtained by training on other models, and the present application embodiment does not impose any limitation on this. Before or after word segmentation, there can be corpus cleaning, part-of-speech tagging, and stop word removal, such as deleting noise data, removing modal particles according to a pre-set modal word list, etc., and the present application embodiment does not impose any limitation on this.
[0035] Exemplarily, here we take Jieba word segmentation as an example. When the input recognition text is "How is the weather today?", the output after Jieba word segmentation processing can be: "Today", "Everyday", "Weather", "How", "How is it", "Yeah", "?". After part-of-speech tagging, the output can be: "Today n", "Everyday v", "Weather n", "How r", "How is it r", "Yeah y", "? vv", where n represents a noun, v represents a verb, r represents a pronoun, y represents an modal particle, and vv represents a punctuation mark. After removing stop words, the output can be: "Today n", "Everyday v", "Weather n", "How r", "How is it r". The modal particles can be removed according to the pre-set modal word list. In this way, you can get the meaning of a sentence. word.
[0036] The second step is to extract sentence-level features
[0037] Specifically, for the The word-level feature vector matrix extracted from the text ,use Attention model for word embedding matrix Processing to Sentence features at different levels: Among them, The output of the attention model is taken as the The input of the attention model, i is a positive integer greater than or equal to 1 and less than m. That is, in The output of the previous attention model in the attention module is used as the input of the next attention model. As a sentence-level feature in a text, After processing, the text can be obtained Sentence-level features .like Figure 3 As shown, the feature word vector matrix at the word level As the input of the first attention model, the output of the first attention model is used as the input of the second attention model, and the output of the previous attention model is used as the input of the next attention model. Sentence features at different levels . Use it like this The attention model processing can obtain deeper semantic information. It can be understood that after the above processing of the text to be recognized, the sentence-level features of the text to be recognized can be obtained. .
[0038] The attention model can be understood as imagining the constituent elements in Source as a series of<Key,Value> Data composition: Given a Query element in Target, we calculate the similarity or correlation between Query and each Key, get the weight coefficient of each Key corresponding to the Value, and then perform weighted summation on the Value to get the final Attention value. The calculation process is as follows:
[0039] Step 1: Calculate the similarity or correlation between Query and Key.
[0040]
[0041] in, Respectively represent the number of words in Query, Key, and Value. Represents the dimension of a word. express and Do the dot product, the result is Represents an element in target With source Corresponding The similarity value of the input word is obtained to obtain the dependency relationship between the input word and the word. It can be understood that in the embodiment of the present application, the method of calculating similarity or correlation is only used for illustration. In actual applications, the similarity or correlation can be calculated by finding the dot product of the vectors of the two, finding the cosine similarity of the vectors of the two, and introducing an additional neural network to evaluate the value. The embodiment of the present application does not impose any limitation on this.
[0042] Step 2: Normalize the original scores in the first step to obtain the weight coefficients;
[0043] Specifically, the score generated in the first step has a different range of values depending on the specific generation method, so the second step introduces The calculation method of the first step is to convert the scores into numerical values. On the one hand, it is normalized to organize the original calculated scores into a probability distribution where the sum of the weights of all elements is 1; on the other hand, the weights of important elements can be highlighted more through the internal mechanism of SoftMax. The specific calculation process is as follows:
[0044]
[0045] in, is the weight matrix, indicating Corresponding The weight coefficient of .
[0046] Step 3: Perform weighted summation of Value according to the weight coefficient.
[0047]
[0048] in, express The number of words in Representation Elements The final Attention value for .
[0049] The third step is to obtain text features based on word-level features and sentence-level features.
[0050] Specifically, the The first is the feature of identifying the word level of the text and the The features at the sentence level of the recognition text are combined as the first Features to identify text: , for the text queue The text gets It can be understood that for the text to be recognized, the features at the word level of the text to be recognized and the features at the sentence level are combined as the features of the text to be recognized, and the .
[0051] In an embodiment of the present application, the word vector matrix of each text and the word vector matrix of the text to be recognized are processed using m attention models, and the output of the previous attention model is used as the input of the next model, so as to obtain m different levels of features of each text and m different levels of features of the text to be recognized, thereby obtaining richer, multi-level and multi-dimensional features.
[0052] S103, obtaining fusion features corresponding to the text to be recognized based on the text features of the text to be recognized and the text features corresponding to each text in the text queue.
[0053] In a specific embodiment, the obtained The Deep Attention Matching (DAM) algorithm uses the word-level features W and the sentence-level features to identify the text features. Specifically, the word-level features of the text to be recognized are matched with the obtained The word-level features of the text to be recognized are matched to obtain the word-level matching results, and the word-level matching results are fused to obtain the first fusion feature; the sentence-level features of the text to be recognized are matched to the word-level features of the text to be recognized The sentence-level features of the text are matched to obtain the sentence-level matching results, and the sentence-level matching results are fused to obtain the second fused feature. The first fused feature and the second fused feature are fused to obtain the fused feature corresponding to the text to be recognized.
[0054] The idea of the DAM algorithm is to select the best matching response from a set of candidate responses given a conversation context. Specifically, each word in the context text or the text in the response is taken as the central meaning of an abstract semantic fragment, and stacked attention is used to construct text representations of different granularities; secondly, considering the text relevance and dependency information, each text in the context and response is matched based on fragment matching of different granularities. In this way, the DAM algorithm captures the matching information between the context and the response from the word level to the sentence level; then, important matching features are extracted through convolution and maximum pooling operations, and finally fused into a single matching score through a single-layer perceptron. In this way, feature fusion of different texts at different granularities can make full use of historical semantic information and achieve context information fusion.
[0055] The specific steps of the DAM algorithm are: first, use stacked attention to construct text representations of different granularities, and second, extract truly paired fragments from the entire context and response.
[0056] Specifically, the DAM algorithm model framework can be: representation-matching-aggregation. The following introduces the DAM algorithm by taking sentence-level feature matching as an example.
[0057] The first layer of the DAM algorithm is the word embedding layer, which embeds the features of the sentence level of the text to be recognized. and Features at the article level As the input of the word embedding layer. Among them, the matrix The columns are the dimensions of the word vector, the matrix The line is the length of the text.
[0058] The second layer of the DAM algorithm is the representation layer, which is used to construct semantic representations of different granularities. layer, using The same self-attention layer is stacked, The input of the layer is The output of the layer can then combine the input semantic vectors into a multi-granular representation. The multi-granular representation process is as follows:
[0059]
[0060]
[0061] in, represents the attention function, and The multi-granularity representation of is gradually constructed as and .in, Indicates different granularity.
[0062] The third layer of the DAM algorithm is the matching layer, which represents the multi-granularity of each text output by the second representation layer. and In particle size Construct the self-attention matching matrix and the cross attention matching matrix Perform multi-granularity matching to obtain matching features.
[0063] Among them, the self-attention matching process is as follows:
[0064]
[0065] in, Represents the number of words in each sentence text, matrix Each element in is and The dot product of The Embedded and The The embedding reflects Middle fragments and Middle The fragment is in The text relevance at a certain granularity.
[0066] The cross-attention matching matrix is based on the cross-attention module, and the specific process is as follows:
[0067]
[0068]
[0069]
[0070] Through the attention module and Cross-attention is used to construct two new representations: and . and Captured across text queues Therefore, the interdependent segments within the conversation text are close to each other in the representation, and the dot products between these potential internal dependencies can be increased, providing dependency-aware matching information.
[0071] The fourth layer of the DAM algorithm is the aggregation layer. DAM finally aggregates the text in the queue. The matching degrees of all segments of the text and the text to be recognized are aggregated into a 3D matching image Q. The specific process is as follows:
[0072]
[0073]
[0074] in, Represents a cascade operation, each pixel has The DAM algorithm then uses a double-layer convolution with a maximum pooling operation to extract important matching features from the entire image. Finally, through a single-layer perceptron, the extracted matching features are used To calculate the matching score , the specific process is as follows:
[0075]
[0076] in, represents the matching function, and is the learning parameter, is the sigmoid function.
[0077] For the sake of simplicity, only the sentence-level features are described above for matching and fusion based on the DAM algorithm. In fact, the matching and fusion of word-level features based on the DAM algorithm are similar and will not be elaborated here.
[0078] S104, classifying the fused features through intent to obtain the intent corresponding to the recognized text.
[0079] In a specific embodiment, the fused features are further subjected to a two-layer convolutional neural network for deeper feature extraction and dimensionality reduction, and finally the softmax function is used for intent classification to obtain the intent corresponding to the recognized text. The types of intent are pre-set in the intelligent customer service system.
[0080] Optionally, in the task-based robot customer service system, the intent classification is set to, but not limited to, checking the weather, setting an alarm, ordering food, booking tickets, playing songs, etc. For example, if the customer inputs "I want to listen to Zhou XX's song", it can be classified as the intent of playing songs; if the customer inputs "What's the weather like today", it can be classified as the intent of checking the weather; if the customer inputs "Please set an alarm for me at 6 o'clock tomorrow morning", it can be classified as the intent of setting an alarm.
[0081] S105, executing corresponding actions according to the intention corresponding to the text to be recognized.
[0082] In a specific embodiment, after obtaining the classified intent, the customer service system selects appropriate reply words from the corpus according to the current process link and the customer intent category. The words in the corpus are pre-set by the system. For example, after the customer enters "I feel great today" and the intent is classified, it can be classified as a mood intent. The customer service system finds the corpus of the mood intent from the pre-set corpus and selects appropriate words to reply to the customer, such as "What makes you feel so good? Share it with me quickly."
[0083] It is understandable that the intelligent customer service system of the embodiment of the present application is only for illustration, but the embodiment does not constitute any specific limitation on the function and scope of application of the present application. The text intent recognition method provided by the present application can also be applied to electronic devices such as mobile phones and computers. For example, in a search engine, the text intent recognition method provided by the present application is also applicable to recognizing the user's query intent based on one or more voices input by the user.
[0084] The embodiment of the present invention also provides a text intent recognition device, which can be used to implement the above-mentioned text intent recognition method embodiments of the present invention. Figure 4 , Figure 4 4 is a schematic diagram of a text intent recognition device provided by an embodiment of the present invention. The system 400 of this embodiment includes:
[0085] An acquisition unit 401 is used to acquire voice information and a text queue;
[0086] A pre-processing unit 402, used to convert the voice information into text to be recognized and add it to a text queue;
[0087] A feature extraction unit 403 is used to extract features from the text to be recognized and each text in the text queue to obtain text features of the text to be recognized and text features corresponding to each text;
[0088] A fusion unit 404 is used to obtain fusion features of the text to be recognized based on the text features of the text to be recognized and the text features of each text;
[0089] The classification unit 405 is used to classify the fused features through an intent classification model to obtain the intent corresponding to the text to be recognized.
[0090] In a specific implementation, see Figure 5 , Figure 5 403 is a structural diagram of a feature extraction unit provided in an embodiment of the present invention. The feature extraction unit 403 includes a first extraction unit 4031, a second extraction unit 4032, and a merging unit 4033.
[0091] The first extraction unit 4031 is used to extract word-level features using a word embedding matrix for each text in the recognition text and the text queue;
[0092] The second extraction unit 4032 is used to extract sentence-level features using multiple attention models for each text in the text to be recognized and the text queue;
[0093] The merging unit 4033 is used to combine the features at the word level and the features at the sentence level as features for recognizing text.
[0094] In a specific embodiment of the text intent recognition device of the present invention, the acquisition unit 402 is used to obtain the customer's voice information, and then use the voice recognition algorithm wav2letter++ algorithm to perform voice recognition, and convert the customer's input voice into the corresponding text to be recognized. At the same time, a text queue is obtained, wherein the text queue includes one or more texts. The text queue can accommodate The way to add text to the text queue is: after converting the voice information into the text to be recognized, when the number of texts in the text queue is less than When the text to be recognized is added to the text queue, the text in the text queue The texts are arranged in the order of time they were added; when the number of texts in the text queue is equal to When the text queue is reached, the text that is first added to the text queue is deleted, and the text to be recognized is added to the text queue.
[0095] In a specific embodiment, the first extraction unit 4031 is used to, first, use a word segmentation tool to perform word segmentation processing on each text in the text queue to obtain word , where the word segmentation tool can be jieba, SnowNLP, THULAC, NLPIR, etc. This embodiment of the present application does not constitute any limitation to this. After word segmentation, we can get the word Then, of the recognized text Words Mapping to word embedding matrix Get word vector Finally, connect The word vector is obtained Word vector matrix for recognized text As word-level features. After processing, the text can be obtained word vector matrix It can be understood that after the above processing of the text to be recognized, the word-level features of the text to be recognized can be obtained. .
[0096] Among them, the word embedding matrix It can be obtained by training the Word2vec model on 3 million text data, or it can be obtained by training on other models, and the present application embodiment does not impose any limitation on this. Before or after word segmentation, there can be corpus cleaning, part-of-speech tagging, and stop word removal, such as deleting noise data, removing modal particles according to a pre-set modal word list, etc., and the present application embodiment does not impose any limitation on this.
[0097] In a specific embodiment, the first extraction unit 4032 is used to, for the first The word-level feature vector matrix extracted from the text ,use Attention model for word embedding matrix Processing to Sentence features at different levels: Among them, The output of the attention model is taken as the The input of the attention model, i is a positive integer greater than or equal to 1 and less than m. That is, in The output of the previous attention model in the attention module is used as the input of the next attention model. As a sentence-level feature in a text, After processing, the text can be obtained Sentence-level features .like Figure 3 As shown, the feature word vector matrix at the word level As the input of the first attention model, the output of the first attention model is used as the input of the second attention model, and the output of the previous attention model is used as the input of the next attention model. Sentence features at different levels . Use it like this The attention model processing can obtain deeper semantic information. It can be understood that after the above processing of the text to be recognized, the sentence-level features of the text to be recognized can be obtained. .
[0098] In a specific embodiment, the first extraction unit 4033 is used to extract the first The first is the feature of identifying the word level of the text and the The features at the sentence level of the recognition text are combined as the first Features to identify text: , for the text queue The text gets It can be understood that for the text to be recognized, the features at the word level of the text to be recognized and the features at the sentence level are combined as the features of the text to be recognized, and the .
[0099] In a specific embodiment, the fusion unit 404 is used to obtain The DAM algorithm is used to identify the features of the text and the features of the text to be identified. Specifically, the word-level features of the text to be recognized are matched with the obtained The word-level features of the text to be recognized are matched to obtain the word-level matching results, and the word-level matching results are fused to obtain the first fusion feature; the sentence-level features of the text to be recognized are matched to the word-level features of the text to be recognized The sentence-level features of the text are matched to obtain the sentence-level matching results, and the sentence-level matching results are fused to obtain the second fused feature. The first fused feature and the second fused feature are fused to obtain the fused feature corresponding to the text to be recognized.
[0100] In a specific embodiment, the fused features are further extracted and dimensionally reduced using a two-layer convolutional neural network, and finally the softmax function is used to classify the intent to obtain the intent corresponding to the recognized text. The types of intent are pre-set in the intelligent customer service system.
[0101] Optionally, in the task-based robot customer service system, the intent classification is set to, but not limited to, checking the weather, setting an alarm, ordering food, booking tickets, playing songs, etc. For example, if the customer inputs "I want to listen to Zhou XX's song", it can be classified as the intent of playing songs; if the customer inputs "What's the weather like today", it can be classified as the intent of checking the weather; if the customer inputs "Please set an alarm for me at 6 o'clock tomorrow morning", it can be classified as the intent of setting an alarm.
[0102] In addition, an embodiment of the present invention provides an electronic device, which may include the text intent recognition method of any of the above embodiments of the present invention. Specifically, the electronic device may be, for example, a terminal device or a server.
[0103] An embodiment of the present invention further provides another electronic device, including:
[0104] A processor and a memory, the processor executes the code in the memory to complete the operation of the method of identifying the text of any of the above embodiments of the present application.
[0105] Figure 6 This is a structural block diagram of an electronic device provided by an embodiment of the present invention. Figure 6 , which shows a schematic diagram of the structure of an electronic device suitable for implementing a terminal device or a server in an embodiment of the present invention. Figure 6 As shown, the electronic device includes: one or more processors 601; one or more input devices 602, one or more output devices 603 and a memory 604. The processor 601, input device 602, output device 603 and memory 604 are connected via a bus 605. The memory 602 is used to store instructions, and the processor 601 is used to execute the instructions stored in the memory 602. Among them, the processor 601 is configured to call the program instruction execution:
[0106] Get voice information and text queues, and convert voice information into text to be recognized;
[0107] Extract features from the text to be recognized and each text in the text queue to obtain text features of the text to be recognized and text features corresponding to each text;
[0108] According to the text features of the text to be recognized and the text features corresponding to each text, a fusion feature corresponding to the text to be recognized is obtained;
[0109] The fused features are used to classify the intent through the intent classification model to obtain the intent corresponding to the text to be recognized.
[0110] It should be understood that in the embodiment of the present invention, the processor 601 may be a central processing unit (CPU), and the processor may also be 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 the processor may also be any conventional processor, etc.
[0111] The input device 602 may include a camera, wherein the camera has the functions of storing image files and transmitting image files, and the output device 603 may include a display, a hard disk, a USB flash drive, etc.
[0112] The memory 604 may include a read-only memory and a random access memory, and provide instructions and data to the processor 601. A portion of the memory 604 may also include a non-volatile random access memory. For example, the memory 604 may also store information about the device type.
[0113] In a specific implementation, the processor 601, input device 602, and output device 603 described in the embodiment of the present invention can execute the implementation methods described in various embodiments of a text intent recognition method and system provided by the embodiment of the present invention, which will not be repeated here.
[0114] In another embodiment of the present invention, a computer-readable storage medium is provided, which stores a computer program, and the computer program includes program instructions. When the program instructions are executed by a processor, the following are implemented: acquiring voice information and a text queue, converting the voice information into text to be recognized, the text queue includes one or more texts; extracting features from the text to be recognized and each text in the text queue to obtain text features of the text to be recognized and text features corresponding to each text; obtaining fused features of the text to be recognized based on the text features of the text to be recognized and the text features of each text; and classifying the fused features through an intent classification model to obtain the intent corresponding to the text to be recognized.
[0115] The computer-readable storage medium may be an internal storage unit of the electronic device of any of the foregoing embodiments, such as a hard disk or memory of a terminal. The computer-readable storage medium may also be an external storage device of a terminal, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the terminal. Furthermore, the computer-readable storage medium may also include both an internal storage unit of an electronic device and an external storage device. The computer-readable storage medium is used to store computer programs and other programs and data required by the electronic device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0116] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0117] Technical personnel in the relevant field can clearly understand that, for the convenience and simplicity of description, the specific working processes of the servers, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments, and can also execute the implementation methods of the electronic devices described in the embodiments of the invention, which will not be repeated here.
[0118] In the several embodiments provided by the present invention, it should be understood that the disclosed servers, devices and methods can be implemented in other ways. For example, the server embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, or it can be an electrical, mechanical or other form of connection.
[0119] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present invention.
[0120] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0121] If the integrated unit 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. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0122] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A text intent recognition method, characterized in that: include: Acquire voice information and a text queue, and convert the voice information into text to be recognized, wherein the text queue includes one or more texts; For the text to be recognized, extract word-level features to obtain word-level features of the text to be recognized, use m attention models to extract sentence-level features to obtain sentence-level features of the text to be recognized, and use the word-level features of the text to be recognized and the sentence-level features of the text to be recognized as text features of the text to be recognized; wherein m is a positive integer greater than 1; For each of the texts, extract word-level features to obtain word-level features of each of the texts, use m attention models to extract sentence-level features to obtain sentence-level features of each of the texts, and use the word-level features of each of the texts and the sentence-level features of each of the texts as text features of each of the texts; Using the deep attention matching algorithm DAM, the text features of the text to be recognized and the text features of each text are matched and fused at different granularities to obtain a first fused feature; Using the deep attention matching algorithm DAM, the text features of the text to be recognized and the text features of each text are matched and fused at different granularities to obtain a second fused feature; Fusing the first fusion feature and the second fusion feature to obtain a fusion feature of the text to be recognized; The fused features are classified by an intent classification model to obtain the intent corresponding to the text to be recognized.
2. The method according to claim 1, characterized in that: The text queue accommodates After converting the voice information into the text to be recognized, the method further comprises: When the number of texts in the text queue is less than When the text to be recognized is added to the text queue, the text in the text queue The texts are arranged in the order of their accession; When the number of texts in the text queue is equal to When the text queue is deleted, the text added first in the text queue is deleted, and the text to be recognized is added to the text queue.
3. The method according to claim 1, characterized in that: The step of extracting word-level features from the text to be recognized to obtain word-level features of the text to be recognized includes: Use a word segmentation tool to segment the text to be recognized to obtain n words, and segment each text into Map words to the word embedding matrix V to obtain n word vectors, and connect the n word vectors to obtain the word vector matrix of each text as the word level feature of the text to be recognized; For each of the texts, extract word-level features to obtain word-level features of each of the texts, including: Use a word segmentation tool to segment each of the texts to obtain n words, map the n words in each of the texts to a word embedding matrix V to obtain n word vectors, and connect the n word vectors to obtain a word vector matrix for each of the texts as word-level features of each of the texts.
4. The method according to claim 1, characterized in that The method of extracting sentence-level features using m attention models to obtain sentence-level features of the text to be recognized includes: The word vector matrix of the text to be recognized is processed using m attention models to obtain features at m different levels, and the features at m different levels are used as sentence-level features of the text to be recognized; wherein the output of the i-th attention model is used as the input of the i+1-th attention model, and each of the m attention models outputs features at one level, where i is a positive integer greater than or equal to 1 and less than m.
5. The method according to claim 4, characterized in that The m attention models are used to extract sentence-level features to obtain sentence-level features of each text, including: The word vector matrix of each text is processed using m attention models to obtain features at m different levels, and the features at m different levels are used as sentence-level features of each text.
6. A text intention recognition device, characterized in that: include: An acquisition unit, used to acquire voice information and text queues; A preprocessing unit, used for converting the voice information into text to be recognized and adding it to a text queue; A feature extraction unit, used for extracting word-level features of the text to be recognized, obtaining word-level features of the text to be recognized, using m attention models to extract sentence-level features, obtaining sentence-level features of the text to be recognized, and using the word-level features of the text to be recognized and the sentence-level features of the text to be recognized as text features of the text to be recognized; wherein m is a positive integer greater than 1; for each of the texts, extracting word-level features, obtaining word-level features of each of the texts, using m attention models to extract sentence-level features, obtaining sentence-level features of each of the texts, and using the word-level features of each of the texts and the sentence-level features of each of the texts as text features of each of the texts; A fusion unit is used to match and fuse the text features of the text to be recognized and the text features of each text at different granularities using a deep attention matching algorithm DAM to match and fuse the word-level features of the text to be recognized and the word-level features of each text at different granularities to obtain a first fused feature; match and fuse the text features of the text to be recognized and the text features of each text at different granularities using a deep attention matching algorithm DAM to match and fuse the sentence-level features of the text to be recognized and the sentence-level features of each text at different granularities to obtain a second fused feature; fuse the first fused feature and the second fused feature to obtain a fused feature of the text to be recognized; The classification unit is used to classify the fused features into intents through an intent classification model to obtain the intent corresponding to the text to be recognized.
7. A text intent recognition device, characterized in that: include: A processor and a memory, wherein the processor executes the code in the memory to perform the method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The method comprises instructions, which, when executed on a computer, cause the computer to execute the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Text classification method and device based on classification model, and model training method
CN110781305A
Speech recognition method and apparatus, storage medium and electronic device
WO2020211006A1