Natural language query statement processing method and device

By obtaining the sub-tables of the data table and interacting with the user to select the target data table, it solves the problem of low efficiency and poor accuracy of NL2SQL technology in the case of multiple data tables and multiple fields, and improves the efficiency and accuracy of converting natural language queries to SQL.

CN118779340APending Publication Date: 2024-10-15HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202310323092.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-29
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

The existing natural language to SQL (NL2SQL) technology is inefficient and inaccurate when processing multiple data tables and fields, affecting the efficiency and accuracy of data queries.

Method used

By 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 conversion efficiency and 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 CN118779340A_ABST
    Figure CN118779340A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to the field of artificial intelligence, and provides a natural language query statement processing method and device.The method comprises the steps that a natural language query statement is obtained, and the natural language query statement is used for querying data in a to-be-queried data 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; 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 the natural language-to-structured query statement model to obtain a structured query statement. According to the method, on the basis of the natural language query statement, the sub-table with a smaller field number is obtained according to the to-be-queried data table to serve as the input of the NL2SQL model, so that the field range needing to be retrieved when the natural language query statement is converted into the SQL statement is narrowed, and the efficiency and accuracy of converting the natural language query statement into the SQL statement are improved; and thus, the efficiency and accuracy of querying the data according to the natural language are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the gradual informatization of various industries, the demand for data query and data analysis is constantly expanding. However, querying data from a database requires the use of a database-specific structured query language (SQL), which has certain threshold restrictions for users. The purpose of natural language to SQL (NL2SQL) technology is to convert the natural language query statements entered by users into SQL statements, thereby lowering the threshold for using the database.

[0003] However, there are many data tables in the database, and each data table has many fields and a large scale, which leads to the slow speed and low accuracy of the NL2SQL process based on all the data tables to be queried, thus affecting 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. Summary of the invention

[0004] The embodiment of the present application provides a method and device for processing natural language query statements, which can obtain a sub-table with fewer fields as the input of the NL2SQL model based on the natural language query statement according to the data table to be queried, 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 further improving the efficiency and accuracy of querying data based on natural language.

[0005] 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 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.

[0006] According to the technical solution provided in 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 scope of fields that need to be retrieved when converting the natural language query statement to the SQL query statement, and improving the efficiency and accuracy of converting the natural language query statement to the SQL query statement.

[0007] 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 sub-table belongs, and the category of the parent table to which at least one sub-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.

[0008] 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 their own query requirements, thereby improving the accuracy of converting natural language query statements into SQL query statements.

