Structured sentence generation method, and sports database-based question answering method

By acquiring database descriptions and historical interaction information, generating requirement extraction prompts using requirement extraction prompt templates, and inputting them into a question-and-answer model to obtain user requirement information, the problem of poor database adaptability and low efficiency in existing technologies is solved, thereby improving the accuracy and efficiency of structured statement generation without training the model.

WO2026026311A1PCT designated stage Publication Date: 2026-02-05CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PTE LTD +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/102682
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-07-30
Filing Date
2025-06-23
Publication Date
2026-02-05

AI Technical Summary

Technical Problem

Existing text-to-database methods rely on training with large-scale data, resulting in poor adaptability across different databases, low efficiency, and difficulty in improving the efficiency of structured sentence generation while ensuring accuracy.

Method used

By acquiring database description information and target historical interaction information, demand extraction prompts are generated using demand extraction prompt templates, input into a question-and-answer model to obtain user demand information, and the target database is identified in the database to generate structured statements.

Benefits of technology

Without requiring additional model training, it improves the accuracy and efficiency of structured statement generation, ensuring accurate understanding of user needs and efficient execution of database operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025102682_05022026_PF_FP_ABST
    Figure CN2025102682_05022026_PF_FP_ABST
Patent Text Reader

Abstract

A structured sentence generation method, comprising: obtaining target historical interaction information comprising current question information and obtaining database description information corresponding to at least one database; on the basis of a demand extraction prompt template, processing the target historical interaction information and the database description information, generating a demand extraction prompt word, inputting the demand extraction prompt word into a question answering model, and obtaining user demand information outputted by the question answering model; on the basis of the user demand information, determining from among the databases a target database comprising at least one target data table; on the basis of the target historical interaction information, the user demand information, the database description information, and each target data table, generating a structured sentence corresponding to the current question information. By means of generating a structured sentence corresponding to a current question on the basis of the user demand information obtained by a demand extraction prompt word template, the structured sentence generated by the model can be more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Structured statement generation methods and question-answering methods based on sports databases

[0001] This disclosure claims priority to Chinese Patent Application No. 202411036109.0, filed with the China Patent Office on July 30, 2024, entitled “Structured Sentence Generation Method and Question Answering Method Based on Sports Database”, the entire contents of which are incorporated herein by reference. Technical Field

[0002] This disclosure relates to the field of computer technology, and in particular to a method for generating structured statements. Background Technology

[0003] With the development of technology, database management systems can manage databases using structured statements, enabling data definition and manipulation, and maintaining data integrity and security. Furthermore, text-to-database methods can convert natural language sentences into structured statements and perform queries within the database.

[0004] Currently, existing text-to-database methods mainly rely on large-scale data training. Models are trained on large datasets to learn text-to-database capabilities. However, to handle different databases, the model needs to be trained separately using data from each database. While this improves the accuracy of text-to-database translation, it reduces the efficiency of the method. Therefore, to address these shortcomings, a more efficient method for generating structured sentences is needed while maintaining accuracy. Summary of the Invention

[0005] In view of this, embodiments of this disclosure provide a structured statement generation method. One or more embodiments of this disclosure also relate to a question-answering method based on a sports database, a question-answering method based on a sports database applied to cloud-side devices, an information processing method based on a question-answering model, a task platform, a structured statement generation device, a computing device, a computer-readable storage medium, and a computer program product, to address the technical deficiencies existing in the prior art.

[0006] According to a first aspect of the present disclosure, a method for generating structured statements is provided, comprising:

[0007] Obtain database description information corresponding to at least one database and obtain target historical interaction information, wherein the target historical interaction information includes current question information;

[0008] Based on the demand extraction prompt template, the target historical interaction information and the description information of each database are processed to generate demand extraction prompt words, and the demand extraction prompt words are input into the question answering model to obtain the user demand information output by the question answering model;

[0009] Based on the user demand information, a target database is determined from each database, wherein the target database includes at least one target data table;

[0010] Based on the target historical interaction information, the user demand information, the database description information corresponding to the target database, and each target data table, a structured statement corresponding to the current problem information is generated.

[0011] According to a second aspect of the present disclosure, a question-answering method based on a sports database is provided, comprising:

[0012] Obtain target historical interaction information and obtain database description information corresponding to at least one sports database, wherein the target historical interaction information includes current sports question information;

[0013] Based on the demand extraction prompt template, the target historical interaction information and the description information of each database are processed to generate demand extraction prompt words, and the demand extraction prompt words are input into the question answering model to obtain the user demand information output by the question answering model;

[0014] Based on the user demand information, a target sports database is determined from each sports database, wherein the target sports database includes at least one target sports data table;

[0015] Based on the target historical interaction information, the user demand information, the database description information corresponding to the target sports database, and each target sports data table, a structured statement corresponding to the current sports problem information is generated;

[0016] The target data is determined in the target sports database according to the structured statement, and the target historical interaction information and the target data are input into the question-answering model to obtain the answer information output by the question-answering model.

[0017] According to a third aspect of the present disclosure, a question-answering method based on a sports database is provided, applied to a cloud-based device, comprising:

[0018] Obtain target historical interaction information and obtain database description information corresponding to at least one sports database, wherein the target historical interaction information includes current sports question information, which is sent by the end device;

[0019] Based on the demand extraction prompt template, the target historical interaction information and the description information of each database are processed to generate demand extraction prompt words, and the demand extraction prompt words are input into the question answering model to obtain the user demand information output by the question answering model;

[0020] Based on the user demand information, a target sports database is determined from each sports database, wherein the target sports database includes at least one target sports data table;

[0021] Based on the target historical interaction information, the user demand information, the database description information corresponding to the target sports database, and each target sports data table, a structured statement corresponding to the current sports problem information is generated;

[0022] The target data is determined in the target database according to the structured statement, and the target historical interaction information and the target data are input into the question-answering model to obtain the answer information output by the question-answering model;

[0023] The answer information is sent to the terminal device.

[0024] According to a fourth aspect of the present disclosure, an information processing method based on a question-answering model is provided, applied to a task platform, including:

[0025] A task generation request sent by a receiving end-side device, wherein the task generation request includes request information;

[0026] Based on the request information, a question-answering model is obtained, wherein the question-answering model obtains user demand information based on target historical interaction information and database description information corresponding to at least one database, determines the target database based on the user demand information and generates structured statements, and the target sports database is any one of the databases;

[0027] Task information is generated based on the question-answering model, wherein the task information is used by the edge device to perform a database-based question-answering task.

[0028] According to a fifth aspect of the present disclosure, a task platform is provided, including a request interface and a response unit;

[0029] The request interface is used to receive a task generation request sent by the end device, wherein the task generation request includes request information;

[0030] The response unit is used to obtain a question-and-answer model based on the request information, and generate task information based on the question-and-answer model. The question-and-answer model obtains user demand information based on target historical interaction information and database description information corresponding to at least one database, determines the target database based on the user demand information and generates structured statements. The target database can be any one of the databases. The task information is used by the end device to execute a database-based question-and-answer task.

[0031] According to a sixth aspect of the present disclosure, a computing device is provided, comprising:

[0032] Memory and processor;

[0033] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, they implement the steps of the above-mentioned structured statement generation method, the question-answering method based on a sports database, the question-answering method based on a sports database applied to cloud devices, and the information processing method based on a question-answering model.

[0034] According to a seventh aspect of the present disclosure, a computer-readable storage medium is provided that stores computer-executable instructions, which, when executed by a processor, implement the steps of the above-described structured statement generation method, the question-answering method based on a sports database, the question-answering method based on a sports database applied to a cloud-side device, and the information processing method based on a question-answering model.

[0035] According to an eighth aspect of the present disclosure, a computer program product is provided, including a computer program / instructions that, when executed by a processor, implement the steps of the above-described structured statement generation method, the question-answering method based on a sports database, the question-answering method based on a sports database applied to a cloud-side device, and the information processing method based on a question-answering model.

[0036] One embodiment of this disclosure implements the following steps: obtaining database description information corresponding to at least one database and obtaining target historical interaction information, wherein the target historical interaction information includes current question information; processing the target historical interaction information and each database description information based on a requirement extraction prompt template to generate requirement extraction prompt words, and inputting the requirement extraction prompt words into a question-answering model to obtain user requirement information output by the question-answering model; determining a target database among the databases based on the user requirement information, wherein the target database includes at least one target data table; and generating a structured statement corresponding to the current question information based on the target historical interaction information, the user requirement information, the database description information corresponding to the target database, and each target data table.

[0037] By applying the solution of this disclosure embodiment, user demand information obtained through demand extraction prompt word templates is used to rewrite the colloquial or defective operations provided by the user into formal expressions. This allows the model to more accurately understand the user's actual needs without training the model, thereby making the structured statement corresponding to the current problem generated by the model based on the aforementioned user demand information more accurate. This improves the efficiency of generating structured statements corresponding to the current problem while ensuring accuracy. Attached Figure Description

[0038] Figure 1 is a flowchart of a structured statement generation method provided in an embodiment of this disclosure;

[0039] Figure 2 is a flowchart of a question-answering method based on a sports database provided in an embodiment of this disclosure;

[0040] Figure 3 is a flowchart of the processing procedure of a question-answering method based on a sports database provided in an embodiment of this disclosure;

[0041] Figure 4 is a flowchart of a question-answering method based on a sports database applied to cloud-side devices according to an embodiment of this disclosure;

[0042] Figure 5 is a flowchart of an information processing method based on a question-answering model provided in an embodiment of this disclosure;

[0043] Figure 6 is a schematic diagram of a task platform provided in an embodiment of this disclosure;

[0044] Figure 7 is a schematic diagram of the structure of a structured statement generation apparatus provided in an embodiment of this disclosure;

[0045] Figure 8 is an architecture diagram of a question-answering system based on a sports database provided in an embodiment of this disclosure;

[0046] Figure 9 is a structural block diagram of a computing device provided in an embodiment of this disclosure. Detailed Implementation

[0047] Numerous specific details are set forth in the following description to provide a full understanding of this disclosure. However, this disclosure can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this disclosure. Therefore, this disclosure is not limited to the specific implementations disclosed below.

[0048] The terminology used in one or more embodiments of this disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this disclosure. The singular forms “a,” “the,” and “the” as used in one or more embodiments of this disclosure and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this disclosure refers to and includes any or all possible combinations of one or more associated listed items.

[0049] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this disclosure, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this disclosure, and similarly, second may also be referred to as first. Depending on the context, the word “if” as used herein may be interpreted as “when”, “in response to a determination”, or “when…”.

[0050] Furthermore, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this disclosure are all information and data authorized by the user or fully authorized by all parties. Moreover, the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0051] In one or more embodiments of this disclosure, a large model refers to a deep learning model with a large number of model parameters, typically containing hundreds of millions, tens of billions, hundreds of billions, trillions, or even tens of trillions of model parameters. A large model can also be called a foundation model. It is pre-trained using large-scale unlabeled corpora to produce a pre-trained model with hundreds of millions of parameters. Such models can adapt to a wide range of downstream tasks and have good generalization ability. Examples include Large Language Models (LLMs) and multi-modal pre-training models.

[0052] In practical applications, large models only require a small number of samples to fine-tune the pre-trained model before they can be applied to different tasks. Large models can be widely used in fields such as Natural Language Processing (NLP) and Computer Vision. Specifically, they can be applied to computer vision tasks such as Visual Question Answering (VQA), Image Captioning (IC), and Image Generation, as well as NLP tasks such as text-based sentiment classification, text summarization, and machine translation. The main application scenarios for large models include digital assistants, intelligent robots, search, online education, office software, e-commerce, and intelligent design.

