Natural language query statement processing method and device

By using the sub-table recall model and visual interface in NL2SQL technology to select the target data table, the problems of inefficiency and insufficient accuracy caused by multi-field and large-scale data tables are solved, and more efficient and accurate natural language queries to SQL are achieved. Convert.

WO2024198725A1PCT designated stage expired Publication Date: 2024-10-03HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD

Patent Information

Application Number
PCT/CN2024/075706
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-03-29
Filing Date
2024-02-04
Publication Date
2024-10-03

AI Technical Summary

Technical Problem

Existing NL2SQL technology is inefficient and inaccurate when processing multi-field and large-scale data tables, affecting the efficiency and accuracy of data queries.

Method used

When obtaining natural language query statements, subtables with fewer fields are obtained based on the data table to be searched as input to the NL2SQL model, narrowing the scope of search fields, and interacting with users through a visual interface to help users select target data tables to improve accuracy. .

Benefits of technology

It improves the efficiency and accuracy of converting natural language query statements into SQL query statements, thereby improving the efficiency and accuracy of data query.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024075706_03102024_PF_FP_ABST
    Figure CN2024075706_03102024_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present application relate to the field of artificial intelligence, and provide a natural language query statement processing method and device. The method comprises: obtaining a natural language query statement, which is used for querying data in data tables waiting for querying; inputting the natural language query statement and said data tables into a sub-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. According to the method, on the basis of a natural language query statement according to data tables waiting for querying, a sub-table with fewer fields is obtained as the input of an NL2SQL model; thus, the field range needing to be retrieved during conversion of a natural language query statement to an SQL statement is reduced, the efficiency and accuracy of converting natural language query statements into SQL statements are improved, and the efficiency and accuracy of querying data according to natural language are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Method and device for processing natural language query statements

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on March 29, 2023, with application number 202310323092.6 and application name “Method and Device for Processing Natural Language Query Statements”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The embodiments of the present application relate to the field of artificial intelligence, and more specifically, to a method and apparatus for processing natural language query statements. Background Art

[0003] With the gradual informatization of various industries, the demand for data query and analysis is continuously expanding. However, querying data from databases requires using the database-specific structured query language (SQL), which has certain user requirements. Natural language to SQL (NL2SQL) technology aims to convert user-entered natural language query statements into SQL statements, thereby lowering the barrier to entry for database users.

[0004] However, the database contains a large number of tables, each with numerous fields and a large size. This results in a slow and inaccurate NL2SQL process based on all the tables to be queried, which in turn affects the efficiency and accuracy of the final data query. Therefore, how to efficiently and accurately convert natural language query statements into SQL query statements has become a technical problem that needs to be solved urgently.

[0005] Summary of the Invention

[0006] The embodiments of the present application provide a method and device for processing natural language query statements, which can obtain a sub-table with fewer fields as input to the NL2SQL model based on the natural language query statement and the data table to be queried, thereby narrowing the range of fields that need to be retrieved when converting the natural language query statement to the SQL query statement, improving the efficiency and accuracy of converting the natural language query statement to the SQL query statement, and further improving the efficiency and accuracy of querying data based on natural language.

[0007] In a first aspect, a method for processing a natural language query statement is provided, comprising: obtaining a natural language query statement, the natural language query statement being used to query data in a data table to be queried, wherein the data table to be queried includes at least one parent table; inputting the natural language query statement and the data table to be queried into a child table recall model to obtain at least one candidate data table, wherein at least one candidate data table includes at least one child table of 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.

[0008] According to the technical solution provided in this application, a sub-table with fewer fields is obtained from the data table to be queried based on the natural language query statement as the input of the NL2SQL model, thereby narrowing the range of fields that need to be retrieved when the natural language query statement is converted into an SQL query statement, and improving the efficiency and accuracy of converting the natural language query statement into an SQL query statement.

[0009] In combination with the first aspect, in certain implementations of the first aspect, determining a target data table from at least one candidate data table includes: generating a visualization interface for displaying representative information of at least one candidate data table to a user, wherein the representative information of at least one candidate data table includes any one or more of the following: the name of a column of at least one candidate data table, example data in at least one candidate data table, the name of a parent table to which at least one child table belongs, and the category of the parent table to which at least one child table belongs; and receiving a selection operation, the selection operation indicating the target data table selected by the user from at least one candidate data table on the visualization interface.

[0010] According to the above technical solution, by interacting with the user through a visual interface, candidate data tables are displayed to the user and the user is provided with the function of selecting a target data table from the candidate data tables, so that the user can perceive the process of determining the target data table input into the NL2SQL model, thereby improving the interpretability of the NL2SQL results, and enabling the user to control and constrain the scope of the target data table according to his or her own query requirements, thereby improving the accuracy of converting natural language query statements into SQL query statements.

[0011] In combination with the first aspect, in certain implementations of the first aspect, determining the target data table from at least one candidate data table includes: sorting at least one candidate data table according to the relevance of at least one candidate data table to the natural language query statement; determining the Q candidate data tables before sorting as the target data table, where Q is a positive integer greater than or equal to 1.

[0012] According to the above technical solution, candidate data tables can be sorted based on their relevance to natural language query statements, with the top Q candidate data tables selected by default as the target data table. This improves the accuracy of selecting the target data table from the candidate data tables, and further improves the accuracy of converting natural language query statements to SQL queries. In addition, when multiple candidate data tables with the highest relevance come from multiple data tables to be queried, multiple candidate data tables from different data tables to be queried can be selected by default as the target data table, thus implementing NL2SQL for multi-table join queries, further improving the accuracy of converting natural language queries to SQL queries.

[0013] In combination with the first aspect, in certain implementations of the first aspect, the method further includes: training a sub-table recall model based on the to-be-queried data table, the natural language query statement, and the target data table to update the sub-table recall model.

[0014] According to the above technical solution, when the user participates in the process of selecting the target data table from the candidate data table and corrects the default sorting result output by the sub-table recall model, the sub-table recall model can be further trained based on the user's selection of the candidate data table, thereby updating the sub-table recall model so that the candidate data table recalled by the sub-table recall model better meets the user's query requirements.

[0015] In combination with the first aspect, in certain implementations of the first aspect, the method further includes: using a structured query statement to query in the to-be-queried data table to obtain a data query result.

