Intention recognition method and device, electronic equipment and storage medium
By using hierarchical dependency parsing logic and semantic anchor-guided keyword extraction, a target intent path is generated, which solves the semantic similarity problem of intent recognition in existing technologies and achieves a clear and complete expression of intent recognition results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-08
- Publication Date
- 2026-04-17
AI Technical Summary
In existing technologies, because multiple sub-intents under the same parent node have high semantic similarity, it is difficult to achieve fine-grained and accurate differentiation between multiple sub-intents, resulting in the propagation of hierarchical structure errors.
By using hierarchical parsing logic and semantic anchor-guided keyword extraction, and utilizing historical intent tags as semantic anchors, keywords are extracted from a predefined mapping table. The target intent path is then generated through a target algorithm, ensuring the semantic relevance and accuracy of intent recognition.
It improves the clarity and completeness of intent recognition results, ensures the hierarchical logical consistency of intent expression, and enhances the semantic relevance and recognition accuracy of multi-level intent tags.
Smart Images

Figure CN121882240A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence, and more particularly to an intent recognition method and apparatus, electronic device and storage medium. Background Technology
[0002] With the rapid development of artificial intelligence and natural language processing technologies, human-computer interaction scenarios such as intelligent customer service, dialogue systems, and voice assistants are becoming increasingly popular. The hierarchical characteristics of user intent are becoming more and more prominent, and the demand for structured, logical, and fine-grained distinction of intent recognition continues to increase.
[0003] In related technologies, a pipeline approach is used to achieve hierarchical intent recognition; however, because multiple sub-intents under the same parent node have high semantic similarity, it is difficult to achieve fine-grained and accurate differentiation between multiple sub-intents, which in turn causes errors to propagate along the hierarchical structure. Summary of the Invention
[0004] This disclosure provides an intent recognition method, apparatus, electronic device, and storage medium to solve problems in related technologies. By using hierarchical parsing logic and keyword extraction guided by semantic anchors, the semantic relevance and accuracy of multi-level intent tags are ensured. The target intent path is generated based on historical intent tags and keywords, so that the intent recognition results have clear hierarchical logic and improve the completeness of intent expression.
[0005] According to a first aspect of this disclosure, an intent recognition method is provided, comprising: The received raw text is parsed layer by layer to obtain multi-level intent tags corresponding to the raw text; wherein, the intent tag of each level is the parsing result of the previous adjacent level; Historical intent tags are identified as semantic anchors, and keywords of the original text are extracted based on the semantic anchors; wherein, the historical intent tags are intent tags of the previous level, and the previous level is at least any level before the current level; Based on the historical intent tags and the keywords, a target intent path corresponding to the original text is generated; wherein, the target intent path is composed of intent tags at each level.
[0006] In some embodiments of this disclosure, determining historical intent tags as semantic anchors and extracting keywords from the original text based on the semantic anchors includes: The prior intent tags are determined as the semantic anchors, and the association between the historical intent tags and the keywords is extracted from the predefined mapping table. Using the semantic anchor as an index, a set of corresponding candidate keywords is matched from the association, and keywords in the original text that match the set of candidate keywords are selected from the original text.
[0007] In some embodiments of this disclosure, generating the target intent path corresponding to the original text based on the historical intent tags and the keywords includes: The historical intent tags and the keywords are input into the target algorithm for prediction to obtain the target intent tags corresponding to the target level. All intent tags are integrated in hierarchical order to obtain the target intent path; wherein, all intent tags include the historical intent tags and the target intent tag.
[0008] In some embodiments of this disclosure, the step of inputting the historical intent tags and the keywords into the target algorithm for prediction to obtain the target intent tags corresponding to the target level includes: Contextual data is constructed based on the historical intent tags and the keywords, and the contextual data is processed by word segmentation to obtain the smallest text unit; The smallest text unit is encoded to obtain the original embedding matrix; The smallest text unit corresponding to the keyword in the original embedding matrix is masked to obtain a masked embedding matrix. The target intent label corresponding to the target level is obtained by predicting the original embedding matrix and the mask embedding matrix.
[0009] In some embodiments of this disclosure, the step of predicting the original embedding matrix and the mask embedding matrix to obtain the target intent label corresponding to the target level includes: The original embedding matrix and the mask embedding matrix are input into the matrix processing layer in the preset model for processing to obtain the original inference score corresponding to the original embedding matrix and the mask inference score corresponding to the mask embedding matrix. Calculate the difference between the original inference score and the masked inference score, and add the difference to the original inference score to obtain the comprehensive inference score; wherein, the difference is used to characterize the degree of contribution of the historical intent tag and the keyword to the inference result; The comprehensive reasoning score is input into the score prediction layer in the preset model for prediction, and the target intent label corresponding to the target level is obtained.
[0010] In some embodiments of this disclosure, the step of parsing the received raw text layer by layer to obtain multi-level intent tags corresponding to the raw text includes: The original text is encapsulated using a preset prompt template to obtain the encapsulated original text; Based on the encapsulated original text, intent tags corresponding to each level are generated in a predefined hierarchical order.
[0011] According to a second aspect of this disclosure, an intent recognition device is provided, comprising: The parsing unit is used to parse the received raw text layer by layer to obtain multi-level intent tags corresponding to the raw text; wherein, the intent tag of each level is the parsing result of the previous adjacent level; The unit determines historical intent tags as semantic anchors and extracts keywords from the original text based on the semantic anchors; wherein, the historical intent tags are intent tags of the previous level, and the previous level is at least any level before the current level; The generation unit generates a target intent path corresponding to the original text based on the historical intent tags and the keywords; wherein the target intent path is composed of intent tags at each level.
[0012] In some embodiments of this disclosure, the determining unit includes: The extraction module is used to determine the prior level intent tags as the semantic anchors and extract the association between the historical intent tags and the keywords from a predefined mapping table; The matching module is used to match the corresponding set of candidate keywords from the association relationship using the semantic anchor as an index, and to filter out the keywords of the original text that match the set of candidate keywords from the original text.
[0013] In some embodiments of this disclosure, the generation unit includes: The prediction module is used to input the historical intent tags and the keywords into the target algorithm for prediction, so as to obtain the target intent tags corresponding to the target level; An integration module is used to integrate all intent tags in hierarchical order to obtain the target intent path; wherein, all intent tags include the historical intent tags and the target intent tag.
[0014] In some embodiments of this disclosure, the prediction module includes: The first processing submodule is used to construct context data based on the historical intent tags and the keywords, and to process the context data through word segmentation to obtain the smallest text unit; The second processing submodule is used to encode the smallest text unit to obtain the original embedding matrix. The third processing submodule is used to perform masking processing on the smallest text unit corresponding to the keyword in the original embedding matrix to obtain a masking embedding matrix. The prediction submodule is used to predict the original embedding matrix and the mask embedding matrix to obtain the target intent label corresponding to the target level.
[0015] In some embodiments of this disclosure, the prediction submodule is further configured to: The original embedding matrix and the mask embedding matrix are input into the matrix processing layer in the preset model for processing to obtain the original inference score corresponding to the original embedding matrix and the mask inference score corresponding to the mask embedding matrix. Calculate the difference between the original inference score and the masked inference score, and add the difference to the original inference score to obtain the comprehensive inference score; wherein, the difference is used to characterize the degree of contribution of the historical intent tag and the keyword to the inference result; The comprehensive reasoning score is input into the score prediction layer in the preset model for prediction, and the target intent label corresponding to the target level is obtained.
[0016] In some embodiments of this disclosure, the parsing unit includes: The encapsulation module is used to encapsulate the original text using a preset prompt template to obtain the encapsulated original text. The generation module is used to generate intent tags for each level based on the encapsulated original text, in a predefined hierarchical order.
[0017] According to a third aspect of this disclosure, an electronic device is provided, comprising: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect embodiment.
[0018] According to a fourth aspect of this disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are configured to cause the computer to perform the method described in the first aspect of the present disclosure.
[0019] According to a fifth aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the method described in the first aspect of the preceding embodiments.
[0020] In summary, the intent recognition method, apparatus, electronic device, and storage medium provided in this disclosure include: parsing the received raw text layer by layer to obtain multi-level intent tags corresponding to the raw text; wherein, the intent tag of each level is the parsing result of the previous adjacent level; determining historical intent tags as semantic anchors, and extracting keywords from the raw text based on the semantic anchors; wherein, historical intent tags are intent tags of previous levels, and previous levels are at least any level before the current level; generating a target intent path corresponding to the raw text based on historical intent tags and keywords; wherein, the target intent path is composed of intent tags of each level; through hierarchical parsing logic and keyword extraction guided by semantic anchors, the semantic relevance and accuracy of multi-level intent tags are ensured, and the target intent path is generated based on historical intent tags and keywords, so that the intent recognition result has a clear hierarchical logic and improves the completeness of intent expression.
[0021] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description
[0022] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein: Figure 1 This is a flowchart illustrating an intent recognition method provided in an embodiment of the present disclosure; Figure 2 A flowchart illustrating another intent recognition method provided in an embodiment of this disclosure; Figure 3 A flowchart illustrating another intent recognition method provided in an embodiment of this disclosure; Figure 4 A flowchart illustrating another intent recognition method provided in an embodiment of this disclosure; Figure 5 A flowchart illustrating another intent recognition method provided in an embodiment of this disclosure; Figure 6 A flowchart illustrating another intent recognition method provided in an embodiment of this disclosure; Figure 7 A schematic diagram of an intent prediction process provided in an embodiment of this disclosure; Figure 8 This is a schematic diagram of the structure of an intent recognition device provided in an embodiment of the present disclosure; Figure 9 This is a schematic diagram of another intent recognition device provided in an embodiment of the present disclosure; Figure 10 A schematic block diagram of an example electronic device provided for embodiments of this disclosure. Detailed Implementation
[0023] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0024] The intent recognition method, apparatus, electronic device, and storage medium of embodiments of the present disclosure are described below with reference to the accompanying drawings.
[0025] Figure 1 This is a flowchart illustrating an intent recognition method provided in an embodiment of the present disclosure.
[0026] like Figure 1 As shown, the method includes the following steps: Step 101: The received original text is parsed layer by layer to obtain multi-level intent tags corresponding to the original text; wherein, the intent tag of each level is the parsing result of the previous adjacent level.
[0027] In some embodiments, the original text refers to the natural language information input by the user, and the multi-level intent tags refer to a set of tags divided according to a preset level and having a semantic hierarchy. The preset level division is determined based on a preset intent system. During the layer-by-layer parsing process, the parsing of the next level needs to be based on the intent tags already generated in the previous adjacent level. The parsing action only revolves around the original text and the intent tags of the previous adjacent level, without introducing other additional reference information. The termination condition of the parsing is the completion of the generation of the preset lowest level intent tags or the satisfaction of the preset termination rule. The triggering method of layer-by-layer parsing is that the parsing of the current level is automatically started after the intent tags of the previous adjacent level are generated.
[0028] The parsing process is constrained by the previous adjacent level intent tag, ensuring that the semantic direction of each level intent tag remains consistent. This ensures the semantic coherence of multi-level intent tags and allows each level tag to form a progressively refined logical relationship.
[0029] Step 102: Determine the historical intent tags as semantic anchors, and extract keywords from the original text based on the semantic anchors; wherein, the historical intent tags are intent tags of the previous level, and the previous level is at least any level before the current level.
[0030] In some embodiments, historical intent tags refer to all or part of the prior hierarchical intent tags that have been parsed, and semantic anchors refer to the benchmarks used to limit the semantic scope of keyword extraction. Semantic anchors ensure that the extracted keywords maintain a semantic connection with the clearly defined historical intent. Keywords refer to words in the original text that are directly related to historical intent tags. When extracting keywords, the semantics of historical intent tags are used as the basis for judgment, and words that fit the semantic scope are selected from the original text. The selection process relies on the semantic connection between historical intent tags and the original text, without relying on additional feature selection rules.
[0031] Using the above method, the scope of keyword extraction is limited by historical intent tags, avoiding deviation from the existing intent direction, improving the semantic matching degree between keywords and historical intent tags, and ensuring that the extracted keywords can provide accurate semantic support for intent-related processing.
[0032] Step 103: Generate the target intent path corresponding to the original text based on the historical intent tags and the keywords; wherein the target intent path is composed of intent tags at each level.
[0033] In some embodiments, the target intent path refers to a structured sequence formed by integrating all generated hierarchical intent tags in the hierarchical order in which they were generated. The integration process follows the generation logic of each level of intent tag, without modifying or re-parsing the intent tags, and only based on the hierarchical relationship of historical intent tags and the semantic reference of keywords, to ensure that the integrated target intent path can fully reflect the hierarchical structure of the original text's intent.
[0034] Using the above methods, the hierarchical logic of historical intent tags and the semantic orientation of keywords jointly ensure the accuracy of path integration, enabling the target intent path to fully present all levels of intent in the original text and clearly reflect the hierarchical relationship of each intent tag.
[0035] In summary, the intent recognition method provided in this disclosure includes: parsing the received raw text layer by layer to obtain multi-level intent tags corresponding to the raw text; each level's intent tag is the parsing result of the previous adjacent level; determining historical intent tags as semantic anchors, and extracting keywords from the raw text based on the semantic anchors; historical intent tags are intent tags of previous levels, and previous levels are at least any level before the current level; generating a target intent path corresponding to the raw text based on historical intent tags and keywords; the target intent path is composed of intent tags at each level; through hierarchical parsing logic and keyword extraction guided by semantic anchors, the semantic relevance and accuracy of multi-level intent tags are ensured; generating a target intent path based on historical intent tags and keywords gives the intent recognition result a clear hierarchical logic and improves the completeness of intent expression.
[0036] Figure 2 This is a flowchart illustrating an intent recognition method provided in an embodiment of the present disclosure, as shown below. Figure 2 As shown, a further explanation of step 102 includes: Step 201: Determine the prior level intent tag as the semantic anchor point, and extract the association relationship between the historical intent tag and the keyword from the predefined mapping table.
[0037] In some embodiments, prior-level intent tags, i.e., historical intent tags, which are the prior-level intent tags that have been parsed, are determined as semantic anchors. These semantic anchors establish a semantic benchmark for keyword extraction, ensuring that the extraction direction remains consistent with the clearly defined historical intent tags. A predefined mapping table stores the corresponding associations between historical intent tags and keywords. These associations are established through business scenario analysis and data accumulation, covering the keywords corresponding to different historical intent tags in practical applications. The predefined mapping table can be dynamically updated as actual business scenarios expand, ensuring that the associations fit actual needs. For historical intent tags with ambiguity, distinguishing features can be marked in the predefined mapping table to avoid semantic deviations in keyword extraction.
[0038] Step 202: Using the semantic anchor as an index, match the corresponding set of candidate keywords from the association relationship, and filter out the keywords of the original text that match the set of candidate keywords from the original text.
[0039] In some embodiments, using semantic anchors as indexes involves directly using historical intent tags as query conditions to locate the relationships in a predefined mapping table, thereby obtaining a set of candidate keywords. The original text is then filtered to extract content that semantically matches words in the candidate keyword set, which is then used as keywords for the original text. Semantic similarity calculation can be introduced during the filtering process. When there are no completely matching words in the original text, words with similarity higher than a preset threshold are included as keywords.
[0040] Using the above method, keyword extraction uses historical intent tags as semantic anchors and relies on a predefined mapping table to lock in the association relationship, ensuring that the extracted keywords are highly related to historical intent tags, avoiding interference from redundant information, and providing accurate support for target intent tag prediction.
[0041] Figure 3 This is a flowchart illustrating an intent recognition method provided in an embodiment of the present disclosure, as shown below. Figure 3 As shown, a further explanation of step 103 includes: Step 301: Input the historical intent tags and the keywords into the target algorithm for prediction to obtain the target intent tags corresponding to the target level.
[0042] In some embodiments, historical intent tags provide a clear semantic basis for the algorithm, while keywords provide semantic clues to the original text. Both historical intent tags and keywords are used as input to ensure that the target intent tags generated by the target algorithm (such as Selective Prompt Anchoring (SPA)) are semantically consistent with the historical intent tags. When inputting, historical intent tags and keywords can be encapsulated into contextual data in a preset format to clarify the correspondence between the two.
[0043] Step 302: Integrate all intent tags in hierarchical order to obtain the target intent path; wherein, all intent tags include the historical intent tags and the target intent tag.
[0044] The hierarchical order is a progressive sequence from high to low levels, consistent with the generation order of historical intent tags and target intent tags. The integration process concatenates historical intent tags and target intent tags in hierarchical order to form a structured sequence containing intent tags at each level, i.e., the target intent path, without adding any other redundant information. Semantic verification can be added during integration to determine the correlation between intent tags at adjacent levels, eliminate conflicting tags, and return for recalculation. The intent tags at each level constitute the target intent path. For example, the hierarchical order is Step1 (Level-1): {High-level intent}, Step2 (Level-2): {Middle-level intent}, ..., StepN (Level-N): {Lower-level intent}. It should be noted that the above examples are for illustrative purposes only and do not limit the specific content.
[0045] Using the above method, the generation of target intent tags is constrained by historical intent tags and keywords. The hierarchical order integration ensures the structure of the target intent path and follows the generation logic of the target intent path, so that the final result can clearly present the hierarchical intent relationship of the original text.
[0046] Figure 4 This is a flowchart illustrating an intent recognition method provided in an embodiment of the present disclosure, as shown below. Figure 4 As shown, a further explanation of step 301 includes: Step 401: Construct context data based on the historical intent tags and the keywords, and then process the context data through word segmentation to obtain the smallest text unit.
[0047] In some embodiments, contextual data is composed of historical intent tags and keywords, which is a data format that the target algorithm can process; word segmentation is to decompose continuous contextual data into the smallest text units that can be recognized by a preset model (such as a Large Language Model (LLM)). The smallest text unit contains complete semantic information of historical intent tags and keywords; word segmentation uses tools adapted to the preset model to ensure that the smallest text unit meets the model input requirements. For multilingual original text, the tool can automatically match word segmentation rules.
[0048] Step 402: Encode the smallest text unit to obtain the original embedding matrix.
[0049] In some embodiments, encoding is the process of converting the smallest text unit into a numerical vector, which carries this numerical information through the original embedding matrix. The original embedding matrix fully preserves the semantic association and sequence features of the smallest text unit. The dimension of the encoding process can be adjusted according to the parameters of the preset model. At the same time, positional encoding is introduced to incorporate the sequence information of the smallest text unit, ensuring the semantic integrity of the original embedding matrix. The adjustment method does not change the properties of the matrix.
[0050] Step 403: Mask the smallest text unit corresponding to the keyword in the original embedding matrix to obtain a mask embedding matrix.
[0051] In some embodiments, the masking process is performed on the smallest text unit corresponding to the keyword in the original embedding matrix. By deleting or replacing the vector corresponding to this part with a preset special vector, the semantic influence of the keyword is isolated. This masking process makes the masked embedding matrix and the original embedding matrix differ only in the position corresponding to the keyword. The scope of the masking process can be extended to the smallest text unit corresponding to the historical intent tag. By simultaneously isolating the semantic influence of the historical intent tag and the keyword, the combined effect of the two on the reasoning result is more comprehensively quantified. The masking position is accurately located through matrix indexing to ensure the targeted nature of the operation.
[0052] Step 404: Predict the original embedding matrix and the mask embedding matrix to obtain the target intent label corresponding to the target level.
[0053] By inputting the original embedding matrix and the masked embedding matrix into the preset model for inference, we can obtain the original inference result containing the semantic influence of keywords and the masked inference result that isolates the semantic influence. By comparing the difference between the original inference result and the masked inference result, we can quantify the role of keywords and historical intent in inference. After adjusting the inference weight based on this difference, we can generate target intent labels corresponding to the target level, ensuring the coherence between the target intent labels and the historical intent labels and their matching with the original text requirements.
[0054] Using the above method, from constructing contextual data to predicting labels, each step revolves around historical intent labels and keywords. Through word segmentation, encoding, masking, and other processing, textual information is transformed into a form that the model can process efficiently, enabling the target algorithm to accurately focus on semantics and improve the prediction accuracy of target intent labels.
[0055] Figure 5 This is a flowchart illustrating an intent recognition method provided in an embodiment of the present disclosure, as shown below. Figure 5 As shown, a further explanation of step 404 includes: Step 501: Input the original embedding matrix and the mask embedding matrix into the matrix processing layer in the preset model for processing to obtain the original inference score corresponding to the original embedding matrix and the mask inference score corresponding to the mask embedding matrix.
[0056] In some embodiments, the matrix processing layer is a module in the preset model responsible for feature extraction and preliminary inference. The original inference score and the masked inference score are the results of the model output based on the two matrices, corresponding to the prediction tendency of including and masking keywords.
[0057] Step 502: Calculate the difference between the original inference score and the masked inference score, and add the difference to the original inference score to obtain the comprehensive inference score; wherein, the difference is used to characterize the degree of contribution of the historical intent tag and the keyword to the inference result.
[0058] In some embodiments, the difference calculation is achieved through element-level subtraction. The difference is added to the original inference score, which superimposes the semantic contribution of historical intent tags and keywords into the original inference to obtain a more accurate comprehensive inference score.
[0059] Step 503: Input the comprehensive reasoning score into the score prediction layer in the preset model for prediction to obtain the target intent label corresponding to the target level.
[0060] In some embodiments, the score prediction layer transforms the comprehensive reasoning score into a normalized probability distribution, selects the result with the highest probability as the target intent label, and the target intent label will be used as the historical intent label for subsequent layers.
[0061] By using the above methods, the semantic contribution of historical intent tags and keywords is quantified and superimposed on the reasoning process, thereby improving the prediction accuracy of target intent tags.
[0062] Figure 6 This is a flowchart illustrating an intent recognition method provided in an embodiment of the present disclosure, as shown below. Figure 6 As shown, a further explanation of step 101 includes: Step 601: Encapsulate the original text using a preset prompt template to obtain the encapsulated original text.
[0063] In some embodiments, the preset prompt template includes intent-level parsing requirements, output format specifications, and reasoning guidance. Encapsulation involves filling the original text with the template format, combining the original text with the guidance information, and providing a clear parsing direction for the preset model.
[0064] Step 602: Based on the encapsulated original text, generate intent tags corresponding to each level according to a predefined hierarchical order.
[0065] In some embodiments, the predefined hierarchical order is a refinement order from high level to low level. During the generation process, the preset model first parses the high-level intent tags, and then generates subsequent level intent tags based on the intent tags of the previous adjacent level, ensuring that the intent tags of each level are the parsing results of the previous adjacent level.
[0066] Using the above method, the preset prompt template provides the model with a clear parsing direction and format specification, and the predefined hierarchical order ensures the logical coherence of intent tag generation, resulting in structured multi-level intent tags.
[0067] To clearly illustrate the embodiments of this disclosure, Figure 7 This is a schematic diagram of an intent prediction process provided as an embodiment of the present disclosure, representing one possible implementation of the embodiments of the present disclosure, such as... Figure 7 As shown, the process revolves around attention guidance based on historical intent tags and keywords: First, based on the historical dialogues corresponding to the historical intent tags and keywords extracted from the original text, a prompt word is constructed in conjunction with the predicted intent hints, which serves as the input guidance information. Then, word segmentation is performed on the text corresponding to the prompt word to obtain the smallest text units. These smallest text units are then encoded and arranged in order to form the original embedding matrix. Next, masking processing is performed on the smallest text units corresponding to the keywords in the original embedding matrix, replacing the corresponding vectors to obtain the masked embedding matrix. The original embedding matrix and the masked embedding matrix are input into the target algorithm for processing, yielding the original inference score and the masked inference score. The difference between the two is then calculated, representing the contribution of historical intent tags and keywords to the inference result. This difference is multiplied by a preset anchoring strength to amplify the influence weight of semantic information, and then added to the original inference score to obtain the comprehensive inference score. Finally, sampling is performed based on this comprehensive inference score to generate the target intent tag corresponding to the target level. This achieves attention focus on historical intent tags and keywords, ensuring a high correlation between the target intent tag and semantic information.
[0068] The present disclosure of embodiments may also have the following beneficial effects: 1. Improve path consistency: By forcing the model to replay and anchor historical intent tags at each inference step, the generation of illegal intent paths is eliminated, ensuring the logical rationality of the output results.
[0069] 2. Improve recognition accuracy: The dynamic alignment mechanism enables the model to accurately focus on evidence supporting the current decision, effectively alleviating the confusion between fine-grained intents, and especially improving the recognition performance of long-tail intents with sparse data.
[0070] 3. No model training required: It executes at inference time, does not depend on fine-tuning of a specific model or additional training data, has versatility and deployment flexibility, and can be applied to various closed-source or open-source large language models.
[0071] Corresponding to the intent recognition method described above, this invention also proposes an intent recognition device. Since the device embodiments of this invention correspond to the method embodiments described above, details not disclosed in the device embodiments can be referred to in the method embodiments described above, and will not be repeated here.
[0072] Figure 8 This is a schematic diagram of the structure of an intent recognition device provided in an embodiment of this disclosure, as shown below. Figure 8 As shown, it includes: parsing unit 81, determining unit 82, and generating unit 83.
[0073] The parsing unit 81 is used to parse the received raw text layer by layer to obtain multi-level intent tags corresponding to the raw text; wherein, the intent tag of each level is the parsing result of the previous adjacent level; The determining unit 82 determines the historical intent tag as a semantic anchor point and extracts keywords from the original text based on the semantic anchor point; wherein, the historical intent tag is the intent tag of the previous level, and the previous level is at least any level before the current level; The generation unit 83 generates a target intent path corresponding to the original text based on the historical intent tags and the keywords; wherein the target intent path is composed of intent tags at each level.
[0074] In summary, the intent recognition device provided in this disclosure includes: parsing the received raw text layer by layer to obtain multi-level intent tags corresponding to the raw text; wherein, the intent tag of each level is the parsing result of the previous adjacent level; determining historical intent tags as semantic anchors, and extracting keywords from the raw text based on the semantic anchors; wherein, the historical intent tags are intent tags of the previous level, and the previous level is at least any level before the current level; generating a target intent path corresponding to the raw text based on the historical intent tags and keywords; wherein, the target intent path is composed of intent tags of each level; through hierarchical parsing logic and keyword extraction guided by semantic anchors, the semantic relevance and accuracy of multi-level intent tags are ensured, and the target intent path is generated based on historical intent tags and keywords, so that the intent recognition result has a clear hierarchical logic and improves the completeness of intent expression.
[0075] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 9 As shown, the determining unit 82 includes: Extraction module 821 is used to determine the prior level intent tag as the semantic anchor point and extract the association relationship between the historical intent tag and the keyword from a predefined mapping table; The matching module 822 is used to match the corresponding set of candidate keywords from the association relationship using the semantic anchor as an index, and to filter out the keywords of the original text that match the set of candidate keywords from the original text.
[0076] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 9 As shown, the generation unit 83 includes: Prediction module 831 is used to input the historical intent tags and the keywords into the target algorithm for prediction, and obtain the target intent tags corresponding to the target level; The integration module 832 is used to integrate all intent tags in hierarchical order to obtain the target intent path; wherein, all intent tags include the historical intent tags and the target intent tags.
[0077] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 9 As shown, the prediction module 831 includes: The first processing submodule 8311 is used to construct context data based on the historical intent tags and the keywords, and to process the context data through word segmentation to obtain the smallest text unit; The second processing submodule 8312 is used to encode the smallest text unit to obtain the original embedding matrix. The third processing submodule 8313 is used to perform masking processing on the smallest text unit corresponding to the keyword in the original embedding matrix to obtain a masking embedding matrix. The prediction submodule 8314 is used to predict the original embedding matrix and the mask embedding matrix to obtain the target intent label corresponding to the target level.
[0078] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 9 As shown, the prediction submodule 8314 is further used for: The original embedding matrix and the mask embedding matrix are input into the matrix processing layer in the preset model for processing to obtain the original inference score corresponding to the original embedding matrix and the mask inference score corresponding to the mask embedding matrix. Calculate the difference between the original inference score and the masked inference score, and add the difference to the original inference score to obtain the comprehensive inference score; wherein, the difference is used to characterize the degree of contribution of the historical intent tag and the keyword to the inference result; The comprehensive reasoning score is input into the score prediction layer in the preset model for prediction, and the target intent label corresponding to the target level is obtained.
[0079] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 9 As shown, the parsing unit 81 includes: The encapsulation module 811 is used to encapsulate the original text using a preset prompt template to obtain the encapsulated original text. The generation module 812 is used to generate intent tags corresponding to each level based on the encapsulated original text and in a predefined hierarchical order.
[0080] It should be noted that the foregoing explanation of the method embodiments also applies to the apparatus of the embodiments of this disclosure, and the principle is the same. Therefore, the embodiments of this disclosure are not limited thereto.
[0081] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0082] Figure 10A schematic block diagram of an example electronic device 900 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0083] like Figure 10 As shown, the electronic device 900 includes a computing unit 901, which can perform various appropriate actions and processes based on a computer program stored in ROM (Read-Only Memory) 902 or loaded from storage unit 908 into RAM (Random Access Memory) 903. The RAM 903 can also store various programs and data required for the operation of the electronic device 900. The computing unit 901, ROM 902, and RAM 903 are interconnected via bus 904. An I / O (Input / Output) interface 905 is also connected to bus 904.
[0084] Multiple components in electronic device 900 are connected to I / O interface 905, including: input unit 906, such as keyboard, mouse, etc.; output unit 907, such as various types of displays, speakers, etc.; storage unit 908, such as disk, optical disk, etc.; and communication unit 909, such as network card, modem, wireless transceiver, etc. Communication unit 909 allows electronic device 900 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0085] The computing unit 901 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, CPUs (Central Processing Units), GPUs (Graphics Processing Units), various special-purpose AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, DSPs (Digital Signal Processors), and any suitable processor, controller, microcontroller, etc. The computing unit 901 performs the various methods and processes described above, such as intent recognition methods. For example, in some embodiments, the intent recognition method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 908. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 900 via ROM 902 and / or communication unit 909. When the computer program is loaded into RAM 903 and executed by the computing unit 901, one or more steps of the methods described above may be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to perform the aforementioned intent recognition method by any other suitable means (e.g., by means of firmware).
[0086] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application-Specific Standard Products), SOCs (System-on-Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0087] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0088] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0089] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0090] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include LANs (Local Area Networks), WANs (Wide Area Networks), the Internet, and blockchain networks.
[0091] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service system that addresses the shortcomings of traditional physical hosts and VPS (Virtual Private Server) services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers incorporating blockchain technology.
[0092] It's important to note that artificial intelligence (AI) is the study of enabling computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, and planning). It encompasses both hardware and software technologies. AI hardware technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, and big data processing. AI software technologies primarily include computer vision, speech recognition, natural language processing, machine learning / deep learning, big data processing, and knowledge graph technologies.
[0093] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0094] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. An intent recognition method, characterized in that, The method includes: The received raw text is parsed layer by layer to obtain multi-level intent tags corresponding to the raw text; wherein, the intent tag of each level is the parsing result of the previous adjacent level; Historical intent tags are identified as semantic anchors, and keywords of the original text are extracted based on the semantic anchors; wherein, the historical intent tags are intent tags of the previous level, and the previous level is at least any level before the current level; Based on the historical intent tags and the keywords, a target intent path corresponding to the original text is generated; wherein, the target intent path is composed of intent tags at each level.
2. The method according to claim 1, characterized in that, The step of identifying historical intent tags as semantic anchors and extracting keywords from the original text based on these semantic anchors includes: The prior intent tags are determined as the semantic anchors, and the association between the historical intent tags and the keywords is extracted from the predefined mapping table. Using the semantic anchor as an index, a set of corresponding candidate keywords is matched from the association, and keywords in the original text that match the set of candidate keywords are selected from the original text.
3. The method according to claim 1, characterized in that, The step of generating the target intent path corresponding to the original text based on the historical intent tags and the keywords includes: The historical intent tags and the keywords are input into the target algorithm for prediction to obtain the target intent tags corresponding to the target level. All intent tags are integrated in hierarchical order to obtain the target intent path; wherein, all intent tags include the historical intent tags and the target intent tag.
4. The method according to claim 3, characterized in that, The step of inputting the historical intent tags and the keywords into the target algorithm for prediction to obtain the target intent tags corresponding to the target level includes: Contextual data is constructed based on the historical intent tags and the keywords, and the contextual data is processed by word segmentation to obtain the smallest text unit; The smallest text unit is encoded to obtain the original embedding matrix; The smallest text unit corresponding to the keyword in the original embedding matrix is masked to obtain a masked embedding matrix. The target intent label corresponding to the target level is obtained by predicting the original embedding matrix and the mask embedding matrix.
5. The method according to claim 4, characterized in that, The step of predicting the original embedding matrix and the mask embedding matrix to obtain the target intent label corresponding to the target level includes: The original embedding matrix and the mask embedding matrix are input into the matrix processing layer in the preset model for processing to obtain the original inference score corresponding to the original embedding matrix and the mask inference score corresponding to the mask embedding matrix. Calculate the difference between the original inference score and the masked inference score, and add the difference to the original inference score to obtain the comprehensive inference score; wherein, the difference is used to characterize the degree of contribution of the historical intent tag and the keyword to the inference result; The comprehensive reasoning score is input into the score prediction layer in the preset model for prediction, and the target intent label corresponding to the target level is obtained.
6. The method according to claim 1, characterized in that, The step of parsing the received raw text layer by layer to obtain the multi-level intent tags corresponding to the raw text includes: The original text is encapsulated using a preset prompt template to obtain the encapsulated original text; Based on the encapsulated original text, intent tags corresponding to each level are generated in a predefined hierarchical order.
7. An intent recognition device, characterized in that, include: The parsing unit is used to parse the received raw text layer by layer to obtain multi-level intent tags corresponding to the raw text; wherein, the intent tag of each level is the parsing result of the previous adjacent level; The unit determines historical intent tags as semantic anchors and extracts keywords from the original text based on the semantic anchors; wherein, the historical intent tags are intent tags of the previous level, and the previous level is at least any level before the current level; The generation unit generates a target intent path corresponding to the original text based on the historical intent tags and the keywords; wherein the target intent path is composed of intent tags at each level.
8. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-6.
9. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-6.
10. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method according to any one of claims 1-6.