Natural language number checking method and device and electronic equipment

By using a multi-stage pipeline processing approach, the natural language query problem is decomposed into steps such as intent recognition, query rewriting, and process orchestration. This solves the problem of insufficient understanding of complex business scenarios in existing technologies, and achieves high-accuracy data query and visualization result generation, making it suitable for industry scenarios with high data accuracy requirements.

CN121350071AActive Publication Date: 2026-01-16LONGSHINE TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511895669.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-16
Publication Date
2026-01-16
Estimated Expiration
2045-12-16

AI Technical Summary

Technical Problem

Existing natural language lookup systems are unable to handle complex business scenarios, especially in the highly specialized energy and power industry, and suffer from problems such as insufficient understanding of ambiguous and complex intentions, lack of decomposition and planning capabilities, superficial application of domain knowledge, and a disconnect between visualization results and user analysis intentions.

Method used

A multi-stage pipeline processing approach is adopted to decompose the natural language query problem into four stages: intent recognition, query rewriting, annotation injection, process orchestration, and intelligent graph generation. Through a progressive approach, the natural language query input by the user is transformed into a clear and executable analysis task, including intent classification, standardized query generation, structured execution plan of multiple atomic tasks, and final visualization chart generation.

Benefits of technology

It significantly improves the accuracy of complex queries, ensures a precise understanding of user intent, deeply integrates knowledge from the power sector, and generates data visualization charts that closely match user analytical intent, providing valuable business insights.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121350071A_ABST
    Figure CN121350071A_ABST
Patent Text Reader

Abstract

The invention provides a natural language number checking method and device and electronic equipment, and relates to the technical field of data processing, the method comprises the following steps: receiving a natural language query character string of a user, performing intention recognition on the query character string based on a preset intention system, and outputting an intention classification result of the user, the intention classification result being expressed by a unique intention code; based on the intention classification result, the query character string and a professional noun library, performing query rewriting on the query character string, and outputting a standardized query; and performing link arrangement on a natural language number checking task corresponding to the natural language query character string based on the standardized query and the intention classification result, generating an execution plan comprising a plurality of atomic tasks, and executing the plan to obtain a data result set. According to the method, the accuracy of complex query is remarkably improved, and the method can be reliably applied to industry scenes with relatively high requirements on data precision.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, and in particular to a natural language query method and device and electronic equipment. BACKGROUND

[0002] With the development of big data and artificial intelligence technology, the natural language database interface (NLIDB) technology, which aims to enable business personnel without professional technical background to directly query and analyze data through natural language, has become a hot topic in the industry.

[0003] The current mainstream natural language query system usually adopts a "end-to-end" processing mode in its technical solution. After receiving the user's natural language question, this mode attempts to convert it into the final executable machine instruction, such as a structured query language (SQL) query statement, in one or two steps. Specifically, these systems usually include the following technologies: 1. Basic natural language processing (NLP): the system first parses the user's input question, and uses technologies such as intent recognition and entity extraction to understand the user's basic needs. For example, in processing the question "query the electricity consumption of A region", the system will identify the query intent and key entities such as "A region" and "electricity consumption". 2. Retrieval augmented generation (RAG): in order to improve the accuracy of the query, some more advanced systems introduce RAG technology. This technology will retrieve relevant database table structure information (schema) from a knowledge base according to the keywords in the user's original question before generating the final query instruction, and provide these information as context to the large language model (LLM) to assist the model to generate a query statement that is more consistent with the actual situation of the database.

[0004] Although the existing technology has made certain progress in simplifying data queries, its "end-to-end" processing mode cannot complete analysis tasks that require multi-step reasoning when dealing with real and complex business scenarios, especially in the highly professional energy and power industry. Therefore, an effective solution is urgently needed to solve the above technical problems. SUMMARY

[0005] In view of the deficiencies in the prior art, the natural language search method, device and electronic equipment provided by the application decompose and plan the fuzzy and complex natural language query problem, systematically convert it into a clear, accurate and executable analysis task through a step-by-step progressive manner, and gradually and systematically convert the natural language sentence input by the user into an accurate data result set, thereby significantly improving the accuracy of complex queries and reliably applying to industry scenarios with high data precision requirements.

[0006] In a first aspect, the application provides a natural language search method, which comprises the following steps: Receiving a natural language query string of a user, performing intent recognition on the natural language query string based on a preset intent system, and outputting an intent classification result of the user; the intent classification result is represented by a unique intent code; Based on the intent classification result, the natural language query string and a professional term library, rewriting the natural language query string, and outputting a standardized query; Based on the standardized query and the intent classification result, arranging the natural language search task corresponding to the natural language query string, generating a structured execution plan comprising a plurality of atomic tasks, and executing the structured execution plan to obtain a data result set; the arrangement of the natural language search task corresponding to the natural language query string based on the standardized query and the intent classification result, the generation of the structured execution plan comprising a plurality of atomic tasks, comprises: taking the standardized query as a keyword, performing semantic retrieval in an electric power domain vector knowledge base to obtain domain context information corresponding to the standardized query; performing information enhancement on the standardized query based on the domain context information, generating a labeled query comprising the domain context information; arranging the natural language search task corresponding to the natural language query string based on the labeled query, the intent classification result and the relevant business rules in the domain context information, and generating the structured execution plan; the labeled query contains the standardized query and all retrieved business context information related to the standardized query, and the relevant business rules include statistical indicators, professional classification and data sources.

[0007] According to the natural language search method provided by the application, the preset intent system comprises a preset intent system or a specified intent system; the intent recognition on the natural language query string based on the preset intent system and the output of the intent classification result of the user comprises: The natural language query string is matched in the preset intent system or the specified intent system to obtain a structured intent object including at least one classification code; wherein the intent recognition supports a single-intent mode or a multi-intent mode. Based on the structured intent object, a prompt word is dynamically generated, and the structured intent object and the corresponding prompt word are determined as the intent classification result.

[0008] According to the natural language search method provided by the application, based on the intent classification result, the natural language query string and the professional term library, the natural language query string is rewritten, and a normalized query is output, including: Based on the natural language query string, a current time context is determined; Based on the current time context and a preset time term library, a relative time expression in the natural language query string is converted into an absolute time range to obtain normalized time information; Based on the professional term library, a professional term in the natural language query string is synonym-mapped and concept-disambiguated to obtain recall term information related to the natural language query string; the professional term library includes a synonym set of the professional term and a thinking process annotation for explaining the difference between the professional term and the synonym; The recall term information, the normalized time information and a historical dialogue context are engineered and arranged through a preset template to generate the normalized query represented in a structured format.

[0009] According to the natural language search method provided by the application, the domain context information includes database table structure information, term set annotation, index definition, the related business rules and annotated samples.

[0010] According to the natural language search method provided by the application, based on the annotated query and the intent classification result, a natural language search task corresponding to the natural language query string is arranged in a link to generate a structured execution plan, including: Based on the intent of the annotated query and the related business rules, the natural language search task is decomposed into a plurality of atomic tasks, and a dependent upper-level atomic task is specified for each atomic task; According to the dependency relationship between each atomic task, each atomic task is organized into a directed acyclic graph (DAG), and the DAG is determined as the structured execution plan; wherein the nodes of the DAG represent the atomic tasks, and the edges of the DAG represent the dependency relationship between the atomic tasks.

