Natural language query sample generation method and device, equipment, medium and product

By deriving processing and large-language model conversion of the basic query template of the OpenStreetMap database, multilingual natural language query samples are generated, which solves the problem of insufficient support for multilinguals, and improves multilingual query capabilities and database usage flexibility. .

CN119226437APending Publication Date: 2024-12-31WEBANK (CHINA)
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411285837.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-13
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

The existing transformation model has limited support for multilinguals, which is difficult to meet the needs of people in different languages, limiting the use of OpenStreetMap database.

Method used

By deriving the preset basic query template, multiple query statements are generated, and large language models are used to convert them into multiple natural language texts, and natural language query samples are generated for training the transformation model, making it support multilingual queries.

Benefits of technology

It realizes automatic generation of natural language query samples for different languages, enriches the language types of the training set, reduces labor costs, and makes the conversion model have multilingual query capabilities, breaks language limitations, and improves the flexibility of using OpenStreetMap database.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119226437A_ABST
    Figure CN119226437A_ABST
Patent Text Reader

Abstract

The invention discloses a natural language query sample generation method and device, equipment, a medium and a product, and relates to the technical field of data query. A query statement is derived according to a preset basic query template used for querying geographic information from a preset geographic database; converting the derived query statement into a first natural query text in a preset language by using a preset large language model, and translating the first natural query text into a second natural query language query text in a target language; the obtained second natural query language query text can be combined with the derived query statement to form a natural language query sample, and the natural language query sample is used for training a conversion model, so that the trained conversion model can convert natural language query texts of different languages into query statements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data query technology, and in particular to a method, device, equipment, medium and product for generating a natural language query sample. Background Art

[0002] OpenStreetMap (OSM) is a free and open map database contributed and maintained by volunteers. It allows users to edit map data, including roads, buildings, water bodies, geographic markers, etc., which can be used for various purposes such as navigation, map making, geographic information system analysis, etc. OSM Query is a query operation performed on the OSM database, which allows users to retrieve map data according to specific conditions. A common query language is OverpassQL. The use of OverpassQL has a certain threshold and is usually used in conjunction with a conversion model. However, the current conversion model has limited capabilities and is difficult to meet the needs of people speaking different languages, so it limits the use of the OSM database.

[0003] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0004] The main purpose of this application is to provide a natural language query sample generation method, device, equipment, medium and product, aiming to solve the technical problem that the current conversion model has limited capabilities and is difficult to meet the needs of people of different languages, thus restricting the use of the OSM database.

[0005] To achieve the above objectives, the present application proposes a method for generating a natural language query sample, the method comprising:

[0006] The query statement is obtained by performing a derivation process on the preset basic query template, wherein the derivation process includes at least one derivation action, and the types of the derivation action include changing the condition content of the basic query condition in the preset basic query template, adding an additional query condition to the preset basic query condition, and adding a new basic query condition to the basic query template;

[0007] Converting the query statement into a first natural language query text in a preset language by using a preset large language model;

[0008] The first natural language query text is translated into a second natural language query text in a target language, and the query statement is used as a label of the second natural language query text to generate a natural language query sample, wherein the natural language query sample is used to train a conversion model so that the trained conversion model can perform multi-language natural language query text conversion.

[0009] In a feasible implementation manner, the step of converting the query statement into a first natural language query text in a preset language by using a preset large language model includes:

[0010] The preset conversion example and the query statement are input into a preset large language model to obtain a first natural language query text in the preset language, wherein the query statement corresponds to the content before conversion in the preset conversion example, and the first natural language query text corresponds to the content after conversion in the preset conversion example.

[0011] In a feasible implementation manner, the step of translating the first natural language query text into a second natural language query text in a target language, and using the query statement as a label of the second natural language query text to generate a natural language query sample includes:

[0012] In the case where there are multiple types of target languages, translating the first natural language query text into second natural language query texts in respective target languages;

[0013] The query statements are used as labels of the second natural language query texts to generate natural language query samples in the target languages.

[0014] In a feasible implementation manner, after the step of obtaining a query statement by deriving a preset basic query template, the method further includes:

[0015] Perform a query operation on a preset map database based on the query statement to obtain a query feedback result;

[0016] If there is an abnormality in the query feedback result, the query statement is discarded.

[0017] In a feasible implementation manner, the query statement is obtained through derivation processing, and after the step of discarding the query statement, the method further includes:

[0018] Determine the derivative actions included in the derivative processing corresponding to the query statement to obtain a derivative action set;

[0019] Determine a target derivative operation in the derivative action set that causes the query feedback result to be abnormal, wherein the target derivative operation includes an abnormal derivative action or an abnormal derivative action combination obtained from multiple abnormal derivative actions;

[0020] The target derivation operation is disabled in the subsequent process of deriving the query statement.

[0021] In a feasible implementation manner, the step of determining the target derivative operation in the derivative action set that causes the query feedback result to be abnormal includes:

[0022] Eliminating a candidate derived action from the derived action set to obtain a new derived action set, wherein the candidate derived action is a derived action that has not been eliminated from the derived action set;

[0023] Generate a new query statement based on the new derived action set, perform a query operation on a preset map database based on the new query statement, and obtain a verification query feedback result;

[0024] In the case where the verification query feedback result is abnormal, based on the new derived action set, performing the step of removing a candidate derived action from the derived action set to obtain a new derived action set;

[0025] In the case that there is no abnormality in the verification query feedback result, the candidate derivative action is added to the preset derivative action blacklist, and based on the new derivative action set to which the candidate derivative action is added, the step of removing a candidate derivative action from the derivative action set to obtain a new derivative action set is performed;

