Structured query language construction prompting method and related device
By performing feature encoding and language module processing on the operation sequence during SQL query conditions construction, standardized and statistical operation prompt information is generated, and the problem of missing prompt information caused by inconsistent prefix matching in the prior art is solved, and SQL construction efficiency is improved.
Patent Information
- Application Number
- CN202411736236.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-02-25
AI Technical Summary
In the prior art, when SQL query conditions are constructed, the prefix matching method needs to be completely consistent to provide effective prompts, resulting in the fact that when the exact matching prefix cannot be found in the historical operation data, the next operation prompt cannot be provided, which reduces the efficiency of SQL construction.
By feature encoding the input operation sequence, a prefix operation feature matrix is generated, and a preconfigured language module is used to generate standard feature vectors and statistical feature vectors, and the processing is used as a probability vector for random sampling, obtaining normative and statistical operation prompt information for the next operation.
It realizes that the next operation prompt information is provided without fully matching the historical operation data, and improves the efficiency of SQL construction.
Smart Images

Figure CN119513131A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of database technology, and in particular to a structured query language construction prompt method and related devices. Background Art
[0002] With the deepening of social informatization, people's demand for data analysis is also increasing. The display of data is no longer confined to a fixed mode, but requires customized data query and analysis of "thousands of faces for thousands of people".
[0003] A common query method currently is that users gradually build SQL (Structured Query Language) query conditions through one or more simplified buttons on the interface. During the construction process, the user's operation on the button is used as a prefix, and data matching the prefix is searched from historical operation data. The data is sorted from high to low according to the frequency of use, and the sorting result is displayed to the user as the next operation prompt information, so that the user can quickly build SQL query conditions.
[0004] However, the prefix matching method is equal value matching, which requires the prefix to be completely consistent with the historical operation data in order to provide an effective prompt. If no data that is completely consistent with the prefix is found in the historical operation data, the next operation prompt information cannot be provided to the user, reducing the efficiency of SQL construction. Summary of the invention
[0005] In view of the above problems, the present application provides a structured query language construction prompt method and related devices to achieve the purpose of generating reasonable and effective next operation prompt information, so that users can quickly construct SQL query conditions based on the next operation prompt information. The specific scheme is as follows:
[0006] The first aspect of the present application provides a structured query language construction prompt method, comprising:
[0007] Performing feature encoding on the input operation sequence to obtain a prefix operation feature matrix, wherein the input operation sequence is used to construct a query condition based on a structured query statement SQL;
[0008] Using a preconfigured language module, a matching standard feature vector and a statistical feature vector are generated based on the prefix operation feature matrix, wherein the standard feature vector is a feature vector that can be used as a basis for predicting a first operation, and the statistical feature vector is a feature vector that can be used as a basis for predicting a second operation, wherein the first operation refers to a next operation that complies with SQL grammar specifications, and the second operation refers to a next operation obtained based on usage frequency;
[0009] Processing the canonical feature vector into a first probability vector, and processing the statistical feature vector into a second probability vector, wherein the first probability vector and the second probability vector both contain the possibility probabilities that all operations are the next operation;
[0010] Random sampling is performed based on the possibility probabilities respectively included in the first probability vector and the second probability vector, so as to obtain normative operation prompt information and statistical operation prompt information for the next operation based on the sampling results.
[0011] In a possible implementation, the feature encoding of the input operation sequence to obtain a prefix operation feature matrix includes:
[0012] Using a preconfigured operation dictionary, each operation included in the input operation sequence is mapped to a number, so as to obtain numbers corresponding to the operations included in the input operation sequence;
[0013] Encode the numbers corresponding to the operations into feature matrices to obtain feature matrices corresponding to the operations;
[0014] The feature matrices corresponding to the operations are concatenated together to obtain the prefix operation feature matrix.
[0015] In a possible implementation, the preconfigured language module includes a first language module in a normative language model and a second language module in a statistical language model;
[0016] The method of using a preconfigured language module to generate a matching canonical feature vector and a statistical feature vector based on the prefix operation feature matrix includes:
[0017] Processing the prefix operation feature matrix into the canonical feature vector using the first language module;
[0018] Processing the prefix operation feature matrix into the statistical feature vector using the second language module;
[0019] The normative language model is trained by taking the first preceding operation sequence annotated with the next operation label as a training sample, and the first training data consisting of the first preceding operation sequence and the corresponding next operation is obtained by performing parameter replacement and deduplication on the target operation data, wherein the parameter replacement refers to replacing all specific operation parameters in the target operation data with the same placeholder;
[0020] The statistical language model is trained by taking the second preceding operation sequence marked with the next operation label as a training sample, and the second training data consisting of the second preceding operation sequence and the corresponding next operation is obtained by screening the target operation data according to the usage frequency and then performing sensitive data desensitization on the screened data;
[0021] The target operation data refers to historical SQL query statements whose queries are successful and whose query waiting time is within a preset waiting time threshold.
[0022] In a possible implementation, the first language module includes at least one first sub-language model, and the second language module includes at least one second sub-language model;
[0023] The using the first language module to process the prefix operation feature matrix into the standard feature vector, and using the second language module to process the prefix operation feature matrix into the statistical feature vector, comprises:
[0024] Processing the prefix operation feature matrix into at least one first feature vector using the at least one first sub-language model, and obtaining the canonical feature vector based on the at least one first feature vector;
[0025] The prefix operation feature matrix is processed into at least one second feature vector by using the at least one second sub-language model, and the statistical feature vector is obtained based on the at least one second feature vector.
[0026] In a possible implementation, the at least one first feature vector includes a plurality of first feature vectors, and the at least one second feature vector includes a plurality of second feature vectors;
[0027] The obtaining of the canonical feature vector based on the at least one first feature vector comprises:
[0028] splicing the at least one first eigenvector together to obtain the canonical eigenvector;
[0029] The obtaining the statistical feature vector based on the at least one second feature vector comprises:
[0030] The at least one second feature vector is concatenated together to obtain the statistical feature vector.
[0031] In a possible implementation, processing the canonical feature vector into a first probability vector and processing the statistical feature vector into a second probability vector includes:
[0032] Performing dimensionality reduction processing on the standard feature vector and the statistical feature vector respectively to obtain a first dimensionality reduction feature vector corresponding to the standard feature vector and a second dimensionality reduction feature vector corresponding to the statistical feature vector;
[0033] The first reduced-dimensionality feature vector and the second reduced-dimensionality feature vector are respectively normalized to obtain the first probability vector and the second probability vector.
[0034] A second aspect of the present application provides a structured query language construction prompt device, comprising:
[0035] A feature encoding module, used for performing feature encoding on an input operation sequence to obtain a prefix operation feature matrix, wherein the input operation sequence is used to construct a query condition based on a structured query statement SQL;
[0036] An operation prediction module, used to generate a matching standard feature vector and a statistical feature vector based on the prefix operation feature matrix using a preconfigured language module, wherein the standard feature vector is a feature vector that can be used as a basis for predicting a first operation, and the statistical feature vector is a feature vector that can be used as a basis for predicting a second operation, wherein the first operation refers to a next operation that complies with the SQL syntax specification, and the second operation refers to a next operation obtained based on a usage frequency;
[0037] A probability extraction module, used for processing the canonical feature vector into a first probability vector, and processing the statistical feature vector into a second probability vector, wherein the first probability vector and the second probability vector both contain the possibility probabilities that all operations are the next operation;
[0038] The prompt generation module is used to perform random sampling based on the possibility probabilities respectively included in the first probability vector and the second probability vector, so as to obtain normative operation prompt information and statistical operation prompt information for the next operation based on the sampling results.
[0039] A third aspect of the present application provides a computer program product, including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements the structured query language construction prompt method of the first aspect or any implementation of the first aspect.
[0040] A fourth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:
[0041] The memory is used to store computer programs;
[0042] The processor is used to execute the computer program so that the electronic device can implement the structured query language construction prompt method of the first aspect or any implementation manner of the first aspect.
[0043] In a fifth aspect, the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement the structured query language construction prompt method of the above-mentioned first aspect or any implementation method of the first aspect.
[0044] By means of the above technical scheme, the structured query language construction prompt method provided by the present application performs feature encoding on the input operation sequence to obtain a prefix operation feature matrix, and uses a preconfigured language module to generate a matching standard feature vector and a statistical feature vector based on the prefix operation feature matrix, and processes the standard feature vector into a first probability vector, and processes the statistical feature vector into a second probability vector, and performs random sampling based on the possibility probabilities contained in the first probability vector and the second probability vector, respectively, so as to obtain the standard operation prompt information and the statistical operation prompt information of the next operation based on the sampling results. It can be seen that, through the processing of feature encoding and language modules, the present application can process the input operation sequence into a standard feature vector and a statistical feature vector that can predict the next operation, and then can obtain the standard operation prompt information and the statistical operation prompt information of the next operation. Since there is no need to perform equivalence matching with historical operation data, there will be no situation where the next operation prompt information cannot be obtained, which improves the efficiency of SQL construction. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0046] Figure 1 A schematic diagram of a system architecture provided for this application;
[0047] Figure 2 A schematic diagram of an optional hardware structure of the terminal 100 provided in this application;
[0048] Figure 3 A schematic diagram of the structure of a server 200 provided in this application;
[0049] Figure 4 A flowchart of a structured query language construction prompt method provided in this application;
[0050] Figure 5A schematic diagram of the structure of a structured query language construction prompt device provided by the present application;
[0051] Figure 6 A schematic diagram of the structure of an electronic device provided in this application. DETAILED DESCRIPTION
[0052] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[0053] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0054] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0055] See also Figure 1 , Figure 1 A schematic diagram of a system architecture is shown. The system may include a terminal 100 and a server 200. The server 200 may include one or more servers ( Figure 1 In the example, a server is included, and the server 200 can provide the method provided in the embodiment of the present application for one or more terminals.
[0056] Among them, an application can be installed on the terminal 100, and the above application and web page can provide an interface. The terminal 100 can receive relevant parameters entered by the user on the interface and send the above parameters to the server 200. The server 200 can obtain processing results based on the received parameters and return the processing results to the terminal 100.
[0057] It should be understood that in some optional implementations, the terminal 100 can also complete the action of obtaining the processing result based on the received parameters by itself without the cooperation of the server, and the embodiments of the present application are not limited to this.
[0058] Next describe Figure 1 The product form of the mid-terminal 100;
[0059] The terminal 100 in the embodiment of the present application can be a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., and the embodiment of the present application does not impose any restrictions on this.
[0060] Figure 2 An optional hardware structure diagram of the terminal 100 is shown.
[0061] refer to Figure 2 As shown, the terminal 100 may include a radio frequency unit 110, a memory 120, an input unit 130, a display unit 140, a camera 150 (optional), an audio circuit 160 (optional), a speaker 161 (optional), a microphone 162 (optional), an earphone jack 163 (optional), a processor 170, an external interface 180, a power supply 190 and other components. Those skilled in the art will appreciate that Figure 2 These are merely examples of terminals or multi-function devices and do not constitute limitations on the terminals or multi-function devices, which may include more or fewer components than those shown in the figures, or combinations of certain components, or different components.
[0062] The input unit 130 can be used to receive input digital or character information, and generate key signal input related to the user settings and function control of the portable multifunctional device. Specifically, the input unit 130 may include a touch screen 131 (optional) and / or other input devices 132. The touch screen 131 can collect the user's touch operations on or near it (such as the user's operation on or near the touch screen using any suitable object such as fingers, joints, stylus, etc.), and drive the corresponding connection device according to a pre-set program. The touch screen can detect the user's touch action on the touch screen, convert the touch action into a touch signal and send it to the processor 170, and can receive and execute the command sent by the processor 170; the touch signal at least includes the touch point coordinate information. The touch screen 131 can provide an input interface and an output interface between the terminal 100 and the user. In addition, the touch screen can be implemented using multiple types such as resistive, capacitive, infrared and surface acoustic wave. In addition to the touch screen 131, the input unit 130 can also include other input devices. Specifically, other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, and the like.
[0063] Among them, the input device 132 can receive input data and the like.
[0064] The display unit 140 may be used to display information input by a user or provided to a user, various menus of the terminal 100, an interactive interface, file display, and / or playback of any multimedia file.
[0065] The memory 120 can be used to store instructions and data. The memory 120 can mainly include an instruction storage area and a data storage area. The data storage area can store various data, such as multimedia files, texts, etc.; the instruction storage area can store software units such as operating systems, applications, instructions required for at least one function, or their subsets and extensions. It can also include a non-volatile random access memory; provide the processor 170 with hardware, software and data resources including management of computing and processing equipment, and support control software and applications. It is also used for the storage of multimedia files, and the storage of running programs and applications.
[0066] The processor 170 is the control center of the terminal 100. It uses various interfaces and lines to connect various parts of the entire terminal 100. By running or executing instructions stored in the memory 120 and calling data stored in the memory 120, it executes various functions of the terminal 100 and processes data, thereby controlling the terminal device as a whole. Optionally, the processor 170 may include one or more processing units; preferably, the processor 170 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface and application program, and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 170. In some embodiments, the processor and the memory may be implemented on a single chip, and in some embodiments, they may also be implemented separately on separate chips. The processor 170 may also be used to generate corresponding operation control signals, send them to corresponding components of the computing and processing device, read and process data in the software, especially read and process data and programs in the memory 120, so that each functional module therein performs corresponding functions, thereby controlling the corresponding components to act according to the requirements of the instructions.
[0067] The memory 120 may be used to store software codes related to the structured query language construction prompt method, the processor 170 may execute the steps of the structured query language construction prompt method, and may also schedule other units (such as the above-mentioned input unit 130 and display unit 140) to implement corresponding functions.
[0068] The radio frequency unit 110 (optional) can be used for receiving and sending information or receiving and sending signals during a call, for example, after receiving the downlink information of the base station, it is sent to the processor 170 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (Low Noise Amplifier, LNA), a duplexer, etc. In addition, the radio frequency unit 110 can also communicate with network devices and other devices through wireless communication. The wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile Communication (Global System of Mobile Communication, GSM), General Packet Radio Service (General Packet Radio Service, GPRS), Code Division Multiple Access (Code Division Multiple Access, CDMA), Wideband Code Division Multiple Access (Wideband Code Division Multiple Access, WCDMA), Long Term Evolution (Long Term Evolution, LTE), email, Short Messaging Service (SMS), etc.
[0069] In this embodiment of the present application, the RF unit 110 can send data to the server 200 and receive processing results sent by the server 200.
[0070] It should be understood that the radio frequency unit 110 is optional and can be replaced by other communication interfaces, such as a network port.
[0071] The terminal 100 also includes a power supply 190 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 170 through a power management system, so that the power management system can manage functions such as charging, discharging, and power consumption.
[0072] The terminal 100 further includes an external interface 180 , which may be a standard Micro USB interface or a multi-pin connector, and may be used to connect the terminal 100 to communicate with other devices, or to connect a charger to charge the terminal 100 .
[0073] Although not shown, the terminal 100 may also include a flashlight, a wireless fidelity (WiFi) module, a Bluetooth module, sensors with different functions, etc., which are not described in detail here. Some or all of the methods described below may be applied in the following embodiments. Figure 2 In the terminal 100 shown.
[0074] Next describe Figure 1 The product form of the server 200;
[0075] Figure 3 A schematic diagram of the structure of a server 200 is provided, such as Figure 3 As shown, the server 200 includes a bus 201, a processor 202, a communication interface 203, and a memory 204. The processor 202, the memory 204, and the communication interface 203 communicate with each other via the bus 201.
[0076] The bus 201 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0077] The processor 202 may be any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0078] The memory 204 may include a volatile memory, such as a random access memory (RAM). The memory 204 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).
[0079] The memory 204 may be used to store software codes related to the structured query language construction prompt method, and the processor 202 may execute the steps of the structured query language construction prompt method of the chip, and may also schedule other units to implement corresponding functions.
[0080] It should be understood that the above-mentioned terminal 100 and server 200 can be centralized or distributed devices, and the processors in the above-mentioned terminal 100 and server 200 (such as processor 170 and processor 202) can be hardware circuits (such as application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), general-purpose processors, DSPs, microprocessors or microcontrollers, etc.), or a combination of these hardware circuits. For example, the processor can be a hardware system with an instruction execution function, such as a CPU, DSP, etc., or a hardware system without an instruction execution function, such as an ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without an instruction execution function and hardware systems with an instruction execution function.
[0081] The present application provides a structured query language construction prompt method. The structured query language construction prompt method of the present application embodiment is described in detail below in conjunction with the accompanying drawings.
[0082] Reference Figure 4 , Figure 4 A schematic diagram of a flow chart of a structured query language construction prompt method provided in an embodiment of the present application, the method may include:
[0083] Step S401: Perform feature encoding on the input operation sequence to obtain a prefix operation feature matrix.
[0084] Here, the input operation sequence refers to an operation sequence of a user operating a button, and the input operation sequence is used to construct a query condition based on a structured query language (SQL).
[0085] For the convenience of subsequent description, the input operation sequence is recorded as ,in, Indicates that the input operation sequence contains operations.
[0086] In this embodiment, in order to use the input operation sequence to predict the next operation, the input operation sequence can be feature encoded in this step to obtain a prefix operation feature matrix.
[0087] Step S402: using a preconfigured language module, generating a matching canonical feature vector and a statistical feature vector based on a prefix operation feature matrix.
[0088] Considering that in the prediction scenario provided by this embodiment, the SQL query statement generated by each step of the operation needs to comply with the grammatical specification, otherwise the situation may occur that the required data cannot be queried based on the generated SQL query statement, and even the situation may occur that the SQL query statement cannot be generated. Therefore, the prediction of this embodiment needs to ensure that the predicted next operation complies with the SQL grammatical specification. Corresponding to the implementation of this step, the prefix operation feature matrix can be semantically understood through a pre-configured language model, and then a standard feature vector matching the prefix operation feature matrix can be generated, so that the subsequent steps can use the standard feature vector as the prediction basis for the first operation, predict the first operation, that is, predict the next operation that complies with the SQL grammatical specification.
[0089] Considering that in addition to the SQL syntax specification, users prefer commonly used operations, therefore, the prediction of this embodiment also needs to ensure that the predicted next operation is as common as possible. Corresponding to the implementation of this step, the semantic understanding of the prefix operation feature matrix based on the preconfigured language model can generate a statistical feature vector that matches the prefix operation feature matrix, so that the subsequent steps can use the statistical feature vector as a prediction basis for the second operation to predict the second operation. Here, the second operation refers to the next operation obtained based on the frequency of use, for example, the second operation refers to the next operation with a higher frequency of use.
[0090] It should be noted that the second operation mentioned above also needs to comply with SQL syntax specifications.
[0091] The difference between the standard feature vector and the statistical feature vector is explained as follows: the first operation mentioned above refers to the next operation that complies with the SQL syntax specification. The prediction process of the first operation pays more attention to the standardization of the SQL statement. Therefore, the standard feature vector can better reflect the standardization of the SQL statement of the next operation to be predicted; although the second operation also needs to comply with the SQL syntax specification, the prediction process of the second operation pays more attention to the frequency of use of the SQL statement. The statistical feature vector can better reflect the frequency of use of the next operation to be predicted.
[0092] Step S403: Process the canonical feature vector into a first probability vector, and process the statistical feature vector into a second probability vector.
[0093] The first probability vector and the second probability vector both contain the possibility probabilities that all operations are the next operations.
[0094] Taking the first probability vector as an example, the first probability vector is recorded as ,but The Elements That is, the first The probability that an action is the next action.
[0095] For example, suppose that there are 20 operations in the actual application scenario, which are sorted according to the operation dictionary as operation 1, operation 2, ..., operation 20. Then, the first probability vector and the second probability vector are both probability vectors with 20 dimensions, where the probability under the first dimension represents the probability that operation 1 is the next operation, the probability under the second dimension represents the probability that operation 2 is the next operation, and so on.
[0096] Step S404: Random sampling is performed based on the possibility probabilities respectively included in the first probability vector and the second probability vector, so as to obtain normative operation prompt information and statistical operation prompt information for the next operation based on the sampling results.
[0097] In conventional implementations, several operations with the highest probability are usually selected as prompt operations, but it is not ruled out that the user may select an operation with a low probability in the next operation. In order to prevent the operation prompt information for the next operation from being useless to the user, this embodiment can perform random sampling based on the probability probabilities contained in the first probability vector and the second probability vector, respectively. The principle of random sampling is: the higher the probability, the easier it is to be sampled, and the lower the probability, the less likely it is to be sampled.
[0098] In a possible implementation, the sampling object may be a possibility probability, that is, this embodiment may randomly sample the possibility probabilities respectively included in the first probability vector and the second probability vector according to the above-mentioned random sampling principle, and the sampling result is the possibility probability.
[0099] Furthermore, the subscript corresponding to the possible probability obtained by sampling can be used as an index to query the operation corresponding to the index from the operation dictionary to obtain the next operation, thereby generating normative operation prompt information and statistical operation prompt information.
[0100] Optionally, the above process of "processing the canonical feature vector into a first probability vector" and performing random sampling based on the possibility probabilities contained in the first probability vector can be implemented by a first decoder, and the implementation process of the first decoder can adopt the following formula (1).
[0101] (1)
[0102] in, Indicates that the operation sequence has been entered In this case, the next step is The probability of the possibility, represents the first decoder, represents all parameters of the first decoder, is the first probability vector The subscript corresponding to the probability obtained after random sampling (that is, the above index), Represents the first probability vector of random sampling The A possibility probability.
[0103] Similarly, the above-mentioned process of "processing the statistical feature vector into a second probability vector" and performing random sampling based on the possibility probabilities contained in the second probability vector can be implemented by a second decoder. The implementation process of the second decoder is similar to the implementation process of the first decoder mentioned above. For details, please refer to the previous introduction and will not be repeated here.
[0104] In another possible implementation, the sampling object may be an operation, that is, this embodiment may randomly sample all operations according to the above random sampling principle, and the sampling result is the operation.
[0105] Furthermore, the sampled operations can be used as the next operation to generate normative operation prompt information and statistical operation prompt information.
[0106] The structured query language construction prompt method provided by the present application performs feature encoding on the input operation sequence to obtain a prefix operation feature matrix, uses a preconfigured language module, generates a matching standard feature vector and a statistical feature vector based on the prefix operation feature matrix, processes the standard feature vector into a first probability vector, and processes the statistical feature vector into a second probability vector, and performs random sampling based on the possibility probabilities contained in the first probability vector and the second probability vector, respectively, so as to obtain the standard operation prompt information and the statistical operation prompt information of the next operation based on the sampling results. It can be seen that the present application can process the input operation sequence into a standard feature vector and a statistical feature vector that can predict the next operation through the processing of feature encoding and language modules, and then obtain the standard operation prompt information and the statistical operation prompt information of the next operation. Since there is no need to perform equivalence matching with historical operation data, there will be no situation where the next operation prompt information cannot be obtained, which improves the efficiency of SQL construction.
[0107] In some embodiments of the present application, the process of the above step S401 "feature encoding the input operation sequence to obtain a prefix operation feature matrix" is introduced.
[0108] In this embodiment, the process of "feature encoding the input operation sequence to obtain a prefix operation feature matrix" may include: mapping each operation included in the input operation sequence to a number based on a preconfigured operation dictionary to obtain numbers corresponding to each operation included in the input operation sequence; encoding the numbers corresponding to each operation into a feature matrix to obtain feature matrices corresponding to each operation; and splicing the feature matrices corresponding to each operation together to obtain a prefix operation feature matrix.
[0109] Specifically, firstly, a preconfigured operation dictionary is used to establish a numerical index for all operations, so that each operation contained in the input operation sequence can be mapped to a number based on the preconfigured operation dictionary. For example, the first operation contained in the input operation sequence Operations Can be mapped to numbers .
[0110] Optionally, the numbers corresponding to the above operations can be encoded into feature matrices according to the following formula (2) to obtain feature matrices corresponding to the operations.
[0111] (2)
[0112] in, Indicates that the input operation sequence contains Operations The corresponding feature matrix is, Represents digital to encode.
[0113] Optionally, the feature matrices corresponding to each operation may be concatenated together according to the following formula (3) to obtain a prefix operation feature matrix.
[0114] (3)
[0115] in, represents the prefix operation feature matrix, is the length of the input operation sequence.
[0116] This embodiment uses a preconfigured operation dictionary to first map the operations therein into numbers and then encode them, so that the input operation sequence that was originally unable to be processed by the computer is converted into information that can be understood and processed, so that the process of constructing SQL prompt information in this application can be smoothly implemented, thereby improving the efficiency of constructing operation prompt information.
[0117] In other embodiments of the present application, the process of the aforementioned "step S402, using a preconfigured language module to generate a matching canonical feature vector and a statistical feature vector based on a prefix operation feature matrix" is introduced.
[0118] Optionally, the preconfigured language module may include a first language module in a normative language model and a second language module in a statistical language model. In this embodiment, the first language module may be used to process the prefix operation feature matrix into a normative feature vector, and the second language module may be used to process the prefix operation feature matrix into a statistical feature vector.
[0119] The above-mentioned normative language model and statistical language model are both neural network models. Optionally, the normative language model and the statistical language model can be language models of any structure or any model with similar functions to language models. For example, the normative language model and the statistical language model can be large language models, long short-term memory (LSTM) models, convolutional neural network (CNN) models, and the like.
[0120] Preferably, since there are fewer types of operations in SQL construction and the requirements for the model are lower, a common neural network model such as an LSTM model can be used, which can occupy less resources than a large language model.
[0121] Optionally, the first language module and the second language module may be a single model or a model composed of a plurality of models.
[0122] Preferably, a combination of multiple models can be used to improve the accuracy of operation suggestions while ensuring operational efficiency.
[0123] Optionally, the first language module includes at least one first sub-language model. This embodiment can use the at least one first sub-language model to process the prefix operation feature matrix into at least one first feature vector, and then obtain a normalized feature vector based on the at least one first feature vector.
[0124] Optionally, when the first language module includes multiple first sub-language models, the at least one first feature vector includes multiple first feature vectors. In order to be able to aggregate the multiple first feature vectors together to obtain the above-mentioned standard feature vector, the first language module may also include a first aggregation layer, which is used to splice the at least one first feature vector (that is, multiple first feature vectors) together to obtain the standard feature vector.
[0125] Optionally, the first aggregation layer may be a fully connected layer, which is used to reduce the dimension of the multiple first feature vectors.
[0126] Optionally, include the first language module in The sub-language model is denoted as , then the following formula (4) can be used to concatenate at least one first eigenvector to obtain a normalized eigenvector.
[0127] (4)
[0128] in, represents the canonical eigenvector, Indicates The first feature vector output by the sub-language model.
[0129] In this embodiment, the above-mentioned multiple first sub-language models can be parallel structures and have different network structures, so that different first feature vectors can be extracted in parallel through different network structures, so that the obtained standard feature vector can predict the next operation with higher accuracy.
[0130] Similarly, the second language module may include at least one second sub-language model. This embodiment may utilize the at least one second sub-language model to process the prefix operation feature matrix into at least one second feature vector, and then obtain a statistical feature vector based on the at least one second feature vector.
[0131] Optionally, when the second language module includes multiple second sub-language models, the at least one second feature vector includes multiple second feature vectors. In order to be able to aggregate the multiple second feature vectors together to obtain the above-mentioned statistical feature vector, the second language module may also include a second aggregation layer, which is used to splice the at least one second feature vector (that is, multiple second feature vectors) together to obtain the statistical feature vector.
[0132] Optionally, the second aggregation layer may be a fully connected layer, which is used to reduce the dimensions of the multiple second eigenvectors.
[0133] In this embodiment, the above-mentioned multiple second sub-language models can be parallel structures and have different network structures, so that different second feature vectors can be extracted in parallel through different network structures, so that the obtained statistical feature vectors can predict the next operation with higher accuracy.
[0134] The following embodiments introduce the training process of the above-mentioned normative language model and statistical language model.
[0135] First, we introduce the training process of the normative language model.
[0136] 1. Determine first training data. Here, the first training data refers to training data of a normative language model.
[0137] In this embodiment, all historical SQL query statements can be collected. Optionally, historical SQL query statements whose queries are successful and whose query waiting time is within a preset waiting time threshold can be screened from the collected historical SQL query statements. For the convenience of subsequent introduction, the queried historical SQL query statements are defined as target operation data.
[0138] Optionally, the above preset waiting time threshold is 15 seconds.
[0139] The above screening process can ensure that the query operation of the target operation data is more accurate and efficient, and then train the language model based on the target operation data, so that the language model can give accurate and efficient operation prompt suggestions.
[0140] As for the normative language model, the present application hopes that the model can give operation prompts and suggestions that are as consistent with grammatical specifications as possible. Since the model does not pay attention to the usage frequency of the first training data, the operation data used to query the same type of data in the target operation data can be removed. To this end, the target operation data can be optionally replaced with parameters and deduplicated to obtain the first training data of the normative language model.
[0141] Parameter replacement refers to replacing all specific operation parameters in the target operation data with the same placeholder. By replacing the placeholder, the training data for querying the same data can be made completely identical. For example, two historical SQL query statements are both for querying names, one for querying Zhang San and the other for querying Li Si. After Zhang San and Li Si are replaced with the same placeholder, the two historical SQL query statements become identical. Then, subsequent deduplication can be performed to achieve the purpose of querying the same data.
[0142] Next, the first training data is processed into sample pairs of (first preceding operation sequence, next operation), that is, the first preceding operation sequence labeled with the next operation label can be used as a training sample to train the canonical language model.
[0143] 2. Train the normative language model based on the first training data.
[0144] Optionally, the canonical language model may be composed of a first encoder, the first language module and the first decoder, and the canonical language model may process the input operation sequence into a first probability vector corresponding to the operation sequence: .
[0145] Among them, the first encoder can perform feature encoding on the input operation sequence to obtain a first prefix operation feature matrix, the first language module can generate a matching standard feature vector based on the first prefix operation feature matrix, and the first decoder can process the standard feature vector into a first probability vector, and perform random sampling based on the possibility probabilities contained in the first probability vector to obtain standard operation prompt information for the next operation based on the sampling results.
[0146] Optionally, considering the real-time requirements of the operation prompt, the first encoder may use a single-layer fully connected layer structure. Optionally, this embodiment may also perform one-hot encoding on the next operation in the first training data to obtain a one-hot vector , then optionally, the first probability vector can be calculated using the loss function shown in the following formula (5): With one-hot vector The loss value between .
[0147] (5)
[0148] in, represents the first probability vector With one-hot vector The loss value between .
[0149] After obtaining the above loss value, the parameters in the normative language model can be gradually updated through gradient descent to obtain a trained normative language model.
[0150] Next, we will introduce the training process of the statistical language model.
[0151] 1. Determine the second training data. Here, the second training data refers to the training data of the statistical language model.
[0152] This embodiment can obtain the target operation data in the same manner as above.
[0153] For the statistical language model, the present application hopes that the model can give operation prompt suggestions with the usage frequency as much as possible. Therefore, the target operation data can be filtered according to the usage frequency, and then the filtered data can be desensitized to obtain the second training data.
[0154] Next, the second training data is processed into sample pairs of (second preceding operation sequence, next operation), that is, the second preceding operation sequence labeled with the next operation label can be used as a training sample to train the statistical language model.
[0155] 2. Train the statistical language model based on the second training data.
[0156] Optionally, the statistical language model may be composed of a second encoder, the second language module and the second decoder.
[0157] Among them, the second encoder can perform feature encoding on the input operation sequence to obtain a second prefix operation feature matrix, the second language module can generate a matching statistical feature vector based on the second prefix operation feature matrix, and the second decoder can process the statistical feature vector into a second probability vector, and perform random sampling based on the possibility probabilities contained in the second probability vector to obtain statistical operation prompt information for the next operation based on the sampling results.
[0158] Optionally, the structure of the second encoder is the same as the structure of the first encoder described above, and will not be repeated here.
[0159] The process of training the statistical language model based on the second training data in this embodiment is similar to the training process of the normative language model mentioned above. It is only necessary to replace the first probability vector with the second probability vector. Therefore, the detailed training process is described above and will not be repeated here.
[0160] In summary, this embodiment provides a training process for a normative language model and a statistical language model. The first training data and training make the operation suggestions generated by the normative language model more normative, and will not tend to suggest corresponding operations due to the user's personal operation preferences; the second training data and training process make the statistical language model more inclined to generate operations commonly used by users.
[0161] In some other embodiments of the present application, the process of the aforementioned step S403 is introduced.
[0162] Optionally, the processes of step S403 “processing the canonical feature vector into a first probability vector” and “processing the statistical feature vector into a second probability vector” can both be implemented by a decoder.
[0163] Optionally, the process of "processing the canonical feature vector into a first probability vector and processing the statistical feature vector into a second probability vector" may include: performing dimensionality reduction processing on the canonical feature vector and the statistical feature vector respectively to obtain a first reduced dimensionality feature vector corresponding to the canonical feature vector and a second reduced dimensionality feature vector corresponding to the statistical feature vector; and normalizing the first reduced dimensionality feature vector and the second reduced dimensionality feature vector respectively to obtain a first probability vector and a second probability vector.
[0164] A first decoder implementation for processing a normalized feature vector into a first probability vector is taken as an example for introduction.
[0165] Optionally, the first decoder includes a fully connected layer and a normalization layer. The fully connected layer in the first decoder can be used to perform dimensionality reduction processing on the canonical feature vector to obtain a first reduced dimensionality feature vector corresponding to the canonical feature vector, and then the normalization function in the first decoder is used to normalize the first reduced dimensionality feature vector to obtain a first probability vector.
[0166] For example, optionally, the following formula (6) may be used to obtain the first probability vector.
[0167] (6)
[0168] in, represents the first probability vector, is the weight coefficient of the fully connected layer, is the bias value of the fully connected layer, is the normalization function.
[0169] Similarly, the second decoder for processing the statistical feature vector into a second probability vector may also include a fully connected layer and a normalization layer. The fully connected layer in the second decoder may be used to reduce the dimension of the statistical feature vector to obtain a second reduced dimension feature vector corresponding to the statistical feature vector, and then the normalization function in the second decoder is used to normalize the second reduced dimension feature vector to obtain a second probability vector. This process is similar to the previous one and will not be repeated here.
[0170] Of course, the process of step S403 may also be implemented in other ways, which are not specifically limited in this application.
[0171] In a possible implementation, the structured query language construction hint method provided in the present application can be applied to an SQL construction hinter.
[0172] For example, the user's input operation sequence is "Personnel Information", "Age", "Less than or equal to", and "20". That is, the user selects the "Personnel Information" table in the table selection box, then selects the "Age" field in the field selection bar, then selects the "Less than or equal to" button from the association symbol, and finally enters the parameter value "20".
[0173] Then the above input operation sequence is input into the SQL construction prompter, and then the SQL construction prompter can generate the normative operation prompt information (i.e. normative operation suggestion) and statistical operation prompt information (i.e. statistical operation suggestion) of the next operation according to the above embodiment, wherein the normative operation suggestion takes 20 operation suggestions and the statistical operation suggestion takes 5 operation suggestions. For example, the normative operation suggestions are "end", "and", "or", "sort", "group", "number of rows", "number of pages", etc., and the statistical operation suggestions are "end", "sort", "and", "or", "group".
[0174] The structured query language construction prompt method provided in the present application can generate normative operation suggestions and statistical operation suggestions for the next operation. The statistical operation suggestions are based on the user's historical input data to propose operation suggestions that users use more frequently, while the normative operation suggestions are more universal, and suggestions are made based on the normativeness of SQL statements, rather than the frequency of user operations. When the user needs to perform some operations that were not often used in the past, SQL can be constructed through normative operation suggestions. The combination of the two methods can not only guide users to accurately and step by step construct query conditions, but also improve the efficiency of construction and the ease of use of functions, and enhance the user experience. Compared with the method of converting natural language into SQL statements through a large language model and using SQL construction, the present application can use an ordinary neural network model with better accuracy and less resource occupation. Compared with the traditional method of using prefix matching in SQL, the present application can make operation suggestions when the prefix cannot be completely matched, which is more robust. In addition, the present application can use multiple parallel first sub-language models and multiple parallel second sub-language models, and improve the effect of the overall model generation operation through a multi-model hybrid method, with better accuracy and diversity. The specific structure of each sub-language model can be replaced by other models with similar functions, which has good flexibility and scalability.
[0175] A structured query language construction prompt method provided in an embodiment of the present application is introduced above. A device for executing the structured query language construction prompt method will be introduced below.
[0176] See also Figure 5 , Figure 5 A schematic diagram of a structured query language construction prompt device provided in an embodiment of the present application. Figure 5 As shown, the device may include:
[0177] A feature encoding module 501 is used to perform feature encoding on an input operation sequence to obtain a prefix operation feature matrix, wherein the input operation sequence is used to construct a query condition based on a structured query statement SQL;
[0178] An operation prediction module 502 is used to generate a matching standard feature vector and a statistical feature vector based on a prefix operation feature matrix using a preconfigured language module, wherein the standard feature vector is a feature vector that can be used as a basis for predicting a first operation, and the statistical feature vector is a feature vector that can be used as a basis for predicting a second operation. The first operation refers to a next operation that complies with the SQL syntax specification, and the second operation refers to a next operation obtained based on usage frequency;
[0179] A probability extraction module 503 is used to process the standard feature vector into a first probability vector and the statistical feature vector into a second probability vector, wherein the first probability vector and the second probability vector both contain the possibility probabilities that all operations are the next operation;
[0180] The prompt generating module 504 is used to perform random sampling based on the possibility probabilities respectively included in the first probability vector and the second probability vector, so as to obtain normative operation prompt information and statistical operation prompt information for the next operation based on the sampling results.
[0181] In a possible implementation, when the feature encoding module performs feature encoding on the input operation sequence to obtain the prefix operation feature matrix, it can be specifically used to:
[0182] Using a preconfigured operation dictionary, each operation included in the input operation sequence is mapped to a number, and the numbers corresponding to the operations included in the input operation sequence are obtained;
[0183] Encode the numbers corresponding to each operation into a feature matrix to obtain the feature matrix corresponding to each operation;
[0184] The feature matrices corresponding to each operation are concatenated together to obtain the prefix operation feature matrix.
[0185] In a possible implementation, the preconfigured language module includes a first language module in a normative language model and a second language module in a statistical language model.
[0186] Then, when the above-mentioned operation prediction module uses the preconfigured language module to generate a matching standard feature vector and a statistical feature vector based on the prefix operation feature matrix, it can be specifically used to: use the first language module to process the prefix operation feature matrix into a standard feature vector, and use the second language module to process the prefix operation feature matrix into a statistical feature vector.
[0187] Optionally, the normative language model is trained using a first preceding operation sequence annotated with a next operation label as a training sample, and first training data consisting of the first preceding operation sequence and the corresponding next operation is obtained by performing parameter replacement and deduplication on target operation data, wherein parameter replacement refers to replacing all specific operation parameters in the target operation data with the same placeholder;
[0188] Optionally, the statistical language model is obtained by training with the second preceding operation sequence annotated with the next operation label as a training sample, and the second training data consisting of the second preceding operation sequence and the corresponding next operation is obtained by screening the target operation data according to the usage frequency and then performing sensitive data desensitization on the screened data;
[0189] Optionally, the above target operation data refers to historical SQL query statements whose queries are successful and whose query waiting time is within a preset waiting time threshold.
[0190] In a possible implementation, the first language module includes at least one first sub-language model, and the second language module includes at least one second sub-language model.
[0191] Then, when the operation prediction module processes the prefix operation feature matrix into a standard feature vector using the first language module and processes the prefix operation feature matrix into a statistical feature vector using the second language module, it can be specifically used for:
[0192] Processing the prefix operation feature matrix into at least one first feature vector using at least one first sub-language model, and obtaining a normalized feature vector based on the at least one first feature vector;
[0193] The prefix operation feature matrix is processed into at least one second feature vector using at least one second sub-language model, and a statistical feature vector is obtained based on the at least one second feature vector.
[0194] In a possible implementation, the at least one first eigenvector includes a plurality of first eigenvectors, and the at least one second eigenvector includes a plurality of second eigenvectors.
[0195] Then, when obtaining the canonical feature vector based on at least one first feature vector, the operation prediction module may be specifically used to: splice at least one first feature vector together to obtain the canonical feature vector.
[0196] Similarly, when obtaining the statistical feature vector based on at least one second feature vector, the operation prediction module may be specifically used to: concatenate at least one second feature vector together to obtain the statistical feature vector.
[0197] In a possible implementation, when the above-mentioned probability extraction module processes the standard feature vector into the first probability vector and processes the statistical feature vector into the second probability vector, it can be specifically used to:
[0198] Performing dimensionality reduction processing on the standard feature vector and the statistical feature vector respectively, to obtain a first dimensionality reduction feature vector corresponding to the standard feature vector and a second dimensionality reduction feature vector corresponding to the statistical feature vector;
[0199] The first reduced-dimensionality feature vector and the second reduced-dimensionality feature vector are respectively normalized to obtain a first probability vector and a second probability vector.
[0200] The structured query language construction prompting device provided in this embodiment corresponds to the structured query language construction prompting method provided in the foregoing text, and details can be found in the foregoing description, which will not be repeated here.
[0201] The present application also provides an electronic device in an embodiment. Figure 6 As shown, it shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Figure 6 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0202] like Figure 6 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 to a random access memory (RAM) 603. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 603. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0203] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a memory card, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0204] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any structured query language construction prompt method provided in the embodiment of the present application.
[0205] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any structured query language construction prompt method provided in the embodiment of the present application.
[0206] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0207] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0208] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0209] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
Claims
1. A structured query language construction prompt method, characterized in that: include: Performing feature encoding on the input operation sequence to obtain a prefix operation feature matrix, wherein the input operation sequence is used to construct a query condition based on a structured query statement SQL; Using a preconfigured language module, a matching standard feature vector and a statistical feature vector are generated based on the prefix operation feature matrix, wherein the standard feature vector is a feature vector that can be used as a basis for predicting a first operation, and the statistical feature vector is a feature vector that can be used as a basis for predicting a second operation, wherein the first operation refers to a next operation that complies with SQL grammar specifications, and the second operation refers to a next operation obtained based on usage frequency; Processing the canonical feature vector into a first probability vector, and processing the statistical feature vector into a second probability vector, wherein the first probability vector and the second probability vector both contain the possibility probabilities that all operations are the next operation; Random sampling is performed based on the possibility probabilities respectively included in the first probability vector and the second probability vector, so as to obtain normative operation prompt information and statistical operation prompt information for the next operation based on the sampling results.
2. The structured query language construction prompt method according to claim 1, characterized in that: The feature encoding of the input operation sequence is performed to obtain a prefix operation feature matrix, including: Using a preconfigured operation dictionary, each operation included in the input operation sequence is mapped to a number, so as to obtain numbers corresponding to the operations included in the input operation sequence; Encode the numbers corresponding to the operations into feature matrices to obtain feature matrices corresponding to the operations; The feature matrices corresponding to the operations are concatenated together to obtain the prefix operation feature matrix.
3. The structured query language construction prompt method according to claim 1, characterized in that: The preconfigured language modules include a first language module in a normative language model and a second language module in a statistical language model; The method of using a preconfigured language module to generate a matching canonical feature vector and a statistical feature vector based on the prefix operation feature matrix includes: Processing the prefix operation feature matrix into the canonical feature vector using the first language module; Processing the prefix operation feature matrix into the statistical feature vector using the second language module; The normative language model is trained by taking the first preceding operation sequence annotated with the next operation label as a training sample, and the first training data consisting of the first preceding operation sequence and the corresponding next operation is obtained by performing parameter replacement and deduplication on the target operation data, wherein the parameter replacement refers to replacing all specific operation parameters in the target operation data with the same placeholder; The statistical language model is trained by taking the second preceding operation sequence marked with the next operation label as a training sample, and the second training data consisting of the second preceding operation sequence and the corresponding next operation is obtained by screening the target operation data according to the usage frequency and then performing sensitive data desensitization on the screened data; The target operation data refers to historical SQL query statements whose queries are successful and whose query waiting time is within a preset waiting time threshold.
4. The structured query language construction prompt method according to claim 3, characterized in that: The first language module includes at least one first sub-language model, and the second language module includes at least one second sub-language model; The using the first language module to process the prefix operation feature matrix into the standard feature vector, and using the second language module to process the prefix operation feature matrix into the statistical feature vector, comprises: Processing the prefix operation feature matrix into at least one first feature vector using the at least one first sub-language model, and obtaining the canonical feature vector based on the at least one first feature vector; The prefix operation feature matrix is processed into at least one second feature vector by using the at least one second sub-language model, and the statistical feature vector is obtained based on the at least one second feature vector.
5. The structured query language construction prompt method according to claim 4, characterized in that: The at least one first eigenvector comprises a plurality of first eigenvectors, and the at least one second eigenvector comprises a plurality of second eigenvectors; The obtaining of the canonical feature vector based on the at least one first feature vector comprises: splicing the at least one first eigenvector together to obtain the canonical eigenvector; The obtaining the statistical feature vector based on the at least one second feature vector comprises: The at least one second feature vector is concatenated together to obtain the statistical feature vector.
6. The structured query language construction prompt method according to claim 1, characterized in that: The processing of the canonical feature vector into a first probability vector and the processing of the statistical feature vector into a second probability vector comprises: Performing dimensionality reduction processing on the standard feature vector and the statistical feature vector respectively to obtain a first dimensionality reduction feature vector corresponding to the standard feature vector and a second dimensionality reduction feature vector corresponding to the statistical feature vector; The first reduced-dimensionality feature vector and the second reduced-dimensionality feature vector are respectively normalized to obtain the first probability vector and the second probability vector.
7. A structured query language construction prompt device, characterized in that: include: A feature encoding module, used for performing feature encoding on an input operation sequence to obtain a prefix operation feature matrix, wherein the input operation sequence is used to construct a query condition based on a structured query statement SQL; An operation prediction module, used to generate a matching standard feature vector and a statistical feature vector based on the prefix operation feature matrix using a preconfigured language module, wherein the standard feature vector is a feature vector that can be used as a basis for predicting a first operation, and the statistical feature vector is a feature vector that can be used as a basis for predicting a second operation, wherein the first operation refers to a next operation that complies with the SQL syntax specification, and the second operation refers to a next operation obtained based on a usage frequency; A probability extraction module, used for processing the canonical feature vector into a first probability vector, and processing the statistical feature vector into a second probability vector, wherein the first probability vector and the second probability vector both contain the possibility probabilities that all operations are the next operation; The prompt generation module is used to perform random sampling based on the possibility probabilities respectively included in the first probability vector and the second probability vector, so as to obtain normative operation prompt information and statistical operation prompt information for the next operation based on the sampling results.
8. A computer program product, characterized in that The method comprises computer-readable instructions, and when the computer-readable instructions are executed on an electronic device, the electronic device implements the structured query language construction prompt method according to any one of claims 1 to 6.
9. An electronic device, characterized in that: The method comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the structured query language construction prompt method according to any one of claims 1 to 6.
10. A computer storage medium, characterized in that: The storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can implement the structured query language construction prompt method as described in any one of claims 1 to 6.