[0011] According to the natural language searching method provided by the application, the method further comprises: generating a visual chart based on the data result set, the intent classification result and the structured execution plan; automatically generating a text result of natural language analysis based on the visual chart; the text result represents a natural language summary corresponding to key features of the data result set.

[0012] According to the natural language searching method provided by the application, the method further comprises: judging the data amount of the data result set; in the case that the data amount is less than a preset threshold, directly generating a corresponding visual chart configuration based on the data result set, the intent classification result and the structured execution plan by a model in a free generation or template generation manner; in the case that the data amount is greater than or equal to the preset threshold, performing data aggregation to obtain aggregated data, or sampling code and performing aggregation processing on the data result set based on the code to obtain the aggregated data; generating the visual chart based on the visual chart configuration, the aggregated data, the data result set, the intent classification result and the structured execution plan.

[0013] According to the natural language searching method provided by the application, the method further comprises: assigning an appropriate chart type to the data result set according to the intent type identified in the intent classification result and the structured execution plan; generating the visual chart based on the appropriate chart type and automatically marking data abnormal points or abnormal intervals in the visual chart.

[0014] In a second aspect, the application further provides a natural language searching device, which comprises the following modules: an intent classification module, configured to receive a natural language query string of a user, perform intent recognition on the natural language query string based on a preset intent system, and output an intent classification result of the user; the intent classification result is represented by a unique intent code; a query rewriting module, configured to perform query rewriting on the natural language query string based on the intent classification result, the natural language query string and a professional term library, and output a standardized query; The link arrangement and execution module is configured to arrange a natural language query task corresponding to the natural language query string based on the normalized query and the intent classification result, generate a structured execution plan including a plurality of atomic tasks, and execute the structured execution plan to obtain a data result set. The link arrangement and execution module is specifically configured to perform semantic retrieval in an electric power domain vector knowledge base by taking the normalized query as a keyword to obtain domain context information corresponding to the normalized query. The normalized query is information-enhanced based on the domain context information to generate a labeled query including the domain context information. The natural language query task corresponding to the natural language query string is arranged based on the labeled query, the intent classification result, and relevant business rules in the domain context information to generate the structured execution plan. The labeled query includes the normalized query and all retrieved business context information related to the normalized query, and the relevant business rules include statistical standards, professional classification, and data sources.

[0015] In a third aspect, the present application further provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor executes the computer program to implement the natural language query method according to any one of the above.

[0016] In a fourth aspect, the present application further provides a non-transitory computer readable storage medium, which stores a computer program executable by a processor to implement the natural language query method according to any one of the above.

[0017] In a fifth aspect, the present application further provides a computer program product, which includes a computer program executable by a processor to implement the natural language query method according to any one of the above.

[0018] The natural language query method, device and electronic equipment provided by the application first receive a natural language query string of a user, perform intent recognition on the query string based on a preset intent system, output an intent classification result of the user, and represent the intent classification result by a unique intent code; then, based on the intent classification result, the query string and a professional term library, perform query rewriting on the query string, and output a normalized query; further, based on the normalized query and the intent classification result, perform link arrangement on a natural language query task corresponding to the natural language query string, generate a structured execution plan including a plurality of atomic tasks, and execute the plan to obtain a data result set; based on the normalized query and the intent classification result, perform link arrangement on the natural language query task corresponding to the natural language query string, generate a structured execution plan including a plurality of atomic tasks, including: performing semantic retrieval in a power domain vector knowledge base by taking the normalized query as a keyword, to obtain domain context information corresponding to the normalized query; performing information enhancement on the normalized query based on the domain context information, to generate an annotated query including the domain context information; based on the annotated query, the intent classification result and relevant business rules in the domain context information, performing link arrangement on the natural language query task corresponding to the natural language query string, to generate a structured execution plan; the annotated query contains the normalized query and all retrieved business context information related to the normalized query.

[0019] The application provides an innovative natural language query method, which is in a pipeline processing mode, logically decomposes and plans a fuzzy and complex natural language query problem, and systematically converts the problem into a clear, accurate and executable analysis task in a step-by-step manner, so that the natural language sentence input by the user is gradually and systematically converted into an accurate data result set, thereby significantly improving the accuracy of complex queries and reliably applying to industry scenarios with high requirements for data accuracy. BRIEF DESCRIPTION OF DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the application or the prior art, the following will briefly introduce the drawings needed in the embodiments or the prior art description. Obviously, the drawings in the following description are some embodiments of the application, and those skilled in the art can also obtain other drawings according to these drawings without creative labor.

[0021] Figure 1 is one of the flowcharts of the natural language query method provided by the application.

[0022] Figure 2 is the second flowchart of the natural language query method provided by the application.

[0023] Figure 3is a structural schematic diagram of a natural language query device provided by the application.

[0024] Figure 4 is a structural schematic diagram of an electronic device provided by the application. DETAILED DESCRIPTION

[0025] In order to make the objects, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be described clearly and completely below in combination with the drawings in the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the protection scope of the present application.

[0026] In order to more clearly understand the embodiments provided by the present application, first, the technical content related to the present application is introduced as follows: Although the prior art has made certain progress in simplifying data query, the "end-to-end" processing mode thereof exposes the following core defects when coping with real and complex business scenarios, especially in the energy and power industry with strong professionalism: 1. Insufficient understanding ability for ambiguous and complex intentions: natural language itself is full of ambiguity. The existing system directly processes the original and colloquial question of the user. When the question contains ambiguous terms (such as "five standards and seven rates" and "high-loss area" in the power industry) or complex analysis intentions (such as "compare and analyze the difference in line loss rate between A and B power supply companies last month"), the system is prone to have understanding deviation in the first step. This small error in the initial stage will be amplified in the subsequent processing, and finally lead to the generation of completely wrong query results.

[0027] 2. Lack of decomposition and planning ability for natural language query task: real business analysis is often not a single query action, but a combination of multiple logical steps. For example, to answer "why did the electricity recovery rate in a certain area decrease last month?", the system needs to query the electricity recovery rate of the current and past periods first, then query the possible related user payment details, fee collection records, etc., and finally perform comparative analysis. The existing "end-to-end" system lacks the mechanism for logical decomposition and step planning for such complex problems, and cannot complete the analysis task requiring multiple reasoning steps.

[0028] 3. The application of domain knowledge is superficial, leading to the "illusion" problem: standard RAG technology usually only retrieves the physical structure information of the database, ignoring the deep business logic and industry knowledge behind it. For example, the system may know that "line loss rate" is a field, but it does not know its calculation formula, business scope, and normal fluctuation range. In addition, directly using the user's vague original question for retrieval often returns irrelevant or incorrect context information because the keywords are not accurate, that is, "garbage in, garbage out", which will exacerbate the "illusion" of large language models and generate logically inconsistent queries.

[0029] 4. The visualization result is disconnected from the user's analysis intention: in existing technologies, chart generation is usually a separate step after data query. Since the user's original analysis intention (such as whether to "compare trends" or "view distribution") has been lost during the processing, the system can only "guess" the appropriate chart type based on the structure of the returned data table. This often leads to the generation of charts that cannot effectively answer the user's questions, such as using a pie chart to show time trends or using a scatter plot to compare categorical data, making the visualization result lack insight.