[0026] After traversing the candidate derivative actions in the derivative action set, if the number of candidate derivative actions in the blacklist is one, the candidate derivative actions in the blacklist are used as the abnormal derivative actions; if the number of candidate derivative actions in the blacklist is greater than one, the combination of the candidate derivative actions in the blacklist is used as the abnormal derivative action combination;

[0027] The target derivative operation is constructed based on the abnormal derivative action or the combination of the abnormal derivative actions.

[0028] In addition, to achieve the above-mentioned purpose, the present application also proposes a natural language query sample generation device, the natural language query sample generation device comprising:

[0029] A derivation module, configured to obtain a query statement by performing derivation processing on a preset basic query template, wherein the derivation processing includes at least one derivation action, and the types of derivation actions include changing the condition content of the basic query condition in the preset basic query template, adding an additional query condition to the preset basic query condition, and adding a new basic query condition to the basic query template;

[0030] A conversion module, configured to convert the query statement into a first natural language query text in a preset language by using a preset large language model;

[0031] A generation module is used to translate the first natural language query text into a second natural language query text in a target language, and use the query statement as a label of the second natural language query text to generate a natural language query sample, wherein the natural language query sample is used to train a conversion model so that the trained conversion model can perform multi-language natural language query text conversion.

[0032] In addition, to achieve the above-mentioned purpose, the present application also proposes an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the natural language query sample generation method as described above.

[0033] In addition, to achieve the above objectives, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the natural language query sample generation method described above are implemented.

[0034] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the natural language query sample generation method described above are implemented.

[0035] One or more technical solutions proposed in this application have at least the following technical effects:

[0036] In the embodiment of the present application, the preset basic query template is subjected to derivative processing to obtain a query statement, wherein the types of derivative actions in the derivative processing may include changing the query conditions in the template and adding query conditions, thereby enriching the types of query statements. The derived query statement is then converted into a first natural query text in a preset language using a preset large language model, and the first natural query text is then translated into a second natural query language query text in a target language, and the obtained second natural query language query text can be combined with the derived query statement to form a natural language query sample, and the natural language query sample will be used to construct a training set for the conversion model. It can be understood that different query statements are automatically generated on the basic query template by derivation, and then the query statement is converted into a natural language query text in a specific language (preset language) by the large language model. Since the Text-to-OverpassQL task corresponding to the current relevant conversion model is a conversion for a specific language, there are samples for the specific language in the relevant field. Therefore, compared with other languages, the preset large language model has a stronger ability to convert the query statement into this specific language, so it is first converted into a natural language query text in the preset language to ensure the accuracy of the conversion result. Then, the natural language query statement in a specific language is translated into the natural language query text in the target language, thereby achieving the automatic generation of natural language query samples in different languages ​​while ensuring the accuracy of the samples, enriching the language types of samples in the training set and reducing the labor cost of sample generation. Moreover, the natural language query samples obtained will be used for the training of the conversion model, which can enable the conversion model to complete the Text-to-OverpassQL task corresponding to the above target language. Since the target language can be set according to actual needs, natural language query samples in different languages ​​can be generated in this application for the training of the conversion model, so that the conversion model has the function of converting natural language query texts in different languages ​​into query statements to meet the needs of people of different languages, thereby breaking the language limitations of the conversion model and avoiding restrictions on the use of OSM. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0038] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0039] Figure 1This is a flowchart of the first embodiment of the method for generating a natural language query sample of the present application;

[0040] Figure 2 This is the overall flow chart of the natural language query sample generation method of this application;

[0041] Figure 3 A schematic diagram of a multilingual scenario in the natural language query sample generation method of this application;

[0042] Figure 4 This is a flow chart of the second embodiment of the method for generating natural language query samples in the present application;

[0043] Figure 5 This is a schematic diagram of the structure of a natural language query sample device in the natural language query sample method of the present application;

[0044] Figure 6 Schematic diagram of the device structure of the hardware operating environment involved in the natural language query sample generation method in the embodiment of the present application.

[0045] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0046] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0047] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0048] The main solution of the embodiment of the present application is: deriving a query statement based on a preset basic query template, wherein the preset basic query template is a template for querying geographic information from a preset geographic database; converting the query statement into a first natural language query text in a preset language through a preset large language model; translating the first natural language query text into a second natural language query text in a target language, and using the query statement as a label of the second natural language query text to generate a natural language query sample, wherein the natural language query sample is used to train the conversion model so that the trained conversion model can perform multi-language natural language query text conversion.

[0049] OpenStreetMap (OSM) is a free and open map database contributed and maintained by volunteers. It allows users to edit map data, including roads, buildings, water bodies, geographic markers, etc., which can be used for various purposes, such as navigation, map making, geographic information system analysis, etc. OSM Query is a query operation for the OSM database, which allows users to retrieve map data according to specific conditions. A common query language is OverpassQL. In addition, since the OverpassQL language has a certain threshold for use, a conversion model for the Text-to-OverpassQL (natural language to query language) task has emerged in the relevant field, which can convert natural language queries into Overpass QL. This conversion enables users to describe the geographic information they want to query in everyday language without having to deeply understand the syntax and structure of Overpass QL. However, it should be noted that the conversion model in the current conversion technology only supports the conversion of English text, that is, the training set of the conversion model only includes English samples, which makes the conversion model single-function and only has the ability to convert English text into query statements. Correspondingly, it also limits the use of the OSM database. Currently, most samples in the training set of conversion models rely on manual generation, which is time-consuming and laborious.

