Data query method and device, electronic equipment and storage medium

By determining the target information and query types in natural language problems, and generating structured information for data query, the problem of inaccurate information extraction in the prior art is solved, and the accuracy and reliability of data query are improved.

CN119646121APending Publication Date: 2025-03-18BEIJING JINGDONG YUANSHENG TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411548053.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

The prior art cannot ensure the accuracy and reliability of information extraction in natural language problems, resulting in a decrease in the accuracy and reliability of data query.

Method used

By obtaining the query request, the target information is determined, including indicator information used to describe the indicator to be queried, and the query request is classified into the query request to obtain the query type. Structured information is generated based on the target information and query types, and data query is carried out through structured information to obtain query results.

Benefits of technology

It realizes the accurate extraction and classification of core information in natural language problems, and improves the accuracy and reliability of data query.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119646121A_ABST
    Figure CN119646121A_ABST
Patent Text Reader

Abstract

The invention provides a data query method and device, electronic equipment and a storage medium, and relates to the technical field of computers. The method comprises the steps of obtaining a query request; determining target information contained in the query request, wherein the target information comprises index information used for describing the to-be-queried index; performing problem classification on the query request to obtain a query type; and generating structured information according to the target information and the query type, and performing data query through the structured information to obtain a query result. According to the method and the device, the target information in the query request can be acquired through a standardized process, and the query request is classified, so that the structured information can be determined according to the target information and the query type, and the accuracy and the reliability of extracting the core information in the natural language problem are realized; and the accuracy and reliability of data query are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] With the development of computer technology, it is possible to perform data queries based on natural language questions sent by users and return the answers to the users.

[0003] In related technologies, natural language questions can be converted into SQL query statements based on NLP2SQL (Natural Language Processing to Structured Query Language) technology to implement database queries. However, this NLP2SQL technology relies on text segmentation, keyword matching, etc., cannot support flexible natural language questions, requires a large amount of data training and cannot be migrated. Text segmentation technology also has limitations and may not be able to effectively extract the core information in natural language questions.

[0004] Therefore, the methods provided by related technologies cannot ensure the accuracy and reliability of core information extraction in natural language questions, thereby reducing the accuracy and reliability of data queries.

[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0006] The present disclosure provides a data query method, device, electronic device and storage medium, which at least to a certain extent overcome the problem that related technologies cannot ensure the accuracy and reliability of information extraction in natural language questions, thereby reducing the accuracy and reliability of data query.

[0007] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.

[0008] According to one aspect of the present disclosure, a data query method is provided, comprising:

[0009] Get the query request;

[0010] Determine target information included in the query request, wherein the target information includes indicator information for describing the indicator to be queried;

[0011] Classifying the query request to obtain a query type;

[0012] Structured information is generated according to the target information and the query type, and a data query is performed using the structured information to obtain a query result.

[0013] In some exemplary embodiments, determining the target information included in the query request includes:

[0014] Obtaining an embedding vector according to the query request;

[0015] Determine the similarity between the embedding vector and each target vector pre-stored in the vector database, respectively, wherein the embedding vector corresponds to one similarity with any pre-stored target vector;

[0016] The target information is determined by the target vector whose corresponding similarity meets the preset screening condition.

[0017] In some exemplary embodiments, determining the target information by corresponding target vectors whose similarities satisfy preset screening conditions includes:

[0018] Combine multiple target vectors with corresponding prompt sentences to obtain candidate prompt information;

[0019] The target information is obtained by screening the target vectors whose corresponding similarities meet the preset screening conditions through the candidate item prompt information.

[0020] In some exemplary embodiments, the target information further includes context information for describing the query background; wherein determining the target information included in the query request includes:

[0021] The indicator information and context information included in the query request are determined respectively.

[0022] In some exemplary embodiments, the query request further includes time information, and the method further includes:

[0023] Determine the time dimension information and date information corresponding to the query request;

[0024] Time information in a target format is obtained according to the time dimension information and the date information, where the time information includes at least one of a start time and an end time.

[0025] In some exemplary embodiments, classifying the query request to obtain a query type includes:

