Data query method and device, electronic equipment and storage medium

By segmenting natural language query statements and constructing structured prefixes, the problem of inaccurate queries caused by place names in existing technologies is solved, and more accurate data query results are achieved.

CN121764940APending Publication Date: 2026-03-31INSPUR TIANYUAN COMM INFORMATION SYST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-29
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing technology cannot accurately understand the place names included in users' natural language queries, resulting in inaccurate search results.

Method used

By segmenting the natural language query statement, the number of consecutive non-separating words after the place name is determined. If it is lower than a preset threshold, a structured prefix containing the place name is constructed and concatenated with the target field to form a structured query statement for data retrieval.

Benefits of technology

The generated structured query statements more clearly represent the query intent, improving the accuracy of data retrieval.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121764940A_ABST
    Figure CN121764940A_ABST
Patent Text Reader

Abstract

The invention provides a data query method and device, electronic equipment and a storage medium, and belongs to the technical field of natural language processing, and the method comprises the steps that word segmentation is performed on a natural language query statement to obtain a word segmentation result, and the word segmentation result comprises a place name; determining the number of continuous non-separated words after the last place name in the word segmentation result; if the number of the continuous non-separated words is lower than a preset threshold value, constructing a structured prefix containing a place name, and splicing the structured prefix and the target field into a structured query statement; the target field is a field except a place name in the natural language query statement; and performing data query based on the structured query statement. According to the method, the structured query statement containing the place name is generated when the number of the non-separated words behind the place name in the natural language query statement is lower than the preset threshold value on the basis of the number of the non-separated words, the query intention represented by the structured query statement is clearer, data query is carried out based on the structured query statement, and the data query result can be more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of natural language processing technology, and in particular to a data query method, apparatus, electronic device, and storage medium. Background Technology

[0002] In the field of natural language query, user-input queries often include place names. Existing technologies often fail to understand the user's true query intent, resulting in inaccurate query results. Summary of the Invention

[0003] This invention provides a data query method, apparatus, electronic device, and storage medium to solve the technical problem of inaccurate data query results in the prior art.

[0004] This invention provides a data query method, comprising: The natural language query statement is segmented into words to obtain segmentation results, which include place names; Determine the number of consecutive non-separating words following the last place name in the word segmentation result; If the number of consecutive non-separated words is less than a preset threshold, a structured prefix containing the place name is constructed, and the structured prefix is ​​concatenated with the target field to form a structured query statement; the target field is the field in the natural language query statement other than the place name; Data retrieval is performed based on the structured query statement.

[0005] According to a data query method provided by the present invention, determining the number of consecutive non-separated words following the last place name in the word segmentation result includes: Determine the location index of the last place name mentioned; Increment the position index by 1 and initialize the count value to zero; The preset process is repeated until the position index is greater than the total number of words in the natural language query statement or the word corresponding to the position index is a delimiter word. The count value is then output as the number of consecutive non-delimiter words. The preset process includes: if the position index is less than or equal to the total number of words, and the word corresponding to the position index is not a separated word, then both the count value and the position index are incremented by 1.

[0006] According to a data query method provided by the present invention, the construction includes a structured prefix for the place name, comprising: If the place name is an abbreviation, then the full name of the place name is looked up in the name mapping table; the name mapping table contains the mapping relationship between the abbreviation and the full name of each place name; Construct the structured prefix containing the full name of the place.

[0007] According to a data query method provided by the present invention, the step of constructing a structured prefix containing the place name and concatenating the structured prefix with a target field to form a structured query statement includes: If the positions of the two place names in the word segmentation result are adjacent, a structured prefix containing both place names is constructed, and the structured prefix is ​​concatenated with the target field to form a structured query statement. If the positions of the two place names in the word segmentation result are not adjacent, then a structured prefix containing the first place name and a structured prefix containing the second place name are constructed respectively. The structured prefix containing the first place name is concatenated with the target field to form a structured query statement, and the structured prefix containing the second place name is concatenated with the target field to form another structured query statement.