[0050] The present application provides a solution to derive a preset basic query template to obtain a query statement, wherein the types of derived actions in the derivation process may include changing the query conditions in the template and adding query conditions, thereby enriching the types of query statements. The derived query statement is then converted into a first natural query text in a preset language using a preset large language model, and the first natural query text is then translated into a second natural query language query text in a target language, and the obtained second natural query language query text can be combined with the derived query statement to form a natural language query sample, and the natural language query sample will be used to construct a training set for the conversion model. It can be understood that different query statements are automatically generated on the basic query template by derivation, and then the query statement is converted into a natural language query text in a specific language (preset language) by the large language model. Since the Text-to-OverpassQL task corresponding to the current relevant conversion model is a conversion for a specific language, there are samples for the specific language in the relevant field. Therefore, compared with other languages, the preset large language model has a stronger ability to convert the query statement into this specific language, so it is first converted into a natural language query text in the preset language to ensure the accuracy of the conversion result. Then, the natural language query statement in a specific language is translated into the natural language query text in the target language, thereby achieving the automatic generation of natural language query samples in different languages ​​while ensuring the accuracy of the samples, enriching the language types of samples in the training set and reducing the labor cost of sample generation. Moreover, the natural language query samples obtained will be used for the training of the conversion model, which can enable the conversion model to complete the Text-to-OverpassQL task corresponding to the above target language. Since the target language can be set according to actual needs, natural language query samples in different languages ​​can be generated in this application for the training of the conversion model, so that the conversion model has the function of converting natural language query texts in different languages ​​into query statements to meet the needs of people of different languages, thereby breaking the language limitations of the conversion model and avoiding restrictions on the use of OSM.

[0051] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a cloud platform, a computer, a mobile phone, etc., or an electronic device that can realize the above functions.

[0052] In addition, in order to clearly explain the present application, the relevant technical solutions are now explained.

[0053] In the process of performing OSM Query operations, OverpassQL specific query statements are usually required. The main content included in OverpassQL is the query condition. For example, the current query task is to find the location of all bicycle rental stations in city A. The label used to mark bicycle rental stations in OSM is usually `amenity=b icyc l e_rental`. Correspondingly, the query statement written based on the above content is as follows:

[0054]

[0055] Execute the above query in the corresponding OSM Query tool, and it will return all nodes marked as bicycle rental stations in city A. The query results will be returned in JSON format, including the coordinates, labels and other relevant information of each bicycle rental station. These data can be further imported into GIS (Geographic Information System) software for further analysis and visualization.

[0056] Based on this, the embodiment of the present application provides a method for generating a natural language query sample, referring to Figure 1 , Figure 1 This is a flowchart of the first embodiment of the method for generating natural language query samples of the present application.

[0057] In this embodiment, the natural language query sample generation method includes steps S10 to S30:

[0058] Step S10, obtaining a query statement by deriving a preset basic query template, wherein the deriving process includes at least one deriving action, and the types of deriving actions include changing the condition content of the basic query condition in the preset basic query template, adding an additional query condition to the preset basic query condition, and adding a new basic query condition to the basic query template;

[0059] It should be noted that, in this embodiment, the implementation subject of the above-mentioned natural language query sample generation method is usually a cloud platform or a cloud server. For example, a corresponding conversion model can be deployed in the cloud server, and the conversion model is used to convert natural language text into query statements. The cloud server can automatically generate natural language query samples for training the conversion model by implementing the above-mentioned natural language query sample generation method. In addition, the above-mentioned preset basic query template is a template for querying geographic information from a preset geographic database, wherein the preset geographic database is usually an OSM database, and the preset basic query template for querying data in the OSM database can be set in advance according to needs. Under normal circumstances, the preset basic query template can cover various geographic spatial data retrieval forms as much as possible. For example, in actual applications, the preset basic query template can be to query all nodes in a specific area, query elements of a specific type, query elements with specific tags, and query and return partial information of elements, etc., which will not be repeated here.

[0060] Exemplarily, a query statement is derived based on a preset basic query template. Derivation mainly includes changing, reducing and adding (usually tending to add, to enrich the types of query statements as much as possible) query conditions in the preset basic query template. The derivation process can be to use the text in the preset geographic feature text set to randomly replace the keywords in the preset basic query template to obtain a query statement, randomly select conditions from the preset query condition library and add them to the preset basic query template to obtain a query statement, or randomly add different additional query conditions while randomly replacing keywords with text. In addition to generating query statements by randomly selecting keywords and query statements, the preset basic query template can also be derived through a large language model to obtain a query statement, such as inputting the preset basic query template and the derived example into the large language model, so that the large language model completes the derivation with reference to the example.

[0061] For example, a preset basic query template is to query all elements in a region, and the specific content is as follows:

[0062]

[0063] During the derivation process, the query condition of the preset basic query template is changed, that is, the query of all elements in an area is changed to the query of all highway entrances in an area, and the following query statement is obtained:

[0064]

[0065] That is, change "node(area.searchArea)" in the preset basic template to "node["highway"="motorway_junction"](area.searchArea)".

[0066] It is understandable that different query statements can be automatically generated by deriving from the preset basic query template, thereby enriching the types of natural language query samples.

[0067] Exemplarily, in this embodiment, a query statement can be obtained by performing derivative processing on the basis of a basic query template by presetting a large language model. The large language model can be LLM (Large Language Model 1). It is worth noting that the above-mentioned derivative processing includes at least one derivative action, and correspondingly, the type of derivative action can include changing the condition content in the basic query condition, adding additional query conditions to the basic query condition, and adding new basic query conditions to the basic query template.

[0068] Similarly, taking the preset basic query template task of querying all elements in a region as an example, when the type of the derived action position is to change the condition content of the basic query condition, the query task of the query statement obtained can be to query all highway entrances in a region; and when the type of the derived action position is to add additional query conditions to the basic query condition, the query task of the query statement obtained can be to query the highway entrances that are open in a region. Specifically, the derived results can refer to the above examples, which will not be repeated here.

