Method, device, electronic equipment, medium and program product for identifying intent

By using the Huffman tree construction method, the problems of cumbersome intent label update process and large data computation are solved, and an efficient intent label system update and recognition is achieved.

CN114036278BActive Publication Date: 2025-12-12KE COM (BEIJING) TECHNOLOGY CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202111355426.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-16
Publication Date
2025-12-12
Estimated Expiration
2041-11-16

AI Technical Summary

Technical Problem

In existing technologies, the process of updating intent labels is cumbersome, involves a large amount of data processing, and is inefficient, making it difficult to update the intent recognition system efficiently.

Method used

The Huffman tree construction method is adopted. Based on the distribution pattern of intent labels in the preset dataset, a one-to-one correspondence between leaf nodes and intent labels is constructed. The merging and splitting of intent labels are realized by updating the nodes in the Huffman tree, thereby improving the update efficiency.

Benefits of technology

By using node operations of the Huffman tree, the process of updating intent labels is simplified, the amount of data processing and time consumption are reduced, and the update efficiency and recognition accuracy of the intent label system are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114036278B_ABST
    Figure CN114036278B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure disclose a method, device, electronic device, medium and computer program product for identifying an intent, wherein the method comprises: determining a text vector of a text to be identified; inputting the text vector into a pre-trained Huffman tree to determine a target leaf node corresponding to the text vector in the Huffman tree, the Huffman tree being constructed based on a distribution rule of intent labels in a preset data set, and the leaf nodes in the Huffman tree corresponding to the preset intent labels one by one; and determining an intent label represented by the target leaf node as a target intent label of the text to be identified. The updating operation on the intent label can be realized by updating the nodes in the Huffman tree, thereby improving the updating efficiency of the intent label system.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to a method, apparatus, electronic device, storage medium and computer program product for identifying an intent. BACKGROUND

[0002] In an intelligent dialogue system, intent recognition on conversation content can determine the conversation intent of a conversation object, and make a targeted reply according to the recognized conversation intent.

[0003] In a real business scenario, as business data accumulates, the intent system often needs to be updated to improve the accuracy of intent recognition, for example, splitting one intent label into multiple new intent labels to refine the categories of intent labels; for example, combining multiple intent labels into a new intent label. It can be seen that the update efficiency of the intent label system can directly affect the flexibility and accuracy of intent recognition. SUMMARY

[0004] Embodiments of the present disclosure provide a method, apparatus, electronic device, storage medium and computer program for identifying an intent to improve the update efficiency of managing the intent label system.

[0005] In one aspect of the embodiments of the present disclosure, a method for identifying an intent is provided, including: determining a text vector of a text to be identified; inputting the text vector into a pre-trained Huffman tree to determine a target leaf node corresponding to the text vector in the Huffman tree, the Huffman tree being constructed based on a distribution rule of intent labels in a preset data set, and the leaf nodes in the Huffman tree corresponding one-to-one to the preset intent labels; and determining an intent label represented by the target leaf node as a target intent label of the text to be identified.

[0006] In some embodiments, inputting the text vector into the pre-constructed Huffman tree to determine the target leaf node corresponding to the text vector in the Huffman tree includes: determining a root node in the Huffman tree as a current node; based on the current node, performing the following classification steps: determining a product of the text vector and a feature vector of the current node; inputting the product into a pre-constructed classifier to determine a classification result of the current node; based on the classification result, determining a target child node from child nodes of the current node; if the target child node is a non-leaf node, updating the target child node as the current node and performing the classification steps again; and if the target child node is a leaf node, determining the leaf node as the target leaf node.

[0007] In some embodiments, the Huffman tree is constructed via the following steps: obtaining a preset data set, the preset data set comprising text data pre-labeled with intent labels; determining each intent label included in the preset data set and a category proportion of each intent label, the category proportion being a ratio of a quantity of text data labeled with the intent label to a total quantity of text data in the preset data set; generating a binary tree including only one root node for each intent label, obtaining a forest composed of multiple binary trees, a weight of the root node of the binary tree being the category proportion of the intent label, and a feature vector of the root node of the binary tree being an embedding vector of the intent label; based on the forest, performing the following merging step: determining two binary trees with the smallest root node weights from the forest; generating a new binary tree based on the two binary trees, the left and right subtrees of the new binary tree being the two binary trees respectively, and the weight of the root node of the new binary tree being a sum of the weights of the root nodes of the left and right subtrees; adding the new binary tree to the forest and deleting the two binary trees from the forest to obtain an updated forest; if the updated forest includes more than one binary tree, continuing to perform the merging step based on the updated forest; if the updated forest includes only one binary tree, determining the binary tree as an initial Huffman tree; training the initial Huffman tree based on the preset data set, determining feature vectors of non-leaf nodes in the initial Huffman tree, and obtaining a trained Huffman tree.

[0008] In some embodiments, the method further comprises: in response to receiving a merging instruction of an intent label, generating a new intent label based on at least two to-be-merged intent labels pointed to by the merging instruction, and updating intent labels of text data in the preset data set corresponding to the at least two to-be-merged intent labels to the new intent label to obtain a merged preset data set; determining at least two to-be-merged leaf nodes in the Huffman tree corresponding to the at least two to-be-merged intent labels; determining a leaf node with the highest weight among the at least two to-be-merged leaf nodes as a reference leaf node, the reference leaf node being used to represent the new intent label; determining a sum of the weights of the at least two to-be-merged leaf nodes as the weight of the reference leaf node, and deleting the to-be-merged leaf nodes other than the reference leaf node from the Huffman tree; updating connection relationships of nodes in a branch with a parent node of the reference leaf node as a branch root node and weights of non-leaf nodes based on a construction strategy of the Huffman tree to obtain an updated branch; training the updated branch based on the merged data set, determining feature vectors of non-leaf nodes in the updated branch, and obtaining a Huffman tree after merging of intent labels.

[0009] In some embodiments, the method further comprises: in response to receiving the splitting instruction of the intent label, determining a to-be-split node corresponding to the to-be-split intent label in the Huffman tree, and generating at least two new intent labels based on the splitting instruction; updating, based on the at least two new intent labels, the intent labels of the text data in the preset data set marked with the to-be-split intent label to obtain a split preset data set, and determining a category proportion of each of the at least two new intent labels in the split preset data set; generating at least two new leaf nodes in the Huffman tree, the weight of the at least two new leaf nodes being the category proportion of each of the at least two new intent labels in the split preset data set, and the at least two new leaf nodes being used to represent the at least two new intent labels; constructing, based on a construction strategy of the Huffman tree, the at least two new leaf nodes as child nodes of the to-be-split node, a new branch with the to-be-split node as a branch root node in the Huffman tree, and the new branch representing a connection relationship between the at least two new leaf nodes and the to-be-split node; and training the new branch based on the split preset data set, determining a feature vector of each non-leaf node in the new branch, and obtaining the Huffman tree after splitting the intent label.

