Search

CN-122019562-A - Data query method, device, computer equipment and storage medium

CN122019562ACN 122019562 ACN122019562 ACN 122019562ACN-122019562-A

Abstract

The embodiment of the application belongs to the technical field of data processing and query, and relates to a data query method, a data query device, computer equipment and a storage medium; the method comprises the steps of carrying out semantic feature extraction operation on a data query text according to a natural language processing model to obtain a semantic query vector, reading a constructed vector database, indexing a candidate business table corresponding to the semantic query vector in the constructed vector database, carrying out prompt word integration operation on the data query text according to a structured prompt word template to obtain a current query intention, inputting the candidate business table and the current query intention into a large language model to carry out intention reasoning operation to obtain a structured query sentence, reading a system database, and carrying out sentence retrieval operation on the structured query sentence in the system database to obtain a target retrieval result. The application can realize high-efficiency and accurate data retrieval, reduce the inquiry threshold of users and improve the inquiry efficiency and accuracy.

Inventors

  • ZHAO ZHIYONG
  • MA HUANRONG
  • WANG QIUJIAN

Assignees

  • 深圳市斯远电子技术有限公司

Dates

Publication Date
20260512
Application Date
20251209

Claims (10)

  1. 1. A data query method, comprising the steps of: acquiring a data query text; Carrying out semantic feature extraction operation on the data query text according to a natural language processing model to obtain a semantic query vector; Reading a constructed vector database, and indexing a candidate service table corresponding to the semantic query vector in the constructed vector database; Performing prompt word integration operation on the data query text according to the structured prompt word template to obtain the current query intention; Inputting the candidate service table and the current query intention into a large language model to perform intention reasoning operation to obtain a structured query statement; And reading a system database, and performing sentence retrieval operation on the structured query sentence in the system database to obtain a target retrieval result.
  2. 2. The data query method according to claim 1, wherein the step of extracting semantic features from the data query text according to a natural language processing model to obtain a semantic query vector comprises the steps of: performing lexical analysis operation on the data query text to obtain data query terms; performing syntactic analysis operation on the data query terms to obtain data query grammar; performing semantic role labeling operation on the data query grammar to obtain a data query role; performing semantic understanding operation on the data query roles according to the natural language processing model to obtain a semantic query text; And carrying out vector conversion operation on the semantic query text to obtain the semantic query vector.
  3. 3. The data query method of claim 1, further comprising, prior to the step of reading the constructed vector database and indexing candidate business tables corresponding to the semantic query vectors in the constructed vector database, the steps of: Reading a system database, and acquiring a stored service data table from the system database; Extracting key attributes of each business data table; Performing vector conversion operation on the key attributes to obtain data table vectors corresponding to each service data table; creating an initialization vector database, and storing the data table vector into the initialization vector database to obtain the constructed vector database.
  4. 4. The method for querying data according to claim 1, wherein the step of performing a prompt word integration operation on the data query text according to the structured prompt word template to obtain the current query intention comprises the following steps: performing text cleaning operation on the data query text to obtain a clear query text; Performing word segmentation and part-of-speech tagging on the clear query text to obtain a part-of-speech tagging text; extracting keywords from the part-of-speech tagged text to obtain query keywords; Acquiring a service scene corresponding to the data query text, and acquiring a structured prompt word template corresponding to the service scene; Performing placeholder matching operation on the query keywords and placeholders of the structured prompt word templates to obtain successfully matched query keywords; and replacing the successfully matched query keywords to the corresponding placeholder positions of the structured prompt word template to obtain the current query intention.
  5. 5. The data query method as claimed in claim 1, wherein said step of performing a sentence search operation on said structured query sentence in said system database to obtain a target search result comprises the steps of: Performing initial search operation on the structured query statement in the system database to obtain an initial search result; performing intention optimizing operation on the current query intention according to the initial search result to obtain an optimized query intention; and repeating intention reasoning, initial retrieval and intention optimizing operation on the optimized query intention until the repetition times meet the preset optimization times to obtain the target retrieval result.
  6. 6. The data query method according to claim 5, wherein the step of performing an intent optimization operation on the current query intent according to the initial search result to obtain an optimized query intent comprises the following steps: Acquiring the data distribution attribute of the initial search result; judging whether the current query intention has keywords corresponding to the data distribution attributes or not; and when the keywords corresponding to the data distribution attributes do not exist, performing keyword expansion and reduction operation on the initial detection result according to the data distribution attributes to obtain the optimized query intention.
  7. 7. The data query method according to claim 5, wherein the step of performing an intent optimization operation on the current query intent according to the initial search result to obtain an optimized query intent comprises the following steps: calculating a relevance score of the initial search result and the current query intention; judging whether the relevance score meets a preset relevance threshold value or not; And when the preset relevance threshold is not met, carrying out semantic refinement and explicit operation on the current query intention to obtain the optimized query intention.
  8. 8. A data query device, comprising: the data query text acquisition module is used for acquiring a data query text; The semantic feature extraction module is used for carrying out semantic feature extraction operation on the data query text according to a natural language processing model to obtain a semantic query vector; The candidate service table acquisition module is used for reading the constructed vector database and indexing a candidate service table corresponding to the semantic query vector in the constructed vector database; The prompt word integration module is used for carrying out prompt word integration operation on the data query text according to the structured prompt word template to obtain the current query intention; the intention reasoning module is used for inputting the candidate business table and the current query intention into a large language model to perform intention reasoning operation so as to obtain a structured query statement; and the sentence retrieval module is used for reading a system database and performing sentence retrieval operation on the structured query sentence in the system database to obtain a target retrieval result.
  9. 9. A computer device comprising a memory and a processor, wherein the memory has stored therein computer readable instructions which when executed by the processor implement the steps of the data querying method according to any of claims 1 to 7.
  10. 10. A computer readable storage medium having stored thereon computer readable instructions which when executed by a processor implement the steps of the data querying method according to any of claims 1 to 7.

Description

Data query method, device, computer equipment and storage medium Technical Field The present application relates to the field of data processing and querying technologies, and in particular, to a data querying method, a data querying device, a computer device, and a storage medium. Background In the present digital age, the data volume is increased explosively, and various business systems accumulate massive data. Traditional data query methods rely primarily on users to precisely input structured query statements, such as SQL (structured query language) statements, which presents great difficulty to non-professional users because they may be unfamiliar with complex grammar rules and database structures. However, applicants have found that with the continued development of natural language processing techniques, while some preliminary attempts to understand natural language queries have emerged, these approaches have a number of shortcomings in processing complex semantics, understanding the user's actual intent, and generating accurate query statements. For example, for some query texts with implicit semantics or fuzzy expressions, the traditional method is difficult to accurately analyze and convert into effective query instructions, so that the query results are inaccurate or incomplete, and the actual requirements of users cannot be met. Disclosure of Invention The embodiment of the application aims to provide a data query method, a data query device, computer equipment and a storage medium, so as to solve the problem of inaccurate query results in the prior art. In order to solve the above technical problems, the embodiment of the present application provides a data query method, which adopts the following technical schemes: acquiring a data query text; Carrying out semantic feature extraction operation on the data query text according to a natural language processing model to obtain a semantic query vector; Reading a constructed vector database, and indexing a candidate service table corresponding to the semantic query vector in the constructed vector database; Performing prompt word integration operation on the data query text according to the structured prompt word template to obtain the current query intention; Inputting the candidate service table and the current query intention into a large language model to perform intention reasoning operation to obtain a structured query statement; And reading a system database, and performing sentence retrieval operation on the structured query sentence in the system database to obtain a target retrieval result. In order to solve the above technical problems, the embodiment of the present application further provides a data query device, which adopts the following technical scheme: the data query text acquisition module is used for acquiring a data query text; The semantic feature extraction module is used for carrying out semantic feature extraction operation on the data query text according to a natural language processing model to obtain a semantic query vector; The candidate service table acquisition module is used for reading the constructed vector database and indexing a candidate service table corresponding to the semantic query vector in the constructed vector database; The prompt word integration module is used for carrying out prompt word integration operation on the data query text according to the structured prompt word template to obtain the current query intention; the intention reasoning module is used for inputting the candidate business table and the current query intention into a large language model to perform intention reasoning operation so as to obtain a structured query statement; and the sentence retrieval module is used for reading a system database and performing sentence retrieval operation on the structured query sentence in the system database to obtain a target retrieval result. In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical schemes: Comprising a memory having stored therein computer readable instructions which when executed by a processor implement the steps of the data query method as described above. In order to solve the above technical problems, an embodiment of the present application further provides a computer readable storage medium, which adopts the following technical schemes: The computer readable storage medium has stored thereon computer readable instructions which when executed by a processor implement the steps of the data querying method as described above. The application provides a data query method which comprises the steps of obtaining a data query text, carrying out semantic feature extraction operation on the data query text according to a natural language processing model to obtain a semantic query vector, reading a constructed vector database, indexing a candidate service table corresponding