[0069] In addition, in the process of derivation through the preset large language model, the derived examples (the types of optional derivative actions can also be given in the examples) and the preset basic query template can be input into the preset large language model, and then the preset large language model outputs the query statement, that is, through the single sample learning algorithm (OSL, One-shot learning) or the few sample learning algorithm (FSL, Few-shot learning), let the preset large language model output the query statement.

[0070] Step S20, converting the query statement into a first natural language query text in a preset language by using a preset large language model;

[0071] Exemplarily, the natural language conversion of the query statement can also be completed by a large language model (LLM, Large Language Model 1, that is, the above-mentioned preset large language model). For example, in actual applications, the cloud server implementing the natural language query sample generation method of the present application can call the interface of the preset large language model, input the preset prompt word or conversion example together with the query statement into the preset large language model, and convert the query statement into a preset first natural language query text of the preset language through the preset large language model. Among them, the prompt word or conversion example is used to inform the preset large language model of the current task, such as the prompt word can be "please convert the query statement into natural language", and the conversion example can be an example of converting the query statement into natural language for reference by the preset large language model. In addition, the above-mentioned preset language is usually English. It can be understood that the current Text-to-OverpassQL task is mainly for the conversion of English text. There are many training samples of English text in the relevant field. Therefore, for the query statement of the OSM database, the ability of the preset large language model to convert it into English natural language text is stronger than that of other languages. Therefore, the query statement may be converted into a first natural language query text in English first to ensure the accuracy of the first natural language query text.

[0072] Step S30, translating the first natural language query text into a second natural language query text in a target language, and using the query statement as a label of the second natural language query text to generate a natural language query sample, wherein the natural language query sample is used to train a conversion model so that the trained conversion model can perform multi-language natural language query text conversion.

[0073] Exemplarily, the first natural language query text is then translated into a second natural language query text in the target language. Among them, the target language can be set by the technicians in one or more languages ​​according to actual needs, such as Chinese, Japanese, Korean and Russian, etc., which will not be repeated here, and for the translation process, the cloud server can call the transfer tool corresponding to the target language. After obtaining the second natural query language, the second natural query language is associated with the query statement derived above, and the query statement is used as a label of the second natural query language to generate a natural language query sample. Moreover, the generated natural language query sample can construct a training set for the conversion model. That is, the generated natural language query sample will participate in the training of the conversion model, so that the conversion model has the function of converting natural language query texts in different languages ​​into query statements. In addition, it should be noted that the conversion model can be different variants in the T5 model family (a series of pre-trained language models based on the Transformer architecture), such as CodeT5 trained for code generation and ByT5 using byte-level tokenization.

[0074] In this implementation, the preset basic query template will be derived to obtain a query statement, wherein the types of derived actions in the derivation process may include changing the query conditions in the template and adding query conditions, thereby enriching the types of query statements. The derived query statement is then converted into a first natural query text in a preset language using a preset large language model, and then the first natural query text is translated into a second natural query language query text in a target language, and the obtained second natural query language query text can be combined with the derived query statement to form a natural language query sample, and the natural language query sample will be used to construct a training set for the conversion model. It can be understood that different query statements are automatically generated on the basic query template by derivation, and then the query statement is converted into a natural language query text in a specific language (preset language) by the large language model. Since the Text-to-OverpassQL task corresponding to the current relevant conversion model is a conversion for a specific language, there are samples for the specific language in the relevant field. Therefore, compared with other languages, the preset large language model has a stronger ability to convert the query statement into this specific language, so it is first converted into a natural language query text in the preset language to ensure the accuracy of the conversion result. Then, the natural language query statement in a specific language is translated into the natural language query text in the target language, thereby achieving the automatic generation of natural language query samples in different languages ​​while ensuring the accuracy of the samples, enriching the language types of samples in the training set and reducing the labor cost of sample generation. Moreover, the natural language query samples obtained will be used for the training of the conversion model, which can enable the conversion model to complete the Text-to-OverpassQL task corresponding to the above target language. Since the target language can be set according to actual needs, natural language query samples in different languages ​​can be generated in this application for the training of the conversion model, so that the conversion model has the function of converting natural language query texts in different languages ​​into query statements to meet the needs of people of different languages, thereby breaking the language limitations of the conversion model and avoiding restrictions on the use of OSM.

[0075] In a feasible implementation manner, the step of converting the query statement into a first natural language query text in a preset language by using a preset large language model includes step S21:

[0076] Step S21, inputting the preset conversion example and the query statement into a preset large language model to obtain a first natural language query text in the preset language, wherein the query statement corresponds to the content before conversion in the preset conversion example, and the first natural language query text corresponds to the content after conversion in the preset conversion example.

[0077] Exemplarily, the preset conversion example and the query statement can be input into the preset large language model to obtain the first natural language query text of the preset language. In practical applications, the preset conversion example may include two parts, namely, a task description and a conversion part, wherein the conversion part is an actual example of conversion including a part before conversion and a part after conversion, and the task description is used to characterize the task that the preset large language model currently needs to perform, such as converting the query statement into the first natural language query text of the preset language according to the part before conversion and the part after conversion given in the preset conversion example, that is, the query statement corresponds to the content before conversion in the preset conversion example, and the first natural language query text corresponds to the content after conversion in the preset conversion example.

[0078] For example, a query statement contains:

[0079] [out:json][timeout:25];

[0080] area(3600000000)->.searchArea;

[0081] node["amenity"="restaurant"](area.searchArea);

[0082] out body;