[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: sorting at least one candidate data table according to the relevance of at least one candidate data table to a natural language query statement; determining Q candidate data tables before sorting as the target data table, where Q is a positive integer greater than or equal to 1.

[0010] According to the above technical solution, based on the relevance ranking between the candidate data tables and the natural language query statements, the candidate data tables ranked first Q by default can be selected as the target data tables, thereby improving the accuracy of selecting the target data tables from the candidate data tables, and further improving the accuracy of converting the natural language query statements to SQL query statements. In addition, when the multiple candidate data tables with the highest relevance come from multiple data tables to be checked, multiple candidate data tables from different data tables to be checked can also be selected by default as the target data tables, thereby realizing NL2SQL for multi-table joint query problems, and further improving the accuracy of converting the natural language query statements to SQL query statements.

[0011] In combination with the first aspect, in some 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.

[0012] 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.

[0013] In combination with the first aspect, in some 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.

[0014] According to the above technical solution, the SQL query statement with higher accuracy 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 querying data, thereby improving the efficiency and accuracy of the entire process of querying data based on natural language.

[0015] In a second aspect, a natural language query statement processing device is provided, including: an acquisition module, used to acquire 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, used to input 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, used to determine a target data table from at least one candidate data table; a conversion module, 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.

[0016] 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 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 sub-table belongs, and the category of the parent table to which at least one sub-table belongs; and receive a selection operation, the selection operation indicating a target data table selected by the user from at least one candidate data table on the visualization interface.

[0017] 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 Q candidate data tables before sorting as the target data table, where Q is a positive integer greater than or equal to 1.

[0018] In combination with the second aspect, in some implementations of the second aspect, the device also includes an updating module, which is used to train the 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.

[0019] 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.

[0020] 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.

[0021] 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.

[0022] Optionally, the processor may be a general-purpose processor, which may be implemented by hardware or software. When implemented by hardware, the processor may be a logic circuit, an integrated circuit, etc.; when implemented by software, the processor may be a general-purpose processor, which is implemented by reading software codes stored in a memory, which may be integrated in the processor or may be located outside the processor and exist independently.

[0023] 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.

[0024] 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.

[0025] 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.

[0026] 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 above-mentioned first aspect or any possible implementation manner of the first aspect.

[0027] 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.

[0028] 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 hard drive.

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

[0030] Figure 1 It is a schematic diagram of a system for querying table data based on natural language provided in an embodiment of the present application.

[0031] Figure 2 It is another schematic diagram of a system for querying table data based on natural language provided in an embodiment of the present application.

[0032] Figure 3 It is a schematic diagram of a cloud system applied in the cloud field provided in an embodiment of the present application.

[0033] Figure 4 It is a schematic flowchart of a method for processing a natural language query statement provided in an embodiment of the present application.

[0034] Figure 5 It is a schematic diagram of a mother table provided in an embodiment of the present application.

[0035] Figure 6 It is a schematic diagram of a sub-table provided in an embodiment of the present application.

[0036] Figure 7 It is a schematic diagram of a candidate data table provided in an embodiment of the present application.

[0037] Figure 8 It is a schematic diagram of another candidate data table provided in an embodiment of the present application.

[0038] Fig. 9 It is a schematic diagram of a visual interface for displaying a candidate data table provided in an embodiment of the present application.

[0039] Fig.10 It is a schematic diagram of another visualization interface for displaying a candidate data table provided in an embodiment of the present application.

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

[0041] Fig.12 It is a schematic diagram of a visualization interface for creating a new target data table provided in an embodiment of the present application.

[0042] Fig.13 It is a schematic structural block diagram of a natural language query statement processing device provided in an embodiment of the present application.

[0043] Fig.14 It is a schematic structural block diagram of a computing device provided in an embodiment of the present application.

[0044] Fig.15 It is a schematic structural block diagram of a computing device cluster provided in an embodiment of the present application.

[0045] Fig.16 It is a schematic structural block diagram of another computing device cluster provided in an embodiment of the present application. DETAILED DESCRIPTION

[0046] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0047] The present application will present various aspects, embodiments or features around a system 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 devices, components, modules, etc. discussed in conjunction with the figures. In addition, combinations of these schemes may also be used.

[0048] In addition, in the embodiments of the present application, words such as "exemplary" and "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of the word "exemplary" is intended to present concepts in a concrete way.

[0049] In the embodiments of the present application, "corresponding (corresponding, relevant)" and "corresponding (corresponding)" can sometimes be used interchangeably. It should be pointed out that when the distinction between them is not emphasized, the meanings they intend to express are consistent.

[0050] 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 of ordinary skill in the art can 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.

[0051] References to "one embodiment" or "some embodiments" etc. described in this specification mean that a particular feature, structure or characteristic described in conjunction with the embodiment is included in one or more embodiments of the present application. Thus, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear at different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0052] In the present application, "at least one" means one or more, and "plurality" 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 items 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.

[0053] To facilitate understanding, relevant terms and concepts that may be involved in the embodiments of the present application are first introduced below.

[0054] 1. SQL: Structured query language (SQL) is a computer programming language for operating databases. It is used to store, read, query and modify data in relational databases. SQL language can be used to query data from the data tables contained in the database to obtain the required information.

[0055] 2. NL2SQL: Natural language to SQL (NL2SQL) is a technology that converts natural language query statements into SQL, allowing users to query data without having to have professional knowledge of the database, thereby lowering the threshold for using the database. Currently, most NL2SQL technologies use deep learning methods to map natural language to SQL templates end-to-end, extract key information, form SQL, and complete database query tasks.

