Intelligent question and answer optimization method and device, computer device and medium
By extracting terms and enumerating and aligning them from the structured elements input by users, generating CDL and optimizing SQL queries, the low accuracy of the ChatBI system when faced with field redundancy and semantic ambiguity is solved, achieving higher SQL generation accuracy and question-answering stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-17
- Publication Date
- 2026-04-14
AI Technical Summary
The existing ChatBI system generates SQL with low accuracy when faced with user queries that have redundant fields, ambiguous semantics, or unclear user intent.
By responding to user input, the system obtains the structured elements of the problem, performs term extraction and enumeration alignment, uses a preset business term enumeration table and recall strategy to obtain candidate fields, performs field matching and fuzzy matching, generates a constraint definition language (CDL), and converts it into SQL query text based on the large model, and optimizes the query path based on user feedback.
It improves the accuracy of SQL and the stability of question answering, especially in the face of redundant fields and semantic ambiguity, thereby enhancing the accuracy of generated SQL and the reliability of question answering.
Smart Images

Figure CN120821814B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of large model technology, and in particular to an intelligent question-answering optimization method, apparatus, computer equipment, and medium. Background Technology
[0002] Currently, in the field of business intelligence analytics, chat-based business intelligence (ChatBI) systems based on large models are commonly used for semantic parsing and automatic SQL generation. Although ChatBI is based on natural language understanding and can generate SQL for general scenarios, the accuracy of the generated SQL is low when faced with user queries that have redundant fields, ambiguous semantics, or unclear user intent. Summary of the Invention
[0003] This invention provides an intelligent question-answering optimization method, apparatus, computer equipment, and medium, aiming to solve the problem that the accuracy of semantic parsing and generated SQL in the existing technology is low when faced with user queries that have redundant fields, ambiguous semantics, or unclear user intent.
[0004] In a first aspect, embodiments of the present invention provide an intelligent question-answering optimization method, comprising:
[0005] In response to the user's first input, obtain the structured elements of the question from the first input;
[0006] The structured elements are extracted according to a preset business term enumeration table to obtain a first field set, which includes multiple first candidate fields.
[0007] The first field set is enumerated and aligned according to the preset business term enumeration table to obtain the target field set. The target field set includes a first candidate field whose matching degree with the enumerated fields in the preset business term enumeration table is higher than the preset matching degree.
[0008] Multiple second candidate fields are obtained according to a preset recall strategy;
[0009] Update the target field set with the plurality of second candidate fields;
[0010] Perform field matching on each candidate field in the updated target field set to obtain the second field set;
[0011] Perform fuzzy matching on the second field set to obtain the target enumeration value combination;
[0012] Based on the combination of the target enumeration values, a constraint definition language (CDL) is generated. The CDL includes the constraints of the problem, the rules for combining enumeration values, and the range of answers.
[0013] Based on the large model, the CDL is converted into SQL query text, and SQL query results based on the SQL query text are obtained;
[0014] Calculate the query path score based on the SQL query results and user feedback information, and optimize the SQL query text and field click sequence based on the path score.
[0015] Secondly, embodiments of the present invention also provide an intelligent question-answering optimization device, comprising:
[0016] The input / output unit is used to receive the user's initial input.
[0017] A processing unit is configured to, in response to a first input received by the input / output unit, obtain structured elements of a problem from the first input; extract terms from the structured elements according to a preset business term enumeration table to obtain a first field set, the first field set including multiple first candidate fields; enumerate and align the first field set according to the preset business term enumeration table to obtain a target field set, the target field set including first candidate fields whose matching degree with the enumerated fields in the preset business term enumeration table is higher than a preset matching degree; obtain multiple second candidate fields according to a preset recall strategy; and update the multiple second candidate fields to the target field set.
[0018] The processing unit is further configured to perform field matching on each candidate field in the updated target field set to obtain a second field set; perform fuzzy matching on the second field set to obtain a combination of target enumeration values; generate a constraint definition language (CDL) based on the combination of target enumeration values, wherein the CDL includes the constraints of the problem, the combination rules of the enumeration values, and the answer range; convert the CDL into SQL query text based on the large model to obtain SQL query results based on the SQL query text; calculate a query path score based on the SQL query results and user feedback information received through the input / output unit; and optimize the SQL query text and field click sequence based on the path score.
[0019] Thirdly, embodiments of the present invention also provide a computer device including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method described in the first aspect above.
[0020] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, the computer program including program instructions that, when executed by a processor, can implement the method described in the first aspect above.
[0021] This invention provides an intelligent question-answering optimization method, apparatus, computer device, and medium. The method includes: responding to a user's first input, obtaining structured elements of a question from the first input; extracting terms from the structured elements according to a preset business term enumeration table to obtain a first field set; enumerating and aligning the first field set according to the preset business term enumeration table to obtain a target field set; obtaining candidate fields according to a preset recall strategy and updating them to the target field set; performing field matching on each candidate field in the updated target field set to obtain a second field set; performing fuzzy matching on the second field set to obtain a target enumeration value combination; and generating a CDL based on the target enumeration value combination, wherein the CDL includes the constraints of the question, the combination rules of the enumeration values, and the answer range. This invention can improve the accuracy of SQL and enhance the stability and accuracy of question answering when user queries have redundant fields, ambiguous semantics, or unclear user intent. Attached Figure Description
[0022] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a schematic diagram of the entire process of an intelligent question-answering system provided in an embodiment of the present invention;
[0024] Figure 2 A flowchart illustrating the intelligent question-answering optimization method provided in an embodiment of the present invention;
[0025] Figure 3 A schematic diagram of a sub-process of the intelligent question-answering optimization method provided in an embodiment of the present invention;
[0026] Figure 4 This is a schematic diagram of another sub-process of the intelligent question-answering optimization method provided in an embodiment of the present invention;
[0027] Figure 5 This is a schematic diagram of another sub-process of the intelligent question-answering optimization method provided in the embodiments of the present invention;
[0028] Figure 6 This is a schematic diagram of another sub-process of the intelligent question-answering optimization method provided in an embodiment of the present invention;
[0029] Figure 7 This is a schematic diagram of another sub-process of the intelligent question-answering optimization method provided in the embodiments of the present invention;
[0030] Figure 8 A schematic block diagram of the intelligent question-answering optimization device provided in the embodiments of the present invention;
[0031] Figure 9 A schematic block diagram of a computer device provided for an embodiment of the present invention. Detailed Implementation
[0032] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0033] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.
[0034] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0035] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0036] This invention provides an intelligent question-answering optimization method, apparatus, computer device, and medium. The intelligent question-answering optimization method in this invention is applied to a server, which includes one or more processors, a memory, and one or more applications. The one or more applications are stored in the memory and configured to be executed by the processor to implement the intelligent question-answering optimization method.
[0037] like Figure 1 As shown, Figure 1This is a flowchart illustrating a ChatBI-based question-answering system, representing an embodiment of the intelligent question-answering optimization method of the present invention. The process mainly includes user question parsing and content enhancement, terminology enumeration and standardization alignment, candidate field recall, field scoring and sorting, enumeration value matching and refinement, CDL generation, and user feedback and learning optimization mechanisms.
[0038] Figure 2 This is a flowchart illustrating the intelligent question-answering optimization method provided in an embodiment of the present invention. Figure 2 As shown, the method includes the following steps S110-S111.
[0039] S110. In response to the user's first input, obtain the structured elements of the problem from the first input.
[0040] The structured elements include indicator keywords, time range, and dimensional restrictions.
[0041] In one embodiment, step S110 includes:
[0042] Extract key problem elements from the first input;
[0043] Select a target standard terminology template that semantically matches the key issue elements;
[0044] The problem elements are transformed into standard terms according to the target standard terminology template to obtain the structured elements.
[0045] In one embodiment, problem rewriting techniques can also be used to convert ambiguous and ambiguous expressions into standard terms, forming a model-friendly structural expression.
[0046] S120. Extract terms from the structured elements according to the preset business term enumeration table to obtain the first field set.
[0047] The first field set includes multiple first candidate fields.
[0048] In one embodiment, the preset business terminology enumeration table includes dimension terms, indicator terms, time expressions, a dimension dictionary table, an indicator repository, and a time template library. Step 120 includes:
[0049] The structured elements are matched with the dimension terms, the indicator terms, the time expressions, the dimension dictionary, the indicator repository, and the time template library to extract first candidate fields from the first input that match the enumeration fields of multiple dimensions in the preset business term enumeration library, thus obtaining the first field set.
[0050] It is evident that by using enumeration alignment and synonym recognition mechanisms, it is possible to ensure that user input is semantically consistent with the fields of the question-answering system.
[0051] Specifically, such as Figure 3 As shown, a business terminology enumeration table is pre-built to define key dimensions, metrics, and time representations. Enumeration alignment and synonym recognition mechanisms ensure semantic consistency between user input and system fields. The specific process is as follows:
[0052] 1. User Input Reception Stage
[0053] The question-answering system receives "structured question expressions" as input data, which contain information such as business terms, metrics, and time that need to be processed.
[0054] 2. Data Processing Stage
[0055] First, extract three types of key terms from the structured questions: indicator terms (such as sales revenue, profit margin and other business indicators), time expressions (such as "Q1 2023", "last 30 days" and other time descriptions), and dimension terms (such as region, product category and other classification dimensions).
[0056] Then, the extracted indicator terms are matched with the indicator repository, the time expressions are matched with the time template library, and the dimension terms are matched with the dimension dictionary table.
[0057] Then, terminology standardization and alignment are achieved through a four-level processing flow:
[0058] 21) Basic matching: Initially check if the term exists in the corresponding database;
[0059] 22) Exact match: Direct mapping of exactly the same terms (e.g., "sales"="Sales");
[0060] 23) Fuzzy matching: Calculate similarity for similar terms (must be >0.7 threshold);
[0061] 24) Third-level terminology alignment: Generate the final "terminology mapping table";
[0062] Finally, synonym expansion is performed, which involves checking whether synonyms exist in the mapping results through "thesaurus retrieval" and expanding the term coverage using "thesaurus grid" (e.g., "customer" ↔ "user").
[0063] 3. Data Output Stage
[0064] First, user verification is performed. The question-and-answer system makes a judgment at the "User corrects record?" diamond node: if the user confirms that it is correct, the system outputs "Keep the existing mapping"; if the user proposes a correction, the system triggers the "Update thesaurus" process and feeds the corrected content back to the knowledge base.
[0065] Then, the standardized terminology mapping results are output to ensure that each term in the problem statement is accurately associated with the business knowledge base.
[0066] visible, Figure 3 The process illustrated demonstrates a closed-loop feedback mechanism where user-corrected data updates the thesaurus, optimizing subsequent matching accuracy; a hierarchical matching strategy that refines matching from basic to fuzzy levels, with a similarity threshold (>0.7) ensuring mapping reliability; and a knowledge base collaboration approach that combines independent processing of three categories of libraries: metrics, time, and dimensions, ultimately outputting a unified mapping table. This demonstrates that... Figure 3 The process shown achieves a systematic transformation from the original problem to standardized terminology, while forming a continuous optimization loop through user feedback.
[0067] S130. Enumerate and align the first field set according to the preset business term enumeration table to obtain the target field set.
[0068] The target field set includes a first candidate field whose matching degree with the enumeration fields in the preset business term enumeration table is higher than the preset matching degree.
[0069] In one embodiment, step S130 includes:
[0070] Based on the fuzzy matching strategy, a first mapping relationship is obtained, which includes the mapping relationship between a first candidate field whose edit distance is greater than a preset threshold and an enumerated field.
[0071] Based on the basic matching strategy, each first candidate field in the first field set is mapped to the enumeration fields in the preset business term enumeration table to obtain the second mapping relationship;
[0072] Based on the expansion strategy, synonyms for each first candidate field are obtained, and a synonym network for the first candidate field is obtained based on the synonyms.
[0073] Based on the first mapping relationship, the second mapping relationship, and the synonym network, a target term mapping table is obtained.
[0074] S140. Obtain multiple second candidate fields according to the preset recall strategy.
[0075] The pre-defined recall strategies include the following (see reference). Figure 4 (as shown)
[0076] Strategy 1: Search the vector library for field names, comments, and sample values;
[0077] Strategy 2: Perform semantic matching using vector similarity calculation (question and table, field, field description, enumeration, etc.);
[0078] Strategy 3: Perform keyword root matching and question segmentation retrieval based on AC Tree (constructing an AC tree from tables, fields, descriptions, etc., and then performing tree retrieval based on the question) and Trie tree structure;
[0079] Strategy 4: Sort by popularity based on field access frequency (AC count);
[0080] Strategy 5: Determine if a field is frequently used in group by and add a dimension label accordingly.
[0081] In one embodiment, step S140 includes:
[0082] Following a vector similarity retrieval strategy, a vector similarity retrieval is performed on the target term mapping table to obtain multiple second candidate fields. Specifically, semantic matching is performed on the question and the preset business term enumeration table, fields, field descriptions, and enumerated fields, respectively, and fields with similarity higher than a preset similarity are selected as candidate fields.
[0083] Based on the tree search and keyword root matching of the target term mapping table, multiple second candidate fields are obtained;
[0084] Multiple second candidate fields are obtained based on the frequency of access to the field.
[0085] Alternatively, determine a second candidate field from the target field set that meets common grouping criteria (i.e., determine whether the field is frequently used in group by) and set dimension labels.
[0086] It is evident that by using multiple strategies to collaboratively recall candidate fields, the accuracy of field retrieval can be improved.
[0087] S150, Update the plurality of second candidate fields to the target field set.
[0088] S160. Perform field matching on each candidate field in the updated target field set to obtain the second field set.
[0089] In one embodiment, step S160 includes:
[0090] The fusion score of the target candidate fields is calculated separately. The fusion score is obtained by weighting the semantic similarity score, field access frequency score, retrieval hit distribution and correctness score of the grouping dimension of the target candidate fields. The target candidate fields are the first candidate field and the second candidate field in the updated first field set.
[0091] Sort each target candidate field according to the size of the fusion score;
[0092] Add the target candidate field whose fusion score is greater than the preset score to the candidate field set;
[0093] The weights of each target candidate field in the candidate field set are adjusted based on the user's selection to obtain the second field set.
[0094] like Figure 5 As shown, the candidate fields are sorted based on the fusion scoring mechanism, and the scoring function is as follows:
[0095] Score(field) = α * sim_score + β * ac_score + γ * es_match + δ *group_tag;
[0096] Where sim_score represents the semantic similarity score, ac_score represents the field access frequency score, es_match represents the ES retrieval hit rate, and group_tag represents whether the field is a grouping dimension.
[0097] Figure 5 In the question-answering system, a "candidate field set" is received as the initial input (starting from the top right corner). This set contains the original data fields to be evaluated (such as database fields, API fields, etc.).
[0098] Then, the "initialize weight parameters" process is executed, assigning initial weight coefficients (α, β, γ, etc.) for subsequent calculations. The question-answering system calculates the sub-scores for the four dimensions in parallel, as follows:
[0099] 1) Calculate the semantic matching degree between the user's question and the field. The calculation formula is: cos(question vector, field vector).
[0100] 2) Based on the normalization of the historical usage frequency of the field, calculate the access popularity (ac_score), with the formula: log(access count + 1) / log(max_count);
[0101] 3) Calculate the exact match (es_match) by standardizing the truncation score of the Elasticsearch retrieval. The calculation formula is: min(ES_score / 10, 1.0);
[0102] 4) Determine the combined value of fields in the business scenario and calculate the combination applicability (group_tag), using the rule: whether the field is a frequently used dimension → 2:1:0;
[0103] Then, the sub-scores of the four dimensions calculated above are weighted and aggregated, and the four sub-scores are integrated in the "Weighted Aggregation Calculation" node:
[0104] final _score = α·sim_score + β·ac _score + γ·es_ match + group _tag;
[0105] Simultaneously, an auxiliary identifier tag_match record is generated to show the field combination relationship;
[0106] Furthermore, sorting and filtering are performed, namely sorting by score in descending order: sort all fields according to final_score, and filter the top-N fields: extract the top N fields to form a "preferred field set".
[0107] Finally, the data output and feedback are as follows:
[0108] (1) User decision-making: The system submits the preferred fields to the user for judgment: If the user adopts the preferred fields, the process terminates and the final set of fields is output; if the user rejects the preferred fields, the system proceeds to the parameter adjustment branch.
[0109] (2) Parameters are dynamically adjusted, and weight parameters are corrected based on user feedback types:
[0110] To enhance semantics, increase the weight of α (α = +0.02).
[0111] Strengthen the association and reduce the β weight (β=-0.01);
[0112] Strengthen the combination, adjust the γ parameter (γ=-0.03 or according to the 1:0 / 2:1:0 rule), and re-inject the adjusted parameter into the "weight allocation" module to start a new round of calculation.
[0113] As can be seen, by setting a dynamic weighting mechanism—that is, adjusting the α / β / γ parameters in real time based on user feedback—an adaptive optimization closed loop is formed; score normalization is performed, standardizing all sub-scores to the [0,1] range through logarithmic transformation (ac_score) and truncation (es_match); business rules are embedded, with group_tag reflecting business priority through hard-coded rules (2:1:0); and preset iteration termination conditions ensure that the process continues until the user adopts the result or the maximum number of iterations is reached. This process achieves intelligent filtering from original fields to business-adapted fields, combining the advantages of both algorithmic calculation and manual intervention.
[0114] S170. Perform fuzzy matching on the second field set to obtain the target enumeration value combination.
[0115] In one embodiment, step S170 includes:
[0116] Determine the target field containing the enumerated values from the second field set;
[0117] An enumeration cluster analysis is performed on the target field to obtain the enumeration value combination.
[0118] like Figure 6 As shown, after field matching in S160, further enumeration clustering analysis can be performed on fields containing enumeration values (such as "region", "type" etc.). Vector similarity or keyword clustering can be used to retrieve and match the most likely combination of enumeration values, thereby improving the accuracy of dimensional fields.
[0119] Figure 6 In the question-and-answer system, the "preferred field set" is received as input, which contains high-priority data fields that have been previously filtered.
[0120] Then, the enumeration value field is identified. The judgment logic is to check whether the field is an enumeration type (such as a finite discrete value field such as region or product type). If it is, the enumeration value refinement process is entered; otherwise, the process jumps directly to the SQL generation stage.
[0121] In the enumeration value refinement process, the original enumeration values (such as "East China / South China / North China", "Category A / Category B / Category C") are extracted from the fields and then subjected to dual-path clustering analysis.
[0122] Path A: Vector similarity calculation, establish an enumeration value vector space (word embedding model transformation), and calculate the semantic similarity between enumeration values;
[0123] Path B: Keyword clustering analysis, constructing a keyword mapping table (e.g., "East China" → "east_china"), and grouping based on keyword features.
[0124] Regenerate dynamic constraints, combine the results of the two clustering methods to generate intelligent constraint conditions (such as merging semantically similar enumeration values), and generate a "refined set of field enumeration values" (filtering redundant values and merging standard enumeration values after merging synonyms).
[0125] Accordingly, non-enumerated fields are processed, and the process proceeds directly to the "SQL generation" stage (without enumerated value constraints). Subsequent integration with the standard query process follows.
[0126] Finally, the system outputs a "refined set of field enumeration values" (standardized, deduplicated, and clustered enumeration values), which maps the results to specific fields via the "Select Field Name" node; and outputs "non-enumeration fields": the original fields are output directly for SQL statement construction and enter the downstream system via the "Return Results" node.
[0127] It can be seen that by presetting rules to automatically distinguish enumerated / non-enumerated fields, manual annotation is avoided; at the same time, the vector space model (semantic analysis) and keyword mapping (rule analysis) are adopted to improve accuracy; similar enumerated values are automatically merged according to the business scenario (such as "Beijing" and "Beijing City"); non-enumerated fields directly enter the main process to ensure processing efficiency. This process realizes intelligent classification processing at the field level, especially optimizing the standardization and semantic aggregation capabilities of enumerated type fields.
[0128] S180. Generate a Constraint Definition Language (CDL) based on the target enumerated value combination.
[0129] Among them, the CDL includes the constraint conditions of the problem, the combination rules of the enumerated values, and the answer range. That is, the enumerated value combination is converted into a CDL expression, and the CDL expression includes the constraint conditions of the problem, the combination rules of the enumerated values, and the answer range. As Figure 7 shown, Figure 7 is a process for generating a CDL expression.
[0130] In one embodiment, a user feedback and learning optimization mechanism can also be established in advance. Correspondingly, after generating the CDL, the SQL execution result and the user feedback information are incorporated into the path scoring to continuously optimize the field priority sorting and the semantic vector model. Support fine-tuning the learning path such as behavior log playback and click field recording.
[0131] S190. Convert the CDL into an SQL query text based on a large model, and obtain an SQL query result based on the SQL query text.
[0132] S111. Calculate the query path score according to the SQL query result and the user feedback information received through the input / output unit, and optimize the SQL query text and the field click sequence according to the path score.
[0133] Among them, the query path score refers to the effectiveness of each query path evaluated by the path scoring system through multi-dimensional indicators. The scoring dimensions include: the SQL execution success rate, that is, whether the SQL statement can be successfully executed and return a result; the result set relevance, that is, the matching degree of the returned result with the user's question (measured by click-through rate, dwell time, etc.); the result set size, that is, whether the number of returned results is appropriate (avoiding too many or too few); the execution efficiency, that is, the query response time; and the user explicit feedback, that is, the satisfaction score or correction request provided by the user.
[0134] The field click sequence refers to the order of fields that the user browses the results.
[0135] In some embodiments, optimizing the field click sequence based on the path score includes dynamically adjusting field importance based on user interaction data. Optimization methods include: click popularity (statistically, the fields most frequently clicked and viewed by users), condition usage frequency (which fields are most frequently used as query conditions), result field preference (the result fields most relevant to users), and feedback correlation analysis (the correlation between positive feedback and specific field combinations).
[0136] It is evident that implementing this method can improve the accuracy of SQL and enhance the stability and accuracy of question answering when user queries contain redundant fields, ambiguous semantics, or unclear user intent.
[0137] Figure 8 This is a schematic block diagram of an intelligent question-answering optimization device provided in an embodiment of the present invention. Figure 8 As shown, corresponding to the above-described intelligent question-answering optimization method, the present invention also provides an intelligent question-answering optimization device 100. This intelligent question-answering optimization device 100 includes a unit for executing the above-described intelligent question-answering optimization method. Please refer to... Figure 8 The intelligent question-answering optimization device 100 includes an input / output unit 110, a processing unit 120, and a display unit 130.
[0138] Input / output unit 110 is used to receive the user's first input;
[0139] Processing unit 120 is configured to, in response to a first input received by input / output unit 110, obtain structured elements of a problem from the first input; extract terms from the structured elements according to a preset business term enumeration table to obtain a first field set, the first field set including multiple first candidate fields; enumerate and align the first field set according to the preset business term enumeration table to obtain a target field set, the target field set including first candidate fields whose matching degree with the enumerated fields in the preset business term enumeration table is higher than a preset matching degree; obtain multiple second candidate fields according to a preset recall strategy; and update the multiple second candidate fields to the target field set.
[0140] The processing unit 120 is further configured to perform field matching on each candidate field in the updated target field set to obtain a second field set; perform fuzzy matching on the second field set to obtain a combination of target enumeration values; generate a CDL based on the combination of target enumeration values and output it through the display unit 130, wherein the CDL includes the constraints of the question, the combination rules of the enumeration values, and the range of answers; convert the CDL into SQL query text based on the large model and obtain SQL query results based on the SQL query text; calculate a query path score based on the SQL query results and user feedback information received through the input / output unit 110, and optimize the SQL query text and field click sequence based on the path score.
[0141] In one embodiment, the processing unit 110 is specifically used for:
[0142] Based on the fuzzy matching strategy, a first mapping relationship is obtained, which includes the mapping relationship between a first candidate field whose edit distance is greater than a preset threshold and an enumerated field.
[0143] Based on the basic matching strategy, each first candidate field in the first field set is mapped to the enumeration fields in the preset business term enumeration table to obtain the second mapping relationship;
[0144] Based on the expansion strategy, synonyms for each first candidate field are obtained, and a synonym network for the first candidate field is obtained based on the synonyms.
[0145] Based on the first mapping relationship, the second mapping relationship, and the synonym network, a target term mapping table is obtained.
[0146] In one embodiment, the processing unit 110 is specifically used to perform one of the following operations:
[0147] According to the vector similarity retrieval strategy, vector similarity retrieval is performed on the target term mapping table to obtain multiple second candidate fields;
[0148] Based on the tree search and keyword root matching of the target term mapping table, multiple second candidate fields are obtained;
[0149] Multiple second candidate fields are obtained based on the popularity data of the field's access frequency.
[0150] Alternatively, a second candidate field that conforms to common grouping criteria can be determined from the target field set, and dimension labels can be set.
[0151] In one embodiment, the preset business terminology enumeration table includes dimension terms, indicator terms, time expressions, a dimension dictionary table, an indicator repository, and a time template library; the processing unit 110 is specifically used for:
[0152] The structured elements are matched with the dimension terms, the indicator terms, the time expressions, the dimension dictionary, the indicator repository, and the time template library to extract first candidate fields from the first input that match the enumeration fields of multiple dimensions in the preset business term enumeration library, thus obtaining the first field set.
[0153] In one embodiment, the processing unit 110 is specifically used for:
[0154] Extract key problem elements from the first input;
[0155] Select a target standard terminology template that semantically matches the key issue elements;
[0156] The problem elements are transformed into standard terms according to the target standard terminology template to obtain the structured elements.
[0157] In one embodiment, the processing unit 110 is specifically used for:
[0158] The fusion score of the target candidate fields is calculated separately. The fusion score is obtained by weighting the semantic similarity score, field access frequency score, retrieval hit distribution and correctness score of the grouping dimension of the target candidate fields. The target candidate fields are the first candidate field and the second candidate field in the updated first field set.
[0159] Sort each target candidate field according to the size of the fusion score;
[0160] Add the target candidate field whose fusion score is greater than the preset score to the candidate field set;
[0161] The weights of each target candidate field in the candidate field set are adjusted based on the user's selection to obtain the second field set.
[0162] In one embodiment, the processing unit 110 is specifically used for:
[0163] Determine the target field containing the enumerated values from the second field set;
[0164] An enumeration cluster analysis is performed on the target field to obtain the enumeration value combination.
[0165] It is evident that implementing this device can improve the accuracy of SQL and enhance the stability and accuracy of question answering when user queries have redundant fields, ambiguous semantics, or unclear user intent.
[0166] It should be noted that those skilled in the art can clearly understand that the specific implementation process of the above-mentioned intelligent question-answering optimization device and each unit can be referred to the corresponding description in the foregoing method embodiments. For the sake of convenience and brevity, it will not be repeated here.
[0167] The aforementioned intelligent question-answering optimization device can be implemented as a computer program, which can, for example... Figure 9 It runs on the terminal device or server shown.
[0168] Please see Figure 9 , Figure 9 This is a schematic block diagram of a computer device provided in an embodiment of the present invention. The computer device integrates any of the intelligent question-answering optimization devices provided in the embodiments of the present invention.
[0169] See Figure 9 The computer device includes a processor 402, a memory, and a network interface 405 connected via a system bus 401, wherein the memory may include a storage medium 403 and internal memory 404.
[0170] The storage medium 403 may store an operating system 4031 and a computer program 4032. The computer program 4032 includes program instructions that, when executed, cause the processor 402 to perform an intelligent question-answering optimization method.
[0171] The processor 402 provides computing and control capabilities to support the operation of the entire computer device.
[0172] The internal memory 404 provides an environment for the computer program 4032 in the storage medium 403 to run. When the computer program 4032 is executed by the processor 402, the processor 402 can execute the above-mentioned intelligent question-answering optimization method.
[0173] This network interface 405 is used for network communication with other devices. Those skilled in the art will understand that... Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present invention and does not constitute a limitation on the computer device to which the present invention is applied. A specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0174] The processor 402 is used to run a computer program 4032 stored in the memory to perform the following steps:
[0175] In response to the user's first input, obtain the structured elements of the question from the first input;
[0176] The structured elements are extracted according to a preset business term enumeration table to obtain a first field set, which includes multiple first candidate fields.
[0177] The first field set is enumerated and aligned according to the preset business term enumeration table to obtain the target field set. The target field set includes a first candidate field whose matching degree with the enumerated fields in the preset business term enumeration table is higher than the preset matching degree.
[0178] Multiple second candidate fields are obtained according to a preset recall strategy;
[0179] Update the target field set with the plurality of second candidate fields;
[0180] Perform field matching on each candidate field in the updated target field set to obtain the second field set;
[0181] Perform fuzzy matching on the second field set to obtain the target enumeration value combination;
[0182] A CDL is generated based on the combination of the target enumeration values. The CDL includes the constraints of the problem, the rules for combining the enumeration values, and the range of answers.
[0183] It should be understood that, in this embodiment of the invention, the processor 402 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0184] It will be understood by those skilled in the art that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program includes program instructions and can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiments of the above methods.
[0185] Therefore, the present invention also provides a computer-readable storage medium. This computer-readable storage medium stores a computer program, wherein the computer program includes program instructions. When executed by a processor, the program instructions cause the processor to perform the following steps:
[0186] In response to the user's first input, obtain the structured elements of the question from the first input;
[0187] The structured elements are extracted according to a preset business term enumeration table to obtain a first field set, which includes multiple first candidate fields.
[0188] The first field set is enumerated and aligned according to the preset business term enumeration table to obtain the target field set. The target field set includes a first candidate field whose matching degree with the enumerated fields in the preset business term enumeration table is higher than the preset matching degree.
[0189] Multiple second candidate fields are obtained according to a preset recall strategy;
[0190] Update the target field set with the plurality of second candidate fields;
[0191] Perform field matching on each candidate field in the updated target field set to obtain the second field set;
[0192] Perform fuzzy matching on the second field set to obtain the target enumeration value combination;
[0193] A CDL is generated based on the combination of the target enumeration values. The CDL includes the constraints of the problem, the rules for combining the enumeration values, and the range of answers.
[0194] The storage medium can be any computer-readable storage medium capable of storing program code, such as a USB flash drive, portable hard drive, read-only memory (ROM), magnetic disk, or optical disk.
[0195] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0196] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of each unit is merely a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.
[0197] The steps in the method of this invention can be adjusted, merged, or reduced in order according to actual needs. The units in the device of this invention can be merged, divided, or reduced according to actual needs. Furthermore, the functional units in the various embodiments of this invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0198] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present 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 storage medium and includes several instructions to cause a computer device (which may be a personal computer, a terminal, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
[0199] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. An intelligent question-answering optimization method, characterized in that, include: In response to the user's first input, obtain the structured elements of the question from the first input; The structured elements are extracted according to a preset business terminology enumeration table to obtain a first field set, which includes multiple first candidate fields; the preset business terminology enumeration table includes dimension terms, indicator terms, time expressions, dimension dictionary table, indicator repository and time template library; The first field set is enumerated and aligned according to the preset business term enumeration table to obtain the target field set. The target field set includes a first candidate field whose matching degree with the enumerated fields in the preset business term enumeration table is higher than the preset matching degree. Multiple second candidate fields are obtained according to a preset recall strategy; Update the target field set with the plurality of second candidate fields; The step of obtaining multiple second candidate fields according to a preset recall strategy includes at least one of the following methods: performing vector similarity retrieval on the target term mapping table according to a vector similarity retrieval strategy to obtain multiple second candidate fields; or, obtaining multiple second candidate fields based on tree retrieval and keyword root matching on the target term mapping table. Multiple second candidate fields are obtained based on the frequency of field access; or, second candidate fields that meet common grouping criteria are determined from the target field set, and dimension labels are set; wherein, the common grouping criteria are that the field has been grouped by at least once; Perform field matching on each candidate field in the updated target field set to obtain the second field set; Perform fuzzy matching on the second field set to obtain the target enumeration value combination; Based on the combination of the target enumeration values, a constraint definition language (CDL) is generated, which includes the constraints of the problem, the rules for combining enumeration values, and the range of answers. Based on the large model, the CDL is converted into SQL query text, and SQL query results based on the SQL query text are obtained; Calculate the query path score based on the SQL query results and user feedback information, and optimize the SQL query text and field click sequence based on the path score.
2. The method according to claim 1, characterized in that, The step of enumerating and aligning the first field set according to the preset business term enumeration table includes: Based on the fuzzy matching strategy, a first mapping relationship is obtained, which includes the mapping relationship between a first candidate field whose edit distance is greater than a preset threshold and an enumerated field. Based on the basic matching strategy, each first candidate field in the first field set is mapped to the enumeration fields in the preset business term enumeration table to obtain the second mapping relationship; Based on the expansion strategy, synonyms for each first candidate field are obtained, and a synonym network for the first candidate field is obtained based on the synonyms. Based on the first mapping relationship, the second mapping relationship, and the synonym network, a target term mapping table is obtained.
3. The method according to claim 1, characterized in that, The terminology extraction of the structured elements according to the preset business terminology enumeration table yields a first field set, including: The structured elements are matched with the dimension terms, the indicator terms, the time expressions, the dimension dictionary, the indicator repository, and the time template library to extract first candidate fields from the first input that match the enumeration fields of multiple dimensions in the preset business term enumeration table, thus obtaining the first field set.
4. The method according to any one of claims 1-3, characterized in that, The step of obtaining the structured elements of the problem from the first input includes: Extract key issue elements from the first input; select a target standard terminology template that semantically matches the key issue elements; The problem elements are transformed into standard terms according to the target standard terminology template to obtain the structured elements.
5. The method according to claim 4, characterized in that, The step of performing field matching on each candidate field in the updated target field set to obtain a second field set includes: The fusion score of the target candidate fields is calculated separately. The fusion score is obtained by weighting the semantic similarity score, field access frequency score, retrieval hit distribution and correctness score of the grouping dimension of the target candidate fields. The target candidate fields are the first candidate field and the second candidate field in the updated first field set. Sort each target candidate field according to the size of the fusion score; Add the target candidate field whose fusion score is greater than the preset score to the candidate field set; The weights of each target candidate field in the candidate field set are adjusted based on the user's selection to obtain the second field set.
6. The method according to claim 5, characterized in that, The step of performing fuzzy matching on the second field set to obtain the target enumeration value combination includes: Determine the target field containing the enumerated values from the second field set; An enumeration cluster analysis is performed on the target field to obtain the enumeration value combination.
7. An intelligent question-answering optimization device, characterized in that, include: The input / output unit is used to receive the user's initial input. The processing unit is configured to, in response to a first input received by the input / output unit, obtain structured elements of the problem from the first input; The structured elements are extracted according to a preset business term enumeration table to obtain a first field set, which includes multiple first candidate fields; the first field set is enumerated and aligned according to the preset business term enumeration table to obtain a target field set, which includes first candidate fields whose matching degree with the enumerated fields in the preset business term enumeration table is higher than a preset matching degree. Multiple second candidate fields are obtained according to a preset recall strategy; The plurality of second candidate fields are updated to the target field set; the step of obtaining the plurality of second candidate fields according to the preset recall strategy includes at least one of the following methods: performing vector similarity retrieval on the target term mapping table according to the vector similarity retrieval strategy to obtain the plurality of second candidate fields; or, obtaining the plurality of second candidate fields based on tree retrieval and keyword root matching on the target term mapping table. Multiple second candidate fields are obtained based on the frequency of field access; or, second candidate fields that meet common grouping criteria are determined from the target field set, and dimension labels are set; wherein, the common grouping criteria are that the field has been grouped by at least once; The processing unit is further configured to perform field matching on each candidate field in the updated target field set to obtain a second field set; perform fuzzy matching on the second field set to obtain a combination of target enumeration values; and generate a CDL based on the combination of target enumeration values, wherein the CDL includes the constraints of the problem, the combination rules of the enumeration values, and the range of answers.
8. A computer device, characterized in that, The computer device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the intelligent question-answering optimization method as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, the computer program including program instructions, which, when executed by a processor, can implement the intelligent question-answering optimization method as described in any one of claims 1-6.
Citation Information
Patent Citations
Database table recall method, device and system and storage medium
CN119357220A