[0053] First, the terms and concepts involved in one or more embodiments of this disclosure will be explained.

[0054] Structured Query Language (SQL) is used to access and manage data in a database. Its syntax is simple and clear, making it easy to learn and use. With SQL, users can efficiently perform operations such as selecting, updating, and deleting data, while also supporting complex operational conditions and multi-table joins to meet diverse data processing needs.

[0055] This disclosure provides a structured statement generation method, and also relates to a question-and-answer method based on a sports database, a question-and-answer method based on a sports database applied to cloud devices, an information processing method based on a question-and-answer model, a task platform, a structured statement generation device, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail in the following embodiments.

[0056] Referring to Figure 1, Figure 1 shows a flowchart of a structured statement generation method according to an embodiment of the present disclosure, which specifically includes the following steps:

[0057] Step 102: Obtain database description information corresponding to at least one database and obtain target historical interaction information, wherein the target historical interaction information includes current problem information.

[0058] In practical applications, the target historical interaction information includes the user's current question and information about the user's previous interactions with the question-answering model; the database is the database included in the service that provides structured statement generation; the database description information is information that describes the database; the current question information is the question information that the user has entered this time; and the structured statement is the statement that operates on the database.

[0059] Specifically, a database can be understood as a database that stores knowledge related to user input questions. Since multiple databases are involved in a project or function, obtaining multiple databases related to user input questions can ensure that the structured statements generated subsequently have a relatively high accuracy.

[0060] It should be noted that the database description information includes database usage information, data table relationship information, data table usage information corresponding to each data table in the database, data table attribute information, and the data table itself. The database description information can be understood as information that describes the function of the data and the data stored in the database. Specifically, which information is used as the information for generating prompt words depends on the specific situation, and this disclosure does not impose any restrictions on it.

[0061] Database description information can be obtained in various ways. For example, database architecture and table structure information can be queried through the metadata function built into the database management system. Alternatively, database developers or maintainers can manually input the database description information language to retrieve descriptions of specific tables and columns. In addition, the purpose information of the database and the purpose information of each table in the database can be obtained through the large model, and the above two purpose information can be used as the database description information.

[0062] In one embodiment provided in this disclosure, the target historical interaction information is: "User: 'Can you tell me who won the most gold medals in this sports meet?', System: 'Zhang San won the most medals in this sports meet'; User: 'I want to ask which country he is from'", where the statement "I want to ask which country he is from" is the current question information, which corresponds to multiple databases such as database A which records information about the current sports meet, database B which records information about previous sports meets, etc. The description information corresponding to database A is that it records information about the current sports meet, and the description information corresponding to database B is that it records information about previous sports meets.

[0063] It is important to note that obtaining the target historical interaction information can be achieved by directly obtaining the user's current question information and the initial historical interaction information, including the user's input information and model output information prior to the current question information. The current question information is then concatenated with the initial historical interaction information to generate the target historical interaction information.

[0064] Considering that if the user input is merely a casual question, there is no need to access the database, therefore, the target historical interaction information is retrieved, including:

[0065] Obtain the user's current question information and initial historical interaction information, wherein the initial historical interaction information includes user input information and model output information prior to the user's current question information;

[0066] Based on the intent-based prompt template, the current question information, the initial historical interaction information, and the description information of each database are processed to generate intent-based prompt words;

[0067] The intent-based prompts are input into the question-and-answer model to obtain the user intent output by the question-and-answer model.

[0068] If the user's intent is a data query intent, the initial historical interaction information and the user's current question information are determined as the target historical interaction information.

[0069] In practical applications, the initial historical interaction information is the information communicated between the user and the model before obtaining the current question information input by the user; the user input information is the information input by the user through the question-and-answer service; the model output information is the information generated by the question-and-answer model based on the user input information and the interaction information before the user input; the intent judgment prompt template is a prompt word template used by the question-and-answer model to determine whether a database query is needed; the intent judgment prompt word is a prompt word used by the question-and-answer model to judge the user's intent; the question-and-answer model is a large model that can receive text input and output based on the input data; and the user intent is the true intent of the question output by the user in this output.

[0070] Specifically, the intent judgment prompt template can be understood as a prompt word template that prompts the large model to perform intent judgment. Through the above intent judgment, it can determine whether a database query is needed based on user input, combined with dialogue history and database description information. If it is needed (data query intent), the subsequent steps are executed. If it is not needed (non-query intent), such as casual conversation or input unrelated to the database, the large model is used to answer directly.

[0071] It's important to note that the intent assessment template includes role definitions, task descriptions, and classification criteria. The role definition section clearly states that the intelligent assistant needs to determine whether user input is relevant to the database. The task description section emphasizes combining database descriptions and historical conversations for assessment. The classification criteria section distinguishes between data query questions and casual conversation questions. This design ensures that the intelligent assistant can accurately identify user intent, thereby deciding whether to perform a database query.

[0072] In one embodiment provided in this disclosure, the intent determination prompt template is:

[0073] "#Role: You are an intelligent assistant responsible for understanding user input and determining whether a database query is required. If the user input is related to the database, it should be considered a data query question; otherwise, it should be considered a casual conversation question."

[0074] #Task Description: Based on the following database description and historical conversations, determine whether the user's actual intent is a query intent. If the user input is related to the database structure, it is considered a query intent; otherwise, it is considered a non-query intent.

[0075] #Historical Dialogue: {Initial Historical Interaction Information}

[0076] #Database description: {Database description}

[0077] #User input: {Current issue information}”

[0078] Considering that using classification criteria alone for segmentation would reduce the model's ability to combine the classification criteria with the current task, in this embodiment, the classification criteria part of the intent judgment prompt template is: "If the user input is related to the database structure, it is considered a query intent; otherwise, it is considered a non-query intent."

[0079] The initial historical interaction information is "User: 'Can you tell me who won the most gold medals in this sports meet?', System: 'Zhang San won the most medals in this sports meet'", the current question information is "I want to ask which country he is from", and there are two databases. Database A is described as "a database that records information about this sports meet" and database B is described as "a database that records information about previous sports meets".

[0080] The initial historical interaction information is filled into the curly braces following the paragraph "#historical dialogue" in the intent judgment prompt template. The database description information corresponding to databases A and B is then filled into the curly braces following the paragraph "#database description" in the intent judgment prompt template. Finally, the current question information is filled into the curly braces following the paragraph "#user input" in the intent judgment prompt template. The resulting intent judgment prompt is:

[0081] "#Role: You are an intelligent assistant responsible for understanding user input and determining whether a database query is required. If the user input is related to the database, it should be considered a data query question; otherwise, it should be considered a casual conversation question."

[0082] #Task Description: Based on the following database description and historical conversations, determine whether the user's actual intent is a query intent. If the user input is related to the database structure, it is considered a query intent; otherwise, it is considered a non-query intent.

[0083] #Historical Dialogue: {User: Can you tell me who won the most gold medals in this sports meet? System: The athlete who won the most medals in this sports meet is Zhang San.}

[0084] #Database Description: {Database A: Database containing information about this Games; Database B: Database containing information about previous Games}

[0085] #User input: {I want to ask what country he is from}”

[0086] Input the above intent-based prompts into the question-answering model, and the user intent output by the question-answering model will be the query intent.

[0087] In another embodiment provided in this disclosure, the intent judgment prompt template and database description follow the example above. The initial historical interaction information is "User: 'How's the weather today?', System: 'It's sunny today, the temperature is about 25 degrees Celsius, suitable for going out.'", and the current question information is "What clothes are suitable to wear today?". Accordingly, the obtained intent judgment prompt words are:

[0088] "#Role: You are an intelligent assistant responsible for understanding user input and determining whether a database query is required. If the user input is related to the database, it should be considered a data query question; otherwise, it should be considered a casual conversation question."

[0089] #Task Description: Based on the following database description and historical conversations, determine whether the user's actual intent is a query intent. If the user input is related to the database structure, it is considered a query intent; otherwise, it is considered a non-query intent.

[0090] #Historical Dialogue: {User: How's the weather today? System: It's sunny today, the temperature is around 25 degrees Celsius, perfect for going out.}

[0091] #Database Description: {Database A: Database containing information about this Games; Database B: Database containing information about previous Games}

[0092] #User input: {What clothes should I wear today?}”

[0093] When the above intent-based prompts are input into the question-answering model, the user intent output by the model is non-query intent.

[0094] By judging user intent, the system can effectively ensure that it accurately understands user needs, thereby providing more relevant and useful responses. This judgment can effectively distinguish between information requests that require database queries and ordinary casual conversation, ensuring the rational use of system resources, improving interaction efficiency, avoiding unnecessary data query operations, and enhancing user experience and satisfaction.

[0095] Considering that if the user's intent does not require a database query, the large model's capabilities can be directly utilized to answer the user's input, the method further includes, after obtaining the user's intent output by the question-answering model:

[0096] If the user's intent is not a query intent, the user's current question information and the initial historical interaction information are input into the question-answering model to obtain the answer information output by the question-answering model.

[0097] Specifically, after the above intent determination, if the determined user intent is a query intent, such as casual conversation or input unrelated to the database, since it does not require data in the database as a basis for the answer, the large model can be used directly to answer. By utilizing the knowledge inherent in the large model itself, the user's answer can be completed, which can effectively improve the user experience.

[0098] Furthermore, obtain database description information corresponding to at least one database, including:

[0099] Obtain a first database and at least one first data table corresponding to the first database, wherein the first database is any one of the databases;

[0100] Obtain the data table attribute information, data table content information, and data table relationship information corresponding to each first data table;

[0101] Based on the database description prompt template, process the attribute information of each data table, the content information of each data table, and the relationship information of the data tables to obtain the database description prompt words corresponding to the first database;

[0102] The database description prompts are input into the question-answering model to obtain the database usage information corresponding to the first database and the data table usage information corresponding to each first data table output by the question-answering model, and the database usage information and the data table usage information are determined to be the database description information corresponding to the first database.

[0103] In practical applications, a database includes at least one data table. Data table attribute information describes the attributes of the data table; data table content information describes the content stored in the data table; database purpose information describes the function of the database; data table relationship information describes the relationships between the various data tables in the database; database description prompt templates are prompt templates generated using a question-and-answer model; and database description prompt words are prompt words generated by inputting the question-and-answer model to provide prompts for each database description.

[0104] Specifically, the database description hint template can be understood as a textual description of the purpose of each data table in the database and the relationships between the data tables, based on the table structure, the relationships between the tables, and the record samples in the tables. Data table attribute information can be understood as information representing the attributes of the data stored in the data table, which can be presented using SQL (Structured Query Language).

[0105] It's important to note that the database description prompt template includes role definitions, task descriptions, and content elements. The role definition section clearly defines the intelligent assistant's responsibilities: generating a detailed database and descriptions of each table based on the database table structure, relationships between tables, and record samples. The task description section emphasizes the need to generate a text description based on the provided information. The content elements section requires a description of the database's purpose and the function of each table. This design aims to ensure that the generated description is comprehensive and detailed, helping users understand the database's structure and functionality.

[0106] In one embodiment provided in this disclosure, the database description prompt template is as follows:

[0107] "#Role:

[0108] You are an intelligent assistant responsible for generating text descriptions of the database and its various tables based on the provided database table structure, relationships between tables, and sample records.

