An intent category identification method and device, an electronic device, and a storage medium
By training an intent recognition model using simulated datasets and data augmentation techniques, the problem of text classification models struggling to identify unknown intent categories is solved, achieving more efficient and accurate intent recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHONGKE DINGFU BEIJING TECH DEV
- Filing Date
- 2022-03-25
- Publication Date
- 2026-05-19
AI Technical Summary
Existing text classification models struggle to identify text of unknown intent categories that have not been trained, resulting in low recognition accuracy.
By training the intent recognition model using a simulated dataset, which includes unknown intent text that logically conflicts with the original text and known intent text that does not logically conflict, and combining data augmentation techniques such as random replacement, deletion, addition, and movement of words, the implication model is used to judge logical conflicts, thereby improving the model training efficiency.
It effectively identifies text of unknown intent categories, improves the training efficiency and recognition accuracy of intent recognition models, and avoids the inefficiency caused by manually annotating unknown intent datasets.
Smart Images

Figure CN114661908B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical fields of artificial intelligence and natural language processing, and more specifically, to an intent category recognition method, apparatus, electronic device, and storage medium. Background Technology
[0002] Intention identification, also known as intent category identification, refers to the process in the field of Natural Language Processing (NLP) of identifying the intent of text content and obtaining the semantically expressed intent category of the text content.
[0003] Currently, text classification models based on neural network structures are commonly used to identify the intent category of text content, thereby obtaining the semantic intent expressed by the text content. However, in practice, it has been found that these text classification models have good accuracy for text with intent categories that have already been trained on, but they have difficulty identifying text with unknown intent categories that have not been trained on. Summary of the Invention
[0004] The purpose of this application is to provide an intent category recognition method, apparatus, electronic device, and storage medium to improve the problem of difficulty in recognizing unknown intent category text that has not been trained.
[0005] This application provides an intent category recognition method, including: acquiring a text to be recognized; using an intent recognition model to recognize the intent category of the text to be recognized, thereby obtaining the intent category of the text to be recognized. The intent recognition model is obtained by training using a simulated dataset, which includes: unknown intent text that has logical conflict with the original text, and known intent text that does not have logical conflict with the original text.
[0006] In the implementation of the above scheme, the intent recognition model trained on a simulated dataset containing text with unknown intent effectively identifies the intent category of the text, avoiding the situation in traditional models where text with unknown intent categories is still classified as text with known intent categories. Since the simulated dataset includes text with unknown intent that has logical conflict with the original text, as well as text with known intent that does not have logical conflict with the original text, the intent recognition model trained on the simulated dataset can effectively identify the intent category of text with unknown intent.
[0007] Optionally, in this embodiment of the application, before using the intent recognition model to recognize the intent category of the text to be recognized, the method further includes: obtaining multiple original texts with known intent categories; performing data augmentation changes on the multiple original texts to obtain multiple simulated changed texts; determining the intent of the multiple original texts and the changed texts corresponding to the original texts to obtain a simulated dataset; and using the simulated dataset to train the intent recognition neural network to obtain the intent recognition model.
[0008] In the implementation of the above scheme, by performing data augmentation changes on multiple original texts, the intent of multiple original texts and their corresponding changed texts is determined, and a simulated dataset for training the intent recognition model is obtained. This avoids the problem of low training efficiency of the intent recognition model caused by manually collecting and labeling unknown intent datasets, and effectively improves the training efficiency of the intent recognition model.
[0009] Optionally, in embodiments of this application, data augmentation changes are performed on multiple original texts, including: randomly replacing at least one word in the original text using a mask; and / or randomly deleting at least one word in the original text; and / or randomly selecting at least one word from a word library and adding at least one word to the original text; and / or randomly selecting at least one word from multiple words in the original text and moving at least one word to the beginning position of the original text.
[0010] In the implementation of the above scheme, the original text is augmented by using various methods such as random replacement, random deletion, random addition and / or random movement, which increases the probability of simulating text with unknown intent and obtains a simulated dataset for training the intent recognition model. This avoids the problem of low training efficiency of the intent recognition model caused by manually collecting and labeling unknown intent datasets, and effectively improves the training efficiency of the intent recognition model.
[0011] Optionally, in this embodiment of the application, using a mask to randomly replace at least one word in the original text includes: performing chunking analysis on the original text to obtain phrases composed of multiple words, and using a mask to replace the position of the phrases in the original text; and / or performing dependency analysis on the original text to obtain relational tags for each word in the original text, and replacing the word with a mask according to the relational tags of each word.
[0012] In the implementation of the above scheme, after performing chunking analysis or dependency analysis on the original text, a mask is used to replace it based on the analysis results. This increases the accuracy of simulating unknown intent text and obtains a more accurate simulated dataset to train the intent recognition model. This avoids the problem of low training efficiency of the intent recognition model caused by manually collecting and labeling unknown intent datasets, and effectively improves the training efficiency of the intent recognition model.
[0013] Optionally, in this embodiment of the application, data intent determination is performed on multiple original texts and their corresponding variant texts to obtain a simulated dataset, including: using an implication model to determine whether there is a logical conflict between each original text and its corresponding variant text; if so, the intent category of the variant text is determined as an unknown intent text, otherwise, the intent category of the variant text is determined as a known intent text; the original texts, their corresponding variant texts, and the intent categories of the variant texts are determined as a simulated dataset; wherein, the intent categories of the variant texts include: unknown intent texts and known intent texts.
[0014] In the implementation of the above scheme, the intent category of the changed text is determined as unknown intent text or known intent text by using the implication model. The original text, the changed text corresponding to the original text, and the intent category of the changed text are determined as a simulated dataset, thereby increasing the accuracy of simulating unknown intent text and obtaining a more accurate simulated dataset to train the intent recognition model. This avoids the problem of low training efficiency of the intent recognition model caused by manually collecting and labeling datasets of unknown intent, and effectively improves the training efficiency of the intent recognition model.
[0015] Optionally, in this embodiment of the application, before using the implication model to determine whether there is a logical conflict between each original text and the corresponding variant text, the method further includes: obtaining premise text, inference text, and sample labels, wherein the sample labels are the implication relationship between the premise text and the inference text, and the implication relationship includes logical conflict categories; and using the premise text, inference text, and sample labels to train an implication neural network to obtain an implication model.
[0016] In the implementation of the above scheme, an implication neural network is trained by using premise text, inference text and sample labels to obtain an implication model for determining unknown intent text. This avoids the problem of low training efficiency of intent recognition model caused by manually collecting and labeling datasets of unknown intent, and effectively improves the training efficiency of intent recognition model.
[0017] Optionally, in the embodiments of this application, the implied model includes: BART model, BERT model or RoBERTa model.
[0018] This application embodiment also provides an intent category recognition device, including: a recognition text acquisition module for acquiring text to be recognized; and an intent category recognition module for using an intent recognition model to recognize the intent category of the text to be recognized, thereby obtaining the intent category of the text to be recognized. The intent recognition model is obtained by training using a simulated dataset, which includes: unknown intent text that has logical conflict with the original text, and known intent text that does not have logical conflict with the original text.
[0019] Optionally, in this embodiment of the application, the intent category recognition device further includes: an original text acquisition module, used to acquire multiple original texts with known intent categories; a modified text acquisition module, used to perform data augmentation changes on the multiple original texts to obtain multiple simulated modified texts; a simulated data acquisition module, used to determine the data intent of the multiple original texts and the modified texts corresponding to the original texts to obtain a simulated dataset; and a recognition model training module, used to train the intent recognition neural network using the simulated dataset to obtain an intent recognition model.
[0020] Optionally, in this embodiment of the application, the changed text acquisition module includes: a text mask replacement submodule, used to randomly replace at least one word in the original text using a mask; and / or, to randomly delete at least one word in the original text; and / or, to randomly select at least one word from a word library and add at least one word to the original text; and / or, to randomly select at least one word from multiple words in the original text and move at least one word to the beginning position of the original text.
[0021] Optionally, in this embodiment, the text mask replacement submodule includes: a text chunking analysis module, used to perform chunking analysis on the original text to obtain phrases composed of multiple words, and use a mask to replace the position of the phrases in the original text; and / or, a text dependency analysis module, used to perform dependency analysis on the original text to obtain the relational label of each word in the original text, and replace the word with a mask according to the relational label of each word.
[0022] Optionally, in this embodiment, the simulation data acquisition module includes: a logical conflict judgment submodule, used to use an implication model to determine whether there is a logical conflict between each original text and the corresponding variant text; an unknown intent determination submodule, used to determine the intent category of the variant text as an unknown intent text if there is a logical conflict between the original text and the corresponding variant text, otherwise, to determine the intent category of the variant text as a known intent text; and a simulation data determination submodule, used to determine the original text, the corresponding variant text, and the intent category of the variant text as a simulation dataset; wherein the intent category of the variant text includes: unknown intent text and known intent text.
[0023] Optionally, in this embodiment, the simulated data acquisition module further includes: a text label acquisition submodule, used to acquire premise text, inference text and sample labels, wherein the sample labels are the implication relationship between the premise text and the inference text, and the implication relationship includes logical conflict categories; and an implication model training module, used to train an implication neural network using the premise text, inference text and sample labels to obtain an implication model.
[0024] Optionally, in the embodiments of this application, the implied model includes: BART model, BERT model or RoBERTa model.
[0025] This application also provides an electronic device, including a processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the machine-readable instructions, when executed by the processor, perform the method described above.
[0026] This application also provides a computer-readable storage medium storing a computer program that is executed by a processor to perform the methods described above. Attached Figure Description
[0027] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0028] Figure 1 The diagram shown is a flowchart illustrating the intent category recognition method provided in an embodiment of this application.
[0029] Figure 2 The diagram shown is a flowchart illustrating the training intent recognition model provided in an embodiment of this application.
[0030] Figure 3 The diagram shown illustrates the variations in data enhancement provided in the embodiments of this application.
[0031] Figure 4 The diagram shown is a structural schematic of the intent category recognition device provided in an embodiment of this application. Detailed Implementation
[0032] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. The components of the embodiments of this application described and shown in the accompanying drawings can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed embodiments of this application, but merely represents selected embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of the embodiments of this application.
[0033] It is understood that the terms "first" and "second" in the embodiments of this application are used to distinguish similar objects. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and that the terms "first" and "second" are not necessarily different.
[0034] Before introducing the intent category recognition method provided in the embodiments of this application, let's first introduce some concepts involved in the embodiments of this application:
[0035] Natural Language Processing (NLP) refers to the study of natural language cognition, which is related to the need for extensive knowledge about the external world and the ability to manipulate that knowledge in order to understand natural language. Natural language cognition is also considered a problem related to AI-completeness, and natural language processing is an important component of machine learning.
[0036] Bidirectional Encoder Representations from Transformers (BERT), also known as bidirectional encoder representation based on Transformers or bidirectional encoder representation from Transformers, is a language representation model designed to be trained on large-scale unlabeled corpora.
[0037] Dependency parsing reveals the syntactic structure of a sentence by analyzing the dependency relationships between its constituent parts. It argues that the core verb in a sentence is the central constituent that governs other constituents, but it itself is not governed by any other constituents; all governed constituents are subordinate to the governing verb through some dependency relationship. Dependency grammar analyzes a sentence as a dependency syntactic tree, describing the dependency relationships between words and indicating the syntactic collocation relationships between words, which are semantically related.
[0038] It should be noted that the intent category recognition method provided in this application can be executed by an electronic device. Here, an electronic device refers to a device terminal or server with the function of executing computer programs. Device terminals include, for example, smartphones, personal computers, tablets, personal digital assistants, or mobile internet devices. A server refers to a device that provides computing services through a network. Servers include, for example, x86 servers and non-x86 servers. Non-x86 servers include, for example, mainframes, minicomputers, and UNIX servers.
[0039] The following describes the application scenarios applicable to this intent category recognition method, including but not limited to: text classification, public opinion monitoring, news classification, and sentiment classification. Taking intent recognition as an example, this intent category recognition method can be used to identify the intent category of text content. In practice, text category labels are often incomplete. For example, in a news classification task, assuming three intent category labels are set: sports, economy, and entertainment, a model trained using these three intent category labels can identify these three intents well. However, when using this model for intent recognition, if political news text is encountered, this intent category recognition method can be used to determine the political news text as an unknown intent category, instead of still choosing the category with the highest probability from sports, economy, and entertainment.
[0040] Please see Figure 1 The illustrated flowchart shows an intent category recognition method provided in an embodiment of this application; the implementation of this intent category recognition method may include:
[0041] Step S110: Obtain the text to be recognized.
[0042] Step S120: Use the intent recognition model to identify the intent category of the text to be identified, and obtain the intent category of the text to be identified. The intent recognition model is obtained by training using a simulated dataset. The simulated dataset includes: unknown intent texts that have logical conflicts with the original text, and known intent texts that do not have logical conflicts with the original text.
[0043] An intent identification model is a neural network model used to identify the intent in text. This intent identification model is trained using simulated text with unknown intent and text with known intent.
[0044] In the above implementation process, the intent recognition model trained on a simulated dataset containing text with unknown intent effectively identifies the intent category of the text, avoiding the situation in traditional models where text with unknown intent categories is still classified as text with known intent categories. Since the simulated dataset includes text with unknown intent that has logical conflict with the original text, as well as text with known intent that does not have logical conflict with the original text, the intent recognition model trained on the simulated dataset can effectively identify the intent category of text with unknown intent.
[0045] Please see Figure 2 The diagram illustrates the flowchart of training an intent recognition model according to an embodiment of this application. As an optional implementation of the aforementioned intent category recognition method, the intent recognition model can be trained before use. If the intent recognition model has already been trained, it can be retrained after use to improve the accuracy of intent recognition. Specifically, supervised learning, semi-supervised learning, or unsupervised learning can be used. Here, supervised learning is used as an example. The process of training an intent recognition model using supervised learning can include:
[0046] Step S210: Obtain multiple raw texts for known intent categories.
[0047] Because the original text may logically conflict with the data-augmented version of the original text, and conversely, the original text may not logically conflict with the corresponding data-augmented version of the original text. This logical conflict is one type of implication relation in the field of natural language processing, referring to the semantic inference relationship between two texts.
[0048] Step S220: Perform data augmentation on multiple original texts to obtain multiple simulated altered texts.
[0049] Step S230: Determine the data intent of multiple original texts and their corresponding modified texts to obtain a simulated dataset.
[0050] The simulated dataset mentioned above includes three types of data: the original text and the corresponding variant text, as well as the category of the variant text. The category of the variant text can be a known intent category (i.e., a variant text that does not logically conflict with the original text) or an unknown intent category (i.e., a variant text that logically conflicts with the original text). The process of determining whether there is a logical conflict will be described in detail below.
[0051] Step S240: Train the intent recognition neural network using a simulated dataset to obtain an intent recognition model.
[0052] Understandably, while there are many ways to augment original text with data, the entailment relationship between the augmented text and the original text is limited. For example, suppose the original text is "A dog is playing frisbee in the snow." Taking the original text as premise P and the augmented text as hypothesis H, there are three possible scenarios between P and H: First, there is a logical conflict between P and H, such as "A cat is washing its face with its front paws." Second, there is an entailment relationship between P and H, meaning H can be inferred from P, such as "An animal is playing with plastic toys outdoors in the cold." Third, there is a neutral relationship between P and H, meaning there is neither a logical conflict nor an entailment relationship, such as "A pet is playing a fetch game with its owner."
[0053] Please see Figure 3 The illustration shows a data enhancement transformation method provided in the embodiment of this application; there are many ways to perform data enhancement on multiple original texts in step S220 above, including but not limited to the following:
[0054] The first method involves using a mask to randomly replace at least one word in the original text, resulting in a replaced text. This replacement can involve replacing only one word or multiple words. The method of random replacement using a mask includes: Firstly, performing chunking analysis on the original text to obtain phrases (here, a phrase refers to a chunk of words). Then, using a mask, the phrases are replaced with their positions in the original text. For example, if the phrase "Republic of South Africa" appears in a sentence, the phrase "Republic of South Africa" should be masked, rather than simply masking "South," "Africa," "South Africa," or "Republic." Another example: assuming the original text is "ABC, DE," when BC is found to be a chunk requiring masking, the replaced sentence can be represented as "A__, DE."
[0055] Of course, in practical application, besides the first mask replacement method mentioned above, the second mask replacement method can be used alone, or a combination of both can be used. The second mask replacement method here is specifically as follows: First, perform dependency parsing on the original text to obtain the relational labels for each word. Then, replace each word with a mask based on its relational label. For example, replace the noun subject (NSUBJ) in each sentence with a mask, or replace the direct object (DOBJ) in each sentence with a mask. Taking NSUBJ as an example, assuming the original text sentence is "ABC, DE", and the mask uses underscores, and the noun subjects are A and D, then the sentence after replacing NSUBJ in the matrix with the mask can be represented as "_BC, _E", where the underscores represent the mask.
[0056] Of course, in practice, there are many ways to choose the mask mentioned above. Other special symbols can also be used as masks, such as "#" or "¥". This operation appears to mask the original characters; therefore, masking is also called character masking or word masking. Furthermore, randomly selected words can be used as masks to achieve random word replacement, thus increasing the amount of original text available.
[0057] The second approach involves randomly deleting at least one word from the original text. Specifically, the number of words to be deleted can be randomly determined, and then deleted from the original text based on that number. Specifically, a word count can be randomly determined between 1 and a maximum threshold, and then deleted based on that count. To avoid affecting model training performance, the maximum threshold can be set to 0.2 times the number of words in the original text. For example, if the original text has 1000 words, a word count between 1 and 200 can be randomly determined, and then that randomly determined number of words can be deleted from the original text. For instance, if the randomly determined number of words is 1, and the sentence in the original text is "ABC, DE", where each letter represents a word, for a total of 5 words, then one word can be randomly deleted from the original sentence. The deleted word could be D, resulting in the sentence "ABC, E", or B could be deleted, resulting in the sentence "AC, DE".
[0058] The third variation involves randomly selecting at least one word from a vocabulary corpus and adding it to the original text. Specifically, the number of words to be added can be randomly determined, and then that number is added to the original text. For instance, a word count between 1 and a maximum threshold can be randomly selected, and then added to the original text based on that count. To avoid affecting model training, the maximum threshold can be set to 0.2 times the number of words in the original text (this can be adjusted as needed). For example, if the original text has 1000 words, a word count between 1 and 200 can be randomly selected, and then added to the original text based on that randomly selected word count. Assuming the randomly selected word count is 1, and the sentence in the original text is "ABC, DE", where each letter represents a word (5 words in total), a word can be added at different positions. The randomly selected word could be F, and the resulting sentence could be "ABC, DFE" or "ABFC, DE", etc.
[0059] The fourth method involves randomly selecting at least one word from multiple words in the original text and moving that word to the beginning of the original text. For example, if the sentence in the original text is "ABC, DE", then moving C to the beginning of the original text would result in the sentence "C, AB, DE".
[0060] The fifth variation method is formed by combining any two or more of the four variation methods mentioned above.
[0061] As an optional implementation of step S230 above, data intent determination is performed on the changed text. Specifically, the following processing can be performed on each original text and its corresponding changed text:
[0062] Step S231: Determine whether there is a logical conflict between each original text and the corresponding modified text.
[0063] The implementation of step S231 above can be exemplified by the following: An implication model (the specific structure and training process of which will be detailed below) can be used to determine whether there is a logical conflict between each original text and its corresponding variant text. Alternatively, in practice, this can also be done manually. Furthermore, other text classification neural network models can be used to determine whether there is a logical conflict between each original text and its corresponding variant text. Examples of other text classification neural network models include Convolutional Neural Network (CNN) models and Recurrent Neural Network (RNN) models.
[0064] Step S232: If there is a logical conflict between the original text and the corresponding variant text, then the intent category of the variant text is determined to be an unknown intent text.
[0065] Step S233: If there is no logical conflict between the original text and the corresponding variant text, determine the intent category of the variant text as a known intent text.
[0066] Step S234: Determine the original text, the corresponding variant text, and the intent category of the variant text as a simulated dataset; wherein, the intent category of the variant text includes: unknown intent text and known intent text.
[0067] As an optional implementation of step S230 above, if an implication model is used to determine whether a logical conflict exists, the implication model can be trained before using it to determine whether a logical conflict exists. The training method for the implication model can specifically employ supervised learning, semi-supervised learning, or unsupervised learning. Here, we will use supervised learning as an example. The specific process of training the implication model can include:
[0068] Step S235: Obtain the premise text, the reasoning text, and the sample labels. The sample labels are the implication relationships between the premise text and the reasoning text. The implication relationships include the categories of logical conflict, entailment, and neutrality.
[0069] Step S236: Train the entailment neural network using the premise text, inference text, and sample labels to obtain the entailment model.
[0070] As an optional implementation, the aforementioned implication model can employ a pre-trained language model, which includes, but is not limited to, Bidirectional and Auto-Regressive Transformers (BART) models, BERT models, or RoBERTa models. BART refers to a denoising autoencoder with a sequence-to-sequence model, applicable to a wide range of natural language processing tasks. BART combines bidirectional and auto-regressive transformers for pre-training, which consists of two stages: first, the text is corrupted by an arbitrary noise function; second, a sequence-to-sequence model is learned to reconstruct the original text. Of course, in specific implementations, other pre-trained language models can also be used, such as ELMo, GPT, and XLNet models.
[0071] Understandably, the reason the aforementioned implication model can identify logical conflicts between the original text and its variant text lies in the fact that it has already been trained using premise text, inference text, and sample labels. The sample labels indicate whether a logical conflict exists between the premise text and the inference text; that is, the sample labels already tell the implication model whether a logical conflict exists between the premise text and the inference text. The implication model can learn from these three sources—premise text, inference text, and sample labels—how to determine whether a logical conflict exists between two texts. Therefore, the trained implication model can identify whether there is a logical conflict between the original text and its corresponding variant text.
[0072] Similarly, the technical principle behind the above-mentioned intent recognition model's ability to identify the intent category of the text to be recognized lies in the fact that the intent recognition model is trained using a simulated dataset (including the original text, the modified text corresponding to the original text, and the intent category of the modified text). Since the intent recognition model is trained using a simulated dataset of unknown intent text and known intent text, the intent recognition model can learn from the original text, the modified text, and its intent category how to determine whether the modified text belongs to the intent category of the unknown intent text, thereby enabling the intent recognition model to identify the intent category of the text to be recognized.
[0073] Please see Figure 4 The diagram shown illustrates the structure of an intent category recognition device provided in an embodiment of this application. This application provides an intent category recognition device 300, comprising:
[0074] The text acquisition module 310 is used to acquire the text to be recognized.
[0075] The intent category recognition module 320 is used to identify the intent category of the text to be recognized using the intent recognition model, and obtain the intent category of the text to be recognized. The intent recognition model is trained using a simulated dataset, which includes: unknown intent text that has logical conflict with the original text, and known intent text that does not have logical conflict with the original text.
[0076] Optionally, in embodiments of this application, the intent category recognition device further includes:
[0077] The raw text acquisition module is used to acquire multiple raw texts of known intent categories.
[0078] The modified text acquisition module is used to perform data augmentation on multiple original texts to obtain multiple simulated modified texts.
[0079] The simulated data acquisition module is used to determine the data intent of multiple original texts and their corresponding modified texts to obtain a simulated dataset.
[0080] The recognition model training module is used to train the intent recognition neural network using a simulated dataset to obtain an intent recognition model.
[0081] Optionally, in this embodiment of the application, the changed text acquisition module includes:
[0082] The text mask replacement submodule is used to randomly replace at least one word in the original text using a mask; and / or to randomly delete at least one word in the original text; and / or to randomly select at least one word from a word library and add at least one word to the original text; and / or to randomly select at least one word from multiple words in the original text and move at least one word to the beginning position of the original text.
[0083] Optionally, in this embodiment of the application, the text mask replacement submodule includes:
[0084] The text chunking analysis unit is used to perform chunking analysis on the original text, obtain phrases composed of multiple words, and replace the positions of the phrases in the original text using a mask; and / or,
[0085] The text dependency analysis unit is used to perform dependency analysis on the original text, obtain the relation label of each word in the original text, and replace the word with a mask according to the relation label of each word.
[0086] Optionally, in this embodiment of the application, the simulation data acquisition module includes:
[0087] The logical conflict judgment submodule is used to determine whether there is a logical conflict between each original text and its corresponding variant text using the implication model.
[0088] The Unknown Intent Determination Submodule is used to determine the intent category of the changed text as unknown intent text if there is a logical conflict between the original text and the corresponding changed text; otherwise, it determines the intent category of the changed text as known intent text.
[0089] The simulation data determination submodule is used to determine the original text, the corresponding variant text, and the intent category of the variant text as a simulation dataset; wherein, the intent category of the variant text includes: unknown intent text and known intent text.
[0090] Optionally, in this embodiment of the application, the simulation data acquisition module further includes:
[0091] The text tag acquisition submodule is used to acquire premise text, reasoning text, and sample tags. Sample tags are the implication relationships between premise text and reasoning text, and implication relationships include logical conflict categories.
[0092] The Entailment Model Training Submodule is used to train the entailment neural network using the premise text, inference text, and sample labels to obtain the entailment model.
[0093] Optionally, in the embodiments of this application, the implied model includes: BART model, BERT model or RoBERTa model.
[0094] It should be understood that this device corresponds to the above-described intent category recognition method embodiment and is capable of performing the various steps involved in the above method embodiment. The specific functions of this device can be found in the description above, and detailed descriptions are omitted here to avoid repetition. The device includes at least one software functional module that can be stored in memory or embedded in the device's operating system (OS) in the form of software or firmware.
[0095] An electronic device provided in this application includes a processor and a memory. The memory stores machine-readable instructions that can be executed by the processor. When the machine-readable instructions are executed by the processor, the method described above is performed.
[0096] This application also provides a computer-readable storage medium storing a computer program, which is executed by a processor to perform the above-described method.
[0097] The computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0098] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For apparatus embodiments, since they are basically similar to method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0099] It should be understood that the disclosed apparatus and methods can also be implemented in other ways, as provided in the embodiments of this application. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in the flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the accompanying drawings. For example, two consecutive blocks may actually be executed substantially in parallel, or they may sometimes be executed in reverse order, depending primarily on the functions involved.
[0100] Furthermore, the functional modules of each embodiment in this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part. In addition, in the description of this specification, the reference to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., means that the specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples. Furthermore, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification and the features of different embodiments or examples.
[0101] In this document, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, without necessarily requiring or implying any such actual relationship or order between these entities or operations.
[0102] The above description is only an optional implementation of the embodiments of this application, but the protection scope of the embodiments of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the embodiments of this application should be covered within the protection scope of the embodiments of this application.
Claims
1. An intent category recognition method, characterized in that, include: Obtain the text to be recognized; The intent category of the text to be identified is determined by using an intent recognition model. When encountering text of an untrained category, the intent recognition model identifies it as an unknown intent category, rather than selecting the known category with the highest probability. The intent recognition model is trained using a simulated dataset, which includes: unknown intent text that logically conflicts with the original text, and known intent text that does not logically conflict with the original text. Prior to identifying the intent category of the text to be identified using the intent recognition model, the method further includes: Retrieve multiple raw texts of known intent categories; Data augmentation changes are performed on the multiple original texts to obtain multiple simulated changed texts; The implication model is used to determine whether there is a logical conflict between each original text and the corresponding variant text. The implication model is trained using premise text, inference text, and sample labels. The sample labels are the implication relationships between the premise text and the inference text. The implication relationships include logical conflict categories, implication relationship categories, and neutral relationship categories. If so, the intent category of the changed text is determined as unknown intent text; otherwise, the intent category of the changed text is determined as known intent text. The original text, the corresponding variant text, and the intent category of the variant text are defined as the simulated dataset; wherein, the intent category of the variant text includes: unknown intent text and known intent text; The intent recognition neural network is trained using the simulated dataset to obtain the intent recognition model.
2. The method according to claim 1, characterized in that, The data augmentation transformation of the plurality of original texts includes: At least one word in the original text is randomly replaced using a mask; And / or, randomly delete at least one word in the original text; And / or, randomly select at least one word from the vocabulary library and add the at least one word to the original text; And / or, randomly select at least one word from a plurality of words in the original text, and move the at least one word to the beginning position of the original text.
3. The method according to claim 2, characterized in that, The step of randomly replacing at least one word in the original text using a mask includes: The original text is subjected to chunk analysis to obtain phrases composed of multiple words, and the positions of the phrases in the original text are replaced with masks. And / or, Dependency analysis is performed on the original text to obtain the relation tags of each word in the original text, and the word is replaced with a mask according to the relation tags of each word.
4. The method according to claim 1, characterized in that, Before using the implication model to determine whether there is a logical conflict between each original text and the corresponding variant text, the method further includes: Obtain premise text, inference text, and sample tags, wherein the sample tags are the implication relationships between the premise text and the inference text, and the implication relationships include logical conflict categories; The entailment neural network is trained using the premise text, the reasoning text, and the sample labels to obtain the entailment model.
5. The method according to any one of claims 1-4, characterized in that, The implied models include: BART model, BERT model, or RoBERTa model.
6. An intent category recognition device, characterized in that, include: The text acquisition module is used to acquire the text to be recognized. The intent category recognition module is used to identify the intent category of the text to be recognized using an intent recognition model, and to obtain the intent category of the text to be recognized. When encountering text of an untrained category, the intent recognition model identifies it as an unknown intent category, rather than selecting the known category with the highest probability. The intent recognition model is trained using a simulated dataset, which includes: unknown intent text that logically conflicts with the original text, and known intent text that does not logically conflict with the original text. Prior to identifying the intent category of the text to be identified using the intent recognition model, the method further includes: Retrieve multiple raw texts of known intent categories; Data augmentation changes are performed on the multiple original texts to obtain multiple simulated changed texts; The implication model is used to determine whether there is a logical conflict between each original text and the corresponding variant text. The implication model is trained using premise text, inference text, and sample labels. The sample labels are the implication relationships between the premise text and the inference text. The implication relationships include logical conflict categories, implication relationship categories, and neutral relationship categories. If so, the intent category of the changed text is determined as unknown intent text; otherwise, the intent category of the changed text is determined as known intent text. The original text, the corresponding variant text, and the intent category of the variant text are defined as the simulated dataset; wherein, the intent category of the variant text includes: unknown intent text and known intent text; The intent recognition neural network is trained using the simulated dataset to obtain the intent recognition model.
7. An electronic device, characterized in that, include: A processor and a memory, the memory storing machine-readable instructions executable by the processor, which, when executed by the processor, perform the method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the method as described in any one of claims 1 to 5.