[0026] Determine the rough classification type of the query request according to the indicator information, and any rough classification type includes at least one query type;

[0027] The query type of the query request is determined according to the context information, at least one of the time information, and the coarse classification type.

[0028] In some exemplary embodiments, the rough classification type includes at least one of an indicator query, a ranking query, a trend query, a year-on-year query, and a month-on-month query;

[0029] Among them, the query type in the indicator query includes at least one of a single indicator query, a multi-indicator query, and an aggregation query, and the query type in the sorting query includes at least one of a time sorting query and a region sorting query.

[0030] According to another aspect of the present disclosure, there is also provided a data query device, comprising:

[0031] A query request acquisition module, used to acquire a query request;

[0032] A target information determination module, used to determine the target information included in the query request, wherein the target information includes indicator information for describing the indicator to be queried;

[0033] A question classification module, used to classify the query request to obtain a query type;

[0034] The data query module is used to generate structured information according to the target information and the query type, and perform data query through the structured information to obtain query results.

[0035] In some exemplary embodiments, the target information determination module is used to obtain an embedded vector according to the query request; respectively determine the similarity between the embedded vector and each target vector pre-stored in a vector database, wherein the embedded vector corresponds to one similarity with any pre-stored target vector; and determine the target information through the target vector whose corresponding similarity meets a preset filtering condition.

[0036] In some exemplary embodiments, the target information determination module is used to combine multiple target vectors with corresponding prompt statements to obtain candidate prompt information; through the candidate prompt information, the corresponding target vectors whose similarities meet the preset filtering conditions are screened to obtain the target information.

[0037] In some exemplary embodiments, the target information also includes context information for describing the query background; the target information determination module is used to respectively determine the indicator information and context information contained in the query request.

[0038] In some exemplary embodiments, the query request also includes time information. The data query device provided by the embodiment of the present disclosure further includes:

[0039] The time information determination module is used to determine the time dimension information and date information corresponding to the query request; obtain the time information in the target format according to the time dimension information and the date information, and the time information includes at least one of the start time and the end time.

[0040] In some exemplary embodiments, the question classification module is used to determine the coarse classification type of the query request based on the indicator information, and any coarse classification type includes at least one query type; and determine the query type of the query request based on the context information, at least one of the time information, and the coarse classification type.

[0041] In some exemplary embodiments, the rough classification type includes at least one of an indicator query, a ranking query, a trend query, a year-on-year query, and a month-on-month query;

[0042] Among them, the query type in the indicator query includes at least one of a single indicator query, a multi-indicator query, and an aggregation query, and the query type in the sorting query includes at least one of a time sorting query and a region sorting query.

[0043] According to another aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any one of the above-mentioned data query methods by executing the executable instructions.

[0044] According to another aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, any one of the above-mentioned data query methods is implemented.

[0045] According to another aspect of the present disclosure, a computer program product or computer program is provided, the computer program product or computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device executes the data query method provided in various optional ways in any embodiment of the present disclosure.

[0046] The technical solution provided in the embodiments of the present disclosure can achieve the acquisition of target information in query requests and classify query requests through a standardized process, so that structured information can be determined according to the target information and the query type, thereby achieving the accuracy and reliability of extracting core information in natural language questions and improving the accuracy and reliability of data queries.

[0047] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.

[0049] Figure 1 A schematic diagram showing a system architecture in an embodiment of the present disclosure;

[0050] Figure 2 A flow chart of a data query method in an embodiment of the present disclosure is shown;

[0051] Figure 3 A flow chart of a method for determining target information included in a query request according to an embodiment of the present disclosure is shown;

[0052] Figure 4 A schematic diagram of a process for generating structured information in an embodiment of the present disclosure is shown;

[0053] Figure 5 A schematic diagram of a data query device in an embodiment of the present disclosure is shown;

[0054] Figure 6 A structural block diagram of an electronic device according to an embodiment of the present disclosure is shown;

[0055] Figure 7 A schematic diagram of a computer-readable storage medium in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0056] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0057] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0058] The specific implementation of the embodiment of the present disclosure is described in detail below with reference to the accompanying drawings.

[0059] Figure 1 FIG. 1 shows an exemplary application system architecture diagram to which the data query method in the embodiment of the present disclosure can be applied. Figure 1 As shown, the system architecture may include a terminal device 101 , a network 102 and a server 103 .

[0060] Among them, the user can input a query request through the terminal device 101. Then, the terminal device 101 can determine the target information contained in the query request, and the target information includes indicator information for describing the indicator to be queried. In addition, the terminal device 101 can classify the query request to obtain a query type. Then, the terminal device 101 can generate structured information according to the target information and the query type. The terminal device 101 can send the structured information to the server 103 to perform data query through the structured information to obtain a query result.

[0061] Alternatively, the user may input a query request through the terminal device 101. The terminal device 101 may send the query request to the server 103. Then, the server 103 determines the target information contained in the query request, and the target information includes the indicator information used to describe the indicator to be queried. In addition, the server 103 may classify the query request to obtain the query type. Then, the server 103 may generate structured information according to the target information and the query type, and perform data query through the structured information to obtain the query result. Finally, the server 103 may return the query result to the terminal 101.

[0062] The network 102 is a medium for providing a communication link between the terminal device 101 and the server 103, and can be a wired network or a wireless network.

[0063] Optionally, the wireless network or wired network described above uses standard communication technology and / or protocol. The network is usually the Internet, but it can also be any network, including but not limited to a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a dedicated network or any combination of a virtual private network). In some embodiments, the data exchanged through the network is represented by technologies and / or formats including Hyper Text Mark-up Language (HTML), Extensible Markup Language (XML), etc. In addition, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPSec) can also be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies can also be used to replace or supplement the above data communication technologies.

[0064] The terminal device 101 can be various electronic devices, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, smart speakers, smart watches, wearable devices, augmented reality devices, virtual reality devices, etc.

[0065] Optionally, the client of the application installed in different terminal devices 101 is the same, or the client of the same type of application based on different operating systems. Based on the different terminal platforms, the specific form of the client of the application can also be different, for example, the application client can be a mobile client, a PC client, etc.

[0066] The server 103 may be a server that provides various services, such as a background management server that provides support for the device operated by the user using the terminal device 101. The background management server may analyze and process the received request and other data, and feed back the processing results to the terminal device.

[0067] Optionally, the server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.

[0068] Those skilled in the art will know that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration, and any number of terminal devices, networks and servers may be provided according to actual needs, and the embodiments of the present disclosure do not limit this.

[0069] Under the above system architecture, a data query method is provided in an embodiment of the present disclosure, and the method can be executed by any electronic device with computing and processing capabilities.

[0070] In some embodiments, the data query method provided in the embodiments of the present disclosure can be executed by a terminal device of the above-mentioned system architecture; in other embodiments, the data query method provided in the embodiments of the present disclosure can be executed by a server in the above-mentioned system architecture; in other embodiments, the data query method provided in the embodiments of the present disclosure can be implemented by the terminal device and the server in the above-mentioned system architecture through interaction.

[0071] Figure 2 A flow chart of a data query method in an embodiment of the present disclosure is shown as follows: Figure 2 As shown, the data query method provided in the embodiment of the present disclosure includes the following steps S202 to S208.

[0072] S202, obtaining a query request.

[0073] The embodiments of the present disclosure do not limit the content of the query request, and the query request can be determined according to the application scenario.

[0074] For example, the application scenario may be an e-commerce system data query, and the query request may be to query the number of orders placed in the e-commerce system during a certain period of time, or the year-on-year change in the number of returns, etc. For another example, the application scenario may be a logistics system data query, and the query request may be to query which region has the highest cargo damage rate on a certain day, or the monthly damage rate of shipments in a certain region, etc.

[0075] In some exemplary embodiments, the query request may be a question input by a user in natural language. Therefore, the database cannot directly query data through the query request, and needs to process the query request to generate a language that can be recognized by the database.

[0076] S204, determining target information included in the query request, where the target information includes indicator information used to describe the indicator to be queried.

[0077] In an exemplary embodiment, the embodiment of the present disclosure may pre-store a plurality of target information to be screened. After obtaining a query request, the target information hit by the query request may be determined from the plurality of target information to be screened.

[0078] In some possible implementations, the query request may be converted into an embedding vector, and then the similarity between the embedding vector and the vectors corresponding to the plurality of target information to be screened pre-stored in the vector database is calculated, so as to determine the target information hit by the query request. Alternatively, the target information may be determined by performing semantic recognition on the query request, etc. The embodiment of the present disclosure does not limit the number of the target information.

[0079] Any indicator information may include at least one of an indicator name, an indicator code, and an indicator table. For example, the indicator name may be, for example, a damage rate of goods, a return volume, order data, etc. Any indicator name corresponds to a unique indicator code. The indicator table is used to indicate the table name corresponding to the indicator information stored in the database.

[0080] In some exemplary embodiments, the target information may also include context information for describing the query background. In this case, determining the target information included in the query request may include: respectively determining the indicator information and the context information included in the query request.

[0081] Exemplarily, the context information may include region information, venue information, etc. The region information may be, for example, a province, a city, an urban area, etc., and the venue information may be, for example, a logistics transfer center, a warehouse, etc.

[0082] Taking the query request "What is the cargo damage rate at site A in August this year?" as an example, the indicator information may be the cargo damage rate, and the context information may be site A.

[0083] For example, Figure 3 As shown, determining the target information included in the query request may include the following steps S2042 to S2046.

[0084] S2042, obtaining an embedding vector according to the query request.

[0085] In an exemplary embodiment, the query request may be preprocessed and embedded to obtain a corresponding embedding vector. For example, the query request may be processed by a model such as BERT (Bidirectional Encoder Representations from Transformers) or RoBERTa (Robustly Optimized BERTPretraining Approach) to obtain an embedding vector.

[0086] S2044, respectively determining similarities between the embedded vector and each target vector pre-stored in the vector database, wherein the embedded vector corresponds to one similarity with any pre-stored target vector.

[0087] The disclosed embodiments may be pre-stored in a vector database, which may be, for example, a Vearch (a vector database system) vector database. It should be noted that the Vearch vector database may be used to convert text language into high-dimensional vectors and store them in a database.

[0088] Exemplarily, the plurality of target information to be screened pre-stored in the vector database may include indicator information and context information. Among them, for the indicator information, any indicator information may correspond to a metadata and an indicator vector, so the vector database may store the metadata and indicator vector corresponding to each indicator information. Similarly, any context information may correspond to a metadata and a context vector, so the vector database may store the metadata and context vector corresponding to each context information.

[0089] Exemplarily, the metadata corresponding to any indicator information may include at least one of the indicator name, indicator code, and the table where the indicator is located. In addition, the metadata may also include indicator calculation logic, etc. Exemplarily, the indicator calculation logic is used to describe the calculation method of the indicator information. The indicator calculation logic can be in the form of sum(numerator) / sum(denominator), sum(numerator), count(numerator), count(numerator) / count(denominator), etc., where the numerator and denominator are specific fields in the data table. In addition, the indicator vector corresponding to any indicator information can be used to represent the indicator name of the indicator information. In addition, the metadata corresponding to any context information may include at least one of the context name, context code, and the table where the context is located.

[0090] In an exemplary embodiment, the indicator vector and the context vector can be obtained by processing models such as Bge-large_zh (a large-scale pre-trained model for natural language processing tasks), BERT, and RoBERTa. It should be noted that Bge-large_zh can be used to convert text language into a database of high-dimensional vectors.

[0091] In some exemplary embodiments, after obtaining the embedding vector corresponding to the query request, the similarity between the embedding vector and each pre-stored target vector may be calculated respectively, and each target vector whose corresponding similarity meets the preset screening condition is recalled.

[0092] It should be noted that the target vector includes an indicator vector. In some possible embodiments, the target vector may also include a context vector.

[0093] S2046, determining the target information through the target vectors whose corresponding similarities satisfy the preset screening conditions.

