CN116595026A - Information inquiry method - Google Patents

Information inquiry method Download PDF

Info

Publication number
CN116595026A
CN116595026A CN202310437564.0A CN202310437564A CN116595026A CN 116595026 A CN116595026 A CN 116595026A CN 202310437564 A CN202310437564 A CN 202310437564A CN 116595026 A CN116595026 A CN 116595026A
Authority
CN
China
Prior art keywords
query
sample
text
target
sentence
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310437564.0A
Other languages
Chinese (zh)
Inventor
曹荣禹
耿瑞莹
惠彬原
黎槟华
黄非
李永彬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba China Co Ltd
Original Assignee
Alibaba China Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba China Co Ltd filed Critical Alibaba China Co Ltd
Priority to CN202310437564.0A priority Critical patent/CN116595026A/en
Publication of CN116595026A publication Critical patent/CN116595026A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the specification provides an information query method, wherein the information query method comprises the following steps: acquiring a query request, wherein the query request comprises a query text; inputting the query text into a query sentence generation model to obtain a target query sentence corresponding to the query text, wherein the query sentence generation model is obtained based on sample set training, the sample set comprises sample text and sample query sentences, the sample query sentences are obtained based on different sample expansion task acquisition, and the sample text is obtained by inputting the sample query sentence into the text generation model; and searching target information from a database based on the target query statement. Because the sample set is obtained based on the sample expansion task and the text generation model, the accuracy of generating the target query statement is higher through the query statement generation model obtained through training the sample set containing rich samples; and further, the target information acquired based on the target query statement is more accurate.

Description