[0008] According to a data query method provided by the present invention, if the positions of two place names in the word segmentation result are adjacent, constructing a structured prefix that simultaneously contains both place names includes: If the positions of two place names in the word segmentation result are adjacent, and the two place names include a first place name and a second place name under the first place name, then a structured prefix composed of a superior place name field and a subordinate place name field is constructed. Assign the first place name to the parent place name field, and assign the second place name to the child place name field.

[0009] According to a data query method provided by the present invention, the non-adjacent locations include the presence of one or more conjunctions between the preceding and following place names.

[0010] According to a data query method provided by the present invention, after determining the number of consecutive non-separated words following the last place name in the word segmentation result, the method further includes: If the number of consecutive non-separated words exceeds a preset threshold, then a data query is performed based on the natural language query statement.

[0011] According to a data query method provided by the present invention, if the number of consecutive non-separated words is lower than a preset threshold, then constructing a structured prefix containing the place name, and concatenating the structured prefix with the target field to form a structured query statement, the method further includes: The output includes a flag indicating whether the natural speech query has been successfully converted into a structured query and a flag indicating whether the structured query was successfully obtained.

[0012] The present invention also provides a data query device, comprising: The word segmentation module is used to segment natural language query statements into words and obtain segmentation results, which include place names; The determination module is used to determine the number of consecutive non-separated words following the last place name in the word segmentation result; The generation module is used to construct a structured prefix containing the place name if the number of consecutive non-separated words is lower than a preset threshold, and to concatenate the structured prefix with a target field to form a structured query statement; the target field is a field in the natural language query statement other than the place name; The query module is used to perform data queries based on the structured query statement.

[0013] The present invention also provides an electronic device, 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 data query method as described above.

[0014] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the data query method as described above.

[0015] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the data query method as described above.

[0016] The data query method, apparatus, electronic device, and storage medium provided by this invention generate a structured query statement containing the place name based on the number of non-separating words after the place name in a natural language query statement. When the number of non-separating words is lower than a preset threshold, the structured query statement represents a clearer query intent. Data query based on the structured query statement can make the data query results more accurate. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0018] Figure 1 This is a flowchart illustrating the data query method provided by the present invention.

[0019] Figure 2 This is a schematic diagram of the data query device provided by the present invention.

[0020] Figure 3 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed implementation manners

[0021] To make the objectives, technical solutions and advantages of the present invention clearer, the technical solutions in the present invention will be clearly and completely described below with reference to the accompanying drawings in the present invention. Apparently, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present invention without making creative efforts shall fall within the protection scope of the present invention.

[0022] In the prior art, for a natural language query statement input by a user, such as "query the computer rooms in Area B of City A where the number of optical line terminals is greater than 30", it is easy to understand this query as "query the number of optical line terminals in Area B of City A", resulting in inaccurate query results.

[0023] The following will be combined with Figures 1-3 to describe the data query method, device, electronic device and storage medium provided by the present invention.

[0024] Figure 1 is a schematic flowchart of the data query method provided by the present invention. As Figure 1 shown, it includes but is not limited to steps S1, S2, S3 and S4.

[0025] Step S1: Segment the natural language query statement to obtain a segmentation result, and the segmentation result includes place names.

[0026] The natural language query statement can be segmented by using a custom dictionary and a segmentation tool. Exemplarily, after segmenting the natural language query statement "query the computer rooms in Area B of City A where the number of optical line terminals is greater than 30", the segmentation results such as "query", "City A", "Area B", "inside", "optical line", "terminal", "quantity", "greater than", "30", "units", "of", "computer room" can be obtained, and the place names therein include City A and Area B.

[0027] Step S2: Determine the number of consecutive non-separator words after the last place name in the segmentation result.

[0028] The separator words in the present invention include semantic separator words such as "of", "inside", "has", "contains", "greater than", "less than", "below", ",", etc. Consecutive means that the first word after the last place name must be a non-separator word.

[0029] For the above example, the last place name is "Area B". Since the first word after "Area B" is the separator word "inside", the number of consecutive non-separator words is 0.

[0030] Step S3: If the number of consecutive non-separating words is lower than a preset threshold, construct a structured prefix containing place names and concatenate the structured prefix with the target field to form a structured query statement; the target field is the field in the natural language query statement other than the place name.