[0030] The purpose of the present application is to overcome the above-mentioned defects of the prior art and provide a brand-new natural language query method, device and electronic equipment. The natural language query method is implemented based on a multi-stage pipeline processing mode. The present application aims to achieve the following objectives by dividing a complex natural language understanding and analysis task into five stages: intention recognition, query rewriting, annotation injection, link arrangement, and intelligent chart generation. 1. Systematically eliminate the ambiguity of natural language to ensure accurate understanding of the user's true intention; 2. Implement logical decomposition and planning for complex analysis and diagnosis problems; 3. Deeply integrate power domain knowledge to ensure that the query process conforms to industry business logic and reduces errors; 4. Make the final generated data visualization chart closely match the user's original analysis intention and provide truly valuable business insights.

[0031] The natural language query method, device and electronic equipment of the present application will be described below. Figures 1-4 The natural language query method, device and electronic equipment of the present application will be described below.

[0032] Figure 1 is one of the flowcharts of the natural language query method provided by the present application, as shown in Figure 1 The method comprises the following steps: Step 101, receiving the user's natural language query string, performing intention recognition on the query string based on the preset intention system, and outputting the intention classification result of the user; the intention classification result is represented by a unique intention code.

[0033] Specifically, it needs to be explained that the execution subject of the embodiment is an electronic device, which is used to gradually and systematically convert the natural language sentence input by the user into an accurate data result set, thereby significantly improving the accuracy of complex queries and can be reliably applied to industry scenarios with high requirements for data precision (such as the power industry).

[0034] First, the original input of the user is received, and the original input of the user is preliminarily analyzed to understand the core analysis target and uniquely classify the problem into a preset classification system, that is, an intention classification result is obtained.

[0035] Among them, the original input of the user is the natural language query string of the user, for example, the power marketing personnel may ask: "Analyze the power supply unit in a certain place last quarter. Is there any abnormality in the power sales volume?" The preset intention system is pre-built based on historical intention classification results, or pre-built based on user-specified intention classification results. Each classification code in the preset intention system represents a different intention classification (that is, intention name), and corresponds to one or more similar questions, which represent the historical query string under the classification.

[0036] After matching the natural language query string of the user in the preset intention system to the corresponding similar question, the last layer classification code (the most fine-grained classification code) is recalled, that is, the intention classification result of the user is output.

[0037] Step 102, based on the intention classification result, the query string and the professional term library, the query string is rewritten, and the standardized query is output.

[0038] After the intention classification result is obtained by intention recognition, the next step is to eliminate the ambiguity of the language and convert the query string into a standardized query that the machine can accurately understand. The standardization processing steps include: regular preprocessing, multi-source retrieval and template enhancement, context arrangement, time and noun disambiguation, etc.

[0039] Specifically, each step is briefly introduced as follows: Regularization preprocessing: performing regular substitution on the question; retaining professional terms and their relative positions; concatenating historical dialogues into context.

[0040] Multi-source retrieval and template enhancement: parallel retrieval of nouns / organizations / dimensions / indicators, unified deduplication and merged according to source quota; fallback to single source or rule retrieval when multi-source fails; perform output and intermediate process quality check on template examples.

[0041] Time and noun disambiguation: disambiguation through synonym and explanation information in the professional noun library (noun set); derive complex time window (such as year granularity cross period mapping) according to the agreed rules; keep the date granularity consistent.

[0042] Context arrangement: unified injection of current time, historical context, noun and template recall segment and notes, output machine readable format; intermediate reasoning information can be selected to return for explanation.

[0043] For example, based on the intent classification result, the query string and the professional noun library, the query string is rewritten, and the normalized query is output.

[0044] Step 103, based on the normalized query and the intent classification result, the natural language query string corresponding to the natural language query task is arranged, a structured execution plan including a plurality of atomic tasks is generated, and the structured execution plan is executed to obtain a data result set; based on the normalized query and the intent classification result, the natural language query string corresponding to the natural language query task is arranged, a structured execution plan including a plurality of atomic tasks is generated, including: taking the normalized query as a keyword, performing semantic retrieval in the power domain vector knowledge base to obtain the domain context information corresponding to the normalized query; based on the domain context information, the normalized query is enhanced, and a labeled query including the domain context information is generated; based on the labeled query, the intent classification result and the related business rules in the domain context information, the natural language query string corresponding to the natural language query task is arranged, and a structured execution plan is generated; the labeled query contains the normalized query and all the retrieved business context information related to the normalized query, and the related business rules include statistical indicators, professional classification and data sources.

[0045] Specifically, after obtaining the normalized query and the intent classification result, before executing the natural language query task, the complex analysis task (natural language query task) is first decomposed into a series of logical clear and executable atomic steps (i.e. generating an execution plan of a plurality of atomic tasks). This execution plan is a logical blueprint independent of the specific query language, which clearly defines "what to do" and "in what order to do", and converts complex analysis logic into a sequence of steps that can be understood and executed by machines.

[0046] Exemplarily, the specific steps of the segment arrangement include the following: Input: normalized query.

[0047] Processing: according to the intent classification result (such as "analysis and diagnosis") and the injected business rules, a macro analysis task is decomposed into a plurality of atomic problems with logical dependency relationship. The arrangement process supports timeout, retry and degradation strategy at node level, and supports combination of pre-set templates and custom nodes.

[0048] Output: A structured execution plan, usually represented as a Directed Acyclic Graph (DAG).

[0049] For the above example, the generated execution plan may contain the following atomic tasks: 1. Atomic task 1.1: Query the total electricity sales of a certain power supply unit in April 2024.

[0050] 2. Atomic task 1.2: Query the total electricity sales of a certain power supply unit in May 2024.

[0051] 3. Atomic task 1.3: Query the total electricity sales of a certain power supply unit in June 2024.

[0052] 4. Atomic task 2 (analysis task 2) (dependent on 1.1, 1.2, 1.3): Merge the results of the above three atomic tasks, calculate the monthly growth rate, and according to the injected business rules, judge and mark the abnormal months.

[0053] In an embodiment of the present application, the link arrangement is implemented through the following steps: First, through Retrieval Augmented Generation (RAG) technology, inject rich and structured power field knowledge and annotated assets into the standardized query to obtain an annotated query. Exemplarily, this process includes: Input: Standardized query; Process: ① Take the standardized query as a keyword and perform semantic retrieval in a pre-constructed power field vector knowledge base to obtain the domain context information corresponding to the standardized query.

[0054] Among them, this knowledge base not only contains table structure information of the database, but also stores: Noun set annotation: general, dimension, organization, index term and its synonym / abbreviation mapping.

[0055] Index definition and related business rules: such as statistical caliber, professional classification, data source, etc.

[0056] Corpus template annotation: templates and examples of intent recognition, query rewriting, question decomposition, slot extraction, general Application Programming Interface (API), SQL generation, etc.

[0057] Annotated samples: high-quality samples and versions deposited by the annotation platform.

[0058] Correspondingly, the retrieved standardized query corresponding to the domain context information includes corresponding database table structure information, noun set annotation, index definition, related business rules and annotated samples.

[0059] ②Based on the domain context information, the information of the standardized query is enhanced to generate an annotated query including domain context information.

[0060] Output: "annotated query" object. The object contains the standardized query and all the retrieved related business context information, providing a complete knowledge base for subsequent complex logic planning.

[0061] Further, based on the annotated query and the intent classification result, the natural language query string corresponding to the natural language query task is arranged, and an execution plan is generated, that is, the complex analysis task is decomposed into multiple atomic steps, and there is a dependency relationship between each atomic step.