[0109] #Task Description:

[0110] Based on the table structures, relationships between tables, and sample records from the provided database, please generate a text describing the database in detail. This text should include the purpose of the database and the function of each table.

[0111] # Attributes of each table in the database: {Table attribute information}

[0112] #Contents of each table in the database: {Table content information}

[0113] # Relationships between tables in the database: {Table relationship information}”

[0114] Considering that segmenting the large model with separate content element prompts would reduce the model's ability to combine the extracted content elements with the current task, in this embodiment, the content element part of the database description prompt template is: "This text should include the purpose of the database and the function of each table."

[0115] Database A has three tables: Athletes (for simplicity, we'll refer to table a of Athletes in the following description), Events (for simplicity, we'll refer to table e of Events in the following description), and the relationships between the three tables are as follows: The Athletes table is associated with the Results table via AthleteID, representing each athlete's competition score. The Events table is associated with the Results table via EventID, representing the specific score for each event in each competition. The Results table acts as an intermediary table, connecting the Athletes and Events tables and recording each athlete's ranking in each competition.

[0116] The data table attribute information corresponding to table 'a' is: "CREATE TABLE Athletes(AthleteID INT PRIMARY KEY,Name VARCHAR(100),Country VARCHAR(100)" and its corresponding data table content information is:

[0117] The data table attribute information corresponding to table e is: "CREATE TABLE Events(EventID INT PRIMARY KEY,EventName VARCHAR(100),Category VARCHAR(100)", and its corresponding data table content information is:

[0118] The data table attribute information corresponding to table r is: "CREATE TABLE Results(ResultID INT PRIMARY KEY,AthleteID INT,EventID INT,Position INT,FOREIGN KEY(AthleteID)REFERENCES Athletes(AthleteID),FOREIGN KEY(EventID)REFERENCES Events(EventID)", and its corresponding data table content information is:

[0119] Fill the attribute information of the data tables corresponding to table a, table e, and table r into the curly braces following the paragraph "#Attributes of each table in the database" in the database description prompt template. Then, fill the content information of each of the aforementioned corresponding data tables into the curly braces following the paragraph "#Content of each table in the database" in the database description prompt template. The resulting database description prompt is:

[0120] "#Role:

[0121] You are an intelligent assistant responsible for generating text descriptions of the database and its various tables based on the provided database table structure, relationships between tables, and sample records.

[0122] #Task Description:

[0123] Based on the table structures, relationships between tables, and sample records from the provided database, please generate a text describing the database in detail. This text should include the purpose of the database and the function of each table.

[0124] #Attributes of each table in the database: {Athletes table: "CREATE TABLE Athletes(AthleteID INT PRIMARY KEY,Name VARCHAR(100),Country VARCHAR(100)", Events table: "CREATE TABLE Events(EventID INT PRIMARY KEY,EventName VARCHAR(100),Category VARCHAR(100)", Results table: "CREATE TABLE Results(ResultID INT PRIMARY KEY,AthleteID INT,EventID INT,Position INT,FOREIGN KEY(AthleteID)REFERENCES Athletes(AthleteID),FOREIGN KEY(EventID)REFERENCES Events(EventID)"}

[0125] #Contents of each table in the database: {Athletes table:}

[0126] Events table:

[0127] Results table:

[0128] #Relationships between tables in the database: {The Athletes table is linked to the Results table via AthleteID, representing each athlete's competition results. The Events table is linked to the Results table via EventID, representing the specific results for each event in each competition. The Results table acts as an intermediary table, connecting the Athletes and Events tables and recording each athlete's ranking in each competition.}

[0129] Inputting the database description prompts into the question-answering model, the model outputs the description information for database A as follows: "This database is used to record athlete information, competition events, and athlete results in the sports meet. It contains three main tables: Athletes, Events, and Results."

[0130] 1. Athletes table:

[0131] - Record basic information for each athlete, including athlete ID (primary key), name, and country.

[0132] - Sample data includes records of athletes such as "Zhang San" (Country A), "Li Si" (Country B), and "Wang Wu" (Country C).

[0133] 2. Events table (Competition items table):

[0134] - Store information about the sports meet events, including the event ID (primary key), event name, and category.

[0135] -Example events include "100-meter sprint", "200-meter swim" and "javelin", which belong to the track and field and swimming categories, respectively.

[0136] 3. Results table (competition results table):

[0137] - Record each athlete's performance in various competition events, including performance ID (primary key), athlete ID (foreign key, related to the Athletes table), event ID (foreign key, related to the Events table), and ranking.

[0138] -Example data shows that Zhang San won first place in both the 100-meter sprint and the 200-meter swimming event, Li Si won second place in the 200-meter swimming event, and Wang Wu won third place in the javelin throw event.

[0139] Describing the database clearly shows its structure, the relationships between tables, and the specific data content, which helps to improve the accuracy of generating structured statements for user requirements later.

[0140] Step 104: Based on the requirement extraction prompt template, process the target historical interaction information and the description information of each database to generate requirement extraction prompt words, and input the requirement extraction prompt words into the question answering model to obtain the user requirement information output by the question answering model.

[0141] In practical applications, the requirement extraction prompt template is a prompt word template used to extract user requirements, and the requirement extraction prompt words are prompt words input into the question-answering model to enable the question-answering model to extract the user's actual requirements.

[0142] Specifically, the requirement extraction prompt template can be understood as rewriting the original user input into a formal expression based on user input, combined with dialogue history and database description information. It is mainly used to correct colloquialisms, typos, and missing context.

[0143] It should be noted that the requirement extraction prompt template includes role definitions, task descriptions, and information sources. The role definition section clarifies that the intelligent assistant needs to determine the relevant database based on the user's query and database description information. The information source section provides the database description information. This design ensures that the system can accurately identify the table names involved in the query, especially in complex multi-table query scenarios, improving the accuracy of structured statement generation.

[0144] It is important to note that user demand information can be understood as a complete query statement that represents the user's actual needs. This fully reflects the user's actual needs and avoids the situation where the structured statement output is prone to errors due to the colloquial nature of the user's input.

[0145] In one embodiment provided in this disclosure, the requirement extraction prompt template is:

[0146] "#Role: You are an intelligent query rewriting assistant, responsible for rewriting user-provided colloquial or flawed queries into formal expressions."

[0147] #Task Description:

[0148] 1. Combine with the user's historical conversation records.

[0149] 2. Based on the description information in the database.

[0150] 3. Rewrite the user's final input into a more formal and accurate expression, eliminating colloquialisms, typos, and lack of context.

[0151] #Historical Dialogue: {Initial Historical Interaction Information}

[0152] #Database description: {Database description}

[0153] #User input: {Current issue information}”

[0154] In this embodiment, the information source part in the requirement extraction prompt template is: "Database description: {database description}", the initial historical interaction information is "User: 'Can you tell me who won the most gold medals in this sports meet?', System: 'Zhang San won the most medals in this sports meet'", the current question information is "I want to ask which country he is from", and the description information corresponding to the two databases A is "a database that records information about this sports meet" and the description information corresponding to database B is "a database that records information about previous sports meets".

[0155] Fill the curly braces following the paragraph "#Historical Dialogue" in the requirement extraction prompt template with the initial historical interaction information, and fill the curly braces following the paragraph "#Database Description" in the requirement extraction prompt template with the description information corresponding to Database B. Then fill the curly braces following the paragraph "#User Input" in the requirement extraction prompt template with the current question information. The resulting requirement extraction prompt is:

[0156] "#Role: You are an intelligent query rewriting assistant, responsible for rewriting user-provided colloquial or flawed queries into formal expressions."

[0157] #Task Description:

[0158] 1. Combine with the user's historical conversation records.

[0159] 2. Based on the description information in the database.

[0160] 3. Rewrite the user's final input into a more formal and accurate expression, eliminating colloquialisms, typos, and lack of context.

[0161] #Historical Dialogue: {User: Can you tell me who won the most gold medals in this sports meet? System: The athlete who won the most medals in this sports meet is Zhang San.}

[0162] #Database Description: {Database A: Database containing information about this Games; Database B: Database containing information about previous Games}

[0163] #User input: {I want to ask what country he is from}”

[0164] Input the demand extraction prompts into the question-answering model, and the question-answering model will output the user demand information as: "What country is Zhang San, the athlete who won the most gold medals in this sports meet, from?"

[0165] In another embodiment provided in this disclosure, the initial historical interaction information is "User: 'Do you know how many records were broken in the swimming competition of this Games?', System: 'Five swimming records were broken in this Games.'", the current question information is "Also, when were those records broken?", and there are two databases, A and B, whose description information is "a database containing information about this Games" and "a database containing information about previous Games". The intent judgment prompt words generated based on the above information are input into the question-answering model, and the user request information output by the question-answering model is: "When exactly were the five records broken in the swimming competition of this Games?".

[0166] Extracting user needs information through large models helps clarify users' specific query intentions, avoiding ambiguity caused by colloquial and vague expressions. This not only improves the accuracy of queries and the system's response, but also ensures that the system can efficiently process requests and provide relevant information. By expanding users' short questions into complete query statements, the system can accurately identify the required information type and content, thereby providing more accurate and useful answers, thus improving user experience and satisfaction.

[0167] Step 106: Determine the target database from among the databases based on the user demand information, wherein the target database includes at least one target data table.

[0168] Specifically, in practical applications, user needs usually correspond to a single database, that is, to perform database operations within a single database. Therefore, the target database that the user actually needs to operate on can be determined from among the various databases based on the user's needs information.

[0169] It should be noted that determining the target database to meet user needs can be achieved in various ways. One approach is to first obtain descriptive information from all relevant databases, then match the keywords from the user's needs within those descriptive information to identify the matched databases as the target databases. Another approach is to use a large-scale model to perform semantic parsing of the user's needs, generate query intent, and then intelligently match the large-scale model with the database descriptive information to determine the database most likely to contain the required information as the target database. This disclosure does not impose any limitations on the method used to confirm the target database.

[0170] Step 108: Based on the target historical interaction information, the user demand information, the database description information corresponding to the target database, and each target data table, generate a structured statement corresponding to the current problem information.

[0171] In practical applications, structured statements are statements used to perform database operations. Structured statements can be understood as statements that directly execute database operations, such as SQL statements, etc. This disclosure does not impose any limitations on this.

[0172] For ease of explanation, the examples provided here and below only illustrate user requirement information. Unless otherwise specified, the corresponding target historical interaction information, target database description information, and various data tables are the same as in the previous embodiments. In one embodiment provided in this disclosure, the user requirement information is: "What country is Zhang San, the athlete who won the most gold medals in this sports meet, from?" The corresponding structured statement is "SELECT a.Name, e.EventName, r.Position FROM Athletes a JOIN Results r ON a.AthleteID=r.AthleteID JOIN Events e ON e.EventID=r.EventID WHERE a.Name='Zhang San'".

[0173] In another embodiment provided in this disclosure, the user requirement information is: "Please provide the number of records broken in the swimming competition of this sports meet and their specific times", and the corresponding structured statement is "SELECT e.EventName,r.Position,e.EventDate FROM Events e JOIN Results r ON e.EventID=r.EventID WHERE e.Category='Swimming'".

[0174] Generating structured statements for database operations using natural language input from users allows non-technical users to easily interact with the database without needing to master complex structured statement syntax. This not only improves the convenience and efficiency of data querying and management but also lowers the barrier to entry, making data access more widespread and user-friendly. Using natural language to generate structured statements can also reduce human error, improve query accuracy and system response speed, thereby enhancing the overall user experience and decision-making capabilities.