[0010] In some embodiments, based on the construction strategy of the Huffman tree, the at least two new leaf nodes are constructed as child nodes of the to-be-split node, and a new branch with the to-be-split node as a branch root node is constructed in the Huffman tree, including: if the number of the at least two new leaf nodes is greater than 2, a node set is constructed based on the at least two new leaf nodes; based on the node set, the following branch construction steps are performed: two nodes with the smallest weights are determined from the node set; a new node is constructed based on the two nodes, and the weight of the new node is the sum of the weights of the two nodes; the new node is added to the node set, and the two nodes are deleted from the node set to obtain an updated node set; if the number of nodes in the updated node set is greater than 2, the branch construction steps are performed based on the updated node set; and if the number of nodes in the updated node set is not greater than 2, the two nodes are taken as child nodes of the to-be-split node to obtain the new branch.

[0011] In some embodiments, based on the construction strategy of the Huffman tree, the at least two new leaf nodes are constructed as child nodes of the to-be-split node, and a new branch with the to-be-split node as a branch root node is constructed in the Huffman tree, including: if the at least two new nodes include two new nodes, the two new nodes are determined as child nodes of the to-be-split node to obtain the new branch.

[0012] In yet another aspect of the embodiments of the present disclosure, an electronic device is provided, including: a memory configured to store a computer program; and a processor configured to execute the computer program stored in the memory, and when the computer program is executed, the method for identifying an intent in any of the above embodiments is implemented.

[0013] In still another aspect of the embodiments of the present disclosure, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program. The computer program is executed by a processor to implement the method for identifying an intent in any of the above embodiments.

[0014] In still another aspect of the embodiments of the present disclosure, a computer program product is provided, and the computer program product includes computer programs / instructions. The computer programs / instructions are executed by a processor to implement the method for identifying an intent in any of the above embodiments.

[0015] The method for identifying an intent provided by the embodiments of the present disclosure can input a text vector of a text to be identified into a pre-trained Huffman tree, determine a target leaf node corresponding to the text vector in the Huffman tree, and then determine an intent label represented by the target leaf node as a target intent label of the text to be identified. The Huffman tree is constructed based on a distribution rule of the intent label in a preset data set, and the leaf nodes of the Huffman tree are one-to-one corresponding to the intent label. The updating operation on the intent label can be implemented by updating the nodes in the Huffman tree, so as to improve the updating efficiency of the intent label system.

[0016] The technical solutions of the present disclosure are described in further detail below by means of the accompanying drawings and embodiments. BRIEF DESCRIPTION OF DRAWINGS

[0017] The accompanying drawings, which form a part of the specification, illustrate embodiments of the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0018] The present disclosure can be more clearly understood and appreciated from the following detailed description, taken in conjunction with the following drawings of which:

[0019] Figure 1 An application scenario of the method for identifying an intent of the present disclosure is shown in the figure.

[0020] Figure 2 A flowchart of an embodiment of the method for identifying an intent of the present disclosure is shown in the figure.

[0021] Figure 3 A flowchart of determining a target leaf node in an embodiment of the method for identifying an intent of the present disclosure is shown in the figure.

[0022] Figure 4 A schematic diagram of determining a target leaf node in an embodiment of the method for identifying an intent of the present disclosure is shown in the figure.

[0023] Figure 5 A flowchart of constructing a Huffman tree in an embodiment of the method for identifying an intent of the present disclosure is shown in the figure.

[0024] Figure 6 A flowchart of merging intent labels in an embodiment of the method for identifying an intent of the present disclosure is shown in the figure.

[0025] FIG. 7 is a schematic diagram of merging intent labels in one embodiment of the method for identifying intent of the present disclosure;

[0026] Figure 8 FIG. 8 is a flowchart of splitting intent labels in one embodiment of the method for identifying intent of the present disclosure;

[0027] FIG. 9 is a schematic diagram of splitting intent labels in one embodiment of the method for identifying intent of the present disclosure;

[0028] Figure 10 FIG. 10 is a schematic diagram of splitting intent labels in another embodiment of the method for identifying intent of the present disclosure;

[0029] Figure 11 FIG. 11 is a schematic diagram of the structure of one embodiment of the apparatus for identifying intent of the present disclosure;

[0030] Figure 12 FIG. 12 is a schematic diagram of the structure of one application embodiment of the electronic device of the present disclosure. DETAILED DESCRIPTION

[0031] Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. Note that the relative arrangement, numerical expressions, and numerical values of components and steps set forth in these embodiments are not limiting to the scope of the present disclosure unless otherwise specifically stated.

[0032] Those skilled in the art can understand that the terms "first", "second", and the like in the embodiments of the present disclosure are only used to distinguish different steps, devices, or modules, and do not represent any specific technical meaning, nor do they represent a necessary logical sequence between them.

[0033] It should also be understood that in the embodiments of the present disclosure, "multiple" can refer to two or more, and "at least one" can refer to one, two, or more.

[0034] It should also be understood that for any component, data, or structure mentioned in the embodiments of the present disclosure, unless specifically limited or given a contrary implication by the context, it can generally be understood as one or more.

[0035] In addition, the term "and / or" in the present disclosure is only a description of the association relationship between the associated objects, which means that there can be three relationships, for example, A and / or B can represent the existence of A alone, the existence of A and B together, and the existence of B alone. In addition, the character " / " in the present disclosure generally represents an "or" relationship between the front and rear associated objects.

[0036] It should also be understood that the description of various embodiments of the present disclosure focuses on the differences between the various embodiments, and the same or similar parts can be referred to each other, and for the sake of brevity, will not be repeated.

[0037] It should be understood that the dimensions of the various portions shown in the drawings are chosen for purposes of convenience and clarity of presentation, not necessarily to scale.

[0038] The following description of at least one example embodiment is merely illustrative in nature and is in no way intended to limit the disclosure, its application, or uses.

[0039] Techniques, methods, and devices known to those of ordinary skill in the relevant art can not be discussed in detail herein. However, where appropriate, such techniques, methods, and devices can be considered part of the specification.

[0040] It is to be understood that the same can be employed in the same or other drawings in place of or in conjunction with those described.

[0041] Embodiments of the disclosure can apply to terminal devices, computer systems, servers, and other electronic devices, which can operate with numerous other general purpose or special purpose computing system environments or configurations. Examples of well-known computing systems, environments, and / or configurations that can be suitable for use with terminal devices, computer systems, servers, and other electronic devices include, but are not limited to: personal computers, servers, thin clients, thick clients, hand-held or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, network personal computers, minicomputers, mainframe computers, and distributed cloud computing environments that include any of the above systems or devices, and the like.