Information inquiry method
Technical Field
The embodiment of the specification relates to the technical field of computers, in particular to an information query method.
Background
With the continuous development of computer technology, forms are used as a widely used storage mode in various application scenarios, such as insurance, medical treatment, and the like. When data in a table needs to be acquired, a query statement needs to be utilized.
At present, a non-technician can realize the query of the table data, and a method for converting the text input by the user into a corresponding query sentence is realized, so that the user can search the table data; however, the current method of converting text into corresponding query sentences has low accuracy, and a more reliable scheme needs to be provided to realize the conversion from text to query sentences.
Disclosure of Invention
In view of this, the embodiments of the present disclosure provide an information query method. One or more embodiments of the present disclosure relate to an information query apparatus, a question answer query method, a training method of a query sentence generation model, a computing device, a computer-readable storage medium, and a computer program, which solve the technical drawbacks of the prior art.
According to a first aspect of embodiments of the present disclosure, there is provided an information query method, including:
Acquiring a query request, wherein the query request comprises a query text;
inputting the query text into a query sentence generation model to obtain a target query sentence corresponding to the query text, wherein the query sentence generation model is obtained based on sample set training, the sample set comprises sample text and sample query sentences, the sample query sentences are obtained based on different sample expansion task acquisition, and the sample text is obtained by inputting the sample query sentence into the text generation model;
and searching target information from a database based on the target query statement.
According to a second aspect of embodiments of the present specification, there is provided an information inquiry apparatus including:
the acquisition module is configured to acquire a query request, wherein the query request comprises a query text;
the input module is configured to input the query text into a query statement generation model to obtain a target query statement corresponding to the query text, wherein the query statement generation model is obtained based on sample set training, the sample set comprises sample text and sample query statements, the sample query statements are obtained based on different sample expansion task acquisition, and the sample text is obtained by inputting the sample query statement into the text generation model;
And the searching module is configured to search the target information from the database based on the target query statement.
According to a third aspect of embodiments of the present disclosure, there is provided a training method of a query statement generation model, applied to cloud side equipment, including:
extracting a target text and a target query sentence corresponding to the target text in a sample set, wherein the target text is any sample text in the sample set;
inputting the target text into a query sentence generation model to obtain a predicted query sentence;
calculating a statement loss value based on the predicted query statement and the target query statement;
adjusting model parameters of the query sentence generation model according to the sentence loss value until model training stopping conditions are reached, and obtaining a trained query sentence generation model;
and sending the model parameters of the query statement generation model to the terminal side equipment.
According to a fourth aspect of embodiments of the present disclosure, there is provided a question answer query method, including:
acquiring an answer query request for a question, wherein the answer query request comprises a question text;
inputting the question text into a query sentence generation model to obtain a question answer query sentence corresponding to the question text, wherein the query sentence generation model is obtained based on sample set training, the sample set comprises sample text and sample query sentences, the sample query sentences are obtained based on different sample expansion tasks, and the sample text is obtained by inputting the sample query sentence into a text generation model;
And searching a question answer from a database based on the question answer query statement.
According to a fifth aspect of embodiments of the present specification, there is provided a computing device comprising:
a memory and a processor;
the memory is configured to store computer-executable instructions that, when executed by the processor, perform the steps of the information query method described above.
According to a sixth aspect of embodiments of the present specification, there is provided a computer readable storage medium storing computer executable instructions which, when executed by a processor, implement the steps of the information query method described above.
According to a seventh aspect of the embodiments of the present specification, there is provided a computer program, wherein the computer program, when executed in a computer, causes the computer to perform the steps of the above-described information query method.
One embodiment of the present disclosure implements obtaining a query request, where the query request includes a query text; inputting the query text into a query sentence generation model to obtain a target query sentence corresponding to the query text, wherein the query sentence generation model is obtained based on sample set training, the sample set comprises sample text and sample query sentences, the sample query sentences are obtained based on different sample expansion task acquisition, and the sample text is obtained by inputting the sample query sentence into the text generation model; and searching target information from a database based on the target query statement.
According to the information query method, query texts are input into a query statement generation model obtained based on sample set training, and target query statements are generated; because the sample set is obtained based on the sample expansion task and the text generation model, the accuracy of the generated target query statement is higher through the query statement generation model obtained by training the sample set containing rich sample data; and the target information acquired based on the target query statement is more accurate.
Drawings
FIG. 1 is a schematic flow chart of a training sample set generating method according to an embodiment of the present disclosure;
FIG. 2 is a flow chart of a method for querying information provided in one embodiment of the present disclosure;
FIG. 3 is a flow chart of a training method for a query statement generation model provided in one embodiment of the present specification;
FIG. 4 is a flowchart of a question answer query method according to one embodiment of the present disclosure;
FIG. 5 is a flowchart illustrating a process of an information query method according to one embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of an information query apparatus according to an embodiment of the present disclosure;
FIG. 7 is a block diagram of a computing device provided in one embodiment of the present description.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present description. This description may be embodied in many other forms than described herein and similarly generalized by those skilled in the art to whom this disclosure pertains without departing from the spirit of the disclosure and, therefore, this disclosure is not limited by the specific implementations disclosed below.
The terminology used in the one or more embodiments of the specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of the specification. As used in this specification, one or more embodiments and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used in one or more embodiments of the present specification refers to and encompasses any or all possible combinations of one or more of the associated listed items.
It should be understood that, although the terms first, second, etc. may be used in one or more embodiments of this specification to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first may also be referred to as a second, and similarly, a second may also be referred to as a first, without departing from the scope of one or more embodiments of the present description. The word "if" as used herein may be interpreted as "at … …" or "at … …" or "responsive to a determination", depending on the context.
Furthermore, it should be noted that, user information (including, but not limited to, user equipment information, user personal information, etc.) and data (including, but not limited to, data for analysis, stored data, presented data, etc.) according to one or more embodiments of the present disclosure are information and data authorized by a user or sufficiently authorized by each party, and the collection, use, and processing of relevant data is required to comply with relevant laws and regulations and standards of relevant countries and regions, and is provided with corresponding operation entries for the user to select authorization or denial.
First, terms related to one or more embodiments of the present specification will be explained.
SQL: structured Query Language, structured query statements.
Text-To-SQL: the natural language is converted into SQL query statements.
SQL-To-Text: the SQL query statement is converted into natural language.
SQL-AST: SQL corresponding syntax structure tree.
Fine-tune: under the trained model, fine tuning of the parameters of the model is performed based on the new data.
A table (Tab) is a storage means widely used for storing and displaying structured data. Because the table data structure is clear, easy to maintain and high in timeliness, a large amount of high-value data in the industries of finance, insurance, medical treatment and the like are stored in a table form, so that a large-scale database is formed. The semantic analysis technology of the form can be quickly matched with the database, so that a user can automatically obtain an answer from the database by providing a natural language question, and the interaction efficiency and experience with the database are greatly improved. Text-To-SQL is a technique capable of converting natural language into queriable SQL statements, and is therefore of great interest in the database field.
The Text-To-SQL model needs To have accurate understanding of natural language questions presented by users on one hand, and accurate reasoning of searching answers according To requirements in a structured table on the other hand. However, in a practical application scenario, the Text-To-SQL model encounters various challenges, such as three more popular challenges: domain generalization, combined generalization, and data starvation. Wherein, domain generalization refers to that training data is derived from certain specific domains but test data is derived from other new domains, combination generalization refers to that a Text-to-SQL model can be extended to a combination of elements by observing the elements observed in the training process, and data starvation refers to that a neural network model needs a large amount of labeling data to obtain higher accuracy.
To solve the above problem, the solution of the present specification is based on the method proposed by dual learning of Text-to-SQL and SQL-to-Text, automatically sampling a large number of task driven SQL statements and generating corresponding natural language questions, creating a large number of high quality < Text, SQL > data to continuously enhance the Text-to-SQL and SQL-to-Text model capabilities.
In the present specification, an information query method, which relates to an information query apparatus, a question answer query method, a training method of a query sentence generation model, a computing device, and a computer-readable storage medium, are provided, and detailed in the following embodiments one by one.
Referring to fig. 1, fig. 1 shows a flowchart of a training sample set generating method according to an embodiment of the present disclosure, which specifically includes:
1. acquiring sample data carrying labels in a training sample set; specifically, acquiring a sample text carrying a query sentence label and a query sentence carrying a text label; training a text model of the query sentence based on the sample text carrying the query sentence tag, and training a text-to-query sentence model based on the query sentence carrying the text tag.
2. Inputting the actual query statement acquired based on the sampling template into a trained query statement-to-text model to obtain a prediction text corresponding to the actual query statement generated by the model.
3. And inputting the trained text to query sentence model based on the predicted text and the data meta information corresponding to the predicted text to obtain a predicted query sentence output by the model, namely a predicted SQL sentence.
4. Comparing the actual query statement with the predicted query statement, and if the actual query statement is consistent with the predicted query statement, adding the actual query statement and the predicted text as training samples into a training sample set; if the actual query statement is inconsistent with the predicted query statement, discarding the piece of data.
The training steps 1-4 are circulated until the number of samples in the training sample set meets the requirement, and the current text-to-query sentence model can be used as a query sentence generation model after training; and the generated training sample set can be used for training other untrained query sentence generation models, so that the training effect of the model is improved by enriching the sample set content.
One embodiment of the present disclosure implements obtaining a query request, where the query request includes a query text; inputting the query text into a query sentence generation model to obtain a target query sentence corresponding to the query text, wherein the query sentence generation model is obtained based on sample set training, the sample set comprises sample text and sample query sentences, the sample query sentences are obtained based on different sample expansion task acquisition, and the sample text is obtained by inputting the sample query sentence into the text generation model; and searching target information from a database based on the target query statement.
According to the information query method, query texts are input into a query statement generation model obtained based on sample set training, and target query statements are generated; because the sample set is obtained based on the sample expansion task and the text generation model, the accuracy of the generated target query statement is higher through the query statement generation model obtained by training the sample set containing rich sample data; and the target information acquired based on the target query statement is more accurate.
Referring to fig. 2, fig. 2 shows a flowchart of a method for querying information according to an embodiment of the present disclosure, which specifically includes the following steps.
Step 202: and obtaining a query request, wherein the query request comprises a query text.
The query request refers to a request for searching target information corresponding to a text in a database; the query request contains query text, which can be text generated by user input or other tasks; for example, the query text is text "what is the total number of people in a grade" entered by the user.
Specifically, the terminal generates a query request based on the operation of sending the query text by the user, wherein the query request comprises the query text input by the user; or the terminal generates a query request based on the operation of selecting the query text from the query text prompted by the terminal by the user trigger, wherein the query request comprises the query text selected by the user.
In one embodiment of the present description, the user inputs the query text "what is the total number of one grade" in the dialog box provided by the terminal; the terminal generates a query request based on a query text input by a user, and the query request includes the query text "what is the total number of people in one grade".
The query request containing the query text is acquired, so that the corresponding query result is obtained based on the query text.
Step 204: inputting the query text into a query sentence generation model to obtain a target query sentence corresponding to the query text, wherein the query sentence generation model is obtained based on sample set training, the sample set comprises sample text and sample query sentences, the sample query sentences are obtained based on different sample expansion task acquisition, and the sample text is obtained by inputting the sample query sentence into the text generation model.
In practical application, after the query request is acquired, the query request is analyzed to obtain a query text, so that the execution of subsequent steps can be performed based on the query text.
The query sentence generation model refers to a neural network model which can output a query sentence which can be queried by a computer based on an input query text; for example, the query term generation model may output a query term "SELECT name, personal identification FROM student list" based on the entered text "look up name and personal identification in student list"; the target query statement refers to a statement that a computer can use to acquire information in a database; the sample expansion task refers to a task for expanding sample query sentences in a sample set, and in practical application, the sample expansion task can be an expansion task with three dimensions of data field, query sentence form and data quantity; specifically, the expansion of the sample expansion task in the data field refers to obtaining a sample query threshold in an unrelated field, namely obtaining a sample query statement from the field 3 when the sample query statement comprises the field 1 and the field 2 sample query statements; the expansion of the sample expansion task in the data quantity refers to obtaining a larger number of sample query sentences in a database; the expansion of the sample expansion task in the form of query sentences refers to the acquisition of more sample query sentences in the form of query sentences.
Specifically, analyzing a query request and determining a query text; in the case that the data meta information corresponding to the query text can be directly determined, for example, the query scene only comprises one data table, so that the data are all queried in the data table, and only the query text is acquired; under the condition that the data source information of the query text cannot be directly determined, the query text and the data meta information corresponding to the query text need to be acquired; inputting the query text or the query text and the data meta information into a pre-trained query sentence generation model to obtain a target query sentence output by the query sentence generation model; training the query sentence generation model based on a sample set before inputting the query text into the query sentence generation model; specific: collecting sample query sentences based on different sample expansion tasks, inputting each sample query sentence into a text generation model to obtain a sample text corresponding to each sample query sentence output by the text generation model, wherein the text generation model can output a corresponding query text based on the input query sentences; based on the sample query statement and the corresponding sample text, a sample set is constructed, and a model is generated for the query statement based on the training sample set for training.
In a specific embodiment of the present disclosure, the received query request is parsed, and a query text is determined; acquiring a query statement generation model which is trained in advance; inputting the query text into a query sentence generation model to obtain a target query sentence output by the query sentence generation model; the sample set comprises sample texts and sample query sentences, the sample query sentences are acquired based on different sample expansion tasks, and the sample texts are obtained by inputting the sample query sentences into a text generation model.
The target query sentence is obtained by inputting the query text into the query sentence generating model obtained by training the sample set generated based on the sample expanding task and the text generating model, and the sample data of different dimensions are expanded on the sample based on the sample expanding task and the text generating model, so that the query sentence generating model obtained by training outputs the target query sentence with higher accuracy, and the query accuracy of the information query based on the target query sentence is improved.
In practical application, in order to ensure the accuracy of generating the query sentence based on the query text, the data meta information and the query text are input into the query sentence generation model, so as to realize the generation of the query sentence.
Specifically, the query request further includes data meta information corresponding to the query text;
the method for inputting the query text into the query sentence generation model can comprise the following steps:
splicing the query text and the data meta-information to obtain a query sequence;
and inputting the query sequence into a query statement generation model.
The data meta-information refers to the position of the information to be queried of the query text, for example, the number of students is queried in the query text, and the data meta-information can be a student information table; the query sequence refers to a sequence obtained by splicing the query text and the corresponding data meta-information; and inputting the spliced query sequence into a query sentence generation model.
In a specific embodiment of the present disclosure, the query request is parsed to obtain a query text "one-grade headcount" and a data meta-information "student information table a"; splicing the query text and the data meta-information to obtain a query sequence; the query sequence is input into a query statement generation model.
The query text and the query sentence position information are spliced to obtain a query sequence; and inputting the query sequence into a query lower sentence generation model, so that the subsequent generation of the query sentence corresponding to the query text based on the query sequence is facilitated, and the accuracy of the query sentence is improved.
In practical application, in order to enable the query sentence generation model to output a query sentence based on input query text and data meta information, training is generally required to be performed on the model based on sample text carrying query sentence labels in a sample set; inputting a sample text carrying a query sentence label into a query sentence generation model to obtain a predicted query sentence output by the model; and calculating a loss value based on the predicted query statement and the query statement label, so as to adjust model parameters of the query statement generation model.
However, the above approach requires obtaining a certain number of sample texts carrying query sentence tags; the sample text with the tag is low in generation efficiency and high in generation cost, and the field range of the sample text or the query statement tag is single, so that the sample text is generated based on the sample query statement and the text generation model by extracting the sample query statement which is easy to obtain, and the model can be trained based on the generated sample text and the corresponding sample query statement.
Specifically, before the query text is input into the query sentence generation model, the method further comprises:
Extracting a target text and a target query sentence corresponding to the target text in a sample set, wherein the target text is any sample text in the sample set;
inputting the target text into a query sentence generation model to obtain a predicted query sentence;
calculating a statement loss value based on the predicted query statement and the target query statement;
and adjusting model parameters of the query statement generation model according to the statement loss value until a model training stopping condition is reached, and obtaining the trained query statement generation model.
The sample set is generated based on sample texts and sample query sentences acquired by different sample expansion tasks and text generation models; the query sentence model can be a model which is trained in advance and has the function of inputting the query sentence based on the text; the target text is one sample arbitrarily extracted in the sample set, and the target query statement refers to a query statement corresponding to the target text in the sample set; the predicted query statement refers to a query statement output by the query statement generation model based on the target text and the corresponding data meta information; statement loss values refer to loss values calculated from the predicted query statement and the target query statement.
Specifically, selecting a target text in a sample set, and acquiring data meta-information corresponding to the target text; splicing the target text and the data meta-information to obtain a query sequence; inputting the query sequence into a query sentence generation model to obtain a prediction query sentence output by the model; calculating statement loss values based on the predicted query statement and the target query statement; adjusting model parameters of the query statement generation model according to the statement loss value; and continuously acquiring sample texts from the sample set, further training the query sentence generation model, and repeating the steps until the model training stopping condition is reached, thereby obtaining the trained query sentence generation model.
In a specific embodiment of the present disclosure, a text a and a query sentence S corresponding to the text a are selected in a sample set; splicing the text A and text position information 'student list' corresponding to the text A to obtain a query sequence; inputting the query sequence into a query sentence generation model to obtain a predicted query sentence output by the model; calculating statement loss values based on the predicted query statement and the query statement S; adjusting model parameters of the query statement generation model based on the statement loss value; repeating the steps until the training of the query sentence generation model is completed based on each text in the sample set, and obtaining the trained query sentence generation model.
The sample set containing abundant sample content is used for training the query sentence model, so that the accuracy of generating the query sentence by the query sentence model can be improved.
In practical application, before training the query sentence generation model based on the sample set, the sample text and the sample query sentence are sampled based on different sample expansion tasks and text generation models, so as to construct the sample set.
Specifically, before extracting the target text and the target query sentence corresponding to the target text in the sample set, the method further comprises:
determining a target sample expansion task and a target sentence sampling template corresponding to the target sample expansion task;
reading a plurality of sample query sentences in a query sentence database based on the target sentence sampling template;
respectively inputting each sample inquiry sentence into a text generation model to obtain a sample text corresponding to each sample inquiry sentence;
and forming a sample set based on the plurality of sample query sentences and sample texts corresponding to the sample query sentences.
The target sample expansion task refers to one of tasks for expanding sample query sentences; the target sentence sampling template is used for executing a target sample expansion task; the query statement database refers to a database storing query statements, and in practical application, the query statements in the query statement database can be generated in historical tasks, input by developers and the like; the sample query statement refers to a query statement read in a query statement database; the sample text refers to a text output by the text generation model based on sample query sentences; the text generation model is a model that generates a corresponding text FROM an input query term, and outputs a sample text "look up a name and a personal identifier in a student table" based on a query term "SELECT name, personal identifier FROM student table", for example.
Specifically, a target sample expansion task is determined in response to a sample expansion request for a sample set; obtaining a target sentence sampling template corresponding to a target sample expansion task; collecting query sentences conforming to the templates in a query sentence database according to the target sentence sampling templates, and taking the query sentences as sample query sentences; respectively inputting the obtained sample query sentences into a text generation model, so as to obtain sample texts corresponding to the sample query sentences; generating a sample pair based on the sample text and a sample query sentence corresponding to the sample text; and constructing a sample set according to the generated sample pairs.
In one embodiment of the present disclosure, a target sample expansion task is determined based on a sample expansion request; obtaining a target sentence sampling template corresponding to a target sample expansion task; sampling query sentences in a query sentence library according to sampling rules set in a target sentence sampling template, and taking the query sentences as target query sentences; inputting the sampled target query sentences into a pre-trained text generation model, so as to obtain sample texts corresponding to each target query sentence; a sample set is constructed based on the sampled sample query statements and the sample query statements.
Obtaining target query sentences in a query sentence database through a target sentence sampling template corresponding to a target sample expansion task, so as to enrich query sentences in a sample set; based on the text generation model, the sample query statement is converted into the sample text, so that the text corresponding to the query statement is enriched, and the efficiency of generating the sample text is improved.
In practical application, the sample set obtained based on the mode can realize training of the query sentence generation model, but in order to further improve the sample quality in the sample set, the sample text can be further verified based on the trained query sentence generation model, and more accurate sample data are further added into the sample set.
Specifically, based on the plurality of sample query sentences and sample texts corresponding to the sample query sentences, the method for forming the sample set may include:
inputting each sample text and the data meta information corresponding to each sample text into a preset query sentence generation model to obtain a prediction query sentence corresponding to each sample text;
determining a target prediction query statement and a sample query statement corresponding to the target prediction query statement;
and under the condition that the predicted query statement is consistent with the sample query statement, constructing a sample set based on the target predicted query statement and sample text corresponding to the target predicted query statement.
The preset query sentence generation model is a model for generating a corresponding query sentence by an input text; in practical application, training can be generated on the preset query statement model based on a small amount of sample data in the sample set, so that the model has a required processing function; the target predictive query statement refers to any one query statement output by a preset query statement generation model.
Specifically, a sample text output by a text generation model is spliced with corresponding data meta-information to obtain a query sequence; inputting each query sequence into a preset query sentence generation model to obtain a predicted query sentence output by the model; and comparing each predicted query sentence with the corresponding target query sentence, and if the comparison is consistent, determining that the target sample text corresponding to the target query sentence is correct, so that the sample set can be expanded based on the target query sentence and the target sample text.
Further, the steps are circulated, and query sentences which are consistent in comparison and texts corresponding to the query sentences are added into the sample set until the number of samples in the sample set meets the preset requirement; at this time, the preset query sentence generation model completes training in the above-described cyclic process, so the preset query sentence generation model may be used as a model for which training is completed. The generated sample set may train other untrained query statement generation models.
In a specific embodiment of the present specification, a sample text a output by a text generation model is obtained; splicing the sample text a and the data meta information corresponding to the sample text to obtain a query sequence; inputting the query sequence into a preset query statement generation model to obtain a predicted query statement output by the model; comparing the predicted query sentence with the target query sentence corresponding to the sample text a, and if the predicted query sentence is consistent with the target query sentence, adding the sample text a and the target query sentence into a sample set; and if the text wool a is inconsistent with the corresponding target query statement, deleting the sample text wool a and the corresponding target query statement.
The model is generated by utilizing the preset query statement, so that a predicted query statement is obtained, more accurate sample text and a corresponding query statement are screened out and added to a sample set based on comparison of the preset query statement and a target query statement, a sample set instruction is improved, and quality of a subsequent query statement generation model obtained based on training of the sample set is improved.
In order to improve the sampling completeness and accuracy of the query statement, the query statement can be sampled by acquiring a statement frame and further acquiring statement specific content based on the frame.
Specifically, based on the target sentence sampling template, the method for reading a plurality of sample query sentences in the query sentence database may include:
Generating a preset sampling rule based on the query statement specification;
acquiring a query statement frame based on the preset sampling rule;
collecting query statement content according to the query statement frame, and generating sample query statements based on the query statement frame and the query statement content.
The query statement specification refers to a specification which needs to be met by the query statement; the preset sampling rule refers to a rule generated based on query statement specifications, for example, "a min and max aggregation function must only be combined with a digit type column and a date type column, cannot be combined with a text type column", "a subsection corresponding to an ORDER BY statement must not contain repeated contents", and the like; the query sentence framework refers to a sentence structure tree corresponding to a query sentence, for example, the sentence framework is a structure tree formed by query sentence clauses, column names in a database and the like; the query statement content refers to the possessed content of each node in the structure tree, for example, an aggregation function corresponding to column sampling, an ascending 0 ORDER descending type of sampling ORDER BY clauses, and the like; adding the query sentence content into a query sentence frame to obtain a completed query sentence tree; the query statement tree is converted into a sequence of characters, i.e., sample query statements.
The query statement frame is sampled based on the preset sampling rule, and query statement content is obtained based on the query statement frame, so that a sample query statement is obtained, the sampling completeness and accuracy of the query statement are improved, and the correct query statement can be conveniently used for model training.
In practical application, the sample set can be expanded from different layers, namely, the sample set is expanded based on different sample expansion tasks, so that sample contents in the sample set are enriched, and a query statement generation model with high generation accuracy is conveniently obtained based on sample set training.
Specifically, based on the target sentence sampling template, before the plurality of sample query sentences are read in the query sentence database, the method further comprises:
determining a historical database and a historical query statement template based on the historical sample data;
correspondingly, based on the target statement sampling template, a plurality of sample query statements are read in a query statement database, and the method comprises at least one of the following steps:
reading a plurality of sample query sentences in the database of each field according to the historical query sentence template;
generating a new query statement template according to the historical query statement template, and reading a plurality of sample query statements in the historical database based on the new query statement template;
And acquiring a plurality of sample query sentences different from the history sample data from the history database according to the history sample data and the history query sentence template.
The historical sample data refers to sample data used in the process of training the query statement generation model in advance, wherein the sample data comprises a pre-training sample text and a corresponding pre-training sample query statement; the historical database refers to a database containing sample data, and the historical query statement template refers to a template for acquiring a pre-training sample query statement.
Specifically, in the case that the target sample expansion task is to perform field expansion on sample data, that is, obtain sample data in different fields, sample query sentences which are not obtained can be sampled in databases in various fields based on a historical query template; under the condition that the target sample expansion task is to expand the query statement form, a new query statement template can be generated based on the historical query template; under the condition that the target sample expansion task is to expand the number of sample data, sample data inconsistent with the historical sample data can be obtained from a historical sample database based on the historical query template and used as data expansion of a sample set.
In one embodiment of the present disclosure, a history database m and a history query statement template n are determined based on history sample data; and if the sample expansion task is determined to expand the field of sample data, acquiring sample query sentences in databases in different fields such as an acquired field database 1, an acquired field database 2 and the like based on the historical query sentence template n.
In another embodiment of the present specification, a history database m and a history query statement template n are determined based on history sample data; determining that a sample expansion task is in an expansion sample query statement form, and generating a new query template n1 based on a historical query statement template n; based on the new query template n1, a sample query statement is acquired in the history database m.
In yet another embodiment of the present specification, a history database m and a history query statement template n are determined based on history sample data; and determining that the sample expansion task is to expand the number of the expanded samples, and acquiring a query sentence different from the historical sample data in the historical database m based on the historical sample data and the historical query sentence template n to serve as a new sample query sentence.
Sample query sentences are expanded in different modes based on different types of expansion tasks, so that the enrichment of sample set contents is realized, and a query sentence generation model with higher generation accuracy is conveniently obtained based on sample set training.
Step 206: and searching target information from a database based on the target query statement.
The target information refers to a query result obtained by querying based on a target query statement.
Specifically, a target query sentence output by a query sentence generation model is obtained; if the user demand is that the query statement is obtained, feeding back the target query statement to the user; if the user demand is to obtain the query result, the query is performed in the corresponding database based on the target query statement to obtain the query result, and then the query result is fed back to the user.
In a specific embodiment of the present disclosure, it is determined that a query sentence outputted BY the query sentence generation model is a "SELECT hospital system", i.e. the number of students in each family is counted, and then the query sentence is searched in a database based on the query sentence, so as to obtain target information as follows: 100 persons in the mathematical system and 100 persons in the physical system.
The query result is obtained by generating the target query statement output by the model based on the query statement, so that the accuracy of the query result is improved.
One embodiment of the present disclosure implements obtaining a query request, where the query request includes a query text; inputting the query text into a query sentence generation model to obtain a target query sentence corresponding to the query text, wherein the query sentence generation model is obtained based on sample set training, the sample set comprises sample text and sample query sentences, the sample query sentences are obtained based on different sample expansion task acquisition, and the sample text is obtained by inputting the sample query sentence into the text generation model; and searching target information from a database based on the target query statement.
According to the information query method, query texts are input into a query statement generation model obtained based on sample set training, and target query statements are generated; because the sample set is obtained based on the sample expansion task and the text generation model, the accuracy of the generated target query statement is higher through the query statement generation model obtained by training the sample set containing rich sample data; and the target information acquired based on the target query statement is more accurate.
Referring to fig. 3, fig. 3 shows a flowchart of a training method of a query sentence generation model, which is applied to cloud-side equipment and specifically includes the following steps:
step 302: extracting a target text and a target query sentence corresponding to the target text in a sample set, wherein the target text is any sample text in the sample set.
Specifically, before extracting the target text and the target query sentence corresponding to the target text in the sample set, the method further comprises:
determining a target sample expansion task and a target sentence sampling template corresponding to the target sample expansion task; reading a plurality of sample query sentences in a query sentence database based on the target sentence sampling template; respectively inputting each sample inquiry sentence into a text generation model to obtain a sample text corresponding to each sample inquiry sentence; and forming a sample set based on the plurality of sample query sentences and sample texts corresponding to the sample query sentences.
Further, based on the plurality of sample query sentences and sample texts corresponding to the sample query sentences, forming a sample set includes: inputting each sample text and the data meta information corresponding to each sample text into a preset query sentence generation model to obtain a prediction query sentence corresponding to each sample text; determining a target prediction query statement and a sample query statement corresponding to the target prediction query statement; and under the condition that the predicted query statement is consistent with the sample query statement, constructing a sample set based on the target predicted query statement and sample text corresponding to the target predicted query statement.
By generating a sample set containing rich sample data at the cloud-side device, subsequent training of the model based on the sample set is facilitated.
Step 304: and inputting the target text into a query sentence generation model to obtain a predicted query sentence.
Specifically, the target text and the data meta information of the target text can be input into a query sentence generating model to obtain a predicted query sentence.
Step 306: and calculating statement loss values based on the predicted query statement and the target query statement.
Step 308: and adjusting model parameters of the query statement generation model according to the statement loss value until a model training stopping condition is reached, and obtaining the trained query statement generation model.
Step 310: and sending the model parameters of the query statement generation model to the terminal side equipment.
Specifically, under the condition that a model acquisition request sent by the terminal side equipment is received, determining model parameters of a query statement generation model in response to the model acquisition request; model parameters are returned to the end side equipment, so that model training and model application of the cloud side equipment are realized, the occupation of computing resources of the end side equipment is avoided, and the efficiency of model application and training is improved.
According to the training method of the query statement generation model, target texts and target query statements corresponding to the target texts are extracted from a sample set, wherein the target texts are any sample text in the sample set; inputting the target text into a query sentence generation model to obtain a predicted query sentence; calculating a statement loss value based on the predicted query statement and the target query statement; adjusting model parameters of the query sentence generation model according to the sentence loss value until model training stopping conditions are reached, and obtaining a trained query sentence generation model; and sending the model parameters of the query statement generation model to the terminal side equipment. Model training and model application of cloud side equipment are achieved, computing resources of end side equipment are prevented from being occupied, and model application and training efficiency is improved.
Referring to fig. 4, fig. 4 shows a flowchart of a question answer query method according to an embodiment of the present disclosure, which specifically includes the following steps:
step 402: and obtaining an answer query request for the question, wherein the answer query request comprises a question text.
Specifically, the question text may be "a total number of people of one grade".
Step 404: inputting the question text into a query sentence generating model to obtain a question answer query sentence corresponding to the question text, wherein the query sentence generating model is obtained based on sample set training, the sample set comprises sample text and sample query sentences, the sample query sentences are obtained based on different sample expansion task acquisition, and the sample text is obtained by inputting the sample query sentences into the text generating model.
Step 406: and searching a question answer from a database based on the question answer query statement.
Specifically, the question answer is "30 people".
Further, after searching the question answer from the database, the method may further include:
sending the question answers to a user; receiving feedback information of a user aiming at answers of questions; and adjusting the query statement generation model according to the feedback information.
The feedback information is feedback for answers of questions, and because the situation that the query result is deviated may occur in practical application, the query sentence generation model can be finely adjusted based on the feedback information of the user.
According to the question answer query method, an answer query request aiming at a question is obtained, wherein the answer query request comprises a question text; inputting the question text into a query sentence generation model to obtain a question answer query sentence corresponding to the question text, wherein the query sentence generation model is obtained based on sample set training, the sample set comprises sample text and sample query sentences, the sample query sentences are obtained based on different sample expansion tasks, and the sample text is obtained by inputting the sample query sentence into a text generation model; and searching a question answer from a database based on the question answer query statement.
Inputting a query sentence generation model obtained based on sample set training through a question text to generate a question answer query sentence; because the sample set is obtained based on the sample expansion task and the text generation model, the accuracy of the generated question answer query statement is higher through the query statement generation model obtained by training the sample set containing rich sample data; and further, the question answers acquired based on the question answer inquiry sentences are more accurate.
The information query method provided in the present specification is further described below with reference to fig. 5 by taking an application of the information query method in text as an example. Fig. 5 shows a flowchart of a processing procedure of an information query method according to an embodiment of the present disclosure, which specifically includes the following steps.
Step 502: and determining a target sample expansion task and a target sentence sampling template corresponding to the target sample expansion task.
Step 504: based on the target statement sampling template, a plurality of sample query statements are read in a query statement database.
Step 506: and respectively inputting each sample query sentence into a text generation model to obtain a sample text corresponding to each sample query sentence.
Step 508: and inputting each sample text and the data meta information corresponding to each sample text into a preset query sentence generation model to obtain a prediction query sentence corresponding to each sample text.
Step 510: and determining target prediction query sentences and sample query sentences corresponding to the target prediction query sentences.
Step 512: and under the condition that the predicted query statement is consistent with the sample query statement, constructing a sample set based on the target predicted query statement and the sample text corresponding to the target predicted query statement.
Specifically, under the condition that the sample set is constructed, a preset query statement generation model can be used as a trained query statement generation model; while the generated sample set may be used for training of the model generated for other query statements, a specific training process may include: extracting a target text and a target query sentence corresponding to the target text in a sample set, wherein the target text is any sample text in the sample set; inputting the target text and the data meta information corresponding to the target text into a query sentence generation model to obtain a prediction query sentence; calculating a statement loss value based on the predicted query statement and the target query statement; and adjusting model parameters of the query statement generation model according to the statement loss value until a model training stopping condition is reached, and obtaining the trained query statement generation model.
Step 514: acquiring a query request, wherein the query request comprises a query text;
step 516: inputting the query text into a query sentence generation model to obtain a target query sentence corresponding to the query text, wherein the query sentence generation model is obtained based on sample set training, the sample set comprises sample text and sample query sentences, the sample query sentences are obtained based on different sample expansion task acquisition, and the sample text is obtained by inputting the sample query sentence into the text generation model;
Step 518: and searching target information from a database based on the target query statement.
One embodiment of the present disclosure implements obtaining a query request, where the query request includes a query text; inputting the query text into a query sentence generation model to obtain a target query sentence corresponding to the query text, wherein the query sentence generation model is obtained based on sample set training, the sample set comprises sample text and sample query sentences, the sample query sentences are obtained based on different sample expansion task acquisition, and the sample text is obtained by inputting the sample query sentence into the text generation model; and searching target information from a database based on the target query statement.
According to the information query method, query texts are input into a query statement generation model obtained based on sample set training, and target query statements are generated; because the sample set is obtained based on the sample expansion task and the text generation model, the accuracy of the generated target query statement is higher through the query statement generation model obtained by training the sample set containing rich sample data; and the target information acquired based on the target query statement is more accurate.
Corresponding to the method embodiment, the present disclosure further provides an information query apparatus embodiment, and fig. 6 shows a schematic structural diagram of an information query apparatus provided in one embodiment of the present disclosure. As shown in fig. 6, the apparatus includes:
the obtaining module 602 is configured to obtain a query request, where the query request includes a query text;
an input module 604, configured to input the query text into a query sentence generation model to obtain a target query sentence corresponding to the query text, where the query sentence generation model is obtained based on sample set training, the sample set includes sample text and sample query sentences, the sample query sentences are obtained based on different sample expansion task acquisitions, and the sample text is obtained by inputting the sample query sentence into the text generation model;
a lookup module 606 configured to lookup target information from a database based on the target query statement.
In a specific embodiment of the present disclosure, the apparatus further includes a training module configured to:
extracting a target text and a target query sentence corresponding to the target text in a sample set, wherein the target text is any sample text in the sample set;
Inputting the target text into a query sentence generation model to obtain a predicted query sentence;
calculating a statement loss value based on the predicted query statement and the target query statement;
and adjusting model parameters of the query statement generation model according to the statement loss value until a model training stopping condition is reached, and obtaining the trained query statement generation model.
Optionally, the training module is further configured to:
determining a target sample expansion task and a target sentence sampling template corresponding to the target sample expansion task;
reading a plurality of sample query sentences in a query sentence database based on the target sentence sampling template;
respectively inputting each sample inquiry sentence into a text generation model to obtain a sample text corresponding to each sample inquiry sentence;
and forming a sample set based on the plurality of sample query sentences and sample texts corresponding to the sample query sentences.
Optionally, the training module is further configured to:
inputting each sample text and the data meta information corresponding to each sample text into a preset query sentence generation model to obtain a prediction query sentence corresponding to each sample text;
Determining a target prediction query statement and a sample query statement corresponding to the target prediction query statement;
and under the condition that the predicted query statement is consistent with the sample query statement, constructing a sample set based on the target predicted query statement and sample text corresponding to the target predicted query statement.
Optionally, the input module 604 is further configured to:
splicing the query text and the data meta-information to obtain a query sequence;
and inputting the query sequence into a query statement generation model.
Optionally, the training module is further configured to:
generating a preset sampling rule based on the query statement specification;
acquiring a query statement frame based on the preset sampling rule;
collecting query statement content according to the query statement frame, and generating sample query statements based on the query statement frame and the query statement content.
Optionally, the training module is further configured to:
determining a historical database and a historical query statement template based on the historical sample data;
correspondingly, based on the target statement sampling template, a plurality of sample query statements are read in a query statement database, and the method comprises at least one of the following steps:
Reading a plurality of sample query sentences in the database of each field according to the historical query sentence template;
generating a new query statement template according to the historical query statement template, and reading a plurality of sample query statements in the historical database based on the new query statement template;
and acquiring a plurality of sample query sentences different from the history sample data from the history database according to the history sample data and the history query sentence template.
The information query device of the specification realizes the acquisition of a query request, wherein the query request comprises a query text; inputting the query text into a query sentence generation model to obtain a target query sentence corresponding to the query text, wherein the query sentence generation model is obtained based on sample set training, the sample set comprises sample text and sample query sentences, the sample query sentences are obtained based on different sample expansion task acquisition, and the sample text is obtained by inputting the sample query sentence into the text generation model; and searching target information from a database based on the target query statement.
Generating a target query sentence by inputting a query text into a query sentence generation model which is trained based on a sample set; because the sample set is obtained based on the sample expansion task and the text generation model, the accuracy of the generated target query statement is higher through the query statement generation model obtained by training the sample set containing rich sample data; and the target information acquired based on the target query statement is more accurate.
The above is an exemplary scheme of an information query apparatus of this embodiment. It should be noted that, the technical solution of the information query apparatus and the technical solution of the information query method belong to the same concept, and details of the technical solution of the information query apparatus, which are not described in detail, can be referred to the description of the technical solution of the information query method.
Fig. 7 illustrates a block diagram of a computing device 700 provided in accordance with one embodiment of the present description. The components of computing device 700 include, but are not limited to, memory 710 and processor 720. Processor 720 is coupled to memory 710 via bus 730, and database 750 is used to store data.
Computing device 700 also includes access device 740, access device 740 enabling computing device 700 to communicate via one or more networks 760. Examples of such networks include public switched telephone networks (PSTN, public Switched Telephone Network), local area networks (LAN, localAreaNetwork), wide area networks (WAN, wideAreaNetwork), personal area networks (PAN, personalAreaNetwork), or combinations of communication networks such as the internet. The access device 740 may include one or more of any type of network interface, wired or wireless, such as a network interface card (NIC, network interface controller), such as an IEEE802.11 wireless local area network (WLAN, wireless LocalAreaNetwork) wireless interface, a worldwide interoperability for microwave access (Wi-MAX, worldwide Interoperability for MicrowaveAccess) interface, an ethernet interface, a universal serial bus (USB, universal Serial Bus) interface, a cellular network interface, a bluetooth interface, near field communication (NFC, near Field Communication).
In one embodiment of the present description, the above-described components of computing device 700, as well as other components not shown in FIG. 7, may also be connected to each other, such as by a bus. It should be understood that the block diagram of the computing device illustrated in FIG. 7 is for exemplary purposes only and is not intended to limit the scope of the present description. Those skilled in the art may add or replace other components as desired.
Computing device 700 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., tablet, personal digital assistant, laptop, notebook, netbook, etc.), mobile phone (e.g., smart phone), wearable computing device (e.g., smart watch, smart glasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or personal computer (PC, personal Computer). Computing device 700 may also be a mobile or stationary server.
Wherein the processor 720 is configured to execute computer-executable instructions that, when executed by the processor, perform the steps of the information query method described above.
The foregoing is a schematic illustration of a computing device of this embodiment. It should be noted that, the technical solution of the computing device and the technical solution of the information query method belong to the same concept, and details of the technical solution of the computing device, which are not described in detail, can be referred to the description of the technical solution of the information query method.
An embodiment of the present disclosure also provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the information query method described above.
The above is an exemplary version of a computer-readable storage medium of the present embodiment. It should be noted that, the technical solution of the storage medium and the technical solution of the information query method belong to the same concept, and details of the technical solution of the storage medium which are not described in detail can be referred to the description of the technical solution of the information query method.
An embodiment of the present disclosure further provides a computer program, where the computer program, when executed in a computer, causes the computer to perform the steps of the information query method described above.
The above is an exemplary version of a computer program of the present embodiment. It should be noted that, the technical solution of the computer program and the technical solution of the information query method belong to the same concept, and details of the technical solution of the computer program, which are not described in detail, can be referred to the description of the technical solution of the information query method.
The foregoing describes specific embodiments of the present disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
The computer instructions include computer program code that may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, randomAccess Memory), an electrical carrier signal, a telecommunication signal, a software distribution medium, and so forth. It should be noted that the content of the computer readable medium can be increased or decreased appropriately according to the requirements of the patent practice, for example, in some areas, according to the patent practice, the computer readable medium does not include an electric carrier signal and a telecommunication signal.
It should be noted that, for simplicity of description, the foregoing method embodiments are all expressed as a series of combinations of actions, but it should be understood by those skilled in the art that the embodiments are not limited by the order of actions described, as some steps may be performed in other order or simultaneously according to the embodiments of the present disclosure. Further, those skilled in the art will appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily all required for the embodiments described in the specification.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to the related descriptions of other embodiments.
The preferred embodiments of the present specification disclosed above are merely used to help clarify the present specification. Alternative embodiments are not intended to be exhaustive or to limit the invention to the precise form disclosed. Obviously, many modifications and variations are possible in light of the teaching of the embodiments. The embodiments were chosen and described in order to best explain the principles of the embodiments and the practical application, to thereby enable others skilled in the art to best understand and utilize the invention. This specification is to be limited only by the claims and the full scope and equivalents thereof.