[0062] The method provided by the embodiment first receives a natural language query string of a user, performs intent recognition on the query string based on a preset intent system, outputs an intent classification result of the user, and the intent classification result is represented by a unique intent code. Then, based on the intent classification result, the query string and the professional noun library, the query string is rewritten to output a standardized query; further, based on the standardized query and the intent classification result, the natural language query string corresponding to the natural language query task is arranged, and an execution plan including multiple atomic tasks is generated, and the execution plan is executed to obtain a data result set; based on the standardized query and the intent classification result, the natural language query string corresponding to the natural language query task is arranged, and a structured execution plan including multiple atomic tasks is generated, including: taking the standardized query as a keyword, performing semantic retrieval in the power domain vector knowledge base to obtain the domain context information corresponding to the standardized query; based on the domain context information, the information of the standardized query is enhanced to generate an annotated query including the domain context information; based on the annotated query, the intent classification result and the related business rules in the domain context information, the natural language query string corresponding to the natural language query task is arranged, and a structured execution plan is generated; the annotated query contains the standardized query and all the retrieved related business context information of the standardized query, and the related business rules include statistical indicators, professional classification and data sources.

[0063] The application provides an innovative natural language query method, which is a pipeline processing method, logically decomposes and plans a fuzzy and complex natural language query problem, and systematically converts the problem into a clear, accurate and executable analysis task through a step-by-step progressive manner, so that the natural language sentence input by the user is gradually and systematically converted into an accurate data result set, thereby significantly improving the accuracy of complex queries and reliably applying to industry scenarios with high data accuracy requirements.

[0064] According to the natural language query method provided by the application, the preset intention system includes a preset intention system or a specified intention system; intention recognition is performed on the natural language query string based on the preset intention system, and an intention classification result of the user is output, including: The natural language query string is matched in the preset intention system or the specified intention system to obtain a structured intention object including at least one classification code; wherein the intention recognition supports a single-intention mode or a multi-intention mode; The structured intention object and the corresponding prompt word are determined as the intention classification result based on the structured intention object.

[0065] Specifically, in some embodiments, the process of intention recognition in step 101 is realized by the following steps: The preset intention system, for example, a historical standard intention tree, is classified based on the historical standard intention tree, and the last layer priority and unique numbering rule is followed; the labeled cases in the recall case library are preferentially followed to ensure consistency and traceability. The construction process of the preset intention system is as follows: 1. Classification judgment and last layer subdivision: first determine the major category (query / answer / navigation / ...) and then refine to the last layer code.

[0066] 2. Similar problem comparison and code matching: compare with the recalled similar problems and labeled samples to ensure consistency with history.

[0067] 3. Output specification: the intention recognition supports a single-intention mode or a multi-intention mode, the single-intention mode returns only one most matched intention number, and the multi-intention mode returns multiple numbers if the problem meets multiple intentions.

[0068] The specified intention system supports loading a user-specified intention system (such as a special topic / query) according to a project or a scene, and the matching is preferentially performed in the range of the specified system compared with the preset system, that is, if the user specifies an intention, the specified system is preferentially used for matching; the last layer priority, unique numbering and machine-readable output requirements still need to be met, and the global code can be mapped back to facilitate statistics and operation and maintenance.

[0069] The query string is matched in the preset intent system or the specified intent system, so that the query string corresponds to a structured intent object including at least one classification code. For example, the structured intent object includes a unique or multiple classification code, an intent name, and the structured intent object is used to drive subsequent link arrangement, permission verification and index statistics.

[0070] After the structured intent object is determined, a prompt word is dynamically generated based on the structured intent object. For example, the structure of the prompt word is automatically constructed based on the intent list, and the single / multiple classification and machine reading output format are switched as needed; whether to return intermediate reasoning information is configurable.

[0071] Further, the structured intent object with at least one classification code and the corresponding prompt word are determined as an intent classification result.

[0072] Optionally, the intent recognition process also supports the following mechanisms: Template recall and conditional generalization: select template types according to different modes, and filter in combination with context ranges; when the recall is empty, perform conditional generalization (such as shielding part of the limit or falling back to the previous intent).

[0073] Output extraction and analysis: extract intermediate reasoning and final results according to a preset intent classification system; multiple classifications are parsed according to separators and code values and names are retained; and a single classification returns a unique result.

[0074] Timeout and fault tolerance: a unified call mechanism with timeout control is adopted, and stage time delay is recorded; timeout, connection and internal exceptions are classified and processed.

[0075] Pluggable retrieval backend: supports custom collection and range control; performs parallel retrieval, rearrangement, deduplication and quota-based merging on multiple source results.

[0076] The method provided by the embodiment performs preliminary analysis on the original input of the user to understand the core analysis target and uniquely classifies the problem into a preset intent classification system to determine an intent classification result, systematically eliminates the ambiguity of natural language, ensures accurate understanding of the real intent of the user, and then performs subsequent query rewriting, link arrangement, plan execution and the like based on the intent classification result. A fuzzy and complex natural language query problem is systematically converted into a clear, accurate and executable analysis task through progressive conversion, so that the natural sentence input by the user is gradually and systematically converted into an accurate data result set, thereby significantly improving the accuracy of complex queries and reliably applied to industry scenarios with high data precision requirements.

[0077] According to the natural language query method provided by the application, based on the intent classification result, the query string and the professional term library, the query string is rewritten, and a standardized query is output, including: determine a current time context based on the query string; convert relative time expressions in the query string into absolute time ranges based on the current time context and a preset time noun library, to obtain normalized time information; perform synonym mapping and concept disambiguation on the professional nouns in the query string based on a professional noun library, to obtain recall noun information related to the query string; the professional noun library includes a synonym set of the professional nouns and a thinking process annotation for explaining differences between the professional nouns and the synonyms; engineer the recall noun information, the normalized time information, and the historical dialogue context through a preset template, to generate a normalized query represented in a structured format.

[0078] Specifically, in some embodiments, the step 102 query rewriting is implemented through the following steps, including: input: the original query of the user, i.e., the intent classification result of the first stage.

[0079] processing, including sub-steps 1-3: 1. Time normalization: determine a current time context based on the query string; convert relative time expressions in the query string into absolute time ranges based on the current time context and a preset time noun library (i.e., a recall time noun library), to obtain normalized time information.

[0080] The relative time expressions are, for example, relative times such as “yesterday / last month / last quarter / last year same period”. The absolute time range is, for example, “[YYYY year 1 month 1 day, YYYY year 12 month 31 day]”. The relative time expressions in the query string are converted into formatted and normalized time. That is, the present application supports deriving complex time windows according to rules.

[0081] 2. Professional noun standardization and disambiguation: perform synonym mapping and concept disambiguation on the professional nouns in the query string based on a professional noun library, to obtain recall noun information related to the query string.

[0082] The professional nouns are, for example, organizations, indicators, dimensions, and professional terms. The professional noun library includes a synonym set of the professional nouns and a thinking process annotation for explaining differences between the professional nouns and the synonyms. The differences (e.g., “new unit” and “new running unit” are not the same concept) are explicitly annotated through the “synonym + thinking process” annotation of the professional noun library (noun set), and the explanation in the annotation is preferred.

[0083] 3. Semantic preservation and completion: no subjective information is added; when key elements are missing, the historical dialogue is preferred to complete; if still uncertain, placeholders are retained but not invented; if necessary, the "thinking process" is provided as a high-weight context to the model to stabilize the rewriting result.