[0042] Terminal devices, computer systems, servers, and other electronic devices can be described in the general context of computer system-executable instructions, such as program modules, being executed by a computer system. Generally, program modules can include routines, programs, objects, components, logic, data structures, and the like, that perform particular tasks or implement particular abstract data types. Computer systems / servers can be practiced in distributed cloud-computing environments with remote processing devices that are linked through a communications network. In a distributed cloud-computing environment, program modules can reside on local or remote computer system storage media including memory storage devices.

[0043] SUMMARY

[0044] In the process of realizing this disclosure, the inventors discovered that in related technologies, when it is necessary to update the intent label in the intent recognition system, it is first necessary to update the intent label and obtain the dataset corresponding to the new intent label, such as merging two old intent labels into a new intent label, or splitting an old intent label into two new intent labels; then, based on the dataset corresponding to the new intent label, the already trained intent label recognition model is retrained so that the intent label recognition model learns the recognition strategy of the new intent label. This has the disadvantages of a cumbersome update process, large amount of data computation, and low efficiency.

[0045] Exemplary System

[0046] The following is combined Figure 1 The application scenarios shown illustrate the method for identifying intent disclosed herein. Figure 1 In the scenario shown, after receiving the text 120 to be recognized, the electronic device 110, on which the method for recognizing intent of this disclosure runs, converts the text 120 into a vector representation, obtaining a text vector 130. Then, the text vector 130 is input into a pre-trained Huffman tree. Starting from the root node A of the Huffman tree, a preset classifier performs binary classification on the input text vector, and determines the next node based on the binary classification result. The node path of the text vector in the Huffman tree can be determined step by step. This node path sequentially includes nodes A, C, E, and F, where F is the target leaf node corresponding to the text 110 to be recognized. In the node path, each node before the target leaf node corresponds to one binary classification.

[0047] Then, the intent label 4 corresponding to the target leaf node can be determined as the target intent label of the text 110 to be recognized. This realizes the recognition of the intent of the text through the Huffman tree, and the intent label can be updated by manipulating the nodes of the Huffman tree, which helps to improve the update efficiency of the intent label recognition system.

[0048] Exemplary Method

[0049] Next, refer to Figure 2 , Figure 2 A flowchart illustrating one embodiment of the method for identifying intent disclosed herein is shown, such as... Figure 2 As shown, the process includes the following steps.

[0050] Step 210: Determine the text vector of the text to be recognized.

[0051] In this embodiment, the text vector is a vector representation of the text to be recognized. As an example, the execution subject (which can be a terminal device or a server, for example) can determine the text vector of the text to be recognized by methods such as one-hot encoding, multilayer perception, etc.

[0052] In some optional implementations of this embodiment, the text to be recognized can be text data extracted from speech data by a speech recognition algorithm, text data recognized from an image by an image recognition algorithm, or text data extracted from any other object that needs to be recognized.

[0053] Step 220: inputting the text vector into the pre-trained Huffman tree to determine the target leaf node corresponding to the text vector in the Huffman tree.

[0054] In this embodiment, the Huffman tree is constructed based on the distribution of the intent labels in the preset data set, and the leaf nodes in the Huffman tree correspond one-to-one to the preset intent labels.

[0055] As an example, the execution subject can determine the number of occurrences of each preset intent label in the preset data set by statistical analysis, and sort the intent labels according to the number of occurrences; then, according to the pre-constructed correspondence relationship list between the order and the weight, the weight corresponding to each intent label is determined, which is the weight of the leaf node corresponding to the intent label in the Huffman tree. The Huffman tree thus constructed can represent the distribution of the intent labels in the preset data set.

[0056] In this embodiment, each node in the Huffman tree corresponds to a feature vector, wherein the feature vector of a leaf node can be an embedding vector of the corresponding intent label, and the feature vector of a non-leaf node is determined in the training phase of the Huffman tree. For a non-leaf node, a preset classifier (which can be a softmax function, for example) can be used to generate the classification result of the node based on the product of the text vector and the feature vector of the node, and the classification result is used to determine the child nodes of the node. The target leaf node represents the recognition result of the text to be recognized in the Huffman tree.

[0057] In some optional implementations of this embodiment, the preset data set can be sampled from the online data of the intelligent conversation system, and the distribution of the preset data set thus obtained is consistent with that of the real data, which helps to improve the accuracy of intent recognition.

[0058] Step 230: determining the intent label represented by the target leaf node as the target intent label of the text to be recognized.

[0059] The method for identifying an intent in the embodiments of the present disclosure can input a text vector of to-be-identified text into a pre-trained Huffman tree, determine a target leaf node corresponding to the text vector in the Huffman tree, and then determine an intent label represented by the target leaf node as a target intent label of the to-be-identified text. The Huffman tree is constructed based on a distribution rule of the intent label in a preset data set, and the leaf nodes of the Huffman tree are in one-to-one correspondence with the intent label. The updating operation on the intent label can be implemented by updating the nodes in the Huffman tree, thereby improving the updating efficiency of the intent label system.

[0060] Reference will be made to Figure 3 , Figure 3 FIG. 1 is a flowchart for determining a target leaf node in one embodiment of the method for identifying an intent of the present disclosure. The step 220 can further include the following steps.

[0061] Step 310: Determine the root node in the Huffman tree as a current node.

[0062] In the present implementation, the execution subject inputs the text vector obtained in the step 210 into the root node of the Huffman tree, and can take the root node as the current node. Then, based on the current node, a classification step is performed, which includes the steps 320 to 340.

[0063] Step 320: Determine the product of the text vector and the feature vector of the current node.

[0064] Step 330: Input the product into a pre-constructed classifier to determine a classification result of the current node.

[0065] Step 340: Based on the classification result, determine a target child node from the child nodes of the current node.

[0066] Generally, each non-leaf node in the Huffman tree is connected to two child nodes through two lines respectively. When constructing the Huffman tree, a strategy for selecting a target child node according to the classification result of the classifier can be pre-set.

[0067] As an example, the classifier can adopt a softmax function, which can output 0 or 1 based on the input product. When the classification result is 0, the right child node is selected as the target child node, and when the classification result is 1, the left child node is selected as the target child node.

[0068] Step 350: If the target child node is a non-leaf node, update the target child node as the current node, and perform the classification step again.

[0069] In the present implementation, the execution subject can verify the target child node determined in the step 340. If the target child node is a non-leaf node, return to the step 320.

[0070] If the target child node is a leaf node, then proceed to step 360.

[0071] Step 360: Determine this leaf node as the target leaf node.

[0072] Further integration Figure 4 right Figure 3 The process shown is illustrated by example, such as Figure 4 As shown, the execution entity inputs the text vector into the root node A, obtains the product of the text vector and the feature vector of node A, and then inputs this product into the classifier. If the classifier outputs a classification result of 0, then the right child node C of node A is taken as the target child node of A. Since node C is still a non-leaf node, the classification step continues, and the target child node of node C is determined to be E. Finally, the target child node of node E is determined to be node F, and since F is a leaf node, node F is determined as the target leaf node.