[0016] According to the above technical solution, the more accurate SQL query statement obtained according to the technical solution of this application can be used to query data from the data table to be queried, thereby improving the efficiency and accuracy of the query data, thereby improving the efficiency and accuracy of the entire process of querying data based on natural language.

[0017] In a second aspect, a device for processing natural language query statements is provided, including: an acquisition module for acquiring a natural language query statement, the natural language query statement is used to query data in a data table to be queried, wherein the data table to be queried includes at least one parent table; a candidate data table generation module for inputting the natural language query statement and the data table to be queried into a sub-table recall model to obtain at least one candidate data table, wherein at least one candidate data table includes at least one sub-table of at least one parent table; a target data table determination module for determining a target data table from at least one candidate data table; a conversion module for 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.

[0018] In combination with the second aspect, in certain implementations of the second aspect, the target data table determination module is specifically used to: generate a visualization interface for displaying representative information of at least one candidate data table to the user, wherein the representative information of at least one candidate data table includes any one or more of the following: the name of a column of at least one candidate data table, example data in at least one candidate data table, the name of a parent table to which at least one child table belongs, and the category of the parent table to which at least one child table belongs; receive a selection operation, the selection operation indicating the target data table selected by the user from at least one candidate data table on the visualization interface.

[0019] In combination with the second aspect, in certain implementations of the second aspect, the target data table determination module is specifically used to: sort at least one candidate data table according to the relevance of at least one candidate data table to the natural language query statement; determine the Q candidate data tables before sorting as the target data table, where Q is a positive integer greater than or equal to 1.

[0020] In combination with the second aspect, in some implementations of the second aspect, the device further includes an updating module for training a sub-table recall model based on the data table to be queried, the natural language query statement, and the target data table to update the sub-table recall model.

[0021] In combination with the second aspect, in some implementations of the second aspect, the device further includes a query module, which is used to use a structured query statement to query in the to-be-queried data table to obtain a data query result.

[0022] In a third aspect, a computing device is provided, comprising a processor and a memory, wherein the memory is used to store instructions, and the processor is used to call and execute the instructions from the memory, so that the computing device executes the method in the first aspect or any possible implementation of the first aspect.

[0023] In a fourth aspect, a computing device cluster is provided, comprising at least one computing device, each computing device comprising a processor and a memory, wherein the memory is used to store instructions, and the processor is used to call and execute the instructions from the memory, so that the computing device cluster executes the method in the first aspect or any possible implementation of the first aspect.

[0024] Optionally, the processor may be a general-purpose processor, which may be implemented in hardware or software. When implemented in hardware, the processor may be a logic circuit, an integrated circuit, or the like; when implemented in software, the processor may be a general-purpose processor implemented by reading software code stored in a memory, which may be integrated into the processor or located independently of the processor.

[0025] In a fifth aspect, a chip is provided, which obtains instructions and executes the instructions to implement the method in the above-mentioned first aspect or any possible implementation manner of the first aspect.

[0026] Optionally, as an implementation, the chip includes a processor and a data interface, and the processor reads instructions stored in the memory through the data interface to execute the method in the above-mentioned first aspect or any possible implementation of the first aspect.

[0027] Optionally, as an implementation method, the chip may also include a memory, in which instructions are stored, and the processor is used to execute the instructions stored in the memory. When the instructions are executed, the processor is used to execute the method in the above-mentioned first aspect or any possible implementation method of the first aspect.

[0028] In a sixth aspect, a computer program product comprising instructions is provided. When the instructions are executed by a computing device cluster, the computing device cluster executes the method in the first aspect or any possible implementation of the first aspect.

[0029] In a seventh aspect, a computer-readable storage medium is provided, comprising computer program instructions. When the computer instructions are executed by a computing device cluster, the computing device cluster executes the method in the above-mentioned first aspect or any possible implementation manner of the first aspect.

[0030] By way of example, these computer-readable storage media include, but are not limited to, one or more of the following: read-only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), Flash memory, electrically EPROM (EEPROM), and a hard drive.

[0031] Optionally, as an implementation manner, the above-mentioned storage medium may specifically be a non-volatile storage medium. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] FIG1 is a schematic diagram of a system for querying table data based on natural language provided by an embodiment of the present application.

[0033] FIG2 is a schematic diagram of another system for querying table data based on natural language provided by an embodiment of the present application.

[0034] FIG3 is a schematic diagram of a cloud system applied in the cloud field provided by an embodiment of the present application.

[0035] FIG4 is a schematic flowchart of a method for processing a natural language query statement provided in an embodiment of the present application.

[0036] FIG5 is a schematic diagram of a mother table provided in an embodiment of the present application.

[0037] FIG6 is a schematic diagram of a sub-table provided in an embodiment of the present application.

[0038] FIG7 is a schematic diagram of a candidate data table provided in an embodiment of the present application.

[0039] FIG8 is a schematic diagram of another candidate data table provided in an embodiment of the present application.

[0040] FIG9 is a schematic diagram of a visualization interface for displaying a candidate data table provided in an embodiment of the present application.

[0041] FIG10 is a schematic diagram of another visualization interface for displaying a candidate data table provided in an embodiment of the present application.

[0042] FIG11 is a schematic diagram of another visualization interface for displaying a candidate data table provided in an embodiment of the present application.

[0043] FIG12 is a schematic diagram of a visualization interface for creating a new target data table provided in an embodiment of the present application.

[0044] FIG13 is a schematic structural block diagram of a natural language query statement processing device provided in an embodiment of the present application.

[0045] FIG14 is a schematic structural block diagram of a computing device provided in an embodiment of the present application.

[0046] FIG15 is a schematic structural block diagram of a computing device cluster provided in an embodiment of the present application.

[0047] FIG16 is a schematic structural block diagram of another computing device cluster provided in an embodiment of the present application. DETAILED DESCRIPTION

[0048] The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings.

[0049] This application will present various aspects, embodiments, or features around systems including multiple devices, components, modules, etc. It should be understood and appreciated that each system may include additional devices, components, modules, etc., and / or may not include all of the devices, components, modules, etc. discussed in conjunction with the figures. Furthermore, combinations of these aspects may also be used.

[0050] Additionally, in the embodiments of this application, words such as "exemplary" and "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described in this application as "exemplary" should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of the word "exemplary" is intended to present concepts in a concrete manner.

