Question intent determination method and electronic device
By employing a pre-defined rule set and confidence evaluation based on embedded vector neighbor vector category labels in dense multilingual corpora, the problem of low accuracy in intent discrimination is solved, thereby improving the accuracy and stability of intent recognition.
Patent Information
- Application Number
- CN202611560717.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-09
- Publication Date
- 2026-11-27
AI Technical Summary
In the case of dense multilingual corpora, the pure semantic nearest neighbor retrieval technology in the present technology has low accuracy in intent judgment and is prone to boundary drift due to incomplete consideration of factors.
Structured intent matching is performed using a pre-defined first rule set. The neighbor vector category labels of the embedded vector and confidence evaluation are combined. The intent category is determined through ordered rule hard interception and near nearest neighbor semantic voting mechanism. In the case of low confidence, a regular fallback rule is triggered to ensure the accuracy and stability of intent determination.
It improves the accuracy and robustness of intent recognition, reduces system resource consumption, and enhances the accuracy of intent discrimination and system stability under dense multilingual corpora.
Smart Images

Figure CN123180179A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and more specifically, to a method and electronic device for determining the intent of a question. Background Technology
[0002] Intent routing is a crucial step in natural language interaction systems, its core being the accurate determination of the user's intent in a question to distribute it to the corresponding downstream processing branch. In scenarios with limited computing power, such as edge devices, intent recognition solutions in related technologies suffer from the following drawbacks: First, many solutions rely on neural models for inference, resulting in high online latency, high computational overhead, and difficulty in cold-starting, making it hard to meet low-latency requirements. Second, some solutions use text embedding combined with Artificial Neural Network (ANN) retrieval. However, when processing dense multilingual corpora such as bilingual (Chinese / English) and colloquial sentences, the highly dense vector space makes pure semantic nearest neighbor retrieval prone to boundary drift. This leads to structured intents, such as numbers and device lists, which could be accurately determined, being incorrectly included in the data query category, causing misjudgments. Furthermore, related solutions often fail to consider all factors, such as the lack of consideration for cases with low confidence in the retrieval results, leading to unstable intent routing results. In summary, pure semantic nearest neighbor retrieval in related technologies does not take into account all factors in dense multilingual corpora, is prone to boundary drift, and leads to low accuracy in intent discrimination.
[0003] There is currently no effective solution to the above problems. Summary of the Invention
[0004] This invention provides a method and electronic device for determining the intent of a question, which at least solves the technical problem in related technologies that pure semantic nearest neighbor retrieval does not consider all factors in dense multilingual corpora, is prone to boundary drift, and results in low accuracy of intent determination.
[0005] According to one aspect of the present invention, a method for determining the intent of a question is provided, comprising: performing intent category matching on a natural language question based on a preset first rule set, wherein the preset first rule set includes ordered matching rules pre-defined for structured intents or high-reliability intents, and high-reliability intents are intents with a preset reliability greater than a preset reliability threshold; when there is no intent category matching the natural language question in the preset first rule set, determining multiple neighbor vectors corresponding to the embedding vector of the natural language question, and category labels corresponding to each of the multiple neighbor vectors, wherein the embedding vector is obtained by performing an embedding encoding on the natural language question; determining a voting intent category from multiple candidate intent categories based on the category labels corresponding to each of the multiple neighbor vectors, and determining the confidence level of the voting intent category, wherein the confidence level is used to indicate the degree of credibility of the relative weight of the voting intent category among the multiple neighbor vectors; and determining, based on the confidence level, whether to use the voting intent category as the target intent of the natural language question, or to obtain the target intent by performing intent category matching on the natural language question based on a preset second rule set, wherein the preset second rule set includes regular expressions pre-defined for unstructured text features or general keywords.
[0006] Optionally, based on the category labels corresponding to each of the multiple neighbor vectors, the voting intent category is determined from multiple candidate intent categories. This includes: determining the similarity of each of the multiple neighbor vectors, where the similarity is obtained based on the cosine distance between the corresponding neighbor vector and the embedding vector; determining the category score of each of the multiple candidate intent categories based on the similarity of each of the multiple neighbor vectors and according to the category labels corresponding to each of the multiple neighbor vectors; and determining the voting intent category from multiple candidate intent categories based on the category scores corresponding to each of the multiple candidate intent categories. By setting up a system that cannot be covered by the rule set, and utilizing the local similarity features of the semantic space, the precise definition of intent boundaries under multilingual and dense corpora is achieved, effectively improving the robustness and accuracy of intent determination.
[0007] Optionally, based on the similarity of multiple neighbor vectors, and according to the category labels of the multiple neighbor vectors, the category scores of multiple candidate intent categories are determined. This includes: for any intent category among the multiple candidate intent categories, determining the neighbor vectors associated with that intent category based on the category labels of the multiple neighbor vectors; using the sum of the similarities of the associated neighbor vectors as the category score of that intent category; and obtaining the category scores of multiple candidate intent categories using the same method as obtaining the category score of that intent category. Using the sum of the similarities of associated neighbor vectors to characterize the confidence level of candidate intents, compared to single voting or simple averaging, this mechanism can more objectively reflect the distribution density and support of each category in the semantic space, effectively avoiding misjudgments caused by individual noise points, and significantly improving the accuracy and robustness of determining the voting intent category.
[0008] Optionally, based on the category scores corresponding to each of the multiple candidate intent categories, a voting intent category is determined from the multiple candidate intent categories, including: determining the intent category with the highest category score among the multiple candidate intent categories; and determining the intent category with the highest category score as the voting intent category. By selecting the intent with the highest category score from multiple candidate intent categories as the voting intent category, the selected intent is ensured to have the highest comprehensive confidence in the semantic space. Compared with the coarse judgment that relies solely on label frequency, this scheme improves the accuracy of intent determination, especially when dealing with dense multilingual corpora, enabling more accurate identification of the user's true intent and reducing the risk of misjudgment caused by boundary drift.
[0009] Optionally, determining the confidence level of the voting intent category includes: summing the similarities of each of the multiple neighbor vectors to obtain the total similarity; and determining the confidence level as the ratio of the category score of the voting intent category to the total similarity. By quantifying the degree of clustering of voting intent in the neighbor set, the confidence level can objectively reflect the reliability of the intent as a target intent, providing a precise numerical basis for subsequent selection of directly adopting the voting intent or triggering the preset second rule set based on the confidence level, effectively improving the certainty of intent determination in low-confidence scenarios.
[0010] Optionally, based on the confidence level, it is determined whether to use the voting intent category as the target intent of the natural language question, or to obtain the target intent by performing intent category matching on the natural language question based on a preset second rule set. This includes: determining whether the confidence level is greater than or equal to a preset confidence threshold; if the confidence level is greater than or equal to the preset confidence threshold, determining the voting intent category as the target intent; if the confidence level is less than the preset confidence threshold, performing intent category matching on the natural language question based on the preset second rule set to obtain the target intent. This approach retains the generalization advantage of embedding vectors in dense multilingual corpora while avoiding misjudgments of intent due to low confidence, ensuring the accuracy of intent determination results and the stability of system operation.
[0011] Optionally, the natural language question is matched for intent categories based on a preset second rule set to obtain the target intent. This includes: performing regular expression matching on the natural language question based on the preset second rule set to determine whether a matching intent category exists; if a matching intent category exists, the matching intent category is determined as the target intent; if no matching intent category exists, the target intent is determined as a predetermined general category. This effectively solves the problem of low-confidence questions lacking a clear endpoint when secondary matching fails, achieving completeness and determinism in intent routing, and avoiding downstream service call failures due to missing intents.
[0012] Optionally, multiple neighbor vectors corresponding to the embedding vector of a natural language question are determined, including: retrieving multiple neighbor vectors from the vector index corresponding to the few-sample labeled example set based on a pre-set approximate nearest neighbor index. The approximate nearest neighbor index is obtained by embedding and encoding multiple examples included in the few-sample labeled example set, and then using the encoded vectors corresponding to each example. This approach avoids the computational redundancy caused by full-scale searching in a large general corpus, while ensuring that the obtained neighbor vectors all have clear manually labeled category tags. This makes the determination of voting intent category and confidence assessment based on these neighbor vectors more accurate and reliable, effectively improving the accuracy and execution efficiency of intent determination in few-sample scenarios.
[0013] According to another aspect of the present invention, a non-volatile storage medium is also provided, which stores a plurality of instructions adapted for a question intent determination method, any one of which is loaded by a processor.
[0014] According to another aspect of the present invention, an electronic device is also provided, including one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement any one of the question intent determination methods.
[0015] According to another aspect of the present invention, a computer program product is also provided, including a computer program that, when executed by a processor, implements the steps of any one of the question intent determination methods.
[0016] In this embodiment of the invention, intent category matching is performed on natural language questions based on a preset first rule set. The preset first rule set includes ordered matching rules for structured intents or high-reliability intents, where a high-reliability intent is an intent with a preset reliability greater than a preset reliability threshold. If no intent category matches the natural language question in the preset first rule set, multiple neighbor vectors corresponding to the embedding vector of the natural language question, and category labels corresponding to each of the neighbor vectors, are determined. The embedding vector is obtained by performing a single embedding encoding on the natural language question. Based on the category labels corresponding to each of the neighbor vectors, a voting intent category is determined from multiple candidate intent categories, and the confidence level of the voting intent category is determined. The confidence level indicates the voting intent category's position in the market. The confidence level of the relative weights among multiple neighbor vectors is assessed. Based on the confidence level, it is determined whether to use the voted intent category as the target intent of the natural language question, or to obtain the target intent by matching the intent category of the natural language question based on a preset second rule set. The preset second rule set includes regular expressions for unstructured text features or general keywords. This achieves the goal of constructing a hierarchical hybrid judgment framework of "ordered rule hard interception - approximate nearest neighbor semantic voting gating - regular expression fallback" to accurately identify intent. This achieves the technical effects of improving the accuracy of intent recognition, reducing system resource consumption, and enhancing system robustness. It also solves the technical problem in related technologies where pure semantic nearest neighbor retrieval does not consider all factors in dense multilingual corpora, is prone to boundary drift, and leads to low accuracy in intent judgment. Attached Figure Description
[0017] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:
[0018] Figure 1 This is a flowchart of a method for determining the intent of a question according to an embodiment of the present invention;
[0019] Figure 2 This is a flowchart of an optional question intent determination method according to an embodiment of the present invention;
[0020] Figure 3 This is a schematic diagram of an optional system architecture according to an embodiment of the present invention;
[0021] Figure 4This is a schematic diagram of a question intent determination device according to an embodiment of the present invention;
[0022] Figure 5 This is a schematic diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0023] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0024] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0025] According to an embodiment of the present invention, a method embodiment for determining the intent of a question is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0026] Figure 1 This is a flowchart of a question intent determination method according to an embodiment of the present invention, such as... Figure 1 As shown, the method includes the following steps:
[0027] Step S102: Based on the preset first rule set, perform intent category matching on natural language questions. The preset first rule set includes ordered matching rules for structured intents or high-reliability intents. High-reliability intents are intents with a preset reliability greater than a preset reliability threshold.
[0028] In this step, a pre-defined first rule set is first used to match the intent categories of natural language questions. This rule set is specifically designed for structured intents or intent categories with high reliability, and the matching rules are arranged in a specific order. By comparing the input questions one by one according to this ordered rule set, intent categories with clear structural features or highly definite decision logic can be quickly identified and classified. This allows for accurate interception and classification of high-reliability intents without the need for complex semantic computation.
[0029] Optionally, the natural language question in this embodiment can be a bilingual (Chinese and English) natural language question, and the intent category can include, but is not limited to, at least one of data query, knowledge explanation, fault statistics, number explanation, equipment list, and general fallback. The preset first rule set (or ordered rule set) is sorted from high to low according to the predictability reliability of the category, and the higher priority rule is matched first and preemptively judged.
[0030] Step S104: If there is no intent category matching the natural language question in the preset first rule set, determine the multiple neighbor vectors corresponding to the embedding vector of the natural language question, and the category labels corresponding to each of the multiple neighbor vectors. The embedding vector is obtained by performing an embedding encoding on the natural language question.
[0031] In this step, it is first determined that there is no intent category matching the natural language question in the preset first rule set. This serves as a prerequisite for subsequent semantic retrieval; that is, when the rule-based hard interception mechanism fails to directly determine the intent, the process transitions to a vectorized semantic analysis flow. Subsequently, the natural language question undergoes embedding encoding to generate an embedding vector that represents the semantic features of the question. Based on this embedding vector, multiple neighbor vectors are determined in the index space, and the category labels associated with each of these neighbor vectors are extracted, providing direct data support for subsequent semantic voting and intent determination based on neighbor samples.
[0032] In one optional embodiment, determining multiple neighbor vectors corresponding to the embedding vector of a natural language question includes: retrieving multiple neighbor vectors from the vector index corresponding to the few-sample labeled example set based on a preset approximate nearest neighbor index, wherein the approximate nearest neighbor index is obtained by embedding and encoding multiple examples included in the few-sample labeled example set, and based on the encoded vectors corresponding to the multiple examples obtained.
[0033] In this embodiment, by introducing a "pre-built approximate nearest neighbor index" and a "vector index corresponding to a small sample labeled example set," the specific data source and retrieval path for obtaining neighbor vectors are clarified. The approximate nearest neighbor index is not an arbitrarily generated vector database, but rather a lightweight retrieval structure specifically built for a small number of labeled samples. Specifically, this index is created by embedding and encoding multiple examples from the small sample labeled example set, transforming these examples into vectors in a high-dimensional space, and establishing an index mapping relationship. This allows for direct similarity matching and retrieval of multiple neighbor vectors in the subsequent retrieval of embedded vectors for natural language questions, based on this index space constructed from real business samples. This mechanism avoids the computational redundancy of full-scale retrieval in a large general corpus, while ensuring that the obtained neighbor vectors all have clear manually labeled category tags. This makes the determination of voting intent categories and confidence assessment based on these neighbor vectors more accurate and reliable, effectively improving the accuracy and execution efficiency of intent determination in small sample scenarios.
[0034] Optionally, the total number of examples included in the few-sample labeled example set is less than a predetermined number (e.g., 500 or 1000).
[0035] In an optional embodiment, the method further includes: determining the content hash value of the few-sample labeled example set; when a change in the content hash value is detected, re-encoding the multiple examples to obtain new encoded vectors corresponding to each of the multiple examples; and obtaining a new approximate nearest neighbor index based on the new encoded vectors corresponding to each of the multiple examples.
[0036] In this embodiment, determining the content hash value of the few-sample labeled example set refers to calculating the text data stored in the set using a hash algorithm to generate a digital fingerprint that uniquely identifies the current data state. This hash value can sensitively reflect minor changes in the content of the set. When a change in the content hash value is detected, it means that the underlying data such as example text, tags, or order in the few-sample labeled example set has been updated, such as added, deleted, or modified. At this time, the system triggers a dynamic maintenance mechanism to re-embed and encode the updated multiple examples, obtaining new encoded vectors corresponding to each of the multiple examples that reflect the new data characteristics. Based on these new encoded vectors, the approximate nearest neighbor index is reconstructed or updated. Obtaining a new approximate nearest neighbor index based on the new encoded vectors corresponding to the multiple examples means using the newly encoded vector data to recalculate the spatial distance relationship between vectors and establish an index structure to ensure that the index is consistent with the latest data state. By adopting the above steps and introducing a change detection and automatic index refresh mechanism based on content hash values, dynamic synchronization between the few-sample labeled example set and the near nearest neighbor index is achieved. This avoids problems such as lag in search results, intent matching deviation, or index failure caused by updates to the example library, and ensures the real-time performance, accuracy, and robustness of intent determination services in few-sample scenarios.
[0037] Step S106: Based on the category labels corresponding to each of the multiple neighbor vectors, determine the voting intent category from the multiple candidate intent categories, and determine the confidence level of the voting intent category, wherein the confidence level is used to indicate the degree of credibility of the relative weight of the voting intent category in the multiple neighbor vectors.
[0038] In this step, candidate target intentions can be filtered and statistically analyzed by utilizing the category labels associated with multiple neighbor vectors retrieved from the near nearest neighbor index, thereby identifying the intention with the highest number of votes as the final voting intention category. Furthermore, the confidence level of this voting intention category can be quantitatively calculated based on the contribution ratio or similarity weight distribution of these neighbor vectors during the voting process. This confidence level directly reflects the relative weight and reliability of the voting intention category in the overall neighbor voting results, providing a quantitative basis for whether to adopt the intention or trigger a fallback mechanism.
[0039] In one optional embodiment, determining the voting intent category from multiple candidate intent categories based on the category labels corresponding to each of the multiple neighbor vectors includes: determining the similarity corresponding to each of the multiple neighbor vectors, wherein the similarity is obtained based on the cosine distance between the corresponding neighbor vector and the embedding vector; determining the category score corresponding to each of the multiple candidate intent categories based on the similarity corresponding to each of the multiple neighbor vectors and according to the category labels corresponding to each of the multiple neighbor vectors; and determining the voting intent category from the multiple candidate intent categories based on the category scores corresponding to each of the multiple candidate intent categories.
[0040] In this embodiment, a similarity calculation mechanism based on cosine distance is introduced to transform abstract semantic associations into quantifiable numerical indicators. Cosine distance measures the directional consistency between the natural language question embedding vector and multiple neighbor vectors in the vector database in the semantic space; the smaller the distance, the closer the semantics. Subsequently, this similarity is used as a weighting criterion to aggregate the similarity of neighbor vectors with the same category label, thereby calculating the category score corresponding to each candidate intent category. This process avoids the bias caused by simply counting or randomly matching neighbor labels, making the influence of neighbors with high contributions on the final intent determination greater. Finally, the intent category with the highest votes is directly locked as the voting intent based on the category scores. Thus, when the rule set cannot cover the entire scope, the local similarity features of the semantic space are used to accurately define the intent boundary under multilingual and dense corpora, effectively improving the robustness and accuracy of intent determination.
[0041] In one optional embodiment, based on the similarity of each of the multiple neighbor vectors, and according to the category labels of each of the multiple neighbor vectors, the category scores of each of the multiple candidate intent categories are determined, including: for any intent category among the multiple candidate intent categories, determining the neighbor vectors associated with any intent category according to the category labels of each of the multiple neighbor vectors; taking the sum of the similarities of each of the associated neighbor vectors as the category score of any intent category; and obtaining the category scores of each of the multiple candidate intent categories by using the method of obtaining the category score of any intent category.
[0042] In this embodiment, for any intent category among multiple candidate intent categories, the neighbor vectors associated with any intent category are determined based on the category labels corresponding to each of the multiple neighbor vectors. This means grouping neighbor vectors with the same semantic affiliation under the same intent category. For example, if intent category A corresponds to vectors v1, v3, and v5 in the neighbor vector library, then these three vectors are determined to be associated with intent category A. Subsequently, the sum of the similarities corresponding to the associated neighbor vectors is used as the category score of any intent category. This means that the final score of the intent category is the sum of the similarities of all its support vectors. The accumulated cosine similarity with the current question embedding vector, such as vectors v1, v3, and v5 having similarities of 0.9, 0.85, and 0.8 respectively, results in a category score of 2.55 for intent category A. This method, through accumulation, quantifies and aggregates semantic evidence scattered across multiple neighbor vectors, fully reflecting the support strength of the intent category within its local neighborhood. By obtaining the category score for any intent category, the category scores for multiple candidate intent categories are obtained. This aggregation and summation process is repeated for all intents in the candidate set, forming a complete score matrix. By using the accumulated similarity of associated neighbor vectors to characterize the confidence level of candidate intents, compared to single voting or simple averaging, this mechanism more objectively reflects the distribution density and support of each category in the semantic space, effectively avoiding misjudgments caused by individual noise points, and significantly improving the accuracy and robustness of determining the voted intent category.
[0043] Optionally, but not limited to, the similarity between any one of the multiple neighbor vectors can be obtained in the following ways: Where k is the total number of neighbor vectors retrieved, and m is the index of any neighbor vector among the multiple neighbor vectors. Let be the cosine distance between the natural language question and the vector of its m-th neighbor. This represents the corresponding similarity score.
[0044] The category score for any intent category can be obtained as follows: ;in, Let be the class label of the m-th neighbor vector, and y be any candidate intent class. The aggregate score (i.e., category score) for candidate intent category y.
[0045] In one optional embodiment, determining the voting intent category from multiple candidate intent categories based on their respective category scores includes: determining the intent category with the highest category score among the multiple candidate intent categories; and determining the intent category with the highest category score as the voting intent category.
[0046] In this embodiment, by introducing a feature based on cosine distance to calculate similarity, the geometric distance between the neighbor vector and the current question embedding vector is transformed into a specific numerical similarity index. The cosine distance is used to measure the consistency of two vectors in spatial direction, and the smaller the distance, the closer the semantics. Subsequently, based on this similarity, a weighted aggregation is performed according to category labels, so that the neighbor vectors that are closer to the current question and have a better semantic match contribute more to the corresponding category score. This realizes the transformation from simple "label counting" to "similarity-weighted voting", effectively avoiding the voting intent bias caused by ignoring the difference in the proximity of neighbors. Finally, by selecting the intent with the highest category score from multiple candidate intent categories as the voting intent category, it is ensured that the selected intent has the highest comprehensive confidence in the semantic space. Compared with the coarse judgment that only relies on the frequency of labels, this scheme improves the accuracy of intent determination. Especially when dealing with dense multilingual corpora, it can more accurately identify the user's true intent and reduce the risk of misjudgment caused by boundary drift.
[0047] As an optional embodiment, the voting intent category is determined from multiple candidate intent categories based on their respective category scores, including: determining a specified intent category among the multiple candidate intent categories whose category score is greater than a preset score threshold; if there is only one specified intent category, using that specified intent category as the voting intent category; or if there are multiple specified intent categories, determining the number of neighbor vectors associated with the specified intent category; determining a first weight corresponding to the category score and a second weight corresponding to the number of associated neighbor vectors; performing a weighted summation operation based on the category scores, the number of associated neighbor vectors, the first weight, and the second weight of each of the multiple specified intent categories to obtain a weighted score for each of the multiple specified intent categories; and determining the specified intent category with the highest weighted score among the multiple specified intent categories as the voting intent category.
[0048] In this embodiment, when multiple intent categories (i.e., designated intent categories) with scores higher than a preset threshold are identified through the neighbor vector voting mechanism, it means that there are multiple highly similar competing candidates. Directly selecting a single highest-scoring category may lack robustness due to the small score difference. By statistically analyzing the number of neighbor vectors associated with each designated intent category, the "voting density" or support frequency of that category in the vector space is quantified. The category score reflects single-point similarity, while the number of neighbor vectors reflects overall clustering. Subsequently, a first weight (corresponding to the category score) and a second weight (corresponding to the number of neighbor vectors) are introduced, and a weighted sum is performed. This aims to comprehensively consider both "single-point matching quality" and "group support scale." For example, when two intent scores are similar, the intent with more associated neighbors and a more concentrated distribution will receive a higher weighted score. Finally, the designated intent category with the highest weighted score is determined as the voting intent category. This multi-dimensional weight fusion mechanism effectively solves the decision ambiguity problem when multiple high-scoring candidate intents compete, improves the accuracy and certainty of intent determination, and avoids the risk of misjudgment due to the limitations of a single similarity indicator.
[0049] In one optional embodiment, determining the confidence level of the voting intent category includes: summing the similarities corresponding to each of the multiple neighbor vectors to obtain the total similarity; and determining the ratio of the category score of the voting intent category to the total similarity as the confidence level.
[0050] In this embodiment, the total similarity is obtained by summing the similarities of multiple neighbor vectors. This involves accumulating the cosine similarity values between the embedding vector of the natural language question and all neighboring sample vectors retrieved in the vector space, and the embedding vector of the question. This constructs a benchmark quantity that reflects the overall neighbor distribution density in the current query context. The confidence level is determined by the ratio of the category score of the voting intent to the total similarity. This is achieved by normalizing the sum of the similarities of all neighbor vectors belonging to the same candidate intent (i.e., the category score of the intent) using the total similarity as the denominator. This process calculates the relative weight of the intent in the neighbor voting. This process intuitively quantifies the degree of clustering of the voting intent in the neighbor set, allowing the confidence level to objectively reflect the reliability of the intent as a target intent. This provides an accurate numerical basis for subsequent selection of directly adopting the voting intent or triggering the preset second rule set based on the confidence level, effectively improving the certainty of intent determination in low-confidence scenarios.
[0051] Step S108: Based on the confidence level, determine whether to use the voting intent category as the target intent of the natural language question, or to obtain the target intent by matching the intent category of the natural language question based on the preset second rule set, wherein the preset second rule set contains pre-defined regular expressions of unstructured text features or general keywords.
[0052] In this step, based on the calculated confidence level, the branch logic for intent determination is executed. For example, when the confidence level meets a preset condition, the intent category obtained through near-nearest neighbor voting in the previous step is directly established as the final target intent of the natural language question. When the confidence level does not meet the preset condition, a secondary matching mechanism based on a preset second rule set is triggered. This mechanism uses regular expressions pre-defined in this rule set for unstructured text features or general keywords to re-match the intent category of the natural language question, thereby determining the target intent. This process uses confidence level as a gating switch, achieving direct adoption under high confidence and regular rule fallback under low confidence, ensuring the completeness and certainty of intent determination.
[0053] In one optional embodiment, determining whether to use the voting intent category as the target intent of the natural language question, or to obtain the target intent by performing intent category matching on the natural language question based on a preset second rule set, includes: determining whether the confidence level is greater than or equal to a preset confidence threshold; if the confidence level is greater than or equal to the preset confidence threshold, determining the voting intent category as the target intent; if the confidence level is less than the preset confidence threshold, performing intent category matching on the natural language question based on the preset second rule set to obtain the target intent.
[0054] In this embodiment, a gated decision logic based on a confidence threshold is introduced. A pre-set confidence threshold serves as a boundary for distinguishing the reliability of intent determination, quantifying the credibility of neighbor vector voting results. Specifically, the execution path is first divided by comparing the confidence of the current voting intent category with the threshold. When the confidence is greater than or equal to the threshold, it indicates that the inference based on vector similarity is highly certain, and the voting intent category is directly locked as the target intent, achieving efficient and low-overhead rapid response. When the confidence is less than the threshold, it indicates that the vector matching result has ambiguity or boundary drift risk. In this case, intent category matching based on a pre-set second rule set is forcibly triggered, using pre-set unstructured text features or general keyword regular expressions to perform secondary verification on natural language questions, providing a clear and certain fallback path for low-confidence scenarios. This approach retains the generalization advantage of embedded vectors in dense multilingual corpora while effectively avoiding intent misjudgment due to low confidence, ensuring the accuracy of intent determination results and the stability of system operation.
[0055] Optionally, the confidence level of the voting intent category can be obtained in the following way: Where K represents the confidence level of the voting intention category. This is the sum of the similarities between neighbors (i.e., the total similarity). To preset the reliability threshold; when and Timely adoption If the intention is determined as the target, otherwise it is judged as low confidence, and a fallback judgment based on the preset second rule set is continued.
[0056] For example, the embedding vector V retrieves k (e.g., k=5) neighbor vectors in the approximate nearest neighbor index, according to... The method is to calculate the cosine distance of each neighbor. Convert to similarity; by The scores of each category are aggregated in a way that yields the total similarity. According to the intention category that achieved the highest score And calculate its confidence level. .when and (like When adopted If the target intent is not specified, it is considered low confidence, and a fallback judgment based on a preset second rule set is performed. For example, for the English question "What is the current SOC?", the similarity scores of five neighbor vectors are 0.82, 0.79, 0.60, 0.55, and 0.20. The first four are labeled as data query, and the fifth as knowledge explanation. Therefore, the score for the data query category is 0.82 + 0.79 + 0.60 + 0.55 = 2.76; the total similarity (T) is 2.96, and the confidence level is... The data query class is adopted as the target intent. When it is judged as low confidence (e.g.) or When the query is in the range of _____, a pre-defined regular expression catch-all rule is used to make a second judgment on the query: if a non-general category is hit (such as keywords like consultation / explanation or fault), then that intent category is adopted as the target intent; otherwise, it is judged as a general category. The final output is a binary result of (intent category, embedding vector V), where the embedding vector V is passed to downstream vector retrieval or data reuse along the vector reuse path to avoid duplicate embedding.
[0057] In one optional embodiment, the intention category matching of the natural language question based on a preset second rule set to obtain the target intention includes: performing regular expression matching on the natural language question based on the preset second rule set to determine whether there is a matching intention category; if there is a matching intention category, determining the matching intention category as the target intention; if there is no matching intention category, determining the target intention as a predetermined general category.
[0058] In this embodiment, a pre-defined second rule set is used to perform regular expression matching on natural language questions. This aims to utilize pre-defined patterns of unstructured text features or common keywords to perform a secondary structural screening of questions that lacked confidence and did not match the first rule set in the previous steps. Specifically, the pre-defined second rule set refers to a set of regular expressions containing pre-defined unstructured text features or common keywords, such as rules for identifying specific format order numbers or fixed phrases. The process involves determining whether a matching intent category exists, i.e., performing a regular expression comparison operation to determine if the question falls within the known rule range. When a match is found... When a match exists, the matched intent is directly determined as the target intent, ensuring a fast output of highly deterministic results. When the comparison fails and no match exists, to avoid the intent routing being suspended or uncertain due to low confidence and no rule hit, the target intent of the question is directly forced to be determined as a predetermined general category as a fallback. Through this logic of "precise matching first, general fallback guarantee", the problem of low confidence questions lacking a clear landing point when the second matching fails is effectively solved, realizing the integrity and determinism of intent routing, and avoiding downstream service call failures due to missing intent.
[0059] As an optional embodiment, the method further includes: performing an embedding encoding step to obtain an embedding vector if an intent category matching the natural language question exists in a preset first rule set, or if no matching intent category exists in a preset second rule set; and outputting the target intent and the embedding vector together for reuse by downstream tasks.
[0060] In this embodiment, if an intent category matching the natural language question exists in the preset first rule set, or if no matching intent category exists in the preset second rule set, an embedding encoding step is performed to obtain an embedding vector. This means that the vector calculation is no longer limited to long-tail or fuzzy questions that cannot be clearly determined by rules, but the embedding encoding action is brought forward or parallelized: when the question matches the intent determined by the first rule set (such as structured keyword matching), or when it does not match the intent determined by the first rule set and the second rule set (such as regular expressions) does not provide a fallback, a complete embedding encoding operation is forced on the original question to generate the corresponding embedding vector; the target intent and the embedding vector are output together for reuse by downstream tasks. This means that after the intent determination logic is completed, the embedding vector is no longer discarded or ignored separately, but is encapsulated together with the finally determined target intent as the overall output result. This process avoids the need for downstream retrieval tasks to re-initiate an independent embedding encoding request due to the lack of vectors, thereby eliminating the resource waste caused by repeated calculations, realizing the synchronous completion of routing determination and vector generation, improving the overall system response efficiency and reducing computational overhead.
[0061] Through steps S102 to S108, the intent category of the natural language question is first matched based on a preset first rule set. Utilizing the ordered matching rules pre-defined for structured or highly reliable intents within this set, highly deterministic intents are prioritized during the preprocessing stage, thus avoiding misjudgments of high-precision intents due to blurred boundaries in dense multilingual corpora. When no intent is matched in the first rule set, multiple neighbor vectors and their category labels corresponding to the embedding vector of the natural language question are determined. A voting mechanism is used to determine the voted intent category from multiple candidate intents and calculate its confidence level, thereby quantifying the semantics. The reliability of the matching is assessed; subsequently, a diversion strategy is implemented based on the confidence level. When the confidence level is high, the voting intent category is directly used as the target intent, while when the confidence level is low, a second set of preset rules containing unstructured text features or general keyword regular expressions is used for secondary matching. By using confidence level gating, the system transitions from fuzzy matching based on vector similarity to precise positioning based on rules, effectively solving the problem of lack of deterministic results in low-confidence scenarios. This achieves high efficiency and robustness in the intent determination process, avoids repeated embedding in routing and downstream retrieval, and improves the overall accuracy and response efficiency of intent recognition.
[0062] Intent routing is a crucial component of natural language interaction systems, determining which downstream processing branch (such as real-time data querying, knowledge interpretation, or fault statistics) should handle a user's input natural language question. On edge devices, intent routing needs to be highly accurate and have low latency, but it should not introduce expensive model inference for each decision or rely on specially trained intent models.
[0063] Most intent recognition solutions in related technologies rely on neural models: either introducing a (cue-based or dedicated) model inference for each decision, resulting in high computational and latency overhead; or relying on pre-trained dedicated intent recognition networks, which have high training and maintenance costs, are difficult to start cold, and are hard to run stably with low latency on edge devices with limited computing power. Other related technologies use text embedding combined with approximate nearest neighbor retrieval, but often only use approximate nearest neighbors for candidate recall, requiring secondary evaluation by semantic re-ranking models or large language models, resulting in heavy links, high latency, and failure to directly normalize the similarity of approximate nearest neighbors into a gated confidence level for decision-making. Furthermore, in bilingual (Chinese and English) and short, colloquial applications, real-time data-type questions are highly dense in the embedding space. Categories that could be accurately determined, such as numbers, equipment lists, analysis reports, and consultation explanations, are easily misclassified into data query categories by pure semantic nearest neighbor voting, causing boundary drift. Simultaneously, when the intent is unclear (low confidence), there is a lack of deterministic fallback paths, and the embeddings used for routing and downstream vector retrieval are calculated separately, resulting in duplicate embeddings and wasted edge computing power.
[0064] To address the aforementioned problems, based on the above embodiments and optional embodiments, this invention proposes an optional implementation method. The purpose of this embodiment is to provide a question intent determination scheme. This method, including a question intent determination method and system, is equivalent to a hierarchical hybrid intent routing method and system that integrates rules and near nearest neighbor representations. This addresses the problems of high overhead in intent determination related to technical issues, boundary drift in dense multilingual corpora, low-confidence lack of deterministic fallback, and redundant embedding of routing and downstream retrieval. It achieves highly accurate, low-latency, maintainable intent routing with zero dedicated model training. The core of this embodiment lies in constructing a hierarchical hybrid determination framework of "rule-based hard interception and preemption—approximate nearest neighbor voting gating—regularity fallback." This method first arranges high-precision classifiable categories into an ordered rule set based on category reliability. Before matching the nearest neighbor, each question is matched one by one; a match is preemptively assigned a category, thus avoiding boundary drift of the nearest neighbor in dense multilingual corpora. For questions that do not match, an embedding encoding is performed. The embedded vector is used to retrieve neighbor vectors in the near nearest neighbor index constructed from a small number of examples. The cosine distance between neighbors is converted into similarity and normalized to a category score and confidence level. If a threshold is reached, the voting intention category is adopted. If the confidence level is insufficient, a second fallback using regularization rules ensures a deterministic landing point. Finally, the vector obtained from the first embedding is output as an arbitrary graph result for reuse in downstream vector retrieval.
[0065] This embodiment also provides a system for implementing the above method, including a hierarchical rule hard interception module, an embedding encoding module, an approximate nearest neighbor semantic voting module, a regular expression fallback module, an index construction and reconstruction module, and a vector reuse output interface.
[0066] Specifically Figure 2 This is a flowchart of an optional question intent determination method according to an embodiment of the present invention, such as... Figure 2 As shown, the method includes:
[0067] S1: Hierarchical rule hard interception: A high-precision rule set (i.e., the first preset rule set) is pre-ordered according to category reliability. The input natural language question is matched one by one according to priority. Once a rule is matched, the target intent of the question is determined to be the intent category corresponding to that rule, and the process proceeds to step S4 for output, without entering the near nearest neighbor voting. This pre-preemption is used to avoid the boundary drift of near nearest neighbors in dense multilingual corpora, which may mistakenly merge the above categories into the data query category.
[0068] S2: Embedding Encoding: For questions not matched in step S1, perform vector encoding to obtain an embedding vector of a specified dimension (e.g., 1024). When step S1 matches, also perform this step on the question to produce the embedding vector for downstream reuse.
[0069] S3: Approximate Nearest Neighbor Semantic Voting: Using the embedding vector from step S2, retrieve several neighbor vectors from the approximate nearest neighbor index constructed from few sample labeled examples. Convert the cosine distance between each neighbor vector and the question into a similarity score. Then, based on the category label of each neighbor vector, aggregate the category score and the sum of similarities for each intent category. Take the intent category with the highest category score as the voted intent category. Use the ratio of the score of the voted intent category to the sum of similarities as the confidence level. When the sum of similarities is greater than zero and the confidence level is not less than a preset threshold, adopt the voted intent category as the target intent of the question and proceed to step S4; otherwise, it is judged as low confidence.
[0070] S4: Regular fallback and vector reuse: When step S3 is judged as low confidence, the question is re-evaluated using the preset regular fallback rule. If a non-general category is hit, the intent category is adopted as the target intent of the question; otherwise, the target intent is determined to be a general category. The embedded vector obtained in step S2 is also output along with the arbitrary graph result for downstream vector retrieval reuse. When step S1 is hit, the embedding encoding of step S2 is also performed on the question to produce an embedded vector.
[0071] Furthermore, this embodiment also includes index building and reconstruction steps: encoding the set of few-sample labeled examples with a general embedding model, building an approximate nearest neighbor index and persisting it; calculating the content hash of the set of few-sample labeled examples, and automatically reconstructing the approximate nearest neighbor index when the content hash changes; the online intent routing process does not rely on any model trained specifically for intent recognition.
[0072] This embodiment also provides a system for implementing the above method. Figure 3 This is an optional system architecture according to an embodiment of the present invention, such as Figure 3 As shown, the system includes:
[0073] The hierarchical rule hard interception module is used to execute step S1 in the above embodiments;
[0074] The embedding encoding module is used to perform step S2 in the above embodiment, and also to generate an embedding vector for the question when step S1 is hit;
[0075] The near nearest neighbor semantic voting module is used to execute step S3 in the above embodiments;
[0076] The regular expression fallback module is used to perform a secondary determination in step S4 of the above embodiments when the near nearest neighbor semantic voting module determines that the confidence level is low.
[0077] The vector multiplexing output interface is used to output the intent result along with the embedded vector and provide the embedded vector to downstream vector retrieval.
[0078] Furthermore, the near nearest neighbor semantic voting module includes a confidence gating unit, which uses whether the sum of similarities is greater than zero and whether the confidence is not less than a preset threshold as gating conditions to determine whether to adopt the voting intention category; the system also includes an index building and reconstruction module, which automatically reconstructs the near nearest neighbor index based on the content hash changes of the few sample labeled example set.
[0079] The method in this embodiment can achieve at least one of the following effects: 1) Zero dedicated model training and no model inference required for each decision: Online routing only requires one embedding, one near nearest neighbor query and rule matching, without the need to train or call a dedicated intent model, resulting in low latency and easy deployment at the edge; the index is constructed from a few labeled examples, and is automatically reconstructed when the hash of the example content changes, resulting in low maintenance costs. 2) Suppressing boundary drift in dense multilingual corpora: High-precision categories are pre-hit and preempted by ordered rules sorted by category reliability, avoiding their incorrect inclusion in dense data query categories by nearest neighbor voting, significantly improving routing stability and accuracy. 3) Nearest neighbor similarity is directly used for confidence determination: The cosine distance of several neighbors is converted into similarity and normalized into confidence, and the decision is made directly with threshold gating, without the need for re-ranking models or secondary evaluation by large language models, resulting in lightweight links and low latency. 4) Low confidence with deterministic fallback and cross-stage vector reuse: When the confidence is insufficient, the deterministic landing point is guaranteed by secondary judgment using regular rules; the vector obtained by one embedding is reused between routing and downstream vector retrieval, saving one repeated embedding and further reducing edge computing power overhead.
[0080] This embodiment also provides a question intent determination device, which is used to implement the above embodiments and preferred embodiments, and will not be repeated as already described. As used below, the terms "module" and "device" can refer to a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0081] According to an embodiment of the present invention, an apparatus embodiment for implementing the above-described question intent determination method is also provided. Figure 4 This is a schematic diagram of a question intent determination device according to an embodiment of the present invention, as shown below. Figure 4 As shown, the above-mentioned question intent determination device includes: intent category matching module 400, neighbor filtering module 402, voting module 404, and determination module 406, wherein:
[0082] The intent category matching module 400 is used to perform intent category matching on natural language questions based on a preset first rule set, wherein the preset first rule set contains ordered matching rules pre-set for structured intents or highly reliable intents;
[0083] The neighbor filtering module 402, connected to the intent category matching module 400, is used to determine multiple neighbor vectors corresponding to the embedding vector of the natural language question and the category labels corresponding to each of the multiple neighbor vectors when there is no intent category matching the natural language question in the preset first rule set. The embedding vector is obtained by performing an embedding encoding on the natural language question.
[0084] The voting module 404, connected to the neighbor filtering module 402, is used to determine the voting intention category from multiple candidate intention categories based on the category labels corresponding to each of the multiple neighbor vectors, and to determine the confidence level of the voting intention category, wherein the confidence level is used to indicate the degree of credibility of the relative weight of the voting intention category in the multiple neighbor vectors;
[0085] The determination module 406, connected to the voting module 404, is used to determine, based on the confidence level, whether to use the voting intent category as the target intent of the natural language question, or to obtain the target intent by matching the intent category of the natural language question based on a preset second rule set, wherein the preset second rule set contains pre-defined regular expressions of unstructured text features or general keywords.
[0086] It should be noted that the above modules can be implemented by software or hardware. For example, for the latter, it can be implemented in the following ways: the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0087] It should be noted that the intent category matching module 400, neighbor filtering module 402, voting module 404, and determination module 406 mentioned above correspond to steps S102 to S108 in the embodiments. The instances and application scenarios implemented by the above modules and their corresponding steps are the same, but are not limited to the content disclosed in the above embodiments. It should be noted that the above modules, as part of the device, can run on a computer terminal.
[0088] It should be noted that the optional or preferred implementation methods of this embodiment can be found in the relevant descriptions in the embodiments, and will not be repeated here.
[0089] The aforementioned question intent determination device may also include a processor and a memory. The intent category matching module 400, neighbor filtering module 402, voting module 404, and determination module 406 are all stored in the memory as program modules, and the processor executes the aforementioned program modules stored in the memory to realize the corresponding functions.
[0090] The processor contains a core that retrieves the corresponding program modules from memory. One or more cores may be configured. Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory includes at least one memory chip.
[0091] According to an embodiment of this application, an embodiment of a non-volatile storage medium is also provided. Optionally, in this embodiment, the non-volatile storage medium includes a stored program, wherein, when the program runs, it controls the device where the non-volatile storage medium is located to execute any of the above-mentioned question intent determination methods.
[0092] Optionally, in this embodiment, the non-volatile storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals, and the non-volatile storage medium includes stored programs.
[0093] Optionally, a program that controls the device containing the non-volatile storage medium to execute any of the above-mentioned question intent determination method steps during program execution.
[0094] According to an embodiment of this application, an embodiment of a processor is also provided. Optionally, in this embodiment, the processor is used to run a program, wherein the program executes any of the above-described question intent determination methods during runtime.
[0095] According to an embodiment of this application, an embodiment of a computer program product is also provided, which, when executed on a data processing device, is adapted to execute a program that initializes a question intent determination method step having any of the above-mentioned steps.
[0096] like Figure 5 As shown, an embodiment of the present invention provides an electronic device 10, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps of the question intent determination method described above.
[0097] The order of the above embodiments of the present invention is merely for description and does not represent the superiority or inferiority of the embodiments.
[0098] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0099] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of modules described above can be a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or indirect coupling or communication connection between modules, and may be electrical or other forms.
[0100] The modules described above as separate components may or may not be physically separate. Similarly, the components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple modules. Some or all of the modules can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0101] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.
[0102] If the aforementioned integrated modules are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable non-volatile storage medium. Based on this understanding, the technical solution of this invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a non-volatile storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned non-volatile storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0103] The above are merely preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for determining the intent of a question, characterized in that, include: Based on a preset first rule set, intent category matching is performed on natural language questions. The preset first rule set includes ordered matching rules for structured intents or high-reliability intents. The high-reliability intent is an intent with a preset reliability greater than a preset reliability threshold. If there is no intent category matching the natural language question in the preset first rule set, determine multiple neighbor vectors corresponding to the embedding vector of the natural language question, and the category label corresponding to each of the multiple neighbor vectors, wherein the embedding vector is obtained by performing an embedding encoding on the natural language question; Based on the category labels corresponding to each of the multiple neighbor vectors, a voting intent category is determined from multiple candidate intent categories, and the confidence level of the voting intent category is determined, wherein the confidence level is used to indicate the degree of credibility of the relative weight of the voting intent category among the multiple neighbor vectors; Based on the confidence level, it is determined whether to use the voting intent category as the target intent of the natural language question, or to obtain the target intent by performing intent category matching on the natural language question based on a preset second rule set, wherein the preset second rule set includes regular expressions preset with unstructured text features or general keywords.
2. The method according to claim 1, characterized in that, The step of determining the voting intent category from multiple candidate intent categories based on the category labels corresponding to each of the multiple neighbor vectors includes: Determine the similarity of each of the plurality of neighbor vectors, wherein the similarity is obtained based on the cosine distance between the corresponding neighbor vector and the embedding vector; Based on the similarity of each of the multiple neighbor vectors, and according to the category labels of each of the multiple neighbor vectors, the category scores of each of the multiple candidate intent categories are determined. The voting intent category is determined from the plurality of candidate intent categories based on the category scores corresponding to each of the plurality of candidate intent categories.
3. The method according to claim 2, characterized in that, The step of determining the category score corresponding to each of the multiple candidate intent categories based on the similarity of each of the multiple neighbor vectors and according to the category label corresponding to each of the multiple neighbor vectors includes: For any intent category among the plurality of candidate intent categories, a neighbor vector associated with the intent category is determined based on the category label corresponding to each of the plurality of neighbor vectors. The sum of the similarities of the associated neighbor vectors is used as the category score for any intention category. The category scores corresponding to each of the multiple candidate intent categories are obtained by using the method of obtaining the category score of any one of the intent categories.
4. The method according to claim 2, characterized in that, The step of determining the voting intent category from the plurality of candidate intent categories based on their respective category scores includes: Determine the intent category with the highest category score among the multiple candidate intent categories; The intent category with the highest score in the category is determined as the voting intent category.
5. The method according to claim 1, characterized in that, The determination of the confidence level for the voting intention category includes: The total similarity is obtained by summing the similarities corresponding to the multiple neighbor vectors. The confidence level is determined by the ratio of the category score of the voting intention category to the total similarity.
6. The method according to any one of claims 1 to 5, characterized in that, The step of determining whether to use the voting intent category as the target intent of the natural language question based on the confidence level, or to obtain the target intent by performing intent category matching on the natural language question based on a preset second rule set, includes: Determine whether the confidence level is greater than or equal to a preset confidence threshold; If the confidence level is greater than or equal to the preset confidence threshold, the voting intent category is determined as the target intent; If the confidence level is less than the preset confidence threshold, the natural language question is matched with the intent category based on the preset second rule set to obtain the target intent.
7. The method according to any one of claims 1 to 5, characterized in that, The step of performing intent category matching on the natural language question based on a preset second rule set to obtain the target intent includes: Based on the preset second rule set, regular expression matching is performed on the natural language question to determine whether there is a matching intent category; If a matching intent category exists, the matching intent category is determined as the target intent; If no matching intent category exists, the target intent is determined to be a predetermined general category.
8. The method according to any one of claims 1 to 5, characterized in that, The process of determining the multiple neighbor vectors corresponding to the embedding vector of the natural language question includes: Based on a preset approximate nearest neighbor index, the vector index corresponding to a preset set of few-sample labeled examples is retrieved to obtain the multiple neighbor vectors. The approximate nearest neighbor index is obtained by embedding and encoding multiple examples included in the set of few-sample labeled examples, and based on the encoded vectors corresponding to each of the multiple examples.
9. The method according to claim 8, characterized in that, The method further includes: Determine the content hash value of the few-sample labeled example set; If a change in the content hash value is detected, the multiple examples are re-embedded and encoded to obtain new encoded vectors for each of the multiple examples; Based on the new encoded vectors corresponding to each of the multiple examples, a new approximate nearest neighbor index is obtained.
10. An electronic device, characterized in that, It includes one or more processors and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the question intent determination method according to any one of claims 1 to 9.
