Statement query method and device, electronic equipment and storage medium
Through pre-trained target intent recognition models and task processing components, intent recognition and query instruction generation are performed on the query statement, which solves the problem of insufficient accuracy and controllability of query intent recognition results in the existing technology, and achieves a more efficient database. Query.
Patent Information
- Application Number
- CN202411447295.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2025-01-21
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art has shortcomings in the accuracy and controllability of query intent identification results, especially when handling complex associations between multiple database tables.
The pre-trained target intent recognition model identifies the query statement to be obtained, obtains the intent category and information parameters, processes the information parameters to generate query instructions based on the task processing component corresponding to the intent category, and searches the target data from the database to generate query results.
It improves the accuracy and controllability of the query results of the query statement, and can more effectively handle complex relationships between multiple database tables.
Smart Images

Figure CN119336782A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of natural language processing, and in particular to a statement query method, device, electronic device and storage medium. Background Art
[0002] With the rapid development of Internet technology, more and more intelligent interaction methods have gradually penetrated into daily life. At present, Qwen-14B is a high-performance open source model that supports multiple languages. Compared with similar models, it uses more high-quality data, and the overall training data exceeds 3 trillion tokens, which makes the model have more powerful reasoning, cognition, planning and memory capabilities. However, data query needs to deal with the complex associations between multiple database tables, and Qwen-14B lacks accuracy and controllability in query intent recognition results. Therefore, designing a method with high accuracy and strong controllability for statement query has become an urgent problem to be solved. Summary of the invention
[0003] The present application provides a statement query method, device, electronic device and storage medium, which can improve the accuracy and controllability of query results for query statements.
[0004] In a first aspect, the present application provides a statement query method, the method comprising:
[0005] Recognize the query statement through the pre-trained target intent recognition model to obtain the intent category and information parameters of the query statement;
[0006] Processing the information parameters based on the task processing component corresponding to the intent category to obtain a query instruction;
[0007] Based on the query instruction, the corresponding target data is searched from the database, and based on the target data, the query result of the query statement is generated.
[0008] Furthermore, the query instruction includes a structured query language SQL query statement and retrieval keywords; the information parameters are processed based on the task processing component corresponding to the intent category to obtain a query instruction, including: if the intent category is a data query intent, the information parameters are processed based on the data query component to obtain a target SQL query statement; if the intent category is a text query intent, the information parameters are processed based on the text query component to obtain a retrieval keyword.
[0009] Furthermore, the information parameters include key fields in the statement to be queried, key values of the key fields, and database table names corresponding to the key fields; the information parameters are processed based on the data query component to obtain a target SQL query statement, including: calling a SQL statement generation tool based on the database table name, the key fields and the key values to generate an initial SQL query statement; and fine-tuning the initial SQL query statement to obtain a target SQL query statement.
[0010] Furthermore, the initial SQL query statement is fine-tuned to obtain a target SQL query statement, including: determining an initial statement skeleton corresponding to the initial SQL query statement; performing similarity matching between the initial statement skeleton and a statement skeleton sample library to obtain a target statement skeleton; and generating the target SQL query statement based on the target statement skeleton and data in the initial SQL query statement.
[0011] Furthermore, after the query statement is identified by a pre-trained target intent recognition model to obtain the intent category and information parameters of the query statement, it also includes: determining multiple entities in the query statement and the logical relationship between the entities based on the information parameters; determining multiple subtasks for executing the query task corresponding to the query statement based on the multiple entities and the logical relationship; determining the node information of each subtask, and using a preset byte structure to store the node information of each subtask, wherein the node information of each subtask includes a local index of the adjacent subtask corresponding to each subtask.
[0012] Furthermore, the method also includes: performing an authenticity check on the query result to obtain a check result; when the check result is failure, correcting the query result based on a preset correction rule to obtain a corrected query result.
[0013] Furthermore, the target intent recognition model is trained in the following manner: the sentence sample set is input into the initial intent recognition model for multi-query intent supervised contrast learning training to obtain the intent label of each sentence sample in the sentence sample set; the sentence sample set is input into the initial intent recognition model for single-label multi-class supervised contrast learning and conditional random field (CRF) layer training to obtain the information parameters of each sentence sample in the sentence sample set; it is determined whether the maximized conditional probability of the intent recognition model after training meets the preset requirements; if so, the intent recognition model after training is determined as the target intent recognition model.
[0014] In a second aspect, the present application provides a statement query device, the device comprising:
[0015] A sentence recognition module is used to recognize the query sentence through a pre-trained target intent recognition model to obtain the intent category and information parameters of the query sentence;
[0016] An instruction determination module, used for processing the information parameters based on the task processing component corresponding to the intention category to obtain a query instruction;
[0017] The result determination module is used to search for corresponding target data from the database based on the query instruction, and generate a query result of the query statement based on the target data.
[0018] In a third aspect, the present application provides an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the statement query method described in any embodiment of the present application.
[0019] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the statement query method described in any embodiment of the present application when executed.
[0020] In a fifth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the statement query method described in any embodiment of the present application.
[0021] In order to solve the defects of the prior art in the background technology, an embodiment of the present application provides a statement query method, and executing the method can bring the following beneficial effects: the present application identifies the intent category of the statement to be queried through a target intent recognition model, first distinguishes the user intent of the statement to be queried, and then processes the information parameters based on the task processing component corresponding to the intent category to obtain the corresponding query instruction, which can improve the accuracy and controllability of the query results for the query statement.
[0022] It should be noted that the above computer instructions may be stored in whole or in part on a computer-readable storage medium, wherein the computer-readable storage medium may be packaged together with the processor of the statement query device, or may be packaged separately from the processor of the statement query device, which is not limited in this application.
[0023] The description of the second, third, ..., and fifth aspects in this application can refer to the detailed description of the first aspect; and the beneficial effects of the description of the second, third, ..., and fifth aspects can refer to the beneficial effect analysis of the first aspect, which will not be repeated here.
[0024] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description.
[0025] It is understandable that before using the technical solutions disclosed in the embodiments of this application, the type, scope of use, and usage scenarios of the personal information involved in this application should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0027] Figure 1 A flowchart of a statement query method provided in an embodiment of the present application;
[0028] Figure 2 The storage structure of the subtask node information provided in the embodiment of the present application;
[0029] Figure 3 A schematic diagram of the structure of a statement query device provided in an embodiment of the present application;
[0030] Figure 4 It is a block diagram of an electronic device used to implement a statement query method in an embodiment of the present application. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.
[0032] It should be noted that the terms "first", "second", "target", and "original" in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including", "having", and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.
[0033] Figure 1 This is a flow chart of a sentence query method provided in an embodiment of the present application. This embodiment can be applied to identify a user's sentence and query to obtain a query result corresponding to the sentence. The sentence query method provided in this embodiment can be executed by a sentence query device provided in an embodiment of the present application. The device can be implemented in software and / or hardware and integrated in an electronic device that executes the method. Preferably, the electronic device in the embodiment of the present application can be a query device with a natural language processing function, and the execution subject is a microprocessor of the query device. )
[0034] See also Figure 1 The method of this embodiment includes but is not limited to the following steps:
[0035] S110, identifying the query statement through a pre-trained target intent recognition model to obtain the intent category and information parameters of the query statement.
[0036] The target intent recognition model is pre-trained to identify the intent and related information of the query sentence. The related information can be the key information in the sentence, and can include entities in the sentence, logical relationships between entities, and database tables. The query sentence can be a sentence input by the user through the voice dialogue function of the query device, or a sentence input through the text input function of the query device. The intent categories can include query data intent (i.e., asking for numbers) and query text intent (i.e., asking for policies).
[0037] In an embodiment of the present application, the target intent recognition model can be modeled by a Transformer Encoder, and the first token of the input sequence corresponding to the query statement input by the user is used as a special marker to store the intent category of the identified query statement.
[0038] Furthermore, the target intent recognition model is trained in the following manner: the sentence sample set is input into the initial intent recognition model for multi-query intent supervised contrast learning training to obtain the intent label of each sentence sample in the sentence sample set; the sentence sample set is input into the initial intent recognition model for single-label multi-class supervised contrast learning and conditional random fields (CRF) layer training to obtain the information parameters of each sentence sample in the sentence sample set; it is determined whether the maximized conditional probability of the intent recognition model after training meets the preset requirements; if so, the intent recognition model after training is determined as the target intent recognition model.
[0039] When training the target intent recognition model, the first token of the input sequence is passed to the query intent recognition layer. The query intent recognition layer takes this token as input and outputs a vector representing the sequence category. This vector is used in the prediction phase to determine the intent category to which the input sequence belongs. The user's query intent is predicted by using the first hidden state of a special token, while the final hidden states of other tokens are used to classify information parameters through the softmax layer, i.e., the tools parameter.
[0040] The optimization goal of the target intent recognition model is to maximize the conditional probability, that is, the joint probability of the query intent and the tools parameter sequence given the user query intent input. This is achieved by minimizing the cross entropy loss to achieve end-to-end fine-tuning. In order to improve the tools parameter filling performance, a random field CRF layer is added on top of the model to help the model learn the dependencies between the tools parameter sequence labels, thereby improving the accuracy of the tools parameter sequence label prediction.
[0041] Optionally, supervised contrastive learning can be introduced on the network architecture of the target intent recognition model to bring semantics with the same / similar labels closer and push semantics with different labels away. In the first stage, since the tasks corresponding to the intent category and information parameters of the query statement (i.e., the two tasks) are performed separately, two specific single-task supervised contrastive learning mechanisms are proposed for multiple query intent detection and tools parameter filling respectively. Since multiple intent detection is a multi-label classification task, the relationship between instances is not a simple positive / negative sample. In order to handle the fine-grained correlation between multiple query intent instances, by proposing multi-query intent supervised contrastive learning, fine-grained weights can be dynamically assigned to each instance, taking into account the similarity of its query intent with the anchor intent. For tools parameter filling, single-label multi-class supervised contrastive learning is adopted. In the second stage, since the two tasks achieve mutual guidance, there is a dual-task semantic contrast relationship.
[0042] In one embodiment, after the query statement is identified by a pre-trained intent recognition model to obtain the intent category and information parameters of the query statement, it also includes: determining multiple entities in the query statement and logical relationships between the entities based on the information parameters; determining multiple subtasks for executing the query task corresponding to the query statement based on the multiple entities and logical relationships; determining the node information of each subtask, and using a preset byte structure to store the node information of each subtask, wherein the node information of each subtask includes a local index of each subtask corresponding to the adjacent subtask.
[0043] The complex problem is transformed into a subtask dependency graph. The nodes of the dependency graph are the entities in the question, and the edges of the dependency graph represent the logical relationships between the entities. Different logical relationships represent different problem decomposition operations. Finally, the decomposition process is learned from the sequence-to-sequence structure to improve storage space and speed. In order to be able to directly address the corresponding subtask node information, a fixed (8) byte size structure is designed to store a single subtask node information, such as Figure 2 The following figure shows the storage structure of subtask node information; each subtask node information maintains its pointer to its neighbor subtask node. Therefore, each subtask node is represented as a local index of its neighbor node, which is much more efficient than the traditional global index. Because the query time is independent of the overall global scale, it is only proportional to the number of subtask node neighbors retrieved. The advantage of this setting is that the complexity of the traditional global index can be reduced from O(logN) to O(1).
[0044] S120. Process the information parameters based on the task processing component corresponding to the intent category to obtain a query instruction.
[0045] The query instruction includes a structured query language (SQL) query statement and a search keyword.
[0046] Specifically, the task processing component corresponding to the intent category processes the information parameters to obtain a query instruction, including: if the intent category is a data query intent and the task processing component is a data query component, then the information parameters are processed based on the data query component to obtain a target SQL query statement; if the intent category is a text query intent and the task processing component is a text query component, then the information parameters are processed based on the text query component to obtain a search keyword.
[0047] Furthermore, the information parameters include key fields in the query statement, key values of the key fields, and database table names corresponding to the key fields; the information parameters are processed based on the data query component to obtain the target SQL query statement, including: calling the SQL statement generation tool to generate the initial SQL query statement based on the database table name, key fields and key values; and fine-tuning the initial SQL query statement to obtain the target SQL query statement. The advantage of this setting is that the method of fine-tuning the SQL query statement is used to realize the transformation of the SQL thinking chain generated by the Qwen-14B-Chat model, which can improve the query accuracy of the query statement.
[0048] Furthermore, the initial SQL query statement is fine-tuned to obtain a target SQL query statement, including: after removing data such as database tables, column names and key values from the initial SQL query statement, an initial statement skeleton corresponding to the initial SQL query statement is obtained; the initial statement skeleton is matched with a statement skeleton sample library using a preset similarity algorithm to obtain a target statement skeleton; based on the target statement skeleton and the data in the initial SQL query statement, that is, the previously removed data is added back to the target statement skeleton, and the target SQL query statement can be generated.
[0049] The statement skeleton sample library is a pre-set seed sample. This application is an improvement on the Qwen-14B-Chat model. The Qwen-14B-Chat model fine-tuned by instructions has the ability to generate SQL accurately and generalized from natural language, and can understand the complex relationships between multiple database tables.
[0050] S130: searching for corresponding target data from a database based on the query instruction, and generating a query result of the query statement based on the target data.
[0051] In an optional embodiment, after the information parameters are processed based on the text query component to obtain the search keywords, the process of determining the query result of the query statement to be queried based on the search keywords is as follows: the text query component includes a dense search and recall component, a sparse search and recall component, and a refined sorting component. First, the first text data is obtained from the vector database by using the dense search and recall component and the search keywords using an offline search method or an online search method; then, the second text data is obtained from the text library by using the sparse search and recall component and the search keywords using a preset sparse search algorithm and a preset sorting and recall algorithm; finally, the query result of the query statement to be queried is obtained by sorting the first text data and the second text data through the refined sorting component.
[0052] In another optional embodiment, after the information parameters are processed based on the data query component to obtain the target SQL query statement, the process of determining the query result of the statement to be queried based on the target SQL query statement is: determining the corresponding database based on the target SQL query statement, and searching for the query result of the statement to be queried in the database.
[0053] Furthermore, the statement query method of the present application also includes: performing an authenticity check on the query result to obtain a check result; when the check result is a check failure, correcting the query result based on a preset correction rule to obtain a corrected query result. The preset correction rule includes removing redundancy, correcting units, and correcting values.
[0054] The technical solution provided by this embodiment identifies the query statement through a pre-trained target intent recognition model to obtain the intent category and information parameters of the query statement; processes the information parameters based on the task processing component corresponding to the intent category to obtain a query instruction; searches the corresponding target data from the database based on the query instruction, and generates a query result for the query statement based on the target data. This application identifies the intent category of the query statement through a target intent recognition model, first distinguishes the user intent of the query statement, and then processes the information parameters based on the task processing component corresponding to the intent category to obtain the corresponding query instruction, which can improve the accuracy and controllability of the query result of the query statement.
[0055] Figure 3 A schematic diagram of a structure of a statement query device provided in an embodiment of the present application is shown in FIG. Figure 3 As shown, the device 300 may include:
[0056] A sentence recognition module 310 is used to recognize the query sentence through a pre-trained target intent recognition model to obtain the intent category and information parameters of the query sentence;
[0057] An instruction determination module 320, configured to process the information parameter based on the task processing component corresponding to the intention category to obtain a query instruction;
[0058] The result determination module 330 is used to search for corresponding target data from the database based on the query instruction, and generate a query result of the query statement based on the target data.
[0059] Optionally, the query instruction includes a structured query language SQL query statement and a search keyword;
[0060] Furthermore, the above-mentioned instruction determination module 320 can be specifically used for: if the intent category is query data intent, then processing the information parameters based on the data query component to obtain the target SQL query statement; if the intent category is query text intent, then processing the information parameters based on the text query component to obtain the search keywords.
[0061] Optionally, the information parameters include a key field in the query statement, a key value of the key field, and a database table name corresponding to the key field;
[0062] Furthermore, the instruction determination module 320 may be specifically used to: call an SQL statement generation tool based on the database table name, the key field and the key value to generate an initial SQL query statement; and fine-tune the initial SQL query statement to obtain a target SQL query statement.
[0063] Furthermore, the above-mentioned instruction determination module 320 can also be specifically used to: determine the initial statement skeleton corresponding to the initial SQL query statement; perform similarity matching on the initial statement skeleton with the statement skeleton sample library to obtain the target statement skeleton; generate the target SQL query statement based on the target statement skeleton and the data in the initial SQL query statement.
[0064] Furthermore, the above-mentioned instruction determination module 320 can also be specifically used for: after identifying the query statement through a pre-trained target intent recognition model and obtaining the intent category and information parameters of the query statement, determining multiple entities in the query statement and the logical relationship between the entities based on the information parameters; determining multiple subtasks for executing the query task corresponding to the query statement based on the multiple entities and the logical relationship; determining the node information of each subtask, and using a preset byte structure to store the node information of each subtask, wherein the node information of each subtask includes a local index of the adjacent subtask corresponding to each subtask.
[0065] Furthermore, the above statement query device may further include: a result correction module;
[0066] The result correction module is used to perform an authenticity check on the query result to obtain a check result; when the check result is failure, the query result is corrected based on a preset correction rule to obtain a corrected query result.
[0067] Optionally, the target intent recognition model is trained in the following manner: the sentence sample set is input into the initial intent recognition model for multi-query intent supervised contrast learning training to obtain the intent label of each sentence sample in the sentence sample set; the sentence sample set is input into the initial intent recognition model for single-label multi-class supervised contrast learning and conditional random field (CRF) layer training to obtain the information parameters of each sentence sample in the sentence sample set; it is determined whether the maximized conditional probability of the intent recognition model after training meets preset requirements; if so, the intent recognition model after training is determined as the target intent recognition model.
[0068] The statement query device provided in this embodiment can be applied to the statement query method provided in any of the above embodiments, and has corresponding functions and beneficial effects.
[0069] Figure 4 It is a block diagram of an electronic device for implementing a statement query method of an embodiment of the present application. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0070] like Figure 4 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0071] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0072] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the statement query method.
[0073] In some embodiments, the statement query method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the statement query method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the statement query method in any other appropriate manner (e.g., by means of firmware).
[0074] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0075] The computer programs for implementing the methods of the present application may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer programs are executed by the processor, the functions / operations specified in the flow charts and / or block diagrams are implemented. The computer programs may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0076] In the context of the present application, a computer readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. Alternatively, a computer readable storage medium may be a machine readable signal medium. A more specific example of a machine readable storage medium may include an electrical connection based on one or more lines, 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), an 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.
[0077] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0078] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server) or a computing system that includes middleware components (e.g., an application server) or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein) or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0079] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0080] Note that the above are only preferred embodiments of the present application and the technical principles used. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and that various obvious changes, readjustments, and substitutions can be made by those skilled in the art without departing from the scope of protection of the present application. For example, those skilled in the art can use the various forms of processes shown above to reorder, add, or delete steps; the steps recorded in the present application can be performed in parallel, sequentially, or in different orders, as long as the desired results of the technical solution of the present application can be achieved, and this document does not limit them here.
[0081] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.
Claims
1. A statement query method, characterized in that: The method comprises: Recognize the query statement through the pre-trained target intent recognition model to obtain the intent category and information parameters of the query statement; Processing the information parameters based on the task processing component corresponding to the intent category to obtain a query instruction; Based on the query instruction, the corresponding target data is searched from the database, and based on the target data, the query result of the query statement is generated.
2. The statement query method according to claim 1, characterized in that: The query instruction includes a structured query language SQL query statement and a search keyword; The task processing component corresponding to the intention category processes the information parameter to obtain a query instruction, including: If the intent category is a data query intent, the information parameters are processed based on the data query component to obtain a target SQL query statement; If the intent category is a query text intent, the information parameters are processed based on a text query component to obtain search keywords.
3. The statement query method according to claim 2, characterized in that: The information parameters include the key field in the query statement, the key value of the key field, and the database table name corresponding to the key field; The information parameters are processed based on the data query component to obtain a target SQL query statement, including: Calling an SQL statement generation tool based on the database table name, the key field and the key value to generate an initial SQL query statement; The initial SQL query statement is fine-tuned to obtain a target SQL query statement.
4. The statement query method according to claim 3, characterized in that: Fine-tuning the initial SQL query statement to obtain a target SQL query statement includes: Determine an initial statement skeleton corresponding to the initial SQL query statement; Performing similarity matching between the initial sentence skeleton and a sentence skeleton sample library to obtain a target sentence skeleton; The target SQL query statement is generated based on the target statement skeleton and the data in the initial SQL query statement.
5. The statement query method according to claim 3, characterized in that: After the query sentence is identified by the pre-trained target intent recognition model to obtain the intent category and information parameters of the query sentence, the method further includes: Determine the multiple entities in the query statement and the logical relationships between the entities based on the information parameters; Determine, based on the multiple entities and the logical relationship, a plurality of subtasks for executing the query task corresponding to the query statement to be queried; The node information of each subtask is determined, and a structure of preset bytes is used to store the node information of each subtask, wherein the node information of each subtask includes a local index of an adjacent subtask corresponding to each subtask.
6. The statement query method according to claim 1, characterized in that: The method further comprises: Performing an authenticity check on the query result to obtain a check result; When the inspection result is failure, the query result is corrected based on a preset correction rule to obtain a corrected query result.
7. The statement query method according to claim 1, characterized in that: The target intent recognition model is trained in the following manner: Inputting the sentence sample set into the initial intent recognition model to perform multi-query intent supervised contrast learning training to obtain the intent label of each sentence sample in the sentence sample set; Inputting the sentence sample set into the initial intent recognition model to perform single-label multi-class supervised contrastive learning and conditional random field (CRF) layer training to obtain information parameters of each sentence sample in the sentence sample set; Determine whether the maximum conditional probability of the intent recognition model after training meets the preset requirements; If satisfied, the trained intent recognition model is determined as the target intent recognition model.
8. A statement query device, characterized in that: The device comprises: A sentence recognition module is used to recognize the query sentence through a pre-trained target intent recognition model to obtain the intent category and information parameters of the query sentence; An instruction determination module, used for processing the information parameters based on the task processing component corresponding to the intention category to obtain a query instruction; The result determination module is used to search for corresponding target data from the database based on the query instruction, and generate a query result of the query statement based on the target data.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively coupled to the at least one processor; The memory stores a computer program executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the statement query method described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the statement query method according to any one of claims 1 to 7 when executed.
Citation Information
Patent Citations
Logistics management professional student information management method based on cloud computing
CN110111047A
Knowledge query method and device for vertical domain knowledge graph, computer equipment and storage medium
CN117194616A
User intention classification method and device, computer readable storage medium and terminal
CN118070796A
Database query statement generation method, system and equipment and medium
CN118467682A
Cited By
Data parallel collection method and device, equipment and medium
CN120492518A
Navigation service recommendation method and device, electronic equipment and storage medium
CN121210770A
Navigation service recommendation methods, devices, electronic devices and storage media
CN121210770B