[0083] The content of the above query statement and the preset conversion example are input into the preset large language model, and the output result of the preset large language model is: for the specified area, find all nodes marked as "amenity" and with a value of "restaurant". That is, find all the restaurant locations in the area and output the detailed information of these nodes.

[0084] In a feasible implementation manner, the step of translating the first natural language query text into a second natural language query text in a target language, and using the query statement as a label of the second natural language query text to generate a natural language query sample includes steps S31 to S32:

[0085] Step S31, when there are multiple types of target languages, translating the first natural language query text into second natural language query texts in respective target languages;

[0086] Step S32: Using the query statements as labels of the second natural language query texts to generate natural language query samples in the target languages.

[0087] It should be noted that, in order to further enrich the types of samples, in this embodiment, each time the first natural language query sample is translated, the first natural language query sample can be translated into a different target language, thereby enriching the language types of the samples.

[0088] Exemplarily, in the case where there are multiple types of target languages, the first natural language query text is translated into the second natural language query text of each target language. For example, assuming that the preset language is English, and there are Chinese target languages, Russian target languages, and Japanese target languages, the first natural language query text in English is translated into the second natural language query text A in Chinese, the second natural language query text B in Russian, and the second natural language query text C in Japanese, that is, the second natural language query text of each target language. Then, the query statement is used as a label of each second natural language query text, thereby obtaining a natural language query sample of each target language. For example, the second natural language query text A is associated with the query statement to form a natural language query sample in Chinese, and in the natural language query sample in Chinese, the query statement is the label of the second natural language query text A. For other languages, the example of the Chinese language can be referred to, and it will not be repeated here.

[0089] It can be understood that in this embodiment, natural language query samples in different target languages ​​can be generated during the translation process, and the language types of natural language query samples can be enriched. Accordingly, after the conversion model is trained using a training set including natural language query samples in different languages, the conversion model can have the function of converting natural language query texts in different languages ​​into query statements.

[0090] Reference Figure 2 , which is an overall flow chart of the natural language query sample generation method of the present application, including extracting OverpassQL template, modifying the template to generate query, generating English NLQ (Natural Language Query), translating into multiple languages ​​and quality inspection.

[0091] 1. Extract OverpassQL templates: OverpassQL query templates (i.e., preset basic query templates) can be selected and extracted from English datasets. These templates are the basis for query construction and can cover various geospatial data retrieval requirements.

[0092] 2. Modify templates to generate queries: Using the Large Language Model (LLM), these templates are modified and extended to generate a variety of OverpassQL query statements. The advanced language understanding capabilities of LLM ensure the semantic accuracy and structural rationality of the query statements.

[0093] 3. Generate English NLQ: Use LLM to generate a natural language query text in English (preset language) corresponding to the query statement (i.e., the first natural language query text mentioned above). In this step, some annotated sample data can be provided to guide LLM to generate an expected natural language expression.

[0094] 4. Multi-language translation: The generated English NLQ can be translated into multiple target languages ​​(i.e. the second natural language query text mentioned above). This step can be completed by using translation tools, and manual correction can also be performed when necessary.

[0095] 5. Quality testing: Perform quality testing on the generated multilingual data. This step can use automated testing tools and manual review to ensure the high quality standards of the data set.

[0096] The second natural language query text obtained through the above process can form a natural language query sample in the target language with the query statement, and a rich, accurate, and highly diverse multilingual Text-to-OverpassQL dataset can be created through the natural language query sample. And the obtained dataset (i.e., training set) is used to train the conversion model. For any natural language query sample in the multilingual training set, the second natural language query text in the natural language query sample is input into the conversion model to obtain a conversion result; based on the difference between the conversion result and the query statement in the natural language query sample, the model parameters of the query text conversion model are updated. The training can be terminated after the preset training conditions are met (such as the conversion model reaches a preset number of training times, the conversion model reaches convergence, etc.).

[0097] In addition, refer to Figure 3 This is a multilingual scenario schematic diagram of the natural language query sample generation method of the present application. As shown in the figure, for a multilingual Text-to-OverpassQL task, language texts in different languages ​​(as shown in the figure, the language text can be Chinese "Bicycle path around the summit of Mount Tromso or the top of the hill with in 500 meters", English "Bicycle path around the summit of Mount Tromso or the top of the hill with in 500 meters" and Japanese "Toromso mountain top is a 500 meter bicycle path around the summit of the hill" etc.) can be input into a multilingual conversion model (i.e., a conversion model trained using a training set constructed using natural language query samples generated by an embodiment of the present application). The multilingual conversion model then obtains a query statement, and the query statement can be used to perform a query operation in the OSM database to obtain a query result.

[0098] Reference Figure 4 , is a flow chart of the second embodiment of the present application proposed based on the first embodiment of the present application. In this embodiment, the parts that are the same or similar to the above embodiments can refer to the above contents and are not repeated here.

[0099] After the step of obtaining a query statement by deriving the preset basic query template, the method further includes steps S101 and S102:

[0100] Step S101, performing a query operation on a preset map database based on the query statement to obtain a query feedback result;

[0101] Step S102: if the query feedback result is abnormal, the query statement is discarded.

[0102] It should be noted that, in order to ensure the quality of the natural language query samples finally generated, a verification mechanism will be added in this embodiment.

[0103] Exemplarily, for the query statement obtained by derivation, the query statement can be input into the preset map database (i.e., OSM database) for query to obtain the query result. If the query statement logic is correct and conforms to the query syntax, the query feedback result obtained under normal circumstances is valid (i.e., a normal geographic information will be returned), and such query statements will continue to be used for subsequent natural language query sample generation. On the contrary, if there is an error in the query statement logic or it does not conform to the query syntax, the query feedback result obtained will have anomalies such as query failure or query error. Accordingly, in the case of anomalies in the query feedback result, the query statement can be discarded, that is, the query statement will not be used to generate natural language query samples.

[0104] Reference Figure 3 , is a flow chart of the third embodiment of the present application based on the first embodiment and the second embodiment of the present application. In this embodiment, the parts that are the same or similar to the above embodiments can refer to the above contents and will not be repeated here.

[0105] The query statement is obtained through derivation processing. After the step of discarding the query statement, the method further includes steps S110 to S130:

[0106] Step S110, determining the derivative actions included in the derivative processing corresponding to the query statement, and obtaining a derivative action set;

[0107] Step S120, determining a target derivative operation in the derivative action set that causes the query feedback result to be abnormal, wherein the target derivative operation includes an abnormal derivative action or an abnormal derivative action combination obtained from multiple abnormal derivative actions;

[0108] Step S130: disabling the target derivation operation in the subsequent process of deriving the query statement.

[0109] It should be noted that, in order to improve the quality of derived query statements, in this embodiment, abnormal derivation actions will be determined from the discarded query statements and used for optimizing the derivation process.

[0110] Exemplarily, for a discarded query statement, the derivative actions included in the derivative processing performed to obtain the query statement can be determined. For example, the query statement can be compared with the preset basic query template used when deriving the query statement to obtain the query statement, and the difference between the two can be obtained. Accordingly, the derivative actions included in the derivative processing can be inferred from the difference. For example, the query task of a preset basic query template is all elements in the query area A, and the query task of the query statement derived from the template is all the highway entrances developed to the outside in the query area B. By comparing the differences before and after derivation, the derivative actions that can be obtained include changing the query condition area A to area B and changing all elements of the query condition to the highway entrance developed to the outside, or the derivative actions that are obtained include changing the query condition area A to area B, changing all elements of the query condition to the highway entrance and adding the subsidiary query condition developed to the outside. The form of determining the derivative action and the granularity of the derivative action can be set by the technician, and will not be repeated here. Accordingly, the derivative actions determined to be obtained can constitute a derivative action set. It can be understood that the number of derivative actions in the derivative action set includes at least one, and for some complex derivative processes, multiple derivative actions can be included. Then, the target derivative operation that causes the abnormal query feedback result is determined from the derivative action set, and the target derivative operation can be an abnormal derivative action or an abnormal derivative action combination obtained by combining multiple abnormal derivative actions. The determination process can be to use different new query statements generated by each derivative action in the derivative action set to perform query operations, and then gradually lock the target derivative operation that causes the abnormality according to the query feedback result. Accordingly, after obtaining the target derivative operation, the target derivative operation is disabled in the subsequent process of deriving the query statement, thereby ensuring the quality of the derived query statement.

[0111] In a feasible implementation manner, the step of determining the target derivative operation in the derivative action set that causes the query feedback result to be abnormal includes steps S121 to S126:

[0112] Step S121, removing a candidate derived action from the derived action set to obtain a new derived action set, wherein the candidate derived action is a derived action that has not been removed from the derived action set;

[0113] Step S122, generating a new query statement based on the new derived action set, performing a query operation on a preset map database based on the new query statement, and obtaining a verification query feedback result;

[0114] Step S123, when the verification query feedback result is abnormal, based on the new derived action set, performing the step of removing a candidate derived action from the derived action set to obtain a new derived action set;

[0115] Step S124, when there is no abnormality in the verification query feedback result, the candidate derivative action is added to the preset derivative action blacklist, and based on the new derivative action set to which the candidate derivative action is added, the step of removing a candidate derivative action from the derivative action set to obtain a new derivative action set is performed;

[0116] Step S125, after traversing the candidate derivative actions in the derivative action set, if the number of the candidate derivative actions in the blacklist is one, the candidate derivative actions in the blacklist are used as the abnormal derivative actions; if the number of the candidate derivative actions in the blacklist is greater than one, the combination of the candidate derivative actions in the blacklist is used as the abnormal derivative action combination;

[0117] Step S126: construct the target derivative operation based on the abnormal derivative action or the abnormal derivative action combination.

[0118] Exemplarily, a candidate derivative action is removed from the derived action set to obtain a new derived action set, and the candidate derivative action refers to the derivative action that has not been removed from the derived action set (in the subsequent steps, the removed derivative action may also be re-added to the derivative sequence). A new query statement is generated through the new derived action set, that is, the derivative action in the new derived action set is performed on the basis of the preset basic query template to obtain a new query statement. Then, based on the new query statement, a query operation is performed in the preset map database to obtain a verification query feedback result. If the verification query feedback result is abnormal at this time, the candidate derivative action removed at this time is most likely not a derivative action that causes the abnormality, and accordingly, it can be regarded as a normal derivative action. Then, based on the new derived action set, the step of removing a candidate derivative action from the derived action set to obtain a new derived action set is performed. If the verification query feedback result is that there is no abnormality at this time, it means that the candidate derivative action removed at this time is most likely a derivative action that causes the abnormality, and accordingly, the removed candidate derivative action can be added to the preset derivative action blacklist. It should also be noted that the occurrence of an exception may also be caused by the combination of the eliminated candidate derivative action and other derivative actions in the derivative action set. Therefore, the eliminated candidate derivative action is added again to the new derivative action set obtained, and based on the new derivative action set to which the eliminated candidate derivative action is added, the step of eliminating a candidate derivative action from the derivative action set to obtain a new derivative action set is performed so that the derivative action that causes the exception in combination can be found.

[0119] After traversing all candidate derivative actions in the derivative action set, if the number of candidate derivative actions in the list is one, the candidate derivative actions in the blacklist are taken as abnormal derivative actions, and if the number of candidate derivative actions in the blacklist is greater than one, the action combination obtained from the candidate derivative actions in the blacklist is taken as the abnormal derivative action combination. Accordingly, the abnormal derivative action or abnormal derivative action combination is determined to be the target derivative operation.

[0120] It can be understood that in this embodiment, different new query statements are formed by traversing the candidate derivative actions in the derivative action set, and the new query statements are used to query to verify whether each candidate derivative action is abnormal. Abnormal candidate derivative actions or abnormal candidate derivative action combinations may be disabled in the subsequent derivation process, thereby ensuring the quality of the derived query statements.

[0121] The present application provides a natural language query sample generation device, referring to Figure 5 , the natural language query sample generating device comprises:

[0122] A derivation module 10, configured to obtain a query statement by performing derivation processing on a preset basic query template, wherein the derivation processing includes at least one derivation action, and the types of derivation actions include changing the condition content of the basic query condition in the preset basic query template, adding an additional query condition to the preset basic query condition, and adding a new basic query condition to the basic query template;

[0123] A conversion module 20, configured to convert the query statement into a first natural language query text in a preset language by using a preset large language model;

[0124] The generation module 30 is used to translate the first natural language query text into a second natural language query text in a target language, and use the query statement as a label of the second natural language query text to generate a natural language query sample, wherein the natural language query sample is used to train the conversion model so that the trained conversion model can perform multi-language natural language query text conversion.

[0125] Optionally, the conversion module 20 is further used for:

[0126] The preset conversion example and the query statement are input into a preset large language model to obtain a first natural language query text in the preset language, wherein the query statement corresponds to the content before conversion in the preset conversion example, and the first natural language query text corresponds to the content after conversion in the preset conversion example.

[0127] Optionally, the generating module 30 is further used for:

[0128] In the case where there are multiple types of target languages, translating the first natural language query text into second natural language query texts in respective target languages;

[0129] The query statements are used as labels of the second natural language query texts to generate natural language query samples in the target languages.

[0130] Optionally, the natural language query sample generating device further includes a detection module 40, and the detection module 40 is further used to:

[0131] Perform a query operation on a preset map database based on the query statement to obtain a query feedback result;

[0132] If there is an abnormality in the query feedback result, the query statement is discarded.

[0133] Optionally, the detection module 40 is further used for:

[0134] Determine the derivative actions included in the derivative processing corresponding to the query statement to obtain a derivative action set;

[0135] Determine a target derivative operation in the derivative action set that causes the query feedback result to be abnormal, wherein the target derivative operation includes an abnormal derivative action or an abnormal derivative action combination obtained from multiple abnormal derivative actions;

[0136] The target derivation operation is disabled in the subsequent process of deriving the query statement.

[0137] Optionally, the detection module 40 is further used for:

[0138] Eliminating a candidate derived action from the derived action set to obtain a new derived action set, wherein the candidate derived action is a derived action that has not been eliminated from the derived action set;

[0139] Generate a new query statement based on the new derived action set, perform a query operation on a preset map database based on the new query statement, and obtain a verification query feedback result;

[0140] In the case where the verification query feedback result is abnormal, based on the new derived action set, performing the step of removing a candidate derived action from the derived action set to obtain a new derived action set;

[0141] In the case that there is no abnormality in the verification query feedback result, the candidate derivative action is added to the preset derivative action blacklist, and based on the new derivative action set to which the candidate derivative action is added, the step of removing a candidate derivative action from the derivative action set to obtain a new derivative action set is performed;

[0142] After traversing the candidate derivative actions in the derivative action set, if the number of candidate derivative actions in the blacklist is one, the candidate derivative actions in the blacklist are used as the abnormal derivative actions; if the number of candidate derivative actions in the blacklist is greater than one, the combination of the candidate derivative actions in the blacklist is used as the abnormal derivative action combination;

[0143] The target derivative operation is constructed based on the abnormal derivative action or the combination of the abnormal derivative actions.

[0144] The natural language query sample generation device provided by the present application adopts the natural language query sample generation method in the above embodiment, aiming to solve the technical problem that the current conversion model has limited capabilities and is difficult to meet the needs of people of different languages, thus limiting the use of the OSM database. Compared with the prior art, the beneficial effects of the natural language query sample generation device provided by the embodiment of the present application are the same as the beneficial effects of the natural language query sample generation method provided by the above embodiment 1, and other technical features in the natural language query sample generation device are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0145] The present application provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the natural language query sample generation method in the above-mentioned embodiment one.

[0146] Reference below Figure 6 , which shows a schematic diagram of the structure of an electronic device suitable for implementing an embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to mobile terminals such as cloud servers, mobile computers, etc. and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0147] like Figure 6As shown, the electronic device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read On ly Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the electronic device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems may be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an electronic device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have instead.

[0148] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0149] The electronic device provided by the present application adopts the natural language query sample generation method in the above embodiment, which can solve the technical problem that the current conversion model has limited capabilities and is difficult to meet the needs of people of different languages, thus limiting the use of the OSM database. Compared with the prior art, the beneficial effects of the electronic device provided by the present application are the same as the beneficial effects of the natural language query sample generation method provided by the above embodiment, and the other technical features in the electronic device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0150] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0151] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0152] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the natural language query sample generation method in the above-mentioned embodiment.

[0153] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read On ly Memory), an erasable programmable read-only memory (EPROM: Erasable Programmab le Read On ly Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read On ly Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.

[0154] The computer-readable storage medium may be included in the electronic device, or may exist independently without being installed in the electronic device.

[0155] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: derives a query statement based on a preset basic query template, wherein the preset basic query template is a template for querying geographic information from a preset geographic database;

[0156] Converting the query statement into a first natural language query text in a preset language by using a preset large language model;

[0157] The first natural language query text is translated into a second natural language query text in a target language, and the query statement is used as a label of the second natural language query text to generate a natural language query sample, wherein the natural language query sample is used to train a conversion model so that the trained conversion model can perform multi-language natural language query text conversion.

[0158] The computer program code for performing the operation of the present application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).

