Method and apparatus for querying data
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
- Filing Date
- 2022-02-15
- Publication Date
- 2026-08-07
AI Technical Summary
由于SQL跟人们通常使用的自然语言之间有较大差别,并且,SQL为一种编程语言,具有一定的使用门槛,因此,对用户不友好,也影响了数据查询的效率
[0068] The data query method and apparatus provided in the embodiments of this specification obtain a string input by a user in natural language for a target dataset, retrieve at least one alternative filter condition from a target dictionary pre-generated for the target dataset, output at least one alternative filter condition to the user for selection, and query data from the target dataset according to the target filter condition selected by the user from the alternative filter conditions. This allows users to query data without using a dedicated programming language and without needing to input complete filter conditions, thus improving the efficiency of data query.
Smart Images

Figure CN115168435B_ABST
Abstract
Description
[0001] This application is a divisional application of the invention patent application filed on February 15, 2022, with application number 202210135283.5, entitled "A method and apparatus for querying data". Technical Field
[0002] This specification relates to the technical field of data querying through one or more embodiments, and particularly to a method and apparatus for querying data. Background Technology
[0003] Currently, SQL (Structured Query Language) is commonly used for data retrieval in the query field. However, because SQL differs significantly from natural languages, and because it is a programming language with a certain learning curve, it is not user-friendly and affects the efficiency of data retrieval. Summary of the Invention
[0004] This specification provides a method and apparatus for querying data through one or more embodiments.
[0005] According to the first aspect, a method for querying data is provided, the method comprising:
[0006] Obtain the string that the user inputs in natural language for the target dataset;
[0007] At least one alternative filtering condition is obtained from a target dictionary pre-generated for the target dataset based on the string; each alternative filtering condition includes a key-value pair consisting of an attribute and an attribute value in natural language.
[0008] The alternative filtering conditions are output to the user for the user to select;
[0009] Data is retrieved from the target dataset based on the target filter condition selected by the user from the alternative filter conditions.
[0010] Optionally, the target dictionary includes key-value pairs consisting of each attribute from at least some of the attributes in the target dataset and each attribute value corresponding to each attribute.
[0011] Optionally, obtaining at least one alternative filtering condition from a target dictionary pre-generated for the target dataset based on the string includes:
[0012] Iterate through each key-value pair in the target dictionary to determine at least one target key-value pair; the attribute value corresponding to any target key-value pair includes the string.
[0013] The alternative filtering conditions are obtained based on the at least one target key-value pair.
[0014] Optionally, obtaining the candidate filtering conditions based on the at least one target key-value pair includes:
[0015] Sort the at least one target key-value pair according to a preset sorting method;
[0016] Select the first preset number of target key-value pairs in the sorted list as the candidate filtering conditions.
[0017] Optionally, the sorting according to a preset sorting method includes:
[0018] Sort by total number of historical queries from highest to lowest; or
[0019] Sort by the number of queries within a preset time period, from most to least; or
[0020] Sort according to the number of characters contained, from most to least.
[0021] Optionally, outputting the alternative filtering conditions to the user includes:
[0022] The alternative filter conditions are optionally displayed in a preset area on the user interface.
[0023] Optionally, before obtaining the string input by the user for the target dataset, the method further includes:
[0024] Obtain the target dataset;
[0025] The target dataset is parsed to generate the target dictionary.
[0026] Optionally, parsing the target dataset to generate the target dictionary includes:
[0027] The natural language data in the target dataset is parsed to obtain each attribute in at least some of the attributes in the target dataset and each attribute value corresponding to each attribute.
[0028] Multiple distinct key-value pairs are constructed using the various attributes and their corresponding attribute values.
[0029] The target dictionary is generated from the multiple key-value pairs.
[0030] Optionally, at least some of the attributes are attributes corresponding to discrete attribute values.
[0031] Optionally, the method further includes:
[0032] After updating the target dataset, obtain the updated data;
[0033] Based on the updated data, new key-value pairs are determined;
[0034] The target dictionary is updated using the newly added key-value pairs.
[0035] According to the second aspect, an apparatus for providing query data, the apparatus comprising:
[0036] The input module is used to obtain strings input by the user in natural language for the target dataset;
[0037] The acquisition module is used to acquire at least one alternative filtering condition from a target dictionary pre-generated for the target dataset based on the string; any alternative filtering condition includes a key-value pair consisting of an attribute and an attribute value in natural language;
[0038] The output module is used to output the alternative filtering conditions to the user for the user to select.
[0039] The query module is used to query data from the target dataset based on the target filter condition selected by the user from the alternative filter conditions.
[0040] Optionally, the target dictionary includes key-value pairs consisting of each attribute from at least some of the attributes in the target dataset and each attribute value corresponding to each attribute.
[0041] Optionally, the acquisition module includes:
[0042] The traversal submodule is used to traverse each key-value pair in the target dictionary and determine at least one target key-value pair; the attribute value corresponding to any target key-value pair includes the string.
[0043] The acquisition submodule is used to acquire the alternative filtering conditions based on the at least one target key-value pair.
[0044] Optionally, the acquisition submodule is configured to:
[0045] Sort the at least one target key-value pair according to a preset sorting method;
[0046] Select the first preset number of target key-value pairs in the sorted list as the candidate filtering conditions.
[0047] Optionally, the acquisition sub-modules are sorted according to a preset sorting method in the following manner:
[0048] Sort by total number of historical queries from highest to lowest; or
[0049] Sort by the number of queries within a preset time period, from most to least; or
[0050] Sort according to the number of characters contained, from most to least.
[0051] Optionally, the output module is configured to:
[0052] The alternative filter conditions are optionally displayed in a preset area on the user interface.
[0053] Optionally, the device further includes:
[0054] The dataset acquisition module is used to acquire the target dataset before acquiring the string input by the user for the target dataset;
[0055] The generation module is used to parse the target dataset and generate the target dictionary.
[0056] Optionally, the generation module is configured to:
[0057] The natural language data in the target dataset is parsed to obtain each attribute in at least some of the attributes in the target dataset and each attribute value corresponding to each attribute.
[0058] Multiple distinct key-value pairs are constructed using the various attributes and their corresponding attribute values.
[0059] The target dictionary is generated from the multiple key-value pairs.
[0060] Optionally, at least some of the attributes are attributes corresponding to discrete attribute values.
[0061] Optionally, the device further includes:
[0062] A new module is added to obtain updated data after the target dataset has been updated;
[0063] The determination module is used to determine the newly added key-value pairs based on the updated data;
[0064] An update module is used to update the target dictionary using the newly added key-value pairs.
[0065] According to a third aspect, a computer-readable storage medium is provided, the storage medium storing a computer program that, when executed by a processor, implements the method described in any one of the first or second aspects above.
[0066] According to a fourth aspect, a computing device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described in any one of the first or second aspects above.
[0067] The technical solutions provided in the embodiments of this specification may include the following beneficial effects:
[0068] The data query method and apparatus provided in the embodiments of this specification obtain a string input by a user in natural language for a target dataset, retrieve at least one alternative filter condition from a target dictionary pre-generated for the target dataset, output at least one alternative filter condition to the user for selection, and query data from the target dataset according to the target filter condition selected by the user from the alternative filter conditions. This allows users to query data without using a dedicated programming language and without needing to input complete filter conditions, thus improving the efficiency of data query.
[0069] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0070] To more clearly illustrate the technical solutions of the embodiments in this specification, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0071] Figure 1 This specification is a schematic diagram illustrating a scenario for querying data according to an exemplary embodiment.
[0072] Figure 2 This is a flowchart illustrating a method for querying data according to an exemplary embodiment.
[0073] Figure 3 This specification is a schematic diagram illustrating an interface that outputs alternative filtering conditions in a preset area on a user interface, according to an exemplary embodiment.
[0074] Figure 4 This is a flowchart illustrating a method for generating a target dictionary according to an exemplary embodiment of this specification;
[0075] Figure 5 This is a block diagram illustrating a data query apparatus according to an exemplary embodiment of this specification. Detailed Implementation
[0076] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this specification.
[0077] Currently, SQL (Structured Query Language) is commonly used for data retrieval in the query field. However, SQL differs significantly from natural language, and as a programming language, it has a learning curve, making it unfriendly to users and impacting query efficiency. Using natural language for data retrieval requires users to input complete filtering conditions. If these conditions are too long, contain uncommon characters, or include easily mispronounced or misspelled words, it can still cause inconvenience and affect query efficiency.
[0078] This specification provides a data query scheme that allows users to query data without using a dedicated programming language and without having to input complete filtering conditions, thus improving the efficiency of data query.
[0079] like Figure 1 The image shown is a schematic diagram illustrating a scenario for querying data according to an exemplary embodiment.
[0080] Figure 1 First, users can pre-input the target dataset to be queried. The system then analyzes the natural language data within the target dataset to generate a target dictionary. The target dictionary includes multiple key-value pairs in natural language, consisting of attributes and attribute values from the target dataset. After generating the target dictionary, users can query the data in the target dataset an unlimited number of times based on it. It should be noted that if the target dataset is updated, the target dictionary can also be updated simultaneously using the updated data.
[0081] Next, when a user needs to query the target dataset, they can enter a string in natural language, such as Chinese keywords / words or English letters. This string can be a partial string of attribute values used in the filtering conditions for the query data. Based on the string entered by the user, the system searches for attribute values containing that string from the attribute values of each key-value pair included in the target dictionary, and selects at least a portion of the key-value pairs corresponding to the attribute values containing that string as candidate filtering conditions.
[0082] Then, alternative filter conditions can be displayed in a preset area of the user interface for the user to select. The user can select the target filter condition for querying data from the alternative filter conditions by clicking. Then, data is queried from the target dataset according to the target filter condition, and the query results are returned to the user.
[0083] The solutions provided in this specification will be described in detail below with reference to specific embodiments.
[0084] like Figure 2 As shown, Figure 2 This is a flowchart illustrating a method for querying data according to an exemplary embodiment. The entity executing this method can be any device, platform, server, or device cluster with computing and processing capabilities. The method includes the following steps:
[0085] In step 201, the string input by the user in natural language for the target dataset is obtained.
[0086] In this embodiment, the target dataset is the dataset to be queried, which may include multiple attributes and their corresponding attribute values. Each attribute and its value is represented using natural language datasets. It is understood that the target dataset can be any form of dataset, and this embodiment does not limit the specific form of the target dataset.
[0087] In this embodiment, when a user queries data from a target dataset, they can use natural language input and strings associated with the filtering conditions of the query data. For example, if the filtering condition for the query data is "country=ABCDEF", where "country" is an attribute (i.e., a key) and "ABCDEF" is an attribute value (i.e., a value), then the user can input the string "A", or the string "CD", or any consecutive strings included in the attribute values of the filtering condition, etc.
[0088] In step 202, at least one alternative filtering condition is obtained from the target dictionary pre-generated for the target dataset based on the above string. Each alternative filtering condition includes key-value pairs using natural language, consisting of attributes and attribute values.
[0089] Specifically, before querying the target dataset, the target dataset can be pre-input, parsed, and at least some of its attributes and their corresponding values can be obtained. Each attribute and its corresponding value form a key-value pair (the attribute is the key, and the attribute value is the value). The obtained key-value pairs are then used to generate a target dictionary for the target dataset, ensuring that the target dictionary includes all the obtained key-value pairs. The at least some attributes in the target dataset can be all attributes in the target dataset, or they can be attributes corresponding to discrete attribute values, such as non-numeric attribute values.
[0090] When performing a query, at least one alternative filtering condition can be obtained from the target dictionary based on the string input by the user in natural language for the target dataset. Specifically, each key-value pair in the target dictionary can be traversed, and for any key-value pair, it can be determined whether the attribute value corresponding to that key-value pair (i.e., the value of the key-value pair) contains the string input by the user. The key-value pair corresponding to the attribute value containing the string is then used as the target key-value pair. After the traversal is completed, at least one target key-value pair is obtained, and alternative filtering conditions are obtained based on this at least one target key-value pair.
[0091] For example, the target dictionary includes the following key-value pairs: country =China, country =PolishABCDEF, country =Japan, country =Poland, country =USA, city =Ningbo, city =Boston, city =Beijing, city =Tokyo, city =Warsaw, city =Mostar. If the user's query filter condition is "country =PolishABCDEF", then the user can input the string "Polish", and the target key-value pairs will be the key-value pairs corresponding to the attribute values containing the string "Polish" in the target dictionary. Therefore, the target key-value pairs include the following four key-value pairs: country =PolishABCDEF, country =Poland, city =Ningbo, city =Boston. Finally, alternative filter conditions can be obtained based on the target key-value pairs.
[0092] In one implementation, all obtained target key-value pairs can be used as candidate filtering conditions, and these conditions can be output to the user in a random or preset order. In another implementation, it can first be determined whether the number of target key-value pairs exceeds a preset threshold. If the number does not exceed the threshold, all obtained target key-value pairs are used as candidate filtering conditions, and these conditions are output to the user. If the number exceeds the threshold, only a subset of target key-value pairs can be selected as candidate filtering conditions, and these conditions are then output to the user.
[0093] Optionally, at least one target key-value pair can be sorted according to a preset sorting method first, and then, the first preset number of target keys in the sorting are selected as alternative filtering conditions. Among them, the sorting can be performed in the order from the most to the least historical query total times, or in the order from the most to the least query times within a preset time period, or in the order from the most to the least number of included characters. It can be understood that the target key-value pairs can also be sorted in any other reasonable manner, and the present embodiment does not limit the specific manner of sorting.
[0094] In step 203, the above at least one alternative filtering condition is output to the user for the user to select.
[0095] In this embodiment, the above at least one alternative filtering condition can be output to the user for the user to select. Optionally, the above at least one alternative filtering condition can be displayed in an optional manner in a preset area on the user interface. As Figure 3 shown, area 301 is a string input box. The user can input a string for the target data set in area 301 using natural language. For example, the user inputs the string "North" in area 301. Then, alternative filtering conditions for the user to select are output in area 302. For example, the alternative filtering conditions "City = Beitun City", "City = Beijing City", "Province = Hebei Province", "Province = Hubei Province", "City = Beihai City" are output in area 302. The user can select a target filtering condition for querying data from the alternative filtering conditions. For example, if the user clicks on "City = Beitun City", then "City = Beitun City" can be used as the target filtering condition.
[0096] In step 204, data is queried from the target data set according to the target filtering condition selected by the user from the alternative filtering conditions.
[0097] In this embodiment, data query can be performed according to the target filtering condition selected by the user from the alternative filtering conditions. It should be noted that the user can perform data query based on one target filtering condition, or continue to input a string and continue to obtain multiple target filtering conditions, and then perform data query based on multiple target filtering conditions.
[0098] The method for querying data provided in the above embodiments of this specification obtains a string input by the user using natural language for the target data set, obtains at least one alternative filtering condition from a target dictionary pre-generated for the target data set, outputs the at least one alternative filtering condition to the user for the user to select, and queries data from the target data set according to the target filtering condition selected by the user from the alternative filtering conditions. Thereby, when the user queries data, without using a dedicated programming language, the user does not need to input complete filtering conditions, which improves the efficiency of data query.
[0099] like Figure 4 As shown, Figure 4 This is a flowchart illustrating a method for generating a target dictionary prior to step 201, according to an exemplary embodiment. The entity executing this method can be any device, platform, server, or device cluster with computing and processing capabilities. The method includes the following steps:
[0100] In step 401, the target dataset is obtained, and in step 402, the target dataset is parsed to generate a target dictionary.
[0101] Specifically, the system can obtain the target dataset input by the user and parse the natural language data within it to obtain at least some attributes and their corresponding values. These at least some attributes can be all attributes in the target dataset or attributes corresponding to discrete attribute values. Then, using these attributes and their corresponding values, multiple distinct key-value pairs are constructed, and these key-value pairs are used to generate a target dictionary.
[0102] For example, after parsing the natural language data in the target dataset, all attributes in the target dataset are obtained, including "province," "city," "district," and "sales volume." "Province," "city," and "district" correspond to discrete attribute values (non-numeric). "Sales volume" corresponds to continuous attribute values (numeric). Therefore, the individual attribute values for "province," "city," and "district" can be obtained. After deduplication, the following key-value pairs can be obtained: "province=Jiangsu," "province=Zhejiang," "province=Shandong," "city=Beijing," "city=Hangzhou," "city=Nanjing," "city=Jinan," and so on. A target dictionary is then generated to include these key-value pairs.
[0103] It should be noted that when updating the target dataset, the target dictionary can be updated simultaneously based on the updated data. For example, if an entry "Province=Shandong, City=Qingdao, Sales=N" is added to the target dataset, the target dictionary can be updated based on this new entry. Specifically, parsing this entry yields the attributes "Province," "City," and "Sales." Selecting the discrete attribute values for "Province" and "City" and obtaining their corresponding values results in the key-value pair "Province=Shandong" and "City=Qingdao." Since the target dictionary already contains the key-value pair "Province=Shandong," only "City=Qingdao" is added to the target dictionary, thus updating the target dictionary.
[0104] It should be noted that although the operations of the methods of the embodiments of this specification are described in a specific order in the above embodiments, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. On the contrary, the steps depicted in the flowcharts may be executed in a different order. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.
[0105] Corresponding to the aforementioned methods for querying data, this specification also provides embodiments of devices for querying data.
[0106] like Figure 5 As shown, Figure 5 This specification is a block diagram of a data query device according to an exemplary embodiment. The device may include: an input module 501, an acquisition module 502, an output module 503, and a query module 504.
[0107] The input module 501 is used to obtain the string that the user inputs in natural language for the target dataset.
[0108] The acquisition module 502 is used to acquire at least one alternative filter condition from a target dictionary pre-generated for the target dataset based on the above string. Each alternative filter condition includes a key-value pair consisting of an attribute and an attribute value in natural language.
[0109] Output module 503 is used to output the alternative filtering conditions to the user for the user to select.
[0110] The query module 504 is used to query data from the target dataset based on the target filter condition selected by the user from the alternative filter conditions.
[0111] In some implementations, the target dictionary includes key-value pairs consisting of each attribute from at least a portion of the attributes in the target dataset and the attribute values corresponding to each attribute.
[0112] In other embodiments, the acquisition module 502 may include: traversing submodules and acquiring submodules (not shown in the figure).
[0113] The traversal submodule is used to traverse each key-value pair in the target dictionary and determine at least one target key-value pair. The attribute value corresponding to any target key-value pair includes the above string.
[0114] The Get submodule is used to obtain alternative filtering conditions based on at least one target key-value pair.
[0115] In other embodiments, the acquisition submodule is configured to: sort at least one target key-value pair according to a preset sorting method, and select the top preset number of target key-value pairs in the sort as candidate filtering conditions.
[0116] In other implementations, the acquisition submodule is sorted according to a preset sorting method in the following ways: sorted in descending order of the total number of historical queries; or sorted in descending order of the number of queries within a preset time period; or sorted in descending order of the number of characters contained.
[0117] In other embodiments, the output module 503 is configured to optionally display alternative filtering conditions in a preset area on the user interface.
[0118] In other embodiments, the apparatus may further include a dataset acquisition module and a generation module (not shown in the figure).
[0119] The dataset acquisition module is used to acquire the target dataset before acquiring the string input by the user for the target dataset.
[0120] The generation module is used to parse the target dataset and generate the target dictionary.
[0121] In other implementations, the generation module is configured to: parse the natural language data in the target dataset to obtain each attribute and its corresponding attribute value from at least some of the attributes in the target dataset; construct multiple distinct key-value pairs using the attributes and their corresponding attribute values; and generate a target dictionary from these key-value pairs.
[0122] In other embodiments, at least some of the above-mentioned attributes are attributes corresponding to discrete attribute values.
[0123] In other embodiments, the device may further include: an addition module, a determination module, and an update module (not shown in the figure).
[0124] One new module is used to obtain updated data after the target dataset has been updated.
[0125] The determination module is used to determine the new key-value pairs based on the updated data mentioned above.
[0126] The update module is used to update the target dictionary using the newly added key-value pair.
[0127] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of one or more embodiments of this specification, depending on actual needs. Those skilled in the art can understand and implement this without creative effort.
[0128] This specification also provides one or more embodiments of a computer-readable storage medium storing a computer program that can be used to perform the above-described actions. Figures 2 to 4 The method for querying data provided in any embodiment.
[0129] One or more embodiments of this specification also provide a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it implements the above-described steps 2 to 3. Figure 4 The method for querying data provided in any embodiment.
[0130] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.
[0131] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A method for querying data, the method comprising: Obtain the string that the user inputs in natural language for the target dataset; Based on the string, at least one alternative filtering condition is obtained from a target dictionary pre-generated for the target dataset; the target dictionary includes key-value pairs consisting of each attribute from at least some attributes in the target dataset and each attribute value corresponding to each attribute; any alternative filtering condition includes a target key-value pair consisting of an attribute and an attribute value in natural language, wherein the attribute value in the target key-value pair contains the string; The alternative filtering conditions are output to the user for the user to select; The step of obtaining at least one alternative filtering condition from a target dictionary pre-generated for the target dataset includes: Traverse each key-value pair in the target dictionary to determine at least one target key-value pair; The alternative filtering conditions are obtained based on the at least one target key-value pair.
2. The method according to claim 1, wherein, The at least one alternative filtering condition includes a first filtering condition and a second filtering condition; the target key-value pairs of the first filtering condition and the second filtering condition have different attributes.
3. The method according to claim 1, wherein, The step of obtaining the candidate filtering conditions based on the at least one target key-value pair includes: Sort the at least one target key-value pair according to a preset sorting method; Select the first preset number of target key-value pairs in the sorted list as the candidate filtering conditions.
4. The method according to claim 3, wherein, The sorting according to the preset sorting method includes: Sort by total number of historical queries from highest to lowest; or Sort by the number of queries within a preset time period, from most to least; or Sort according to the number of characters contained, from most to least.
5. The method according to claim 1, wherein, The step of outputting the alternative filtering conditions to the user includes: The alternative filter conditions are optionally displayed in a preset area on the user interface.
6. The method according to claim 1, wherein, Before obtaining the string input by the user for the target dataset, the method further includes: Obtain the target dataset; The target dataset is parsed to generate the target dictionary.
7. The method according to claim 6, wherein, The step of parsing the target dataset to generate the target dictionary includes: The natural language data in the target dataset is parsed to obtain each attribute in at least some of the attributes in the target dataset and each attribute value corresponding to each attribute. Multiple distinct key-value pairs are constructed using the various attributes and their corresponding attribute values. The target dictionary is generated from the multiple key-value pairs.
8. The method according to claim 7, wherein the at least some attributes are attributes corresponding to discrete attribute values.
9. The method according to claim 6, wherein, The method further includes: After updating the target dataset, obtain the updated data; Based on the updated data, new key-value pairs are determined; The target dictionary is updated using the newly added key-value pairs.
10. An apparatus for querying data, the apparatus comprising: The input module is used to obtain strings input by the user in natural language for the target dataset; The acquisition module is configured to acquire at least one alternative filtering condition from a target dictionary pre-generated for the target dataset based on the string; the target dictionary includes key-value pairs consisting of each attribute from at least some attributes in the target dataset and each attribute value corresponding to each attribute; any alternative filtering condition includes a target key-value pair consisting of an attribute and an attribute value in natural language, wherein the attribute value in the target key-value pair contains the string; The output module is used to output the alternative filtering conditions to the user for the user to select. Specifically, the acquisition module is used to: traverse each key-value pair in the target dictionary, determine at least one target key-value pair, and acquire the candidate filtering conditions based on the at least one target key-value pair.
11. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the method of any one of claims 1-9.
12. A computing device comprising a memory and a processor, wherein the memory stores executable code, and the processor, when executing the executable code, implements the method of any one of claims 1-9.
Citation Information
Patent Citations
Input recommendation method based on database query, electronic device and storage medium
CN111414375A