Intention recognition method, device, apparatus and storage medium
The model trained by the intent knowledge graph converts statements into feature vectors and matches them with intent vectors, solving the problem of low efficiency in multi-intent recognition and achieving efficient and accurate intent recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- MASHANG CONSUMER FINANCE CO LTD
- Filing Date
- 2022-07-25
- Publication Date
- 2026-04-28
AI Technical Summary
Existing technologies are inefficient in multi-intent recognition, require significant manual annotation costs, and have poor inference performance.
The training sample pairs are trained using an intent knowledge graph. The intent recognition model converts the sentences to be recognized into sentence feature vectors and performs similarity matching with the intent vector space set to determine the target intent vector, thereby reducing manual annotation and improving training efficiency.
It reduces the cost of multi-intent recognition, improves recognition efficiency and accuracy, and simplifies the calculation process.
Smart Images

Figure CN116150309B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to an intent recognition method, apparatus, device, and storage medium. Background Technology
[0002] With the rapid development of computer and internet technologies, increasingly intelligent interaction methods have gradually penetrated into daily life. For example, in intelligent customer service scenarios, the system can identify the user's intent based on the input and provide appropriate responses. Especially when the user's input contains multiple intents, it is necessary to accurately identify these multiple intents and then provide appropriate responses for each intent.
[0003] Currently, for multi-intent recognition, training an intent recognition model requires manually labeling sample sentences to convert the multiple intents contained within them into multi-label classifications to obtain a training set. Based on this training set, the intent recognition model is trained to obtain a trained model, which is then used for multi-intent recognition. This method of multi-intent recognition is inefficient. Summary of the Invention
[0004] This application provides an intent recognition method, apparatus, device, and storage medium to solve the problem of low efficiency in performing multi-intent recognition using current methods.
[0005] In a first aspect, this application provides an intent recognition method, comprising:
[0006] Obtain the statement to be recognized;
[0007] The sentence to be identified is input into the intent recognition model to obtain the sentence feature vector corresponding to the sentence to be identified. The intent recognition model is obtained by training the training sample pairs based on the intent knowledge graph.
[0008] The target intent vector in the intent vector space set is determined based on the similarity threshold between the intent vector set and the statement feature vector. The intent vector space set is obtained based on the output of the intent recognition model.
[0009] Based on the target intent vector, the target intent corresponding to the statement to be identified is obtained.
[0010] Optionally, training sample pairs are obtained by: combining intent paths corresponding to the same intent category in the intent knowledge graph in pairs to obtain positive sample pairs, and combining intent paths corresponding to different intent categories in the intent knowledge graph in pairs to obtain negative sample pairs; the positive sample pairs and negative sample pairs are determined as training sample pairs.
[0011] Optionally, the intent vector space set is obtained based on the output of the intent recognition model, including: averaging the feature vectors corresponding to intent paths under the same intent category based on the feature vectors output by the intent recognition model to obtain an average feature vector; and obtaining the intent vector space set based on the average feature vector, which is used to represent the set of vectors obtained by mapping the vector representation of intent categories to the vector space.
[0012] Optionally, determining the target intent vectors in the intent vector space set whose similarity to the statement feature vectors is less than a similarity threshold includes: obtaining the similarity between the statement feature vectors and each intent vector in the intent vector space set; and determining a preset number of intent vectors in the intent vector space set whose similarity to the statement feature vectors is less than a similarity threshold as target intent vectors.
[0013] Optionally, the sentence to be recognized is input into the intent recognition model, including: performing word segmentation on the sentence to be recognized to obtain the segmented sentence; performing encoding on the segmented sentence to obtain the encoded sentence; and inputting the encoded sentence into the intent recognition model.
[0014] Secondly, this application provides a method for training an intent recognition model, comprising:
[0015] Multiple training sample pairs are obtained. The training sample pairs include positive sample pairs and negative sample pairs. Positive sample pairs are obtained by combining the intent paths corresponding to the same intent category in the intent knowledge graph. Negative sample pairs are obtained by combining the intent paths corresponding to different intent categories in the intent knowledge graph. The intent knowledge graph contains multiple intent categories and the intent paths corresponding to each intent category.
[0016] Multiple training samples are input into the initial intent recognition model to obtain a feature vector set, which includes the feature vector corresponding to each intent path.
[0017] Obtain the first similarity of the feature vectors corresponding to the two intent paths of the positive sample pairs in the feature vector set, and the second similarity of the feature vectors corresponding to the two intent paths of the negative sample pairs.
[0018] Based on the first and second similarities, the initial intent recognition model is trained iteratively to obtain the intent recognition model.
[0019] Optionally, the intent knowledge graph is obtained by: acquiring a corpus; extracting the intent category and node information corresponding to each corpus in the corpus using a preset intent extraction method based on the corpus; obtaining the intent path corresponding to each corpus based on the intent category and node information; and constructing an intent knowledge graph based on the intent path. The intent knowledge graph includes nodes and edges, where nodes include intent categories and edges are the intent paths corresponding to the intent categories.
[0020] Optionally, after obtaining the intent recognition model, the training method of the intent recognition model further includes: averaging the feature vectors corresponding to the intent paths under the same intent category based on the feature vectors output by the intent recognition model to obtain an average feature vector; and obtaining an intent vector space set based on the average feature vector.
[0021] Thirdly, this application provides an intent recognition device, comprising:
[0022] The first acquisition module is used to acquire the statement to be recognized;
[0023] The processing module is used to input the statement to be recognized into the intent recognition model to obtain the statement feature vector corresponding to the statement to be recognized. The intent recognition model is obtained by training on training sample pairs based on the intent knowledge graph.
[0024] The determination module is used to determine target intent vectors in the intent vector space set whose similarity to the statement feature vectors is less than a similarity threshold. The intent vector space set is obtained based on the output of the intent recognition model.
[0025] The module is used to obtain the target intent corresponding to the statement to be recognized based on the target intent vector.
[0026] Optionally, the intent recognition device further includes a second acquisition module, used to obtain training sample pairs by: combining intent paths corresponding to the same intent category in the intent knowledge graph in pairs to obtain positive sample pairs, and combining intent paths corresponding to different intent categories in the intent knowledge graph in pairs to obtain negative sample pairs; and determining the positive sample pairs and negative sample pairs as training sample pairs.
[0027] Optionally, the intent recognition device further includes a third acquisition module, used to: average the feature vectors corresponding to intent paths under the same intent category based on the feature vectors output by the intent recognition model, to obtain an average feature vector; and obtain an intent vector space set based on the average feature vector, the intent vector space set being used to represent the set of vectors obtained by mapping the vector representation of intent categories to the vector space.
[0028] Optionally, the determining module is specifically used to: obtain the similarity between the statement feature vector and each intent vector in the intent vector space set; and determine the intent vectors in the intent vector space set whose similarity to the statement feature vector is less than a preset number of similarity thresholds as target intent vectors.
[0029] Optionally, the processing module is specifically used for: performing word segmentation on the statement to be recognized to obtain the segmented statement; performing encoding on the segmented statement to obtain the encoded statement; and inputting the encoded statement into the intent recognition model.
[0030] Fourthly, this application provides a training apparatus for an intent recognition model, comprising:
[0031] The first acquisition module is used to acquire multiple training sample pairs. The training sample pairs include positive sample pairs and negative sample pairs. Positive sample pairs are sample pairs obtained by combining the intent paths corresponding to the same intent category in the intent knowledge graph in pairs. Negative sample pairs are sample pairs obtained by combining the intent paths corresponding to different intent categories in the intent knowledge graph in pairs. The intent knowledge graph contains multiple intent categories and the intent paths corresponding to each intent category.
[0032] The processing module is used to input multiple training samples into the initial intent recognition model to obtain a feature vector set, which includes the feature vector corresponding to each intent path.
[0033] The second acquisition module is used to acquire the first similarity of the feature vectors corresponding to the two intent paths of the positive sample pairs in the feature vector set, and the second similarity of the feature vectors corresponding to the two intent paths of the negative sample pairs.
[0034] The training module is used to iteratively train the initial intent recognition model based on the first similarity and the second similarity to obtain the intent recognition model.
[0035] Optionally, the training device for the intent recognition model further includes a third acquisition module, used to obtain an intent knowledge graph in the following ways: acquiring a corpus set; based on the corpus set, extracting the intent category and node information corresponding to each corpus set using a preset intent extraction method; based on the intent category and node information, obtaining the intent path corresponding to each corpus set; and based on the intent path, constructing an intent knowledge graph, the intent knowledge graph including nodes and edges, the nodes including intent categories, and the edges being the intent paths corresponding to the intent categories.
[0036] Optionally, the processing module is also used to: after obtaining the intent recognition model, based on the feature vectors corresponding to the intent paths output by the intent recognition model, perform average processing on the feature vectors corresponding to the intent paths under the same intent category to obtain an average feature vector; and obtain an intent vector space set based on the average feature vector.
[0037] Fifthly, this application provides an electronic device, including: a processor, and a memory communicatively connected to the processor;
[0038] The memory stores instructions that the computer executes;
[0039] The processor executes computer execution instructions stored in memory to implement the intent recognition method as described in the first aspect of this application.
[0040] Sixthly, this application provides an electronic device, including: a processor, and a memory communicatively connected to the processor;
[0041] The memory stores instructions that the computer executes;
[0042] The processor executes computer execution instructions stored in memory to implement the training method for the intent recognition model as described in the second aspect of this application.
[0043] In a seventh aspect, this application provides a computer-readable storage medium storing computer program instructions, which, when executed by a processor, implement the intent recognition method as described in the first aspect of this application.
[0044] Eighthly, this application provides a computer-readable storage medium storing computer program instructions, which, when executed by a processor, implement the training method for the intent recognition model as described in the second aspect of this application.
[0045] Ninthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the intent recognition method as described in the first aspect of this application.
[0046] In a tenth aspect, this application provides a computer program product, including a computer program that, when executed by a processor, implements a training method for an intent recognition model as described in the second aspect of this application.
[0047] The intent recognition method, apparatus, device, and storage medium provided in this application obtain the statement feature vector corresponding to the statement by inputting the statement to be recognized into an intent recognition model. The intent recognition model is trained on training sample pairs obtained from an intent knowledge graph, eliminating the need for manual annotation of the training set, thus significantly reducing the cost and improving the efficiency of model training. The method identifies target intent vectors in the intent vector space set whose similarity to the statement feature vectors is less than a similarity threshold. The intent vector space set is obtained from the output of the intent recognition model. Since each intent vector in the intent vector space set is matched with the statement feature vector for similarity, rather than matching the statement feature vector with the feature vector of the intent path corresponding to each intent category in the intent knowledge graph, fewer comparisons are performed, resulting in simpler and more efficient computation. Based on the target intent vector, the target intent corresponding to the statement to be recognized is obtained. Therefore, this application significantly reduces the cost and improves the efficiency of multi-intent recognition while ensuring accurate multi-intent recognition. Attached Figure Description
[0048] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0049] Figure 1 This is a schematic diagram illustrating an application scenario provided in one embodiment of this application;
[0050] Figure 2 A flowchart illustrating an intent recognition method provided in an embodiment of this application;
[0051] Figure 3 A flowchart of an intent recognition method provided in another embodiment of this application;
[0052] Figure 4 A flowchart illustrating a training method for an intent recognition model provided in an embodiment of this application;
[0053] Figure 5 A schematic diagram illustrating the construction of an intent knowledge graph based on a corpus set, provided as an embodiment of this application;
[0054] Figure 6 This is a schematic diagram of the structure of an intent recognition device provided in an embodiment of this application;
[0055] Figure 7 A schematic diagram of the structure of a training device for an intent recognition model provided in an embodiment of this application;
[0056] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0057] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, 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 some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0058] The collection, storage, use, processing, transmission, provision, and disclosure of financial data or user data involved in the technical solution of this application all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0059] In intelligent customer service scenarios, the Dialogue Management (DM) module can be used to identify user intent based on their input and provide appropriate responses. Intent recognition refers to analyzing the user's core needs. However, in real-world intelligent customer service scenarios, user questions often contain multiple intents. For example, a user's question, "I want to check today's weather and check my package," contains two intents: checking the weather and checking the package. Therefore, for user input containing multiple intents, it is necessary to accurately identify these intents and provide appropriate responses for each. Currently, a common approach to multi-intent recognition is to convert it into a multi-label problem. However, this method requires a large amount of corpus data, resulting in high costs for manual annotation and training, poor inference performance, and a negative impact on user experience. In one related technology, when performing multi-intent recognition, the target text is acquired, and multi-intent detection is performed on the target text. If at least two intents are detected in the target text, the target text is segmented to obtain at least two sub-texts corresponding to the at least two intents. Intent recognition is then performed on each of the at least two sub-texts to obtain at least two intents, and the type of each intent is determined. Based on the types of each intent included in the at least two intents, a corresponding response message is obtained for each intent. However, when performing intent recognition on each of the at least two sub-texts to obtain at least two intents, the model used is trained on a training set obtained through manual annotation. Obtaining the training set through manual annotation is costly and has insufficient performance, resulting in low efficiency for multi-intent recognition.
[0060] To address the aforementioned issues, this application provides an intent recognition method, apparatus, device, and storage medium. The method involves inputting the statement to be recognized into an intent recognition model, converting it into a statement feature vector, and then matching this statement feature vector with intent vectors in an intent vector space set to obtain a multi-intent output. The intent recognition model is trained using training samples obtained from an intent knowledge graph, eliminating the need for extensive manual annotation and significantly reducing training costs. The intent vector space set is obtained from the output of the intent recognition model. Matching each intent vector in the intent vector space set with a statement feature vector requires fewer comparisons, resulting in simpler and more efficient computation and greatly improving the efficiency and accuracy of multi-intent recognition.
[0061] The following section provides examples illustrating the application scenarios of the solution provided in this application.
[0062] Figure 1 This is a schematic diagram illustrating an application scenario provided by an embodiment of this application. For example... Figure 1 As shown, in this application scenario, the user inputs a statement to be identified via mobile phone 101, which is then sent to server 102. Server 102 identifies the user's intent based on the statement and sends an appropriate response to mobile phone 101. Mobile phone 101 then displays the response to the user. The specific implementation process of server 102 identifying the user's intent based on the statement can be found in the solutions of the following embodiments.
[0063] It should be noted that, Figure 1 This is merely a schematic diagram illustrating one application scenario provided by an embodiment of this application. This embodiment does not necessarily represent... Figure 1 The included equipment is not limited, nor is it restricted. Figure 1 The positional relationships between devices are defined. For example, in Figure 1 The application scenario shown may also include a data storage device, which may be an external storage device relative to the server 102 or an internal storage device integrated into the server 102.
[0064] Next, the intent recognition method will be introduced through specific embodiments.
[0065] Figure 2 This is a flowchart illustrating an intent recognition method provided in an embodiment of this application. The method described in this embodiment can be applied to an electronic device, which may be a server or a server cluster, etc. Figure 2 As shown, the method in this application embodiment includes:
[0066] S201. Obtain the statement to be recognized.
[0067] In this embodiment of the application, the statement to be identified may be input by a user to an electronic device executing this method embodiment, or it may be sent by another device to the electronic device executing this method embodiment. For example, the statement to be identified may be "How to apply for a household registration in City X".
[0068] S202. Input the statement to be identified into the intent recognition model to obtain the statement feature vector corresponding to the statement to be identified. The intent recognition model is obtained by training on training sample pairs based on the intent knowledge graph.
[0069] In this step, the intent recognition model is trained using training sample pairs obtained from the intent knowledge graph, rather than using a training set obtained through manual annotation. For details on how to train the intent recognition model using training sample pairs obtained from the intent knowledge graph, please refer to subsequent embodiments; these will not be elaborated here. Inputting the statement to be recognized into the intent recognition model directly yields the statement feature vector, which can be understood as the statement vector representation of the statement to be recognized.
[0070] S203. Determine the target intent vectors in the intent vector space set whose similarity to the statement feature vectors is less than a similarity threshold. The intent vector space set is obtained based on the output of the intent recognition model.
[0071] In this step, after obtaining the statement feature vector corresponding to the statement to be identified, target intent vectors with a similarity less than a similarity threshold to the statement feature vector can be determined from the intent vector space set. The intent vector space set is obtained based on the output of the intent recognition model and contains multiple intent vectors. For details on how to obtain the intent vector space set based on the output of the intent recognition model, please refer to subsequent embodiments; details will not be elaborated here.
[0072] For example, a preset similarity calculation method can be used to determine target intent vectors whose similarity to the statement feature vectors in the intent vector space is less than a similarity threshold. Taking Manhattan distance as an example, the preset similarity calculation method is used to measure distance in a multi-dimensional data space; the smaller the value, the higher the similarity. The Manhattan distance between each intent vector in the intent vector space and the statement feature vector can be obtained, and thus, target intent vectors whose Manhattan distance to the statement feature vectors in the intent vector space is less than the similarity threshold can be determined. It can be understood that for cases where the statement to be identified contains multiple intents, multiple target intent vectors whose Manhattan distance to the statement feature vectors in the intent vector space is less than the similarity threshold can be determined. For details on how to determine target intent vectors whose similarity to the statement feature vectors in the intent vector space is less than the similarity threshold, please refer to subsequent embodiments, which will not be repeated here.
[0073] It should be noted that cosine similarity can also be used as a preset similarity calculation method, and this application does not specifically limit it. This step performs similarity matching between each intent vector in the intent vector space set and the statement feature vector to determine the target intent vector in the intent vector space set whose similarity to the statement feature vector is less than the similarity threshold. This method involves fewer comparisons and is simple and efficient in calculation.
[0074] S204. Based on the target intent vector, obtain the target intent corresponding to the statement to be identified.
[0075] In this step, after obtaining the target intent vector, since the target intent vector has a corresponding target intent, the target intent corresponding to the statement to be identified can be obtained, which is the target intent corresponding to the target intent vector. Therefore, the response content corresponding to the statement to be identified can be determined based on the target intent.
[0076] The intent recognition method provided in this application involves inputting the statement to be recognized into an intent recognition model to obtain the statement feature vector corresponding to the statement. The intent recognition model is trained using training samples obtained from an intent knowledge graph, eliminating the need for manual annotation and significantly reducing training costs and improving efficiency. The method identifies target intent vectors in the intent vector space that have a similarity threshold less than a certain threshold with the statement feature vectors. This intent vector space is obtained from the output of the intent recognition model. Since each intent vector in the intent vector space is matched with a statement feature vector based on similarity, rather than matching the statement feature vector with the feature vectors of intent paths corresponding to each intent category in the intent knowledge graph, fewer comparisons are performed, resulting in simpler and more efficient computation. Based on the target intent vector, the target intent corresponding to the statement to be recognized is obtained. Therefore, while ensuring accurate multi-intent recognition, this method significantly reduces the cost and improves the efficiency of multi-intent recognition.
[0077] Based on the above embodiments, optionally, the training sample pairs used to train the intent recognition model are obtained by: combining the intent paths corresponding to the same intent category in the intent knowledge graph in pairs to obtain positive sample pairs, and combining the intent paths corresponding to different intent categories in the intent knowledge graph in pairs to obtain negative sample pairs; and determining the positive sample pairs and negative sample pairs as training sample pairs.
[0078] For example, for an intent knowledge graph containing M intent categories, positive and negative sample pairs can be constructed as follows: (1) Construct positive sample pairs, which represent two samples belonging to the same intent category. That is, a positive sample pair is a sample pair obtained by combining two intent paths corresponding to the same intent category in the intent knowledge graph. For example, a positive sample pair is represented by label 1. (2) Construct negative sample pairs, which represent the difference between two intent paths. An intent path can be extracted from all intent paths in the intent knowledge graph, and then an intent feature path can be randomly extracted from different intent categories and combined with it to form a negative sample pair. That is, a negative sample pair is a sample pair obtained by combining two intent paths corresponding to different intent categories in the intent knowledge graph. For example, a negative sample pair is represented by label 0, where label 0 indicates a similarity of 0. By constructing positive and negative sample pairs in the above way, a large number of positive and negative sample pairs can be obtained, which can then be used as training sample pairs.
[0079] Based on the above embodiments, optionally, the intent vector space set is obtained according to the output of the intent recognition model, which may include: averaging the feature vectors corresponding to the intent paths under the same intent category based on the feature vectors output by the intent recognition model to obtain an average feature vector; and obtaining the intent vector space set according to the average feature vector, which is used to represent the vector set obtained by mapping the vector representation of the intent category to the vector space.
[0080] For example, the intent recognition model vectorizes all intent paths in the intent knowledge graph and outputs the feature vectors corresponding to the intent paths. The fusion nodes, i.e. semantic information, can be averaged according to the feature vectors corresponding to intent paths distributed under different intent categories. That is, the feature vectors corresponding to intent paths under the same intent category are averaged to obtain the average feature vector corresponding to the intent category. Thus, based on the average feature vector, the vector representation of each intent category (i.e. intent) can be mapped to the vector space to obtain the intent vector space set.
[0081] The intent recognition method provided in this application can solve the problem of not being able to match semantic information in user questions based on traditional knowledge graphs. Specifically, traditional knowledge graphs cannot use entity information extracted from questions to understand intent for all matched candidate paths; while the intent recognition method provided in this application constructs an intent knowledge graph based on a collected corpus, divides it into multiple intent categories according to different intents, vectorizes the intent paths under different intent categories through an intent recognition model, and then obtains intent vectors for all intent categories through a vector averaging strategy of intent paths under different intent categories. Then, similarity matching can be performed based on these intent vectors and the semantic information in user questions.
[0082] Figure 3 A flowchart illustrating an intent recognition method according to another embodiment of this application. Based on the above embodiments, this application further describes the intent recognition method. For example... Figure 3 As shown, the method in this application embodiment may include:
[0083] S301. Obtain the statement to be recognized.
[0084] For a detailed description of this step, please refer to [link / reference]. Figure 2 The relevant description of S201 in the illustrated embodiment will not be repeated here.
[0085] In the embodiments of this application, Figure 2 Step S202 can further include the following three steps: S302 to S304:
[0086] S302. Perform word segmentation on the sentence to be identified to obtain the segmented sentence.
[0087] In this step, a preset word segmentation method can be used to segment the sentence to be recognized, resulting in a segmented sentence. Preset word segmentation methods can be found in current related technologies and will not be elaborated upon here.
[0088] S303. Encode the segmented statement to obtain the encoded statement.
[0089] In this step, after obtaining the segmented sentence, the segmented sentence can be encoded to obtain an encoded sentence. For example, based on a preset vocabulary, the segmented sentence can be encoded, such as encoding "City X" contained in the segmented sentence to obtain the numerical representation of the identifier information corresponding to "City X".
[0090] S304. Input the encoded statement into the intent recognition model to obtain the statement feature vector corresponding to the statement to be recognized.
[0091] In this step, after obtaining the encoded statement, the encoded statement can be input into the intent recognition model to obtain the statement feature vector corresponding to the statement to be recognized. This statement feature vector can be understood as the statement vector expression corresponding to the statement to be recognized.
[0092] In the embodiments of this application, Figure 2 Step S203 can further include the following two steps, S305 and S306:
[0093] S305. Obtain the similarity between the statement feature vector and each intent vector in the intent vector space set.
[0094] For example, a preset similarity calculation method can be used to obtain the similarity between the statement feature vector and each intent vector in the intent vector space. Taking the Manhattan distance as an example, the Manhattan distance between the statement feature vector and each intent vector in the intent vector space can be obtained.
[0095] S306. The number of intent vectors whose similarity to the sentence feature vectors in the intent vector space is less than a preset similarity threshold are determined as target intent vectors.
[0096] For example, the preset number is N, and this application does not specifically limit the value of the preset number. Assuming the similarity is the Manhattan distance, sorting the Manhattan distances between the statement feature vector and each intent vector in the intent vector space set from low to high can determine the top N (i.e., top N) target intent vectors in the intent vector space set whose similarity to the statement feature vector is less than the similarity threshold. Of course, in this embodiment, the Manhattan distances between the statement feature vector and each intent vector in the intent vector space set can also be sorted from high to low to determine the top N (i.e., top N) target intent vectors in the intent vector space set whose similarity to the statement feature vector is less than the similarity threshold. Of course, in this embodiment, the Manhattan distances between the statement feature vector and each intent vector in the intent vector space set can be compared pairwise to determine the top N (i.e., top N) target intent vectors in the intent vector space set whose similarity to the statement feature vector is less than the similarity threshold.
[0097] This step solves the problem of slow and inefficient intent recognition. Traditional intent recognition, as a text classification task, uses machine learning or deep learning as classifiers, resulting in poor inference performance. In this step, after the intent recognition model is trained, all user questions are converted into vector representations by the intent recognition model, and then vector similarity matching is performed to obtain the target intent vector. This method is computationally simple, requires fewer comparisons, and has a fast inference speed.
[0098] S307. Based on the target intent vector, obtain the target intent corresponding to the statement to be identified.
[0099] For a detailed description of this step, please refer to [link / reference]. Figure 2 The relevant description of S204 in the illustrated embodiment will not be repeated here.
[0100] The intent recognition method provided in this application involves segmenting and encoding the statement to be recognized, inputting the encoded statement into an intent recognition model to obtain the statement feature vector corresponding to the statement to be recognized; obtaining the similarity between the statement feature vector and each intent vector in the intent vector space; determining a preset number of intent vectors in the intent vector space whose similarity to the statement feature vector is less than a similarity threshold as target intent vectors; and obtaining the target intent corresponding to the statement to be recognized based on the target intent vectors. Since the intent recognition model in this application is trained based on training samples obtained from an intent knowledge graph, without the need for manual annotation, it significantly reduces the cost and improves the efficiency of model training. Instead of matching the statement feature vector with the feature vector of each intent vector in the intent vector space to obtain a preset number of most similar target intent vectors, the method performs fewer comparisons, resulting in simpler and more efficient computation. This significantly reduces the cost and improves the efficiency of multi-intent recognition while ensuring accurate multi-intent recognition.
[0101] Figure 4 This is a flowchart illustrating a training method for an intent recognition model provided in one embodiment of this application. The method described in this embodiment can be applied to an electronic device, which may be a server or a server cluster, etc. Figure 4 As shown, the method in this application embodiment includes:
[0102] S401. Obtain multiple training sample pairs. The training sample pairs include positive sample pairs and negative sample pairs. Positive sample pairs are obtained by combining two pairs of intent paths corresponding to the same intent category in the intent knowledge graph. Negative sample pairs are obtained by combining two pairs of intent paths corresponding to different intent categories in the intent knowledge graph.
[0103] The intent knowledge graph contains multiple intent categories and the intent path corresponding to each intent category.
[0104] In this step, intent paths in the intent knowledge graph are integrated with intent information, and the node information in the intent paths, as semantic features, can guide intent recognition. Under a specified intent category, the feature space composed of all intent paths can serve as the feature representation of that intent. For details on how to obtain the intent knowledge graph, please refer to the subsequent embodiments; they will not be repeated here. For example, assuming the initial intent recognition model is a Siamese network model, training sample pairs for the Siamese network model are obtained based on the intent knowledge graph. Specifically, all intent paths in the intent knowledge graph are used as training samples. Intent paths belonging to the same intent category are considered close to each other, while intent paths belonging to different intent categories are considered far apart. Positive sample pairs can be obtained by pairwise combination of intent paths corresponding to the same intent category in the intent knowledge graph, for example, denoted by label 1. Negative sample pairs can be obtained by pairwise combination of intent paths corresponding to different intent categories in the intent knowledge graph, for example, denoted by label 0, where label 0 indicates a similarity of 0. For details on how to obtain positive and negative sample pairs, please refer to the above embodiments; they will not be repeated here.
[0105] S402. Input multiple training samples into the initial intent recognition model to obtain a feature vector set, which includes the feature vector corresponding to each intent path.
[0106] For example, the initial intent recognition model could be a Siamese network model. The subnetworks in a Siamese network model have identical architectures, and their weights are shared. In a Siamese network model, the input is a pair of sentences, and the specific process involves mapping the two input sentences to a new space to obtain two feature vectors. The Siamese network model has a simple structure and stable training. In this step, multiple training sample pairs are input into the Siamese network model, allowing the acquisition of feature vectors corresponding to the two intent paths in each training sample pair, thus obtaining a feature vector set including the feature vectors corresponding to each intent path. Furthermore, the Siamese network model can learn the comparison between positive and negative sample pairs in the feature space, learning the feature representation of the samples.
[0107] Further, optionally, inputting the training sample pair into the initial intent recognition model may include: performing word segmentation on each sample in the training sample pair to obtain the segmented sample; performing encoding on the segmented sample to obtain the encoded sample; and inputting the encoded sample into the initial intent recognition model.
[0108] For example, referring to steps S302 and S303 in the above embodiments, a preset word segmentation method can be used to segment each sample in the training sample pair to obtain the segmented sample; based on the preset vocabulary, the segmented sample is encoded to obtain the encoded sample, and the encoded sample is input into the initial intent recognition model.
[0109] S403. Obtain the first similarity of the feature vectors corresponding to the two intention paths of the positive sample pairs in the feature vector set, and the second similarity of the feature vectors corresponding to the two intention paths of the negative sample pairs.
[0110] In this step, after obtaining the feature vector set, the first similarity of the feature vectors corresponding to the two intent paths of the positive sample pairs and the second similarity of the feature vectors corresponding to the two intent paths of the negative sample pairs can be obtained. For example, assuming the feature vectors corresponding to the two intent paths are represented by u and v, the similarity between u and v is calculated by concatenating u and v and passing them through a downstream network used to calculate similarity. In this step, the loss function can be, for example, Manhattan distance. Manhattan distance is used to measure similarity in multidimensional data space, ranging from 0 to 1; the smaller the value, the greater the similarity. The Manhattan distance can be obtained using the following formula:
[0111]
[0112] Where Manhattan_Distance(vec1, vec2) represents the Manhattan distance between vectors vec1 and vec2; x i This represents the value at the i-th position of vector vec1; y i The value at the i-th position of vector vec2.
[0113] S404. Based on the first similarity and the second similarity, iteratively train the initial intent recognition model to obtain the intent recognition model.
[0114] For example, after obtaining the first similarity of the feature vectors corresponding to the two intent paths of each positive sample pair in the feature vector set, and the second similarity of the feature vectors corresponding to the two intent paths of each negative sample pair, the initial intent recognition model can be iteratively trained based on the first and second similarities until the calculated loss function (such as Manhattan distance) meets the preset evaluation conditions, that is, the Manhattan distance between the two intent paths in the positive sample pair becomes smaller and smaller, tending to a stable state of 0; the Manhattan distance between the two intent paths in the negative sample pair becomes larger and larger, tending to a stable state of 1, thereby obtaining the intent recognition model.
[0115] The training method for the intent recognition model provided in this application obtains multiple training sample pairs, including positive and negative sample pairs. Positive sample pairs are obtained by combining two pairs of intent paths corresponding to the same intent category in the intent knowledge graph, while negative sample pairs are obtained by combining two pairs of intent paths corresponding to different intent categories in the intent knowledge graph. This eliminates the need for manual annotation to obtain the training set, significantly reducing the cost and improving the efficiency of model training. Multiple training sample pairs are input into an initial intent recognition model to obtain a feature vector set, which includes the feature vector corresponding to each intent path. The method then obtains the first similarity of the feature vectors corresponding to the two intent paths of the positive sample pairs and the second similarity of the feature vectors corresponding to the two intent paths of the negative sample pairs. Based on the first and second similarities, the initial intent recognition model is iteratively trained to obtain the intent recognition model. Therefore, the obtained intent recognition model can be accurately used for multi-intent recognition.
[0116] Based on the above embodiments, optionally, after obtaining the intent recognition model, the training method of the intent recognition model provided in this application embodiment may further include: averaging the feature vectors corresponding to intent paths under the same intent category based on the output of the intent recognition model to obtain an intent vector space set.
[0117] For example, after obtaining the intent recognition model through the training method of the intent recognition model described above, all intent paths in the intent knowledge graph are vectorized. The fusion nodes, i.e. semantic information, can be averaged according to the feature vectors corresponding to intent paths distributed under different intent categories. Thus, each intent category (i.e. intent) can be mapped to the intent vector space set, thereby obtaining the intent vector space set.
[0118] Based on the above embodiments, optionally, the intent knowledge graph is obtained by: acquiring a corpus set; based on the corpus set, extracting the intent category and node information corresponding to each corpus set using a preset intent extraction method; based on the intent category and node information, obtaining the intent path corresponding to each corpus set; based on the intent path, constructing an intent knowledge graph, the intent knowledge graph including nodes and edges, the nodes including intent categories, and the edges being the intent paths corresponding to the intent categories.
[0119] For example, the preset intent extraction method is such as clustering, template matching or keyword matching, etc., and this application does not specifically limit it. By collecting a corpus, the preset intent extraction method is used to determine the intent category and node information corresponding to each corpus in the corpus, clarify the intent boundary, and standardize the multiple entities (i.e. nodes) and words contained under each intent category. In the intent knowledge graph, the nodes are the same as those in the traditional knowledge graph. The edges in the intent knowledge graph are used for the association between entities, representing the attributes of the entity, the hierarchical ontology relationship between the entity and the concept, or the action performed by a certain entity. In the intent knowledge graph, a "hyperedge" is defined to express a set of entities or words. The intent categories (also called intents) can represent the equivalence relationship between intents. Specifically, the intent knowledge graph can be constructed through the following steps: (1) By extracting information, obtain the entity, relation, attribute information of the entity and the phrase expressing the intent of the question from the original question;
[0120] (2) Based on the extracted information, the extracted entities are linked to the correct entity objects in the knowledge base. Based on the above operations, entities, attributes, actions, and relationships extracted from a single question can form an intent path. Based on different intent paths, an intent knowledge graph can be constructed. Nodes in the intent knowledge graph include intent categories, such as an intent category being an attribute of the last node in all nodes constituting an intent path; edges in the intent knowledge graph are intent paths corresponding to intent categories. For example, the corpus is "How to apply for a Beijing household registration". In the intent knowledge graph, it is converted into three entities: "household registration", "Beijing", and "apply". These are used as node information in the intent knowledge graph. After connecting the nodes, they are added to the graph as hyperedges "household registration → Beijing → apply". The intent corresponding to the hyperedge is "household registration application". After obtaining the intent knowledge graph, the intent knowledge graph can be enriched quickly and efficiently, and the intent recognition model can be iteratively optimized, through continuous expansion of the intent knowledge graph and synchronous expansion of the input data of the intent recognition model.
[0121] For example, taking a corpus for household registration transfer as an example, for question scenarios involving household registration transfer in and out, the corpus that can be collected includes at least the following: Conditions for transferring household registration in City B? Procedures for intra-city transfer of household registration in City B? Procedures for transferring out of Zhongshan City from City B? Conditions for transferring from City B to City A? Conditions for transferring from City A to City B? Procedures for intra-city transfer in City B? Materials required for intra-city transfer in City B? Figure 5 A schematic diagram illustrating the construction of an intent knowledge graph based on a corpus set, as provided in an embodiment of this application, is shown below. Figure 5As shown, the intentions (i.e., intention categories) regarding "City B household registration" include six types: "migration in", "migration out", "processing", "transfer", "advantages and disadvantages", and "intra-city migration". Each intention contains multiple intention paths. The subsets of intention paths obtained according to the above six intentions are as follows: (1) The intention path set included in the "transfer" intention: household registration -> city B -> transfer -> collective -> conditions, household registration -> city B -> transfer -> individual -> conditions; (2) The intention path set included in the "move out" intention: household registration -> city B -> move out -> city C, household registration -> city B -> move out -> city D, household registration -> city B -> move out -> city E, household registration -> city B -> move out -> city A; (3) The intention path set included in the "move in" intention: household registration -> city B -> move in -> city E, household registration -> city B -> move in -> city A, household registration -> city B -> move in -> city F; (4) The intention path set included in the "process" intention: household registration -> city B -> process; (5) The intention path set included in the "advantages and disadvantages" intention: household registration -> city B -> advantages and disadvantages; (6) The intention path set included in the "intra-city transfer" intention: household registration -> city B -> intra-city transfer -> procedures, household registration -> city B -> intra-city transfer -> materials. The training sample pairs required for training the Siamese network model can be constructed based on the above intent paths. As shown in Table 1, if sentence 1 and sentence 2 have the same intent, the label is 1, indicating a positive sample pair; if sentence 1 and sentence 2 have different intents, the label is 0, indicating a negative sample pair.
[0122] Table 1
[0123]
[0124] Based on the aforementioned method of obtaining the intent knowledge graph, the intent recognition method provided in this application can solve the problem of not being able to integrate the intent knowledge graph in intent recognition. For traditional intent recognition, semantic parsing requires a large number of templates and rules, which are then learned by combining machine learning or deep learning models and used as a separate pipeline to finally obtain the parsed intent. However, the intent recognition method provided in this application does not require a large number of templates for semantic extraction. In the data analysis stage of user semantic parsing, multiple semantic information contained under the intent is collected according to the dimension of the intent, converted into multiple nodes and put into the intent knowledge graph. As the data is continuously iterated, the intent knowledge graph will be continuously enriched and feed back into the semantic parsing part. The two interact deeply and complement each other.
[0125] The intent recognition method provided in this application can be applied to any scenario requiring intent recognition, and thus can be applied to products in these scenarios, such as a chatbot customer service dialogue system. A chatbot customer service dialogue system is used for multi-turn dialogues between a chatbot and a user. It can efficiently respond based on the results of intent recognition, with the response method categorized according to whether multiple intents belong to the same slot. If multiple intents belong to the same slot, the system asks a clarifying question to the user based on the slot-filling script to confirm the answer. If multiple intents belong to two different slots, the system sorts the returned results according to a threshold, asks clarifying questions to the user sequentially based on the sorted results, obtains the slot value, and returns the filled answer based on the slot value. The multi-intent results identified by the intent recognition method provided in this application can be effectively applied in multi-turn dialogues and assist the chatbot in clarifying questions and completing slot filling.
[0126] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.
[0127] Figure 6 This is a schematic diagram of the structure of an intent recognition device provided in an embodiment of this application, as shown below. Figure 6 As shown, the intent recognition device 600 of this application embodiment includes: a first acquisition module 601, a processing module 602, a determination module 603, and a obtaining module 604. Wherein:
[0128] The first acquisition module 601 is used to acquire the statement to be recognized.
[0129] The processing module 602 is used to input the statement to be recognized into the intent recognition model to obtain the statement feature vector corresponding to the statement to be recognized. The intent recognition model is obtained by training on training sample pairs based on the intent knowledge graph.
[0130] The determination module 603 is used to determine the target intent vectors in the intent vector space set whose similarity to the statement feature vectors is less than a similarity threshold. The intent vector space set is obtained based on the output of the intent recognition model.
[0131] Module 604 is used to obtain the target intent corresponding to the statement to be identified based on the target intent vector.
[0132] In some embodiments, the intent recognition device 600 may further include a second acquisition module 605, configured to acquire training sample pairs by: combining intent paths corresponding to the same intent category in the intent knowledge graph in pairs to obtain positive sample pairs, and combining intent paths corresponding to different intent categories in the intent knowledge graph in pairs to obtain negative sample pairs; and determining the positive sample pairs and negative sample pairs as training sample pairs.
[0133] Optionally, the intent recognition device 600 may further include a third acquisition module 606, used to: average the feature vectors corresponding to intent paths under the same intent category based on the feature vectors output by the intent recognition model, to obtain an average feature vector; and obtain an intent vector space set based on the average feature vector, the intent vector space set being used to characterize the set of vectors obtained by mapping the vector representation of intent categories to the vector space.
[0134] In some embodiments, the determining module 603 may be specifically used to: obtain the similarity between the statement feature vector and each intent vector in the intent vector space set; and determine a preset number of intent vectors in the intent vector space set whose similarity to the statement feature vector is less than a similarity threshold as target intent vectors.
[0135] In some embodiments, the processing module 602 may be specifically used to: perform word segmentation on the statement to be recognized to obtain the word segmented statement; perform encoding on the word segmented statement to obtain the encoded statement; and input the encoded statement into the intent recognition model.
[0136] The apparatus of this application embodiment can be used to execute the scheme of the intent recognition method in any of the above method embodiments. Its implementation principle and technical effect are similar, and will not be described again here.
[0137] Figure 7 This is a schematic diagram of the structure of a training device for an intent recognition model provided in an embodiment of this application, as shown below. Figure 7 As shown, the training device 700 for the intent recognition model in this embodiment includes: a first acquisition module 701, a processing module 702, a second acquisition module 703, and a training module 704. Wherein:
[0138] The first acquisition module 701 is used to acquire multiple training sample pairs. The training sample pairs include positive sample pairs and negative sample pairs. Positive sample pairs are sample pairs obtained by combining the intent paths corresponding to the same intent category in the intent knowledge graph in pairs. Negative sample pairs are sample pairs obtained by combining the intent paths corresponding to different intent categories in the intent knowledge graph in pairs. The intent knowledge graph contains multiple intent categories and the intent paths corresponding to each intent category.
[0139] The processing module 702 is used to input multiple training samples into the initial intent recognition model to obtain a feature vector set, which includes the feature vector corresponding to each intent path.
[0140] The second acquisition module 703 is used to acquire the first similarity of the feature vectors corresponding to the two intention paths of the positive sample pairs in the feature vector set, and the second similarity of the feature vectors corresponding to the two intention paths of the negative sample pairs.
[0141] Training module 704 is used to iteratively train the initial intent recognition model based on the first similarity and the second similarity to obtain the intent recognition model.
[0142] In some embodiments, the training apparatus for the intent recognition model further includes a third acquisition module 705, configured to acquire an intent knowledge graph by: acquiring a corpus set; based on the corpus set, extracting the intent category and node information corresponding to each corpus in the corpus set using a preset intent extraction method; based on the intent category and node information, obtaining the intent path corresponding to each corpus set; and based on the intent path, constructing an intent knowledge graph, wherein the intent knowledge graph contains multiple intent categories and the intent path corresponding to each intent category.
[0143] Optionally, the processing module 702 can also be used to: after obtaining the intent recognition model, based on the feature vectors corresponding to the intent paths output by the intent recognition model, perform average processing on the feature vectors corresponding to the intent paths under the same intent category to obtain an average feature vector; and obtain an intent vector space set based on the average feature vector.
[0144] The apparatus of this application embodiment can be used to execute the training method of the intent recognition model in any of the above method embodiments. Its implementation principle and technical effect are similar, and will not be repeated here.
[0145] Figure 8 This is a schematic diagram of the structure of an electronic device provided according to an embodiment of this application. Exemplarily, the electronic device may be provided as a server or a computer. (Refer to...) Figure 8 The electronic device 800 includes a processing component 801, which further includes one or more processors, and memory resources represented by memory 802 for storing instructions, such as application programs, that can be executed by the processing component 801. The application programs stored in memory 802 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 801 is configured to execute instructions to perform any of the method embodiments described above.
[0146] Electronic device 800 may also include a power supply component 803 configured to perform power management of electronic device 800, a wired or wireless network interface 804 configured to connect electronic device 800 to a network, and an input / output (I / O) interface 805. Electronic device 800 may operate on an operating system stored in memory 802, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or similar.
[0147] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-mentioned intent recognition method and the training method for the intent recognition model.
[0148] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described intention recognition method and a method for training the intention recognition model.
[0149] The aforementioned 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. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0150] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an application-specific integrated circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in an intent recognition device or a training device for an intent recognition model.
[0151] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0152] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. An intent recognition method, characterized in that, include: Obtain the statement to be recognized; The statement to be identified is input into the intent recognition model to obtain the statement feature vector corresponding to the statement to be identified. The intent recognition model is obtained by training on training sample pairs based on the intent knowledge graph. The training sample pairs include positive sample pairs formed by combining two pairs of intent paths corresponding to the same intent category in the intent knowledge graph, and negative sample pairs formed by combining two pairs of intent paths corresponding to different intent categories in the intent knowledge graph. Determine the target intent vectors in the intent vector space set whose similarity to the statement feature vectors is less than a similarity threshold, wherein the intent vector space set is obtained based on the output of the intent recognition model; Based on the target intent vector, the target intent corresponding to the statement to be identified is obtained.
2. The intent recognition method according to claim 1, characterized in that, The intent vector space set is obtained based on the output of the intent recognition model, and includes: Based on the feature vector corresponding to the intent path output by the intent recognition model, the feature vectors corresponding to the intent paths under the same intent category are averaged to obtain the average feature vector. Based on the average feature vector, the intent vector space set is obtained, which is used to characterize the vector set obtained by mapping the vector representation of intent categories to the vector space.
3. The intent recognition method according to claim 1 or 2, characterized in that, The determination of target intent vectors in the intent vector space set whose similarity to the statement feature vector is less than a similarity threshold includes: Obtain the similarity between the statement feature vector and each intent vector in the intent vector space set; The target intent vectors are determined by identifying a preset number of intent vectors in the intent vector space whose similarity to the statement feature vector is less than a similarity threshold.
4. The intent recognition method according to claim 1 or 2, characterized in that, The step of inputting the statement to be recognized into the intent recognition model includes: The sentence to be identified is segmented into words to obtain the segmented sentence. The segmented sentence is then encoded to obtain the encoded sentence. The encoded statement is input into the intent recognition model.
5. A training method for an intent recognition model, characterized in that, include: Multiple training sample pairs are obtained, including positive sample pairs and negative sample pairs. The positive sample pairs are obtained by combining the intent paths corresponding to the same intent category in the intent knowledge graph in pairs. The negative sample pairs are obtained by combining the intent paths corresponding to different intent categories in the intent knowledge graph in pairs. The intent knowledge graph contains multiple intent categories and the intent path corresponding to each intent category. The multiple training samples are input into the initial intent recognition model to obtain a feature vector set, which includes the feature vector corresponding to each intent path. Obtain the first similarity of the feature vectors corresponding to the two intent paths of the positive sample pair in the feature vector set, and the second similarity of the feature vectors corresponding to the two intent paths of the negative sample pair. Based on the first similarity and the second similarity, the initial intent recognition model is trained iteratively to obtain the intent recognition model.
6. The training method for the intent recognition model according to claim 5, characterized in that, The intent knowledge graph was obtained through the following methods: Obtain the corpus; Based on the corpus, a preset intent extraction method is used to extract the intent category and node information corresponding to each corpus in the corpus. Based on the intent category and the node information, the intent path corresponding to each corpus is obtained; Based on the intent path, an intent knowledge graph is constructed. The intent knowledge graph includes nodes and edges. The nodes include intent categories, and the edges are intent paths corresponding to the intent categories.
7. The training method for the intent recognition model according to claim 5 or 6, characterized in that, After obtaining the intent recognition model, the process further includes: Based on the feature vector corresponding to the intent path output by the intent recognition model, the feature vectors corresponding to the intent paths under the same intent category are averaged to obtain the average feature vector. Based on the average feature vector, the intention vector space set is obtained.
8. An intent recognition device, characterized in that, include: The first acquisition module is used to acquire the statement to be recognized; The processing module is used to input the statement to be identified into the intent recognition model to obtain the statement feature vector corresponding to the statement to be identified. The intent recognition model is obtained by training on training sample pairs based on the intent knowledge graph. The training sample pairs include positive sample pairs formed by combining two pairs of intent paths corresponding to the same intent category in the intent knowledge graph, and negative sample pairs formed by combining two pairs of intent paths corresponding to different intent categories in the intent knowledge graph. The determination module is used to determine target intent vectors in the intent vector space set whose similarity to the statement feature vector is less than a similarity threshold, wherein the intent vector space set is obtained based on the output of the intent recognition model; The module is used to obtain the target intent corresponding to the statement to be identified based on the target intent vector.
9. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions that, when executed by a processor, implement the method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
User intention recognition method and apparatus, device, and computer-readable storage medium
WO2022141875A1