[0084] Further, the recalled noun information, the normalized time information and the historical dialogue context are engineered and arranged through a preset template to generate a normalized query represented in a structured format such as XML.

[0085] Output: a normalized, unambiguous and directly executable internal query expression (normalized query) that meets the format constraints such as being wrapped in an XML tag.

[0086] Optionally, the query rewriting process further includes the steps of vector recall and template enhancement: Noun vector recall: preferentially using vector library retrieval (supporting the limitation of noun set range and workspace effective interval), and falling back to rule retrieval when failing; Template recall: retrieving and injecting rewriting templates according to the conversation type / intention; Context engineering arrangement: template enhancement information is engineered and optimized and uniformly injected to output a machine-readable output wrapped in an Extensible Markup Language (XML) package.

[0087] The method provided by the embodiment first determines the current time context based on the query string; converts the relative time expression in the query string into an absolute time range based on the current time context and a preset time noun library to obtain normalized time information; then performs synonym mapping and concept disambiguation on the professional nouns in the query string based on a professional noun library to obtain recalled noun information related to the query string, the professional noun library including a synonym set of the professional nouns and a thinking process annotation for explaining the difference between the professional nouns and the synonyms; and further engineers and arranges the recalled noun information, the normalized time information and the historical dialogue context through a preset template to generate a normalized query represented in a structured format. The embodiment realizes the conversion of a colloquial user input into a normalized query that can be accurately understood by a machine, ensures that the output can be directly used in the subsequent stage, and significantly improves the accuracy of complex queries, which can be reliably applied to industry scenarios with high requirements for data accuracy.

[0088] According to the natural language query method provided by the embodiment, the domain context information includes database table structure information, noun set annotation, index definition, related business rules and annotated samples.

[0089] The method provided by the embodiment first takes the normalized query as a keyword, performs semantic retrieval in the power field vector knowledge base, and obtains the field context information corresponding to the normalized query; then, information enhancement is performed on the normalized query based on the field context information, and an annotated query including the field context information is generated; and further, a natural language query string corresponding to the natural language query task is arranged based on the annotated query and the intent classification result, and an execution plan is generated, so that a complex analysis task is decomposed into a series of logical clear and executable atomic steps, and the natural language question input by the user is gradually and systematically converted into an accurate data analysis result.

[0090] According to the natural language query method provided by the application, the natural language query task corresponding to the natural language query string is arranged based on the annotated query and the intent classification result, and an execution plan is generated, which comprises the following steps: Based on the intent of the annotated query and the related business rules, the natural language query task is decomposed into a plurality of atomic tasks, and the dependent upper-level atomic task is specified for each atomic task. According to the dependency relationship between the atomic tasks, the atomic tasks are organized into a directed acyclic graph (DAG), and the DAG is determined as the execution plan; wherein the nodes of the DAG represent the atomic tasks, and the edges of the DAG represent the dependency relationship between the atomic tasks.

[0091] Specifically, in some embodiments, the specific implementation process of arranging the natural language query task corresponding to the natural language query string based on the annotated query and the intent classification result to generate an execution plan comprises the following steps: First, based on the intent of the annotated query and the related business rules, the natural language query task is decomposed into a plurality of atomic tasks, and the dependent upper-level atomic task is specified for each atomic task.

[0092] The intent of the annotated query can be determined according to the intent classification result, and the intent classification result is, for example, analysis and diagnosis, and the related business rules are pre-injected field business rules, which represent the specific meaning of each atomic task and the dependency relationship between the atomic tasks.

[0093] According to the intent of the query (such as "analysis and diagnosis") and the injected business rules, a macro analysis task (i.e. the natural language query task) can be decomposed into a plurality of atomic problems with logical dependency relationship. The arrangement process supports timeout, retry and degradation strategy at node level, and supports combination of pre-set templates and custom nodes.

[0094] Further, according to the dependency relationship between each atomic task, each atomic task is organized into a directed acyclic graph (DAG), and the DAG is determined as an execution plan. The dependency relationship between each atomic task can be determined according to a related business rule. For example, analyzing the year-on-year growth rate of electricity sales in a quarter needs to query the electricity sales of each month in the quarter.

[0095] The nodes of the DAG represent atomic tasks, and the edges of the DAG represent the dependency relationship between each atomic task. The DAG represents a structured execution plan.

[0096] The method provided by the embodiment first decomposes the natural language query task into a plurality of atomic tasks based on the annotated query intention and the related business rule, and specifies the dependent upper-level atomic task for each atomic task. Then, according to the dependency relationship between each atomic task, each atomic task is organized into a directed acyclic graph (DAG), and the DAG is determined as an execution plan. The application takes the link arrangement module as the core to perform end-to-end pluggable arrangement for complex analysis and diagnosis scenarios. The problem decomposition is a sub-link, which decomposes a macro business problem into atomic tasks with a dependency relationship, and combines other links (rewriting, annotation injection, data retrieval, aggregation, graph formation, etc.) to form an executable process. The application systematically converts a fuzzy and complex natural language query problem into a clear, accurate and executable analysis task through a step-by-step progressive manner.

[0097] According to the natural language query method provided by the application, the method further includes: Based on the data result set, the intention classification result and the execution plan, a visualization chart is generated. Based on the visualization chart, a text result of natural language analysis is automatically generated. The text result represents a natural language abstract corresponding to a key feature of the data result set.

[0098] Specifically, in some embodiments, the method further includes presenting the data query result (data result set) to the user in the most effective and most insightful way, including two paths of "limited data amount adaptive generation" and "large data amount code generation aggregation". The process is achieved through the following steps: Based on the data result set, the intention classification result and the execution plan, a visualization chart is generated. Based on the visualization chart, a text result of natural language analysis is automatically generated. The text result represents a natural language abstract corresponding to a key feature of the data result set.

[0099] For example, input: 1. The data result set returned after executing the link arrangement plan. 2. The original user intention object identified in the first stage. 3. The execution plan (DAG).

[0100] Processing strategy: The system makes intelligent decisions by comprehensively utilizing the intent classification results and DAG context, and adopts different strategies according to the amount of data.

[0101] Output: A comprehensive results interface including visual charts, data facts, insightful analytics, and personalized responses, as shown in the attached image. For example, the system will output a line graph showing the change in electricity sales, with the following text description: "Data shows that the electricity sales of a certain power supply unit in May were XXX million kWh, a month-on-month increase of 25%, showing a significant increase. Preliminary analysis suggests this may be related to the commissioning of a large industrial user that month."

[0102] The method provided in this embodiment, when generating visualizations, not only relies on the final data results, but more importantly, it traces back and utilizes the user's original analytical intent and execution plan captured in the first step of the pipeline. This mechanism ensures that the final chart type and presentation format accurately serve the user's analytical purpose, thereby providing more insightful visualization results.

[0103] According to the natural language data lookup method provided by the present invention, based on a data result set, intent classification results, and execution plan, a visualization chart is generated, including: Determine the size of the data result set; When the amount of data is less than the preset threshold, the model directly generates the corresponding visualization chart configuration based on the data result set, intent classification results and execution plan, using either free generation or template generation methods. If the data volume is greater than or equal to a preset threshold, perform data aggregation to obtain aggregated data; or, sample the code and perform aggregation processing on the data result set based on the code to obtain aggregated data. Visual charts are generated based on the configuration of the visualization chart, the aggregated data, the data result set, the intent classification results, and the execution plan.