[0031] The preset threshold can be 2. If the number of consecutive non-separating words is lower than the preset threshold, the query can be split. For the example above, this invention can construct a structured prefix in the form of "city[A], district[B]"; the target fields include "query", "internal", and "computer rooms with more than 30 optical line terminals". The structured prefix "city[A], district[B]" and "computer rooms with more than 30 optical line terminals" can be concatenated into the structured query statement "city[A], district[B], computer rooms with more than 30 optical line terminals".

[0032] Step S4: Perform data query based on structured query statements.

[0033] Because natural language queries are transformed into structured queries that include place names, the query intent represented by structured queries is more explicit. For example, the structured query "City [A], District [B], Room with more than 30 optical line terminals" clearly represents the query intent of "room with more than 30 optical line terminals", rather than "query the number of optical line terminals in District B of City A". Data queries based on structured queries can make the query results more accurate.

[0034] As can be seen from the above, the data query method of the present invention is based on the number of non-separating words after place names in natural language query statements. When the number of non-separating words is lower than a preset threshold, a structured query statement containing place names is generated. The query intent represented by the structured query statement is clearer. Data query based on the structured query statement can make the data query results more accurate.

[0035] In one embodiment, step S2 of the present invention may specifically include: Determine the location index of the last place name; Increment the position index by 1 and initialize the count value to zero; The preset process is repeated until the position index is greater than the total number of words in the natural language query or the word corresponding to the position index is a delimiter word. The count value is then output as the number of consecutive non-delimiter words. The preset process includes: if the position index is less than or equal to the total number of words, and the word corresponding to the position index is not a delimited word, then both the count value and the position index are incremented by 1.

[0036] Exemplarily, for the word segmentation results "query", "City A", "District B", "inside", "optical line", "terminal", "quantity", "greater than", "30", "units", "of", "computer room", the position index of the last place name "District B" is 3. After adding 1 to the position index, the position index becomes 4, which is less than the total number of word segments 12. However, the word corresponding to the position index 4 is the separator word "inside", so the loop ends and the counted value obtained is 0.

[0037] Exemplarily, for the natural language query sentence "I want to know the information of the computer room at Loop C, D01, United Rural Commercial Bank, District B, City A", the word segmentation results include "I", "want", "to know", "City A", "District B", "United", "rural", "commercial bank", "C", "loop", "computer room", "D", "01", "of", "information". The position index of the last place name "District B" is 5. After adding 1 to the position index, the position index becomes 6, which is less than the total number of word segments 15. The word corresponding to the position index 6 is the non-separator word "United", so both the counted value and the position index are incremented by 1. The counted value becomes 1 and the position index becomes 7; The position index 7 is less than the total number of word segments 15. The word corresponding to the position index 7 is the non-separator word "rural", so both the counted value and the position index are incremented by 1. The counted value becomes 2 and the position index becomes 8; And so on, until the separator word "of", and the final counted value is 8.

[0038] Considering that the place names input by users are often abbreviations. For example, if the input is "query computer rooms with more than 30 optical line terminals inside AB", the generated structured query statement is "City [A], District [B], computer rooms with more than 30 optical line terminals". However, the system resource data usually stores the full names of place names. Conducting data queries based on the foregoing structured query statement may result in query failures.

[0039] To this end, in one embodiment, in step S3, constructing a structured prefix containing place names may specifically include: If the place name is an abbreviation, look up the full name of the place name in the name mapping table; the name mapping table contains the mapping relationship between the abbreviations and full names of each place name; Construct a structured prefix containing the full name of the place name.

[0040] The name mapping table may contain the abbreviation "A" of City A and the corresponding full name "City A", and the abbreviation "B" of District B and the corresponding full name "District B". Then, after word segmentation, the full name "City A" of the place name "A" and the full name "District B" of the place name "B" can be found in the name mapping table, and the structured query statement "City [City A], District [District B], computer rooms with more than 30 optical line terminals" is constructed.

[0041] This allows for the conversion of abbreviated place names into standard full place names through name mapping, enabling the construction of structured query statements that can be understood by system resources, thereby improving the query success rate.