Claims (14)

1. An information query method, comprising:
acquiring a query request, wherein the query request comprises a query text;
inputting the query text into a query sentence generation model to obtain a target query sentence corresponding to the query text, wherein the query sentence generation model is obtained based on sample set training, the sample set comprises sample text and sample query sentences, the sample query sentences are obtained based on different sample expansion task acquisition, and the sample text is obtained by inputting the sample query sentence into the text generation model;
And searching target information from a database based on the target query statement.
2. The method of claim 1, further comprising, prior to entering the query text into a query statement generation model:
extracting a target text and a target query sentence corresponding to the target text in a sample set, wherein the target text is any sample text in the sample set;
inputting the target text into a query sentence generation model to obtain a predicted query sentence;
calculating a statement loss value based on the predicted query statement and the target query statement;
and adjusting model parameters of the query statement generation model according to the statement loss value until a model training stopping condition is reached, and obtaining the trained query statement generation model.
3. The method of claim 2, further comprising, prior to extracting the target text and the target query statement corresponding to the target text in the sample set:
determining a target sample expansion task and a target sentence sampling template corresponding to the target sample expansion task;
reading a plurality of sample query sentences in a query sentence database based on the target sentence sampling template;
respectively inputting each sample inquiry sentence into a text generation model to obtain a sample text corresponding to each sample inquiry sentence;
And forming a sample set based on the plurality of sample query sentences and sample texts corresponding to the sample query sentences.
4. The method of claim 3, forming a sample set based on the plurality of sample query statements and sample text corresponding to each sample query statement, comprising:
inputting each sample text and the data meta information corresponding to each sample text into a preset query sentence generation model to obtain a prediction query sentence corresponding to each sample text;
determining a target prediction query statement and a sample query statement corresponding to the target prediction query statement;
and under the condition that the predicted query statement is consistent with the sample query statement, constructing a sample set based on the target predicted query statement and sample text corresponding to the target predicted query statement.
5. The method of claim 1, wherein the query request further comprises data meta information corresponding to the query text;
inputting the query text into a query sentence generation model, comprising:
splicing the query text and the data meta-information to obtain a query sequence;
and inputting the query sequence into a query statement generation model.
6. The method of claim 3, reading a plurality of sample query statements in a query statement database based on the target statement sampling template, comprising:
Generating a preset sampling rule based on the query statement specification;
acquiring a query statement frame based on the preset sampling rule;
collecting query statement content according to the query statement frame, and generating sample query statements based on the query statement frame and the query statement content.
7. The method of claim 3, further comprising, based on the target statement sampling template, prior to reading a plurality of sample query statements in a query statement database:
determining a historical database and a historical query statement template based on the historical sample data;
correspondingly, based on the target statement sampling template, a plurality of sample query statements are read in a query statement database, and the method comprises at least one of the following steps:
reading a plurality of sample query sentences in the database of each field according to the historical query sentence template;
generating a new query statement template according to the historical query statement template, and reading a plurality of sample query statements in the historical database based on the new query statement template;
and acquiring a plurality of sample query sentences different from the history sample data from the history database according to the history sample data and the history query sentence template.
8. A training method of a query statement generation model is applied to cloud side equipment and comprises the following steps:
extracting a target text and a sample query sentence corresponding to the target text in a sample set, wherein the target text is any sample text in the sample set;
inputting the target text into a query sentence generation model to obtain a predicted query sentence;
calculating a statement loss value based on the predicted query statement and the target query statement;
adjusting model parameters of the query sentence generation model according to the sentence loss value until model training stopping conditions are reached, and obtaining a trained query sentence generation model;
and sending the model parameters of the query statement generation model to the terminal side equipment.
9. The method of claim 8, inputting sample text in a sample set into a query statement generation model to obtain a predictive query statement, comprising:
and inputting the target text and the data meta information corresponding to the target text into a query sentence generation model to obtain a prediction query sentence.
10. The method of claim 8, further comprising, prior to extracting the target text and the target query statement corresponding to the target text in the sample set:
Determining a target sample expansion task and a target sentence sampling template corresponding to the target sample expansion task;
reading a plurality of sample query sentences in a query sentence database based on the target sentence sampling template;
respectively inputting each sample inquiry sentence into a text generation model to obtain a sample text corresponding to each sample inquiry sentence;
and forming a sample set based on the plurality of sample query sentences and sample texts corresponding to the sample query sentences.
11. A question answer query method, comprising:
acquiring an answer query request for a question, wherein the answer query request comprises a question text;
inputting the question text into a query sentence generation model to obtain a question answer query sentence corresponding to the question text, wherein the query sentence generation model is obtained based on sample set training, the sample set comprises sample text and sample query sentences, the sample query sentences are obtained based on different sample expansion tasks, and the sample text is obtained by inputting the sample query sentence into a text generation model;
and searching a question answer from a database based on the question answer query statement.
12. The method of claim 11, further comprising, after searching the database for the question answer:
sending the question answers to a user;
receiving feedback information of a user aiming at answers of questions;
and adjusting the query statement generation model according to the feedback information.
13. A computing device, comprising:
a memory and a processor;
the memory is configured to store computer executable instructions, the processor being configured to execute the computer executable instructions, which when executed by the processor, implement the steps of the method of any one of claims 1 to 12.
14. A computer readable storage medium storing computer executable instructions which when executed by a processor implement the steps of the method of any one of claims 1 to 12.
CN202310437564.0A 2023-04-17 2023-04-17 Information inquiry method Pending CN116595026A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310437564.0A CN116595026A (en) 2023-04-17 2023-04-17 Information inquiry method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310437564.0A CN116595026A (en) 2023-04-17 2023-04-17 Information inquiry method