[0104] Specifically, in some embodiments, generating a visualization chart based on the data result set, intent classification results, and execution plan can be achieved through the following steps: Generate visualizations according to Strategy 1, which is based on the size of the data set. Step 1: Determine the size of the data result set; Step 2: Compare the size of the data result set with a preset threshold to determine whether the data result set is small, medium, or large. When the data volume is less than the preset threshold: the model directly generates the corresponding visualization chart configuration based on the data result set, intent classification results and execution plan, using either free generation or template generation methods.

[0105] The two chart generation methods for small to medium datasets are: 1. Free generation: Allow the model to freely select a suitable chart based on the data, output a general chart configuration, and perform self-validation; if it fails, return an error to the model for correction until it passes. 2. Template generation: Select the most suitable template from a set of preset templates, generate a general chart configuration, and perform self-validation; if it fails, return an error and iteratively correct until it passes.

[0106] When the data volume is greater than or equal to a preset threshold, a code generation path is adopted. Specifically, data aggregation or sampling code is generated and the data result set is aggregated based on the code to obtain aggregated data; based on the visualization chart configuration or aggregated data, data result set, intent classification results and execution plan, a visualization chart is generated.

[0107] For example: 1. Generate code for data aggregation / sampling / binning to obtain analytical information, rather than directly outputting details. 2. Include background information such as table headers, sample size, and time span in prompts to guide the model in forming reasonable summaries and more coarse-grained visualizations.

[0108] The method provided in this embodiment makes intelligent decisions by comprehensively utilizing the intent classification results and DAG context, and adopts different strategies according to the amount of data. This mechanism ensures that the final chart type and display format can accurately serve the user's analysis purpose, thereby providing more insightful visualization results.

[0109] According to the natural language data lookup method provided by the present invention, based on a data result set, intent classification results, and execution plan, a visualization chart is generated, including: Assign appropriate chart types to the data result set based on the intent types and execution plans identified in the intent classification results; Generate visualization charts based on appropriate chart types, and automatically mark data outliers or outlier ranges in the visualization charts.

[0110] Specifically, in some embodiments, the process of generating visualization charts based on data result sets, intent classification results, and execution plans includes the following steps: First, based on the intent type identified in the intent classification results, an appropriate chart type is assigned to the data result set. That is, the chart type selection is aligned with the intent. If the intent classification results corresponding to the user's input natural language query string identify an intent type, then the appropriate chart type is determined based on that intent type. For example, if the intent type is trend analysis, a line chart is preferred; if the intent type is percentage analysis, a pie chart is preferred.

[0111] Furthermore, visualization charts are generated based on appropriate chart types, and outliers or abnormal intervals are automatically marked on the visualization charts. Simultaneously, standardized natural language summaries are provided.

[0112] The method provided in this embodiment determines the appropriate chart type based on the intent type, and then generates a visualization chart based on the appropriate chart type. This mechanism ensures that the final chart type and display format can accurately serve the user's analysis purpose, thereby providing more insightful visualization results.

[0113] Figure 2 This is the second flowchart of the natural language data lookup method provided by this invention, as shown below. Figure 2 As shown, the method includes: Step 201: Receive the user's natural language query string, perform intent recognition on the query string based on the preset intent system, and output the user's intent classification result; the intent classification result is represented by a unique intent code; Step 202: Determine the current time context based on the query string; Step 203: Based on the current time context and the preset time terminology database, convert the relative time expressions in the query string into absolute time ranges to obtain the normalized time information; Step 204: Based on the professional terminology database, perform synonym mapping and concept disambiguation on the proper nouns in the query string to obtain recall terminology information related to the query string; the professional terminology database contains a set of synonyms for proper nouns and annotations of thought processes used to explain the differences; Step 205: The recalled noun information, normalized time information, and historical dialogue context are engineered and arranged using a pre-set template to generate a normalized query represented in a structured format. Step 206: Use the normalized query as a keyword to perform semantic retrieval in the power domain vector knowledge base to obtain the domain context information corresponding to the normalized query; the domain context information includes database table structure information, noun set annotation, indicator definition, relevant business rules and labeled samples; Step 207: Enhance the normalized query based on domain context information to generate an annotated query that includes domain context information; Step 208: Based on the labeled query and intent classification results, orchestrate the steps of the natural language data lookup task, generate an execution plan, and execute the plan to obtain the data result set; Step 209: Based on the data result set, intent classification results, and execution plan, generate a visualization chart; Step 210: Based on the visualization charts, automatically generate the text results of natural language analysis; the text results represent the natural language summaries corresponding to the key features of the data result set.

[0114] The natural language number query device provided by the present invention will be described below. The natural language number query device described below can be correspondingly referred to the natural language number query method described above.

[0115] Compared with the prior art, the method proposed by the present invention has achieved the following remarkable beneficial effects in the application of professional fields such as energy and power: 1. Greatly improved query accuracy: Through staged corpus injection decoupling and pluggable orchestration, the system can understand the user's intention more accurately and apply domain knowledge more deeply, thus significantly improving the accuracy of complex queries and being reliably applied to industry scenarios with high requirements for data accuracy.

[0116] 2. Breakthrough in complex analysis ability: The link orchestration ability enables the system to no longer be limited to simple "question and answer", but can, like a business analyst, organize and logically decompose complex diagnosis and attribution problems in stages, and complete multi-step exploration through multi-link collaboration, providing in-depth data support for business decisions.

[0117] 3. Significantly enhanced user experience and trust: The system can understand colloquial and ambiguous natural language and finally respond in the form of rich media of "data facts + visual charts + insight analysis + anthropomorphic answers". The results are not only intuitive and easy to understand, but also "the process is interpretable and adjustable". Users can see how the system arrives at the conclusion step by step, which greatly enhances the user's trust in the results.

[0118] 4. Strong domain adaptability and maintainability: The architecture of the present invention is closely combined with background data annotation and knowledge management platforms such as the annotation platform. Business experts can continuously inject new noun terms, business rules and annotation samples into the system through this platform, enabling the system to continuously learn and evolve, quickly adapt to new business changes and query requirements, and having good scalability and maintainability.

[0119] 5. Quantitative indicators (intra-enterprise evaluation baseline): Intent recognition accuracy rate ≥ XX%, query rewriting disambiguation success rate ≥ XX%, link orchestration DAG execution success rate ≥ XX%, chart and intention Figure 1 consistency ≥ XX%, end-to-end P95 response time < XX milliseconds ms; unauthorized query interception rate ≥ 99%.

[0120] Figure 3 is a schematic structural diagram of the natural language number query device provided by the present invention. As Figure 3 shown, the natural language number query device 300 includes the following modules: The intent classification module 310 is used to receive the user's natural language query string, perform intent recognition on the natural language query string based on a preset intent system, and output the user's intent classification result; the intent classification result is represented by a unique intent code. The query rewriting module 320 is used to rewrite the natural language query string based on the intent classification result, the natural language query string, and the professional terminology database, and output a standardized query. The process orchestration and execution module 330 is used to orchestrate the natural language data lookup task corresponding to the natural language query string based on the normalized query and the intent classification result, generate a structured execution plan including multiple atomic tasks, and execute the structured execution plan to obtain a data result set. The process of orchestrating the natural language data lookup task corresponding to the natural language query string based on the normalized query and the intent classification result to generate a structured execution plan including multiple atomic tasks includes: using the normalized query as a keyword to perform semantic retrieval in a power domain vector knowledge base to obtain domain context information corresponding to the normalized query; performing information enhancement on the normalized query based on the domain context information to generate an annotated query including the domain context information; and orchestrating the natural language data lookup task corresponding to the natural language query string based on the annotated query, the intent classification result, and relevant business rules in the domain context information to generate the structured execution plan. The annotated query includes the normalized query and all retrieved business context information related to the normalized query, and the relevant business rules include statistical definitions, professional classifications, and data sources.