[0056] 3. Table Question Answering: Table question answering is a task that gives answers to natural language questions based on the content of a table. The task can be described as: input a table set T (containing one or more tables) and a question Q in natural language form, and output the correct answer A. The form of the table refers to the table form of the database. Currently, table question answering tasks are generally completed by NL2SQL technology, that is, the natural language query statement entered by the user and the data table to be queried are input into the deep learning model, the model converts natural language into SQL, queries the table to be queried and outputs the query results. Among them, the deep learning model that executes the conversion of natural language query statements into SQL query statements in the above table question answering process can be called the NL2SQL model.

[0057] 4. Subtable: For a data table in a database, a column of the data table is called a field. A data table can be regarded as a set of fields. All true subsets of the field set are called subtables of this data table, and this data table is called the parent table to which these subtables belong. There is a corresponding relationship between the subtable and the parent table, and a parent table can have one or more subtables. For example, if a data table A consists of M fields, then a 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.

[0058] With the gradual informatization of various industries, the demand for data query and data analysis is constantly expanding. However, querying data from a database requires the use of database-specific SQL, which has certain threshold restrictions for users. NL2SQL is a technology developed to perform natural language form question-answering tasks. Its purpose is to convert the natural language query statements entered by users into SQL query statements, thereby lowering the threshold for using the database.

[0059] However, the NL2SQL model often encounters situations where the input data table to be queried has many fields and is large in scale. The data table to be queried may include dozens or even hundreds of fields, resulting in a slow speed and low accuracy of the NL2SQL process. If multi-table query is required, the input data of the NL2SQL model may also include multiple data tables to be queried. Joint query of multiple large-scale data tables will further lead to a slow speed and low accuracy of the NL2SQL process, thereby affecting 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.

[0060] In fact, users will not involve many fields in a query. For example, "What is the profit of product A in the first half of last year?" The query content only includes fields such as time, product name, and profit, while each data table to be queried may include hundreds of fields. Directly using all the data tables to be queried as the input of the NL2SQL model, the model will convert the natural language query statement into an SQL query statement based on all the fields included, which will take a long time and may cause large errors.

[0061] 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 further improving the efficiency and accuracy of querying data based on natural language.

[0062] In order to better understand the solution of the embodiment of the present application, Figures 1 to 3 The possible application scenarios of the embodiments of the present application are briefly introduced.

[0063] Figure 1 A system for querying table data according to natural language is shown, and 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, and the user can initiate a request through the user device 20, such as a request for querying table data according to a natural language question in the embodiment of the present application.