Publications (1)

Publication Number Publication Date
CN116595026A true CN116595026A (en) 2023-08-15

Family

ID=87588998

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310437564.0A Pending CN116595026A (en) 2023-04-17 2023-04-17 Information inquiry method

Country Status (1)

Country Link
CN (1) CN116595026A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117708304A (en) * 2024-02-01 2024-03-15 浙江大华技术股份有限公司 Database question-answering method, equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117708304A (en) * 2024-02-01 2024-03-15 浙江大华技术股份有限公司 Database question-answering method, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN111125309A (en) Natural language processing method and device, computing equipment and storage medium
CN107451153A (en) The method and apparatus of export structure query statement
CN109947952B (en) Retrieval method, device, equipment and storage medium based on English knowledge graph
CN112328800A (en) System and method for automatically generating programming specification question answers
CN113127624A (en) Question-answer model training method and device
CN114090776A (en) Document analysis method, system and device
CN113282729A (en) Question-answering method and device based on knowledge graph
CN116595026A (en) Information inquiry method
Bazaga et al. Translating synthetic natural language to database queries with a polyglot deep learning framework
CN114911893A (en) Method and system for automatically constructing knowledge base based on knowledge graph
CN114647719A (en) Question-answering method and device based on knowledge graph
CN116501858B (en) Text processing and data query method
CN113159187A (en) Classification model training method and device, and target text determining method and device
CN116049376B (en) Method, device and system for retrieving and replying information and creating knowledge
CN117077792A (en) Knowledge graph-based method and device for generating prompt data
CN116662495A (en) Question-answering processing method, and method and device for training question-answering processing model
CN115757723A (en) Text processing method and device
CN115757720A (en) Project information searching method, device, equipment and medium based on knowledge graph
CN115934904A (en) Text processing method and device
CN114942981A (en) Question-answer query method and device, electronic equipment and computer readable storage medium
CN114417863A (en) Word weight generation model training method and device and word weight generation method and device
CN115809318A (en) Question answering model training method and device and question answering method and device
CN113468311A (en) Knowledge graph-based complex question and answer method, device and storage medium
CN113537263A (en) Training method and device of two-classification model and entity linking method and device
Wang et al. Question answering system of discipline inspection laws and regulations based on knowledge graph

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination