Search

CN-122019573-A - Natural language question-answering processing method and device for financial data query

CN122019573ACN 122019573 ACN122019573 ACN 122019573ACN-122019573-A

Abstract

The invention relates to a natural language question-answering processing method and device for financial data query, the method comprises the steps of obtaining an original query statement input by a user, carrying out intention analysis processing on the original query statement, converting the original query statement into a target query statement, extracting a financial entity from the target query statement, searching and matching the financial entity in a pre-built financial data metadata base to obtain a mapping result of the financial entity in the financial data metadata base, combining the target query statement and the mapping result to generate a target SQL statement, and executing the target SQL statement in the pre-built financial data base to generate a query result. According to the invention, financial requirements can be accurately understood, the problems of ambiguity of financial terms, complex table association logic and the like are effectively solved, the accuracy, stability and interaction experience of financial data query are obviously improved as a whole, and the financial data analysis threshold is reduced.

Inventors

  • ZHAO JINGCHENG

Assignees

  • 深圳市跨越速运有限公司

Dates

Publication Date
20260512
Application Date
20260327

Claims (10)

  1. 1. A natural language question-answering processing method facing to financial data query is characterized by comprising the following steps: acquiring an original query sentence input by a user; performing intention analysis processing on the original query statement to convert the original query statement into a target query statement, wherein the intention analysis processing comprises intention recognition, intention rewriting and intention clarification; Extracting a financial entity from the target query statement, and searching and matching the financial entity in a pre-constructed financial data metadata base to obtain a mapping result of the financial entity in the financial data metadata base, wherein the mapping result comprises a target table name, a target column name and an association relation among target tables; Combining the target query statement and the mapping result to generate a target SQL statement; And executing the target SQL statement in the pre-constructed financial database to generate a query result.
  2. 2. The method of claim 1, wherein the performing intent analysis processing on the original query statement to convert to a target query statement comprises: Combining a pre-trained intention classification model and a pre-constructed financial intention label system, identifying the intention of the original query statement, and extracting preliminary financial element information; optimizing and rewriting the original query statement by combining the intention, the financial element information, the pre-constructed financial knowledge graph and the financial sentence pattern template to obtain an intention rewritten query statement; Based on the intention and the financial element information, performing secondary verification on the intention rewrite query statement to obtain an initial target query statement after verification is passed; and if the initial target query statement is incomplete, carrying out intention clarification on the initial target query statement through interactive feedback to obtain the target query statement.
  3. 3. The method according to claim 1, wherein said searching and matching the financial entity in the pre-constructed financial data metadata base to obtain the mapping result of the financial entity in the financial data metadata base includes: searching and matching the financial entity with metadata of the financial data metadata base to obtain a plurality of candidate mapping results; And inputting a plurality of initial mapping results as contexts to a pre-trained financial large model for entity mapping, and determining the final mapping result.
  4. 4. The method of claim 1, wherein the generating a target SQL statement by combining the target query statement and the mapping result comprises: Combining the target query statement and the mapping result, and generating a plurality of candidate SQL statements by a pre-trained SQL generating model; and sequentially carrying out progressive checksum scoring on the candidate SQL sentences to determine a target SQL sentence.
  5. 5. The method according to claim 4, wherein sequentially performing progressive checksum scoring on the plurality of candidate SQL statements to determine a target SQL statement therefrom comprises: sequentially carrying out grammar check, semantic check and business logic check on each candidate SQL statement; grading each candidate SQL sentence passing the verification according to the consistency of the query result after the execution and the sentence quality of the candidate SQL sentence; And determining the candidate SQL statement with the highest score as the target SQL statement.
  6. 6. The method of claim 4, wherein each candidate SQL statement is generated using a hierarchical policy, comprising: generating a backbone SQL framework containing a core table, association conditions and filtering conditions according to the mapping result; And on the basis of the backbone SQL framework, filling an aggregation function, a sequencing condition, a grouping condition and calculation logic in combination with the intention of the target query statement to generate the candidate SQL statement.
  7. 7. The method of claim 1, comprising, prior to generating a target SQL statement in conjunction with the target query statement and the mapping result: Determining the query difficulty level of the target query statement according to the number of tables, the number of aggregation functions and the number of nesting layers of the query contained in the mapping result and the classification result of the pre-training classifier; and selecting a pre-trained SQL generating model matched with the query difficulty level according to the query difficulty level, and generating the target SQL statement.
  8. 8.A method according to any one of claims 1 to 7, comprising, prior to extracting a financial entity from the target query statement: and judging whether the target query statement belongs to a financial class query problem, if so, executing financial entity extraction, and if not, outputting preset non-financial class problem prompt information to a user.
  9. 9.A natural language question-answering processing device for a financial data query, comprising: the acquisition module is used for acquiring an original query statement input by a user; The intention analysis module is used for carrying out intention analysis processing on the original query statement and converting the original query statement into a target query statement, wherein the intention analysis processing comprises intention recognition, intention rewriting and intention clarification; The entity extraction module is used for extracting a financial entity from the target query statement, searching and matching the financial entity in a pre-constructed financial data metadata base to obtain a mapping result of the financial entity in the financial data metadata base, wherein the mapping result comprises a target table name, a target column name and a target table association relation; The target SQL sentence generation module is used for combining the target query sentence and the mapping result to generate a target SQL sentence; And the query module is used for executing the target SQL statement in the pre-constructed financial database to generate a query result.
  10. 10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of any one of claims 1-8 when the computer program is executed.

