Statement conversion method and device, electronic equipment and computer readable storage medium
By obtaining label rule combination information, parsing and processing it, matching the target template from the conversion template library, and using the rule engine and query optimizer to generate the final conversion statement, the problem of repeated coding in traditional methods is solved and efficient statement conversion is achieved.
Patent Information
- Application Number
- CN202510730636.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-30
- Publication Date
- 2025-09-12
AI Technical Summary
The traditional tag rule combination JavaScript Object Notation (JSON) to Structured Query Language (SQL) conversion process requires exhaustive enumeration of tag rule combination scenarios, resulting in a large amount of repetitive coding work, low efficiency, and incompatibility with SQL syntax of different programming languages and OLAP engines.
A statement conversion method is provided, which obtains the combination information of label rules to be converted, parses and processes the information to obtain structure and attribute information, matches the target statement conversion template from a preset conversion template library, uses the rule engine to fill it, and optimizes and adjusts it through the query optimizer to finally generate the final conversion statement.
It reduces the workload of statement conversion, improves conversion efficiency, avoids repeated coding, and improves the accuracy and efficiency of statement conversion.
Smart Images

Figure CN120632159A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to, but are not limited to, the field of statement conversion, and in particular to a statement conversion method, apparatus, electronic device, and computer-readable storage medium. Background Art
[0002] With the development of big data and data analysis technologies, tag selection services are playing an increasingly important role in the development of big data applications. In many cases, users simply configure tag rule combinations on the tagging platform based on specific analysis scenarios to perform tag selection and profiling calculations, helping them quickly locate and extract valuable information from massive amounts of data. For example, in the insurance sector, tag selection can be used to analyze and process collected insurance data for business decisions; or in the smart healthcare sector, tag selection can be used to optimize medical resources. However, in the traditional process of converting JavaScript Object Notation (JSON) into Structured Query Language (SQL), it is necessary to exhaustively enumerate the tag rule combination scenarios, such as single-table, multi-table, and cross-table statistical / analytical calculations. Then, through programming language coding, the rule combination for each scenario is converted into SQL statements executable by the Online Analytical Processing (OLAP) engine. Moreover, different programming languages and different OLAP engine SQL syntaxes are incompatible with a single rule conversion service, which inevitably leads to a large amount of repetitive but necessary coding work, wasting a lot of time and resulting in low efficiency. Summary of the Invention
[0003] The following is a summary of the subject matter described in detail herein. This summary is not intended to limit the scope of the claims.
[0004] In order to solve the problems mentioned in the above background technology, the embodiments of the present application provide a statement conversion method, device, electronic device and computer-readable storage medium, which reduce the workload of statement conversion and improve the efficiency of statement conversion.
[0005] In a first aspect, an embodiment of the present application provides a statement conversion method, comprising:
[0006] Get the tag rule combination information to be converted;
[0007] Parsing the tag rule combination information to be converted to obtain tag rule combination structure information and tag rule combination attribute information;
[0008] According to the label rule combination structure information and the label rule combination attribute information, a target sentence conversion template is obtained by matching from a preset conversion template library;
[0009] Filling the target statement conversion template based on a preset rule engine to obtain a preliminary conversion statement;
[0010] The preliminary conversion statement is optimized and adjusted based on the preset query optimizer to obtain the final conversion statement
[0011] In a second aspect, an embodiment of the present application further provides a statement conversion device, the device comprising:
[0012] An acquisition unit, used to acquire label rule combination information to be converted;
[0013] a parsing unit, configured to parse the tag rule combination information to be converted to obtain tag rule combination structure information and tag rule combination attribute information;
[0014] a matching unit, configured to obtain a target sentence conversion template from a preset conversion template library according to the tag rule combination structure information and the tag rule combination attribute information;
[0015] A filling unit, configured to fill the target statement conversion template based on a preset rule engine to obtain a preliminary conversion statement;
[0016] The adjustment unit is used to optimize and adjust the preliminary conversion statement based on a preset query optimizer to obtain a final conversion statement.
[0017] In a third aspect, an embodiment of the present application further provides an electronic device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the statement conversion method as described in the first aspect above is implemented.
[0018] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the statement conversion method described in the first aspect above.
[0019] According to the statement conversion method of the embodiment provided by the present application, there are at least the following beneficial effects: in the process of statement conversion, first obtain the label rule combination information to be converted; then parse the label rule combination information to be converted to obtain label rule combination structure information and label rule combination attribute information; then, according to the label rule combination structure information and label rule combination attribute information, match the target statement conversion template from the preset conversion template library; then fill the target statement conversion template based on the preset rule engine to obtain a preliminary conversion statement; finally, the preliminary conversion statement can be optimized and adjusted based on the preset query optimizer to obtain the final conversion statement. Through the above technical solution, there is no need to perform a large amount of repeated coding in the process of statement conversion as in the past, which reduces the workload of statement conversion and improves the efficiency of statement conversion. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings are used to provide a further understanding of the technical solution of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the technical solution of the present application and do not constitute a limitation on the technical solution of the present application.
[0021] Figure 1 This is a flow chart of a statement conversion method provided by an embodiment of the present application;
[0022] Figure 2 yes Figure 1 A schematic flow chart of a specific implementation of step S200;
[0023] Figure 3 yes Figure 1 A schematic flow chart of a specific implementation of step S300;
[0024] Figure 4 yes Figure 1 A schematic flow chart of a specific implementation of step S400;
[0025] Figure 5 yes Figure 1 A schematic flow chart of a specific implementation of step S500;
[0026] Figure 6 yes Figure 1 A schematic flow chart of a specific implementation method of the process of constructing the conversion template library;
[0027] Figure 7 It is executed Figure 1 A schematic flow chart of a specific implementation method after step S500;
[0028] Figure 8 This is a schematic diagram of a sentence conversion device provided by one embodiment of the present application;
[0029] Figure 9 This is a schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0031] It should be noted that although the device schematics illustrate functional module divisions and the flowcharts illustrate logical sequences, in certain circumstances, the steps shown or described may be performed in a sequence that differs from the module divisions in the device or the sequence in the flowcharts. The terms "first," "second," and so on, used in the specification, claims, and drawings, are used to distinguish similar items and are not necessarily used to describe a specific sequence or precedence.
[0032] It should be noted that, unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0033] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to achieve optimal results.
[0034] AI is a new technical discipline that studies and develops theories, methods, technologies, and application systems for simulating, extending, and expanding human intelligence. Artificial intelligence is a branch of computer science that seeks to understand the essence of intelligence and produce new intelligent machines that can respond in a manner similar to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing, and expert systems. Artificial intelligence can simulate the information processes of human consciousness and thinking. It also refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results.
[0035] Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0036] Artificial intelligence, or AI, is a theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to achieve optimal results.
[0037] The servers involved in artificial intelligence technology can be independent servers or cloud servers that provide 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 delivery networks (CDN), as well as big data and artificial intelligence platforms.
[0038] The present application provides a statement conversion method, device, electronic device and computer-readable storage medium. In the process of statement conversion, first obtain the label rule combination information to be converted; then parse the label rule combination information to be converted to obtain label rule combination structure information and label rule combination attribute information; then, according to the label rule combination structure information and label rule combination attribute information, match the target statement conversion template from the preset conversion template library; then fill the target statement conversion template based on the preset rule engine to obtain a preliminary conversion statement; finally, optimize and adjust the preliminary conversion statement based on the preset query optimizer to obtain the final conversion statement. Through the above technical solution, there is no need to perform a large amount of repeated coding in the process of statement conversion as in the past, which reduces the workload of statement conversion and improves the efficiency of statement conversion.
[0039] The statement conversion method provided in the embodiment of the present application relates to the field of statement conversion. The statement conversion method provided in the embodiment of the present application can be applied in a terminal, can also be applied in a server side, and can also be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or can be configured as a server cluster or distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0040] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and the like. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments in which tasks are performed by remote processing devices connected via a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media, including storage devices.
[0041] It should be noted that in each specific embodiment of the present application, when it comes to the need to perform relevant processing based on data related to the user's identity or characteristics, such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first, and the collection, use, and processing of such data will comply with relevant laws, regulations, and standards. In addition, when the embodiment of the present application needs to obtain the user's sensitive personal information, the user's separate permission or consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the user's separate permission or consent, the necessary user-related data for the normal operation of the embodiment of the present application will be obtained.
[0042] The embodiments of the present application are further described below with reference to the accompanying drawings.
[0043] like Figure 1 As shown, Figure 1 This is a flow chart of a statement conversion method provided by an embodiment of the present application, which includes the following steps:
[0044] Step S100: Obtain label rule combination information to be converted.
[0045] The sentence conversion method provided by the embodiment of the present application first obtains the tag rule combination information to be converted during the sentence conversion process to prepare for the subsequent sentence conversion. Once the tag rule combination information to be converted is obtained, the tag rule combination information to be converted can be parsed to obtain the tag rule combination structure information and the tag rule combination attribute information.
[0046] It's worth noting that tag rule combination information refers to combining and organizing data according to specific classification criteria by setting a series of tag rules. These rules can be based on data attributes, characteristics, or behavioral patterns. Tag rule combination information helps quickly classify and retrieve data, improving data management efficiency. For example, in the insurance business, customer tag systems are the foundation of precision marketing and personalized services. These tag systems typically include basic information such as age, gender, occupation, and income level; purchasing behavior such as the type of insurance products purchased, purchase frequency, and premium amount; risk preferences such as health status, family status, and history of major medical conditions; and value contribution such as the customer's contribution to the insurance company. Using these tags, insurance companies can manage customers in tiers, for example, by categorizing them into high-value customers, potential customers, and customers at risk of churn, and develop differentiated marketing strategies for each tier. Tag rule combination involves logically combining multiple tags to meet specific business needs. For example, by combining tags such as "age 30-40," "having children," and "having purchased health insurance," target customer groups can be identified and recommended appropriate education insurance products. Alternatively, in the field of smart healthcare, label rule combination information is primarily used to improve the efficiency, safety, and personalization of medical services. Label rule combination information cards within the industry include patient information, medical device management information, and drug management information. Patient information includes the patient's basic information, medical history, and allergy history. This information can be used to alert medical staff based on allergy history and flag high-risk patients based on age and medical history. Medical device management information includes the device's basic information, manufacturer, model, last maintenance date, and status. Maintenance reminders based on maintenance dates can be used to check device status. Drug management information includes the drug's name, dosage, frequency of use, and expiration date. This information can be used to alert pharmacies to restock the drug based on the expiration date and to check whether the dosage requires doctor review.
[0047] It is worth noting that after obtaining the tag rule combination information to be converted, in order to facilitate subsequent data execution and processing, the tag rule combination information to be converted needs to be converted into a structured query language to facilitate subsequent data execution and analysis processing.
[0048] It should be noted that during the statement conversion process of this application, before obtaining the tag rule combination information to be converted, the user's permission or consent will be obtained first, and the collection, use and processing of this data will comply with relevant laws, regulations and standards. In addition, when the embodiment of this application needs to obtain the user's sensitive personal information, the user's separate permission or consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the user's separate permission or consent, the necessary user-related data for the normal operation of the embodiment of this application will be obtained.
[0049] Step S200: parsing the tag rule combination information to be converted to obtain tag rule combination structure information and tag rule combination attribute information.
[0050] The statement conversion method provided in the embodiment of the present application can parse and process the label rule combination information to be converted after obtaining the label rule combination information to be converted, and obtain the label rule combination structure information and label rule combination attribute information. Subsequently, the corresponding target statement conversion template can be matched from a pre-set conversion template library based on the label rule combination structure information and the label rule combination attribute information, so as to prepare for subsequent statement conversion processing.
[0051] It is worth noting that the label-rule combination information to be converted is parsed to obtain label-rule combination structure information and label-rule combination attribute information. Label-rule combination structure information refers to the structured information with specific functions or meanings formed by combining multiple labels according to certain logical rules in a system. This structure information can help the system perform operations such as data classification, retrieval, and decision support more efficiently. Label-rule combination attribute information refers to the attribute information of each label, rule, and combination in the label-rule combination. Attribute information is used to describe the characteristics, behaviors, and relationships between labels and rules, thereby achieving more flexible and efficient rule management and application.
[0052] like Figure 2 As shown, parsing the tag rule combination information to be converted to obtain tag rule combination structure information and tag rule combination attribute information may include the following steps:
[0053] Step S210: performing format recognition processing on the tag rule combination information to be converted to obtain format type information;
[0054] Step S220: Analyze and process the tag rule combination information to be converted based on the format type information to obtain tag rule definition information and combination mode information;
[0055] Step S230, determining tag rule combination structure information according to the tag rule definition information and combination mode information;
[0056] Step S240 : performing attribute analysis on the tag rule definition information to obtain tag rule combination attribute information.
[0057] For steps S210 to S240, in the process of parsing the label rule combination information to be converted to obtain the label rule combination structure information and the label rule combination attribute information, firstly, the label rule combination information to be converted is subjected to format recognition processing to obtain the format type information; then, based on the format type information, information analysis processing is performed on the label rule combination information to be converted to obtain the label rule definition information and the combination method information; then, the label rule combination structure information is determined based on the label rule definition information and the combination method information; finally, the label rule definition information is subjected to attribute analysis processing to obtain the label rule combination attribute information, and subsequently, the statement conversion template can be selected from the conversion template library based on the label rule combination structure information and the label rule combination attribute information.
[0058] It is worth noting that the format identification processing is performed on the tag rule combination information to be converted, and then the format type information of the tag rule combination information to be converted can be determined, for example, it can be the JavaScript object notation format. Subsequently, information analysis processing can be performed on the tag rule combination information to be converted based on the format type information, so as to determine the tag rule definition information and combination method information from the tag rule combination information to be converted; then, the tag rule combination structure information can be determined based on the tag rule definition information and the combination method information, and finally, the tag rule definition information is subjected to attribute analysis processing to determine the tag rule combination attribute information of the tag rule definition information, so as to prepare for the subsequent statement conversion template selection.
[0059] For example, in the insurance business field, after obtaining the tag rule combination information to be converted, the tag rule combination information to be converted can be formatted and processed to obtain format type information. For example, the tag rule combination information to be converted can be identified as being in JSON format. Then, according to the JSON format, the tag rule definition information and combination method information can be filtered from the tag rule combination information to be converted. Subsequently, the tag rule combination structure information can be directly determined from the tag rule definition information and combination method information. The tag rule definition information can be attributed and processed to obtain the tag rule combination attribute information. Alternatively, in the smart medical field, the tag rule combination information to be converted can be formatted and processed to obtain format type information. Then, the tag rule definition information and combination method information can be filtered from the tag rule combination information to be converted. Subsequently, the tag rule combination structure information can be directly determined from the tag rule definition information and combination method information. Then, the tag rule definition information can be attributed and processed to obtain the tag rule combination attribute information.
[0060] Step S300: According to the tag rule combination structure information and the tag rule combination attribute information, a target sentence conversion template is matched from a preset conversion template library.
[0061] The statement conversion method provided in the embodiment of the present application parses and processes the label rule combination information to be converted, and after obtaining the label rule combination structure information and the label rule combination attribute information, it can match the target statement conversion template from a pre-set conversion template library based on the label rule combination structure information and the label rule combination attribute information, so as to prepare for subsequent statement conversion processing.
[0062] It is worth noting that the conversion template library includes multiple sentence conversion templates, each of which carries structural tag information and attribute tag information. Subsequently, the target sentence conversion template can be selected from the conversion template library based on the structural tag information and attribute tag information.
[0063] like Figure 3 As shown, the conversion template library includes multiple sentence conversion templates, each sentence conversion template carries structure tag information and attribute tag information. According to the tag rule combination structure information and tag rule combination attribute information, the target sentence conversion template is matched from the preset conversion template library, which may include the following steps:
[0064] Step S310, performing a first matching process on the tag rule combination structure information and the structure tag information of the statement conversion template in the conversion template library to obtain a conversion template subset;
[0065] Step S320 : performing a second matching process on the tag rule combination attribute information and the attribute tag information of the sentence conversion template in the conversion template subset to obtain a target sentence conversion template.
[0066] In steps S310 to S320, in the process of matching the target sentence conversion template from the preset conversion template library, a first matching process is first performed on the tag rule combination structure information with the structure tag information of each sentence conversion template in the conversion template library to obtain a conversion template subset; when the conversion template subset is obtained, a second matching process is performed on the tag rule combination attribute information with the attribute tag information of each sentence conversion template in the conversion template subset to obtain the target sentence conversion template. Through the above technical solution, the target sentence conversion template can be selected from the conversion template library by utilizing two matching processes.
[0067] It is worth noting that the first matching process is performed on the label rule combination structural information and the structural tag information of the sentence conversion template in the conversion template library, that is, the label rule combination structural information and the structural tag information of the sentence conversion template are matched for similarity, so that a conversion template subset can be determined from the conversion template library; subsequently, a second matching process can be performed on the conversion template subset to obtain the corresponding target sentence conversion template. Based on the above technical solution, the target sentence conversion template is selected from the conversion template library, and then the sentence conversion process is performed based on the target sentence conversion template. As a result, a large amount of repeated coding is not required during the sentence conversion process as in the past, which reduces the workload of sentence conversion and improves the efficiency of sentence conversion.
[0068] Step S400: Filling the target statement conversion template based on a preset rule engine to obtain a preliminary conversion statement.
[0069] The sentence conversion method provided in the embodiment of the present application can fill in the target statement conversion template based on the preset rule engine after matching the target statement conversion template from the preset conversion template library according to the label rule combination structure information and the label rule combination attribute information, and then obtain a preliminary conversion statement. The preliminary conversion statement can then be adjusted to obtain the final conversion statement.
[0070] It's worth noting that a rule engine is a rule-based reasoning engine that processes data or logic using a set of predefined rules. The core of a rule engine is the rule base, which contains a series of conditions and actions. When input data meets the conditions in the rules, the rule engine triggers the corresponding actions. The target statement transformation template is a predefined text structure containing several placeholders that need to be replaced with specific values to generate the final text or data.
[0071] like Figure 4 As shown, the target statement conversion template is filled based on a preset rule engine to obtain a preliminary conversion statement, which may include the following steps:
[0072] Step S410: Using a rule engine to perform template filling processing on the target statement conversion template according to the tag rule definition information to obtain a filled conversion statement;
[0073] Step S420: Perform conditional verification on the filled conversion statement to obtain a preliminary conversion statement.
[0074] For steps S410 to S420, in the process of filling the target statement conversion template based on the preset rule engine to obtain the preliminary conversion statement, the rule engine is first used to perform template filling processing on the target statement conversion template according to the label rule definition information to obtain the filled conversion statement; then the filled conversion statement is conditionally checked to obtain the corresponding preliminary conversion statement, so as to realize preliminary statement conversion processing.
[0075] It is worth noting that, according to the label rule definition information, the rule engine can be used to directly perform template filling processing on the target statement conversion template to obtain the filled conversion statement; and the filled conversion statement can be subsequently subjected to conditional verification processing to obtain the preliminary conversion statement. For example, in the insurance business field, when it is determined that the target statement conversion template is obtained, the rule engine can be used to perform template filling processing on the target statement conversion template according to the label rule definition information to obtain the filled conversion statement, and then the filled conversion statement can be subjected to conditional verification processing to eliminate the part that fails the conditional verification, and obtain the preliminary conversion statement, so that the statement conversion can be more accurate. Alternatively, in the field of smart medical care, when it is determined that the target statement conversion template is obtained, the rule engine can also be used to perform template filling processing on the target statement conversion template according to the label rule definition information to obtain the filled conversion statement, and then the filled conversion statement can be subjected to conditional verification processing to eliminate the part that fails the conditional verification, and obtain the preliminary conversion statement, so that the statement conversion can be more accurate.
[0076] Step S500: Optimize and adjust the preliminary conversion statement based on a preset query optimizer to obtain a final conversion statement.
[0077] The statement conversion method provided in the embodiment of the present application, after filling in the target statement conversion template based on a pre-set rule engine to obtain a preliminary conversion statement, can then optimize and adjust the preliminary conversion statement based on a pre-set query optimizer to obtain the final conversion statement. Through the above technical solution, the statement conversion process can be made more precise, further improving the accuracy of statement conversion.
[0078] It is worth noting that the query optimizer is the key component responsible for optimizing SQL query statements. The query optimizer's job is to convert the SQL statements entered by the user into an efficient query plan, thereby improving query performance.
[0079] like Figure 5 As shown, optimizing and adjusting the preliminary conversion statement based on a preset query optimizer to obtain a final conversion statement may include the following steps:
[0080] Step S510: performing query analysis on the preliminary conversion statement based on the query optimizer to obtain syntax analysis information and semantic analysis information;
[0081] Step S520, generating multiple statement execution plans based on the syntax analysis information and the semantic analysis information;
[0082] Step S530 , estimating the costs of multiple statement execution plans to obtain multiple estimation results;
[0083] Step S540 , selecting an optimal estimation result from the multiple estimation results, and rewriting the preliminary conversion statement according to the statement execution plan corresponding to the optimal estimation result to obtain a final conversion statement.
[0084] For steps S510 to S540, in the process of optimizing and adjusting the preliminary conversion statement based on the preset query optimizer to obtain the final conversion statement, first, the preliminary conversion statement is subjected to query analysis based on the query optimizer to obtain grammatical analysis information and semantic analysis information; then, multiple statement execution plans are generated based on the grammatical analysis information and semantic analysis information; then, the costs of the multiple statement execution plans are estimated to obtain multiple estimation results; then, the optimal estimation result is selected from the multiple estimation results, and according to the statement execution plan corresponding to the optimal estimation result, the preliminary conversion statement is rewritten to obtain the final conversion statement. Through the above technical solution, the accuracy of statement conversion can be greatly improved.
[0085] It is worth noting that based on the query optimizer, query analysis processing can be performed on the preliminary conversion statement to obtain grammatical analysis information and semantic analysis information. Subsequently, multiple statement execution plans can be generated based on the grammatical analysis information and semantic analysis information. Then, multiple statement execution plans can be estimated. Subsequently, the preliminary conversion statement can be rewritten based on the statement execution plan with the lowest estimated result to obtain the final conversion statement, so as to further optimize the effect of statement conversion. For example, in the field of insurance business, first, based on the query optimizer, query analysis processing is performed on the preliminary conversion statement to obtain grammatical analysis information and semantic analysis information. Then, multiple statement execution plans can be generated based on the grammatical analysis information and semantic analysis information. Then, multiple statement execution plans can be estimated. Subsequently, the preliminary conversion statement can be rewritten based on the statement execution plan with the lowest estimated result to obtain the final conversion statement, so as to facilitate subsequent decision recommendations for insurance business. In the field of smart healthcare, query analysis and processing of preliminary conversion statements can be performed based on the query optimizer, and grammatical analysis information and semantic analysis information can also be obtained. Then, multiple statement execution plans are generated based on the grammatical analysis information and semantic analysis information, and then multiple statement execution plans are estimated. Subsequently, the preliminary conversion statement can be rewritten according to the statement execution plan with the lowest estimation result, and the final conversion statement can be obtained to further optimize the resources of the smart healthcare system.
[0086] like Figure 6 As shown, the conversion template library can be obtained through the following steps:
[0087] Step S110, obtaining programming language information, engine association information, and rule combination mapping relationship information;
[0088] Step S120: training a preset language model based on the programming language information, the engine association information, and the rule combination mapping relationship information to obtain a training loss value;
[0089] Step S130, adjusting the weight parameters of the language model according to the training loss value;
[0090] Step S140: After the weight parameters of the language model are adjusted, determining the dataset training result;
[0091] Step S150: construct a conversion template library based on the dataset training results.
[0092] For steps S110 to S150, in the process of constructing the conversion template library, the programming language information, engine association information and rule combination mapping relationship information are first obtained; then the pre-set language model can be trained according to the programming language information, engine association information and rule combination mapping relationship information to obtain the training loss value; subsequently, the weight parameters of the language model can be back-propagated and adjusted according to the training loss value; after multiple adjustment processes, when the weight parameters of the language model are adjusted, the data set training results can be obtained, and finally the conversion template library is constructed based on the data set training results to prepare for the subsequent target sentence conversion template selection.
[0093] It is worth noting that based on the language model's early automatic learning of the basic knowledge of programming languages and OLAP engine SQL syntax, as well as the subsequent continuous manual training and reinforcement of SQL syntax for specific complex business scenarios, a universal label rule combination conversion SQL service is implemented. This can quickly support arbitrary switching of multiple programming languages, OLAP engine SQL syntax, and database types, reducing the learning cost of new knowledge for R&D personnel and improving R&D efficiency; it supports non-discriminatory system integration, has strong compatibility and flexibility, avoids duplicate development, reduces maintenance costs, and reduces costs and increases efficiency; and as more and more training samples are used, the conversion accuracy will become higher and higher, improving system stability and user satisfaction.
[0094] like Figure 7 As shown, after optimizing and adjusting the preliminary conversion statement based on the preset query optimizer to obtain the final conversion statement, the following steps may be included:
[0095] Step S610, evaluating the final converted statement to obtain a statement evaluation result;
[0096] Step S620: updating the conversion template library according to the statement evaluation result.
[0097] For steps S610 to S620, the preliminary conversion statement is optimized and adjusted based on the preset query optimizer. After obtaining the final conversion statement, the final conversion statement can be evaluated to obtain a statement evaluation result; then the conversion template library is updated according to the statement evaluation result to further improve the accuracy of subsequent statement conversions.
[0098] It is worth noting that when the statement evaluation result indicates that the accuracy of the final converted statement is not high, the conversion template library can be updated to improve the accuracy of subsequent statement conversions.
[0099] In addition, if Figure 8 As shown, an embodiment of the present application further provides a sentence conversion device 10, the device comprising:
[0100] An acquisition unit 100 is configured to acquire label rule combination information to be converted;
[0101] The parsing unit 200 is used to parse the tag rule combination information to be converted to obtain tag rule combination structure information and tag rule combination attribute information;
[0102] The matching unit 300 is configured to obtain a target sentence conversion template from a preset conversion template library according to the tag rule combination structure information and the tag rule combination attribute information;
[0103] The filling unit 400 is used to fill the target sentence conversion template based on a preset rule engine to obtain a preliminary conversion sentence;
[0104] The adjustment unit 500 is configured to perform optimization and adjustment processing on the preliminary conversion statement based on a preset query optimizer to obtain a final conversion statement.
[0105] It should be noted that, in the process of statement conversion, first obtain the label rule combination information to be converted; then parse the label rule combination information to be converted to obtain label rule combination structure information and label rule combination attribute information; then, according to the label rule combination structure information and label rule combination attribute information, match the target statement conversion template from the preset conversion template library; then fill the target statement conversion template based on the preset rule engine to obtain a preliminary conversion statement; finally, optimize and adjust the preliminary conversion statement based on the preset query optimizer to obtain the final conversion statement. Through the above technical solution, there is no need to perform a large amount of repeated coding in the process of statement conversion as in the past, which reduces the workload of statement conversion and improves the efficiency of statement conversion.
[0106] The specific implementation of the sentence conversion device 10 is basically the same as the specific embodiment of the above-mentioned sentence conversion method, and will not be repeated here.
[0107] In addition, if Figure 9 As shown, an embodiment of the present application further provides an electronic device 700 , which includes: a memory 720 , a processor 710 , and a computer program stored in the memory 720 and executable on the processor 710 .
[0108] The processor 710 and the memory 720 may be connected via a bus or other means.
[0109] The non-transient software programs and instructions required to implement the statement conversion methods of the above embodiments are stored in the memory 720 , and when executed by the processor 710 , the statement conversion methods of the above embodiments are executed.
[0110] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, i.e., they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.
[0111] In addition, an embodiment of the present application also provides a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are executed by a processor 710 or a controller, for example, by a processor 710 in the above-mentioned device embodiment, so that the above-mentioned processor 710 can execute the statement conversion method in the above-mentioned embodiment.
[0112] The above embodiments may be used in combination, and modules with the same name in different embodiments may be the same or different.
[0113] The foregoing description describes specific embodiments of the present application, and other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in an order different from that described in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0114] The various embodiments in this application are described in a progressive manner. Similar portions between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from the other embodiments. In particular, the device, equipment, and computer-readable storage medium embodiments are generally similar to the method embodiments, so their descriptions are relatively simple. For relevant portions, refer to the descriptions of the method embodiments.
[0115] The apparatus, device, computer-readable storage medium and method provided in the embodiments of the present application correspond to each other. Therefore, the apparatus, device and non-volatile computer storage medium also have similar beneficial technical effects as the corresponding method. Since the beneficial technical effects of the method have been described in detail above, the beneficial technical effects of the corresponding apparatus, device and computer storage medium will not be repeated here.
[0116] In the 1990s, technological improvements could be clearly distinguished as either hardware improvements (for example, improvements to circuit structures like diodes, transistors, and switches) or software improvements (improvements to process flows). However, with the advancement of technology, many process flow improvements today can now be considered direct improvements to hardware circuit structures. Designers almost always create the corresponding hardware circuit structure by programming the improved process flow into the hardware circuit. Therefore, it cannot be said that a process flow improvement cannot be implemented using hardware modules. For example, a programmable logic device (PLD), such as a field programmable gate array (FPGA), is an integrated circuit whose logical function is determined by user programming. Designers can "integrate" a digital system on a PLD through their own programming, without having to hire a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly done using "logic compiler" software. This is similar to the software compiler used when developing programs. Before compilation, the original code must also be written in a specific programming language, called a hardware description language (HDL). There is not just one HDL, but many, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art will also understand that by simply programming the method flow in one of these hardware description languages and then programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.
[0117] The controller can be implemented in any suitable manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that in addition to implementing the controller in a purely computer-readable program code manner, it is entirely possible to implement the same function in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0118] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0119] For the convenience of description, the above devices are described as being divided into various units according to their functions. Of course, when implementing the embodiments of the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0120] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the embodiments of the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0121] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0122] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0123] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0124] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0125] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0126] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0127] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0128] In the embodiments of the present application, "at least one" refers to one or more, and "more" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent the existence of A alone, the existence of A and B at the same time, and the existence of B alone. Among them, A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can represent: a, b, c, a and b, a and c, b and c or a and b and c, where a, b, c can be single or multiple.
[0129] Embodiments of the present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. Embodiments of the present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0130] The various embodiments in this application are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiment is generally similar to the method embodiment, so the description is relatively simple. For relevant parts, refer to the partial description of the method embodiment.
[0131] The foregoing is merely an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included within the scope of the claims of the present application.
Claims
1. A sentence conversion method, characterized in that: include: Get the tag rule combination information to be converted; Parsing the tag rule combination information to be converted to obtain tag rule combination structure information and tag rule combination attribute information; According to the label rule combination structure information and the label rule combination attribute information, a target sentence conversion template is obtained by matching from a preset conversion template library; Filling the target statement conversion template based on a preset rule engine to obtain a preliminary conversion statement; The preliminary conversion statement is optimized and adjusted based on a preset query optimizer to obtain a final conversion statement.
2. The sentence conversion method according to claim 1, characterized in that: The parsing process of the tag rule combination information to be converted to obtain tag rule combination structure information and tag rule combination attribute information includes: Performing format recognition processing on the tag rule combination information to be converted to obtain format type information; According to the format type information, information is analyzed and processed from the tag rule combination information to be converted to obtain tag rule definition information and combination mode information; Determining the label rule combination structure information according to the label rule definition information and the combination mode information; Attribute analysis is performed on the tag rule definition information to obtain the tag rule combination attribute information.
3. The sentence conversion method according to claim 1, wherein: The conversion template library includes a plurality of sentence conversion templates, each of which carries structure tag information and attribute tag information. The target sentence conversion template is obtained by matching the structure information and the attribute information according to the tag rule from the preset conversion template library, including: Performing a first matching process on the label rule combination structure information and the structure tag information of the statement conversion template in the conversion template library to obtain a conversion template subset; A second matching process is performed on the tag rule combination attribute information and the attribute tag information of the sentence conversion template in the conversion template subset to obtain the target sentence conversion template.
4. The sentence conversion method according to claim 2, wherein: The preset rule engine performs filling processing on the target statement conversion template to obtain a preliminary conversion statement, including: Performing template filling processing on the target statement conversion template using the rule engine according to the label rule definition information to obtain a filled conversion statement; Conditional checking is performed on the fill conversion statement to obtain the preliminary conversion statement.
5. The sentence conversion method according to claim 1, wherein: The preset query optimizer performs optimization and adjustment processing on the preliminary conversion statement to obtain a final conversion statement, including: Performing query analysis on the preliminary conversion statement based on the query optimizer to obtain syntax analysis information and semantic analysis information; generating a plurality of statement execution plans according to the grammatical analysis information and the semantic analysis information; Estimating the costs of the execution plans of the multiple statements to obtain multiple estimation results; An optimal estimation result is selected from the plurality of estimation results, and the preliminary conversion statement is rewritten according to the statement execution plan corresponding to the optimal estimation result to obtain the final conversion statement.
6. The sentence conversion method according to claim 1, characterized in that: The conversion template library is obtained in the following manner: Obtain programming language information, engine association information, and rule combination mapping relationship information; Performing training processing on a preset language model according to the programming language information, the engine association information, and the rule combination mapping relationship information to obtain a training loss value; Adjusting the weight parameters of the language model according to the training loss value; When the weight parameter adjustment of the language model is completed, determining to obtain a data set training result; The conversion template library is constructed based on the training results of the data set.
7. The sentence conversion method according to claim 1, characterized in that: After the preset query optimizer optimizes and adjusts the preliminary conversion statement to obtain a final conversion statement, the method further includes: Evaluating the final converted statement to obtain a statement evaluation result; The conversion template library is updated according to the statement evaluation result.
8. A sentence conversion device, characterized in that: The device comprises: An acquisition unit, used to acquire label rule combination information to be converted; a parsing unit, configured to parse the tag rule combination information to be converted to obtain tag rule combination structure information and tag rule combination attribute information; a matching unit, configured to obtain a target sentence conversion template from a preset conversion template library according to the tag rule combination structure information and the tag rule combination attribute information; A filling unit, configured to fill the target statement conversion template based on a preset rule engine to obtain a preliminary conversion statement; The adjustment unit is used to optimize and adjust the preliminary conversion statement based on a preset query optimizer to obtain a final conversion statement.
9. An electronic device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the statement conversion method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing computer-executable instructions, characterized in that: The computer-executable instructions are used to execute the sentence conversion method according to any one of claims 1 to 7.