[0064] The computing device 10 may be a device or server with data processing functions 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 an external device. The user may input data (e.g., 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 may call the data (e.g., a data table to be checked), code, etc. in the memory 12 for corresponding processing (e.g., training to obtain a target model / rule, or using the target model / rule for reasoning, etc., the target model / rule may be, for example, a subtable recall model, an NL2SQL model, etc. in the embodiment of the present application), or may store the corresponding processed data (e.g., a candidate data table recalled according to the data table to be checked), instructions, etc. in 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.

[0065] 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.

[0066] exist Figure 1 In the embodiment of the present application, the computing device 10 can execute the method for processing natural language query statements.

[0067] Figure 2 Another system for querying table data based on natural language is shown. Figure 2 In the example, 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 the same as Figure 1 Similarly, please refer to the above description and will not repeat them here.

[0068] exist Figure 2 In the embodiment of the present application, the user device 20 itself can execute the method for processing the natural language query statement.

[0069] Optionally, the method for processing natural language query statements of the embodiments of the present application may also be applied in the field of cloud computing. Figure 3 A schematic diagram of a cloud system in which an embodiment of the present application is applied in the cloud field is shown.

[0070] like Figure 3As shown, the cloud management platform 310 is used to manage the infrastructure that provides multiple cloud services, and the infrastructure includes multiple cloud data centers, each of which includes multiple servers, and each server includes cloud service resources to provide corresponding cloud services for tenants. Cloud services can include cloud storage services, such as data warehouses, data lakes, and data lakehouses, and can also include cloud services based on the above cloud storage services, such as business intelligence (BI) systems.

[0071] The cloud management platform 310 provides an access interface (such as an interface or an application program interface (API)). The tenant 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.

[0072] The functions of the cloud management platform 310 include but are not limited to user console, computing management service, network management service, storage management service, authentication service, and image management service. The user console provides an interface or API to interact with tenants, the computing management service is used to manage servers running virtual machines and containers and bare metal servers, the network management service is used to manage network services (such as gateways, firewalls, etc.), the storage management service is used to manage storage services (such as data bucket services), the authentication service is used to manage tenants' accounts and passwords, and the image management service is used to manage virtual machine images.

[0073] Tenants can use client 330 to log in to cloud management platform 310 through Internet 320 to obtain data stored in cloud services (such as 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 table data based on natural language based on the data table to be checked.

[0074] exist Figure 3 In the embodiment of the present application, the cloud management platform 310 can execute the method for processing natural language query statements.

[0075] Combine the following Figure 4 , describes in detail the method for processing natural language query statements of the present application.

[0076] Figure 4A schematic flow chart of a method for processing a natural language query statement provided in an embodiment of the present application is shown. Optionally, Figure 4 The method may be executed by a processor, such as the above Figure 1 and Figure 2 The processor 11 in the embodiment may be executed by a device including a processor, such as the above Figure 1 and Figure 2 The computing device 10 in the embodiment may also be executed by a computing device cluster, such as the above Figure 3 The cloud management platform 310 in the embodiment. For the sake of brevity, the following describes some embodiments of the present application by taking 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.

[0077] like Figure 4 As shown, the method includes the following steps S410 to S440.

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

[0079] For example, in step S410, the computing device 10 may obtain a natural language query statement input by the user. As an example and not a 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 "what retail companies are there in community YY in city XX after 2013?" Optionally, the natural language query statement input by the user may be in voice form, text form, or any other natural language expression form, which is not specifically limited in this application.

[0080] Specifically, the natural language query statement is used to query data in the to-be-queried data table. The to-be-queried data table may include one or more parent tables. As an example, Figure 5 FIG. 1 is a schematic diagram of a mother table in an embodiment of the present application. Figure 5 As shown in the figure, "Basic Information Table of Companies in City A" is the name of the master table. The master table includes multiple fields. Each column in the table corresponds to a field. The first row of each column is called the column name, 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 Figure 5 Only a schematic diagram of a parent table is shown as an example. The data table to be queried 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.

[0081] 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.

[0082] Optionally, the data table to be checked can be obtained by the computing device 10 from a database. The database can be stored locally on the computing device, or in a network server, or in a server cluster that provides cloud storage services. For example, the computing device 10 can access the BI system and obtain a data table from the underlying cloud service for storing data (such as a data lake) of the BI system as the data table to be checked, thereby providing the BI system with an accurate and efficient service for querying table data based on natural language.

[0083] In some possible implementations, the computing device 10 may preprocess the acquired data table to be queried before the subsequent processing steps. The preprocessing means include but are not limited to: processing the type, primary key, foreign key and other structural information of the data table fields; normalizing the data table contents, such as unifying uppercase and lowercase letters, replacing synonyms, converting Chinese numbers, etc.; organizing the data table contents into a dictionary for backup. In this way, the data in the data table can be normalized, and the neural network model can more easily obtain convergent results by using normalized data for reasoning or training, thereby improving the efficiency and accuracy of querying data based on natural language.

[0084] S420: Input the natural language query statement and the data table to be checked into the 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 at least one parent table in the data table to be checked.

[0085] 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.

[0086] As an example, Figure 6 FIG. 2 shows a schematic diagram of a sub-table in an embodiment of the present application. Figure 6 As shown, subtable A includes three fields named "Company Name", "Community" and "Enterprise Registration Place", and subtable B includes two fields named "Company Name" and "Taxes in the Last Three Years". Figure 5 In the example shown, the "Basic Information Table of Companies in City A" is used, so both sub-table A and sub-table B are Figure 5 The example shown is a child table of the parent table. Figure 5 When the "Basic Information Table of Companies in City A" is one of the data tables to be checked, both sub-table A and sub-table B may be one of the candidate data tables.

[0087] 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 give a relevance score of each column name relative to the natural language query statement based on a string comparison algorithm (the higher the score, the higher the relevance), and further give a relevance score of the combination of different column names relative to the natural language query statement, so as to output 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, among all the fields contained in each parent table in the data table to be checked, only some of the fields 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 according to other algorithms, such as calculating the edit distance of the combination of names of different columns relative to the natural language query statement, etc. This application does not make specific limitations on this.

[0088] 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 corresponding field combinations with higher relevance scores, 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.

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

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

[0091] In some possible implementations, the computing device 10 may determine the target data table from the candidate data table according to a default sort. Specifically, the candidate data table with the highest Q rankings is determined as the target data table, where Q is a positive integer greater than or equal to 1.

[0092] In some cases, the user 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 child tables of the same parent table. In this case, the computing device 10 may select the candidate data table with the highest ranking among the P candidate data tables as the target data table by default. Figure 5 In the example shown, the natural language query statement S1 of the parent table "Basic Information Table of Companies in City A" is "What retail companies are there in Community YY in City XX after 2013?". Figure 7 The figure shows the three candidate data tables output by the subtable recall model in this case and the order of relevance between the three candidate data tables and the natural language query statement S1. Figure 7 As shown, sub-table 1, sub-table 2 and sub-table 3 are Figure 5 In the example shown, the subtables are the parent table "Basic Information Table of Companies in City A", and the relevance ranking of subtable 1 to natural language query statement S1 is first, the relevance ranking of subtable 2 to natural language query statement S1 is second, and the relevance ranking of subtable 3 to natural language query statement S1 is third. At this time, the computing device 10 selects subtable 1 as the target data table by default, so as to subsequently implement NL2SQL for single-table query problems.

[0093] In some cases, the user query statement corresponds to a multi-table joint query problem. P candidate data tables may come from multiple parent tables. For example, the top Q candidate data tables in the P candidate data tables are child tables of Q different parent tables. Then the computing device 10 can select the 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 "A City Company Legal Representative Information Table" and "A City Company Basic Information Table". The natural language query statement S2 for the above data tables to be queried is "Query the contact information of the legal representative of the software development company in YY community in XX City". Figure 8 The figure shows the three candidate data tables output by the sub-table recall model in this case and the order of relevance between the three candidate data tables and the natural language query statement S2. Figure 8In the table, the relevance of subtable 1 to natural language query statement S2 is ranked first, the relevance of subtable 2 to natural language query statement S2 is ranked second, and the relevance of subtable 3 to 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 Place" and "Community" columns involved in the query statement correspond to the fields in the "A City Company Basic Information Table", but the legal person's contact number corresponds to the field in the "A City Company Legal Representative Information Table". Therefore, Figure 8 As shown, the top two sub-tables 1 and 2 in the three candidate data tables are sub-tables of "Basic Information Table of Companies in City A" and "Information Table of Legal Representatives of Companies in City A". At this time, the computing device 10 selects sub-table 1 and sub-table 2 as target data tables by default, so as to subsequently implement NL2SQL for multi-table joint query problems.

[0094] Through the above method, the candidate data tables can be sorted based on the relevance between the candidate data tables and the natural language query statements, and the candidate data tables with the top Q in the ranking can be selected as the target data tables by default, thereby improving the accuracy of selecting the target data table from the candidate data tables, and further improving the accuracy of converting the natural language query statements to SQL query statements. In addition, when multiple candidate data tables with the highest relevance come from multiple data tables to be checked, multiple candidate data tables from different data tables to be checked can also be selected as target data tables by default, thereby realizing NL2SQL for multi-table joint query problems, and further improving the accuracy of converting natural language query statements to SQL query statements in multi-table joint query problems.

[0095] In some 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 candidate data tables to the user, and receiving a selection operation, wherein the selection operation is used to indicate a target data table selected by the user from at least one of the candidate data tables on the visualization interface. 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 a column in the candidate data table, 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. Figures 9 to 11 The visual interface provided by the embodiments of the present application is illustrated by way of example.

[0096] Fig. 9 A schematic diagram of a visualization interface for displaying a candidate data table provided in an embodiment of the present application is shown. Fig. 9 As shown in the figure, the visualization interface shows the user representative information of four candidate data tables, including the name of the parent table to which the candidate data table belongs, the name of the column, and sample data. Fig. 9For example, "from -XX City Company Basic Information Table" is used to indicate that the parent table to which subtable 1 belongs is "XX City Company Basic Information Table". The first row of subtable 1 is the name of the column, and the second row is a data in each column as an example, so that users can clearly know which fields are included in the subtable 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 subtable recall model. Fig. 9 Taking the shown situation as an example, sub-tables 1 to 4 can be arranged in descending order according to the relevance scores 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 users can more clearly know the output results of the sub-table recall model.

[0097] Based on the representative information displayed above, the user can understand the information of each candidate data table, and thus select a 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 check mark 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 Fig. 9 In the illustrated case, the user selects 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 select multiple candidate data tables from different parent tables, for example Fig.10 In the illustrated situation, the user checks both sub-table 2 and sub-table 4, and the computing device 10 is able to determine sub-table 2 and sub-table 4 as target data tables.

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

[0099] As an example but not a limitation, when the natural language query statement processing method provided in the embodiment of the present application is applied to the 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 "What was the profit of product A in the second half of last year?", the visualization interface is as follows: Fig.11As shown, the four candidate data tables displayed come 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 Table", and parent table 1 belongs to the "Revenue" category; sub-table 2 is a sub-table of parent table 2 "XX Product Information Table", and 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 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 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 visual interface, he can quickly find and check the corresponding sub-table 1 according to the "Revenue" category.

[0100] Optionally, the computing device 10 may also generate a target data table according to the user's new creation operation. For example, when there is no candidate data table that can meet the user's query requirements in the candidate data table displayed in the visualization interface, the user can click on Figures 9 to 11 The computing device may generate a visual interface for creating a new target data table by clicking the "Create Subtable" button shown in any visual interface.

[0101] Fig.12 FIG. 1 is a schematic diagram showing a visualization interface for creating a new target data table provided in an embodiment of the present application. Fig.12 As shown, the visualization interface can present representative information of the parent table to which the child table in the candidate data table belongs to to the user. The user selects some fields in the parent table by clicking and clicks the "Generate" button, so that the computing device 10 generates the target data table according to the fields selected by the user.

[0102] Through the above method, the visualization interface displays candidate data tables to users and provides users with the function of selecting target data tables from candidate data tables, so that users can perceive the process of determining the target data table input into the NL2SQL model, improve the interpretability of NL2SQL results, and enable 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.

[0103] Optionally, the computing device 10 may also update the sub-table recall model according to the target data table selected by the user. For example, when 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 data table to be queried, the natural language query statement and the target data table to update the sub-table recall model.

[0104] Specifically, the computing device 10 can use the data table to be queried by the user and the input natural language query statement as training data, and the target data table selected by the user as the label of the training data, thereby obtaining labeled training data. The training data is used as the input of the sub-table recall model during training, and the label is used as the expected output of the sub-table recall model. Based on the labeled training data, the sub-table recall model can be supervisedly trained, and the parameters of the sub-table recall model can be adjusted so that the actual output of the sub-table recall model is closer to the expected output, thereby realizing the update of the sub-table recall model.

[0105] Through the above method, 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.

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

[0107] 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 the input of the NL2SQL model, thereby obtaining the SQL query statement output by the NL2SQL model. The NL2SQL model includes but is not limited to multitask question answering network (MQAN), SEQ2SQL, SqlNet, Sqlova, TypeSQL, X-SQL, Coarse2Fine, Pointer-SQL, AnnotatedSeq2Seq, etc. By replacing the to-be-queried data table with the target data table as the input of the NL2SQL model, it is possible to reduce interfering redundant fields and avoid the problem of too large input data of the NL2SQL model.

[0108] 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 scope of fields that need to be retrieved when converting the natural language query statement to the SQL query statement, and improving the efficiency and accuracy of converting the natural language query statement to the SQL query statement.

[0109] Optionally, after obtaining the SQL query statement through the above method, the computing device 10 can use the obtained SQL query statement to query in the data table to be checked to obtain the data query result. The data query result can be the 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 make specific limitations on this.

[0110] Through the above method, the more accurate SQL query statement obtained according to the technical solution of the present 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.

[0111] Fig.13 A schematic structural block diagram of a natural language query statement processing device 1300 provided in an embodiment of the present application is shown.

[0112] like Fig.13 As shown, 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 .

[0113] 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.

[0114] 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 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 at least one parent table.

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

[0116] 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 sub-table belongs, and the category of the parent table to which at least one sub-table belongs; and 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.

[0117] Optionally, the target data table determination module 1330 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; and determine Q candidate data tables before sorting as target data tables, where Q is a positive integer greater than or equal to 1.

[0118] 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.

[0119] Optionally, in some possible implementations, the processing device 1300 further includes an updating module 1350, which 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.

[0120] 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.

[0121] Among them, the above modules can be implemented by software or hardware. Exemplarily, the implementation of the target data table determination module 1330 is introduced below by taking the target data table determination module 1330 as an example. Similarly, the implementation of the acquisition module 1310, the candidate data table generation module 1320, the conversion module 1340, the update module 1350 and the query module 1360 can refer to the implementation of the target data table determination module 1330.

[0122] As an example of a software functional unit, the target data table determination module 1330 may include code running on a computing instance. Among them, the computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the above-mentioned 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 (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 a data center or multiple data centers with similar geographical locations. Among them, usually a region may include multiple AZs.

[0123] Similarly, multiple hosts / virtual machines / containers used to run the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, a VPC is set up in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway needs to be set up in each VPC to achieve interconnection between VPCs through the communication gateway.

[0124] 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, etc. Alternatively, the target data table determination module 1330 may also be a device implemented by 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.

[0125] 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 computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.

[0126] 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 execute any step in the above-mentioned natural language query statement processing method respectively, and 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 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 respectively implement different steps in the above-mentioned natural language query statement processing method to realize all the functions of the natural language query statement processing device.

[0127] The present application also provides a computing device 100. Fig.14 As shown, the computing device 100 includes: a bus 102, a processor 104, a memory 106, and a communication interface 108. The processor 104, the memory 106, and the communication interface 108 communicate with each other through the bus 102. The computing device 100 can be a server or a terminal device. It should be understood that the present application does not limit the number of processors and memories in the computing device 100.

[0128] The bus 102 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.14 The bus 102 is represented by only one line, but it does not mean that there is only one bus or one type of bus. The bus 102 may include a path for transmitting information between various components of the computing device 100 (eg, the memory 106, the processor 104, and the communication interface 108).

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

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

[0131] The memory 106 stores executable program codes, and the processor 104 executes the executable program codes to respectively 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 natural language query statement processing method. That is, the memory 106 stores instructions for executing the aforementioned natural language query statement processing method.

[0132] 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.

[0133] The embodiment of the present application also provides 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 smart phone.

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

[0135] 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 above-mentioned method for processing natural language query statements. In other words, the combination of one or more computing devices 100 may jointly execute the instructions for executing the above-mentioned method for processing natural language query statements.

[0136] It should be noted that the memory 106 in different computing devices 100 in the computing device cluster can store different instructions, which are respectively used to execute part of the functions of the processing device for the above-mentioned natural language query statement. That is, the instructions stored in the memory 106 in different computing devices 100 can realize the functions of one or more modules among the acquisition module, the candidate data table generation module, the target data table determination module, the conversion module, the update module and the query module.

[0137] In some possible implementations, one or more computing devices in the computing device cluster may be connected via a network, which may be a wide area network or a local area network. Fig.16 A possible implementation is shown. Fig.16 As shown, 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 the functions of the target data table determination module and the conversion module.

[0138] It should be understood that Fig.16 The functions of the computing device 100A shown in FIG. 1 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.

[0139] 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 natural language query statement processing method.

[0140] The embodiment of the present application also provides a computer program product including instructions. The computer program product may be software or a program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes the above-mentioned method for processing natural language query statements.

[0141] 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 containing one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk). The computer-readable storage medium includes instructions that instruct the computing device to execute the above-mentioned natural language query statement processing method.

[0142] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described 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.

[0143] 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, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. 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

Cited By

  • Intelligent number asking method and device based on natural language, intelligent agent and electronic equipment

    CN120723799A

  • Natural language query statement processing method and device

    EP4682737A1

  • Natural language query statement processing method and device

    WO2024198725A1