Description

Natural language question-answering processing method and device for financial data query Technical Field The invention relates to the technical field of natural language processing, in particular to a natural language question-answering processing method and device for financial data query. Background At the moment of digital transformation advanced, financial data has become a core support for enterprise decision making, risk management and compliance auditing, and the scale and complexity of the financial data are exponentially increased. The enterprise financial data is usually stored in a structured database, covers multidimensional information such as general ledgers, itemized ledgers, reports, tax declarations and the like, is required to follow standards in the industry, and has the characteristics of strong field specialization, high data association degree, large format difference and the like. Traditional financial data inquiry and analysis rely on professional technicians to write Structured Query Language (SQL), but core business personnel such as financial analysts, financial management personnel and the like often lack SQL programming capability, and the requirements are required to be transferred and processed through technicians, so that the problems of low data acquisition efficiency, deviation in requirement transfer and the like are caused, and the requirements of enterprises on real-time financial insights are difficult to adapt. Under the background, text-to-SQL conversion technology (Text 2 SQL) has been developed, and the core capability is to automatically convert the query requirement described by natural language into executable SQL sentences, break the interaction barrier between non-technicians and structured financial data, and provide technical possibility for light weight and high efficiency of financial data analysis. Along with the iterative development of a Large Language Model (LLMs), the Text2SQL technology is obviously improved in semantic understanding and complex sentence processing capacity, and gradually penetrates into vertical fields such as finance, medical treatment and the like. In the financial scene, the Text2SQL technology can be widely applied to the scenes such as financial statement analysis, cost accounting, budget control, compliance monitoring and the like, and is hopeful to greatly shorten the financial data analysis period, reduce the operation threshold and reduce the manual error, so that the method becomes a key support technology for digitally upgrading the enterprise finance. However, when the existing Text2SQL technology is oriented to a financial data query scene, the technical problems that professional semantic understanding is weak due to insufficient field suitability, illusion and inconsistency are outstanding due to insufficient generating accuracy and stability, deployment and iteration costs are high due to low generalization capability, and interactive experience is limited due to insufficient multi-language and spoken language adaptation are commonly existed. Disclosure of Invention The invention aims to solve at least one technical problem by providing a natural language question-answering processing method and device for financial data query. In a first aspect, the technical scheme for solving the technical problems is as follows, a natural language question-answering processing method for inquiring financial data, which comprises the following steps: acquiring an original query sentence input by a user; performing intention analysis processing on the original query statement to convert the original query statement into a target query statement, wherein the intention analysis processing comprises intention recognition, intention rewriting and intention clarification; Extracting a financial entity from a target query statement, and searching and matching the financial entity in a pre-constructed financial data metadata base to obtain a mapping result of the financial entity in the financial data metadata base, wherein the mapping result comprises a target table name, a target column name and an association relation among target tables; combining the target query statement and the mapping result to generate a target SQL statement; and executing the target SQL statement in the pre-constructed financial database to generate a query result. The natural language question-answering processing method for the financial data query has the advantages that the original query statement input by a user is firstly obtained, the original query statement is subjected to intention analysis processing, including intention recognition, intention rewriting and intention clarification, to be converted into the target query statement, the problems that the financial language query is insufficient and intention deviation is likely to occur in the prior art are effectively solved, the accuracy of intention understanding is remarkably improved, then the fin