[0073] Compared with semantic recognition-based intent classification models in related technologies, this implementation can determine the target leaf node corresponding to the text vector by multiple classifications corresponding to multiple nodes in the Huffman tree, which can avoid the decrease in accuracy caused by the high degree of confusion of intent labels.

[0074] Next, refer to Figure 5 , Figure 5 A flowchart of constructing a Huffman tree is provided as an embodiment of the method for identifying intent disclosed herein, such as Figure 5 As shown, the process includes the following steps.

[0075] Step 510: Obtain the preset dataset.

[0076] The preset dataset includes text data pre-labeled with intent tags.

[0077] As an example, the executing entity can first obtain the dialogue logs in the intelligent conversation system, and then, based on the preset intent tags, label the dialogue text to obtain the preset dataset.

[0078] Step 520: Determine the intent labels contained in the preset dataset and the category proportion of each intent label.

[0079] The category percentage is the ratio of the number of text data labeled with the intent to the total number of text data in the preset dataset.

[0080] As an example, the number of text data included in the preset data set is 100, wherein the number of text data labeled with the intent label a is 20, the number of text data labeled with the intent label b is 30, and the number of text data labeled with the intent label c is 50, and the category proportions of the intent labels a, b, and c are 0.2, 0.3, and 0.5 respectively.

[0081] Step 530, generating a binary tree including only one root node for each intent label to obtain a forest composed of multiple binary trees.

[0082] The weight of the root node of the binary tree is the category proportion of the intent label, and the feature vector of the root node of the binary tree is the embedding vector of the intent label.

[0083] Continue to illustrate with the example in step 520, the execution subject can determine the embedding vectors Va, Vb, and Vc of the intent labels a, b, and c respectively by using the multi-layer perception, and then generate three binary trees by taking the embedding vectors as the feature vectors of the root nodes, and thus obtain three binary trees 1, 2, and 3 in the forest, and the weights of the root nodes of the three binary trees are 0.2, 0.3, and 0.5 respectively.

[0084] Then, the execution subject can perform the following merging step based on the forest, and the merging step includes steps 540 to 580.

[0085] Step 540, determining two binary trees with the smallest weights of root nodes from the forest.

[0086] Step 550, generating a new binary tree based on the two binary trees, and the left and right child trees of the new binary tree are the two binary trees respectively.

[0087] The weight of the root node of the new binary tree is the sum of the weights of the root nodes of the left and right child trees.

[0088] Step 560, adding the new binary tree to the forest and deleting the two binary trees from the forest to obtain an updated forest.

[0089] Continue to illustrate with the example in step 520, the two binary trees determined by the execution subject in step 540 are binary trees 1 and 2, and the weights thereof are 0.2 and 0.3 respectively. Then, a new binary tree 4 is generated by taking the binary trees 1 and 2 as the left and right child trees respectively, the weight of the binary tree 4 is 0.5, and the feature vector thereof is the initial feature vector, and thus the binary trees included in the updated forest are binary trees 3 and 4.

[0090] Step 570, if the updated forest includes more than one binary tree, continuing to perform the merging step based on the updated forest.

[0091] In this embodiment, if the execution subject determines that the number of binary trees included in the forest is greater than 1, step 540 is returned, and the merging step is continued.

[0092] Step 580: If only one binary tree is included in the updated forest, the binary tree is determined as the initial Huffman tree.

[0093] Step 590: Based on the preset data set, the initial Huffman tree is trained, the feature vectors of each non-leaf node in the initial Huffman tree are determined, and the trained Huffman tree is obtained.

[0094] Continue to take the example in step 520 as an example, when the forest includes binary trees 3 and 4, the merging step is continued, and binary trees 3 and 4 can be merged into binary tree 5, the weight of binary tree 5 is 1, and binary tree 5 is the initial Huffman tree. At this time, the initial Huffman tree includes nodes 1, 2, 3, 4 and 5, node 5 is the root node of the initial Huffman tree and is also a non-leaf node, 1, 2 and 3 are leaf nodes, and 4 is a non-leaf node. Among them, the feature vectors of nodes 4 and 5 are initial feature vectors, and then the execution subject can input the text data in the preset data set into the initial Huffman tree, take the intent label marked by the text data as the expected output, and adjust the feature vectors of nodes 4 and 5 to obtain the trained Huffman tree.

[0095] In this embodiment, the distribution of each intent in the preset data set is represented by the category proportion of the intent label, and the initial Huffman tree is constructed in this way. The initial Huffman tree is trained by the preset data set, so that the trained Huffman tree can learn the classification strategy of the intent label, thereby realizing the identification of the text intent by the Huffman tree.

[0096] Next, reference is made to Figure 6 , Figure 6 The flowchart of merging intent labels in one embodiment of the method for identifying intent of the present disclosure is shown in Figure 6 The method for identifying intent in the above embodiment can further include the following steps.

[0097] Step 610: In response to receiving the merging instruction of the intent label, a new intent label is generated based on at least two to-be-merged intent labels pointed by the merging instruction, and the intent label of the text data corresponding to the at least two to-be-merged intent labels in the preset data set is updated to the new intent label, to obtain the merged preset data set.

[0098] In practice, when the degree of difference between two or more intent labels is low, the two or more intent labels can be merged into a new intent label, so as to ensure a certain intent recognition accuracy and reduce the data amount of intent recognition.

[0099] As an example, after receiving the merging instruction, the execution subject can determine at least two to-be-merged intent labels and a new intent label after merging from the merging instruction. The new intent label can be any one of the at least two to-be-merged intent labels, or a brand new intent label different from the at least two to-be-merged intent labels. Then, the execution subject can re-label the text data in the preset data, and update the intent label of the text data labeled with the to-be-merged intent label to the new intent label.

[0100] Step 620, determining at least two to-be-merged leaf nodes corresponding to the at least two to-be-merged intent labels in the Huffman tree.

[0101] Step 630, determining the leaf node with the highest weight value in the at least two to-be-merged leaf nodes as the reference leaf node.

[0102] The reference leaf node is used to represent the new intent label.

[0103] In this embodiment, after determining the new intent label in step 610, the execution subject can determine the embedding vector of the new intent label, and then take the embedding vector as the feature vector of the reference leaf node.

[0104] Step 640, determining the sum of the weights of the at least two to-be-merged leaf nodes as the weight of the reference leaf node, and deleting the to-be-merged leaf nodes other than the reference leaf node from the Huffman tree.

[0105] Step 650, updating the connection relationship of each node in the branch with the parent node of the reference leaf node as the branch root node and the weight of the non-leaf node based on the construction strategy of the Huffman tree, to obtain an updated branch.