[0051] In the embodiments of the present application, “corresponding” and “relevant” may sometimes be used interchangeably. It should be noted that when the distinction between them is not emphasized, the meanings they intend to express are consistent.

[0052] The network architecture and business scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. A person skilled in the art will appreciate that, with the evolution of the network architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are equally applicable to similar technical problems.

[0053] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in yet other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0054] In this application, "at least one" means one or more, and "more" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: including the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.

[0055] To facilitate understanding, the following first introduces relevant terms and concepts that may be involved in the embodiments of this application.

[0056] 1. SQL: Structured Query Language (SQL) is a computer programming language used to operate databases. It is used to store, read, query, and modify data in relational databases. SQL allows you to query data from database tables to obtain the required information.

[0057] 2. NL2SQL: Natural language to SQL (NL2SQL) is a technology that converts natural language query statements into SQL, allowing users to query data without requiring database expertise, thereby lowering the barrier to entry for database users. Currently, most NL2SQL technologies utilize deep learning methods in an end-to-end manner to map natural language to SQL templates, extract key information, and generate SQL to complete database queries.

[0058] 3. Table Question Answering: Table question answering is a task that provides answers to natural language questions based on the content of a table. This task can be described as: inputting a table set T (consisting of one or more tables) and a natural language question Q, and outputting the correct answer A. The table format refers to the table format of a database. Currently, table question answering tasks are generally completed using NL2SQL technology. Specifically, the user's natural language query statement and the data table to be queried are input into a deep learning model. The model converts the natural language into SQL, queries the table to be queried, and outputs the query results. The deep learning model that performs the conversion of natural language query statements into SQL query statements in the table question answering process is called an NL2SQL model.

[0059] 4. Subtable: For a data table in a database, a column of the data table is called a field. A data table can be considered a set of fields. All proper subsets of this set of fields are called subtables of the data table, and the data table is called the parent table to which these subtables belong. Subtables and parent tables have a corresponding ownership relationship, and a parent table can have one or more subtables. For example, if data table A consists of M fields, then data table B consisting of N fields selected from these M fields is called a subtable of data table A, where M and N are positive integers greater than 1, and M is greater than N.

[0060] With the gradual informatization of various industries, the demand for data query and analysis is continuously expanding. However, querying data from databases requires using database-specific SQL, which has certain user barriers. NL2SQL is a technology developed for natural language form question answering tasks. Its goal is to convert user-entered natural language query statements into SQL queries, thereby lowering the barrier to entry for database users.

[0061] However, the NL2SQL model often encounters situations where the input data tables to be queried are large and contain many fields. A table to be queried may include dozens or even hundreds of fields, resulting in slow NL2SQL processing and low accuracy. If multi-table queries are required, the input data to the NL2SQL model may also include multiple tables to be queried. Joint queries across multiple large tables further slow the NL2SQL process and reduce its accuracy, thus affecting the efficiency and accuracy of the final data query. Therefore, how to efficiently and accurately convert natural language queries into SQL queries has become a pressing technical challenge.

[0062] In reality, a user's query often involves only a few fields. For example, "What was the profit of product A in the first half of last year?" The query only includes fields such as time, product name, and profit. However, each table to be queried may contain hundreds of fields. Directly using the entire table as input for the NL2SQL model, and forcing the model to convert the natural language query into SQL based on all the fields included, would take a long time and could result in significant errors.

[0063] In view of this, an embodiment of the present application provides a method for processing natural language query statements. Based on the natural language query statement input by the user, a sub-table with fewer fields in the data table to be queried is first obtained as the target data table, and then the target data table is used as the input of the NL2SQL model, thereby narrowing the range of fields that need to be retrieved when the natural language query statement is converted into an SQL query statement, improving the efficiency and accuracy of converting the natural language query statement into an SQL query statement, and thereby improving the efficiency and accuracy of querying data based on natural language.

[0064] In order to better understand the solution of the embodiment of the present application, the following briefly introduces the possible application scenarios of the embodiment of the present application with reference to Figures 1 to 3.

[0065] Figure 1 shows a system for querying tabular data using natural language. The system includes a user device 20 and a computing device 10. The user device 20 includes an intelligent terminal such as a mobile phone, a personal computer, or an information processing center. The user device 20 is the initiator of data processing. A user can initiate a request through the user device 20, such as a request to query tabular data using a natural language question in the embodiment of the present application.

[0066] The computing device 10 can be a device or server with data processing capabilities, such as a cloud server, a network server, an application server, and a management server. The computing device 10 is configured with an input / output (I / O) interface 13 for data interaction with external devices. The user can input data (such as a natural language query statement in the embodiment of the present application) to the I / O interface 13 through the user device 20. The processor 11 can call the data (such as the data table to be checked), code, etc. in the memory 12 for corresponding processing (such as training to obtain a target model / rule, or using the target model / rule for reasoning, etc. The target model / rule can be, for example, a sub-table recall model, an NL2SQL model, etc. in the embodiment of the present application), or store the corresponding processed data (such as a candidate data table recalled based on the data table to be checked), instructions, etc. into the memory 12. Finally, the I / O interface 13 returns the processing result, such as the processing result of the data obtained above, to the user device 20, thereby providing it to the user, such as providing the query result to the user device 20 in the embodiment of the present application.

[0067] It is worth noting that the memory 12 in the computing device 10 can be a general term, including local storage and a database for storing external data. The database can be on the computing device 10 or on other network servers or server clusters.

[0068] In FIG1 , a computing device 10 may execute the method for processing a natural language query statement according to an embodiment of the present application.

[0069] Figure 2 shows another system for querying table data based on natural language. In Figure 2, the user device 20 directly serves as the computing device 10. The user device 20 can directly receive input from the user and directly process it by the hardware of the user device 20 itself. The specific process is similar to that of Figure 1. Please refer to the above description and will not be repeated here.

[0070] In FIG2 , the user device 20 itself can execute the method for processing natural language query statements according to the embodiment of the present application.

[0071] Optionally, the method for processing natural language query statements of the embodiment of the present application can also be applied in the field of cloud computing. Figure 3 shows a schematic diagram of a cloud system of the embodiment of the present application applied in the cloud field.

[0072] As shown in Figure 3, cloud management platform 310 manages the infrastructure that provides multiple cloud services. This infrastructure includes multiple cloud data centers, each of which contains multiple servers. Each server contains cloud service resources and provides corresponding cloud services to tenants. Cloud services can include cloud storage services such as data warehouses, data lakes, and data lakehouses. They can also include cloud services based on these cloud storage services, such as business intelligence (BI) systems.