[0094] Exemplarily, the preset filtering condition may be a similarity threshold, and when the similarity corresponding to any target vector is greater than the similarity threshold, the preset filtering condition is satisfied. Alternatively, the target vector satisfying the preset filtering condition may be determined by a Topk recall method. In this case, the preset filtering condition may be to sort the similarities from large to small, so that the k target vectors with the largest corresponding similarities are the target vectors satisfying the preset filtering condition, where k is a positive integer.

[0095] In some possible implementations, the target information corresponding to the target vector that meets the preset screening condition can be used as the screened target information. Alternatively, in other possible implementations, the target vector that meets the preset screening condition can be subjected to large model matching recall to achieve further screening, thereby determining the screened target information.

[0096] In some exemplary embodiments, target information is determined by target vectors whose corresponding similarities satisfy preset filtering conditions, including: combining multiple target vectors with corresponding Prompts to obtain candidate prompt information; and filtering target vectors whose corresponding similarities satisfy preset filtering conditions to obtain target information through the candidate prompt information.

[0097] The present disclosure embodiment does not limit the prompt sentence, and the prompt sentence can be determined based on experience or application scenarios. After the target vector is combined with the corresponding prompt sentence to obtain candidate prompt information, the candidate prompt information can be input into the large model, and the target information can be obtained by filtering the output of the large model.

[0098] In a possible embodiment, the query request may be, for example, "How many damaged packages were there yesterday?" First, the indicator information may be roughly recalled by similarity. For example, the roughly recalled indicator information may include 10 indicator information such as damage rate, damage amount, and fresh damage amount. Then, the query request, the roughly recalled indicator information, and the prompt statement may be input into the large model. The large model may further filter the roughly recalled indicator information. For example, the damage amount among the above 10 roughly recalled indicator information may be determined as the target information.

[0099] In some exemplary embodiments, the query request may also include time information. In this case, the data query method provided by the embodiment of the present disclosure may also include: determining the time dimension information and date information corresponding to the query request; obtaining the time information in the target format according to the time dimension information and the date information, the time information including at least one of the start time and the end time.

[0100] Exemplarily, the time dimension information may be year, month, day, quarter, week, etc. In addition, the date information may be a specific date, such as August 2, January 30, etc. Alternatively, the date information may also be a relative time expression describing a date, such as yesterday, the day before yesterday, the past three days, the past week, last month, etc.

[0101] Therefore, the time dimension information and date information contained in the query request can be determined first, so as to convert the time expression in the query request into the time information in the target format through the corresponding prompt statement. For example, the target format can be a list containing the start time and the end time. If only one day is mentioned in the query request, the start time and the end time in the table are the same.

[0102] Exemplarily, the present application can determine the time dimension information and date information through a large model, thereby converting the expression in the query request into a target format and ensuring the accuracy of the conversion.

[0103] The embodiment of the present disclosure does not limit the order in which the three threads of determining time information, determining target information, and classifying questions for query requests are executed, or the three threads may be executed simultaneously.

[0104] S206: classify the query request to obtain a query type.

[0105] In an exemplary embodiment, the corresponding query type can be obtained by inputting the classification prompt statement and the query request into the big model.

[0106] In some exemplary embodiments, query requests are classified to obtain query types, including: determining a coarse classification type of the query request based on indicator information, any coarse classification type includes at least one query type; and determining the query type of the query request based on context information, at least one of time information and the coarse classification type.

[0107] In some exemplary embodiments, the coarse classification type includes at least one of an indicator query, a ranking query, a trend query, a year-on-year query, and a quarter-on-quarter query.

[0108] Exemplarily, the query type in the indicator query includes at least one of a single indicator query, a multi-indicator query, and an aggregation query, and the query type in the sorting query includes at least one of a time sorting query and a region sorting query.

[0109] In some embodiments, a single indicator query can be used to query a single indicator information. A multi-indicator query can be used to query multiple indicator information. An aggregate query can be used to aggregate and query multiple indicator information.

