Data processing method, computing device, storage medium and computer program product
By determining the target data storage unit and decomposing natural language queries, and generating structured query statements, the accuracy problem when natural language is converted into structured query is solved, and accurate search and efficient processing of data are achieved.
Patent Information
- Application Number
- CN202411864481.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-01-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When natural language query is converted into structured query statements, due to the arbitrary and complexity of natural language, the accuracy is poor and the data that users want cannot be accurately found. The existing technology is difficult to effectively solve this problem.
By determining the target data storage unit of the pending problem and decomposing it when the preset decomposition conditions are met, multiple sub-problems are obtained and structured query statements are generated using the sub-problems, thereby achieving simplification of natural language and accurate data search.
Improve the accuracy and efficiency of data processing, ensure that structured query statements can accurately find the required data from the target data storage unit, and improve task processing efficiency and problem-solving performance.
Smart Images

Figure CN119322788A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification relate to the field of computer technology, and in particular, to data processing methods, computing devices, storage media, and computer program products. Background Art
[0002] In the field of natural language processing, natural language queries can be converted into structured query statements in order to interact with relational databases. Specifically, it is possible to understand the information needs expressed by users in natural language and accurately convert them into instructions that can be executed by the database, thereby realizing data query and acquisition. However, due to the randomness and complexity of natural language, such as the possibility of vocabulary, grammar and even semantic ambiguity in natural language, user questions may not be precise enough, lack necessary detailed information, and natural language is relatively complex, all of which will result in poor accuracy when converting natural language into structured query statements, resulting in the inability to accurately find the desired data when the structured query statement is subsequently executed. Based on this, an effective technical solution is urgently needed to solve the above problems. Summary of the invention
[0003] In view of this, the embodiments of this specification provide two data processing methods. One or more embodiments of this specification also involve two data processing devices, a computing device, a computer-readable storage medium and a computer program product to solve the technical defects existing in the prior art.
[0004] According to a first aspect of an embodiment of this specification, a data processing method is provided, including: Determine the target data storage unit corresponding to the problem to be processed; When it is determined that the problem to be processed meets the preset decomposition condition, the problem to be processed is decomposed to obtain a plurality of sub-problems corresponding to the problem to be processed, wherein the plurality of sub-problems are used to represent the processing logic of the problem to be processed; Generate a structured query statement corresponding to the problem to be processed according to the problem to be processed, the multiple sub-problems and the target data storage unit; Execute the structured query statement to obtain the problem processing result corresponding to the problem to be processed.
[0005] According to a second aspect of an embodiment of this specification, there is provided a data processing device, including: A determination module, configured to determine a target data storage unit corresponding to the problem to be processed; A decomposition module is configured to decompose the problem to be processed to obtain a plurality of sub-problems corresponding to the problem to be processed when it is determined that the problem to be processed meets a preset decomposition condition, wherein the plurality of sub-problems are used to represent the processing logic of the problem to be processed; A generating module is configured to generate a structured query statement corresponding to the problem to be processed according to the problem to be processed, the multiple sub-problems and the target data storage unit; The execution module is configured to execute the structured query statement to obtain the problem processing result corresponding to the problem to be processed.
[0006] According to a third aspect of an embodiment of this specification, a data processing method is provided, which is applied to a cloud-side device, including: The receiving end-side device sends the pending problem, and determines the target data storage unit corresponding to the pending problem; When it is determined that the problem to be processed meets the preset decomposition condition, the problem to be processed is decomposed to obtain a plurality of sub-problems corresponding to the problem to be processed, wherein the plurality of sub-problems are used to represent the processing logic of the problem to be processed; Generate a structured query statement corresponding to the problem to be processed according to the problem to be processed, the multiple sub-problems and the target data storage unit; Execute the structured query statement to obtain a problem processing result corresponding to the problem to be processed, and send the problem processing result to the terminal side device.
[0007] According to a fourth aspect of an embodiment of this specification, a data processing device is provided, which is applied to a cloud-side device, including: A receiving module, configured to receive the pending problem sent by the terminal side device, and determine a target data storage unit corresponding to the pending problem; A decomposition module is configured to decompose the problem to be processed to obtain a plurality of sub-problems corresponding to the problem to be processed when it is determined that the problem to be processed meets a preset decomposition condition, wherein the plurality of sub-problems are used to represent the processing logic of the problem to be processed; A generating module is configured to generate a structured query statement corresponding to the problem to be processed according to the problem to be processed, the multiple sub-problems and the target data storage unit; The execution module is configured to execute the structured query statement, obtain the problem processing result corresponding to the problem to be processed, and send the problem processing result to the terminal side device.
[0008] According to a fifth aspect of an embodiment of this specification, a computing device is provided, including: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the above-mentioned data processing method are implemented.
[0009] According to a sixth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores a computer program / instruction, and the computer program / instruction implements the steps of the above-mentioned data processing method when executed by a processor.
[0010] According to a seventh aspect of the embodiments of this specification, there is provided a computer program product, comprising a computer program / instruction, which implements the steps of the above-mentioned data processing method when executed by a processor.
[0011] An embodiment of the present specification provides a data processing method, including: determining a target data storage unit corresponding to a problem to be processed; when it is determined that the problem to be processed meets a preset decomposition condition, decomposing the problem to be processed to obtain multiple sub-problems corresponding to the problem to be processed, wherein the multiple sub-problems are used to represent the processing logic of the problem to be processed; generating a structured query statement corresponding to the problem to be processed based on the problem to be processed, the multiple sub-problems and the target data storage unit; and executing the structured query statement to obtain a problem processing result corresponding to the problem to be processed. The above method determines the target data storage unit corresponding to the problem to be processed as a natural language, and judges whether the problem to be processed meets the preset decomposition conditions. When it is judged that the problem to be processed meets the preset decomposition conditions, the problem to be processed is decomposed to obtain multiple sub-problems, and the multiple sub-problems are used to represent the problem processing logic of the problem to be processed. The sub-problems are used to interpret the problem to be processed, thereby simplifying the complex natural language. Subsequently, the corresponding structured query statement is generated according to the problem to be processed, the multiple sub-problems and the target data storage unit, so that when the structured query statement is executed, the corresponding target data can be accurately found from the target data storage unit and the problem processing result of the problem to be processed can be obtained, so as to solve the problem to be processed and improve the task processing efficiency and problem solving performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 This is a schematic diagram of an application scenario of a data processing method provided by an embodiment of this specification; Figure 2 is a flow chart of a data processing method provided by an embodiment of this specification; Figure 3 is a processing flow chart of a data processing method provided by an embodiment of this specification; Figure 4is a structural schematic diagram of a data processing device provided by an embodiment of this specification; Figure 5 It is a structural diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION
[0013] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
[0014] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0015] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0016] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0017] In one or more embodiments of this specification, a large model refers to a deep learning model with large-scale model parameters, which usually contains hundreds of millions, tens of billions, hundreds of billions, trillions, or even more than 10 trillion model parameters. A large model can also be called a foundation model / foundation model. The large model is pre-trained with large-scale unlabeled corpus to produce a pre-trained model with more than 100 million parameters. This model can adapt to a wide range of downstream tasks, and the model has good generalization ability, such as a large-scale language model (LLM, Large Language Model), a multi-modal pre-training model, etc.
[0018] When the big model is used in practice, only a small number of samples are needed to fine-tune the pre-trained model and it can be applied to different tasks. The big model can be widely used in natural language processing (NLP), computer vision and other fields. Specifically, it can be applied to computer vision tasks such as visual question answering (VQA), image description (IC, Image Caption), image generation, as well as natural language processing tasks such as text-based sentiment classification, text summary generation, and machine translation. The main application scenarios of the big model include digital assistants, intelligent robots, search, online education, office software, e-commerce, intelligent design, etc.
[0019] First, the terms involved in one or more embodiments of this specification are explained.
[0020] SQL: Structured Query Language, a standard programming language for managing and processing relational databases. It is designed to store, retrieve, manage and manipulate data in relational databases. SQL includes multiple functions such as data query, data manipulation, data definition and data control.
[0021] LLM: Large Language Model, a deep learning model, especially a model based on the Transformer architecture, which learns the statistical laws of language by pre-training on massive text data. Such models usually contain billions or more parameters and can perform various natural language processing tasks such as text generation, question answering, translation, etc.
[0022] ICL: In-Context Learning, context learning, which means that when using a large-scale pre-trained model, the model is able to reason and generate responses based on the contextual information in the input text without the need for a dedicated fine-tuning process. Usually only a small number of examples are needed to effectively guide the model to generate the desired results.
[0023] CTE: Common Table Expression, is a temporary result set defined in a SQL query. It is similar to a temporary table, but only exists in a single query. CTE can be used to simplify complex queries and make them clearer and easier to read. It can be referenced multiple times in a query and can be used for recursive queries.
[0024] JOIN operation: A method used in SQL to obtain data from two or more tables.
[0025] API: Application Programming Interface, a set of rules and definitions that allow different software applications to communicate with each other. The API defines how requests and responses are made, available functions, data formats, etc.
[0026] Text2SQL: A natural language processing technology that automatically converts user queries or requests in natural language into SQL queries that can be executed in a relational database.
[0027] COT: Chain of Thought, a method to enhance reasoning ability, is commonly used in the fields of natural language processing and machine learning. COT guides the model to gradually unfold the thinking process when reasoning, rather than directly giving the final answer. Doing so helps the model understand the problem more clearly and improves the accuracy of its generated answers. The working principle is to break down a complex problem into smaller and simpler parts. Through the step-by-step reasoning process, logical relationships are established, and after completing each step of the thought chain, a comprehensive answer is finally generated.
[0028] In practical applications, in the field of data query, natural language can be converted into structured query language to achieve data query, which can lower the threshold for non-technical personnel to access database information and simplify the data analysis process. Specifically, it can understand the user's intention and identify key parts in natural language, such as entities, attributes, context, and specific conditions. Based on the database architecture and content to be searched, identify the data tables required to generate structured query language. Based on the understanding of natural language and database, generate the corresponding structured query language. This task currently has the following problems that need to be solved.
[0029] First of all, due to the randomness and complexity of natural language, the ambiguity, vagueness and uncertainty of natural language, problems such as word meaning ambiguity, syntactic ambiguity and insufficient information will arise. A large number of consecutive questions and progressive questions also increase the difficulty of language conversion.
[0030] Secondly, due to the complexity of the database and the incompleteness of the data, the complex database architecture and the huge volume of data pose challenges to the effective execution of the language conversion task, including the complexity of the relationships between tables, the similarity of column names, changes in data in specific fields, large data volume, incomplete data, and problems with data quality.
[0031] Moreover, in the conversion from natural language to structured query language, the syntax conversion of structured query language often has multiple expressions for one intention, which is a one-to-many mapping. Based on this, when generating structured query language in a large model, higher-quality corpus examples are often required for learning, and unified, standardized, and clear corpus enhancement is required to enable the large model to complete more accurate generation.
[0032] In order to solve the above technical problems, a data processing method is provided in this specification. This specification also involves a data processing device, a computing device, a computer-readable storage medium, and a computer program product, which are described in detail one by one in the following embodiments.
[0033] See also Figure 1 , Figure 1 A schematic diagram of an application scenario of a data processing method provided according to an embodiment of the present specification is shown, and the data processing method specifically includes the following steps.
[0034] Determine the target data storage unit corresponding to the problem to be processed; When it is determined that the problem to be processed meets the preset decomposition condition, the problem to be processed is decomposed to obtain a plurality of sub-problems corresponding to the problem to be processed, wherein the plurality of sub-problems are used to represent the processing logic of the problem to be processed; Generate a structured query statement corresponding to the problem to be processed according to the problem to be processed, the multiple sub-problems and the target data storage unit; Execute the structured query statement to obtain the problem processing result corresponding to the problem to be processed.
[0035] Specifically, Figure 1The data processing method includes a terminal device 102 and a cloud device 104. The data processing method can be applied to a database of an e-commerce platform, for example, and the database of the e-commerce platform is used to store e-commerce data of the e-commerce platform, such as commodity sales data, cost data, price data, profit data, etc. In actual applications, personnel of the e-commerce platform can use the data processing method to search for data from the database of the e-commerce platform.
[0036] In specific implementation, the user can send the problem to be processed to the cloud-side device 104 through the terminal-side device 102, and the cloud-side device 104 can determine the target data storage unit corresponding to the problem to be processed, and when it is determined that the problem to be processed meets the preset decomposition conditions, decompose the problem to be processed to obtain multiple sub-problems, and generate a structured query statement corresponding to the problem to be processed based on the problem to be processed, the multiple sub-problems and the target data storage unit, and send the structured query statement to the terminal-side device 102, and execute the structured query statement through the terminal-side device 102 to obtain the problem processing result of the problem to be processed. Alternatively, the cloud-side device 104 can also directly execute the structured query statement to obtain the problem processing result corresponding to the problem to be processed, and send the problem processing result to the terminal-side device 102.
[0037] The end-side device 102 may include a browser, an APP (Application), or a web application such as an H5 (Hyper Text Markup Language 5, version 5 of Hypertext Markup Language) application, or a light application (also known as a mini-program, a lightweight application) or a cloud application, etc. The end-side device may be based on a software development kit (SDK) of the corresponding service provided by the server, such as based on the real-time communication (RTC, Real Time Communication) SDK development and acquisition. The end-side device may be deployed in an electronic device and needs to rely on the device to run or some APPs in the device to run. The electronic device may have a display screen and support information browsing, such as a personal mobile terminal such as a mobile phone, a tablet computer, a personal computer, etc. Various other types of applications may also be configured in the electronic device, such as human-computer dialogue applications, model training applications, text processing applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0038] The cloud-side device 104 can be understood as a server that provides various services, including physical servers and cloud servers, such as a server that provides communication services for multiple clients, a server for background training that supports the model used on the client, and a server that processes the data sent by the client. It should be noted that the cloud-side device 104 can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. The cloud-side device 104 can also be a server for a distributed system, or a server combined with a blockchain. The cloud-side device 104 can also be a cloud server for basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks (CDNs), and big data and artificial intelligence platforms, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.
[0039] See also Figure 2 , Figure 2 A flow chart of a data processing method provided according to an embodiment of the present specification is shown, which specifically includes the following steps.
[0040] Step 202: Determine the target data storage unit corresponding to the problem to be processed.
[0041] Specifically, the data processing method provided in the embodiments of this specification can be applied to the field of language conversion, for example, natural language can be converted into structured query statements. In the field of data query for databases, the data processing method can be used to convert data search questions raised by users in natural language into structured query statements, and the structured query statements are executed to realize data search. It can be understood that the data processing method can be applied to databases in various fields, such as databases in the industrial field, databases in the medical field, databases in the e-commerce field, etc., and this specification does not limit this.
[0042] For ease of understanding, an embodiment of this specification is described by taking the application of the data processing method to a database in the industrial field as an example, which does not affect the application of the data processing method in other fields.
[0043] Among them, the problem to be processed can be understood as a natural language question raised by the user, such as "What is the planned maintenance capacity of the unit on April 22, 2024?", "How many goods were sold in March 2024?", etc. The target data storage unit can be understood as a data storage unit associated with the problem to be processed, that is, the data that the problem to be processed wants to find is stored in the target data storage unit. For example, if the problem to be processed is "How many goods were sold in March 2024?", then the target data storage unit corresponding to the problem to be processed can be a data source for storing the number of goods sold (such as a database or a data table).
[0044] In practical applications, the above data processing method can be executed using the Text2SQL model, which includes a table selector, a question decomposer, and an SQL corrector. In addition, the Text2SQL model can be evaluated based on the SQL pass rate and the running accuracy. Among them, the SQL pass rate can be calculated by maintaining the data tables, data columns, and data values contained in the reference structured query statement, and comparing the generated structured query statement with the reference structured query statement. When the generated structured query statement contains all important data tables, data columns, and data values, it is judged that the SQL has passed, and the overall SQL pass rate is calculated based on this. The running accuracy can be calculated by the running results of the generated structured query statement and the running results of the reference structured query statement.
[0045] In a specific implementation, the step of determining a target data storage unit corresponding to the problem to be processed includes: Performing text recognition on the problem to be processed to obtain multiple indicator dimensions corresponding to the problem to be processed; According to the multiple indicator dimensions, a target data storage unit corresponding to the problem to be processed is determined from multiple candidate data storage units.
[0046] Among them, the indicator dimension may include the indicator classification, indicator name, region, time, etc. described in the problem to be processed. For example, if the problem to be processed is "What is the number of goods sold in region A in March 2024?", then the multiple indicator dimensions corresponding to the problem to be processed may include the product dimension, the sales dimension, the quantity dimension, and the region dimension. The candidate data storage unit can be understood as a data source for storing data, which may include a database and a data table, etc. There may be a corresponding relationship between the candidate data storage units and the indicator dimensions, for example, the correspondence may be achieved through an indicator tree. For example, the indicator classification is power generation, and the indicator names under this indicator classification may include: distributed photovoltaic power generation below 10 kV, distributed photovoltaic power generation above 10 kV, distributed photovoltaic power generation, centralized photovoltaic power generation, photovoltaic power generation, wind power generation, centralized new energy power generation, new energy power generation, energy storage power generation, independent energy storage power generation, etc.; the indicator classification is power abandonment, and the indicator names under this indicator classification may include: distributed photovoltaic abandonment below 10 kV, distributed photovoltaic abandonment above 10 kV, centralized photovoltaic abandonment, photovoltaic abandonment, wind power abandonment, centralized new energy abandonment and new energy abandonment, etc. Each indicator name may correspond to one or more data sources, which are the above-mentioned candidate data storage units.
[0047] Specifically, text recognition can be performed on the problem to be processed to obtain multiple indicator dimensions of the description of the problem to be processed, and according to the multiple indicator dimensions, a target data storage unit related to the multiple indicator dimensions can be selected from multiple candidate data storage units. In addition, according to a single indicator dimension, a target data storage unit related to the single indicator dimension can be selected from multiple candidate data storage units.
[0048] In practical applications, the selection of the above target data storage unit can be realized based on the table selector. It is understandable that when processing a large database, the table selector can decompose it into smaller sub-databases to reduce interference from irrelevant information. Databases often contain many tables and columns, and their huge architecture may exceed the processing capacity of LLM in a single API call. At the same time, for projects, there is often a need to "jump tables" for the same indicator. For example: when asking about the utilization rate, under the historical monthly query conditions, it is necessary to select a data source 1; when asking about the latest monthly query conditions before data source 1 is updated, it is necessary to select another data source 2; under the daily level, it is necessary to select data source 3; under different unit query conditions, different data sources need to be selected... For example, "As of April 30 last year, the number of hours of new energy utilization / consumption rate" needs to be found from data source 1, and similarly, "As of May 30 this year, the number of hours of new energy utilization / consumption rate" (monthly report has not been released) needs to be found from data source 2. This makes it difficult for LLM to select the right table column for correct generation based on table column information even when multiple data sources are recalled.
[0049] Based on this, the table selector can be used to implement initial screening, and the target data storage unit related to the problem to be processed can be screened from multiple candidate data storage units (i.e., multiple data sources) to reduce the interference of irrelevant information. Specifically, multiple indicator dimensions can be identified based on LLM combined with ICL, and knowledge representation can be performed on multiple indicator dimensions, so that the large model can deeply understand the single node and node relationship of multiple indicator dimensions, and represent them based on a dictionary-like method.
[0050] In actual applications, the initial screening can be achieved based on the prompt word project to guide the table selector. The prompt word project can include task descriptions, pending issues, indicator analysis methods and indicator analysis examples based on the table selector. For example, it can be "You are now an expert in power BI intention analysis. I will give you a 'customer question' and 'indicator analysis method' as an option. In the 'indicator analysis method', 'indicator classification' refers to the first-level indicator classification, and 'indicator name' contains a list. The list lists the second-level specific indicators under the first-level indicator classification. Please analyze the 'customer question', identify the indicator classification and indicator name described in the question, select 'indicator classification' from the 'standard analysis method', and locate the indicator from the 'indicator name' list. Note: 1. The original content of the 'standard analysis method' cannot be changed. 2. 'Indicator classification' and 'indicator name' that are not related to the 'customer question' cannot be returned. 3. If the 'customer question' contains multiple indicators, return 'None'. 4. If no relevant indicators are found, return 'None'. Indicator analysis method: 1. Indicator classification: Send Electricity, indicator name: ['Distributed photovoltaic power generation below 10 kV', 'Distributed photovoltaic power generation above 10 kV', 'Distributed photovoltaic power generation (below 10 kV + above 10 kV)', 'Centralized photovoltaic power generation', 'Photovoltaic power generation', 'Wind power generation', 'Centralized new energy power generation', 'New energy power generation', 'Energy storage power generation', 'Independent energy storage power generation', 'Supporting energy storage power generation']; 2. Indicator classification: Abandoned electricity, indicator name: ['Abandoned distributed photovoltaic power generation below 10 kV', '1 0 kV and above distributed photovoltaic power abandonment','Distributed photovoltaic power abandonment (below 10 kV + above 10 kV)','Centralized photovoltaic power abandonment','Photovoltaic power abandonment','Wind power abandonment','Centralized renewable energy abandonment','Renewable energy abandonment']; 3.......Example 1: Input: Customer question: What was the renewable energy power generation in October last year? Input: Indicator category: renewable energy power generation, indicator name: renewable energy power generation; Start now! Input: Customer question: What was the photovoltaic power generation for the whole year last year? ". After obtaining the indicator category and indicator name output by the table selector, the corresponding data source (i.e., the target data storage unit) can be obtained from the indicator tree.
[0051] In summary, by screening the target data storage units related to the problem to be processed, the interference of other irrelevant information is reduced, and the accuracy of the generated structured query statement is further guaranteed.
[0052] Furthermore, in one embodiment of the present specification, after obtaining the output results of the indicator classification and indicator name output by the table selector, the problem to be processed can be rewritten to obtain the rewritten problem to be processed, and then the problem to be processed can be processed based on the rewritten problem to generate a structured query statement. For example, the problem to be processed is "What was the annual photovoltaic power generation last year?", the indicator classification output by the table selector is power generation, the indicator name is photovoltaic power generation, the regional type is province, and the data type is monthly report, then the problem to be processed can be rewritten to obtain the rewritten problem to be processed as "What was the annual photovoltaic power generation last year? (Using data table A)" In addition, when screening the target data storage unit, the screening task can be decomposed into the identification of the relevant indicator dimensions of each data storage unit selection, and multiple identification results can be combined to form the final target data storage unit selection. This can achieve the standardization of the data storage unit screening task, the convenience of module decoupling, the convenience of combining with external tools, and the accuracy of identification.
[0053] Step 204: When it is determined that the problem to be processed meets the preset decomposition condition, the problem to be processed is decomposed to obtain multiple sub-problems corresponding to the problem to be processed, wherein the multiple sub-problems are used to represent the processing logic of the problem to be processed.
[0054] The preset decomposition condition can be understood as the condition that the problem to be processed is a complex problem, that is, the problem to be processed cannot be directly obtained by searching a data source. The sub-problem can be understood as the problem processing steps for the problem to be processed.
[0055] Specifically, after determining the problem to be processed, it can be determined whether the problem to be processed meets the preset decomposition conditions. If it is determined that the problem to be processed meets the preset decomposition conditions, it means that the problem to be processed is a complex problem. The problem processing steps of the problem to be processed can be decomposed to obtain multiple sub-problems corresponding to the problem to be processed.
[0056] In a specific implementation, when it is determined that the problem to be processed meets the preset decomposition condition, the problem to be processed is decomposed to obtain multiple sub-problems corresponding to the problem to be processed, including: Determine the complexity of the problem to be addressed; When it is determined, based on the complexity, that the problem to be processed meets the preset decomposition condition, the problem to be processed is decomposed to obtain a plurality of sub-problems corresponding to the problem to be processed.
[0057] In practical applications, the complexity of the problem can be predefined, and the problem can be divided into simple problems, medium problems and complex problems. Among them, the complexity of simple problems is less than that of medium problems. Simple problems usually involve basic query structures, and a basic structured query statement can be generated through a simple natural language question. Simple problems can be solved by accessing a single table and do not involve complex filtering conditions or aggregate functions. They have the characteristics of single table query, no need for join operations, simple filtering conditions, and basic selection statements. For example, a simple question can be "What is the planned capacity of the unit maintenance on April 22, 2024?". Medium problems require a more complex table structure, which may involve multiple fields or aggregate functions, but do not require complex joins or nested queries. They usually contain more complex filtering conditions and simple JOIN operations, or may also involve sorting operations. Medium problems can be, for example, "When does the maximum load occur during the midday peak in a certain area on November 5, 2023?". Complex problems are aimed at more complex scenarios and usually require complex connections and nested queries of multiple data sources. These complex problems usually require understanding the details of the problem semantics and multi-step logical reasoning. They may involve complex JOIN operations of multiple data sources, deeply nested queries, complex aggregation and filtering conditions, and multi-step sub-queries. They require strong logical reasoning skills and the need to combine multiple concepts to understand the problem. For example, it can be a complex problem of calculating indicators, such as "How many protective devices will be in service beyond their expiration date in a certain region in 2026? (To query the protective devices that have been in service beyond their expiration date, it is necessary to return the protective devices that have been in service for more than 15 years from the date of commissioning to the determined time condition)", "How many hours was the utilization of a certain power station last year?" It can also be logical reasoning and deep nested problems, such as "What is the ranking of the highest power load of the entire network in a certain region in the province in 2023?" It can also be a complex year-on-year calculation problem, such as "Which region had the highest year-on-year increase in the highest load during the peak summer period last year?" It can also be a hyperbola superposition calculation problem, such as "What is the maximum proportion of distributed renewable energy power generation output to the total power load of the entire network in August 2023?" It can also be a complex calculation problem with progressive conditions, such as "What is the total power load of the entire network corresponding to the maximum output of photovoltaic power in a certain region in March 2024?" It can also be a complex reasoning and project concept understanding problem, such as "What is the proportion of new energy power generation to the total power consumption of the entire network on the day when the load exceeded 100 million?"
[0058] Specifically, the complexity of the problem to be processed can be determined, and the complexity of the problem to be processed can be matched with the complexity of the pre-defined problem, and whether the problem to be processed is a complex problem can be determined based on the matching result. If so, the problem to be processed is decomposed to obtain multiple sub-problems. In specific implementation, the complexity of the problem to be processed can be determined based on the problem elements contained in the problem to be processed, or the complexity of the problem to be processed can be determined based on the problem type of the problem to be processed. For example, when the problem to be processed is a year-on-year problem, a project indicator calculation problem, and a progressive problem, the problem to be processed is determined to be a complex problem.
[0059] In practical applications, complex problems can include year-on-year problems, project indicator calculation problems, and progressive problems. For example, a year-on-year problem can be "How much did the total grid electricity consumption grow year-on-year in the spring of last year?" The multiple sub-problems obtained by decomposing this problem are "1. Calculate the total grid electricity consumption in the spring of last year; 2. Calculate the total grid electricity consumption in the spring of the year before last; 3. Calculate the year-on-year growth rate." A project indicator calculation problem can be "Calculate the utilization rate of new energy." The multiple sub-problems obtained by decomposing this problem are "1. Calculate the amount of new energy power generation; 2. Calculate the amount of new energy abandoned; 3. Calculate the utilization rate of new energy." A progressive problem can be "How many regions set new records on the day when the total grid electricity load exceeded 100 million in February, March, July, and August 2017?" The multiple sub-problems obtained by decomposing this problem are "1. Find the dates when the total grid electricity load exceeded 100 million in February, March, July, and August 2017; 2. Count the number of regions that set new records on these dates."
[0060] In summary, by judging the complexity of the problem to be processed, we can determine whether the problem needs to be decomposed, and perform subsequent decomposition steps on the problem to be processed without decomposing all the problems to be processed, thereby reducing the occupation and consumption of computing resources and further improving the processing efficiency of the problems to be processed.
[0061] Furthermore, the problem to be processed is decomposed to obtain a plurality of sub-problems corresponding to the problem to be processed, including: The problem to be processed is decomposed by using the problem processing model to obtain multiple sub-problems corresponding to the problem to be processed.
[0062] The problem processing model can be understood as a model used to decompose the problem to be processed and generate structured query statements. In practical applications, the problem processing model can be a large model, or other machine learning models or neural network models.
[0063] Specifically, the problem processing model can be used to decompose the problem to be processed, obtain multiple sub-problems corresponding to the problem to be processed, and realize the decomposition of the problem to be processed, so as to facilitate the subsequent conversion into a structured query statement.
[0064] In a specific implementation, the problem processing model is used to decompose the problem to be processed to obtain multiple sub-problems corresponding to the problem to be processed, including: Generate a prompt text corresponding to the problem to be processed according to the problem to be processed and a pre-created prompt text template; The problem processing model is used to decompose the problem to be processed according to the prompt text to obtain multiple sub-problems corresponding to the problem to be processed.
[0065] Among them, the prompt text template can be understood as a template for guiding the problem processing model to decompose the problem to be processed. For example, the prompt text template can be "You are an expert in SQL query question decomposition. Your task is to infer multiple sub-questions from a given complex question. Please follow the steps below: 1. Carefully read and understand the complex question provided. 2. Decompose the complex question into multiple sub-questions. Each sub-question should be able to be solved independently, and finally combined to answer the original question. Please output the results in the following format: - **Original question**: [provided complex question] - **Sub-questions**: - [Sub-question 1]: [Describe the first sub-question] - [Sub-question 2]: [Describe the second sub-question] -... Please operate according to the following examples: --- ###Example 1: **Original question**: How much did the total grid electricity consumption increase year-on-year in the spring of last year? **Sub-questions**: - What was the total grid electricity consumption in the spring of last year? - What was the total grid electricity consumption in the spring of the year before last? - Year-on-year growth rate = (total grid electricity consumption in the spring of last year - total grid electricity consumption in the spring of the year before last) / total grid electricity consumption in the spring of the year before last --- ###Example 2: ... Now, please deal with the following questions: **Original question**: [Enter your complex question] **Sub-questions**: -[Sub-question 1]: [Describe the first sub-question] -[Sub-question 2]: [Describe the second sub-question]" Specifically, the problem to be processed can be used to replace the position of the complex problem in the pre-created prompt text template to obtain the prompt text corresponding to the text to be processed, and the problem processing model can be used to decompose the text to be processed according to the prompt text to obtain multiple sub-problems corresponding to the problem to be processed.
[0066] In summary, by using the prompt text to guide the problem processing model to decompose the problem to be processed, the understanding ability of the problem processing model is further improved, and the accuracy of multiple sub-problems decomposed by the problem processing model is further ensured.
[0067] Step 206: Generate a structured query statement corresponding to the problem to be processed according to the problem to be processed, the multiple sub-problems and the target data storage unit.
[0068] Specifically, after the problem to be processed is decomposed to obtain multiple sub-problems, a structured query statement corresponding to the problem to be processed can be generated according to the problem to be processed, the multiple sub-problems and the target data storage unit.
[0069] Among them, the structured query statement can be understood as the SQL language that can be recognized by the database.
[0070] In a specific implementation, generating a structured query statement corresponding to the problem to be processed according to the problem to be processed, the multiple sub-problems and the target data storage unit includes: According to the multiple sub-problems, the problem to be processed is supplemented to obtain a problem processing logic including the problem to be processed and the multiple sub-problems; A structured query statement corresponding to the problem to be processed is generated according to the problem processing logic and the target data storage unit.
[0071] Specifically, the problem to be processed can be supplemented according to the multiple sub-problems to obtain the supplemented problem processing logic, which includes the problem to be processed and multiple sub-problems, and according to the problem processing logic and the target data storage unit, based on the CTE syntax, a structured query statement corresponding to the problem to be processed is generated.
[0072] In practical applications, these multiple sub-problems, as the decomposition results of the problem to be processed, can be supplemented after the problem to be processed to form an explanation (i.e., problem processing logic). For example, it can be "How much did the total grid electricity consumption increase year-on-year in the spring of last year? (Step 1: How much was the total grid electricity consumption last spring? Step 2: How much was the total grid electricity consumption in the spring of the year before last? Step 3: Year-on-year growth rate = (total grid electricity consumption last spring - total grid electricity consumption in the spring of the year before last) / total grid electricity consumption in the spring of the year before last)".
[0073] In summary, by using sub-questions to supplement the problem to be processed, the accuracy of the structured query statement can be further improved.
[0074] Further, in one embodiment of the present specification, generating a structured query statement corresponding to the problem to be processed according to the problem processing logic and the target data storage unit includes: According to the thinking chain reasoning strategy, the problem processing logic and the unit attribute information of the target data storage unit are grammatically solved to generate a structured query statement corresponding to the problem to be processed.
[0075] The unit attribute information of the target data storage unit may be understood as identification information of the data source, such as the table name of a data table.
[0076] In practical applications, we can use the problem decomposer, the thinking chain reasoning strategy, and the CTE syntax to gradually solve the problem processing logic and the unit attribute information of the target data storage unit, and generate structured query statements. Since complex problems are mostly problems that require multi-table associations and subqueries, they can be converted into views, thereby simplifying multi-table problems into single-table problems. At the same time, complex subqueries or multi-step queries are implemented through CTE syntax, which can decompose complex problems into multiple steps, solve a sub-problem in each step, and finally combine them into a complete solution. This method improves the readability and maintainability of SQL, and significantly improves the readability and execution efficiency of structured query statements.
[0077] In another embodiment of the present specification, generating a structured query statement corresponding to the problem to be processed according to the problem to be processed, the multiple sub-problems and the target data storage unit includes: The problem to be processed, the multiple sub-problems and the target data storage unit are processed by using the problem processing model to obtain a structured query statement corresponding to the problem to be processed.
[0078] Specifically, the aforementioned problem processing model may be used to process the problem to be processed, the multiple sub-problems and the target data storage unit to obtain a structured query statement corresponding to the problem to be processed, thereby realizing the generation of a structured query statement.
[0079] In practical applications, before executing the above data processing method, the problem processing model may be trained to obtain a trained problem processing model so that the problem processing model can implement the above data processing method. Specifically, the training steps of the problem processing model include: Determine a sample prompt text, wherein the sample prompt text includes a sample question, a plurality of sample sub-questions corresponding to the sample question, and a sample structured query statement corresponding to the sample question; The initial question processing model is trained according to the sample question, the multiple sample sub-questions, and the sample structured query statement to obtain a trained question processing model.
[0080] The sample structured query statement can be used as seed data to infer sub-questions during the training process of the question processing model. The initial question processing model can be understood as the question processing model before training.
[0081] Specifically, the sample question and multiple sample sub-questions can be used as training samples, and the sample structured query statements can be used as training labels to perform supervised training on the initial question processing model to obtain a trained question processing model.
[0082] In practical applications, the question processing model can understand the CTE syntax based on the sample prompt text and generate questions corresponding to multiple independent SQL blocks in the CTE syntax. A sample prompt text may be, for example, "You are an SQL query expert, and your task is to infer the various sub-problems from the given CTE syntax SQL. Please follow the steps below: 1. Carefully read and understand the provided CTE syntax SQL. 2. Decompose the entire CTE SQL into multiple independent CTE blocks. 3. Generate a clear and concise description for each CTE block, describing the specific problem solved by the CTE block. Please output the results in the following format: - **Original CTE SQL**: [Provided CTE syntax SQL] - **Sub-problems**: - [Sub-problem 1]: [Describe the problem solved by the first CTE block] - [Sub-problem 2]: [Describe the problem solved by the second CTE block] -... Please refer to the following example: --- **Original CTESQ; Sub-problem: Calculate the total grid electricity consumption last spring. Calculate the total grid electricity consumption in the spring of the year before last. Calculate the year-on-year growth rate. Now, please deal with the following problem: Original CTE SQL: [Enter your CTE syntax SQL] Sub-problems: [Sub-problem 1]: [Describe the problem solved by the first CTE block] [Sub-problem 2]: [Describe the problem solved by the second CTE block]".
[0083] In summary, by training the problem processing model, the problem processing model can effectively infer each sub-problem from the final CTE syntax SQL, thereby better understanding the complex query logic.
[0084] Furthermore, after generating the structured query statement corresponding to the problem to be processed, the method further includes: Performing a grammar check on the structured query statement to obtain a grammar check result; When it is determined that the structured query statement is wrong according to the grammar checking result, the structured query statement is adjusted to obtain an adjusted structured query statement.
[0085] Specifically, the SQL corrector can be used to perform syntax checking on the generated structured query statement to obtain a syntax checking result. When a syntax error is determined in the structured query statement according to the syntax checking result, the structured query statement can be corrected to obtain a corrected structured query statement.
[0086] In practical applications, the SQL corrector can be an LLM, which can be combined with instruction context learning (ICL) technology to inject project knowledge and improve the SQL corrector's ability to understand and correct structured query statements. The SQL corrector can be an LLM with a large number of parameters, and project examples can be added to prompt words through ICL to enable the SQL corrector to learn how to use data tables and data fields. When designing prompt words, the prompt words can include queries (problems to be processed), generated structured query statements, target data storage units, precautions, and similar correct examples to guide the SQL corrector to correct the generated structured query statements based on this information, and refer to similar correct structured query statements to handle field reference issues.
[0087] In addition, when the generated structured query statement is corrected based on the SQL corrector, the fields in the generated structured query statement may not be deleted, and the structured query statement may be re-output with reference to similar correct structured query statements, so that the SQL corrector can modify the generated structured query statement with a certain degree of freedom.
[0088] In summary, the structured query statements are self-analyzed and corrected, prompt words are injected through table structure, project knowledge, and samples, and the structured query statements can be corrected through multiple corrections to improve the running success rate of the structured query statements.
[0089] Step 208: Execute the structured query statement to obtain the problem processing result corresponding to the problem to be processed.
[0090] In a specific implementation, executing the structured query statement to obtain a problem processing result corresponding to the problem to be processed includes: Executing the structured query statement to determine target data from the target data storage unit; The target data is calculated to obtain a problem processing result corresponding to the problem to be processed.
[0091] Specifically, the structured query statement can be executed to search the target data storage unit for the target data that can solve the problem to be processed, and the target data can be calculated according to the problem processing logic corresponding to the problem to be processed to obtain the problem processing result of the problem to be processed. In addition, in the process of executing the structured query statement, the calculation result of the target data can also be directly obtained according to the execution result, thereby obtaining the problem processing result of the problem to be processed.
[0092] In summary, the above method determines the target data storage unit corresponding to the problem to be processed as a natural language, and judges whether the problem to be processed meets the preset decomposition conditions. When it is judged that the problem to be processed meets the preset decomposition conditions, the problem to be processed is decomposed to obtain multiple sub-problems, and the multiple sub-problems are used to represent the problem processing logic of the problem to be processed. The sub-problems are used to interpret the problem to be processed, thereby simplifying the complex natural language. Subsequently, the corresponding structured query statement is generated according to the problem to be processed, the multiple sub-problems and the target data storage unit, so that when the structured query statement is executed, the corresponding target data can be accurately found from the target data storage unit and the problem processing result of the problem to be processed can be obtained, so as to solve the problem to be processed and improve the task processing efficiency and problem solving performance.
[0093] The following combination Figure 3 , taking the application of the data processing method provided in this specification in solving complex problems as an example, the data processing method is further explained. Figure 3 A processing flow chart of a data processing method provided by an embodiment of the present specification is shown, which specifically includes the following steps.
[0094] Step 302: Receive the pending issues sent by the user client.
[0095] Step 304: Use a table selector to perform text recognition on the problem to be processed, obtain multiple indicator dimensions corresponding to the problem to be processed, and determine a target data storage unit corresponding to the problem to be processed from multiple candidate data storage units based on the multiple indicator dimensions.
[0096] Step 306: Using the question decomposer, when it is determined that the problem to be processed is a complex problem, the problem to be processed is decomposed to obtain multiple sub-problems corresponding to the problem to be processed, and the problem to be processed is supplemented according to the multiple sub-problems to obtain the problem processing logic including the problem to be processed and the multiple sub-problems, and according to the thinking chain reasoning strategy, the problem processing logic and the unit attribute information of the target data storage unit are grammatically solved to generate a structured query statement corresponding to the problem to be processed.
[0097] Step 308: Use the SQL corrector to perform a syntax check on the structured query statement. If it is determined that the structured query statement has a syntax error, the structured query statement is corrected to obtain a corrected structured query statement.
[0098] Step 310: Return the corrected structured query statement to the user client.
[0099] In summary, the above method determines the target data storage unit corresponding to the problem to be processed as a natural language, and judges whether the problem to be processed meets the preset decomposition conditions. When it is judged that the problem to be processed meets the preset decomposition conditions, the problem to be processed is decomposed to obtain multiple sub-problems, and the multiple sub-problems are used to represent the problem processing logic of the problem to be processed. The sub-problems are used to interpret the problem to be processed, thereby simplifying the complex natural language. Subsequently, the corresponding structured query statement is generated according to the problem to be processed, the multiple sub-problems and the target data storage unit, so that when the structured query statement is executed, the corresponding target data can be accurately found from the target data storage unit and the problem processing result of the problem to be processed can be obtained, so as to solve the problem to be processed and improve the task processing efficiency and problem solving performance.
[0100] Corresponding to the above method embodiment, this specification also provides a data processing device embodiment, Figure 4 FIG. 1 is a schematic diagram showing the structure of a data processing device provided by an embodiment of the present specification. Figure 4 As shown, the device comprises: A determination module 402 is configured to determine a target data storage unit corresponding to the problem to be processed; The decomposition module 404 is configured to decompose the problem to be processed to obtain a plurality of sub-problems corresponding to the problem to be processed when it is determined that the problem to be processed meets a preset decomposition condition, wherein the plurality of sub-problems are used to represent the processing logic of the problem to be processed; A generating module 406 is configured to generate a structured query statement corresponding to the problem to be processed according to the problem to be processed, the multiple sub-problems and the target data storage unit; The execution module 408 is configured to execute the structured query statement to obtain the problem processing result corresponding to the problem to be processed.
[0101] In an optional embodiment, the generating module 406 is further configured to: According to the multiple sub-problems, the problem to be processed is supplemented to obtain a problem processing logic including the problem to be processed and the multiple sub-problems; A structured query statement corresponding to the problem to be processed is generated according to the problem processing logic and the target data storage unit.
[0102] In an optional embodiment, the generating module 406 is further configured to: According to the thinking chain reasoning strategy, the problem processing logic and the unit attribute information of the target data storage unit are grammatically solved to generate a structured query statement corresponding to the problem to be processed.
[0103] In an optional embodiment, the decomposition module 404 is further configured to: The problem to be processed is decomposed by using the problem processing model to obtain multiple sub-problems corresponding to the problem to be processed.
[0104] In an optional embodiment, the decomposition module 404 is further configured to: Generate a prompt text corresponding to the problem to be processed according to the problem to be processed and a pre-created prompt text template; The problem processing model is used to decompose the problem to be processed according to the prompt text to obtain multiple sub-problems corresponding to the problem to be processed.
[0105] In an optional embodiment, the decomposition module 404 is further configured to: Determine the complexity of the problem to be addressed; When it is determined, based on the complexity, that the problem to be processed meets the preset decomposition condition, the problem to be processed is decomposed to obtain a plurality of sub-problems corresponding to the problem to be processed.
[0106] In an optional embodiment, the generating module 406 is further configured to: The problem processing model is used to process the problem to be processed, the multiple sub-problems and the target data storage unit to obtain a structured query statement corresponding to the problem to be processed.
[0107] In an optional embodiment, the device further includes a training module configured to: Determine a sample prompt text, wherein the sample prompt text includes a sample question, a plurality of sample sub-questions corresponding to the sample question, and a sample structured query statement corresponding to the sample question; The initial question processing model is trained according to the sample question, the multiple sample sub-questions, and the sample structured query statement to obtain a trained question processing model.
[0108] In an optional embodiment, the determining module 402 is further configured to: Performing text recognition on the problem to be processed to obtain multiple indicator dimensions corresponding to the problem to be processed; According to the multiple indicator dimensions, a target data storage unit corresponding to the problem to be processed is determined from multiple candidate data storage units.
[0109] In an optional embodiment, the execution module 408 is further configured to: Executing the structured query statement to determine target data from the target data storage unit; The target data is calculated to obtain a problem processing result corresponding to the problem to be processed.
[0110] In an optional embodiment, the device further includes an adjustment module configured to: Performing a grammar check on the structured query statement to obtain a grammar check result; When it is determined that the structured query statement is wrong according to the grammar checking result, the structured query statement is adjusted to obtain an adjusted structured query statement.
[0111] To summarize, the above-mentioned device determines the target data storage unit corresponding to the problem to be processed as a natural language, and judges whether the problem to be processed satisfies the preset decomposition conditions. When it is judged that the problem to be processed satisfies the preset decomposition conditions, the problem to be processed is decomposed to obtain multiple sub-problems, and the multiple sub-problems are used to represent the problem processing logic of the problem to be processed. The sub-problems are used to interpret the problem to be processed, thereby simplifying the complex natural language. Subsequently, the corresponding structured query statement is generated according to the problem to be processed, the multiple sub-problems and the target data storage unit, so that when the structured query statement is executed, the corresponding target data can be accurately found from the target data storage unit and the problem processing result of the problem to be processed can be obtained, so as to solve the problem to be processed and improve the task processing efficiency and problem solving performance.
[0112] The above is a schematic scheme of a data processing device of this embodiment. It should be noted that the technical scheme of the data processing device and the technical scheme of the above data processing method belong to the same concept, and the details of the technical scheme of the data processing device that are not described in detail can be referred to the description of the technical scheme of the above data processing method.
[0113] Corresponding to the above method embodiment, the embodiment of this specification also provides a data processing method, which is applied to a cloud-side device, including: The receiving end-side device sends the pending problem, and determines the target data storage unit corresponding to the pending problem; When it is determined that the problem to be processed meets the preset decomposition condition, the problem to be processed is decomposed to obtain a plurality of sub-problems corresponding to the problem to be processed, wherein the plurality of sub-problems are used to represent the processing logic of the problem to be processed; Generate a structured query statement corresponding to the problem to be processed according to the problem to be processed, the multiple sub-problems and the target data storage unit; Execute the structured query statement to obtain a problem processing result corresponding to the problem to be processed, and send the problem processing result to the terminal side device.
[0114] Specifically, after receiving the problem to be processed sent by the end-side device, the cloud-side device determines the target data storage unit corresponding to the problem to be processed as a natural language, and judges whether the problem to be processed satisfies the preset decomposition conditions. When it is judged that the problem to be processed satisfies the preset decomposition conditions, the problem to be processed is decomposed to obtain multiple sub-problems, and the multiple sub-problems are used to represent the problem processing logic of the problem to be processed. The sub-problems are used to interpret the problem to be processed, thereby simplifying the complex natural language. Subsequently, a corresponding structured query statement is generated according to the problem to be processed, the multiple sub-problems and the target data storage unit, so that when the structured query statement is executed, the corresponding target data can be accurately found from the target data storage unit and the problem processing result of the problem to be processed can be obtained, and the problem processing result of the problem to be processed is returned to the end-side device, so as to solve the problem to be processed and improve the task processing efficiency and problem solving performance.
[0115] The above is a schematic scheme of a data processing method of this embodiment. It should be noted that the technical scheme of this data processing method and the technical scheme of the above data processing method belong to the same concept, and the details not described in detail in the technical scheme of the data processing method can be referred to the description of the technical scheme of the above data processing method.
[0116] Corresponding to the above method embodiment, the embodiment of this specification also provides a data processing device, which is applied to a cloud-side device, including: A receiving module, configured to receive the pending problem sent by the terminal side device, and determine a target data storage unit corresponding to the pending problem; A decomposition module is configured to decompose the problem to be processed to obtain a plurality of sub-problems corresponding to the problem to be processed when it is determined that the problem to be processed meets a preset decomposition condition, wherein the plurality of sub-problems are used to represent the processing logic of the problem to be processed; A generating module is configured to generate a structured query statement corresponding to the problem to be processed according to the problem to be processed, the multiple sub-problems and the target data storage unit; The execution module is configured to execute the structured query statement, obtain the problem processing result corresponding to the problem to be processed, and send the problem processing result to the terminal side device.
[0117] Specifically, after receiving the problem to be processed sent by the end-side device, the cloud-side device determines the target data storage unit corresponding to the problem to be processed as a natural language, and judges whether the problem to be processed satisfies the preset decomposition conditions. When it is judged that the problem to be processed satisfies the preset decomposition conditions, the problem to be processed is decomposed to obtain multiple sub-problems, and the multiple sub-problems are used to represent the problem processing logic of the problem to be processed. The sub-problems are used to interpret the problem to be processed, thereby simplifying the complex natural language. Subsequently, a corresponding structured query statement is generated according to the problem to be processed, the multiple sub-problems and the target data storage unit, so that when the structured query statement is executed, the corresponding target data can be accurately found from the target data storage unit and the problem processing result of the problem to be processed can be obtained, and the problem processing result of the problem to be processed is returned to the end-side device, so as to solve the problem to be processed and improve the task processing efficiency and problem solving performance.
[0118] The above is a schematic scheme of a data processing device of this embodiment. It should be noted that the technical scheme of the data processing device and the technical scheme of the above data processing method belong to the same concept, and the details of the technical scheme of the data processing device that are not described in detail can be referred to the description of the technical scheme of the above data processing method.
[0119] Figure 5 The structure block diagram of a computing device 500 provided according to an embodiment of the present specification is shown. The components of the computing device 500 include but are not limited to a memory 510 and a processor 520. The processor 520 is connected to the memory 510 via a bus 530, and the database 550 is used to store data.
[0120] The computing device 500 also includes an access device 540 that enables the computing device 500 to communicate via one or more networks 560. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 540 may include one or more of any type of network interface (e.g., a network interface card (NIC)) of wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide interoperability for microwave access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.
[0121] In one embodiment of the present application, the above components of the computing device 500 and Figure 5 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 5 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of the present application. Those skilled in the art may add or replace other components as needed.
[0122] The computing device 500 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 500 may also be a mobile or stationary server.
[0123] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above data processing method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above data processing method.
[0124] An embodiment of the present specification further provides a computer-readable storage medium storing a computer program / instruction, which implements the steps of the above-mentioned data processing method when executed by a processor.
[0125] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above data processing method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above data processing method.
[0126] An embodiment of the present specification also provides a computer program product, including a computer program / instruction, which implements the steps of the above data processing method when executed by a processor.
[0127] The above is a schematic scheme of a computer program product of this embodiment. It should be noted that the technical scheme of the computer program product and the technical scheme of the above data processing method belong to the same concept, and the details not described in detail in the technical scheme of the computer program product can be referred to the description of the technical scheme of the above data processing method.
[0128] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0129] The computer program / instruction includes computer program code, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer readable media do not include electric carrier signals and telecommunication signals.
[0130] It should be noted that, for the convenience of description, the aforementioned method embodiments are all described as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.
[0131] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0132] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is only limited by the claims and their full scope and equivalents.
Claims
1. A data processing method, comprising: Determine the target data storage unit corresponding to the problem to be processed; When it is determined that the problem to be processed meets the preset decomposition condition, the problem to be processed is decomposed to obtain a plurality of sub-problems corresponding to the problem to be processed, wherein the plurality of sub-problems are used to represent the processing logic of the problem to be processed; Generate a structured query statement corresponding to the problem to be processed according to the problem to be processed, the multiple sub-problems and the target data storage unit; Execute the structured query statement to obtain the problem processing result corresponding to the problem to be processed.
2. According to the method of claim 1, generating a structured query statement corresponding to the problem to be processed according to the problem to be processed, the multiple sub-problems and the target data storage unit comprises: According to the multiple sub-problems, the problem to be processed is supplemented to obtain a problem processing logic including the problem to be processed and the multiple sub-problems; A structured query statement corresponding to the problem to be processed is generated according to the problem processing logic and the target data storage unit.
3. The method according to claim 2, wherein generating a structured query statement corresponding to the problem to be processed according to the problem processing logic and the target data storage unit comprises: According to the thinking chain reasoning strategy, the problem processing logic and the unit attribute information of the target data storage unit are grammatically solved to generate a structured query statement corresponding to the problem to be processed.
4. According to the method according to any one of claims 1 to 3, decomposing the problem to be processed to obtain multiple sub-problems corresponding to the problem to be processed comprises: The problem to be processed is decomposed by using the problem processing model to obtain multiple sub-problems corresponding to the problem to be processed.
5. The method according to claim 4, wherein the problem processing model is used to decompose the problem to be processed to obtain multiple sub-problems corresponding to the problem to be processed, including: Generate a prompt text corresponding to the problem to be processed according to the problem to be processed and a pre-created prompt text template; The problem processing model is used to decompose the problem to be processed according to the prompt text to obtain multiple sub-problems corresponding to the problem to be processed.
6. The method according to any one of claims 1 to 3 and 5, wherein when it is determined that the problem to be processed meets a preset decomposition condition, decomposing the problem to be processed to obtain a plurality of sub-problems corresponding to the problem to be processed comprises: Determine the complexity of the problem to be addressed; When it is determined, based on the complexity, that the problem to be processed meets the preset decomposition condition, the problem to be processed is decomposed to obtain a plurality of sub-problems corresponding to the problem to be processed.
7. The method according to claim 1, wherein generating a structured query statement corresponding to the problem to be processed according to the problem to be processed, the plurality of sub-problems and the target data storage unit comprises: The problem to be processed, the multiple sub-problems and the target data storage unit are processed by using the problem processing model to obtain a structured query statement corresponding to the problem to be processed.
8. According to the method of claim 7, the training step of the problem processing model comprises: Determine a sample prompt text, wherein the sample prompt text includes a sample question, a plurality of sample sub-questions corresponding to the sample question, and a sample structured query statement corresponding to the sample question; The initial question processing model is trained according to the sample question, the multiple sample sub-questions, and the sample structured query statement to obtain a trained question processing model.
9. According to the method of any one of claims 1-3, 7-8, the step of determining the target data storage unit corresponding to the problem to be processed comprises: Performing text recognition on the problem to be processed to obtain multiple indicator dimensions corresponding to the problem to be processed; According to the multiple indicator dimensions, a target data storage unit corresponding to the problem to be processed is determined from multiple candidate data storage units.
10. The method according to any one of claims 1-3, 7-8, wherein executing the structured query statement to obtain a problem processing result corresponding to the problem to be processed comprises: Executing the structured query statement to determine target data from the target data storage unit; The target data is calculated to obtain a problem processing result corresponding to the problem to be processed.
11. The method according to any one of claims 1-3, 7-8, after generating the structured query statement corresponding to the problem to be processed, further comprising: Performing a grammar check on the structured query statement to obtain a grammar check result; When it is determined that the structured query statement is wrong according to the grammar checking result, the structured query statement is adjusted to obtain an adjusted structured query statement.
12. A data processing method, applied to a cloud-side device, comprising: The receiving end-side device sends the pending problem, and determines the target data storage unit corresponding to the pending problem; When it is determined that the problem to be processed meets the preset decomposition condition, the problem to be processed is decomposed to obtain a plurality of sub-problems corresponding to the problem to be processed, wherein the plurality of sub-problems are used to represent the processing logic of the problem to be processed; Generate a structured query statement corresponding to the problem to be processed according to the problem to be processed, the multiple sub-problems and the target data storage unit; Execute the structured query statement to obtain a problem processing result corresponding to the problem to be processed, and send the problem processing result to the terminal side device.
13. A computing device comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the method described in any one of claims 1 to 12 are implemented.
14. A computer-readable storage medium storing a computer program / instruction, wherein the computer program / instruction, when executed by a processor, implements the steps of the method according to any one of claims 1 to 12.
15. A computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Structured query language query statement generation method and device and storage medium
CN112506949A
Data processing method and device
CN113886474A
Question answering method and apparatus, and electronic device, computer-readable storage medium and computer program product
WO2024230117A1