[0073] The cloud management platform 310 provides an access interface (such as an interface or application program interface (API)). Tenants can operate the client remote access access interface to register a cloud account and password on the cloud management platform and log in to the cloud management platform. After the cloud management platform successfully authenticates the cloud account and password, the tenant can further pay to select and purchase a virtual machine with specific specifications (processor, memory, disk) on the cloud management platform. After the payment is successful, the cloud management platform provides the remote login account and password of the purchased virtual machine. The client can remotely log in to the virtual machine and use the cloud services provided by the cloud service provider in the virtual machine.

[0074] The functions of the cloud management platform 310 include, but are not limited to, a user console, computing management services, network management services, storage management services, authentication services, and image management services. The user console provides an interface or API for interacting with tenants. The computing management service manages servers running virtual machines and containers, as well as bare metal servers. The network management service manages network services (such as gateways and firewalls). The storage management service manages storage services (such as data bucket services). The authentication service manages tenant accounts and passwords. The image management service manages virtual machine images.

[0075] Tenants use client 330 to log in to cloud management platform 310 via the internet 320 to obtain data stored in the cloud service (e.g., the data table to be checked in the embodiment of the present application). Cloud management platform 310 can provide users with a service for querying tabular data using natural language based on the data table to be checked.

[0076] In FIG3 , the cloud management platform 310 may execute the method for processing natural language query statements according to an embodiment of the present application.

[0077] The following describes in detail the method for processing natural language query statements of the present application in conjunction with FIG4 .

[0078] FIG4 shows a schematic flow chart of a method for processing a natural language query statement provided in an embodiment of the present application. Optionally, the method of FIG4 can be executed by a processor, such as the processor 11 in FIG1 and FIG2 above, or by a device including a processor, such as the computing device 10 in FIG1 and FIG2 above, or by a computing device cluster, such as the cloud management platform 310 in FIG3 above. For the sake of brevity, some embodiments of the present application are described below using the computing device 10 as an example of the execution subject, but it is clear to those skilled in the art that this description does not constitute a limitation on the scope of the present application.

[0079] As shown in FIG4 , the method includes the following steps S410 to S440 .

[0080] S410: Obtain a natural language query statement.

[0081] For example, in step S410, the computing device 10 may obtain a natural language query statement input by the user. By way of example and not limitation, the natural language query statement may be a query command, such as "Query the profit of product A in the first half of last year," or a natural language question, such as "Which retail companies are located in community YY in city XX after 2013?" Alternatively, the natural language query statement input by the user may be in voice, text, or any other natural language expression form, which is not specifically limited in this application.

[0082] Specifically, a natural language query statement is used to query data in a data table to be checked. The data table to be checked may include one or more parent tables. As an example, FIG5 shows a schematic diagram of a parent table in an embodiment of the present application. As shown in FIG5 , “Basic Information Table of Company in City A” is the name of the parent table. The parent table includes multiple fields, and each column in the table in the figure corresponds to a field. The first row of each column is called the name of the column, such as “Company Name”, “Year of Establishment”, “Introduction”, etc. The other rows of each column are the data corresponding to the column. It should be understood that FIG5 only exemplarily shows a schematic diagram of a parent table, and the data table to be checked may also include one or more other parent tables, such as “Basic Information Table of Company in City B”, “Information Table of Legal Representative of Company in City A”, “Information Table of Legal Representative of Company in City B”, etc. Each parent table may include the same fields or different fields.

[0083] Optionally, the data table to be checked may be input by a user. For example, the computing device 10 may accept a data table uploaded by a user through the user device 20 as the data table to be checked.

[0084] Alternatively, the data table to be queried can be obtained by the computing device 10 from a database. The database can be stored locally on the computing device, on a network server, or in a server cluster providing cloud storage services. For example, the computing device 10 can access a BI system and obtain a data table from the underlying cloud service for storing data (e.g., a data lake) as the data table to be queried, thereby providing the BI system with an accurate and efficient natural language query service for tabular data.

[0085] In some possible implementations, computing device 10 may preprocess the retrieved data table to be queried before subsequent processing steps. Preprocessing methods include, but are not limited to: processing structural information such as the type, primary key, and foreign key of the data table fields; normalizing the data table contents, such as capitalization, synonym replacement, and Chinese number conversion; and organizing the data table contents into a dictionary for future use. This normalizes the data in the data table, making it easier for neural network models to achieve convergence when performing inference or training using normalized data, thereby improving the efficiency and accuracy of natural language data queries.

[0086] S420: Inputting the natural language query statement and the data table to be checked into the child table recall model to obtain at least one candidate data table, wherein the at least one candidate data table includes at least one child table of at least one parent table in the data table to be checked.

[0087] For example, in step S420, the computing device 10 may use the natural language query statement input by the user and the data table to be checked obtained in S410 as the input of the trained sub-table recall model, thereby obtaining at least one candidate data table output by the sub-table recall model. Among them, at least one candidate data table includes at least one sub-table of at least one parent table in the above-mentioned data table to be checked. Specifically, a single candidate data table can be a parent table in the above-mentioned data table to be checked, or it can be a sub-table composed of some fields selected from a parent table, and all candidate data tables include at least one of the above-mentioned sub-tables. It should be understood that the candidate data table and the data table to be checked are not limited to a one-to-one correspondence. For example, the candidate data table may include multiple different sub-tables of the first data table to be checked in the data table to be checked, while the candidate data table may not include the second data table to be checked in the data table to be checked and any sub-table of the second data table to be checked.

[0088] As an example, Figure 6 shows a schematic diagram of a sub-table in an embodiment of the present application. As shown in Figure 6, sub-table A includes three fields with column names of "Company Name", "Community" and "Enterprise Registration Place", and sub-table B includes two fields with column names of "Company Name" and "Taxes in the Last Three Years". The above fields are all included in the "Basic Information Table of Company in City A" in the example shown in Figure 5. Therefore, sub-table A and sub-table B are both sub-tables of the parent table in the example shown in Figure 5. When the "Basic Information Table of Company in City A" shown in Figure 5 is one of the data tables to be checked, sub-table A and sub-table B may both be one of the candidate data tables.