[0121] The apparatus provided in this embodiment includes an intent classification module 310, which receives a user's natural language query string, performs intent recognition on the query string based on a preset intent system, and outputs the user's intent classification result, represented by a unique intent code; a query rewriting module 320, which rewrites the query string based on the intent classification result, the query string, and a terminology database, and outputs a standardized query; furthermore, a process orchestration and execution module 330, which orchestrates the natural language data lookup task corresponding to the natural language query string based on the standardized query and intent classification result, generates an execution plan including multiple atomic tasks, and executes the plan to obtain a data result set; based on the standardized query and intent classification result... This invention proposes an innovative pipelined processing method that logically decomposes and plans the complex natural language query problem, systematically transforming it into a clear, accurate, and executable analysis task through a step-by-step approach. This method transforms user-input natural language statements into precise data result sets, significantly improving the accuracy of complex queries and enabling reliable application in industry scenarios with high data precision requirements. The method includes: using the normalized query as a keyword to perform semantic retrieval in a power domain vector knowledge base to obtain the corresponding domain context information; enhancing the normalized query based on the domain context information to generate an labeled query that includes the domain context information; and orchestrating the natural language query task based on the labeled query, intent classification results, and relevant business rules in the domain context information to generate a structured execution plan. The labeled query includes the normalized query and all retrieved business context information related to the normalized query.

[0122] According to the natural language counting device 300 provided by the present invention, the intent classification module 310 is specifically used for: The natural language query string is matched against the preset intent system or the specified intent system to obtain a structured intent object including at least one classification code; wherein, the intent recognition supports single intent mode or multi intent mode; Based on the structured intent object, prompt words are dynamically generated, and the structured intent object and the corresponding prompt words are determined as the intent classification result.

[0123] According to the natural language lookup device 300 provided by the present invention, the query rewriting module 320 is specifically used for: Based on the natural language query string, determine the current time context; Based on the current time context and the preset time term library, the relative time expression in the natural language query string is converted into an absolute time range to obtain the normalized time information; Based on the terminology database, synonym mapping and concept disambiguation are performed on the proper nouns in the natural language query string to obtain recall terminology information related to the natural language query string; the terminology database contains a set of synonyms for the proper nouns and annotations of thought processes used to explain the differences between the proper nouns and their synonyms; The recalled noun information, the normalized time information, and the historical dialogue context are engineered and arranged using a preset template to generate the normalized query represented in a structured format.

[0124] According to the natural language data lookup device 300 provided by the present invention, the domain context information includes database table structure information, noun set annotation, indicator definition, relevant business rules and annotated samples.

[0125] According to the natural language counting device 300 provided by the present invention, the link arrangement and execution module 330 is further used for: Based on the labeled query intent and the relevant business rules, the natural language data lookup task is decomposed into multiple atomic tasks, and a parent atomic task is assigned to each atomic task. Based on the dependencies between the atomic tasks, the atomic tasks are organized into a directed acyclic graph (DAG), and the DAG is determined as the structured execution plan; wherein, the nodes of the DAG represent the atomic tasks, and the edges of the DAG represent the dependencies between the atomic tasks.

[0126] According to the natural language counting device 300 provided by the present invention, the device further includes: a chart generation and analysis module; The chart generation and analysis module is used for: Based on the data result set, the intent classification results, and the structured execution plan, a visualization chart is generated; Based on the visualization charts, text results of natural language analysis are automatically generated; the text results represent natural language summaries corresponding to the key features of the data result set.

[0127] According to the natural language data lookup device 300 provided by the present invention, the chart generation and analysis module is specifically used for: Determine the size of the data result set; When the amount of data is less than a preset threshold, the model directly generates the corresponding visualization chart configuration based on the data result set, the intent classification result, and the structured execution plan, using either a free generation or template generation method. If the data volume is greater than or equal to the preset threshold, data aggregation is performed to obtain aggregated data; or, code is sampled and the data result set is aggregated based on the code to obtain the aggregated data. The visualization chart is generated based on the configuration of the visualization chart or the aggregated data, the data result set, the intent classification results, and the structured execution plan.

[0128] According to the natural language data lookup device 300 provided by the present invention, the chart generation and analysis module is further used for: Based on the intent types identified in the intent classification results and the structured execution plan, assign appropriate chart types to the data result set; The visualization chart is generated based on the appropriate chart type, and data anomalies or abnormal ranges are automatically marked in the visualization chart.

[0129] Figure 4 This is a schematic diagram of the structure of the electronic device provided by the present invention, such as... Figure 4 As shown, the electronic device may include: a processor 410, a communications interface 420, a memory 430, and a communication bus 440, wherein the processor 410, the communications interface 420, and the memory 430 communicate with each other via the communication bus 440. The processor 410 can call logical instructions in the memory 430 to execute a natural language lookup method, which includes: The system receives a user's natural language query string, performs intent recognition on the natural language query string based on a preset intent system, and outputs the user's intent classification result; the intent classification result is represented by a unique intent code. Based on the intent classification results, the natural language query string, and the terminology database, the natural language query string is rewritten to output a standardized query. Based on the normalized query and the intent classification result, the natural language data lookup task corresponding to the natural language query string is orchestrated in stages to generate a structured execution plan including multiple atomic tasks, and the structured execution plan is executed to obtain a data result set; the orchestration of the natural language data lookup task corresponding to the natural language query string based on the normalized query and the intent classification result to generate a structured execution plan including multiple atomic tasks includes: using the normalized query as a keyword to perform semantic retrieval in the power domain vector knowledge base to obtain the domain context information corresponding to the normalized query; performing information enhancement on the normalized query based on the domain context information to generate an annotated query including the domain context information; orchestrating the natural language data lookup task corresponding to the natural language query string based on the annotated query, the intent classification result, and the relevant business rules in the domain context information to generate the structured execution plan; the annotated query includes the normalized query and all retrieved business context information related to the normalized query, and the relevant business rules include statistical caliber, professional classification, and data source.

[0130] Furthermore, the logical instructions in the aforementioned memory 430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a 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, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0131] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program that can be stored on a non-transitory computer-readable storage medium, wherein when the computer program is executed by a processor, the computer is able to execute the natural language data lookup method provided by the above methods, the method comprising: The system receives a user's natural language query string, performs intent recognition on the natural language query string based on a preset intent system, and outputs the user's intent classification result; the intent classification result is represented by a unique intent code. Based on the intent classification results, the natural language query string, and the terminology database, the natural language query string is rewritten to output a standardized query. Based on the normalized query and the intent classification result, the natural language data lookup task corresponding to the natural language query string is orchestrated in stages to generate a structured execution plan including multiple atomic tasks, and the structured execution plan is executed to obtain a data result set; the orchestration of the natural language data lookup task corresponding to the natural language query string based on the normalized query and the intent classification result to generate a structured execution plan including multiple atomic tasks includes: using the normalized query as a keyword to perform semantic retrieval in the power domain vector knowledge base to obtain the domain context information corresponding to the normalized query; performing information enhancement on the normalized query based on the domain context information to generate an annotated query including the domain context information; orchestrating the natural language data lookup task corresponding to the natural language query string based on the annotated query, the intent classification result, and the relevant business rules in the domain context information to generate the structured execution plan; the annotated query includes the normalized query and all retrieved business context information related to the normalized query, and the relevant business rules include statistical caliber, professional classification, and data source.