[0159] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0160] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0161] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned natural language query sample generation method, and can solve the technical problem that the current conversion model has limited capabilities and is difficult to meet the needs of people of different languages, thus limiting the use of the OSM database. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the natural language query sample generation method provided by the above-mentioned embodiment, and will not be repeated here.

[0162] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned natural language query sample generation method when executed by a processor.

[0163] The computer program product provided by this application can solve the technical problem of natural language query sample generation. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the natural language query sample generation method provided by the above embodiment, which will not be repeated here.

[0164] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A method for generating natural language query samples, characterized in that: The natural language query sample generation method comprises: The query statement is obtained by performing a derivation process on the preset basic query template, wherein the derivation process includes at least one derivation action, and the types of the derivation action include changing the condition content of the basic query condition in the preset basic query template, adding an additional query condition to the preset basic query condition, and adding a new basic query condition to the basic query template; Converting the query statement into a first natural language query text in a preset language by using a preset large language model; The first natural language query text is translated into a second natural language query text in a target language, and the query statement is used as a label of the second natural language query text to generate a natural language query sample, wherein the natural language query sample is used to train a conversion model so that the trained conversion model can perform multi-language natural language query text conversion.

2. The method for generating a natural language query sample according to claim 1, wherein: The step of converting the query statement into a first natural language query text in a preset language by using a preset large language model comprises: The preset conversion example and the query statement are input into a preset large language model to obtain a first natural language query text in the preset language, wherein the query statement corresponds to the content before conversion in the preset conversion example, and the first natural language query text corresponds to the content after conversion in the preset conversion example.

3. The method for generating a natural language query sample according to claim 1, wherein: The step of translating the first natural language query text into a second natural language query text in a target language, and using the query statement as a label of the second natural language query text to generate a natural language query sample comprises: In the case where there are multiple types of target languages, translating the first natural language query text into second natural language query texts in respective target languages; The query statements are used as labels of the second natural language query texts to generate natural language query samples in the target languages.

4. The method for generating a natural language query sample according to claim 1, wherein: After the step of obtaining a query statement by deriving the preset basic query template, the method further includes: Perform a query operation on a preset map database based on the query statement to obtain a query feedback result; If there is an abnormality in the query feedback result, the query statement is discarded.

5. The method for generating a natural language query sample according to claim 4, wherein: The query statement is obtained through derivation processing. After the step of discarding the query statement, the method further includes: Determine the derivative actions included in the derivative processing corresponding to the query statement to obtain a derivative action set; Determine a target derivative operation in the derivative action set that causes the query feedback result to be abnormal, wherein the target derivative operation includes an abnormal derivative action or an abnormal derivative action combination obtained from multiple abnormal derivative actions; The target derivation operation is disabled in the subsequent process of deriving the query statement.

6. The method for generating a natural language query sample according to claim 5, wherein: The step of determining the target derivative operation in the derivative action set that causes the query feedback result to be abnormal includes: Eliminating a candidate derived action from the derived action set to obtain a new derived action set, wherein the candidate derived action is a derived action that has not been eliminated from the derived action set; Generate a new query statement based on the new derived action set, perform a query operation on a preset map database based on the new query statement, and obtain a verification query feedback result; In the case where the verification query feedback result is abnormal, based on the new derived action set, performing the step of removing a candidate derived action from the derived action set to obtain a new derived action set; In the case that there is no abnormality in the verification query feedback result, the candidate derivative action is added to the preset derivative action blacklist, and based on the new derivative action set to which the candidate derivative action is added, the step of removing a candidate derivative action from the derivative action set to obtain a new derivative action set is performed; After traversing the candidate derivative actions in the derivative action set, if the number of candidate derivative actions in the blacklist is one, the candidate derivative actions in the blacklist are used as the abnormal derivative actions; if the number of candidate derivative actions in the blacklist is greater than one, the combination of the candidate derivative actions in the blacklist is used as the abnormal derivative action combination; The target derivative operation is constructed based on the abnormal derivative action or the combination of the abnormal derivative actions.

7. A natural language query sample generation device, characterized in that: The natural language query sample generating device comprises: A derivation module, configured to obtain a query statement by performing derivation processing on a preset basic query template, wherein the derivation processing includes at least one derivation action, and the types of derivation actions include changing the condition content of the basic query condition in the preset basic query template, adding an additional query condition to the preset basic query condition, and adding a new basic query condition to the basic query template; A conversion module, configured to convert the query statement into a first natural language query text in a preset language by using a preset large language model; A generation module is used to translate the first natural language query text into a second natural language query text in a target language, and use the query statement as a label of the second natural language query text to generate a natural language query sample, wherein the natural language query sample is used to train a conversion model so that the trained conversion model can perform multi-language natural language query text conversion.

8. An electronic device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the method for generating a natural language query sample according to any one of claims 1 to 6.

9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, on which a computer program is stored, and the computer program is configured to implement the steps of the natural language query sample generation method according to any one of claims 1 to 6.

10. A computer program product, characterized in that The computer program product comprises a computer program, and the computer program is configured to implement the steps of the method for generating a natural language query sample according to any one of claims 1 to 6.

Citation Information

Cited By

  • Training corpus generation method and device based on large language model, medium and equipment

    CN120509494A

  • Big language model-based training corpus generation method and device, medium and equipment

    CN120509494B