[0089] Specifically, the subtable recall model can recall candidate data tables based on the relevance between the data table to be queried and the natural language query statement. For example, the subtable recall model can extract the names of the columns in the input data table to be queried, and based on a string comparison algorithm, give a relevance score for each column name relative to the natural language query statement (the higher the score, the higher the relevance), and further give a relevance score for the combination of different column names relative to the natural language query statement, thereby outputting the field combinations corresponding to the top P combinations with the highest relevance scores as P candidate data tables, where P is a positive integer greater than or equal to 1. The P candidate data tables include at least one subtable of at least one parent table in the above-mentioned data table to be queried. In most cases, only some of the fields contained in each parent table in the data table to be checked are related to the natural language query statement input by the user. In this case, the P candidate data tables may all be child tables of the parent table in the data table to be checked; in other cases, the natural language query statement input by the user involves more fields, and all the fields of several parent tables in the data table to be checked are related to the natural language query statement input by the user. In this case, the P candidate data tables may include several parent tables in the data table to be checked. It should be understood that the above examples are only for illustrating the way in which the child table recall model generates candidate data tables, and do not limit the specific algorithm of the child table recall model. The child table recall model can also determine the candidate data table based on other algorithms, such as calculating the edit distance of the combination of the names of different columns relative to the natural language query statement, etc. This application does not make specific limitations on this.

[0090] Optionally, when recalling candidate data tables, the sub-table recall model can sort the candidate data tables according to the relevance of the candidate data tables to the natural language query statement. For example, in the example described above, the P candidate data tables output by the sub-table recall model can be sorted according to the relevance scores of the corresponding P field combinations. As an example, the candidate data tables that are ranked higher have higher relevance scores for the field combinations corresponding to them, and the candidate data table ranked first is the candidate data table corresponding to the combination with the highest relevance score among the above P combinations. Through the above method, the candidate data tables output by the sub-table recall model can be sorted according to the relevance to the natural language query statement, so that the computing device can determine the default target data table from the candidate data tables according to the above sorting. In addition, if the candidate data tables are subsequently displayed to the user, the displayed content can be made clearer and more organized to facilitate user selection.

[0091] S430: Determine a target data table from at least one candidate data table.

[0092] For example, in step S430 , the computing device 10 may determine one or more candidate data tables as target data tables from the at least one candidate data table acquired in S420 .

[0093] In some possible implementations, the computing device 10 may determine the target data table from the candidate data tables according to a default sort order. Specifically, the candidate data tables ranked first by Q are determined as the target data table, where Q is a positive integer greater than or equal to 1.

[0094] In some cases, the user's query statement corresponds to a single-table query problem, and the P candidate data tables may come from the same parent table, for example, P different sub-tables of the same parent table. In this case, the computing device 10 can default to selecting the candidate data table with the highest ranking among the P candidate data tables as the target data table. As an example, for the natural language query statement S1 of the parent table "Basic Information Table of Companies in City A" in the example shown in FIG5 , which is "What retail companies are there in the YY community in City XX after 2013?", FIG7 shows the three candidate data tables output by the sub-table recall model in this case, as well as the order of relevance of these three candidate data tables to the natural language query statement S1. As shown in FIG7 , sub-table 1, sub-table 2, and sub-table 3 are all sub-tables of the parent table "Basic Information Table of Companies in City A" in the example shown in FIG5 , and sub-table 1 ranks first in relevance to the natural language query statement S1, sub-table 2 ranks second in relevance to the natural language query statement S1, and sub-table 3 ranks third in relevance to the natural language query statement S1. At this time, the computing device 10 selects subtable 1 as the target data table by default, so as to subsequently implement NL2SQL for the single-table query problem.

[0095] In some cases, the user's query statement corresponds to a multi-table joint query problem. P candidate data tables may come from multiple parent tables. For example, if the Q candidate data tables ranked highest among the P candidate data tables are child tables of Q different parent tables, the computing device 10 may select these Q candidate data tables as the target data tables by default. In this case, Q is a positive integer greater than 1 and less than P. As an example, the data tables to be queried include "Information table of legal representative of companies in City A" and "Basic information table of companies in City A." The natural language query statement S2 for the above-mentioned data tables to be queried is "Query the contact information of the legal representative of software development companies in the YY community in XX City." Figure 8 shows the three candidate data tables output by the sub-table recall model in this case and the order of relevance of these three candidate data tables to the natural language query statement S2. In Figure 8, the relevance of sub-table 1 to the natural language query statement S2 is ranked first, the relevance of sub-table 2 to the natural language query statement S2 is ranked second, and the relevance of sub-table 3 to the natural language query statement S2 is ranked third. Since the software development category belongs to the "Middle Category Name" field, and the names of the "Enterprise Registration Location" and "Community" columns involved in the query statement both correspond to fields in the "City A Company Basic Information Table," but the legal representative's contact number corresponds to a field in the "City A Company Legal Representative Information Table," as shown in Figure 8 , the top two subtables 1 and 2 in the three candidate data tables are subtables of the "City A Company Basic Information Table" and the "City A Company Legal Representative Information Table," respectively. At this point, computing device 10 defaults to selecting subtables 1 and 2 as the target data tables, enabling the subsequent implementation of NL2SQL for multi-table join queries.

[0096] Through the above approach, we can sort candidate data tables based on their relevance to natural language query statements, and by default select the top Q candidate data tables as target data tables, thereby improving the accuracy of selecting target data tables from candidate data tables and, in turn, the accuracy of converting natural language query statements to SQL queries. Furthermore, when multiple candidate data tables with the highest relevance come from multiple query tables, we can also default to selecting multiple candidate data tables from different query tables as target data tables, thus implementing NL2SQL for multi-table joint query problems and further improving the accuracy of converting natural language query statements to SQL queries in multi-table joint query problems.

[0097] In other possible implementations, the computing device 10 may also display the candidate data table to the user, thereby determining the target data table based on the user's selection. Specifically, the computing device 10 is capable of generating a visualization interface for displaying representative information of at least one of the above-mentioned candidate data tables to the user, and receiving a selection operation, wherein the selection operation is used to indicate the target data table selected by the user from at least one candidate data table on the visualization interface. Among them, the representative information of the candidate data table may include, but is not limited to, any one or more of the following: the name of the column of the candidate data table, the example data in the candidate data table, the name of the parent table to which the candidate data table belongs, and the category of the parent table to which the candidate data table belongs. The visualization interface provided in the embodiment of the present application is illustrated below with reference to Figures 9 to 11.

[0098] Figure 9 shows a schematic diagram of a visualization interface for displaying candidate data tables provided by an embodiment of the present application. As shown in Figure 9, the visualization interface displays representative information of four candidate data tables to the user, including the name of the parent table to which the candidate data tables belong, the name of the columns, and sample data. Taking sub-table 1 in Figure 9 as an example, "from -XX City Company Basic Information Table" is used to indicate that the name of the parent table to which sub-table 1 belongs is "XX City Company Basic Information Table". The first row of sub-table 1 is the name of the column, and the second row is a data in each column as an example, so that the user can clearly know which fields are included in the sub-table and what type of data is stored in each field. Optionally, the visualization interface can display representative information of the candidate data table according to the default sorting of the candidate data table output by the sub-table recall model. Taking the situation shown in Figure 9 as an example, sub-tables 1 to sub-table 4 can be arranged in descending order according to the relevance score output by the sub-table recall model, where sub-table 1 has the highest relevance score among the four candidate data tables, and sub-table 4 has the lowest relevance score among the four candidate data tables, so that the user can more clearly know the output results of the sub-table recall model.

[0099] According to the representative information displayed above, the user can understand the information of each candidate data table, and thus select the candidate data table that meets the user's query requirements as the target data table. Optionally, the visualization interface can provide the user with a mark that can be checked in front of each candidate data table. The user can check one or more candidate data tables in the visualization interface and click the "Confirm" button to complete the selection of the target data table. For example, as shown in Figure 9, the user checks sub-table 2, and the computing device 10 can determine sub-table 2 as the target data table. When the candidate data tables displayed in the visualization interface come from multiple parent tables, the user can also check multiple candidate data tables from different parent tables. For example, as shown in Figure 10, the user checks sub-table 2 and sub-table 4 at the same time, and the computing device 10 can determine sub-table 2 and sub-table 4 as target data tables.

[0100] Optionally, the representative information of the candidate data tables displayed in the visualization interface may also include the category of the parent table to which the candidate data tables belong. For example, when there are a large number of data tables to be searched, in order to facilitate the user to quickly find the required candidate data table from multiple candidate data tables based on the parent table to which they belong in the visualization interface, the visualization interface may also display the category of the parent table before the name of the parent table to which each candidate data table belongs.

[0101] As an example and not a limitation, when the method for processing natural language query statements provided in the embodiment of the present application is applied to a BI system, the computing device 10 obtains a large number of data tables to be queried from the data lake of the BI system. When a user queries "How much was the profit of product A in the second half of last year?", the visualization interface is shown in Figure 11. The four candidate data tables displayed are from different parent tables, and each parent table belongs to a different category. For example, sub-table 1 is a sub-table of parent table 1 "XX Product Profit Statement", and the parent table 1 belongs to the "Revenue" category; sub-table 2 is a sub-table of parent table 2 "XX Product Information Table", and the parent table 2 belongs to the "Product Information" category; sub-table 3 is a sub-table of parent table 3 "XX Operation and Maintenance Record Table", and the parent table 3 belongs to the "Operation and Maintenance" category; sub-table 4 is a sub-table of parent table 4 "XX Activity Table", and the parent table 4 belongs to the "Activity" category. Since the user needs to query profit-related information, when the user selects the target data table in the visualization interface, he can quickly find and check the corresponding sub-table 1 according to the "Revenue" category.

[0102] Optionally, the computing device 10 may also generate a target data table based on a user's creation operation. For example, when there is no candidate data table that meets the user's query requirements in the candidate data tables displayed in the visualization interface, the user may click a "New Sub-Table" button as shown in any of the visualization interfaces in Figures 9 to 11, and the computing device may generate a visualization interface for creating a new target data table.

[0103] Figure 12 shows a schematic diagram of a visualization interface for creating a new target data table, provided in an embodiment of the present application. As shown in Figure 12, the visualization interface can present representative information of the parent table to which the child tables in the candidate data table belong to. The user selects some fields in the parent table by clicking and then clicking the "Generate" button, causing the computing device 10 to generate the target data table based on the fields selected by the user.

[0104] Through the above method, the visual interface displays candidate data tables to users and provides users with the function of selecting target data tables from the candidate data tables, allowing users to understand the process of determining the target data table input into the NL2SQL model, improving the interpretability of NL2SQL results, and allowing users to control and constrain the scope of the target data table according to their own query requirements, thereby improving the accuracy of converting natural language query statements into SQL query statements.

[0105] Optionally, the computing device 10 may also update the sub-table recall model based on the target data table selected by the user. For example, if the target data table selected by the user through the visual interface is different from the target data table selected by the sub-table recall model by default, the computing device 10 may train the sub-table recall model based on the target data table, the natural language query statement, and the target data table to update the sub-table recall model.

[0106] Specifically, the computing device 10 can use the user's query table and the natural language query statement entered as training data, and the user-selected target data table as the label for the training data, thereby obtaining labeled training data. The training data serves as the input to the sub-table recall model during training, and the label serves as the expected output of the sub-table recall model. Based on the labeled training data, the sub-table recall model can be trained in a supervised manner, and the parameters of the sub-table recall model can be adjusted to bring the actual output of the sub-table recall model closer to the expected output, thereby updating the sub-table recall model.

[0107] Through the above method, when the user participates in the process of selecting the target data table from the candidate data table and modifies the default sorting result output by the sub-table recall model, the sub-table recall model can be further trained based on the user's selection of the candidate data table, thereby updating the sub-table recall model so that the candidate data table recalled by the sub-table recall model better meets the user's query requirements.

[0108] S440: Input the natural language query statement and the target data table into the NL2SQL model to obtain a structured query statement.

[0109] For example, in step S440, the computing device 10 may use the natural language query statement input by the user and the target data table selected in S430 as input to the NL2SQL model, thereby obtaining an SQL query statement output by the NL2SQL model. NL2SQL models include, but are not limited to, multitask question answering networks (MQANs), SEQ2SQL, SqlNet, Sqlova, TypeSQL, X-SQL, Coarse2Fine, Pointer-SQL, and Annotated Seq2Seq. By replacing the query table with the target data table as the input to the NL2SQL model, interfering redundant fields can be reduced, while also avoiding the problem of excessive input data size for the NL2SQL model.

[0110] Through the technical solution of the embodiment of the present application, a sub-table with fewer fields is obtained according to the data table to be queried based on the natural language query statement as the input of the NL2SQL model, thereby narrowing the range of fields that need to be retrieved when the natural language query statement is converted into an SQL query statement, and improving the efficiency and accuracy of converting the natural language query statement into an SQL query statement.

[0111] Optionally, after obtaining the SQL query statement through the above method, the computing device 10 can use the obtained SQL query statement to query the data table to obtain a data query result. The data query result can be data in the data table to be checked, or it can be an answer statement generated based on the data in the data table to be checked, and this application does not specifically limit this.

[0112] Through the above method, the more accurate SQL query statement obtained according to the technical solution of this application can be used to query data from the data table to be queried, thereby improving the efficiency and accuracy of the query data, thereby improving the efficiency and accuracy of the entire process of querying data based on natural language.

[0113] FIG13 shows a schematic structural block diagram of a natural language query statement processing device 1300 provided in an embodiment of the present application.

[0114] As shown in FIG. 13 , the processing device 1300 includes: an acquisition module 1310 , a candidate data table generation module 1320 , a target data table determination module 1330 , and a conversion module 130 .

[0115] Specifically, the acquisition module 1310 is used to acquire a natural language query statement, where the natural language query statement is used to query data in a to-be-queried data table, wherein the to-be-queried data table includes at least one parent table.

[0116] Specifically, the candidate data table generating module 1320 is used to input the natural language query statement and the data table to be queried into the child table recall model to obtain at least one candidate data table, wherein the at least one candidate data table includes at least one child table of at least one parent table.

[0117] Specifically, the target data table determining module 1330 is configured to determine a target data table from at least one candidate data table.

[0118] Optionally, the target data table determination module 1330 is specifically used to generate a visualization interface for displaying representative information of at least one candidate data table to the user, wherein the representative information of at least one candidate data table includes any one or more of the following: the name of a column of at least one candidate data table, example data in at least one candidate data table, the name of a parent table to which at least one child table belongs, and the category of the parent table to which at least one child table belongs; and receive a selection operation, where the selection operation indicates the target data table selected by the user from at least one candidate data table on the visualization interface.

[0119] Optionally, the target data table determination module 1330 is specifically configured to sort at least one candidate data table according to the relevance between the at least one candidate data table and the natural language query statement; and determine the Q candidate data tables before sorting as target data tables, where Q is a positive integer greater than or equal to 1.

[0120] Specifically, the conversion module 1340 is used to input the natural language query statement and the target data table into the natural language to structured query statement model to obtain a structured query statement.

[0121] Optionally, in some possible implementations, the processing device 1300 further includes an updating module 1350 for training a sub-table recall model based on the to-be-queried data table, the natural language query statement, and the target data table to update the sub-table recall model.

[0122] Optionally, in some possible implementations, the processing device 1300 further includes a query module 1360 for querying the to-be-queried data table using a structured query statement to obtain a data query result.

[0123] The above modules can be implemented in software or hardware. For example, the implementation of the target data table determination module 1330 will be described below using the target data table determination module 1330 as an example. Similarly, the implementation of the acquisition module 1310, candidate data table generation module 1320, conversion module 1340, update module 1350, and query module 1360 can refer to the implementation of the target data table determination module 1330.

[0124] As an example of a software functional unit, the target data table determination module 1330 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Furthermore, the computing instance may be one or more. For example, the target data table determination module 1330 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one data center or multiple geographically close data centers. Typically, a region may include multiple AZs.

[0125] Similarly, multiple hosts / virtual machines / containers running the code can be distributed within the same virtual private cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Cross-region communication between two VPCs within the same region, or between VPCs in different regions, requires a communication gateway within each VPC to interconnect the VPCs.

[0126] As an example of a hardware functional unit, the target data table determination module 1330 may include at least one computing device, such as a server. Alternatively, the target data table determination module 1330 may be implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0127] The multiple computing devices included in the target data table determination module 1330 can be distributed in the same region or in different regions. The multiple computing devices included in the target data table determination module 1330 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the target data table determination module 1330 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of servers, ASICs, PLDs, CPLDs, FPGAs, GALs, and other computing devices.

[0128] It should be noted that, in other embodiments, the acquisition module 1310, the candidate data table generation module 1320, the target data table determination module 1330, the conversion module 1340, the update module 1350 and the query module 1360 can be used to respectively execute any step in the above-mentioned natural language query statement processing method. The steps that the acquisition module 1310, the candidate data table generation module 1320, the target data table determination module 1330, the conversion module 1340, the update module 1350 and the query module 1360 are responsible for implementing can be specified as needed. The full functions of the natural language query statement processing device are realized by respectively implementing different steps in the above-mentioned natural language query statement processing method through the acquisition module 1310, the candidate data table generation module 1320, the target data table determination module 1330, the conversion module 1340, the update module 1350 and the query module 1360.

[0129] This application also provides a computing device 100. As shown in FIG14 , computing device 100 includes a bus 102, a processor 104, a memory 106, and a communication interface 108. Processor 104, memory 106, and communication interface 108 communicate with each other via bus 102. Computing device 100 may be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in computing device 100.

[0130] Bus 102 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, among others. Buses may be classified as address buses, data buses, control buses, and the like. For ease of illustration, FIG14 illustrates a single bus line, but this does not imply a single bus or type of bus. Bus 102 may include a path for transmitting information between various components of computing device 100 (e.g., memory 106, processor 104, and communication interface 108).

[0131] The processor 104 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0132] The memory 106 may include volatile memory, such as random access memory (RAM). The processor 104 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).

[0133] Memory 106 stores executable program code, which processor 104 executes to implement the functions of the aforementioned acquisition module, candidate data table generation module, target data table determination module, conversion module, update module, and query module, thereby implementing the aforementioned method for processing natural language queries. Specifically, memory 106 stores instructions for executing the aforementioned method for processing natural language queries.

[0134] The communication interface 108 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 100 and other devices or a communication network.

[0135] Embodiments of the present application also provide a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smartphone.

[0136] As shown in Figure 15, the computing device cluster includes at least one computing device 100. The memory 106 of one or more computing devices 100 in the computing device cluster may store the same instructions for executing the above-mentioned method for processing natural language query statements.

[0137] In some possible implementations, the memory 106 of one or more computing devices 100 in the computing device cluster may also store partial instructions for executing the method for processing the natural language query. In other words, the combination of one or more computing devices 100 can jointly execute the instructions for executing the method for processing the natural language query.

[0138] It should be noted that the memory 106 in different computing devices 100 in the computing device cluster can store different instructions, each for executing a portion of the functions of the apparatus for processing natural language query statements. That is, the instructions stored in the memory 106 in different computing devices 100 can implement the functions of one or more of the acquisition module, candidate data table generation module, target data table determination module, conversion module, update module, and query module.

[0139] In some possible implementations, one or more computing devices in a computing device cluster may be connected via a network. The network may be a wide area network (WAN) or a local area network (LAN), etc. FIG16 shows a possible implementation. As shown in FIG16 , two computing devices 100A and 100B are connected via a network. Specifically, the network is connected via a communication interface in each computing device. In this type of possible implementation, the memory 106 in the computing device 100A stores instructions for executing the functions of the acquisition module and the candidate data table generation module. At the same time, the memory 106 in the computing device 100B stores instructions for executing the functions of the target data table determination module and the conversion module.

[0140] It should be understood that the functions of the computing device 100A shown in FIG16 may also be completed by multiple computing devices 100. Similarly, the functions of the computing device 100B may also be completed by multiple computing devices 100.

[0141] An embodiment of the present application also provides a chip, which includes a processor and a data interface. The processor reads instructions stored in a memory through the data interface to execute the above-mentioned method for processing natural language query statements.

[0142] Embodiments of the present application also provide a computer program product comprising instructions. The computer program product may be software or a program product comprising instructions that can be executed on a computing device or stored on any available medium. When the computer program product is executed on at least one computing device, the at least one computing device executes the above-described method for processing natural language query statements.

[0143] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center that contains one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to execute the above-mentioned method for processing natural language query statements.

[0144] The technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above-mentioned embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0145] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the protection scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for processing natural language query statements, characterized in that: include: Obtaining a natural language query statement, where the natural language query statement is used to query data in a to-be-queried data table, wherein the to-be-queried data table includes at least one parent table; Inputting the natural language query statement and the to-be-queried data table into a sub-table recall model to obtain at least one candidate data table, wherein the at least one candidate data table includes at least one sub-table of the at least one parent table; Determine a target data table from the at least one candidate data table; The natural language query statement and the target data table are input into a natural language to structured query statement model to obtain a structured query statement.

2. The method according to claim 1, characterized in that Determining the target data table from the at least one candidate data table comprises: Generate a visualization interface for 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 includes any one or more of the following: a name of a column of the at least one candidate data table, sample data in the at least one candidate data table, a name of a parent table to which the at least one sub-table belongs, and a category of the parent table to which the at least one sub-table belongs; A selection operation is received, wherein the selection operation indicates the target data table selected by the user from the at least one candidate data table on the visualization interface.

3. The method according to claim 1, characterized in that Determining the target data table from the at least one candidate data table comprises: sorting the at least one candidate data table according to the relevance between the at least one candidate data table and the natural language query statement; The candidate data table with Q before sorting is determined as the target data table, where Q is a positive integer greater than or equal to 1.

4. The method according to claim 2, characterized in that: The method further comprises: The sub-table recall model is trained based on the to-be-queried data table, the natural language query statement and the target data table to update the sub-table recall model.

5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: The structured query statement is used to query the to-be-queried data table to obtain a data query result.

6. A natural language query statement processing device, characterized in that: include: An acquisition module, used for acquiring a natural language query statement, wherein the natural language query statement is used for querying data in a to-be-queried data table, wherein the to-be-queried data table includes at least one parent table; a candidate data table generating module, configured to input the natural language query statement and the to-be-queried data table into a sub-table recall model to obtain at least one candidate data table, wherein the at least one candidate data table includes at least one sub-table of the at least one parent table; A target data table determining module, configured to determine a target data table from the at least one candidate data table; The conversion module is used to 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.

7. The device according to claim 6, characterized in that The target data table determination module is used to: Generate a visualization interface for 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 includes any one or more of the following: a name of a column of the at least one candidate data table, sample data in the at least one candidate data table, a name of a parent table to which the at least one sub-table belongs, and a category of the parent table to which the at least one sub-table belongs; A selection operation is received, wherein the selection operation indicates the target data table selected by the user from the at least one candidate data table on the visualization interface.

8. The device according to claim 6, characterized in that The target data table determination module is used to: sorting the at least one candidate data table according to the relevance between the at least one candidate data table and the natural language query statement; The candidate data table with Q before sorting is determined as the target data table, where Q is a positive integer greater than or equal to 1.

9. The device according to claim 7, characterized in that The device also includes: An updating module is used to train the sub-table recall model based on the to-be-queried data table, the natural language query statement and the target data table to update the sub-table recall model.

10. The device according to any one of claims 6 to 9, characterized in that The device also includes: The query module is used to query the to-be-queried data table using the structured query statement to obtain data query results.

11. A computing device cluster, characterized in that: comprising at least one computing device, each computing device comprising a processor and a memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method according to any one of claims 1 to 5.

12. A computer program product comprising instructions, characterized in that When the instructions are executed by a computing device cluster, the computing device cluster is caused to perform the method according to any one of claims 1 to 5.

13. A computer-readable storage medium, characterized in that: The method comprises computer program instructions, and when the computer program instructions are executed by a computing device cluster, the computing device cluster performs the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Natural language query statement processing method and device

    CN118779340A

  • Method and device for outputting structured query statements

    CN111159220A

  • Natural language data query method and device, electronic equipment and storage medium

    CN114281957A

  • Method, system and device for converting natural language query into SQL and storage medium

    CN114547072A

  • Using multiple natural language classifiers to associate a generic query with a structured question type

    US20180096058A1

Cited By

  • Data table screening method and device, electronic equipment and computer program product

    CN119149549A

  • Database table recall method, device and system and storage medium

    CN119357220A

  • Intelligent question answering system and method based on combination of large language model and NL2SQL

    CN119760071A

  • Data analysis method and device, storage medium and program product

    CN120030039A

  • Data processing method, server, storage medium and program product

    CN120144612A