[0042] In some cases, similar natural language queries entered by users represent different query intentions. For example, the natural language query "query the equipment rooms with more than 30 optical line terminals in District B of City A" means only querying information in District B, while the natural language query "query the equipment rooms with more than 30 optical line terminals in both City A and District B" means querying information in both City A and District B. In this case, if the two place names are constructed as a structured prefix, it will lead to inaccurate query results.

[0043] Therefore, in one embodiment, step S3, which involves constructing a structured prefix containing the place name and concatenating the structured prefix with the target field to form a structured query statement, may specifically include: If the positions of two place names in the word segmentation result are adjacent, a structured prefix containing both place names is constructed, and the structured prefix is ​​concatenated with the target field to form a structured query statement. If the positions of two place names in the word segmentation result are not adjacent, then construct a structured prefix containing the first place name and a structured prefix containing the second place name respectively. Concatenate the structured prefix containing the first place name with the target field to form a structured query statement, and concatenate the structured prefix containing the second place name with the target field to form another structured query statement.

[0044] For example, for the natural language query "Query the number of computer rooms with more than 30 optical line terminals in District B of City A", the two place names, City A and District B, are adjacent. The structured prefix "City[City A], District[District B]" is constructed to obtain the structured query "City[City A], District[District B], Computer rooms with more than 30 optical line terminals", which means that the query target is District B of City A.

[0045] For the natural language query "Query the number of computer rooms with more than 30 optical line terminals in City A and District B", since the two place names City A and District B are not adjacent, we can construct structured prefixes "city[City A]" and "district[District B]" respectively, resulting in the structured query statements "city[City A], computer rooms with more than 30 optical line terminals" and "district[District B], computer rooms with more than 30 optical line terminals", representing that the query targets are City A and District B.

[0046] This allows for the construction of a unified structured prefix to represent a single query target when place names are adjacent, and the construction of different structured prefixes to represent different query targets when place names are not adjacent, which helps improve the accuracy of query results.

[0047] In one embodiment, if two place names are adjacent in the word segmentation result, constructing a structured prefix that simultaneously includes both place names can specifically include: If the positions of two place names in the word segmentation result are adjacent, and the two place names include the first place name and the second place name under the first place name, then construct a structured prefix composed of the superior place name field and the subordinate place name field; Assign the first place name to the parent place name field, and assign the second place name to the child place name field.

[0048] For example, for the natural language query "Query the computer rooms in District B of City A with more than 30 optical line terminals", the first place name is City A, the second place name is District B, and District B belongs to City A. The upper-level place name field can be a city, and the lower-level place name field can be a district or county. Then, construct the structured prefix "city[], district[]". After assigning the first place name City A to the upper-level place name field and the second place name District B to the lower-level place name field, we can get the structured prefix "city[City A], district[District B]".

[0049] This allows for the construction of structured prefixes that represent the hierarchical relationship between place names when natural language queries contain hierarchical place names, thus accurately representing the query target.

[0050] In one embodiment, the non-adjacent locations in this invention may include one or more conjunctions between the preceding and following place names. Conjunctions such as "and," "with," and "as well as" indicate that both place names are search targets.

[0051] In one embodiment, after step S2, the data query method of the present invention may further include: If the number of consecutive non-separating words exceeds a preset threshold, data retrieval will be performed based on natural language query statements.

[0052] If the number of consecutive non-separating words exceeds a preset threshold, it means that the query is an indivisible whole. If it is rewritten as a structured query, it will lead to inaccurate query results.

[0053] For example, for the natural language query "I want to know the information of the C Ring Road Computer Room D01 of the United Rural Commercial Bank in District B of City A", the query target is obviously the whole "City B United Rural Commercial Bank C Ring Road Computer Room D01". The final count value is 8, which is greater than the preset threshold of 2. Therefore, the data query is performed based on the natural language query "I want to know the information of the C Ring Road Computer Room D01 of the United Rural Commercial Bank in District B of City A".

[0054] This allows for direct data retrieval based on the original natural language query statement when the query is an indivisible whole, ensuring the accuracy of the query results.

[0055] In one embodiment, after step S3, the data query method of the present invention may further include: The output includes a flag indicating whether the natural language query was successfully converted into a structured query and a flag indicating whether a structured query was successfully obtained.