[0110] In some embodiments, the time-sorted query can be used, for example, to obtain the maximum or minimum value of a certain indicator information on a certain day, or to obtain the top k indicators of a certain indicator on a certain day, ranked from large to small. The area-sorted query can be used, for example, to obtain which area in a certain range has the highest damage rate on a certain day, or to obtain the top k areas in a certain range with the highest damage rate on a certain day, ranked from large to small.

[0111] In some embodiments, trend query can be used to query the trend change of a certain indicator within a certain period of time. Year-on-year query can be used to query the year-on-year change of a certain indicator. Month-on-month query can be used to query the month-on-month change of a certain indicator.

[0112] In an exemplary embodiment, questions may be pre-classified into five categories: index query, ranking query, trend query, year-on-year query, and quarter-on-quarter query. Then, based on target information or based on target information and time information, the coarse classification corresponding to the query request is determined, and the query type in the coarse classification hit by the query request is determined.

[0113] S208, generating structured information according to the target information and the query type, and performing data query through the structured information to obtain query results.

[0114] For example, multiple structured information to be screened can be obtained by combining target information, time information, and query type. Then, the final structured information can be obtained by Top1 screening.

[0115] In an exemplary embodiment, the structured information may be determined based on a database used for data query, and exemplarily, the structured information may be a SQL query statement, or may be a JSON (JavaScript Object Notation, an object representation) language, etc. After the SQL query statement is determined, the SQL statement query may be performed according to the corresponding SQL type classification.

[0116] In an exemplary embodiment, a schematic diagram of a process for generating structured information provided by an embodiment of the present disclosure can be as follows: Figure 4 shown.

[0117] In this Figure 4 In the vector database, metadata corresponding to the indicator information, regional information, and venue information and the target vector can be pre-stored, wherein any indicator information corresponds to the indicator name, indicator code, and the indicator table, etc., any regional information corresponds to the regional name, regional code, etc., and any venue information corresponds to the venue name, venue code, etc.

[0118] When a user sends a query request, the similarity between the embedding vector corresponding to the query request and each target vector can be calculated through the vector database, and Topk recall and large model recall can be performed to determine the target information. In addition, the Pipeline can start three threads to perform the tasks of target information extraction, time information extraction, and query request classification. The above three threads can determine the corresponding information based on the corresponding prompt sentence and small sample.

[0119] Then, you can use the target information, time information, and query type to form structured information and confirm the Top 1. After determining the SQL query statement, you can perform SQL statement query according to the corresponding SQL type classification.

[0120] The method provided by the embodiment of the present disclosure can obtain the target information in the query request and classify the query request through a standardized process, so that the structured information can be determined according to the target information and the query type, thereby achieving the accuracy and reliability of extracting the core information in the natural language question and improving the accuracy and reliability of data query.

[0121] It should be noted that since the three threads of target information, time information and query type determination in this application can be carried out simultaneously, the embodiment of the present disclosure can further improve efficiency while achieving accuracy and reliability in extracting core information in natural language questions.

[0122] It should be noted that the acquisition, storage, use, and processing of data in the technical solution disclosed in this disclosure are in compliance with the relevant provisions of national laws and regulations, and various types of data such as personal identity data, operation data, behavioral data, etc. related to individuals, customers, and groups obtained in the embodiments of this disclosure have all been authorized.

[0123] Based on the same inventive concept, the present disclosure also provides a data query device in the following embodiments. Since the principle of solving the problem in the device embodiment is similar to that in the above method embodiment, the implementation of the device embodiment can refer to the implementation of the above method embodiment, and the repeated parts will not be repeated.

[0124] Figure 5 A schematic diagram of a data query device in an embodiment of the present disclosure is shown. Figure 5 As shown, the device comprises:

[0125] A query request acquisition module 501, used to acquire a query request;

[0126] A target information determination module 502, configured to determine target information included in the query request, wherein the target information includes indicator information for describing the indicator to be queried;

[0127] A question classification module 503 is used to classify the query request to obtain a query type;

[0128] The data query module 504 is used to generate structured information according to the target information and the query type, and perform data query through the structured information to obtain query results.