[0132] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the natural language lookup method provided by the methods described above, the method comprising: The system receives a user's natural language query string, performs intent recognition on the natural language query string based on a preset intent system, and outputs the user's intent classification result; the intent classification result is represented by a unique intent code. Based on the intent classification results, the natural language query string, and the terminology database, the natural language query string is rewritten to output a standardized query. Based on the normalized query and the intent classification result, the natural language data lookup task corresponding to the natural language query string is orchestrated in stages to generate a structured execution plan including multiple atomic tasks, and the structured execution plan is executed to obtain a data result set; the orchestration of the natural language data lookup task corresponding to the natural language query string based on the normalized query and the intent classification result to generate a structured execution plan including multiple atomic tasks includes: using the normalized query as a keyword to perform semantic retrieval in the power domain vector knowledge base to obtain the domain context information corresponding to the normalized query; performing information enhancement on the normalized query based on the domain context information to generate an annotated query including the domain context information; orchestrating the natural language data lookup task corresponding to the natural language query string based on the annotated query, the intent classification result, and the relevant business rules in the domain context information to generate the structured execution plan; the annotated query includes the normalized query and all retrieved business context information related to the normalized query, and the relevant business rules include statistical caliber, professional classification, and data source.

[0133] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0134] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0135] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A natural language search method, characterized by, The method comprises the following steps: receiving a natural language query string of a user, performing intent recognition on the natural language query string based on a preset intent system, and outputting an intent classification result of the user; the intent classification result is represented by a unique intent code; based on the intent classification result, the natural language query string and a professional term library, rewriting the natural language query string, and outputting a normalized query; based on the normalized query and the intent classification result, arranging the natural language query string corresponding to the natural language query string into a link, generating a structured execution plan comprising a plurality of atomic tasks, and executing the structured execution plan to obtain a data result set; the step of arranging the natural language query string corresponding to the natural language query string into a link based on the normalized query and the intent classification result, generating a structured execution plan comprising a plurality of atomic tasks, comprises: performing semantic retrieval in the power domain vector knowledge base by taking the normalized query as a keyword, obtaining the domain context information corresponding to the normalized query; based on the domain context information, performing information enhancement on the normalized query, generating a labeled query comprising the domain context information; based on the labeled query, the intent classification result and the relevant business rules in the domain context information, arranging the natural language query string corresponding to the natural language query string into a link, generating the structured execution plan; the labeled query contains the normalized query and all the retrieved business context information related to the normalized query, and the relevant business rules include statistical indicators, professional classification and data sources.

2. The natural language query method of claim 1, wherein, The preset intent system comprises a preset intent system or a specified intent system; the step of performing intent recognition on the natural language query string based on the preset intent system and outputting the intent classification result of the user comprises: matching the natural language query string in the preset intent system or the specified intent system to obtain a structured intent object comprising at least one classification code; wherein the intent recognition supports a single-intent mode or a multi-intent mode; based on the structured intent object, dynamically generating a prompt word, and determining the structured intent object and the corresponding prompt word as the intent classification result.

3. The natural language query method of claim 1, wherein, the step of rewriting the natural language query string based on the intent classification result, the natural language query string and the professional term library, and outputting a normalized query comprises: based on the natural language query string, determining a current time context; based on the current time context and a preset time term library, converting the relative time expression in the natural language query string into an absolute time range to obtain normalized time information; Based on the professional term library, the synonym mapping and concept disambiguation of the proper noun in the natural language query string are performed to obtain recall noun information related to the natural language query string; the professional term library includes a synonym set of the proper noun and a thinking process annotation for explaining the difference between the proper noun and the synonym; The recall noun information, the normalized time information, and the historical dialogue context are engineered and arranged through a pre-set template to generate the normalized query in a structured format.

4. The natural language query method of claim 1, wherein, The domain context information includes database table structure information, term set annotation, index definition, the related business rules, and the annotated sample.

5. The natural language query method of claim 4, wherein, The link arrangement of the natural language query task corresponding to the natural language query string based on the annotated query and the intent classification result to generate the structured execution plan includes: Based on the intent of the annotated query and the related business rules, the natural language query task is decomposed into a plurality of atomic tasks, and each atomic task is specified to depend on a superior atomic task; According to the dependency relationship between the atomic tasks, the atomic tasks are organized into a directed acyclic graph (DAG), and the DAG is determined as the structured execution plan; wherein the nodes of the DAG represent the atomic tasks, and the edges of the DAG represent the dependency relationship between the atomic tasks.

6. The natural language query method of claim 1, wherein, The method further includes: Based on the data result set, the intent classification result, and the structured execution plan, a visualization chart is generated; Based on the visualization chart, a natural language analysis text result is automatically generated; the text result represents a natural language summary corresponding to the key features of the data result set.

7. The natural language query method of claim 6, wherein, The generation of the visualization chart based on the data result set, the intent classification result, and the structured execution plan includes: judging the data size of the data result set; in the case where the data size is less than a preset threshold, a corresponding visualization chart configuration is directly generated by a model based on the data result set, the intent classification result, and the structured execution plan using a free generation or template generation method; in the case where the data size is greater than or equal to the preset threshold, aggregated data is obtained by data aggregation, or the data result set is aggregated based on a sampling code to obtain the aggregated data; based on the visualization chart configuration, the aggregated data, the data result set, the intent classification result, and the structured execution plan, the visualization chart is generated.

8. The natural language query method of claim 6, wherein, The generation of the visualization chart based on the data result set, the intent classification result, and the structured execution plan includes: according to the intent type identified in the intent classification result and the structured execution plan, an appropriate chart type is assigned to the data result set; based on the appropriate chart type, the visualization chart is generated, and data abnormal points or abnormal intervals are automatically annotated in the visualization chart.

9. A natural language search apparatus, characterized by comprising: including: An intent classification module is configured to receive a natural language query string of a user, perform intent recognition on the natural language query string based on a preset intent system, and output an intent classification result of the user; The intent classification result is represented by a unique intent code; A query rewriting module is configured to perform query rewriting on the natural language query string based on the intent classification result, the natural language query string, and a professional term library, and output a normalized query; A link arrangement and execution module is configured to perform link arrangement on a natural language query task corresponding to the natural language query string based on the normalized query and the intent classification result, generate a structured execution plan including a plurality of atomic tasks, and execute the structured execution plan to obtain a data result set; the link arrangement and execution module is specifically configured to perform semantic retrieval in an electric power domain vector knowledge base by taking the normalized query as a keyword, and obtain domain context information corresponding to the normalized query; The normalized query is information-enhanced based on the domain context information, and a labeled query including the domain context information is generated; The natural language query task corresponding to the natural language query string is arranged based on relevant business rules in the labeled query, the intent classification result, and the domain context information, and the structured execution plan is generated; the labeled query includes the normalized query and all retrieved business context information related to the normalized query, and the relevant business rules include statistical indicators, professional classification, and data sources.

10. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the natural language query method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Query processing method and device, electronic equipment and storage medium

    CN120632209A

  • User intent and context based search results

    US20170242886A1