Natural language query statement processing method and apparatus
Abstract
A natural language query statement processing method includes obtaining a natural language query statement; inputting the natural language query statement and the to-be-queried data table into a child table recall model to obtain at least one candidate data table; determining a target data table from the at least one candidate data table; and inputting the natural language query statement and the target data table into a natural language to structured query statement model to obtain a structured query statement.
Interactive Citation Constellation Global Citation Ranking
Interactive SVG Citation Constellation renders in Rust/WebAssembly. Prior art cited: 10 · Forward citations: 0.
Claims (20 — 3 Independent, 17 Dependent)
- Claim 1Independent Claim
A method comprising: obtaining a natural language query statement to query a to-be-queried data table for data, wherein the to-be-queried data table comprises at least one parent table; inputting the natural language query statement and the to-be-queried data table into a child table recall model to obtain at least one candidate data table, wherein the at least one candidate data table comprises at least one child table of the at least one parent table; determining a target data table from the at least one candidate data table; and inputting the natural language query statement and the target data table into a natural language-to-structured query statement model to obtain a structured query statement.
- Claim 2Depends on #1
The method of claim 1, wherein determining the target data table comprises: generating a visual interface displaying representative information of the at least one candidate data table to a user, wherein the representative information a name of a column of the at least one candidate data table, example data in the at least one candidate data table, a name of a parent table to which the at least one child table belongs, or a category of the parent table to which the at least one child table belongs; and receiving, from the user, a selection operation selecting the target data table from the at least one candidate data table on the visual interface.
- Claim 3Depends on #2
The method of claim 2, further comprising training the child table recall model based on the to-be-queried data table, the natural language query statement, and the target data table to update the child table recall model.
- Claim 4Depends on #1
The method of claim 1, wherein determining the target data table comprises: sorting the at least one candidate data table based on a correlation between the at least one candidate data table and the natural language query statement; and determining, as the target data table, candidate data tables having top Q ranking, wherein Q is a positive integer greater than or equal to 1.
- Claim 5Depends on #1
The method of claim 1, further comprising querying the to-be-queried data table using the structured query statement to obtain a data query result.
- Claim 6Independent Claim
An apparatus comprising: one or more memories configured to store instructions; and one or more processors coupled to the one or more memories, wherein when executed by the one or more processors, the instructions cause the apparatus to: obtain a natural language query statement to query a to-be-queried data table for data, wherein the to-be-queried data table comprises at least one parent table; input the natural language query statement and the to-be-queried data table into a child table recall model to obtain at least one candidate data table, wherein the at least one candidate data table comprises at least one child table of the at least one parent table; determine a target data table from the at least one candidate data table; and input the natural language query statement and the target data table into a natural language-to-structured query statement model to obtain a structured query statement.
- Claim 7Depends on #6
The apparatus of claim 6, wherein to determine the target data table, when executed by the one or more processors, the instructions further cause the apparatus to: generate a visual interface displaying representative information of the at least one candidate data table to a user, wherein the representative information of the at least one candidate data table comprises a name of a column of the at least one candidate data table, example data in the at least one candidate data table, a name of a parent table to which the at least one child table belongs, or a category of the parent table to which the at least one child table belongs; and receive, from the user, a selection operation selecting the target data table from the at least one candidate data table on the visual interface.
- Claim 8Depends on #7
The apparatus of claim 7, wherein when executed by the one or more processors, the instructions further cause the apparatus to train the child table recall model based on the to-be-queried data table, the natural language query statement, and the target data table to update the child table recall model.
- Claim 9Depends on #6
The apparatus of claim 6, wherein to determine the target data table, when executed by the one or more processors, the instructions further cause the apparatus to: sort the at least one candidate data table based on a correlation between the at least one candidate data table and the natural language query statement; and determine, as the target data table, candidate data tables having top Q ranking, wherein Q is a positive integer greater than or equal to 1.
- Claim 10Depends on #6
The apparatus of claim 6, wherein when executed by the one or more processors, the instructions further cause the apparatus to query the to-be-queried data table using the structured query statement to obtain a data query result.
- Claim 11Independent Claim
A computer program product comprising computer-executable instructions that are stored on a non-transitory computer-readable storage medium and that, when executed by one or more processors, cause an apparatus to: obtain a natural language query statement to query a to-be-queried data table for data, wherein the to-be-queried data table comprises at least one parent table; input the natural language query statement and the to-be-queried data table into a child table recall model to obtain at least one candidate data table, wherein the at least one candidate data table comprises at least one child table of the at least one parent table; determine a target data table from the at least one candidate data table; and input the natural language query statement and the target data table into a natural language-to-structured query statement model to obtain a structured query statement.
- Claim 12Depends on #11
The computer program product of claim 11, wherein to determine the target data table, when executed by the one or more processors, the instructions further cause the apparatus to: generate a visual interface displaying representative information of the at least one candidate data table to a user; and receive, from the user, a selection operation indicating the target data table from the at least one candidate data table on the visual interface.
- Claim 13Depends on #12
The computer program product of claim 12, wherein the representative information comprises a category of a parent table to which the at least one child table belongs.
- Claim 14Depends on #12
The computer program product of claim 12, wherein the representative information comprises a name of a column of the at least one candidate data table.
- Claim 15Depends on #12
The computer program product of claim 12, wherein the representative information comprises example data in the at least one candidate data table.
- Claim 16Depends on #12
The computer program product of claim 12, wherein the representative information comprises a name of a parent table to which the at least one child table belongs.
- Claim 17Depends on #11
The computer program product of claim 11, wherein to determine the target data table, when executed by the one or more processors, the instructions further cause the apparatus to: sort the at least one candidate data table based on a correlation between the at least one candidate data table and the natural language query statement; and determine, as the target data table, candidate data tables having top Q ranking, wherein Q is a positive integer greater than or equal to 1.
- Claim 18Depends on #11
The computer program product of claim 11, wherein when executed by the one or more processors, the instructions further cause the apparatus to train the child table recall model based on the to-be-queried data table, the natural language query statement, and the target data table to update the child table recall model.
- Claim 19Depends on #11
The computer program product of claim 11, wherein when executed by the one or more processors, the instructions further cause the apparatus to query the to-be-queried data table using the structured query statement to obtain a data query result.
- Claim 20Depends on #19
The computer program product of claim 19, wherein the data query result comprises the data in the to-be-queried data table.
Technical Overview & Description
CROSS-REFERENCE TO RELATED APPLICATIONS This is a continuation of International Patent Application No. PCT/CN2024/075706 filed on Feb. 4, 2024, which claims priority to Chinese Patent Application No. 202310323092.6 filed on Mar. 29, 2023, which are hereby incorporated by reference in their entireties. TECHNICAL FIELD Embodiments of this application relate to the field of artificial intelligence, and more specifically, to a natural language query statement processing method and apparatus. BACKGROUND With gradual informatization of various industries, practitioners have increasing requirements for data query and analysis. However, querying data from a database requires a structured query language (SQL) dedicated to the database, which imposes specific thresholds on users. A natural language to SQL (NL2SQL) technology is used to convert a natural language query statement entered by the user into an SQL statement, to lower a threshold for using the database. However, there are a large quantity of data tables in the database, and each data table has a large quantity of fields and a large scale. Consequently, an NL2SQL process based on all to-be-queried data tables has a low speed and low accuracy, and final data query efficiency and accuracy are affected. Therefore, how to efficiently and accurately convert the natural language query statement into the SQL query statement becomes a technical problem that urgently needs to be resolved. SUMMARY Embodiments of this application provide a natural language query statement processing method and apparatus, to obtain, based on a natural language query statement, a child table with a smaller quantity of fields from a to-be-queried data table as an input of an NL2SQL model, so that a range of fields that need to be retrieved when the natural language query statement is converted into an SQL query statement is narrowed, efficiency and accuracy of converting the natural language query statement into the SQL query statement are improv
Cited By — Indexed Forward Citations (0 of 0 total)
No indexed citing patents in this generation yet. Ingest USPTO/PatentsView bulk citation tables via patents-ingest to expand the local forward citation graph.