Intent recognition method, intent recognition device, storage medium and electronic device
By combining sentence structure and semantic features in the corpus, the problem of low intent recognition accuracy was solved, achieving higher intent recognition accuracy and fewer false recognitions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-21
- Publication Date
- 2026-04-03
AI Technical Summary
The accuracy of intent recognition in existing technologies is low, and misidentification is prone to occur.
By performing slot identification on the sentence to be identified to extract initial sentence structure features and semantic features, and then conducting a comprehensive and thorough search in the corpus, the intent of the sentence to be identified is determined by combining the initial sentence structure features and semantic features in the corpus.
It improves the accuracy of intent recognition and reduces false recognition.
Smart Images

Figure CN115221283B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of natural language processing technology, and in particular to an intent recognition method, intent recognition device, computer-readable storage medium, and electronic device. Background Technology
[0002] Intent recognition is an important task in natural language processing. For example, in the context of intelligent robots, users input commands to electronic devices (such as speakers and mobile phones) through voice interaction. The electronic devices recognize the user's intent, execute the relevant commands, and thus provide corresponding services, such as playing a specific song or making a phone call.
[0003] In related technologies, the accuracy of intent recognition needs to be improved. Summary of the Invention
[0004] This disclosure provides an intent recognition method, intent recognition device, computer-readable storage medium, and electronic device to at least improve the accuracy of intent recognition to a certain extent.
[0005] According to a first aspect of this disclosure, an intent recognition method is provided, comprising: performing slot recognition on a statement to be recognized to obtain initial sentence structure features of the statement to be recognized; extracting semantic features of the statement to be recognized; performing a search in a corpus based on the initial sentence structure features and the semantic features to obtain candidate search results; and determining the intent of the statement to be recognized based on the candidate search results.
[0006] According to a second aspect of this disclosure, an intent recognition device is provided, comprising: a sentence structure feature extraction module configured to perform slot recognition on a sentence to be recognized to obtain initial sentence structure features of the sentence to be recognized; a semantic feature extraction module configured to extract semantic features of the sentence to be recognized; a feature retrieval module configured to perform a retrieval in a corpus based on the initial sentence structure features and the semantic features to obtain candidate retrieval results; and an intent determination module configured to determine the intent of the sentence to be recognized based on the candidate retrieval results.
[0007] According to a third aspect of this disclosure, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the intent recognition method of the first aspect and its possible implementations.
[0008] According to a fourth aspect of this disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the intent recognition method of the first aspect and possible implementations thereof by executing the executable instructions.
[0009] The technical solution disclosed herein has the following beneficial effects:
[0010] This scheme extracts initial sentence structure features and semantic features from the sentence to be identified, searches the corpus, and determines the intent of the sentence based on the candidate search results. By comprehensively and thoroughly searching the corpus using these two aspects of initial sentence structure features and semantic features, it can recall candidate search results similar to the sentence to be identified at both the sentence structure and semantic levels, thereby determining the intent of the sentence to be identified. This improves the accuracy of intent recognition and reduces false identification. Attached Figure Description
[0011] Figure 1 A schematic diagram of a system architecture in this exemplary embodiment is shown;
[0012] Figure 2 This diagram illustrates a flowchart of an intent recognition method in this exemplary embodiment;
[0013] Figure 3 This diagram illustrates the offline construction of the corpus in this exemplary embodiment.
[0014] Figure 4 A sub-flowchart of the intent recognition method in this exemplary embodiment is shown;
[0015] Figures 5 to 7 This diagram illustrates a configuration interface intended to identify configuration information in this exemplary embodiment.
[0016] Figure 8 This exemplary embodiment shows a schematic flowchart of the intent recognition of the statement to be recognized;
[0017] Figure 9 This diagram illustrates the structure of an intent recognition device according to this exemplary embodiment.
[0018] Figure 10 A schematic diagram of the structure of an electronic device in this exemplary embodiment is shown. Detailed Implementation
[0019] Exemplary embodiments of this disclosure will be described more fully below with reference to the accompanying drawings.
[0020] The accompanying drawings are schematic illustrations of this disclosure and are not necessarily drawn to scale. Some block diagrams shown in the drawings may be functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in hardware modules or integrated circuits, or in networks, processors, or microcontrollers. Implementations can be carried out in various forms and should not be construed as limited to the examples set forth herein. The features, structures, or characteristics described in this disclosure can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough description of embodiments of this disclosure. However, those skilled in the art will recognize that one or more specific details may be omitted when implementing the technical solutions of this disclosure, or other methods, components, apparatuses, steps, etc., may be used to replace one or more specific details.
[0021] In related technologies, intent recognition is achieved by training machine learning models. However, the results of intent recognition are highly dependent on the quality of the model, which can easily lead to low accuracy and misidentification.
[0022] In view of the above problems, the exemplary embodiments of this disclosure first provide an intent recognition method for outputting the intent recognition result of the statement to be recognized.
[0023] The following is an explanation of the nouns and terms used in this article.
[0024] A domain (or vertical domain) refers to a specific business scenario, such as music or weather. In this exemplary embodiment, the intent recognition of the statement to be recognized can be performed within one or more domains to obtain its intent within those domains.
[0025] Intent refers to the purpose that a statement intends to express. For example, if the statement to be identified is "Xiao Bu, I want to listen to Jay Chou's 'Seven Mile Fragrance'", its intent could be "to play the song".
[0026] Slot: refers to the attribute of a word in a sentence, which can be the semantic category of the word. For example, in the sentence to be recognized, "Xiao Bu, I want to listen to JAY's 'Seven Mile Fragrance'", the slot for the word "Seven Mile Fragrance" could be [song] (song title).
[0027] The following is combined Figure 1 The system architecture and application scenarios of the operating environment of this exemplary implementation are described in an exemplary manner.
[0028] Figure 1A schematic diagram of the system architecture is shown. System architecture 100 may include a terminal 110 and a server 120. The terminal 110 may be a smartphone, tablet, personal computer, etc., and can receive user input or specified statements to be recognized. The server 120 can generally refer to a backend system providing intent recognition-related services (such as an intelligent voice service system), and may be a single server or a cluster of multiple servers. The terminal 110 and server 120 can be connected via wired or wireless communication links for data exchange.
[0029] In one implementation, a user inputs a statement to be recognized into terminal 110. For example, a user can invoke a smart robot on terminal 110 and input a voice command. Terminal 110 converts the voice command into a text-formatted statement to be recognized. Then, terminal 110 can send the statement to be recognized to server 120. Server 120 obtains the intent of the statement by executing the aforementioned intent recognition method and can return the intent to terminal 110, enabling terminal 110 to respond to the user's voice command based on the intent.
[0030] In one implementation, this exemplary implementation can also be implemented independently based on terminal 110. For example, after obtaining the user-inputted statement to be recognized, terminal 110 obtains the intent of the statement to be recognized by executing the above-described intent recognition method.
[0031] In one implementation, this exemplary implementation can also be implemented independently based on server 120. For example, server 120 can obtain the statement to be identified from a background database and obtain the intent of the statement to be identified by executing the intent recognition method described above.
[0032] As can be seen from the above, in this exemplary embodiment, the intent recognition method can be executed by the terminal 110 or the server 120. This disclosure does not limit this.
[0033] The following is combined Figure 2 The intent recognition method in this exemplary embodiment will be described. Figure 2 An exemplary flow of the intent recognition method is shown, which may include the following steps S210 to S240:
[0034] Step S210: Slot identification is performed on the statement to be identified to obtain the initial sentence structure features of the statement to be identified;
[0035] Step S220: Extract the semantic features of the statement to be identified;
[0036] Step S230: Search the corpus based on the initial sentence structure features and semantic features to obtain candidate search results;
[0037] Step S240: Determine the intent of the sentence to be recognized based on the candidate retrieval results.
[0038] In the above intent recognition method, initial syntactic features and semantic features are extracted from the sentence to be recognized, retrieved in the corpus, and the intent of the sentence to be recognized is determined based on the retrieved candidate retrieval results. By comprehensively and fully retrieving in the corpus through these two aspects of features, namely initial syntactic features and semantic features, candidate retrieval results similar to the sentence to be recognized can be recalled from both the syntactic and semantic levels, and thus the intent of the sentence to be recognized can be determined, which can improve the accuracy of intent recognition and reduce the situation of misrecognition.
[0039] The following Figure 2 will specifically describe each step.
[0040] Refer to Figure 2 , in step S210, slot recognition is performed on the sentence to be recognized to obtain the initial syntactic features of the sentence to be recognized.
[0041] The sentence to be recognized is the sentence for which intent recognition is required. The present disclosure does not limit the source of the sentence to be recognized. For example, it can be a query sentence input by the user in any way, or a sentence obtained from the Internet, such as a dialogue sentence in a forum, a sentence in an article, a sentence extracted from a video, etc.
[0042] Syntactic features are features that include information such as the entity composition and sentence structure of the sentence, which can reflect the user's expression and semantics to a certain extent, and thus reflect the intent. The syntactic features obtained in step S210 may be further processed in subsequent steps to generate other syntactic features. For the sake of distinction, the syntactic features obtained in step S210 are referred to as initial syntactic features.
[0043] In this exemplary embodiment, performing slot recognition on the sentence to be recognized may include determining the slots of the keywords in the sentence to be recognized, and obtaining the initial syntactic features of the sentence to be recognized based on the slots of the keywords. The initial syntactic features of the sentence to be recognized may include the original information (or a part of the original information) of the sentence to be recognized and the slots of the keywords. For example, for the sentence to be recognized "Xiaobu, I want to listen to Jay's Qi Li Xiang", its initial syntactic features may be "Xiaobu, I want to listen to <singer: jay>'s <song: Qi Li Xiang>". <神仙文案>
[0044] Keywords can be words with actual meanings in the sentence to be recognized, or words with actual meanings in a certain field. Each keyword may correspond to one slot or multiple slots. The present disclosure does not limit the method of extracting keywords from the sentence to be recognized and performing slot recognition, such as any one of the following methods or a combination of multiple methods:
[0045] Keyword extraction based on word segmentation: This method removes prefixes, suffixes, and stop words from the sentence to be identified, and then segments the remaining part to obtain keywords.
[0046] Slot-based identification using a dictionary: A dictionary can be a collection of words in a specific or general domain. When constructing the dictionary, the slot for each word can be determined. Words from the dictionary are searched within the sentence to be identified, and these found words are extracted as keywords, thus determining their slots. This method allows for exhaustive enumeration of keywords and their slots. For example, using a music-related dictionary, the keywords "JAY" and "Seven Mile Fragrance" are extracted from the sentence "Xiao Bu, I want to listen to JAY's Seven Mile Fragrance," and the slot for "JAY" is determined. <singer>(Singer), the slot for "Seven Mile Fragrance" is <song>(song).
[0047] Rule-based slot identification: Rules can be expressed as regular expressions, etc. The process involves searching for substrings that match the rules in the sentence to be identified, thus obtaining the keywords in the sentence. Based on the slots set in the rules, the slot for each keyword is determined. This method can identify relatively complex keywords (such as keywords that are essentially phrases) and their corresponding slots.
[0048] Model-based slot identification: The model is typically designed for a specific category of words, such as names of people or places. By training the corresponding model, the slots can be determined based on keywords of a specific category in the sentence to be identified. This method has a certain degree of generalization ability and can be used for the extraction and slot identification of keywords that have not appeared before.
[0049] In one implementation, after obtaining the sentence to be recognized, text preprocessing can be performed before slot recognition. Text preprocessing may include, but is not limited to: text standardization, such as converting uppercase letters to lowercase letters, traditional Chinese to simplified Chinese, and full-width characters to half-width characters; text cleaning, such as deleting non-text content (emoticons, special characters, etc.) and punctuation marks; text correction, such as correcting typos; and text length processing, which can standardize the sentence length, such as filling in pre-defined words for sentences that are too short, and trimming sentences that are too long. Through text preprocessing, the sentence to be recognized can be more standardized, reducing interference information and minimizing its adverse effects on slot recognition and subsequent processing steps, thereby improving the accuracy of slot recognition and final intent recognition.
[0050] Continue to refer to Figure 2 In step S220, the semantic features of the statement to be identified are extracted.
[0051] Semantic features are features derived from the semantic understanding of a statement, and are distinct from sentence structure features. For example, the statements "Who is A's wife?", "Who is A's daughter-in-law?", and "A married whom?" have different sentence structures, but their semantics are very similar. Therefore, in addition to sentence structure features, this exemplary embodiment also extracts the semantic features of the statement to be identified, thus comprehensively and fully representing the statement to be identified from both sentence structure and semantic features.
[0052] It should be understood that sentence structure features may contain some semantic information, and semantic features may contain some sentence structure information. Therefore, there may be overlap between the information in sentence structure features and semantic features.
[0053] This disclosure does not limit the specific form of semantic features; for example, semantic features can be semantic feature vectors or semantic feature matrices, etc.
[0054] Generally, the text of the statement to be recognized can be mapped to a semantic space to obtain semantic features.
[0055] In one implementation, the sentence to be identified can be sparsely encoded first, such as one-hot encoding of the words in the sentence to be identified to obtain sparse features of the sentence to be identified; then the sparse features of the sentence to be identified can be mapped to a dense semantic space, such as using embedding to map the sparse features to embedding feature data as semantic features of the sentence to be identified.
[0056] In one implementation, a pre-trained semantic representation model can be used to process the sentence to be recognized to obtain its semantic features. This semantic representation model can be a neural network model or other types of machine learning models, which encode the sentence at the semantic level to represent its semantic features. For example, the semantic representation model can be a recurrent structure model such as an RNN (Recurrent Neural Network), LSTM (Long Short-Term Memory), or GRU (Gated Recurrent Unit), which can extract sequence information from the sentence to be recognized and perform semantic encoding based on word context to output semantic features.
[0057] In one implementation, since obtaining ground truth data for semantic features is difficult, an easily labeled semantic processing model can be set up first. This model can be used for semantic classification (inputting a sentence and outputting the corresponding semantic classification result) and semantic response (inputting a sentence and outputting the corresponding response sentence). The required training data, including training sentences and labeled data, is then acquired. For example, in semantic classification, the labeled data is the semantic classification result of the training sentence; in semantic response, the labeled data is the response sentence corresponding to the training sentence. The semantic processing model is trained using the training data, enabling supervised learning. After training, a sub-model is extracted from the semantic processing model, such as the sub-model from the input end to the encoding end, to serve as the semantic representation model. Alternatively, the sub-model can be further trained to serve as the semantic representation model. This solves the problem of directly performing supervised learning on the semantic representation model and improves model quality.
[0058] In one implementation, a BERT (Bidirectional Encoder Representation from Transformers) model can be pre-trained, and then the BERT model can be fine-tuned to obtain a semantic representation model.
[0059] Once a trained semantic representation model is obtained, the sentence to be recognized is input into the semantic representation model, and after processing, the corresponding semantic features are output.
[0060] It should be noted that steps S210 and S220 are two independent steps, and this disclosure does not limit their order. For example, steps S210 and S220 can be performed simultaneously, that is, the initial sentence structure features and semantic features of the sentence to be identified can be extracted at the same time.
[0061] Continue to refer to Figure 2 In step S230, a search is performed in the corpus based on the initial sentence structure features and semantic features to obtain candidate search results.
[0062] A corpus is a pre-built library containing a large amount of linguistic information. A corpus can be domain-specific or domain-general. In one implementation, corpora can be built for multiple domains to obtain multiple corpora. Then, in step S230, retrieval can be performed separately in each of the multiple corpora.
[0063] Information similar to the initial sentence structure and semantic features can be retrieved from the corpus, thereby achieving retrieval recall and obtaining candidate retrieval results.
[0064] In one implementation, the corpus may include sample data, sample sentence structure features, and sample semantic features. The sample data may be collected statements, such as those collected by developers using web crawlers or from users' historical queries. Sample sentence structure features refer to the sentence structure characteristics of the sample data. For example, step S210 can be used to perform slot identification on the sample data to obtain its initial sentence structure features, which serve as the sample sentence structure features corresponding to the sample data. Sample semantic features refer to the semantic features of the sample data. For example, step S220 can be used to extract semantic features from the sample data to obtain the sample semantic features corresponding to the sample data.
[0065] In one implementation, intent recognition can be performed on the statements of a user's historical queries. For example, the intent recognition method in this exemplary implementation can be used for processing. During the processing, the sentence structure features (such as initial sentence structure features or sentence structure features to be retrieved) and semantic features of the statement will be obtained. The statement and its sentence structure features and semantic features will be added to the corpus to serve as sample corpus, sample sentence structure features, and sample semantic features, respectively.
[0066] Figure 3 This diagram illustrates the offline corpus construction process. First, sample data is acquired and formed into a corpus. Then, slot identification and sentence preprocessing are performed on the sample data to obtain sentence structure features. Semantic representation is then performed on the sample data to obtain semantic features. For details on sentence preprocessing, please refer to the section below on sentence preprocessing of the initial sentence structure features. Semantic representation can be implemented using a semantic representation model (such as the BERT model). Finally, the sample sentence structure features and sample semantic features are written into the aforementioned corpus, thus completing the corpus construction.
[0067] Based on the aforementioned corpus, sample sentence structure features similar to the initial sentence structure features of the sentence to be identified can be retrieved, as well as sample semantic features similar to the semantic features of the sentence to be identified. This yields sample corpus similar to the sentence to be identified, which can then be used as candidate search results. In other words, the candidate search results can include both candidate search results corresponding to the initial sentence structure features and candidate search results corresponding to the semantic features.
[0068] In one implementation, considering the diversity of people's expressions, the initial sentence structure features can be modified during the retrieval of sentence structure features to facilitate the retrieval of similar or substantially similar results. Specifically, refer to... Figure 4 As shown, the above-mentioned retrieval of candidate search results in the corpus based on initial sentence structure features and semantic features may include the following steps S410 and S420:
[0069] Step S410: Perform sentence preprocessing on the initial sentence features to obtain the sentence features to be retrieved;
[0070] Step S420: Search the corpus based on the sentence structure features and semantic features to be searched to obtain candidate search results.
[0071] Sentence preprocessing can be used to structurally or materialize initial sentence features to obtain sentence features that can achieve equivalent or similar expressions, i.e., the sentence features to be retrieved. Then, sample sentence features similar to the sentence features to be retrieved can be searched in the corpus. Compared to directly retrieving initial sentence features, this expands the hit and recall range of the retrieval and reduces missed detections.
[0072] The present disclosure does not limit the specific manner of sentence preprocessing, and exemplary illustrations are given below:
[0073] ① Slot replacement
[0074] In one implementation manner, the sentence features to be retrieved include the first sentence features to be retrieved. The above-mentioned sentence preprocessing of the initial sentence features to obtain the sentence features to be retrieved may include the following steps:
[0075] Replace the slots in the initial sentence features with preset characters to obtain the first sentence features to be retrieved.
[0076] Among them, the preset characters can be general identifiers or placeholders, etc., or can be identifiers representing a certain type of slot. In the initial sentence features, the slots contain specific entity information. For example, in the initial sentence feature "Xiaobu, I want to listen to <singer: jay>'s <song: Qilixiang>", the slot <singer: jay> contains the entity information of the singer, and <song: Qilixiang> contains the entity information of the song. Replacing the slots with preset characters can obscure the entity information, so that the first sentence features to be retrieved retain more features of the main sentence pattern and introduce entity features (such as introducing the entity features of a certain type of slot). Thus, when performing retrieval, results with the same or similar main sentence patterns but possibly different entity information can be recalled.
[0077] In one implementation manner, the prefixes and suffixes in the initial sentence features can be removed, and the slots in the initial sentence features can be replaced with preset characters to obtain the first sentence features to be retrieved. Among them, the prefixes and suffixes usually have no actual meaning or contribute nothing to the semantic expression of the sentence. For example, in the scenario of the Xiaobu intelligent voice assistant, when the user issues a voice command, it usually starts with "Xiaobu", which is irrelevant to the semantic meaning of the sentence itself and can be removed as a prefix. Some users are accustomed to ending their speech with modal particles such as "ba" and "ne", which have no actual meaning and can be removed as suffixes. By removing the prefixes and suffixes, the redundant information in the initial sentence features can be simplified, and through the processing of slot replacement, the first sentence features to be retrieved are obtained, making the first sentence features to be retrieved more accurately represent the main sentence pattern of the sentence to be recognized and improving the retrieval effect and efficiency.
[0078] For example, removing the prefixes and suffixes and performing slot replacement on the initial sentence feature "Xiaobu, I want to listen to <singer: jay>'s <song: Qilixiang>" obtains the first sentence feature to be retrieved "I want to listen to <#1>'s <#2>", where #1 can be a general preset character representing the singer, and #2 can be a general preset character representing the song.
[0079] ② Stop word removal
[0080] In one implementation, the sentence pattern features to be retrieved include the second sentence pattern features to be retrieved; the above-mentioned preprocessing of the initial sentence pattern features to obtain the sentence pattern features to be retrieved may include the following steps:
[0081] Remove the stop words in the initial sentence pattern features to obtain the second sentence pattern features to be retrieved.
[0082] Stop words usually do not have entity information but contribute to the sentence structure. For example, in the initial sentence pattern feature "Xiaobu, I want to listen to <singer: jay>'s <song: Qilixiang>", "of" is a stop word. In this exemplary implementation, the stop words in the initial sentence pattern features can be detected and removed based on a general stop word list, or a stop word list can be set for a specific field for the removal of stop words. Removing stop words from the initial sentence pattern features can enable the second sentence pattern features to retain more entity information of the sentence to be recognized, so as to retain as many original features of the sentence to be recognized as possible. Thus, when performing retrieval, results with the same or similar entity information but possibly different sentence structures can be recalled.
[0083] In one implementation, the prefixes and suffixes and stop words in the initial sentence pattern features can be removed to obtain the second sentence pattern features to be retrieved. As mentioned above, the prefixes and suffixes also do not have entity information. Removing the prefixes, suffixes and stop words can fully simplify the information irrelevant to the entity information in the second sentence pattern features and improve the retrieval effect and efficiency.
[0084] For example, by removing the prefixes, suffixes and stop words from the initial sentence pattern feature "Xiaobu, I want to listen to <singer: jay>'s <song: Qilixiang>", the second sentence pattern feature "I want to listen to <singer: jay><song: Qilixiang>" is obtained.
[0085] ③ Slot replacement + stop word removal
[0086] In one implementation, the sentence pattern features to be retrieved include the third sentence pattern features to be retrieved. The above-mentioned preprocessing of the initial sentence pattern features to obtain the sentence pattern features to be retrieved may include the following steps:
[0087] Replace the slots in the initial sentence pattern features with preset characters and remove the stop words to obtain the third sentence pattern features to be retrieved.
[0088] By superimposing slot replacement and stop word removal, the entity information and the main sentence pattern in the initial sentence pattern features can be blurred, introducing entity features while partially retaining the original features of the sentence to be recognized, so as to further expand the recall range and recall more textually similar results.
[0089] In one embodiment, the slot in the initial sentence pattern feature can be replaced with a preset character, and the prefixes, suffixes, and stop words can be removed to obtain the third sentence pattern feature to be retrieved. This can fully simplify the information unrelated to entity information in the third sentence pattern feature to be retrieved and improve the retrieval effect and efficiency.
[0090] For example, for the initial sentence pattern feature "Xiaobu, I want to listen to <singer: jay>'s <song: Qilixiang>", after slot replacement, prefix and suffix removal, and stop word removal, the third sentence pattern feature to be retrieved "I want to listen to <#1><#2>" is obtained.
[0091] It should be noted that this exemplary embodiment can adopt any of the above sentence pattern preprocessing methods to obtain any sentence pattern feature to be retrieved, or can also adopt multiple of the above sentence pattern preprocessing methods to obtain multiple sentence pattern features to be retrieved. In one embodiment, the sentence pattern feature to be retrieved can also include the initial sentence pattern feature. In the case of obtaining multiple sentence pattern features to be retrieved, each sentence pattern feature to be retrieved can be retrieved separately to obtain the corresponding candidate retrieval results.
[0092] Next, an explanation will be given on how to retrieve in the corpus according to the sentence pattern feature to be retrieved (or the initial sentence pattern feature).
[0093] In one embodiment, the retrieval of the sentence pattern feature to be retrieved (or the initial sentence pattern feature) can be implemented based on ES (Elasticsearch, a distributed search engine). ES can implement multi-node distributed retrieval. For example, the first sentence pattern feature to be retrieved, the second sentence pattern feature to be retrieved, and the third sentence pattern feature to be retrieved can be retrieved in parallel and distributedly through different nodes to improve the retrieval efficiency. Among them, the relevant processing and retrieval of the first sentence pattern feature to be retrieved can be implemented based on the keyword + term query in ES; the relevant processing and retrieval of the second sentence pattern feature to be retrieved can be implemented based on the text + match query in ES; the relevant processing and retrieval of the third sentence pattern feature to be retrieved can be implemented based on the keyword + text + match query in ES
[0094] In one embodiment, the sentence pattern feature to be retrieved (or the initial sentence pattern feature) can be converted into a string. For example, Unicode, ASCII code, or a custom code table can be used for conversion, and it is matched with the string of the sample sentence pattern feature in the corpus. The similarity is calculated according to the character matching situation. For example, the similarity can be the ratio of the number of matched characters to the total number of characters, etc.
[0095] In one embodiment, in the case of obtaining the first sentence pattern feature to be retrieved, retrieving in the corpus according to the first sentence pattern feature to be retrieved and the semantic feature to obtain the candidate retrieval results may include the following steps:
[0096] Calculate the similarity between the sample sentence structure features in the corpus and the first sentence structure feature to be retrieved, and take the sample corpus corresponding to the sample sentence structure feature with the highest similarity as the candidate retrieval result corresponding to the first sentence structure feature to be retrieved.
[0097] Because the first retrieval sentence structure feature blurs entity information while retaining the main sentence structure of the sentence to be identified, by retrieving the sample sentence structure feature with the highest similarity, it can be ensured that the main sentence structure of the sample sentence structure feature is the same as or very similar to the main sentence structure of the sentence to be identified. For example, if the first retrieval sentence structure feature is "I want to listen to <#1>'s <#2>", the sample sentence structure feature with the highest similarity in the corpus could be in the form of "I want to listen to <singer>'s <song>", where <singer> can be any singer's name and <song> can be any song's name. Furthermore, the sample corpus corresponding to the retrieved sample sentence structure feature can be used as the candidate retrieval result corresponding to the first retrieval sentence structure feature.
[0098] It can be seen that, although the entity information of the candidate search results recalled based on the first retrieval sentence features may be different from that of the sentence to be identified, for example, in the above example, the singer and song name in the candidate search results may be different from those in the sentence to be identified. However, the candidate search results and the intent of the sentence to be identified have a high probability of being the same, for example, both have the intent of "playing songs", thus breaking through the limitation of entity information and expanding the recall scope.
[0099] In one implementation, after obtaining the second retrieval sentence structure feature (or the third retrieval sentence structure feature; the second retrieval sentence structure feature is used as an example below, but the scheme also applies to the third retrieval sentence structure feature), a retrieval is performed in the corpus based on the second retrieval sentence structure feature and semantic features to obtain candidate retrieval results. This may include the following steps:
[0100] Calculate the similarity between the sample sentence structure features in the corpus and the second sentence structure feature to be retrieved. Select N sample sentence structure features according to the similarity from high to low, and use the sample corpus corresponding to them as the candidate retrieval results corresponding to the second sentence structure feature to be retrieved.
[0101] Where N is a positive integer, representing the number of candidate search results recalled for the second sentence structure feature to be searched. Its value can be set according to experience or actual situation, and is usually greater than 1. Since both the second and third sentence structure features to be searched have removed stop words, which is equivalent to blurring the main sentence structure of the sentence to be identified, when searching for similar sample sentence structure features, the number of candidate search results can be appropriately increased (i.e., it can be more than 1) to achieve a certain degree of fuzzy search, thereby breaking through the limitation of the main sentence structure and expanding the recall range.
[0102] In one implementation, after obtaining the first, second, and third retrieval sentence features, the above-mentioned retrieval in the corpus based on the retrieval sentence features and semantic features to obtain candidate retrieval results may include the following steps:
[0103] Calculate the similarity between the sample sentence structure features in the corpus and the first, second, and third sentence structure features to be retrieved;
[0104] Sample corpora corresponding to sample sentence features whose similarity to the first sentence feature to be retrieved is higher than the first similarity threshold are used as candidate retrieval results corresponding to the first sentence feature to be retrieved.
[0105] Sample corpora corresponding to sample sentence features whose similarity to the second retrieval sentence feature is higher than the second similarity threshold are used as candidate retrieval results corresponding to the second retrieval sentence feature.
[0106] Sample corpora corresponding to sample sentence features whose similarity to the third retrieval sentence feature is higher than the third similarity threshold are used as candidate retrieval results corresponding to the third retrieval sentence feature.
[0107] The first similarity threshold is a preset threshold used to measure whether the similarity between the sample sentence structure features in the corpus and the first sentence structure feature to be retrieved is high enough. The second similarity threshold is a preset threshold used to measure whether the similarity between the sample sentence structure features and the second sentence structure feature to be retrieved is high enough. The third similarity threshold is a preset threshold used to measure whether the similarity between the sample sentence structure features and the third sentence structure feature to be retrieved is high enough. The first, second, and third similarity thresholds can all be set based on experience or actual conditions, and they can satisfy the following relationship: the first similarity threshold is greater than or equal to the third similarity threshold, and the third similarity threshold is greater than or equal to the second similarity threshold. That is to say, according to the first sentence structure feature to be retrieved, the third sentence structure feature to be retrieved, and the second sentence structure feature to be retrieved, the accuracy of the retrieval can gradually decrease, while the ambiguity can gradually increase. Specifically, for the first retrieval sentence structure feature, a more precise retrieval is used to obtain candidate search results that are the same as or very similar to the main sentence structure of the sentence to be identified. For the second retrieval sentence structure feature, the precision of the retrieval can be appropriately reduced to obtain candidate search results that are similar to the entity information of the sentence to be identified. For the third retrieval sentence structure feature, a retrieval with a precision between the first and second retrieval sentence structure features can be used to obtain candidate search results that are similar to both the main sentence structure and entity information of the sentence to be identified. In other words, different recall ranges are set for the first, third, and second retrieval sentence structure features, which helps to achieve a more comprehensive and sufficient retrieval recall.
[0108] The following explains how to retrieve data from a corpus based on semantic features.
[0109] Generally, the semantic features of the sentence to be identified and the semantic features of the samples in the corpus can both be in the form of tensors (such as vectors, matrices, etc.). By calculating the similarity between tensors, the similarity between the semantic features of the sentence to be identified and the semantic features of the samples can be obtained. Then, the sample semantic features with high similarity are selected, and the corresponding sample corpus is used as the candidate retrieval result corresponding to the semantic features of the sentence to be identified.
[0110] This disclosure does not limit the method for calculating similarity; for example, Euclidean distance, cosine similarity, or other methods can be used to calculate similarity.
[0111] In one implementation, the HNSW (Hierarchical Navigable Small Worldgraphs) algorithm can be used to retrieve sample semantic features from the corpus that are similar to the semantic features of the sentence to be identified. In the HNSW algorithm, assuming that both the semantic features of the sentence to be identified and the sample semantic features are D-dimensional vectors, the sample semantic features can be constructed as a connected graph in a D-dimensional vector space. The semantic features of the sentence to be identified are mapped to vertices in this D-dimensional vector space. Based on this graph, one or more nearest neighbors to each vertex are searched, thereby determining the similar sample semantic features.
[0112] In one implementation, the above-mentioned retrieval of candidate search results in the corpus based on initial sentence structure features and semantic features may include the following steps:
[0113] The similarity between the semantic features of samples in the corpus and the semantic features of the sentence to be identified is calculated. Samples with similarity higher than the fourth similarity threshold are used as candidate retrieval results corresponding to the semantic features of the sentence to be identified.
[0114] The fourth similarity threshold is a preset threshold used to measure whether the similarity between the semantic features of samples in the corpus and the semantic features of the sentence to be identified is high enough. It is unrelated to the first, second, and third similarity thresholds mentioned above and can be set based on experience or actual conditions. By using the fourth similarity threshold, sample semantic features with high similarity to the semantic features of the sentence to be identified can be filtered out, ensuring the accuracy of recall.
[0115] In one implementation, the above-mentioned retrieval of candidate search results in the corpus based on initial sentence structure features and semantic features may include the following steps:
[0116] Calculate the similarity between the semantic features of the samples in the corpus and the semantic features of the sentence to be identified. Select M sample semantic features according to the similarity from high to low, and use the corresponding sample corpus as the candidate retrieval results corresponding to the semantic features of the sentence to be identified.
[0117] Where M is a positive integer, representing the number of candidate retrieval results retrieved from the semantic features of the sentence to be identified. Its value can be set according to experience or actual situation, and is usually greater than 1. By retrieving the semantic features of M samples with high similarity and recalling their corresponding sample corpora as candidate retrieval results, a balance between semantic fuzzy retrieval and precise retrieval can be achieved, thus expanding the recall range to a certain extent.
[0118] After recalling candidate search results from both sentence structure and semantic features, we continue to refer to... Figure 2 In step S240, the intent of the statement to be identified is determined based on the candidate search results.
[0119] Candidate search results can include sample corpora similar to the statement to be identified, and these sample corpora have corresponding intents. For example, the intents corresponding to the sample corpora can be stored in a corpus. Therefore, the intent of the statement to be identified can be determined based on the intents corresponding to these sample corpora.
[0120] In one implementation, if the candidate search results include multiple sample corpora, the candidate search results can be filtered to determine the target search result, and the intent of the statement to be identified can be determined based on the target search result. Alternatively, the candidate intents corresponding to the candidate search results can be filtered to determine the intent of the statement to be identified from the candidate intents.
[0121] This disclosure does not limit the specific methods for filtering target search results or intentions.
[0122] In one implementation, a voting method can be used to count the candidate intents corresponding to each candidate search result, and the candidate intent with the most corresponding candidate search results can be taken as the intent of the statement to be identified.
[0123] In one implementation, the above-mentioned determination of the intent of the statement to be identified based on candidate retrieval results may include the following steps:
[0124] The target search result is selected from the candidate search results based on the intent recognition configuration information, and the intent corresponding to the target search result is taken as the intent of the statement to be recognized; or the intent of the statement to be recognized is selected from the candidate intents corresponding to the candidate search results based on the intent recognition configuration information.
[0125] Among them, the candidate intent corresponding to the candidate search result can be the intent corresponding to the sample corpus in the candidate search result.
[0126] Intent recognition configuration information can be information configured by the developer or (end-user) for intent determination, such as including but not limited to: confidence threshold, number of target search results, number of intents, preference information, etc. These types of information are explained below.
[0127] A confidence threshold is used to measure whether the confidence level of a statement to be identified as belonging to a certain intent is high enough, thereby filtering candidate intents. In this exemplary embodiment, a general confidence threshold can be set for all intents, or different confidence thresholds can be set for different intents. This disclosure does not limit the calculation method of the confidence level. In one embodiment, the confidence level of a statement to be identified as belonging to a certain intent can be calculated as follows: the similarity between the retrieval sentence structure features (or initial sentence structure features) of the statement to be identified and the sample sentence structure features corresponding to the intent, and the similarity between the semantic features of the statement to be identified and the sample semantic features corresponding to the intent. The above similarities can be obtained in step S230, and the average or weighted average of the above similarities is calculated as the confidence level. Alternatively, the proportion of candidate search results corresponding to the intent in all candidate search results can be counted as the confidence level.
[0128] The number of target search results is used to determine the number of candidate search results after filtering. For example, if the number of target search results is 8, then the 9 candidate search results with the highest similarity to the statement to be identified can be retained from all candidate search results as target search results.
[0129] The intent count is used to determine the number of candidate intents after filtering. For example, after obtaining the candidate intents corresponding to each candidate search result, the candidate intents can be sorted according to the number (or confidence) of the candidate search results corresponding to each candidate intent. Based on the intent count (e.g., 5), the corresponding number of candidate intents (e.g., the top 5 candidate intents) can be displayed as the intents of the statement to be identified.
[0130] Preference information can include a user's preferences for a certain field or certain intentions, so that when filtering candidate search results or candidate intentions, results that match the user's preferences can be prioritized.
[0131] Furthermore, the intent recognition configuration information may also include other information, which this disclosure does not limit. Using the intent recognition configuration information to help determine the intent of the statement to be recognized is beneficial for obtaining intent recognition results that meet user needs or preferences.
[0132] Figures 5 to 7 A schematic diagram of the configuration interface intended to identify configuration information is shown.
[0133] Figure 5 This is a schematic diagram of the domain details interface. Assuming the user (or developer) has configured the relevant information for the "Music" domain, this interface displays the domain ID (identifier) and intent information within that domain, including intent ID, intent name, and intent's English name. Users can enter the intent ID to search for a specific intent, delete and edit intents, and perform operations such as adding, batch adding, and batch overwriting intents. This interface also provides data-related functions, including data updates, downloading model training reports, downloading test reports, downloading logs, generating training data, exporting training data, generating configuration data, and batch testing. Furthermore, users can save domain information in different versions; for example, after each update, the user can save a new version using the version saving function, and can also restore to a previous version using the version restoration function.
[0134] Figure 6 This is a schematic diagram of the basic information interface under intent details. For example, users can... Figure 5 Click "Edit" on the "Play Song" option and select the "Basic Information" section to proceed. Figure 6 The interface allows users to modify the intent name, English name, and confidence threshold. To prevent accidental user actions, a review mechanism can be added to the confidence threshold modification. For example, after a user modifies the confidence threshold, a user with higher privileges must review the modification before it takes effect. With a set confidence threshold, when the confidence of the statement to be identified as belonging to that intent is greater than or equal to the confidence threshold, the intent can be recalled as either the intent or one of the intents to be identified.
[0135] Figure 7 This is a schematic diagram of the intent recall interface under intent details. In this interface, users can edit the intent recall logic (i.e., the matching method). For example, users can choose one or more of the following: full match (corresponding to the first retrieval sentence feature), term match (corresponding to the second retrieval sentence feature), and term match (corresponding to the third retrieval sentence feature) to recall candidate search results corresponding to one or more of the first, second, and third retrieval sentence features. Users can view and edit rules and sample corpora, and can also perform operations such as batch adding, batch overwriting, batch exporting, and template downloading for matching methods.
[0136] Through the above configuration interface, intent recognition can be realized based on platformization, enabling users (or developers) to conveniently configure or edit intent recognition-related information that meets their own needs through simple platform operations, thereby achieving accurate and targeted intent recognition.
[0137] Figure 8 The following shows a schematic flowchart of intent recognition for the statement to be recognized, including:
[0138] Step S801: After the user inputs the statement to be recognized, "Xiaobu, I want to listen to Jay's 'Qi Li Xiang'", text preprocessing (such as case conversion) is performed to obtain the statement to be recognized after text preprocessing, "Xiaobu, I want to listen to jay's 'Qi Li Xiang'".
[0139] Step S802: Slot recognition is performed on the statement to be recognized after text preprocessing to obtain the initial sentence pattern feature, "Xiaobu, I want to listen to <singer: jay>'s <song: Qi Li Xiang>".
[0140] Step S803: The initial sentence pattern feature is processed by removing prefixes and suffixes and slot replacement to obtain the first retrieval sentence pattern feature, "I want to listen to <#1>'s <#2>".
[0141] Step S804: The initial sentence pattern feature is processed by removing prefixes and suffixes and removing stop words to obtain the second retrieval sentence pattern feature, "I want to listen to Jay Qi Li Xiang".
[0142] Step S805: The initial sentence pattern feature is processed by removing prefixes and suffixes, removing stop words, and slot replacement to obtain the third retrieval sentence pattern feature, "I want to listen to <#1><#2>".
[0143] Step S806: Semantic representation is performed on the statement to be recognized after text preprocessing. For example, semantic features can be obtained through a BERT model, such as a 200-dimensional semantic feature vector [x1, x2, x3,..., x200].
[0144] Step S807: Retrieve in the corpus according to the above first, second, and third retrieval sentence pattern features and semantic features respectively to recall candidate retrieval results in multiple ways, which can be sample corpora matching the statement to be recognized.
[0145] Step S808: According to the pre-configured intent recognition configuration information, screen the candidate retrieval results or the candidate intents corresponding to the candidate retrieval results to finally determine the intent of the statement to be recognized, which can be multiple intents, and ranking and display can be performed.
[0146] Thus, the intent recognition of the statement to be recognized is completed.
[0147] In one implementation, if there is an intent recognition error, such as determining that the intent of the statement to be recognized is intent A, but finding, based on user feedback or other rules, that the statement to be recognized does not belong to intent A but to intent B, the statement to be recognized can be added to the sample corpus corresponding to intent B, so as to correct the error and update and improve the corpus.
[0148] Exemplary embodiments of this disclosure also provide an intent recognition device. (See reference...) Figure 9 As shown, the intent recognition device 900 may include:
[0149] The sentence structure feature extraction module 910 is configured to perform slot recognition on the sentence to be identified in order to obtain the initial sentence structure features of the sentence to be identified.
[0150] The semantic feature extraction module 920 is configured to extract the semantic features of the statement to be recognized;
[0151] The feature retrieval module 930 is configured to perform retrieval in the corpus based on initial sentence structure features and semantic features to obtain candidate retrieval results;
[0152] The intent determination module 940 is configured to determine the intent of the statement to be identified based on the candidate search results.
[0153] In one implementation, the above-mentioned retrieval of candidate search results in the corpus based on initial sentence structure features and semantic features includes:
[0154] The initial sentence structure features are preprocessed to obtain the sentence structure features to be retrieved.
[0155] Based on the sentence structure and semantic features of the target sentence, a search is performed in the corpus to obtain candidate search results.
[0156] In one implementation, the sentence structure features to be retrieved include a first sentence structure feature; the above-mentioned preprocessing of the initial sentence structure features to obtain the sentence structure features to be retrieved includes:
[0157] Replace the slots in the initial sentence structure features with preset characters to obtain the first sentence structure features to be retrieved.
[0158] In one implementation, a search is performed in a corpus based on the first retrieval sentence structure features and semantic features to obtain candidate retrieval results, including:
[0159] Calculate the similarity between the sample sentence structure features in the corpus and the first sentence structure feature to be retrieved, and take the sample corpus corresponding to the sample sentence structure feature with the highest similarity as the candidate retrieval result corresponding to the first sentence structure feature to be retrieved.
[0160] In one implementation, the sentence structure features to be retrieved include a second sentence structure feature to be retrieved; the above-mentioned preprocessing of the initial sentence structure features to obtain the sentence structure features to be retrieved includes:
[0161] Stop words are removed from the initial sentence features to obtain the second sentence features to be retrieved.
[0162] In one implementation, the sentence structure features to be retrieved include a third sentence structure feature; the above-mentioned preprocessing of the initial sentence structure features to obtain the sentence structure features to be retrieved includes:
[0163] The slots in the initial sentence structure features are replaced with preset characters and stop words are removed to obtain the third sentence structure features to be retrieved.
[0164] In one embodiment, the sentence structure features to be retrieved include a first sentence structure feature, a second sentence structure feature, and a third sentence structure feature; the above-mentioned preprocessing of the initial sentence structure features to obtain the sentence structure features to be retrieved includes:
[0165] Replace the slots in the initial sentence structure features with preset characters to obtain the first sentence structure features to be retrieved.
[0166] Stop words are removed from the initial sentence structure features to obtain the second sentence structure features to be retrieved;
[0167] Replace the slots in the initial sentence structure features with preset characters and remove the stop words in the initial sentence structure features to obtain the third sentence structure features to be retrieved;
[0168] Based on the sentence structure and semantic features of the target sentence, a search is performed in the corpus to obtain candidate search results, including:
[0169] Calculate the similarity between the sample sentence structure features in the corpus and the first, second, and third sentence structure features to be retrieved;
[0170] Sample corpora corresponding to sample sentence features whose similarity to the first sentence feature to be retrieved is higher than the first similarity threshold are used as candidate retrieval results corresponding to the first sentence feature to be retrieved.
[0171] Sample corpora corresponding to sample sentence features whose similarity to the second retrieval sentence feature is higher than the second similarity threshold are used as candidate retrieval results corresponding to the second retrieval sentence feature.
[0172] Sample corpora corresponding to sample sentence features whose similarity to the third retrieval sentence feature is higher than the third similarity threshold are used as candidate retrieval results corresponding to the third retrieval sentence feature.
[0173] Among them, the first similarity threshold is greater than or equal to the third similarity threshold, and the third similarity threshold is greater than or equal to the second similarity threshold.
[0174] In one implementation, the extraction of semantic features of the statement to be identified includes:
[0175] The semantic representation model to be identified is used to process the sentence to be identified in order to obtain the semantic features of the sentence to be identified.
[0176] In one implementation, the intent to determine the statement to be identified based on candidate retrieval results includes:
[0177] Based on the intent recognition configuration information, the target search result is filtered from the candidate search results, and the intent corresponding to the target search result is taken as the intent of the statement to be recognized; or
[0178] Based on the intent recognition configuration information, the intent of the statement to be recognized is filtered out from the candidate intents corresponding to the candidate search results.
[0179] The specific details of each part of the above-mentioned device have been described in detail in the method section of the implementation plan. For any undisclosed details, please refer to the implementation plan of the method section, and therefore will not be repeated here.
[0180] Exemplary embodiments of this disclosure also provide a computer-readable storage medium that can be implemented as a program product including program code, which, when run on an electronic device, causes the electronic device to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure. In an alternative embodiment, the program product can be implemented as a portable compact disc read-only memory (CD-ROM) including program code and can run on an electronic device, such as a personal computer. However, the program product of this disclosure is not limited thereto. In this document, the readable storage medium can be any tangible medium that contains or stores a program that can be used or combined with an instruction execution system, apparatus, or device.
[0181] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0182] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.
[0183] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0184] Program code for performing the operations of this disclosure can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing devices can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0185] Exemplary embodiments of this disclosure also provide an electronic device, which may be, for example, the terminal 110 and server 120 described above. The electronic device may include a processor and a memory. The memory stores executable instructions of the processor, such as program code. The processor executes the executable instructions to perform the intent recognition method in this exemplary embodiment, such as... Figure 2 The method and steps.
[0186] The following is for reference. Figure 10 The electronic device is illustrated by way of a general-purpose computing device. It should be understood that... Figure 10 The electronic device 1000 shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments disclosed herein.
[0187] like Figure 10 As shown, the electronic device 1000 may include: a processor 1010, a memory 1020, a bus 1030, an I / O (input / output) interface 1040, and a network adapter 1050.
[0188] The memory 1020 may include volatile memory, such as RAM 1021 and cache unit 1022, and may also include non-volatile memory, such as ROM 1023. The memory 1020 may also include one or more program modules 1024, such program modules 1024 including, but not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. For example, program module 1024 may include the modules in the intent recognition device 900 described above.
[0189] Bus 1030 is used to connect different components of electronic device 1000, and may include data bus, address bus and control bus.
[0190] Electronic device 1000 can communicate with one or more external devices 1100 (such as keyboard, mouse, external controller, etc.) through I / O interface 1040.
[0191] Electronic device 1000 can communicate with one or more networks via network adapter 1050. For example, network adapter 1050 can provide mobile communication solutions such as 3G / 4G / 5G, or wireless communication solutions such as wireless LAN, Bluetooth, and near-field communication. Network adapter 1050 can communicate with other modules of electronic device 1000 via bus 1030.
[0192] although Figure 10 Other hardware and / or software modules, including but not limited to: displays, microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, may also be configured in the electronic device 1000.
[0193] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to exemplary embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0194] Those skilled in the art will understand that various aspects of this disclosure can be implemented as systems, methods, or program products. Therefore, various aspects of this disclosure can be embodied in entirely hardware implementations, entirely software implementations (including firmware, microcode, etc.), or implementations combining hardware and software aspects, collectively referred to herein as "circuit," "module," or "system." Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.
[0195] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is defined only by the appended claims.< / song> < / singer>
Claims
1. An intent recognition method, characterized in that, include: Slot identification is performed on the statement to be identified to obtain the initial sentence structure features of the statement to be identified; Extract the semantic features of the statement to be identified; Based on the initial sentence structure features and the semantic features, a search is performed in the corpus to obtain candidate search results; the candidate search results include the candidate search results corresponding to the initial sentence structure features and the candidate search results corresponding to the semantic features; The intent of the statement to be identified is determined based on the candidate search results; The step of retrieving candidate search results from the corpus based on the initial sentence structure features and the semantic features includes: The initial sentence pattern features are subjected to sentence pattern preprocessing to obtain the sentence pattern features to be retrieved; the sentence pattern preprocessing includes one or more of the following: replacing slots with preset characters to obscure entity information; removing stop words; Based on the sentence structure features and semantic features to be retrieved, a search is performed in the corpus to obtain candidate search results.
2. The method according to claim 1, characterized in that, The preset characters include at least one of the following: a general identifier, a placeholder, or an identifier representing a certain type of slot.
3. The method according to claim 1, characterized in that, The sentence structure features to be retrieved include a first sentence structure feature; the step of performing sentence structure preprocessing on the initial sentence structure features to obtain the sentence structure features to be retrieved includes: The slots in the initial sentence pattern feature are replaced with preset characters to obtain the first sentence pattern feature to be retrieved.
4. The method according to claim 3, characterized in that, Based on the first retrieval sentence structure feature and the semantic feature, a retrieval is performed in the corpus to obtain candidate retrieval results, including: Calculate the similarity between the sample sentence features in the corpus and the first sentence feature to be retrieved, and take the sample corpus corresponding to the sample sentence feature with the highest similarity as the candidate retrieval result corresponding to the first sentence feature to be retrieved.
5. The method according to claim 1, characterized in that, The sentence structure features to be retrieved include a second sentence structure feature to be retrieved; the process of preprocessing the initial sentence structure features to obtain the sentence structure features to be retrieved includes: Stop words are removed from the initial sentence pattern features to obtain the second sentence pattern features to be retrieved.
6. The method according to claim 1, characterized in that, The sentence structure features to be retrieved include a third sentence structure feature; the process of preprocessing the initial sentence structure features to obtain the sentence structure features to be retrieved includes: The slots in the initial sentence pattern features are replaced with preset characters and stop words are removed to obtain the third sentence pattern features to be retrieved.
7. The method according to claim 1, characterized in that, The sentence structure features to be retrieved include a first sentence structure feature, a second sentence structure feature, and a third sentence structure feature; the process of preprocessing the initial sentence structure features to obtain the sentence structure features to be retrieved includes: The slots in the initial sentence pattern feature are replaced with preset characters to obtain the first sentence pattern feature to be retrieved. Remove stop words from the initial sentence structure features to obtain the second sentence structure features to be retrieved; The slots in the initial sentence pattern features are replaced with preset characters, and the stop words in the initial sentence pattern features are removed to obtain the third sentence pattern features to be retrieved; The step of searching the corpus based on the sentence structure features and semantic features to obtain candidate search results includes: Calculate the similarity between the sample sentence structure features in the corpus and the first, second, and third sentence structure features to be retrieved. Sample corpus corresponding to sample sentence features whose similarity to the first sentence feature to be retrieved is higher than the first similarity threshold is used as candidate retrieval results corresponding to the first sentence feature to be retrieved. Sample corpus corresponding to sample sentence features whose similarity to the second retrieval sentence feature is higher than the second similarity threshold is used as candidate retrieval results corresponding to the second retrieval sentence feature; Sample corpora corresponding to sample sentence features whose similarity to the third retrieval sentence feature is higher than the third similarity threshold are used as candidate retrieval results corresponding to the third retrieval sentence feature; Wherein, the first similarity threshold is greater than or equal to the third similarity threshold, and the third similarity threshold is greater than or equal to the second similarity threshold.
8. The method according to claim 1, characterized in that, The extraction of semantic features of the statement to be identified includes: The sentence to be identified is processed using a pre-trained semantic representation model to obtain the semantic features of the sentence to be identified.
9. The method according to claim 1, characterized in that, Determining the intent of the statement to be identified based on the candidate search results includes: Based on the intent recognition configuration information, the target search result is selected from the candidate search results, and the intent corresponding to the target search result is taken as the intent of the statement to be recognized; or The intent of the statement to be identified is filtered from the candidate intents corresponding to the candidate search results based on the intent recognition configuration information.
10. An intent recognition device, characterized in that, include: The sentence structure feature extraction module is configured to perform slot identification on the sentence to be identified in order to obtain the initial sentence structure features of the sentence to be identified. The semantic feature extraction module is configured to extract the semantic features of the statement to be identified; The feature retrieval module is configured to perform a retrieval in the corpus based on the initial sentence structure features and the semantic features to obtain candidate retrieval results; An intent determination module is configured to determine the intent of the statement to be identified based on the candidate search results; The step of retrieving candidate search results from the corpus based on the initial sentence structure features and the semantic features includes: The initial sentence pattern features are subjected to sentence pattern preprocessing to obtain the sentence pattern features to be retrieved; the sentence pattern preprocessing includes one or more of the following: replacing slots with preset characters to obscure entity information; removing stop words; Based on the sentence structure features and semantic features to be retrieved, a search is performed in the corpus to obtain candidate search results.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method according to any one of claims 1 to 9.
12. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the method of any one of claims 1 to 9 by executing the executable instructions.
Citation Information
Patent Citations
Semantic matching method and system for knowledge retrieval and question answering of power transformer
CN113962219A