[0175] Furthermore, based on the target historical interaction information, the user demand information, the database description information corresponding to the target database, and each target data table, a structured statement corresponding to the current problem information is generated, including:

[0176] Obtain the data table description information corresponding to each target data table;

[0177] Based on the target historical interaction information, the user demand information, and the data table description information corresponding to each target data table, at least one user demand data table is obtained.

[0178] Based on the target historical interaction information, the user demand information, the database description information corresponding to the target database, and each user demand data table, a structured statement corresponding to the current problem information is generated.

[0179] In practical applications, the user requirement data table refers to the data tables that users actually use or are affected by in the target database when performing database operations. The data table description information includes the purpose information and attribute information of the data table.

[0180] Specifically, the user requirement data table can be understood as the data table that is actually used or affected by this requirement among multiple data tables stored in the target database.

[0181] In one embodiment provided in this disclosure, the user's request information is: "What country is Zhang San, the athlete who won the most gold medals in this sports meet, from?" Since the user needs to obtain the data table corresponding to the athletes, the data table corresponding to the competition events, and the data table corresponding to the competition results, the corresponding user request data table includes: Athletes table, Results table, and Events table.

[0182] It should be noted that the user requirement data table can be obtained by concatenating the target historical interaction information and user requirement information to extract keywords, and then performing keyword matching in the table description information corresponding to each target data table to determine the matching data table as the user requirement data table. Alternatively, it can be obtained by using a large model to process the target historical interaction information, user requirement information, and the table description information corresponding to each target data table, so that the large model directly outputs the user requirement data table. This disclosure does not impose any limitations on the method of obtaining the user requirement data table. The structured statement can be generated by parsing the target historical interaction information, user requirement information, database description information, and user requirement data table to extract keywords, and then determining and generating specific SQL query statements based on the extracted keywords and fixed rules. Alternatively, it can be obtained by using a large model to process the target historical interaction information, user requirement information, database description information, and user requirement data table, so that the large model directly outputs the structured statement. This disclosure does not impose any limitations on the method of generating the structured statement.

[0183] In another embodiment provided in this disclosure, the user's requirement information is: "Please provide the number of records broken in the swimming competition of this sports meet and their specific times." Since the user needs to obtain the data table corresponding to the competition events and the data table corresponding to the competition results, the corresponding user requirement data table includes: Results table and Events table.

[0184] By first identifying the data tables involved in the structured statement and then generating the structured statement for database operations, the accuracy and relevance of queries can be ensured. This approach helps avoid unnecessary table joins and data accesses, optimizes query performance, and reduces system load. It also reduces the risk of generating incorrect or invalid structured statements, improving query efficiency and reliability, thereby providing users with a faster and more accurate database operation experience.

[0185] Furthermore, based on the target historical interaction information, the user demand information, and the data table description information corresponding to each target data table, at least one user demand data table is obtained, including:

[0186] Based on the confirmation prompt template of the demand data table, the target historical interaction information, the user demand information, and the data table description information corresponding to each target data table are processed to obtain the confirmation prompt words of the demand data table.

[0187] Input the confirmation prompt words of the demand data table into the question-and-answer model, and obtain at least one user demand data table name output by the question-and-answer model;

[0188] The data table corresponding to each user requirement data table name is designated as the user requirement data table.

[0189] In practical applications, the requirement data table confirmation prompt template is a prompt word template used to determine the data tables involved in the user's actual requirements. The requirement data table confirmation prompt words are used to input the question-and-answer model so that the question-and-answer model can output the names of the data tables involved in the user's actual requirements.

[0190] Specifically, the request data table confirmation prompt template can be understood as determining the names of the data tables involved in the user's intent based on the natural language input and the database structure. It's worth noting that when the user input involves multi-table joins, the names of multiple data tables need to be output simultaneously.

[0191] It's worth noting that the requirement data table confirmation prompt template includes role definitions, task descriptions, and information sources. The role definition section clarifies that the intelligent assistant needs to determine the relevant database table names based on user actions, data table attributes, and the function of the data tables. The task description section emphasizes the need to output multiple table names simultaneously when performing multi-table operations. The information source section provides the database structure and data table descriptions. This design ensures that the intelligent assistant can accurately identify the table names involved in user actions, especially in complex multi-table operation scenarios.

[0192] In one embodiment provided in this disclosure, the requirement data table confirmation prompt template is as follows:

[0193] "#Role:

[0194] You are an intelligent assistant responsible for determining the database table names involved in the user's intent based on the user's natural language query and the database structure. When the user input involves a multi-table join query, you need to output the names of all relevant tables simultaneously.

[0195] #Task Description:

[0196] 1. Based on the attributes and description of the data table to be queried, determine which data tables the user input involves.

[0197] 2. Pay special attention to cases involving multi-table joins, and output the names of all relevant tables in the results.

[0198] 3. Ensure that the output is an accurate and complete list of table names.

[0199] #Historical Dialogue: {Initial Historical Interaction Information}

[0200] #Data table description: {Data table description information}

[0201] #User Requirements: {User Requirements Information}

[0202] In this embodiment, the user's request is: "What country is Zhang San, the athlete who won the most gold medals in this sports meet, from?" The corresponding database includes the following tables: Athletes, Results, and Events. The description information of each table is the same as the purpose and attribute information of the table in the above embodiment, which will not be repeated here.

[0203] After processing the above information using the requirement data table confirmation prompt template, the resulting requirement data table confirmation prompt message is:

[0204] "#Role:

[0205] You are an intelligent assistant responsible for determining the database table names involved in the user's intent based on the user's natural language query and the database structure. When the user input involves a multi-table join query, you need to output the names of all relevant tables simultaneously.

[0206] #Task Description:

[0207] 1. Based on the attributes and description of the data table to be queried, determine which data tables the user input involves.

[0208] 2. Pay special attention to cases involving multi-table joins, and output the names of all relevant tables in the results.

[0209] 3. Ensure that the output is an accurate and complete list of table names.

[0210] #Historical Dialogue: {User: Can you tell me who won the most gold medals in this sports meet? System: The athlete who won the most medals in this sports meet is Zhang San.}

[0211] #Data Table Description: {Athletes table: "Use information of the Athletes table, attribute information of the Athletes table", Results table: "Use information of the Results table, attribute information of the Results table", Events table: "Use information of the Events table, attribute information of the Events table"}

[0212] #User Requirement: {Provide the number of records broken in the swimming competition of this sports meet and their specific times}”

[0213] The above-mentioned requirement data table confirmation prompts are input into the question-and-answer model. The table names output by the question-and-answer model are Athletes, Results, and Events. Therefore, it can be determined that the user requirement data table in this embodiment is the Athletes table, the Results table, and the Events table.

[0214] Large-scale models can significantly improve the accuracy and efficiency of generating structured statements by identifying data tables relevant to user needs. Because large-scale models possess powerful natural language understanding capabilities, they can automatically identify relevant data tables based on the user's actual usage and the descriptive information of each table, thereby reducing errors and time consumption from human judgment.

[0215] Furthermore, based on the target historical interaction information, the user requirement information, the database description information corresponding to the target database, and each user requirement data table, a structured statement corresponding to the current problem information is generated, including:

[0216] Obtain the attribute information of the user requirement data table corresponding to each user requirement data table;

[0217] Based on the target historical interaction information, the user demand information, and the attribute information of each user demand data table, generate demand statement feature information;

[0218] Based on the target historical interaction information, the user demand information, the demand statement feature information, and the attribute information of each user demand data table, a structured statement is obtained.

[0219] In practical applications, the characteristic information of a requirement statement refers to the characteristic information of the structured statement corresponding to the user's requirement.

[0220] Specifically, depending on the user's needs, structured statements can be obtained for querying, adding, deleting, and modifying data.

[0221] If the operation performed by the structured statement is a query operation, then the corresponding requirement statement feature information includes the set of field names to be queried, the query method, and the query conditions. The set of field names to be queried is the set of the names of the fields that need to be queried in each data table. The query method is the method of the structured statement involved in the query operation. The query conditions are the conditions that need to be queried in the structured statement when performing the query operation.

[0222] If the operation performed by the structured statement is an insert operation, then the corresponding requirement statement feature information includes the set of field names to be inserted, the insertion method, and the insertion value. The set of field names to be inserted is the set of names of the fields that need to be inserted in each data table. The insertion method is the method of the structured statement involved in the insertion operation. The insertion value is the data value that needs to be inserted in the structured statement when the insertion operation is performed.

[0223] If the operation performed by the structured statement is a deletion operation, then the corresponding requirement statement feature information includes the set of field names to be deleted, the deletion method, and the deletion condition. The set of field names to be deleted is the set of the names of the fields that need to be deleted in each data table. The deletion method is the method of the structured statement involved in the deletion operation. The deletion condition is the condition that the structured statement needs to meet when performing the deletion operation.

[0224] If the operation performed by the structured statement is a modification operation, then the corresponding requirement statement feature information includes the set of field names to be updated, the update method, and the update conditions. The set of field names to be updated is the set of names of the fields that need to be updated in each data table. The update method is the method of the structured statement involved in the update operation. The update conditions are the conditions that the structured statement needs to meet when performing the update operation.

[0225] By leveraging large-scale models to extract sentence feature information from structured statements representing user requirements, the accuracy and efficiency of subsequently generating structured statements meeting those requirements can be improved. This method utilizes the language understanding capabilities of large-scale models to enable the system to accurately parse user operational intentions, extract key fields, operation methods, and conditions, thereby automatically generating structured statements that meet user needs.

[0226] Furthermore, based on the target historical interaction information, the user demand information, and the attribute information of each user demand data table, demand statement feature information is generated, including:

[0227] Based on the structured statement feature generation prompt template, the target historical interaction information, the user demand information, and the attribute information of each user demand data table are processed to obtain structured statement feature generation prompt words;

[0228] The structured statement features are used to generate prompt words, which are then input into the question-answering model to obtain the requirement statement feature information output by the question-answering model.

[0229] In practical applications, the structured statement feature generation prompt template is a prompt word template used to generate the features in the structured statement required by the user, and the structured statement feature generation prompt words are used as input into the question answering model to enable the question answering model to output the features in the structured statement required by the user.

[0230] Specifically, the structured statement feature generation prompt template can be understood as a further refinement of user operation content and operation conditions in one or more embodiments provided in this disclosure. It can be understood as extracting structured statement feature information through the following steps: Operation method identification: Based on the user's intent, identify the operation methods that the input may involve, such as SELECT, BETWEEN, AND, OR, MIN, MAX, AVERAGE, ORDERBY, etc. It is particularly important to note that when the user input involves multi-table join operations, JOIN operations should also be output. Table column name identification: Identify the specific columns (fields) involved in the operation. This requires contextual understanding and the attribute information of the data tables in the database. Operation condition identification: Identify the specific column values ​​or conditions involved in the operation, such as "age greater than 30" or "name contains 'Zhang'", etc.

[0231] It should be noted that the structured statement feature generation prompt template includes role definition, task description, and identification elements. The role definition section clarifies that the intelligent assistant needs to refine the user's operation content and conditions. The task description section requires identification of operation methods, table column names, and operation conditions. The identification elements section lists in detail the possible operation methods and conditions involved. This design ensures that the intelligent assistant can comprehensively and meticulously analyze user operations, extract all relevant information, and perform accurate database operations.