[0129] In some exemplary embodiments, the target information determination module 502 is used to obtain an embedded vector according to the query request; respectively determine the similarity between the embedded vector and each target vector pre-stored in the vector database, wherein the embedded vector corresponds to one similarity with any pre-stored target vector; and determine the target information through the target vector whose corresponding similarity meets the preset filtering condition.

[0130] In some exemplary embodiments, the target information determination module 502 is used to combine multiple target vectors with corresponding prompt statements to obtain candidate prompt information; through the candidate prompt information, the corresponding target vectors whose similarities meet the preset filtering conditions are filtered to obtain the target information.

[0131] In some exemplary embodiments, the target information also includes context information for describing the query background; the target information determination module 502 is used to respectively determine the indicator information and context information included in the query request.

[0132] In some exemplary embodiments, the query request also includes time information. The data query device provided by the embodiment of the present disclosure further includes:

[0133] The time information determination module is used to determine the time dimension information and date information corresponding to the query request; obtain the time information in the target format according to the time dimension information and the date information, and the time information includes at least one of the start time and the end time.

[0134] In some exemplary embodiments, the question classification module 503 is used to determine the coarse classification type of the query request based on the indicator information, and any coarse classification type includes at least one query type; and determine the query type of the query request based on the context information, at least one of the time information, and the coarse classification type.

[0135] In some exemplary embodiments, the rough classification type includes at least one of an indicator query, a ranking query, a trend query, a year-on-year query, and a month-on-month query;

[0136] Among them, the query type in the indicator query includes at least one of a single indicator query, a multi-indicator query, and an aggregation query, and the query type in the sorting query includes at least one of a time sorting query and a region sorting query.

[0137] It should be noted that the query request acquisition module 501, the target information determination module 502, the question classification module 503, and the data query module 504 correspond to S202 to S208 in the method embodiment, and the examples and application scenarios implemented by the above modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above method embodiment. It should be noted that the above modules, as part of the device, can be executed in a computer system such as a set of computer executable instructions.

[0138] The device provided by the embodiment of the present disclosure can acquire target information in a query request and classify the query request through a standardized process, so that structured information can be determined according to the target information and the query type, thereby achieving accuracy and reliability in extracting core information in natural language questions and improving the accuracy and reliability of data queries.

[0139] Those skilled in the art will appreciate that various aspects of the present disclosure may be implemented as systems, methods or program products. Therefore, various aspects of the present disclosure may be specifically implemented in the following forms, namely: complete hardware implementation, complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as "circuits", "modules" or "systems".

[0140] The present disclosure embodiment provides an electronic device, which exemplarily includes: a processor and a memory. The memory can be used to store executable instructions of the processor. The processor is configured to perform the data query method provided by the present disclosure embodiment by executing the above executable instructions.

[0141] Refer to the following Figure 6 The electronic device 600 according to this embodiment of the present disclosure is described. Figure 6 The electronic device 600 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0142] like Figure 6 As shown, the electronic device 600 is in the form of a general computing device. The components of the electronic device 600 may include but are not limited to: at least one processing unit 610, at least one storage unit 620, and a bus 630 connecting different system components (including the storage unit 620 and the processing unit 610).

[0143] The storage unit stores a program code, which can be executed by the processing unit 610, so that the processing unit 610 performs the steps of various exemplary embodiments of the present disclosure described in the above “Exemplary Method” section of this specification. For example, the processing unit 610 can perform the following steps of the above method embodiment:

[0144] Obtain a query request; determine the target information contained in the query request, wherein the target information includes indicator information used to describe the indicator to be queried; classify the query request to obtain a query type; generate structured information according to the target information and the query type, and perform data query through the structured information to obtain a query result.

[0145] The storage unit 620 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 6201 and / or a cache memory unit 6202 , and may further include a read-only memory unit (ROM) 6203 .

[0146] The storage unit 620 may also include a program / utility 6204 having a set (at least one) of program modules 6205, such program modules 6205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0147] Bus 630 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0148] The electronic device 600 may also communicate with one or more external devices 640 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 600, and / or communicate with any device that enables the electronic device 600 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 650. Furthermore, the electronic device 600 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 660. As shown, the network adapter 660 communicates with other modules of the electronic device 600 via a bus 630. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.