[0056] After rewriting a natural language query into a structured query, outputting the corresponding flags helps to notify the user that the query has been rewritten; outputting a flag indicating whether a structured query was successfully obtained helps to notify the user whether the rewriting was successful.

[0057] like Figure 2 As shown, the data query device provided by the present invention includes, but is not limited to: The word segmentation module is used to segment natural language query statements into words and obtain segmentation results, which include place names; The determination module is used to determine the number of consecutive non-separated words following the last place name in the word segmentation results; The generation module is used to construct a structured prefix containing place names if the number of consecutive non-separated words is less than a preset threshold, and then concatenate the structured prefix with the target field to form a structured query statement; the target field is the field in the natural language query statement other than the place name. The query module is used to perform data queries based on structured query statements.

[0058] It should be noted that the data query device provided by the present invention can execute the data query method of any of the above embodiments during specific operation, which will not be described in detail in this embodiment.

[0059] Furthermore, the determination module is also used for: Determine the location index of the last place name; Increment the position index by 1 and initialize the count value to zero; The preset process is repeated until the position index is greater than the total number of words in the natural language query or the word corresponding to the position index is a delimiter word. The count value is then output as the number of consecutive non-delimiter words. The preset process includes: if the position index is less than or equal to the total number of words, and the word corresponding to the position index is not a delimited word, then both the count value and the position index are incremented by 1.

[0060] Furthermore, the generation module is also used for: If the place name is an abbreviation, then look up the full name of the place name in the name mapping table; the name mapping table contains the mapping relationship between the abbreviation and the full name of each place name; Construct a structured prefix that includes the full name of the place.

[0061] Furthermore, the generation module is also used for: If the positions of two place names in the word segmentation result are adjacent, a structured prefix containing both place names is constructed, and the structured prefix is ​​concatenated with the target field to form a structured query statement. If the positions of two place names in the word segmentation result are not adjacent, then construct a structured prefix containing the first place name and a structured prefix containing the second place name respectively. Concatenate the structured prefix containing the first place name with the target field to form a structured query statement, and concatenate the structured prefix containing the second place name with the target field to form another structured query statement.

[0062] Furthermore, the generation module is also used for: If the positions of two place names in the word segmentation result are adjacent, and the two place names include the first place name and the second place name under the first place name, then construct a structured prefix composed of the superior place name field and the subordinate place name field; Assign the first place name to the parent place name field, and assign the second place name to the child place name field.

[0063] Furthermore, non-adjacent locations include places with one or more conjunctions between the preceding and following place names.

[0064] Furthermore, the query module is also used for: If the number of consecutive non-separating words exceeds a preset threshold, data retrieval will be performed based on natural language query statements.

[0065] Furthermore, the data query device also includes an output module for: The output includes a flag indicating whether the natural language query was successfully converted into a structured query and a flag indicating whether a structured query was successfully obtained.

[0066] Figure 3 This is a schematic diagram of the structure of an electronic device provided by the present invention. The electronic device may include a processor, a communications interface, a memory, and a communication bus. The processor, communications interface, and memory communicate with each other via the communication bus. The processor can call logical instructions in the memory to execute a data query method. This method includes: segmenting a natural language query statement into words to obtain segmentation results, the segmentation results including place names; determining the number of consecutive non-separated words after the last place name in the segmentation results; if the number of consecutive non-separated words is lower than a preset threshold, constructing a structured prefix containing the place name, and concatenating the structured prefix with a target field to form a structured query statement; the target field is any field in the natural language query statement other than the place name; and performing a data query based on the structured query statement.

[0067] Furthermore, the logical instructions in the aforementioned memory can be implemented as software functional units and sold or used as independent products, and can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0068] On the other hand, the present invention also provides a computer program product, the computer program product including a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions, and when the program instructions are executed by a computer, the computer is able to execute the data query method provided in the above embodiments, the method including: segmenting a natural language query statement to obtain a segmentation result, the segmentation result including place names; determining the number of consecutive non-separated words after the last place name in the segmentation result; if the number of consecutive non-separated words is lower than a preset threshold, constructing a structured prefix containing place names, and concatenating the structured prefix with a target field to form a structured query statement; the target field is a field in the natural language query statement other than place names; and performing a data query based on the structured query statement.