[0232] In one embodiment provided in this disclosure, the structured statement feature generation prompt template is:

[0233] "#Role:

[0234] You are an intelligent assistant responsible for refining user queries and search criteria, including query method identification, table column name identification, and query condition identification.

[0235] #Task Description:

[0236] 1. Query Method Identification: Based on the user's intent, identify the query methods that the input may involve, such as SELECT, BETWEEN, AND, OR, MIN, MAX, AVERAGE, ORDER BY, etc. When the user input involves a multi-table join query, the JOIN operation should also be output.

[0237] 2. Table column name identification: Identify the specific columns (fields) involved in the query, which may require contextual understanding and table schema information in the database.

[0238] 3. Query condition identification: Identify specific column values ​​or conditions involved in the query, such as "age greater than 30" or "name contains 'Zhang'".

[0239] #Historical Dialogue: {Initial Historical Interaction Information}

[0240] #Description of the Requirement Data Table: {Description information of the requirement data table}

[0241] #User requirements: {User requirement information}.

[0242] In this embodiment, the user's request information is: "What country is Zhang San, the athlete who won the most gold medals in this sports meet, from?" The corresponding request data tables include: Athletes table, Results table, and Events table. The description information of each data table is the purpose information and attribute information of the data tables in the above embodiment, which will not be repeated here.

[0243] After processing the above information using the structured statement feature generation prompt template, the resulting structured statement feature generation prompt words are:

[0244] "#Role:

[0245] You are an intelligent assistant responsible for refining user queries and search criteria, including query method identification, table column name identification, and query condition identification.

[0246] #Task Description:

[0247] 1. Query Method Identification: Based on the user's intent, identify the query methods that the input may involve, such as SELECT, BETWEEN, AND, OR, MIN, MAX, AVERAGE, ORDER BY, etc. When the user input involves a multi-table join query, the JOIN operation should also be output.

[0248] 2. Table column name identification: Identify the specific columns (fields) involved in the query, which may require contextual understanding and table schema information in the database.

[0249] 3. Query condition identification: Identify specific column values ​​or conditions involved in the query, such as "age greater than 30" or "name contains 'Zhang'".

[0250] #Historical Dialogue: {User: Can you tell me who won the most gold medals in this sports meet? System: The athlete who won the most medals in this sports meet is Zhang San.}

[0251] #Data Table Description: {Athletes table: "Use information of the Athletes table, attribute information of the Athletes table", Results table: "Use information of the Results table, attribute information of the Results table", Events table: "Use information of the Events table, attribute information of the Events table"}

[0252] #User Requirement: {Provide the number of records broken in the swimming competition of this sports meet and their specific times}.

[0253] The above statement features are used to generate prompt words, which are then input into the question-answering model. The structured statement features output by the question-answering model are: "Query methods involved: SELECT, JOIN; Field names involved: Athletes.Name, Events.EventName, Results.Position; Query conditions involved: Athletes.Name = 'Zhang San'".

[0254] By extracting feature information from the SQL queries generated by users through large-scale models, the accuracy and intelligence of SQL generation can be significantly improved. Large-scale models possess powerful natural language understanding capabilities, accurately parsing user intent and automatically identifying key fields, methods, and conditions in the query. This approach not only reduces the complexity and potential errors of manual parsing but also improves the efficiency and reliability of system response.

[0255] Furthermore, based on the target historical interaction information, the user requirement information, the requirement statement feature information, and the attribute information of each user requirement data table, structured statements are obtained, including:

[0256] Based on the structured statement generation prompt template, the target historical interaction information, the user demand information, the demand statement feature information, and the attribute information of each user demand data table are processed to obtain structured statement generation prompt words;

[0257] The structured statement is generated and input into the question-answering model to obtain the structured statement output by the question-answering model.

[0258] In practical applications, the structured statement generation prompt template is a prompt word template used to generate the structured statement required by the user, and the structured statement generation prompt word is a prompt word used to input into the question-answering model so that the question-answering model outputs the structured statement required by the user.

[0259] Specifically, the structured statement generation prompt template can be understood as combining the results of the above processing, user input, and attribute information from relevant tables in the database, and using a large model to generate the corresponding structured statement.

[0260] It's important to note that the structured statement generation prompt template includes a role definition, task description, and information source. The role definition clarifies that the intelligent assistant needs to generate structured statements. The task description requires generating structured statements by combining user input, historical dialogues, and attribute information from database tables. The information source provides necessary background information. This design ensures that the generated structured statements are accurate and complete, containing all necessary query methods, field names, and query conditions, making them suitable for various database operation scenarios.

[0261] In one embodiment provided in this disclosure, the structured statement generation prompt template is:

[0262] "#Role:

[0263] You are an SQL expert responsible for generating corresponding SQL query statements based on user input and the schema information of database tables.

[0264] #Task Description:

[0265] 1. Combine user input, historical dialogues, and database description information to generate corresponding SQL query statements.

[0266] 2. The output SQL query statement must accurately include the query method, field names, query conditions, and possible multi-table joins.

[0267] #Structured Statement Characteristics {Requirement Statement Characteristic Information}

[0268] #Historical Dialogue: {Initial Historical Interaction Information}

[0269] #Requirement data table attributes: {Data table attribute information of the requirement data table}

[0270] #User Requirements: {User Requirements Information}

[0271] In this embodiment, the user's request is: "What country is Zhang San, the athlete who won the most gold medals in this Games, from?" The corresponding structured statement features are: "Query methods involved: SELECT, JOIN; Field names involved: Athletes.Name, Events.EventName, Results.Position; Query conditions involved: Athletes.Name = 'Zhang San'". The corresponding request data tables include: Athletes table, Results table, and Events table. The description information of each data table is the purpose information and attribute information of the data tables in the above embodiment, which will not be repeated here.

[0272] After processing the above information using the structured statement generation prompt template, the resulting structured statement generation prompt words are:

[0273] "#Role:

[0274] You are an SQL expert responsible for generating corresponding SQL query statements based on user input and the schema information of database tables.

[0275] #Task Description:

[0276] 1. Combine user input, historical dialogues, and database description information to generate corresponding SQL query statements.

[0277] 2. The output SQL query statement must accurately include the query method, field names, query conditions, and possible multi-table joins.

[0278] #Structured statement characteristics {Query methods involved: SELECT, JOIN; Field names involved: Athletes.Name, Events.EventName, Results.Position; Query conditions involved: Athletes.Name = 'Zhang San'}

[0279] #Historical Dialogue: {User: Can you tell me who won the most gold medals in this sports meet? System: The athlete who won the most medals in this sports meet is Zhang San.}

[0280] #Data table description: {Athletes table: "Attribute information of the Athletes table", Results table: "Attribute information of the Results table", Events table: "Attribute information of the Events table"}

[0281] # User requirement: {Provide the number of records broken in the swimming competition of this sports meeting and their specific times}”

[0282] The structured statement generated by inputting the above structured statement into the Q&A model is: "SELECT a.Name, e.EventName, r.Position FROM Athletes a JOIN Results r ON a.AthleteID = r.AthleteID JOIN Events e ON e.EventID = r.EventID WHERE a.Name = 'Zhang San'".

[0283] The large model can generate structured statements by using the feature information of the structured statements, which can greatly improve the automation and accuracy of the structured statement generation process. The large model can efficiently parse and understand the natural language queries of users, and automatically generate structured statements that meet the user's needs by extracting and using key feature information. This method not only reduces the complexity and error risk of manually writing structured statements, improves the efficiency and accuracy of data queries, but also can adapt to complex query requirements and provide a more intelligent and convenient database interaction experience.

[0284] Considering that the structured statement generated by the large model may be incorrect, after generating the structured statement corresponding to the current problem information, the method further includes:

[0285] Execute the structured statement based on the target database to obtain the execution result of the structured statement;

[0286] In the case where the execution result of the structured statement is an execution error, return to the step of generating a requirement extraction prompt word by processing the target historical interaction information and each database description information based on the requirement extraction prompt template;

[0287] In the case where the execution result of the structured statement is an execution success, determine the target data according to the execution result of the structured statement, and input the target historical interaction information and the target data into the Q&A model to obtain the answer information output by the Q&A model.

[0288] In practical applications, the execution result of the structured statement includes execution error and execution success. Specifically, the execution result of the structured statement can be understood as the result obtained after executing the structured statement. In the case of an execution error of the structured statement, the structured statement is regenerated to improve the user experience.

[0289] It's important to note that successful execution includes both finding the target data and not finding it. Even if the target data is not found, execution is still considered successful, with the corresponding target data being "Target data not found." The corresponding answer information is also generated based on the absence of data in the database. Execution errors can be understood as errors in the structured statement generation, such as misspelled letters, misspelled table names, etc. This disclosure does not impose any restrictions on this.

[0290] It should be noted that, considering the efficiency of this structured statement generation method, if the execution result of the structured statement is an execution error, error information can be obtained, feedback prompts can be generated based on the error information, and these feedback prompts and the structured statement generation prompts can be concatenated and re-input into the question-and-answer model so that the question-and-answer model can re-output a new structured statement and return to the execution step to execute the structured statement based on the target database and obtain the structured statement execution result.

[0291] In the embodiments provided in this disclosure, different errors correspond to different error messages. For example, for a syntax error, the statement "SELECT * FROM table_name" corresponds to the error message "ERROR 1064(42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FRO table_name' at line 1". For an error that the table or field does not exist, the statement "SELECT * FROM non_existing_table" corresponds to the error message "ERROR 1146(42S02): Table 'database_name.non_existing_table' does not exist". Another example is the statement "SELECT non_existing_column FROM table_name", which corresponds to the error message "ERROR 1054(42S22): Unknown column 'non_existing_column' in 'field list'", etc. This disclosure does not impose any limitations on this.

[0292] The solution applied in this disclosure involves intent determination, requirement extraction, requirement data table confirmation, and requirement statement feature information extraction before generating structured statements. This allows for in-depth analysis of user input, dialogue history, and database structure, resulting in more accurate structured statements. This enables non-technical users to easily interact with the database without needing to master complex structured statement syntax. This further improves the convenience and efficiency of data querying and management, lowers the barrier to entry, and makes data access more widespread and user-friendly.

[0293] Corresponding to the above method embodiments, this disclosure also provides an embodiment of a question-answering method based on a sports database. Referring to Figure 2, Figure 2 shows a flowchart of a question-answering method based on a sports database according to an embodiment of this disclosure, specifically including the following steps:

[0294] Step 202: Obtain target historical interaction information and obtain database description information corresponding to at least one sports database, wherein the target historical interaction information includes current sports question information.

[0295] Step 204: Based on the requirement extraction prompt template, process the target historical interaction information and the description information of each database to generate requirement extraction prompt words, and input the requirement extraction prompt words into the question answering model to obtain the user requirement information output by the question answering model.

[0296] Step 206: Determine the target sports database from among the various sports databases based on the user demand information, wherein the target sports database includes at least one target sports data table.

[0297] Step 208: Based on the target historical interaction information, the user demand information, the database description information corresponding to the target sports database, and each target sports data table, generate a structured statement corresponding to the current sports problem information.

[0298] Step 210: Determine target data in the target sports database according to the structured statement, and input the target historical interaction information and the target data into the question-answering model to obtain the answer information output by the question-answering model.

[0299] In practical applications, target data is the data used as a reference when generating the answer needed by the user. By obtaining the reference data from the database, the accuracy of generating the answer needed by the user can be improved, thus enhancing the user's experience of using the question-and-answer service.

[0300] The above is an illustrative scheme of a question-answering method based on a sports database according to this embodiment. It should be noted that the technical solution of this question-answering method based on a sports database belongs to the same concept as the technical solution of the structured statement generation method described above. Details not described in detail in the technical solution of this question-answering method based on a sports database can be found in the description of the technical solution of the structured statement generation method described above.

[0301] By applying the solution of this disclosure embodiment, after intent judgment, requirement extraction, requirement data table confirmation, and requirement statement feature information extraction, structured statements are generated. This allows for in-depth analysis of user input, dialogue history, and database structure, thereby generating more accurate structured statements. This enables the large model to accurately obtain the data needed to answer user questions from the target database, and then use the obtained data to answer user questions. This avoids the illusion problem that may occur when the large model answers questions, and significantly reduces the cost of implementing the question answering method compared to training the large model using data from the database.

[0302] The following description, in conjunction with Figure 3, uses the application of the structured statement generation method provided in this disclosure in question-answering based on a sports database as an example to further illustrate the structured statement generation method. Figure 3 shows a flowchart of the processing procedure of a question-answering method based on a sports database according to an embodiment of this disclosure, specifically including the following steps:

[0303] Step 302: Obtain the current sports question information input by the user, as well as the initial historical interaction information between the user and the question-answering model.

[0304] Step 304: Process the above-mentioned current sports question information using the intent judgment prompt template, generate intent judgment prompt words, and input the intent judgment prompt words into the question answering model to obtain the user intent output by the question answering model.

[0305] Step 306: Determine if the user's intent is a data query question. If yes, proceed to step 308; otherwise, proceed to step 332.

[0306] Step 308: Obtain the database description information of each sports database, and combine the above-mentioned historical interaction information and the above-mentioned current sports problem information as the target historical interaction information.

[0307] Step 310: Use the requirement extraction prompt template to process the description information of each database and the target historical interaction information to generate requirement extraction prompt words, and input the requirement extraction prompt words into the question answering model to obtain the user requirement information output by the question answering model.

[0308] Step 312: Determine the target sports database that the user actually needs based on the above user demand information.

[0309] Step 314: Obtain the data table usage information for each data table in the target sports database.

[0310] Step 316: Based on the confirmation prompt template of the demand data table, process the above-mentioned target historical interaction information, user demand information and the purpose information of each data table, obtain the confirmation prompt words of the demand data table, and input the above-mentioned confirmation prompt words of the demand data table into the question answering model to obtain at least one user demand data table name output by the question answering model.

[0311] Step 318: Identify the data table corresponding to the name of the user requirement data table as the user requirement data table, and obtain the user requirement data table attribute information corresponding to each user requirement data table.

[0312] Step 320: Process the above-mentioned target historical interaction information, user demand information, and attribute information of each user demand data table through the demand statement feature information extraction prompt template, generate demand statement feature information extraction prompt words, and input the above demand statement feature information extraction prompt words into the question answering model to obtain the demand statement feature information output by the question answering model, including the set of field names to be queried, query method, and query conditions.

[0313] Step 322: Process the above-mentioned target historical interaction information, user requirement information, requirement statement feature information and attribute information of each user requirement data table through the structured statement generation prompt template, generate structured statement generation prompt words, and input the above-mentioned structured statement generation prompt words into the question answering model to obtain the structured statement output by the question answering model.

[0314] Step 324: Perform operations on the target sports database based on the structured statement and obtain the execution result of the structured statement.

[0315] Step 326: Determine whether the above execution result is successful. If yes, proceed to step 334; otherwise, proceed to step 328.

[0316] Step 328: Obtain the error message from the system execution, generate feedback information based on the error message and the above structured statement, and generate prompt words by concatenating the above structured statement with the feedback information. Obtain the feedback structured statement and generate prompt words.

[0317] Step 330: Input the prompt words generated from the above feedback structured statement into the question-answering model, obtain the structured statement output by the question-answering model, and return to execute step 324.

[0318] Step 332: Input the current sports question information and the initial historical interaction information into the question answering model to obtain the answer information output by the question answering model.

[0319] Step 334: Input the execution result of the above structured statement and the target historical interaction information into the question answering model to obtain the answer information output by the question answering model.

[0320] By applying the solution of this disclosure embodiment, after intent judgment, requirement extraction, requirement data table confirmation, and requirement statement feature information extraction, structured statements are generated. This allows for in-depth analysis of user input, dialogue history, and database structure, thereby generating more accurate structured statements. This enables the large model to accurately obtain the data needed to answer user questions from the target database, and then use the obtained data to answer user questions. This avoids the illusion problem that may occur when the large model answers questions, and significantly reduces the cost of implementing the question answering method compared to training the large model using data from the database.

[0321] Corresponding to the above method embodiments, this disclosure also provides an embodiment of a question-answering method based on a sports database applied to cloud-side devices. Referring to Figure 4, Figure 4 shows a flowchart of a question-answering method based on a sports database applied to cloud-side devices according to an embodiment of this disclosure, specifically including the following steps:

[0322] Step 402: Obtain target historical interaction information and obtain database description information corresponding to at least one sports database, wherein the target historical interaction information includes current sports question information, which is sent by the end device.

[0323] Step 404: Based on the requirement extraction prompt template, process the target historical interaction information and the description information of each database to generate requirement extraction prompt words, and input the requirement extraction prompt words into the question answering model to obtain the user requirement information output by the question answering model.

[0324] Step 406: Determine the target sports database from among the various sports databases based on the user demand information, wherein the target sports database includes at least one target sports data table.

[0325] Step 408: Based on the target historical interaction information, the user demand information, the database description information corresponding to the target sports database, and each target sports data table, generate a structured statement corresponding to the current sports problem information.

[0326] Step 410: Determine target data in the target sports database according to the structured statement, and input the target historical interaction information and the target data into the question-answering model to obtain the answer information output by the question-answering model.

[0327] Step 412: Send the answer information to the terminal device.

[0328] Considering that the answer obtained after answering based on the target sports database using a question-answering model may not meet the requirements of the edge device, the method further includes the following after sending the answer information to the edge device:

[0329] The receiving device sends adjustment information in response to the answer information;

[0330] The adjustment information and the answer information are input into the question-answering model to obtain the adjustment answer information output by the question-answering model;

[0331] The adjusted answer information is sent to the terminal device.

[0332] After receiving the target answer information, the client can further send adjustment information to modify the content of the target answer information. For example, if the target answer information includes statement 1 and statement 2, the adjustment information could be "Please provide relevant information about the entity specified in statement 1".

[0333] The cloud-side device inputs the adjustment information and answer information into the question-answering model for further processing, obtains the adjustment answer information output by the question-answering model, and returns the adjustment answer information to the edge device.

[0334] The above is an illustrative scheme of a question-answering method based on a sports database applied to cloud-side devices according to this embodiment. It should be noted that the technical solution of this question-answering method based on a sports database applied to cloud-side devices belongs to the same concept as the technical solution of the structured statement generation method described above. Details not described in detail in the technical solution of the question-answering method based on a sports database applied to cloud-side devices can be found in the description of the technical solution of the structured statement generation method described above.

[0335] The solution of this disclosure involves intent judgment, requirement extraction, requirement data table confirmation, and requirement statement feature information extraction before generating structured statements. This allows for in-depth analysis of user input, dialogue history, and database structure, resulting in more accurate structured statements. Consequently, the large model can accurately obtain the data needed to answer user questions from the target database and then use the obtained data to answer user questions. This avoids the illusion problem that can occur when the large model answers questions and significantly reduces the hardware requirements for providing question-answering services compared to training the large model using data from a database.

[0336] Corresponding to the above method embodiments, this disclosure also provides an embodiment of an information processing method based on a question-answering model. Referring to Figure 5, Figure 5 shows a flowchart of an information processing method based on a question-answering model according to an embodiment of this disclosure, applied to a task platform, specifically including the following steps:

[0337] Step 502: Receive a task generation request sent by the receiving end device, wherein the task generation request includes request information.

[0338] Step 504: Based on the request information, obtain a question-answering model, wherein the question-answering model obtains user demand information based on the target historical interaction information and the database description information corresponding to at least one database, determines the target database based on the user demand information and generates structured statements, and the target sports database is any one of the databases.

[0339] Step 506: Generate task information based on the question-answering model, wherein the task information is used by the end device to perform a database-based question-answering task.

[0340] A task platform is an online platform that provides services or functions, allowing developers, enterprises, or individual users to submit tasks, obtain resources, or implement specific functions through API calls, web interfaces, or other interactive methods. In this embodiment, the task platform is a cloud service platform capable of providing database-based question-and-answer services, allowing external applications (such as content recommendation, social media, digital twin systems, etc.) to access and use its information processing capabilities based on question-and-answer models to generate answer information. The task platform ensures efficient and accurate responses to requests from edge devices by managing the training, updating, optimization, and load balancing of the model.

[0341] A task generation request is a specific operation request initiated by the edge device to the task platform, designed to trigger the platform to execute a database-based question-and-answer task. Task generation requests typically contain necessary parameters and request information, such as the current question information.

[0342] The task platform can obtain the corresponding question-answering model based on the request information. For relevant information about the question-answering model, please refer to the relevant description in the above embodiments, which will not be repeated here.

[0343] After the task platform processes the task generation request, it generates task information based on the output of the scene localization model, serving as a response to the edge device. This task information guides the edge device to operate the question-answering model to execute corresponding database-based question-answering tasks.

[0344] In another specific embodiment provided in this disclosure, the request information includes a task scenario identifier for a database-based question-and-answer task, or a task model identifier;

[0345] Based on the requested information, a question-answering model is obtained, including:

[0346] Based on the task scenario identifier, a target scenario template is determined from multiple preset scenario templates, and based on the target scenario template, a question-answering model is searched from the model library, wherein the model library stores multiple question-answering models;

[0347] or,

[0348] Based on the task model identifier, the question-answering model is searched from the model library.

[0349] The task scenario identifier for database-based question-answering tasks is a tag or code that uniquely identifies or classifies a database-based question-answering task. It helps the task platform understand which specific task category a database-based question-answering task belongs to.

[0350] The task scenario identifier for database-based question answering tasks is a label used to distinguish and identify different database-based question answering task models. Each model may be designed for different data features, processing logic, or optimization goals.

[0351] In practical applications, the target scenario template corresponding to the task scenario identifier can be found from multiple preset scenario templates based on the task scenario identifier, and the corresponding question-answering model can be found from the model library based on the target scenario template. Alternatively, the corresponding question-answering model can be found directly from the model library based on the task model identifier.

[0352] The above is an illustrative scheme of a question-answering method based on a sports database applied to cloud-side devices according to this embodiment. It should be noted that the technical solution of this question-answering method based on a sports database applied to cloud-side devices belongs to the same concept as the technical solution of the structured statement generation method described above. Details not described in detail in the technical solution of the question-answering method based on a sports database applied to cloud-side devices can be found in the description of the technical solution of the structured statement generation method described above.

[0353] The solution applied in this disclosure involves intent determination, requirement extraction, requirement data table confirmation, and requirement statement feature information extraction before generating structured statements. This allows for in-depth analysis of user input, dialogue history, and database structure, resulting in more accurate structured statements. This enables non-technical users to easily interact with the database without needing to master complex structured statement syntax. This further improves the convenience and efficiency of data querying and management, lowers the barrier to entry, and makes data access more widespread and user-friendly.

[0354] Figure 6 shows a schematic diagram of a task platform provided in an embodiment of the present disclosure. The task platform includes a request interface 602 and a response unit 604, wherein:

[0355] The request interface 602 is used to receive a task generation request sent by the end device, wherein the task generation request includes request information.

[0356] The response unit 604 is used to obtain a question-and-answer model based on the request information, and generate task information based on the question-and-answer model. The question-and-answer model obtains user demand information based on target historical interaction information and database description information corresponding to at least one database, determines the target database based on the user demand information and generates structured statements. The target database can be any one of the databases. The task information is used by the end device to execute a database-based question-and-answer task.

[0357] The above is an illustrative scheme of a task platform according to this embodiment. It should be noted that the technical solution of this task platform and the technical solution of the information processing method based on the question-answering model described above belong to the same concept. For details not described in detail in the technical solution of the task platform, please refer to the description of the technical solution of the information processing method based on the question-answering model described above.

[0358] Corresponding to the above method embodiments, this disclosure also provides an embodiment of a structured statement generation apparatus. Figure 7 shows a schematic diagram of the structure of a structured statement generation apparatus provided in one embodiment of this disclosure. As shown in Figure 7, the apparatus includes:

[0359] The acquisition module 702 is configured to acquire database description information corresponding to at least one database and acquire target historical interaction information, wherein the target historical interaction information includes current problem information;

[0360] The first generation module 704 is configured to process the target historical interaction information and the description information of each database based on the demand extraction prompt template, generate demand extraction prompt words, and input the demand extraction prompt words into the question answering model to obtain the user demand information output by the question answering model;

[0361] The determination module 706 is configured to determine a target database in each database based on the user requirement information, wherein the target database includes at least one target data table;

[0362] The second generation module 708 is configured to generate a structured statement corresponding to the current problem information based on the target historical interaction information, the user demand information, the database description information corresponding to the target database, and each target data table.

[0363] Optionally, the acquisition module 702 is further configured to:

[0364] Obtain the user's current question information and initial historical interaction information, wherein the initial historical interaction information includes user input information and model output information prior to the user's current question information;

[0365] Based on the intent judgment prompt template, the user's current question information, the initial historical interaction information, and the description information of each database are processed to generate intent judgment prompt words;

[0366] The intent-based prompts are input into the question-and-answer model to obtain the user intent output by the question-and-answer model.

[0367] If the user's intent is a data query intent, the initial historical interaction information and the user's current question information are determined as the target historical interaction information.

[0368] Optionally, the structured statement generation device further includes a first answer module, configured as follows:

[0369] If the user's intent is not a query intent, the user's current question information and the initial historical interaction information are input into the question-answering model to obtain the answer information output by the question-answering model.

[0370] Optionally, the database includes at least one data table;

[0371] The acquisition module 702 is further configured to:

[0372] Obtain a first database and at least one first data table corresponding to the first database, wherein the first database is any one of the databases;

[0373] Obtain the data table attribute information, data table content information, and data table relationship information corresponding to each first data table;

[0374] Based on the database description prompt template, process the attribute information of each data table, the content information of each data table, and the relationship information of the data tables to obtain the database description prompt words corresponding to the first database;

[0375] The database description prompts are input into the question-answering model to obtain the database usage information corresponding to the first database and the data table usage information corresponding to each first data table output by the question-answering model, and the database usage information and the data table usage information are determined to be the database description information corresponding to the first database.

[0376] Optionally, the second generation module 708 is further configured to:

[0377] Obtain the data table description information corresponding to each target data table;

[0378] Based on the target historical interaction information, the user demand information, and the data table description information corresponding to each target data table, at least one user demand data table is obtained.

[0379] Based on the target historical interaction information, the user demand information, the database description information corresponding to the target database, and each user demand data table, a structured statement corresponding to the current problem information is generated.

[0380] Optionally, the second generation module 708 is further configured to:

[0381] Based on the confirmation prompt template of the demand data table, the target historical interaction information, the user demand information, and the data table description information corresponding to each target data table are processed to obtain the confirmation prompt words of the demand data table.

[0382] Input the confirmation prompt words of the demand data table into the question-and-answer model, and obtain at least one user demand data table name output by the question-and-answer model;

[0383] The data table corresponding to each user requirement data table name is designated as the user requirement data table.

[0384] Optionally, the second generation module 708 is further configured to:

[0385] Obtain the attribute information of the user requirement data table corresponding to each user requirement data table;

[0386] Based on the target historical interaction information, the user demand information, and the attribute information of each user demand data table, generate demand statement feature information;

[0387] Based on the target historical interaction information, the user demand information, the demand statement feature information, and the attribute information of each user demand data table, a structured statement is obtained.

[0388] Optionally, the feature information of the demand statement includes the set of field names to be queried, the query method, and the query conditions.

[0389] Optionally, the second generation module 708 is further configured to:

[0390] Based on the structured statement feature generation prompt template, the target historical interaction information, the user demand information, and the attribute information of each user demand data table are processed to obtain structured statement feature generation prompt words;

[0391] The structured statement features are used to generate prompt words, which are then input into the question-answering model to obtain the requirement statement feature information output by the question-answering model.

[0392] Optionally, the second generation module 708 is further configured to:

[0393] Based on the structured statement generation prompt template, the target historical interaction information, the user demand information, the demand statement feature information, and the attribute information of each user demand data table are processed to obtain structured statement generation prompt words;

[0394] The structured statement is generated and input into the question-answering model to obtain the structured statement output by the question-answering model.

[0395] Optionally, the structured statement generation device further includes a second answer module, configured to:

[0396] The structured statement is executed based on the target database to obtain the execution result of the structured statement;

[0397] If the execution result of the structured statement is an execution error, return to the step of processing the target historical interaction information and the description information of each database based on the requirement extraction prompt template to generate requirement extraction prompt words;

[0398] If the structured statement execution result is successful, the target data is determined based on the structured statement execution result, and the target historical interaction information and the target data are input into the question-answering model to obtain the answer information output by the question-answering model.

[0399] The solution applied in this disclosure involves intent determination, requirement extraction, requirement data table confirmation, and requirement statement feature information extraction before generating structured statements. This allows for in-depth analysis of user input, dialogue history, and database structure, resulting in more accurate structured statements. This enables non-technical users to easily interact with the database without needing to master complex structured statement syntax. This further improves the convenience and efficiency of data querying and management, lowers the barrier to entry, and makes data access more widespread and user-friendly.

[0400] The above is a schematic scheme of a structured statement generation device according to this embodiment. It should be noted that the technical solution of this structured statement generation device and the technical solution of the structured statement generation method described above belong to the same concept. For details not described in detail in the technical solution of the structured statement generation device, please refer to the description of the technical solution of the structured statement generation method described above.

[0401] Referring to Figure 8, Figure 8 shows an architecture diagram of a question-answering system based on a sports database provided in an embodiment of the present disclosure. The question-answering system based on a sports database may include a client 100 and a server 200.

[0402] Client 100 is used to send current sports issue information to server 200;

[0403] Server 200 is used to acquire target historical interaction information, including current sports question information, and acquire database description information corresponding to at least one sports database; process the target historical interaction information and each database description information based on a demand extraction prompt template, generate demand extraction prompt words, and input the demand extraction prompt words into a question-and-answer model to acquire user demand information output by the question-and-answer model; determine the target sports database in each sports database according to the user demand information, wherein the target sports database includes at least one target sports data table; generate a structured statement corresponding to the current sports question information based on the target historical interaction information, the user demand information, the database description information corresponding to the target sports database, and each target sports data table; determine the target data in the target database according to the structured statement, and input the target historical interaction information and the target data into the question-and-answer model to acquire answer information output by the question-and-answer model; and send the answer information to client 100.

[0404] Client 100 is also used to receive answer information sent by server 200.

[0405] The solution of this disclosure involves intent judgment, requirement extraction, requirement data table confirmation, and requirement statement feature information extraction before generating structured statements. This allows for in-depth analysis of user input, dialogue history, and database structure, resulting in more accurate structured statements. Consequently, the large model can accurately obtain the data needed to answer user questions from the target database and then use the obtained data to answer user questions. This avoids the illusion problem that can occur when the large model answers questions and significantly reduces the hardware requirements for providing question-answering services compared to training the large model using data from a database.

[0406] A question-and-answer system based on a sports database may include multiple clients 100 and a server 200. Clients 100 can be referred to as edge devices, and the server 200 as cloud devices. Multiple clients 100 can establish communication connections through the server 200. In a sports database-based question-and-answer scenario, the server 200 provides a sports database-based question-and-answer service between the multiple clients 100. Each client 100 can act as either a sender or a receiver, communicating through the server 200.

[0407] Users can interact with server 200 through client 100 to receive data sent by other clients 100, or send data to other clients 100, etc. In a question-and-answer scenario based on a sports database, users can publish data streams to server 200 through client 100, server 200 can generate answer information based on the data stream, and push the answer information to other clients that have established communication.

[0408] In this system, client 100 and server 200 establish a connection via a network. The network provides the medium for communication between client 100 and server 200. The network can include various connection types, such as wired or wireless communication links or fiber optic cables. Data transmitted by client 100 may need to undergo encoding, transcoding, compression, or other processing before being published to server 200.

[0409] Client 100 can be a browser, an app (application), a web application such as an H5 (HyperText Markup Language 5) application, a lightweight application (also known as a mini-program), or a cloud application. Client 100 can be developed based on the software development kit (SDK) of the corresponding service provided by server 200, such as a real-time communication (RTC) SDK. Client 100 can be deployed on electronic devices and depends on the device or certain apps on the device to run. Electronic devices may have displays and support information browsing, such as personal mobile terminals like mobile phones, tablets, and personal computers. Various other types of applications can also be configured on electronic devices, such as human-computer interaction applications, model training applications, text processing applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, and social media platform software.

[0410] Server 200 may include servers providing various services, such as servers providing communication services to multiple clients, servers supporting backend training of models used on clients, and servers processing data sent by clients. It should be noted that server 200 can be implemented as a distributed server cluster composed of multiple servers, or as a single server. The server can also be a server in a distributed system, or a server integrated with blockchain. The server can also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.

[0411] It is worth noting that the question-answering method based on a sports database provided in this disclosure is generally executed by the server. However, in other embodiments of this disclosure, the client may also have similar functionality to the server, thereby executing the question-answering method based on a sports database provided in this disclosure. In other embodiments, the question-answering method based on a sports database provided in this disclosure may also be executed jointly by the client and the server.

[0412] Figure 9 shows a structural block diagram of a computing device 900 according to an embodiment of the present disclosure. The components of the computing device 900 include, but are not limited to, a memory 910 and a processor 920. The processor 920 is connected to the memory 910 via a bus 930, and a database 950 is used to store data.

[0413] The computing device 900 also includes an access device 940, which enables the computing device 900 to communicate via one or more networks 960. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 940 may include one or more of any type of wired or wireless network interface (e.g., a network interface controller (NIC)), such as an IEEE 902.11 Wireless Local Area Network (WLAN) wireless interface, a Wi-MAX (Worldwide Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, or a Near Field Communication (NFC) interface.

[0414] In one embodiment of this disclosure, the aforementioned components of the computing device 900, as well as other components not shown in FIG. 9, may also be connected to each other, for example, via a bus. It should be understood that the computing device structural block diagram shown in FIG. 9 is merely for illustrative purposes and is not intended to limit the scope of this disclosure. Those skilled in the art can add or replace other components as needed.

[0415] The computing device 900 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 900 can also be a mobile or stationary server.

[0416] The processor 920 is used to execute the following computer-executable instructions, which, when executed by the processor, implement the steps of the above-mentioned structured statement generation method, the question-answering method based on a sports database, the question-answering method based on a sports database applied to cloud devices, and the information processing method based on a question-answering model.

[0417] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device belongs to the same concept as the above-described structured statement generation method, the question-and-answer method based on a sports database, the question-and-answer method based on a sports database applied to cloud devices, and the information processing method based on a question-and-answer model. Details not described in detail in the technical solution of the computing device can be found in the descriptions of the above-described structured statement generation method, the question-and-answer method based on a sports database, the question-and-answer method based on a sports database applied to cloud devices, and the information processing method based on a question-and-answer model.

[0418] An embodiment of this disclosure also provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the above-described structured statement generation method, the question-answering method based on a sports database, the question-answering method based on a sports database applied to cloud devices, and the information processing method based on a question-answering model.

[0419] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium belongs to the same concept as the above-described structured statement generation method, the question-and-answer method based on a sports database, the question-and-answer method based on a sports database applied to cloud devices, and the information processing method based on a question-and-answer model. Details not described in detail in the technical solution of the storage medium can be found in the descriptions of the above-described structured statement generation method, the question-and-answer method based on a sports database, the question-and-answer method based on a sports database applied to cloud devices, and the information processing method based on a question-and-answer model.

[0420] An embodiment of this disclosure also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the above-described structured statement generation method, the question-answering method based on a sports database, the question-answering method based on a sports database applied to cloud devices, and the information processing method based on a question-answering model.

[0421] The above is an illustrative scheme of a computer program according to this embodiment. It should be noted that the technical solution of this computer program belongs to the same concept as the above-described structured statement generation method, the question-and-answer method based on a sports database, the question-and-answer method based on a sports database applied to cloud devices, and the information processing method based on a question-and-answer model. Details not described in detail in the computer program's technical solution can be found in the descriptions of the above-described structured statement generation method, the question-and-answer method based on a sports database, the question-and-answer method based on a sports database applied to cloud devices, and the information processing method based on a question-and-answer model.

[0422] The foregoing has described specific embodiments of this disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0423] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or certain intermediate forms. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added or removed according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.

[0424] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of this disclosure are not limited to the described order of actions, because according to the embodiments of this disclosure, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments of this disclosure.

[0425] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0426] The preferred embodiments disclosed above are merely illustrative of this disclosure. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments of this disclosure. These embodiments are selected and specifically described in this disclosure to better explain the principles and practical applications of the embodiments of this disclosure, thereby enabling those skilled in the art to better understand and utilize this disclosure. This disclosure is limited only by the claims and their full scope and equivalents.

Claims

1. A method for generating structured statements, comprising: Obtain database description information corresponding to at least one database and obtain target historical interaction information, wherein the target historical interaction information includes current question information; Based on the demand extraction prompt template, the target historical interaction information and the description information of each database are processed to generate demand extraction prompt words, and the demand extraction prompt words are input into the question answering model to obtain the user demand information output by the question answering model; Based on the user demand information, a target database is determined from each database, wherein the target database includes at least one target data table; Based on the target historical interaction information, the user demand information, the database description information corresponding to the target database, and each target data table, a structured statement corresponding to the current problem information is generated.

2. The method as described in claim 1, wherein obtaining target historical interaction information includes: Obtain the user's current question information and initial historical interaction information, wherein the initial historical interaction information includes user input information and model output information prior to the user's current question information; Based on the intent judgment prompt template, the user's current question information, the initial historical interaction information, and the description information of each database are processed to generate intent judgment prompt words; The intent-based prompts are input into the question-and-answer model to obtain the user intent output by the question-and-answer model. If the user's intent is a data query intent, the initial historical interaction information and the user's current question information are determined as the target historical interaction information.

3. The method as described in claim 2, further comprising, after obtaining the user intent output by the question-answering model: If the user's intent is not a query intent, the user's current question information and the initial historical interaction information are input into the question-answering model to obtain the answer information output by the question-answering model.

4. The method according to any one of claims 1-3, wherein the database comprises at least one data table; Obtain database description information for at least one database, including: Obtain a first database and at least one first data table corresponding to the first database, wherein the first database is any one of the databases; Obtain the data table attribute information, data table content information, and data table relationship information corresponding to each first data table; Based on the database description prompt template, process the attribute information of each data table, the content information of each data table, and the relationship information of the data tables to obtain the database description prompt words corresponding to the first database; The database description prompts are input into the question-answering model to obtain the database usage information corresponding to the first database and the data table usage information corresponding to each first data table output by the question-answering model, and the database usage information and the data table usage information are determined to be the database description information corresponding to the first database.

5. The method according to any one of claims 1-4, wherein, based on the target historical interaction information, the user requirement information, and the database description information corresponding to the target database and each target data table, a structured statement corresponding to the current question information is generated, comprising: Obtain the data table description information corresponding to each target data table; Based on the target historical interaction information, the user demand information, and the data table description information corresponding to each target data table, at least one user demand data table is obtained. Based on the target historical interaction information, the user demand information, the database description information corresponding to the target database, and each user demand data table, a structured statement corresponding to the current problem information is generated.

6. The method as described in claim 5, wherein at least one user requirement data table is obtained based on the target historical interaction information, the user requirement information, and the data table description information corresponding to each target data table, comprising: Based on the confirmation prompt template of the demand data table, the target historical interaction information, the user demand information, and the data table description information corresponding to each target data table are processed to obtain the confirmation prompt words of the demand data table. Input the confirmation prompt words of the demand data table into the question-and-answer model, and obtain at least one user demand data table name output by the question-and-answer model; The data table corresponding to each user requirement data table name is designated as the user requirement data table.

7. The method as described in claim 5 or 6, wherein, based on the target historical interaction information, the user requirement information, and the database description information corresponding to the target database and each user requirement data table, a structured statement corresponding to the current question information is generated, including: Obtain the attribute information of the user requirement data table corresponding to each user requirement data table; Based on the target historical interaction information, the user demand information, and the attribute information of each user demand data table, generate demand statement feature information; Based on the target historical interaction information, the user demand information, the demand statement feature information, and the attribute information of each user demand data table, a structured statement is obtained.

8. The method as described in claim 7, wherein the requirement statement feature information includes a set of field names to be queried, a query method, and query conditions.

9. The method as described in any one of claims 7-8, wherein a structured statement is obtained based on the target historical interaction information, the user requirement information, the requirement statement feature information, and the attribute information of each user requirement data table, comprising: Based on the structured statement generation prompt template, the target historical interaction information, the user demand information, the demand statement feature information, and the attribute information of each user demand data table are processed to obtain structured statement generation prompt words; The structured statement is generated and input into the question-answering model to obtain the structured statement output by the question-answering model.

10. The method according to any one of claims 1-9, wherein after generating the structured statement corresponding to the current problem information, the method further comprises: The structured statement is executed based on the target database to obtain the execution result of the structured statement; If the execution result of the structured statement is an execution error, return to the step of processing the target historical interaction information and the description information of each database based on the requirement extraction prompt template to generate requirement extraction prompt words; If the structured statement execution result is successful, the target data is determined based on the structured statement execution result, and the target historical interaction information and the target data are input into the question-answering model to obtain the answer information output by the question-answering model.

11. A question-answering method based on a sports database, comprising: Obtain target historical interaction information and obtain database description information corresponding to at least one sports database, wherein the target historical interaction information includes current sports question information; Based on the demand extraction prompt template, the target historical interaction information and the description information of each database are processed to generate demand extraction prompt words, and the demand extraction prompt words are input into the question answering model to obtain the user demand information output by the question answering model; Based on the user demand information, a target sports database is determined from each sports database, wherein the target sports database includes at least one target sports data table; Based on the target historical interaction information, the user demand information, the database description information corresponding to the target sports database, and each target sports data table, a structured statement corresponding to the current sports problem information is generated; The target data is determined in the target sports database according to the structured statement, and the target historical interaction information and the target data are input into the question-answering model to obtain the answer information output by the question-answering model.

12. A question-answering method based on a sports database, applied to cloud-side devices, comprising: Obtain target historical interaction information and obtain database description information corresponding to at least one sports database, wherein the target historical interaction information includes current sports question information, which is sent by the end device; Based on the demand extraction prompt template, the target historical interaction information and the description information of each database are processed to generate demand extraction prompt words, and the demand extraction prompt words are input into the question answering model to obtain the user demand information output by the question answering model; Based on the user demand information, a target sports database is determined from each sports database, wherein the target sports database includes at least one target sports data table; Based on the target historical interaction information, the user demand information, the database description information corresponding to the target sports database, and each target sports data table, a structured statement corresponding to the current sports problem information is generated; The target data is determined in the target sports database according to the structured statement, and the target historical interaction information and the target data are input into the question answering model to obtain the answer information output by the question answering model. The answer information is sent to the terminal device.

13. The method of claim 12, further comprising: The receiving device sends adjustment information in response to the answer information; The adjustment information and the answer information are input into the question-answering model to obtain the adjustment answer information output by the question-answering model; The adjusted answer information is sent to the terminal device.

14. An information processing method based on a question-answering model, applied to a task platform, comprising: A task generation request sent by a receiving end-side device, wherein the task generation request includes request information; Based on the request information, a question-answering model is obtained, wherein the question-answering model obtains user demand information based on target historical interaction information and database description information corresponding to at least one database, determines the target database based on the user demand information and generates structured statements, and the target sports database is any one of the databases; Task information is generated based on the question-answering model, wherein the task information is used by the edge device to perform a database-based question-answering task.

15. The method of claim 14, wherein the request information includes a task scenario identifier for a database-based question-and-answer task, or a task model identifier; Based on the requested information, a question-answering model is obtained, including: Based on the task scenario identifier, a target scenario template is determined from multiple preset scenario templates, and based on the target scenario template, a question-answering model is searched from the model library, wherein the model library stores multiple question-answering models; or, Based on the task model identifier, the question-answering model is searched from the model library.

16. A task platform, comprising a request interface and a response unit; The request interface is used to receive task generation requests sent by the end-side device, wherein... The task generation request includes request information; The response unit is used to obtain a question-and-answer model based on the request information, and generate task information based on the question-and-answer model. The question-and-answer model obtains user demand information based on target historical interaction information and database description information corresponding to at least one database, determines the target database based on the user demand information and generates structured statements. The target database can be any one of the databases. The task information is used by the end device to execute a database-based question-and-answer task.

17. A computing device, comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, which, when executed by the processor, implement the steps of the method according to any one of claims 1 to 15.

18. A computer-readable storage medium storing a computer program / instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 15.

19. A computer program product comprising a computer program / instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 15.

Citation Information

Patent Citations

  • Database query instruction generation method and device, computer equipment and storage medium

    CN117909355A

  • Structured query language generation method and device, electronic equipment and storage medium

    CN118093621A

  • Intelligent question answering method based on pre-training model, computer equipment and storage medium

    CN118332095A

  • Systems, methods, and apparatuses for implementing dynamic macros within a multi-tenant aware structured query language

    US20180218031A1

  • Natural language-based search engine for information retrieval in energy industry

    WO2024059094A1