[0106] In this embodiment, the branch with the parent node of the reference leaf node as the branch root node represents a branch formed by nodes with weights less than the weight of the parent node of the reference leaf node in the Huffman tree. The connection relationship represents the parent-child relationship between two nodes, and the weight of the non-leaf node is the sum of the weights of the child nodes of the non-leaf node.

[0107] In one specific example, after the execution subject deletes the leaf nodes to be merged other than the reference leaf node, the execution subject can first determine the branch to be updated according to the weight of the parent node of the reference leaf node. Then, the non-leaf nodes in the branch to be updated are deleted to obtain the leaf nodes to be updated. Subsequently, according to the construction strategy of the Huffman tree, based on the two nodes with the smallest weights, a new node is generated, and the weight of the new node is the sum of the weights of the two nodes. Then, the two nodes with the smallest weights are selected from the new node and the remaining nodes, and a new node is generated again until only the reference leaf node and a new node are left. The reference leaf node and the new node can be connected as two child nodes of the parent node of the reference leaf node to obtain the updated branch.

[0108] Step 660, based on the merged data set, training the updated branch to determine the feature vector of each non-leaf node in the updated branch, and obtaining the Huffman tree after merging the intent labels.

[0109] In this embodiment, the feature vectors of the non-leaf nodes in the updated branch obtained in step 650 are initial vectors. The feature vectors of the non-leaf nodes can be adjusted by training, so that the updated branch can learn the recognition strategy of the intent labels included in the branch, thereby ensuring that the Huffman tree after merging the intent labels can recognize the intent of the text data based on the new intent label and other old intent labels.

[0110] Further combining Fig. 7, the process shown in Fig. 7 is exemplarily described. Figure 6 The Huffman tree before merging the intent labels is shown in Fig. 7(a). 720 and 730 are leaf nodes K and N to be merged, and the weights of K and N are 0.4 and 0.05, respectively. 710 is the parent node G of node K, and the weight of G is 0.6. Since the weight of node K is greater than that of node N, the execution subject can take node K as the reference leaf node and merge the weight of node N into node K. At this time, the branch to be updated includes nodes G, K, L, and M, wherein L is a non-leaf node and can be directly deleted. The nodes to be updated include nodes G, K, and M. Then, the execution subject can determine the updated branch according to the construction rule of the Huffman tree, taking the reference leaf node and node M as the child nodes of node G. The Huffman tree after node merging is shown in Fig. 7(b), wherein 740 is the merged node P, and the weight of P is the sum of the weights of nodes K and N. The updated branch includes nodes G, P, and M. Subsequently, the execution subject can train the updated branch based on the data set after merging the intent labels to determine the feature vector of node G, and obtain the Huffman tree after merging the intent labels.

[0111] In the embodiment, the merging of the intent labels can be mapped to the merging of nodes in the Huffman tree, and the updating of the intent recognition model can be completed by retraining the branches involved in the merging of the nodes, which can effectively reduce the data operation amount and time consumption in the merging of the intent labels, and further reduce the cost of merging the intent labels.

[0112] Reference is then made to Figure 8 , Figure 8 A flowchart of the process of splitting an intent label in one embodiment of the method for identifying an intent of the present disclosure is shown in FIG. 8, which comprises the following steps: Figure 8

[0113] Step 810: In response to receiving the splitting instruction of the intent label, determining the node to be split in the Huffman tree corresponding to the intent label to be split, and generating at least two new intent labels based on the splitting instruction.

[0114] In practice, in order to refine the granularity of intent recognition, one old intent label can be split into two or more new intent labels.

[0115] Step 820: Based on the at least two new intent labels, updating the intent labels of the text data in the preset data set marked with the intent label to be split to obtain a split preset data set, and determining the class proportion of each of the at least two new intent labels in the split preset data set.

[0116] As an example, if the splitting instruction received by the execution subject is to split the intent label 6 into intent labels 7, 8 and 9 according to a preset splitting strategy, the execution subject can determine the intent label 6 as the intent label to be split, and generate new intent labels 7, 8 and 9. Then, the execution subject can update the intent labels of the text data in the preset data set marked with the intent label 6 to the intent labels 7, 8 or 9 according to the preset splitting strategy. The split preset data set is obtained, and the class proportions of the intent labels 7, 8 and 9 are determined respectively.

[0117] Step 830: Generating at least two new leaf nodes in the Huffman tree, and the weights of the at least two new leaf nodes are the class proportions of the at least two new intent labels in the split preset data set.

[0118] The at least two new leaf nodes are used to represent the at least two new intent labels.

[0119] In the embodiment, the feature vector of the new leaf node is the embedding vector of the new intent label.

[0120] ​At step 840, based on the construction strategy of the Huffman tree, at least two new leaf nodes are taken as child nodes of the to-be-split node, and a new branch with the to-be-split node as the branch root node is constructed in the Huffman tree.

[0121] In this embodiment, the new branch represents the connection relationship between the at least two new leaf nodes and the to-be-split node.

[0122] Step 840 is exemplarily illustrated in combination with FIG. 9. The Huffman tree before splitting is shown in FIG. 9(a), where 910 is the to-be-split node, and the splitting instruction is to split the intent label represented by the node S into three new intent labels. The execution subject can generate three new nodes U, W, and X according to the embedding vectors and category proportions of the three new intent labels, and the weights of the three new nodes U, W, and X are 0.25, 0.12, and 0.08 respectively. Then, the execution subject can generate a new node V based on the nodes W and X according to the construction strategy of the Huffman tree, the weight of the node V is the sum of the weights of the nodes W and X, and then the nodes U and V are taken as the child nodes of the node S, so that the construction of the new branch is completed. The Huffman tree after splitting is shown in FIG. 9(b), where 920, 940, and 950 are the new nodes U, W, and X respectively, 930 is the new node V generated based on the nodes W and X, and the new branch includes the nodes U, V, W, and X.

[0123] At step 850, the new branch is trained based on the preset data set after splitting, the feature vectors of the non-leaf nodes in the new branch are determined, and the Huffman tree after splitting of the intent label is obtained.

[0124] In this embodiment, the feature vectors of the non-leaf nodes in the new branch obtained by the execution subject at step 840 are initial vectors. The new branch can be trained based on the preset data set after splitting to determine the feature vectors of the non-leaf nodes in the new branch, so that the new branch can learn the classification strategy based on the new intent label and the old intent label.

[0125] In this embodiment, the process of splitting the intent label can be mapped into the construction process of the new branch in the Huffman tree, and the update of the intent recognition model can be completed by only training the new branch again, which can effectively reduce the data operation amount and time consumption in the process of splitting the intent label, and further reduce the cost of splitting the intent label.

[0126] Reference is made next to Figure 10 , Figure 10 a schematic diagram of splitting an intent label in yet another embodiment of the method for identifying an intent of the present disclosure. In Figure 8 some optional implementations of the embodiment shown in FIG. 9, step 840 can further include Figure 10 the flow shown in FIG. 9, which includes the following steps.

[0127] Step 1010, if the number of at least two new leaf nodes is greater than 2, constructing a node set based on the at least two new leaf nodes.

[0128] The following will continue to illustrate the flow in conjunction with FIG. 9, and the node set can include nodes U, W, X. Then, the execution subject can execute the following branch construction step based on the node set.

[0129] Step 1020, determining two nodes with the smallest weights from the node set.

[0130] As an example, the execution subject can determine nodes W and X from the node set.

[0131] Step 1030, constructing a new node based on the two nodes.

[0132] The weight of the new node is the sum of the weights of the two nodes.

[0133] As an example, the execution subject can generate a new node V based on nodes W and X, and the feature vector of the new node V is the initial vector, and the weight is the sum of the weights of nodes W and X.

[0134] Step 1040, adding the new node to the node set, and deleting the two nodes from the node set to obtain an updated node set.

[0135] As an example, the updated node set includes nodes U and V.

[0136] Step 1050, if the number of nodes in the updated node set is greater than 2, executing the branch construction step based on the updated node set.

[0137] In this embodiment, if the execution subject detects that the number of nodes in the updated node set is greater than 2, it returns to step 1020.

[0138] Step 1060, if the number of nodes in the updated node set is not greater than 2, taking the two nodes as child nodes of the to-be-split node to obtain a new branch.

[0139] As an example, nodes U and V can be taken as child nodes of node S to obtain a new branch.

[0140] In this implementation, when the number of new intent labels is greater than 2, the intent label splitting process can be mapped to the construction process of the new branch based on the construction strategy of the Huffman tree, and the splitting efficiency of the intent label can be improved.

[0141] In Figure 8In some alternative implementations of the illustrated embodiments, step 840 may further include: if at least two new nodes include two new nodes, determining the two new nodes as child nodes of the node to be split, thereby obtaining a new branch.

[0142] In this implementation, when the newly added node consists of only two nodes, the newly added node can be directly identified as a child node of the node to be split to obtain a new branch, which can further improve the splitting efficiency of intent tags.

[0143] Exemplary Device

[0144] Next, refer to Figure 11 , Figure 11 This is a schematic diagram of one embodiment of the apparatus for identifying intent disclosed herein, as shown below. Figure 11 As shown, the device includes: a vector determination unit 1110, which determines the text vector of the text to be recognized; a node determination unit 1120, which is configured to input the text vector into a pre-trained Huffman tree and determine the target leaf node corresponding to the text vector in the Huffman tree, wherein the Huffman tree is constructed based on the distribution pattern of intent labels in a preset dataset; and an intent determination unit 1130, which is configured to determine the intent label represented by the target leaf node as the target intent label of the text to be recognized.

[0145] In this embodiment, the node determination unit 1120 further includes: a current node determination module, configured to determine the root node in the Huffman tree as the current node; and a classification module, configured to perform the following classification steps based on the current node: determining the product of the text vector and the feature vector of the current node; inputting the product into a pre-built classifier to determine the classification result of the current node; determining the target child node from the child nodes of the current node based on the classification result; if the target child node is a non-leaf node, updating the target child node as the current node and performing the classification steps again; and if the target child node is a leaf node, determining the leaf node as the target leaf node.

[0146] In this embodiment, the apparatus further comprises a Huffman tree construction unit configured to: obtain a preset data set, the preset data set comprising text data pre-labeled with intent labels; determine each intent label contained in the preset data set and a category proportion of each intent label, the category proportion being a ratio of a quantity of text data labeled with the intent label to a total quantity of text data in the preset data set; generate a binary tree comprising only one root node for each intent label, obtaining a forest comprising a plurality of binary trees, a weight of the root node of each binary tree being the category proportion of the intent label, and a feature vector of the root node of each binary tree being an embedding vector of the intent label; based on the forest, perform the following merging step: determine two binary trees with the smallest root node weights from the forest; generate a new binary tree based on the two binary trees, the left and right subtrees of the new binary tree being the two binary trees respectively, and the weight of the root node of the new binary tree being a sum of the weights of the root nodes of the left and right subtrees; add the new binary tree to the forest and delete the two binary trees from the forest, obtaining an updated forest; if the updated forest comprises more than one binary tree, continue to perform the merging step based on the updated forest; if the updated forest comprises only one binary tree, determine the binary tree as an initial Huffman tree; and train the initial Huffman tree based on the preset data set, determine feature vectors of non-leaf nodes in the initial Huffman tree, and obtain a trained Huffman tree.

[0147] In this embodiment, the apparatus further comprises a merging unit configured to: in response to receiving a merging instruction of an intent label, generate a new intent label based on at least two to-be-merged intent labels pointed to by the merging instruction, and update intent labels of text data in the preset data set corresponding to the at least two to-be-merged intent labels to the new intent label, obtaining a merged preset data set; determine at least two to-be-merged leaf nodes in the Huffman tree corresponding to the at least two to-be-merged intent labels; determine a leaf node with the highest weight among the at least two to-be-merged leaf nodes as a reference leaf node, the reference leaf node being used to represent the new intent label; determine a sum of the weights of the at least two to-be-merged leaf nodes as the weight of the reference leaf node, and delete the to-be-merged leaf nodes other than the reference leaf node from the Huffman tree; update connection relationships of nodes in a branch with a parent node of the reference leaf node as a branch root node and weights of non-leaf nodes based on a construction strategy of the Huffman tree, obtaining an updated branch; train the updated branch based on the merged data set, determine feature vectors of non-leaf nodes in the updated branch, and obtain a Huffman tree after merging of intent labels.

[0148] In this embodiment, the apparatus further includes a splitting unit configured to: in response to receiving a splitting instruction of the intent label, determine a to-be-split node corresponding to the intent label to be split in the Huffman tree, and generate at least two new intent labels based on the splitting instruction; update, based on the at least two new intent labels, the intent labels of the text data in the preset data set marked with the intent label to be split, to obtain a split preset data set, and determine a category proportion of each of the at least two new intent labels in the split preset data set; generate at least two new leaf nodes in the Huffman tree, the weight of the at least two new leaf nodes being the category proportion of each of the at least two new intent labels in the split preset data set, and the at least two new leaf nodes being used to represent the at least two new intent labels; based on a construction strategy of the Huffman tree, take the at least two new leaf nodes as child nodes of the to-be-split node, construct a new branch with the to-be-split node as a branch root node in the Huffman tree, and the new branch represents a connection relationship between the at least two new leaf nodes and the to-be-split node; and train the new branch based on the split preset data set, determine a feature vector of each non-leaf node in the new branch, and obtain a Huffman tree after splitting the intent label.

[0149] In this embodiment, the splitting unit is further configured to: if the number of the at least two new leaf nodes is greater than 2, construct a node set based on the at least two new leaf nodes; based on the node set, perform the following branch construction steps: determine two nodes with the smallest weights from the node set; construct a new node based on the two nodes, the weight of the new node being the sum of the weights of the two nodes; add the new node to the node set and delete the two nodes from the node set to obtain an updated node set; if the number of nodes in the updated node set is greater than 2, perform the branch construction steps based on the updated node set; and if the number of nodes in the updated node set is not greater than 2, take the two nodes as child nodes of the to-be-split node to obtain the new branch.

[0150] In this embodiment, the splitting unit is further configured to: if the at least two new nodes include two new nodes, determine the two new nodes as child nodes of the to-be-split node to obtain the new branch.

[0151] In addition, the embodiments of the present disclosure also provide an electronic device, including: a memory for storing a computer program; a processor for executing the computer program stored in the memory, and when the computer program is executed, the method for identifying an intent described in any of the embodiments of the present disclosure is implemented.

[0152] Figure 12 The structural schematic diagram of an application embodiment of the electronic device of the present disclosure is shown in the following figure. Figure 12An electronic device according to embodiments of the present disclosure will be described. The electronic device can be either one or both of the first and second devices, or a standalone device independent from them, which can communicate with the first and second devices to receive the acquired input signals therefrom.

[0153] As shown in Figure 12 The electronic device includes one or more processors and a memory.

[0154] The processor can be a central processing unit (CPU) or other form of processing unit having data processing and / or instruction execution capabilities, and can control other components in the electronic device to perform desired functions.

[0155] The memory can include one or more computer program products, which can include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory, for example, can include random access memory (RAM), cache, and / or the like. The non-volatile memory, for example, can include read-only memory (ROM), hard disk, flash memory, and / or the like. One or more computer program instructions can be stored on the computer-readable storage media, and the processor can execute the program instructions to implement the above-described method for recognizing an intent of various embodiments of the present disclosure and / or other desired functions.

[0156] In one example, the electronic device can further include input and output devices, which are interconnected through a bus system and / or other forms of connection mechanisms (not shown).

[0157] Further, the input device can include, for example, a keyboard, a mouse, and / or the like.

[0158] The output device can output various information, including the determined distance information, direction information, and / or the like, to the outside. The output device can include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, and / or the like.

[0159] Of course, for simplicity, Figure 12 In the drawings, only some of the components related to the present disclosure are shown in the electronic device, and components such as buses, input / output interfaces, and / or the like are omitted. In addition to this, the electronic device can include any other appropriate components according to a specific application.

[0160] In addition to the above-described method and device, embodiments of the present disclosure can be a computer program product including computer program instructions that, when executed by a processor, cause the processor to perform the steps of the above-described method for recognizing an intent according to various embodiments of the present disclosure described in the above-described part of the specification.

[0161] The computer program product can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C++, or the like, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device or entirely on the remote computing device or server. The embodiments of the present disclosure can be a computer program product, which can include a computer program tangibly embodied in a machine readable storage medium.

[0162] Moreover, an embodiment of the disclosure can also be a computer readable storage medium, having stored thereon a computer program instructing, when executed by a processor, the processor to perform the steps of the method for identifying an intention according to various embodiments of the disclosure described in the foregoing parts of the specification.

[0163] The computer readable storage medium can be any combination of one or more computer readable media. The computer readable medium can be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can include, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or apparatus, or any suitable combination of the above. More specific examples (a non-exhaustive list) of the computer readable storage medium include an electrical connection having one or more wires, a portable disc, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0164] Those skilled in the art can understand that all or part of the steps of the above-mentioned method embodiments can be completed by program instruction related hardware, and the aforementioned program can be stored in a computer readable storage medium, and the program executes the steps of the above-mentioned method embodiments when executed; and the aforementioned storage medium includes ROM, RAM, magnetic disc or optical disc and various storage medium that can store program code.

[0165] The above describes the basic principles of the disclosure in combination with specific embodiments, but it should be pointed out that the advantages, advantages, effects and the like mentioned in the disclosure are only examples and not limitations, and these advantages, advantages, effects and the like cannot be considered as the various embodiments of the disclosure must have. In addition, the above specific details are only for the purpose of example and for the purpose of understanding, and the above details do not limit the disclosure to the above specific details.

[0166] The various embodiments described in this specification are intended to be illustrative only and in no way limit the scope of the application. One skilled in the art will readily recognize from the disclosure herein, possible alternative techniques within the scope of the application. Accordingly, the examples are not to be regarded as limiting, but rather are to be understood to be illustrative of the possible aspects of the application. The various embodiments described in this specification are described in the context of a system. As such, the system embodiments are described in relatively greater detail than the method embodiments, with the understanding that the method embodiments are substantially analogous to the system embodiments.

[0167] The block diagrams of devices, apparatuses, equipment, systems referred to in this disclosure are merely illustrative examples and are not intended to require or imply that the connection, arrangement, configuration must be as shown in the block diagrams. These devices, apparatuses, equipment, systems can be connected, arranged, configured in any manner as will be appreciated by those skilled in the art. Words such as "include," "contain," "have," etc. are open-ended words that are to be interpreted to mean "including but not limited to," and are to be interpreted not to exclude items that do not match the description of the word. The words "or" and "and" as used herein are to be interpreted as the word "and / or," and are to be interpreted not to exclude items that do not match the description of the word. The word "such as" as used herein is to be interpreted as the phrase "such as but not limited to," and is to be interpreted not to exclude items that do not match the description of the word.

[0168] The methods and apparatuses of this disclosure can be implemented in a number of ways. For example, the methods and apparatuses of this disclosure can be implemented using software, hardware, firmware, or any combination of these methods and apparatuses. The order of any steps described above is merely exemplary and the steps of the methods of this disclosure need not be performed in the order described unless otherwise specified. Furthermore, in some embodiments, the methods of this disclosure can also be implemented as a program for use with a computer-based system, the program including a machine-readable instruction for implementing the methods according to this disclosure. Thus, the disclosure also covers record media storing the program for implementing the methods according to this disclosure.

[0169] It is also to be noted that in the apparatuses, equipment and methods of this disclosure, the components or steps can be decomposed and / or recombined. These decompositions and / or recombinations are to be considered as equivalents of this disclosure.

[0170] The above description of disclosed aspects is intended to be illustrative only and not limiting of the scope of the application. Various modifications to these aspects will be readily apparent to those skilled in the art, and the generic principles defined herein can be applied to other aspects without departing from the scope of the disclosure. Thus, the present disclosure is not intended to be limited to the aspects shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

[0171] The foregoing description has been presented for the purposes of illustration and description. Furthermore, the description is not intended to limit the embodiments of the disclosure to the forms disclosed herein. Although the various example aspects and embodiments have been described herein with regard to particular aspects and embodiments, those skilled in the art will recognize that certain modifications, changes, substitutions, additions and sub-combinations can be made without departing from the spirit of the disclosure.

Claims

1. A method for identifying an intent, the method comprising: The method comprises: determining a text vector of the text to be identified; inputting the text vector into a pre-trained Huffman tree to determine a target leaf node corresponding to the text vector in the Huffman tree, the Huffman tree being constructed based on the distribution of intent labels in a preset data set, the leaf nodes in the Huffman tree corresponding one-to-one to the preset intent labels, the merging process of the intent labels being mapped to the merging process of the nodes in the Huffman tree, and the splitting process of the intent labels being mapped to the construction process of new branches in the Huffman tree; determining the intent label represented by the target leaf node as the target intent label of the text to be identified; inputting the text vector into a pre-constructed Huffman tree to determine a target leaf node corresponding to the text vector in the Huffman tree, comprising: determining the root node in the Huffman tree as a current node; based on the current node, performing the following classification steps: determining the product of the text vector and the feature vector of the current node; inputting the product into a pre-constructed classifier to determine the classification result of the current node; and based on the classification result, determining a target child node from the child nodes of the current node; if the target child node is a non-leaf node, updating the target child node as the current node and performing the classification steps again; if the target child node is a leaf node, determining the leaf node as the target leaf node.

2. The method of claim 1, wherein, The Huffman tree is constructed via the following steps: obtaining the preset data set, the preset data set comprising text data pre-labeled with intent labels; determining each intent label included in the preset data set and the category proportion of each intent label, the category proportion being the ratio of the number of text data labeled with the intent label to the total number of text data in the preset data set; generating a binary tree comprising only one root node for each intent label to obtain a forest comprising a plurality of binary trees, the weight of the root node of the binary tree being the category proportion of the intent label, and the feature vector of the root node of the binary tree being the embedding vector of the intent label; based on the forest, performing the following merging steps: determining two binary trees with the smallest root node weights from the forest; generating a new binary tree based on the two binary trees, the left and right child trees of the new binary tree being the two binary trees, and the weight of the root node of the new binary tree being the sum of the weights of the root nodes of the left and right child trees; adding the new binary tree to the forest and deleting the two binary trees from the forest to obtain an updated forest; if the updated forest comprises more than one binary tree, continuing to perform the merging steps based on the updated forest; if the updated forest comprises only one binary tree, determining the binary tree as an initial Huffman tree; training the initial Huffman tree based on the preset data set to determine the feature vectors of the non-leaf nodes in the initial Huffman tree, thereby obtaining a trained Huffman tree.

3. The method according to one of claims 1 to 2, characterized in that, The method further comprises: In response to receiving the merging instruction of the intent label, a new intent label is generated based on at least two intent labels to be merged pointed by the merging instruction, and an intent label of text data corresponding to the at least two intent labels to be merged in the preset data set is updated to the new intent label, to obtain a merged preset data set; At least two leaf nodes to be merged corresponding to the at least two intent labels to be merged in the Huffman tree are determined; The leaf node with the highest weight value among the at least two leaf nodes to be merged is determined as a reference leaf node, and the reference leaf node is used to represent the new intent label; The sum of the weight values of the at least two leaf nodes to be merged is determined as the weight value of the reference leaf node, and the leaf nodes to be merged other than the reference leaf node are deleted from the Huffman tree; Based on the construction strategy of the Huffman tree, the connection relationship between nodes in a branch with the parent node of the reference leaf node as a branch root node and the weight values of non-leaf nodes are updated to obtain an updated branch. Based on the merged preset data set, the updated branch is trained to determine the feature vectors of the non-leaf nodes in the updated branch, to obtain a Huffman tree after merging intent labels.

4. The method according to one of claims 1 to 2, characterized in that, The method further comprises: In response to receiving a splitting instruction of an intent label, a node to be split corresponding to the intent label to be split in the Huffman tree is determined, and at least two new intent labels are generated based on the splitting instruction; Based on the at least two new intent labels, intent labels of text data marked with the intent label to be split in the preset data set are updated to obtain a split preset data set, and a category proportion of each of the at least two new intent labels in the split preset data set is determined; At least two new leaf nodes are generated in the Huffman tree, the weight values of the at least two new leaf nodes are the category proportions of the at least two new intent labels in the split preset data set, and the at least two new leaf nodes are used to represent the at least two new intent labels; Based on the construction strategy of the Huffman tree, the at least two new leaf nodes are taken as child nodes of the node to be split to construct a new branch with the node to be split as a branch root node in the Huffman tree; Based on the split preset data set, the new branch is trained to determine the feature vectors of the non-leaf nodes in the new branch, to obtain a Huffman tree after splitting intent labels.

5. The method of claim 4, wherein, Based on the construction strategy of the Huffman tree, the at least two new leaf nodes are taken as child nodes of the node to be split to construct a new branch with the node to be split as a branch root node in the Huffman tree, comprising: If the number of the at least two new leaf nodes is greater than 2, a node set is constructed based on the at least two new leaf nodes; Based on the node set, perform the following branch construction step: determine two nodes with minimum weights from the node set; construct a new node based on the two nodes, the weight of the new node being the sum of the weights of the two nodes; add the new node to the node set and delete the two nodes from the node set to obtain an updated node set; if the number of nodes in the updated node set is greater than 2, perform the branch construction step based on the updated node set; if the number of nodes in the updated node set is not greater than 2, take the two nodes as child nodes of the to-be-split node to obtain the new branch.

6. The method of claim 4, wherein, Based on the construction strategy of the Huffman tree, the at least two new leaf nodes are taken as child nodes of the to-be-split node to construct a new branch with the to-be-split node as a root node in the Huffman tree, including: If the number of the at least two new leaf nodes is 2, the two new leaf nodes are determined as child nodes of the to-be-split node to obtain the new branch.

7. An electronic device, comprising: Including: a memory for storing a computer program; a processor for executing the computer program stored in the memory, and when the computer program is executed, the method of any one of claims 1-6 is implemented.

8. A computer-readable storage medium having stored thereon a computer program, characterized in that When the computer program is executed by the processor, the method of any one of claims 1-6 is implemented.

9. A computer program product comprising computer programs / instructions, characterized in that, When the computer program / instruction is executed by the processor, the method of any one of claims 1-6 is implemented.

Citation Information

Patent Citations

  • A software information site quick label recommendation method based on neural network classification

    CN109446414A

  • Intention recognition method and device under multi-scene application, equipment and storage medium

    CN111460829A

  • Word vector training method and device

    CN111859945A

  • Data compression coding processing method and equipment

    CN112886967A