[0069] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the data query method provided in the above embodiments. The method includes: segmenting a natural language query statement to obtain segmentation results, the segmentation results including place names; determining the number of consecutive non-separated words after the last place name in the segmentation results; if the number of consecutive non-separated words is lower than a preset threshold, constructing a structured prefix containing place names, and concatenating the structured prefix with a target field to form a structured query statement; the target field is a field in the natural language query statement other than place names; and performing a data query based on the structured query statement.

[0070] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. 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 this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0071] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0072] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A data query method, characterized in that, include: The natural language query statement is segmented into words to obtain segmentation results, which include place names; Determine the number of consecutive non-separating words following the last place name in the word segmentation result; If the number of consecutive non-separated words is less than a preset threshold, a structured prefix containing the place name is constructed, and the structured prefix is ​​concatenated with the target field to form a structured query statement; the target field is the field in the natural language query statement other than the place name; Data retrieval is performed based on the structured query statement.

2. The data query method according to claim 1, characterized in that, Determining the number of consecutive non-separated words following the last place name in the word segmentation result includes: Determine the location index of the last place name mentioned; Increment the position index by 1 and initialize the count value to zero; The preset process is repeated until the position index is greater than the total number of words in the natural language query statement or the word corresponding to the position index is a delimiter word. The count value is then output as the number of consecutive non-delimiter words. The preset process includes: if the position index is less than or equal to the total number of words, and the word corresponding to the position index is not a separated word, then both the count value and the position index are incremented by 1.

3. The data query method according to claim 1, characterized in that, The construct includes a structured prefix for the place name, including: If the place name is an abbreviation, then the full name of the place name is looked up in the name mapping table; the name mapping table contains the mapping relationship between the abbreviation and the full name of each place name; Construct the structured prefix containing the full name of the place.

4. The data query method according to claim 1, characterized in that, The construction includes a structured prefix for the place name, and concatenates the structured prefix with the target field to form a structured query statement, including: If the positions of the two place names in the word segmentation result are adjacent, a structured prefix containing both place names is constructed, and the structured prefix is ​​concatenated with the target field to form a structured query statement. If the positions of the two place names in the word segmentation result are not adjacent, then a structured prefix containing the first place name and a structured prefix containing the second place name are constructed respectively. The structured prefix containing the first place name is concatenated with the target field to form a structured query statement, and the structured prefix containing the second place name is concatenated with the target field to form another structured query statement.

5. The data query method according to claim 4, characterized in that, If the two place names in the word segmentation result are adjacent, then a structured prefix containing both place names is constructed, including: If the positions of two place names in the word segmentation result are adjacent, and the two place names include a first place name and a second place name under the first place name, then a structured prefix composed of a superior place name field and a subordinate place name field is constructed. Assign the first place name to the parent place name field, and assign the second place name to the child place name field.

6. The data query method according to claim 4, characterized in that, The phrase "locations are not adjacent" includes the presence of one or more conjunctions between the previously mentioned place name and the subsequently mentioned place name.

7. The data query method according to claim 1, characterized in that, After determining the number of consecutive non-separated words following the last place name in the word segmentation result, the method further includes: If the number of consecutive non-separated words exceeds a preset threshold, then a data query is performed based on the natural language query statement.

8. The data query method according to claim 1, characterized in that, If the number of consecutive non-separating words is less than a preset threshold, then after constructing a structured prefix containing the place name and concatenating the structured prefix with the target field to form a structured query statement, the method further includes: The output indicates whether the natural speech query has been successfully converted into a structured query and whether the structured query was successfully obtained.

9. A data query device, characterized in that, include: The word segmentation module is used to segment natural language query statements into words and obtain segmentation results, which include place names; The determination module is used to determine the number of consecutive non-separated words following the last place name in the word segmentation result; The generation module is used to construct a structured prefix containing the place name if the number of consecutive non-separated words is lower than a preset threshold, and to concatenate the structured prefix with a target field to form a structured query statement; the target field is a field in the natural language query statement other than the place name; The query module is used to perform data queries based on the structured query statement.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the data query method as described in any one of claims 1 to 8.

11. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the data query method as described in any one of claims 1 to 8.

12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the data query method as described in any one of claims 1 to 8.