[0149] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.

[0150] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart may be implemented as a computer program product, which includes: a computer program, which implements the above data query method when executed by a processor.

[0151] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a computer program is stored, and when the computer program is executed by a processor, the data query method provided in the embodiment of the present disclosure can be implemented. The computer-readable storage medium can be a readable signal medium or a readable storage medium.

[0152] Figure 7 A schematic diagram of a computer-readable storage medium in an embodiment of the present disclosure is shown. Figure 7As shown, a program product capable of implementing the above method of the present disclosure is stored on the computer-readable storage medium 700. In some possible implementations, various aspects of the present disclosure may also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary implementations of the present disclosure described in the above “Exemplary Method” section of this specification.

[0153] More specific examples of computer-readable storage media in the present disclosure may include, but are not limited to, an electrical connection having one or more conductors, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0154] In the present disclosure, a computer readable storage medium may include a data signal propagated in baseband or as part of a carrier wave, wherein a readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A readable signal medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0155] Alternatively, the program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

[0156] In a specific implementation, the program code for performing the operation of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).

[0157] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.

[0158] In addition, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.

[0159] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the implementation of the present disclosure.

[0160] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The description and examples are to be regarded as exemplary only, and the true scope of the present disclosure is indicated by the appended claims.

Claims

1. A data query method, characterized in that: include: Get the query request; Determine target information included in the query request, wherein the target information includes indicator information for describing the indicator to be queried; Classifying the query request to obtain a query type; Structured information is generated according to the target information and the query type, and a data query is performed using the structured information to obtain a query result.

2. The data query method according to claim 1, characterized in that: The determining the target information included in the query request includes: Obtaining an embedding vector according to the query request; Determine the similarity between the embedding vector and each target vector pre-stored in the vector database, respectively, wherein the embedding vector corresponds to one similarity with any pre-stored target vector; The target information is determined by the target vector whose corresponding similarity meets the preset screening condition.

3. The data query method according to claim 2, characterized in that: The target information is determined by the target vector whose corresponding similarity satisfies the preset screening condition, including: Combine multiple target vectors with corresponding prompt sentences to obtain candidate prompt information; The target information is obtained by screening the target vectors whose corresponding similarities meet the preset screening conditions through the candidate item prompt information.

4. The data query method according to any one of claims 1 to 3, characterized in that: The target information also includes context information for describing the query background; The step of determining the target information included in the query request includes: The indicator information and context information included in the query request are determined respectively.

5. The data query method according to claim 4, characterized in that: The query request also includes time information, and the method further includes: Determine the time dimension information and date information corresponding to the query request; Time information in a target format is obtained according to the time dimension information and the date information, where the time information includes at least one of a start time and an end time.

6. The data query method according to claim 5, characterized in that: The query request is classified into question categories to obtain a query type, including: Determine the rough classification type of the query request according to the indicator information, and any rough classification type includes at least one query type; The query type of the query request is determined according to the context information, at least one of the time information, and the coarse classification type.

7. The data query method according to claim 6, characterized in that: The rough classification type includes at least one of an indicator query, a ranking query, a trend query, a year-on-year query, and a month-on-month query; Among them, the query type in the indicator query includes at least one of a single indicator query, a multi-indicator query, and an aggregation query, and the query type in the sorting query includes at least one of a time sorting query and a region sorting query.

8. A data query device, characterized in that: include: A query request acquisition module, used to acquire a query request; A target information determination module, used to determine the target information included in the query request, wherein the target information includes indicator information for describing the indicator to be queried; A question classification module, used to classify the query request to obtain a query type; The data query module is used to generate structured information according to the target information and the query type, and perform data query through the structured information to obtain query results.

9. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; Wherein, the processor is configured to execute the data query method described in any one of claims 1 to 7 by executing the executable instructions.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the data query method according to any one of claims 1 to 7 is implemented.

11. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device executes the data query method as described in any one of claims 1 to 7.

Citation Information

Cited By

  • Project subsidy query method, electronic equipment and storage medium

    CN121524230A