Syntax analyzer generation method, data processing method, medium, and device

By generating a grammatical analyzer in specific fields, the problems of low efficiency and low accuracy of indicator analysis in the prior art are solved, efficient indicator analysis is achieved and the implementation process of complex indicators is simplified.

CN115145584BActive Publication Date: 2024-11-26TONGDUN NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210836936.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-15
Publication Date
2024-11-26
Estimated Expiration
2042-07-15

AI Technical Summary

Technical Problem

In the prior art, grammatical analyzers for specific domain scenarios cannot effectively analyze indicators, resulting in low analysis efficiency and low accuracy, and requiring customized processing, resulting in long development cycles and waste of resources.

Method used

By obtaining the original scene indicators of specific domain scenarios, abstracting the process to generate lexical files, assembling lexical symbols to generate grammar files, and compiling and generating grammar analyzers based on compilation tools, supporting domain-specific language descriptions of complex indicators, reducing the cost of realizing complex indicators.

Benefits of technology

It improves the efficiency and accuracy of indicator analysis, avoids the long development cycle and waste of resources caused by customized processing, and simplifies the implementation process of complex indicators.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115145584B_ABST
    Figure CN115145584B_ABST
Patent Text Reader

Abstract

The present disclosure is about a method for generating a syntax analyzer, a data processing method, a medium, and a device, and relates to the field of computer technology. The method includes: obtaining original scene indicators in a specific domain scene, and abstracting the original scene indicators to obtain a lexical file in the specific domain scene; assembling the lexical symbols included in the lexical file to obtain a grammar file in the specific domain scene; compiling the lexical file and the grammar file based on a preset compilation tool to generate a syntax analyzer in the specific domain scene. The present disclosure solves the problem that the efficiency of indicator analysis is low and the accuracy of the analysis result is also low.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] In the existing technical solutions, in certain specific domain scenarios, some indicators in the specific domain scenarios cannot be analyzed by the syntax analyzer of the specific domain scenarios, which makes the efficiency of indicator analysis low and the accuracy of the analysis results low.

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

[0004] The purpose of the present disclosure is to provide a method for generating a grammatical analyzer, a device for generating a grammatical analyzer, a data processing method, a computer-readable storage medium, and an electronic device, thereby at least to a certain extent overcoming the problems of low efficiency of indicator analysis and low accuracy of analysis results caused by limitations and defects of related technologies.

[0005] According to one aspect of the present disclosure, a method for generating a grammar analyzer is provided, comprising:

[0006] Acquire original scene indicators in a specific domain scene, and perform abstract processing on the original scene indicators to obtain a lexical file in the specific domain scene;

[0007] Assembling the lexical symbols included in the lexical file to obtain a grammar file in the specific domain scenario;

[0008] The lexical file and the grammar file are compiled based on a preset compilation tool to generate a grammar analyzer in the specific domain scenario.

[0009] In an exemplary embodiment of the present disclosure, the original scene indicator includes multiple types of date symbols, string symbols, number symbols, relational operation symbols, conventional operation symbols, comparison symbols, bracket symbols, and segmentation symbols;

[0010] The original scene indicators are abstracted to obtain the lexical files in the specific domain scene, including:

[0011] Performing abstract processing on the date symbol to obtain a first lexical symbol corresponding to the date symbol; and / or

[0012] Abstracting the string symbol to obtain a second lexical symbol corresponding to the string symbol; and / or

[0013] Abstracting the digital symbol to obtain a third lexical symbol corresponding to the digital symbol; and / or

[0014] Abstracting the relational operator symbol to obtain a fourth lexical symbol corresponding to the relational operator symbol; and / or

[0015] Abstracting the conventional operation symbol to obtain a fifth lexical symbol corresponding to the conventional operation symbol; and / or

[0016] Abstracting the comparison symbol to obtain a sixth lexical symbol corresponding to the comparison symbol; and / or

[0017] Performing abstract processing on the bracket symbol to obtain a seventh lexical symbol corresponding to the bracket symbol; and / or

[0018] Abstracting the segmentation symbol to obtain an eighth lexical symbol corresponding to the segmentation symbol;

[0019] According to the first lexical symbol and / or the second lexical symbol and / or the third lexical symbol and / or the fourth lexical symbol and / or the fifth lexical symbol and / or the sixth lexical symbol and / or the seventh lexical symbol and / or the eighth lexical symbol, a lexical file in the specific domain scenario is constructed.

[0020] In an exemplary embodiment of the present disclosure, the lexical symbols included in the lexical file are assembled to obtain a grammar file in the specific domain scenario, including:

[0021] Assembling the first lexical symbol and / or the second lexical symbol and / or the third lexical symbol and / or the fourth lexical symbol and / or the fifth lexical symbol and / or the sixth lexical symbol and / or the seventh lexical symbol and / or the eighth lexical symbol to obtain one or more expressions having a first calculation level;

[0022] Assembling the first expression and the first lexical symbol and / or the second lexical symbol and / or the third lexical symbol and / or the fourth lexical symbol and / or the fifth lexical symbol and / or the sixth lexical symbol and / or the seventh lexical symbol and / or the eighth lexical symbol to obtain one or more expressions with a second calculation level;

[0023] Repeat the calculation process of the expression with the second calculation level in sequence to obtain one or more expressions with other calculation levels;

[0024] A grammar file in the specific domain scenario is constructed according to one or more expressions with a first calculation level and / or one or more expressions with a second calculation level and / or one or more expressions with other calculation levels.

[0025] In an exemplary embodiment of the present disclosure, the lexical file and the grammar file are compiled based on a preset compilation tool to generate a grammar analyzer in the specific domain scenario, including:

[0026] Based on the preset compilation tool, the lexical symbols included in the grammar file and the expressions composed of the lexical symbols are identified, and the logical relationship between the expressions is identified; wherein the logical relationship includes a nested logical relationship and / or a logical relationship with the same calculation priority;

[0027] A syntax tree file is generated according to the expressions and the logical relationship between the expressions, and the syntax tree file is compiled based on the preset mutation tool to obtain a syntax analyzer in the specific domain scenario.

[0028] In an exemplary embodiment of the present disclosure, the method for generating a syntax analyzer further includes:

[0029] A syntax tree monitoring interface is configured for each syntax file included in the syntax analyzer, and the syntax tree monitoring interface is filled with calling logic and / or data processing logic corresponding to the syntax file.

[0030] In an exemplary embodiment of the present disclosure, the method for generating a syntax analyzer further includes:

[0031] According to the original scene index in the specific domain scene and the syntax analyzer, a user display interface corresponding to the specific domain scene is generated, and the user display interface is displayed.

[0032] In an exemplary embodiment of the present disclosure, the method for generating a syntax analyzer further includes:

[0033] In response to a configuration operation on an original scene indicator included in the user display interface, updating the original scene indicator;

[0034] Wherein, updating the original scene indicator includes at least one of adding, deleting and modifying the original scene indicator.

[0035] According to one aspect of the present disclosure, there is provided a data processing method, comprising:

[0036] Acquire data to be processed, and perform syntax analysis on the data to be processed based on a preset syntax analyzer to obtain expressions to be processed included in the data to be processed and logical relationships between the expressions to be processed; wherein the syntax analyzer is generated by any of the syntax analyzer generation methods described above;

[0037] Generate a syntax tree to be processed based on the expressions to be processed and the logical relationship between the expressions to be processed;

[0038] The syntax tree to be processed is converted into a structured query language, and the structured query language is executed to obtain a data processing result corresponding to the data to be processed.

[0039] According to one aspect of the present disclosure, there is provided a device for generating a grammar analyzer, comprising:

[0040] An abstract processing module is used to obtain original scene indicators in a specific domain scene, and perform abstract processing on the original scene indicators to obtain a lexical file in the specific domain scene;

[0041] A lexical symbol assembly module, used for assembling the lexical symbols included in the lexical file to obtain a grammar file in the specific domain scenario;

[0042] The syntax analyzer generation module is used to compile the lexical file and the syntax file based on a preset compilation tool to generate a syntax analyzer in the specific domain scenario.

[0043] In an exemplary embodiment of the present disclosure, the original scene indicator includes multiple types of date symbols, string symbols, number symbols, relational operation symbols, conventional operation symbols, comparison symbols, bracket symbols, and segmentation symbols;

[0044] The abstract processing module may also be configured to: perform abstract processing on the date symbol to obtain a first lexical symbol corresponding to the date symbol; and / or perform abstract processing on the string symbol to obtain a second lexical symbol corresponding to the string symbol; and / or perform abstract processing on the digital symbol to obtain a third lexical symbol corresponding to the digital symbol; and / or perform abstract processing on the relational operator to obtain a fourth lexical symbol corresponding to the relational operator; and / or perform abstract processing on the conventional operator to obtain a fifth lexical symbol corresponding to the conventional operator. Lexical symbol; and / or abstract the comparison symbol to obtain a sixth lexical symbol corresponding to the comparison symbol; and / or abstract the bracket symbol to obtain a seventh lexical symbol corresponding to the bracket symbol; and / or abstract the separation symbol to obtain an eighth lexical symbol corresponding to the separation symbol; construct a lexical file in the specific domain scenario according to the first lexical symbol and / or the second lexical symbol and / or the third lexical symbol and / or the fourth lexical symbol and / or the fifth lexical symbol and / or the sixth lexical symbol and / or the seventh lexical symbol and / or the eighth lexical symbol.

[0045] In an exemplary embodiment of the present disclosure, the lexical symbol assembly module can also be configured to: assemble the first lexical symbol and / or the second lexical symbol and / or the third lexical symbol and / or the fourth lexical symbol and / or the fifth lexical symbol and / or the sixth lexical symbol and / or the seventh lexical symbol and / or the eighth lexical symbol to obtain one or more expressions with a first calculation level; assemble the first expression and the first lexical symbol and / or the second lexical symbol and / or the third lexical symbol and / or the fourth lexical symbol and / or the fifth lexical symbol and / or the sixth lexical symbol and / or the seventh lexical symbol and / or the eighth lexical symbol to obtain one or more expressions with a second calculation level; repeat the calculation process of the expression with the second calculation level in sequence to obtain one or more expressions with other calculation levels; and construct a grammar file in the specific domain scenario according to one or more expressions with the first calculation level and / or one or more expressions with the second calculation level and / or one or more expressions with other calculation levels.

[0046] In an exemplary embodiment of the present disclosure, the syntax analyzer generation module can also be configured to: identify the lexical symbols included in the syntax file and the expressions composed of the lexical symbols based on the preset compilation tool, and identify the logical relationship between each of the expressions; wherein the logical relationship includes a nested logical relationship and / or a logical relationship with the same calculation priority; generate a syntax tree file according to the expression and the logical relationship between each of the expressions, and compile the syntax tree file based on the preset mutation tool to obtain the syntax analyzer in the specific domain scenario.

[0047] In an exemplary embodiment of the present disclosure, the generating device of the syntax analyzer may further include:

[0048] The logic filling module can be used to configure a syntax tree monitoring interface for each syntax file included in the syntax analyzer, and fill the calling logic and / or data processing logic corresponding to the syntax file in the syntax tree monitoring interface.

[0049] In an exemplary embodiment of the present disclosure, the generating device of the syntax analyzer may further include:

[0050] The user display interface generation module can be used to generate a user display interface corresponding to the specific domain scene according to the original scene indicators in the specific domain scene and the syntax analyzer, and display the user display interface.

[0051] In an exemplary embodiment of the present disclosure, the generating device of the syntax analyzer may further include:

[0052] A scene indicator updating module, which can be used to update the original scene indicator in response to a configuration operation on the original scene indicator included in the user display interface;

[0053] Wherein, updating the original scene indicator includes at least one of adding, deleting and modifying the original scene indicator.

[0054] According to one aspect of the present disclosure, there is provided a data processing device, comprising:

[0055] A syntax parsing module, which can be used to obtain data to be processed, and perform syntax analysis on the data to be processed based on a preset syntax analyzer to obtain expressions to be processed included in the data to be processed and logical relationships between the expressions to be processed; wherein the syntax analyzer is generated by any of the syntax analyzer generation methods described above;

[0056] A syntax tree generation module, which can be used to generate a syntax tree to be processed based on the expressions to be processed and the logical relationship between the expressions to be processed;

[0057] The structured query language execution module can be used to convert the syntax tree to be processed into a structured query language, execute the structured query language, and obtain a data processing result corresponding to the data to be processed.

[0058] According to one aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for generating a syntax analyzer described in any one of the above and the method for processing data described in any one of the above are implemented.

[0059] According to one aspect of the present disclosure, there is provided an electronic device, including:

[0060] Processor; and

[0061] A memory, configured to store executable instructions of the processor;

[0062] The processor is configured to execute any one of the above-mentioned methods for generating a syntax analyzer and any one of the above-mentioned data processing methods by executing the executable instructions.

[0063] The disclosed embodiment provides a method for generating a syntax analyzer. On the one hand, the original scenario indicators in a specific domain scenario are obtained and the original scenario indicators are abstracted to obtain a lexical file in the specific domain scenario; then the lexical symbols included in the lexical file are assembled to obtain a grammar file in the specific domain scenario; finally, the lexical file and the grammar file are compiled based on a preset compilation tool to obtain a syntax analyzer in the specific domain scenario, and then the indicators included in the specific domain scenario can be analyzed by the syntax analyzer, which solves the problem in the prior art that some indicators in the specific domain scenario cannot be analyzed by the syntax analyzer of the specific domain scenario, resulting in low efficiency of indicator analysis and low accuracy of analysis results, thereby improving the efficiency of indicator analysis and the accuracy of analysis results; on the other hand, since the corresponding syntax analyzer can be generated by the lexical file and the grammar file in the specific domain scenario, the syntax analyzer can specifically process all indicators included in the specific domain scenario, thereby avoiding the problem in the prior art that the indicators included in the specific domain scenario need to be processed in a customized manner, resulting in a long development cycle and waste of resources.

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

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

[0066] Figure 1 The flowchart schematically shows a method for generating a syntax analyzer according to an exemplary embodiment of the present disclosure.

[0067] Figure 2 An example diagram schematically illustrates an interpretation of nested symbols for dates according to an example embodiment of the present disclosure.

[0068] Figure 3 An example diagram schematically illustrates a grammar rule obtained by assembling lexical symbols according to an example embodiment of the present disclosure.

[0069] Figure 4 , Figure 5 , Figure 6 , Figure 7 , Figure 8 , Fig. 9 as well as Fig.10 An example diagram of a sub-grammar tree according to an example embodiment of the present disclosure is schematically shown respectively.

[0070] Fig.11 An example diagram of a syntax tree according to an example embodiment of the present disclosure is schematically shown.

[0071] Fig.12 An example diagram of a grammar rule with nested levels according to an example embodiment of the present disclosure is schematically shown.

[0072] Fig.13 An example diagram of filling in call logic in a syntax tree monitoring interface according to an example embodiment of the present disclosure is schematically shown.

[0073] Fig.14 The flowchart schematically shows a data processing method according to an exemplary embodiment of the present disclosure.

[0074] Fig.15 A block diagram schematically shows a device for generating a syntax analyzer according to an exemplary embodiment of the present disclosure.

[0075] Fig.16 The following is a block diagram schematically showing a data processing device according to an exemplary embodiment of the present disclosure.

[0076] Fig.17 An electronic device for implementing the syntax analyzer generation method and data processing method according to an exemplary embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0077] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.

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

[0079] As the Internet of Things (IoT) industries such as e-commerce, payment, live streaming, and short videos become more and more developed, credit risk, anti-fraud, and content security review are becoming more and more important. In these specific scenarios, one of the most important technologies is indicator calculation, which is then used to determine the level of credit risk, whether there is fraud, and whether there is unsafe behavior, etc. In a credit scenario, for example, it is necessary to determine whether a customer's transaction is a risky transaction or a money laundering operation; in an e-commerce scenario, it is necessary to determine whether a user's transaction is a fake order, etc.

[0080] In the process of determining whether a transaction or payment is money laundering or fraudulent, multiple indicators may need to be determined. Among these indicators, some are relatively simple, while others are relatively complex. Among them:

[0081] First, simpler indicators may include, for example: Indicator 1: Last 30 days_Mobile phone number_Transaction event_Number of occurrences_This application; Indicator 2: 7 days_Account_Transaction event_Number of occurrences_This application_Group transaction passed; Indicator 3: ≥3 accounts opened with the same mobile phone number in one day or the number of accounts opened with the same mobile phone number ≥5 (Type I, II, and III accounts) within 12 months_Excluding certificate of deposit account opening and closing; Indicator 4: The account opening date of the same account is ≤10 days, and the deposit at the time of opening the account is less than or equal to 100 yuan, the transaction amount is ≤10, and there are no other transactions during the period.

[0082] Secondly, more complex indicators may include: Indicator 5: For the same customer, in the past year, there are ≥II and III account deposits [non-bound account transfers and / or cash deposits] ≥90*annual limit [the annual limit for II accounts is 200,000, and the annual limit for III accounts is 50,000] and then the account is closed; Indicator 6: Accounts opened less than 12 months ago have the following characteristics: within a few days (within 1 month) after the new account is opened, there is more than one transaction with a transaction amount of less than 100 yuan, the current transaction is interest settlement, and there are no other outgoing transactions in the middle, excluding fee-based transactions (raising fund supervision accounts);

[0083] Furthermore, very complex indicators (which the industry cannot currently support well) may include, for example, indicator 7: the same person's account opening time is less than 8 months_within 30 days of account opening, there is more than one transaction with a transaction amount of less than 100 yuan, the cumulative number of transactions in and out of the account within one month is ≥1,000_the cumulative amount of withdrawals is ≥2 million, the current transaction is interest settlement_no withdrawal transactions in the past 10 days; indicator 8: for the same person's account, the number of months with the following characteristics in 12 months is ≥5: the number of active days with monthly transactions (withdrawals + deposits) ≥20 ≥20_excluding financial management and transaction counterparties of government affairs; indicator 9: for the same person's account, the number of months with the following characteristics in 12 months is ≥5: the number of active days with monthly transactions (withdrawals + deposits) ≥20 ≥20 ≥20_excluding financial management and transaction counterparties of government affairs; indicator 9: For a personal account, the following characteristics exist for more than 3 months in 12 months: transactions occur for more than 10 days in a month, and the proportion of transactions through the UnionPay channel is ≥40%_the average outgoing amount in a period of time is ≤10_the average incoming amount is ≤500_the number of small outgoing transactions is ≥80%_there are more than 5 UnionPay outgoing transactions with a transaction amount of ≥10,000 in the month; Indicator 10: For the same account, which has been activated for more than 3 months, the account has the following characteristics in the past year: high-frequency transactions in 1 month (more than 300 outgoing transactions), suspension for more than 2 months (the number of outgoing transactions in 2 months is close to 0); high-frequency transactions in the past month (more than 300 outgoing transactions), etc.

[0084] However, the industry currently only supports simple indicators or indicators of average complexity. However, there is no good support solution for very complex multi-dimensional indicators or complex indicators with multiple time windows. The fundamental reason is that it is impossible to abstractly describe such indicators well. Due to the inability to abstract well, each indicator must have its own special algorithmic logic support. In many scenarios, such indicators are large in number and changeable, so it is difficult to support them.

[0085] At the same time, the current existing methods can generally be concentrated as follows:

[0086] One is to summarize and process simple indicators in a unified manner: simple indicators can be abstracted and summarized into some specific types, such as count statistics, frequency statistics, quantity statistics, number of associations, and existence categories. The processing of such indicators is relatively simple and can generally be achieved through SQL queries at the database level.

[0087] The other is to combine complex indicators with simple indicators: for indicators of average complexity, multiple simple indicators are usually combined for processing; for example, the number of times and the existence of the class are combined; this type of indicator can be implemented in programming languages ​​such as Java combined with SQL;

[0088] Another is customized development of complex indicators: Currently, there is no good solution in the industry to support complex indicators, such as multi-dimensional data statistics in multiple time windows, multi-dimensional related indicators, etc. There are very few types of supported indicators of this type. Even if there is support, customized development is adopted, and each indicator is customized. Moreover, this development method has a high implementation cost and a long cycle, which seriously restricts the flexible development of the business.

[0089] However, the above scheme has the following defects: On the one hand, for the more complex indicators, the method of using simple indicator combination processing can only solve some indicators with lower complexity. It uses the existing simple indicators to make some combinations, calculations and judgments, but cannot support complex nested indicators, and the business scenarios are limited; On the other hand, for the customized development of complex indicators, it has the following problems: One problem is that since there is no set of domain-specific languages ​​to describe, each complex indicator requirement is a brand new indicator when it is proposed; for example, the elements, conditions, attributes, etc. of the indicator can only come from text descriptions, and the existing indicator assembly configuration function in the existing system cannot configure this indicator, and cannot be described in a standardized manner; and business experts and products, development, etc. can only confirm the true intention and demand meaning of the business based on text and face-to-face communication; Another problem is that the development cost is too high; At the same time, due to the complexity, it is impossible to use the current code to assemble and implement it, and it can only be redeveloped and implemented according to the requirements of the business, and then tested and released; and the implementation of each new indicator requires a lot of human resources; From accepting and confirming the requirements to development, testing, and release online, the entire cycle is too long, and the requirements cannot be released online immediately after they are proposed, which seriously affects the development rhythm of the business.

[0090] In order to solve the above problems, a domain-general language, such as Java or Python, is proposed, which can describe simple indicators; however, complex indicators with nested or multiple time windows are difficult to describe with domain-general languages. Therefore, this example implementation provides a method for generating a grammar analyzer, that is, Antlr4 can be used to establish a domain-general language to specifically describe complex indicators, collect and sort out complex indicators from business domain experts, and then abstract common lexical symbols, and then abstract common formulas and grammar patterns. With this set of patterns, the implementation cost of complex indicators can be greatly reduced.

[0091] Furthermore, the method for generating a grammar analyzer described in the exemplary embodiment of the present disclosure can be run on a terminal device, a server, a server cluster or a cloud server, etc. Of course, those skilled in the art can also run the method of the present disclosure on other platforms as required, and this exemplary embodiment does not specifically limit this. Figure 1 As shown, the method for generating the grammar analyzer may include the following steps:

[0092] Step S110. Acquire the original scene indicators in the specific domain scene, and perform abstract processing on the original scene indicators to obtain the lexical file in the specific domain scene;

[0093] Step S120. Assembling the lexical symbols included in the lexical file to obtain a grammar file in the specific domain scenario;

[0094] Step S130: Compile the lexical file and the grammar file based on a preset compilation tool to generate a grammar analyzer in the specific domain scenario.

[0095] In the above-mentioned method for generating a syntax analyzer, on the one hand, by obtaining the original scene indicators in the specific domain scene and abstracting the original scene indicators, a lexical file in the specific domain scene is obtained; then the lexical symbols included in the lexical file are assembled to obtain a grammar file in the specific domain scene; finally, the lexical file and the grammar file are compiled based on a preset compilation tool to obtain a syntax analyzer in the specific domain scene, and then the syntax analyzer can be used to analyze the indicators included in the specific domain scene, thereby solving the problem in the prior art that some indicators in the specific domain scene cannot be analyzed by the syntax analyzer of the specific domain scene, thereby making the efficiency of indicator analysis low and the accuracy of the analysis results low, thereby improving the efficiency of indicator analysis and the accuracy of the analysis results; on the other hand, since the corresponding syntax analyzer can be generated by the lexical file and the grammar file in the specific domain scene, the syntax analyzer can specifically process all the indicators included in the specific domain scene, thereby avoiding the problem in the prior art that the indicators included in the specific domain scene need to be processed in a customized manner, thereby causing a long development cycle and waste of resources.

[0096] Hereinafter, the method for generating a syntax analyzer according to an exemplary embodiment of the present disclosure will be explained and illustrated in detail with reference to the accompanying drawings.

[0097] First, the invention purpose of the exemplary embodiment of the present disclosure is explained and illustrated. Specifically, the generation method of the grammatical analyzer recorded in the exemplary embodiment of the present disclosure is mainly to achieve the following purposes: on the one hand, Antlr4 is used to establish a set of indicator field-specific languages ​​to specifically describe complex indicators, collect and sort out complex indicators from business field experts, and then abstract general lexical symbols, grammatical symbols and grammatical pattern formulas. With this set of patterns, when business experts add new complex indicators, they only need to use the defined lexical symbols / grammatical symbols and the defined grammatical patterns to combine formulas, which greatly reduces the communication costs of business demanders, product personnel, developers and other parties, and improves the efficiency of cross-team communication; on the other hand, when the general lexical symbols, grammatical patterns and indicator formulas are defined, general codes can be developed for each pattern formula and its combined pattern formula. Within the scope of the defined pattern formula, when configuring new complex indicators, there is no need to perform development testing and other work, and they can be directly spliced ​​according to the grammatical formula, and the existing implementation of the grammatical formula can be reused; greatly saving development resources and costs.

[0098] Secondly, the domain-specific language recorded in the exemplary embodiment of the present disclosure is explained and illustrated. Specifically, the domain-specific language involved in the exemplary embodiment of the present disclosure refers to a program that can be used to identify complex indicator description sentences, then extract key information, identify the indicator mode and indicator key variables therein, and then perform calculations; wherein, the domain-specific language recorded in the exemplary embodiment of the present disclosure can be implemented in the following manner: first, construct a program that can analyze the input sentence, and the sentence is composed of words, phrases and some punctuation marks, and the phrase is composed of some words; therefore, you can start from the most fine-grained words and symbols to define words and symbols; at the same time, because the phrase is composed of a single word in a certain order, the phrase is indivisible, and it is necessary to define a string of some indivisible words combined - phrases, so as to avoid sentence segmentation errors during recognition, and recognize the indivisible phrases as separate words. For example: I love my motherland and my people. It cannot be recognized as: I love my country and my people, it should be: I love my motherland and my people; further, because the sentence has a logical relationship and word order, for example: Because it is going to rain, you need to bring an umbrella when you go out. Here, "because" and "so" need to appear in pairs, otherwise it is an incorrect sentence; therefore, in the recognition process, you need to recognize and know that "because...so" need to appear in pairs; similarly, when encountering () brackets, you must also be able to recognize the brackets in pairs, not just half of them.

[0099] Based on the specific implementation process of the domain-specific language recorded above, we can know that the description of complex indicators can also be regarded as a new language, but this language is mainly used in the special field of complex indicators, so it is called a domain-specific language (or domain-specific language). Specifically, we can take a complex multi-window nested complex indicator as an example to disassemble step by step how to define a domain-specific language, and then use it as a basis to implement complex indicators.

[0100] For example, suppose the indicator case is: the same individual account has the following characteristics for 5-10 months within 12 months: there are 20-25 days of high-frequency small-amount trial swipes within a month (the number of transactions is greater than 10 times and the cumulative transaction amount is less than 1,000 yuan, or the average single transaction amount is less than 100 yuan), and there are more than 5 online payment withdrawals with a transaction amount greater than or equal to 10,000 in the same month, and the account type is a Class II account.

[0101] In this indicator case, there are some basic fields or basic indicators, so they can be used directly:

[0102] Basic indicator fields: transferCount, number of transactions; moneySum, total transaction amount; accountType, account type, etc. Among them, the account type that can be extracted is a second-class account, and transferOut (transaction amount) is the number of Nets Union withdrawals greater than 10,000; at the same time, the abstract configuration results that can be obtained are:

[0103] [12M,5,10,[30D,20,25,((moneySum<1000||treansferCount>10||(moneySum / treansferCount)<100)&&transferOut>5&&accountType=3)]].

[0104] That is, the grammatical analyzer generated by the grammatical analyzer generation method recorded in the exemplary embodiment of the present disclosure can ultimately achieve the following goal: through the grammatical analyzer, the input indicator case "the same individual account has the following characteristics for 5-10 months within 12 months: there are 20-25 days within 1 month with high-frequency small-amount trial swipes (the number of transactions is greater than 10 times and the cumulative transaction amount is less than 1,000 yuan, or the average single transaction amount is less than 100 yuan), and there are more than 5 Nets Union withdrawals with transaction amounts greater than or equal to 10,000 in the month, and the account type is a Class II account" is analyzed, and then the expression is obtained: [12M, 5, 10, [30D, 20, 25, ((moneySum<1000||treansferCount>10||(moneySum / treansferCount)<100)&&transferOut>5&&accountType=3)]]; and then the account corresponding to the expression is matched from the database according to the expression.

[0105] The following will Figure 1 The generation method of the syntax analyzer shown in is explained and illustrated in detail.

[0106] In step S110, original scene indicators in a specific domain scene are obtained, and abstract processing is performed on the original scene indicators to obtain a lexical file in the specific domain scene.

[0107] In this example embodiment, first, the original scene indicators in the specific field scene can be obtained; wherein the original scene indicators include date symbols, string symbols, numeric symbols, relational operation symbols, conventional operation symbols, comparison symbols, bracket symbols and separation symbols, etc.; wherein the date symbol can be a specific year, month, day, hour, minute, second, etc., and the string symbol can be, for example, the basic field of the indicator included in the specific field scene. For example, in an e-commerce or payment scenario, the basic field of the indicator can include the number of transactions, transaction amount, account type, etc.; for another example, in a live broadcast or short video scenario, the basic field of the indicator can include the number of clicks, the number of views, the number of favorites, the number of fans or the transaction amount, etc., and this example does not impose special restrictions on this; further, the numeric symbol can be, for example, a specific value of the transaction amount, a specific value of the number of transactions, etc.; the relational operation symbol can include relational operation symbols such as and, or, and; the conventional operation symbol can include operation symbols such as addition, subtraction, multiplication, division and square root; the comparison symbol can include, for example, greater than, less than, equal to, greater than or equal to, less than or equal to, etc.; the separation symbol can include, for example, a space character, a comma, a semicolon or a period, etc., and this example does not impose special restrictions on this.

[0108] Furthermore, after obtaining the above-mentioned original scene indicators, the original scene indicators can be abstracted to obtain the lexical file in the specific domain scene. Specifically, the specific implementation process of abstracting the lexical file can be achieved in the following ways: abstracting the date symbol to obtain a first lexical symbol corresponding to the date symbol; and / or abstracting the string symbol to obtain a second lexical symbol corresponding to the string symbol; and / or abstracting the digital symbol to obtain a third lexical symbol corresponding to the digital symbol; and / or abstracting the relational operator to obtain a fourth lexical symbol corresponding to the relational operator; and / or abstracting the conventional operator to obtain a fourth lexical symbol corresponding to the conventional operator. The fifth lexical symbol corresponding to the symbol; and / or the comparison symbol is abstracted to obtain the sixth lexical symbol corresponding to the comparison symbol; and / or the bracket symbol is abstracted to obtain the seventh lexical symbol corresponding to the bracket symbol; and / or the separation symbol is abstracted to obtain the eighth lexical symbol corresponding to the separation symbol; according to the first lexical symbol and / or the second lexical symbol and / or the third lexical symbol and / or the fourth lexical symbol and / or the fifth lexical symbol and / or the sixth lexical symbol and / or the seventh lexical symbol and / or the eighth lexical symbol, a lexical file in the specific domain scenario is constructed.

[0109] The following will further explain and illustrate the abstraction process. Specifically, the abstraction process can also be called the lexical analysis process. In the lexical analysis process, the smallest granularity of symbols that can be recognized is first required, such as an integer 2276, a greater than symbol > or an associative symbol &&, etc. When reading a data, the most basic symbols included in the input data can be recognized. At the same time, the process of aggregating characters into words or symbols is called lexical analysis. In the specific application process, it can be implemented by defining a lexical analyzer (also called a lexical file) through antlr4. Under this premise, it is necessary to define the symbols that the lexical analyzer needs to recognize. Further, through the understanding of complex indicator business, a set of abstractions can be sorted out to cover all possible relationships and symbols used in complex indicators. At the same time, after the abstraction determines this lexical system, it needs to be made public to reach a consensus among indicator business experts, developers, testers, etc. to ensure that the same symbol has only one accurate meaning to improve communication efficiency. For example, refer to Figure 2 An explanation of the nested notation for a date is shown below:

[0110] [nD,x,z,expr], in the last n days, there are xz days that satisfy expr; expr is the conditional expression, historical count>10; s is seconds, m is minutes, h is hours, D is days, M is months, Y is years, nD represents the time range, starting from the current time and moving forward n days, x and z are both closed intervals, this symbol is intended to abstract a unified time window descriptor; at the same time, since Antlr4 supports left recursion, nested windows such as [12M,2,6,[30D,20,25,expr]] can be implemented; {n,} means at least n matches.

[0111] For example, [20D,0,5,expr] means that 0-5 days in the last 20 days meet the condition expr (expression); [20D,5,20,expr] means that 5-20 days in the last 20 days meet the condition expr; [20D,20,20,expr] means that 20 days in the last 20 days meet the condition expr; [12M,2,6,[30D,20,25,expr]] means that in the last 12 months, 2-6 months meet the condition; in the 30 days of a month, 20-25 days meet the condition expr.

[0112] Furthermore, after determining the various symbols needed, these symbols can be defined as lexical rules (lexical files), as follows. All complex indicators can be clearly described using the following dozens of symbols:

[0113] First, the date symbol can be abstracted as: YEAR: 'Y'; MONTH: 'M'; DAY: 'D'; HOUR: 'h'; MIN: 'm'; SECOND: 's'; that is, the first lexical symbol

[0114] The string symbol is: FIELD_NAME:[a-zA-Z]+; that is, the second lexical symbol

[0115] Numeric symbols: INT: [0-9]+; NUMBER: ('0'…'9')+('.'('0'…'9')+); SCIENTIFIC_NUMBER: NUMBER((E1|E2)SIGN?NUMBER); fragment E1: 'E'; fragment E2: 'e'; fragmentSIGN: ('+'|'-'); that is, the third lexical symbol;

[0116] Relational operator symbols: AND: '&'; DOUBLE_AND: '&&'; OR: '|'; DOUBLE_OR: '||'; also known as the fourth lexical symbol;

[0117] Conventional operator symbols: PLUS: '+'; MINUS: '-'; TIMES: '*'; DIV: ' / '; SQRT: 'sqrt'; POW: '^'; also known as the fifth lexical symbol;

[0118] Comparison symbols: GT: '>'; LT: '<'; EQ: '='; GT_EQ: '≥'; LT_EQ: '≤'; also known as the sixth lexical symbol;

[0119] Bracket symbols: LSQUARE: '['; RSQUARE: ']'; LBRACES: '{'; RBRACES: '}'; LPAREN: '('; RPAREN: ')'; also known as the seventh lexical symbol;

[0120] Separation symbols: COMMA: ','; POINT: '.', which is the eighth lexical symbol.

[0121] At this point, all the abstract processing processes have been completed, and the corresponding lexical file can be constructed according to the first lexical symbol to the eighth lexical symbol obtained by the abstract processing.

[0122] In step S120, the lexical symbols included in the lexical file are assembled to obtain a grammar file in the specific domain scenario.

[0123] In an example embodiment of the present disclosure, first, the first lexical symbol and / or the second lexical symbol and / or the third lexical symbol and / or the fourth lexical symbol and / or the fifth lexical symbol and / or the sixth lexical symbol and / or the seventh lexical symbol and / or the eighth lexical symbol are assembled to obtain one or more expressions with a first calculation level; secondly, the first expression and the first lexical symbol and / or the second lexical symbol and / or the third lexical symbol and / or the fourth lexical symbol and / or the fifth lexical symbol and / or the sixth lexical symbol and / or the seventh lexical symbol and / or the eighth lexical symbol are assembled to obtain one or more expressions with a second calculation level; then, the calculation process of the expression with the second calculation level is repeated in sequence to obtain one or more expressions with other calculation levels; finally, according to the one or more expressions with the first calculation level and / or one or more expressions with the second calculation level and / or one or more expressions with other calculation levels, a grammar file in the specific domain scenario is constructed.

[0124] The following will further explain and illustrate the specific generation process of the grammar file. Specifically, the generation process of the grammar file can also be called a grammar analysis process; wherein, in the grammar analysis process, when receiving the input statement, it is necessary not only to be able to recognize the key characters and symbols, but also to be able to recognize the logical relationships, calculation relationships, and comparison relationships, etc., and to be able to access these key information at any time when the program is running; in order to achieve this goal, some patterns and processing methods of complex indicators can be sorted out through the understanding of complex indicator business; for example, the various lexical symbols obtained through the above-mentioned abstract processing can be assembled in a certain order to obtain grammar rules. Specifically, refer to Figure 3 As shown, for example:

[0125] expr:expr(GT|LT|GT_EQ|LT_EQ|EQ)expr#compare

[0126] |expr(DIV)expr#calc

[0127] |expr(AND|OR|DOUBLE_AND|DOUBLE_OR)expr#relation

[0128] |autom#automExpr|timeExpr#timeExprStr

[0129] |SCIENTIFIC_NUMBER#scientificNumber

[0130] |NUMBER#number

[0131] |INT#int

[0132] |FIELD_NAME#fieldName ;

[0134] automTimeExpr

[0135] :INT(YEAR|MONTH|DAY|HOUR) ;

[0137] autom

[0138] :LPAREN expr RPAREN ;

[0140] …

[0141] exist Figure 3In the example shown, since Antlr4 supports the implementation of left recursion, complex nested expressions can be implemented with this feature. For example, in the example with nested expressions shown below:

[0142] [12M,5,10,[30D,20,25,((moneySum<1000||treansferCount>10||(moneySum / treansferCount)<100)&&transferOut>5&&accountType=3)]];

[0143] Expressions with the first calculation level may include, for example, moneySum<1000, treansferCount>10, etc., expressions with the second calculation level may include, for example, (moneySum / treansferCount)<100), etc.; expressions with the third calculation level may include, for example, ((moneySum<1000||treansferCount>10||(moneySum / treansferCount)<100), etc.; in the specific application process, the corresponding computer expressions can be configured according to actual needs, and this example does not impose any special restrictions on this.

[0144] It should be noted that since the nested phrases are a self-similar language structure, that is, its word phrases also follow the same structure; therefore, the defined expr expression rule is a typical self-similar language structure, consisting of nested expressions separated by different operators or relational symbols. That is, in the specific implementation process, the first lexical symbol and / or the second lexical symbol and / or the third lexical symbol and / or the fourth lexical symbol and / or the fifth lexical symbol and / or the sixth lexical symbol and / or the seventh lexical symbol and / or the eighth lexical symbol can be assembled to obtain one or more expressions with a first calculation level; then the first expression and the first lexical symbol and / or the second lexical symbol and / or the third lexical symbol and / or the fourth lexical symbol and / or the fifth lexical symbol and / or the sixth lexical symbol and / or the seventh lexical symbol and / or the eighth lexical symbol can be assembled to obtain one or more expressions with a second calculation level; then the calculation process of the expressions with the second calculation level is repeated in sequence to obtain one or more expressions with other calculation levels; finally, according to one or more expressions with the first calculation level And / or one or more expressions with a second calculation level and / or one or more expressions with other calculation levels, to construct a grammar file in a specific domain scenario; that is, the obtained grammar file may include expr1&&expr2, when expr1 is a and expr2 is b, that is, a&&b; when expr1 is a<5 as a whole and expr2 is b>7 as a whole, that is, a<5&&b>7; that is, the expr itself composed of simple characters can also be used to assemble more complex exprs; as for how many expressions of calculation levels are needed, it can be determined according to actual needs, and this example does not impose any special restrictions on this; further, by setting multiple expressions of different calculation levels, specific nesting can be achieved, thereby achieving the purpose of satisfying indicator calculation in complex scenarios.

[0145] In step S130, the lexical file and the grammar file are compiled based on a preset compilation tool to generate a grammar analyzer in the specific domain scenario.

[0146] In this example embodiment, first, based on the preset compilation tool, lexical symbols included in the grammar file and expressions composed of the lexical symbols are identified, and the logical relationship between each of the expressions is identified; wherein the logical relationship includes a nested logical relationship and / or a logical relationship with the same calculation priority; secondly, a syntax tree file is generated according to the expression and the logical relationship between each of the expressions, and the syntax tree file is compiled based on the preset mutation tool to obtain a syntax analyzer in the specific domain scenario.

[0147] Specifically, the specific implementation process of the grammar analyzer can be implemented as follows: First, identify lexical symbols and expressions. The identified lexical symbols and expressions may include: Figure 4 As shown, expr supports FIELD_NAME and NUMBER, that is, strings and numbers, so it can recognize string variables such as accountType and moneySum and numbers such as 5, 1000, and 5; secondly, refer to Figure 5 As shown, expr GT expr can express treansferCount>10; then, refer to Figure 6 As shown, expr DIV expr can express moneySum / treansferCount; for further reference, Figure 7 As shown, expr AND expr can express transferOut>5&&accountType=3; for further reference, Figure 8 As shown, LPAREN expr RPAREN, which can express (moneySum / treansferCount) < 100; further, refer to Fig. 9 As shown, INT(MONTH) can express 5M; finally, refer to Fig.10 As shown, LSQUARE automTimeExprCOMMA INT COMMA INT COMMA expr RSQUARE can be expressed.

[0148] So far, we have fully explained how the grammar rules composed of lexical symbols recognize simple input. That is, in the specific application process, the lexical analyzer processes the character sequence and provides the generated lexical symbols to the grammar parse tree. The grammar parse tree checks the correctness of the grammar based on this information and constructs a grammar parse tree. The obtained grammar parse tree can be specifically referred to Fig.11 shown; based on Fig.11 It can be seen from the syntax analysis tree shown that each leaf node in the syntax analysis tree is actually some simple grammars explained above, and these simple grammars are composed of various lexical symbols defined above; that is, the calculation of complex scenario indicators can be realized through the defined lexical symbols.

[0149] Further, after obtaining the grammatical analysis tree, the grammatical analysis tree can be compiled using the Antlr tool to obtain the corresponding grammatical analyzer. The obtained grammatical analyzer can be referred to Fig.12As shown; wherein, the syntax analyzer can be a recursive descent syntax analyzer, which is a collection of several recursive methods, each method corresponds to a rule; at the same time, the descent process is the process of parsing from the root node of the syntax analysis tree to the leaf node.

[0150] At this point, the implementation process of the syntax analyzer has been completed.

[0151] In an exemplary embodiment provided by the present disclosure, after the generation of the grammar analyzer is completed, the generation method of the grammar analyzer further includes: configuring a grammar tree listening interface for each grammar file included in the grammar analyzer, and filling the call logic and / or data processing logic corresponding to the grammar file in the grammar tree listening interface. That is, after the lexical and grammar rules are defined, the access entry of the rule can be marked in the form of #xxxx behind each grammar rule; and the Antlr runtime library provides a listener mechanism, which can generate a subclass of ParseTreeListener for each grammar file. In this class, each rule in the grammar has corresponding enter() and exit() methods. For example, when the traverser accesses the node corresponding to the compare rule, it will call the enterCompare() method and then pass the corresponding grammar tree node instance to it as a parameter; therefore, the ParseTreeListener interface can be implemented by itself, and the required call logic can be filled in the interface, that is, the logic of how to process data when encountering each rule; wherein, the specific filled logic can refer to Fig.13 shown.

[0152] So far, the implementation of the DSL engine in the field of complex indicators has been completed. In summary, the specific implementation process can include the following steps: First, abstract a set of lexical symbols, which can abstractly describe the business semantics of all complex indicators; second, according to the lexical rules and business logic, abstract a set of grammatical rules that can identify and support various functions such as complex nesting, time windows, comparisons, etc. This set of grammatical rules can identify and parse indicator descriptions of various complexities; then, according to the grammatical rules, generate a syntax tree, and in the implementation of the syntax tree listener, implement an access entry method for each syntax rule, and pass the context data required by the rule to the access entry method in the form of input parameters; further, in the specific implementation of each rule method of the listener, we will do the specific development and implementation of our business; further, since the lexical symbols and grammatical rules are universal, after these universal rules are implemented, the complex indicators composed of these universal rules can also be implemented. For example: if the function of a&&b is implemented, then the implementation of (a>6)&&(b<9) is realized.

[0153] In an example embodiment, the method for generating the grammar analyzer further includes: generating a user display interface corresponding to the specific domain scenario according to the original scenario indicators in the specific domain scenario and the grammar analyzer, and displaying the user display interface. Specifically, after the above-mentioned general indicator rules / patterns / formulas are implemented, a page (i.e., a user display interface) can be developed, so that when a user wants to use an indicator, he only needs to configure it on the page according to the prescribed lexical symbols and grammar rules.

[0154] In an example embodiment, the generation method of the grammatical analyzer further includes: in response to a configuration operation on the original scene indicator included in the user display interface, updating the original scene indicator; wherein, updating the original scene indicator includes at least one of adding, deleting and modifying the original scene indicator. That is, assuming the indicators to be achieved: for the same personal account, there are 5-10 months with the following characteristics within 12 months: there are 20-25 days with high-frequency small-amount trial swipes within 1 month (the number of transactions is greater than 10 times and the cumulative transaction amount is less than 1,000 yuan, or the average single transaction amount is less than 100 yuan), and there are more than 5 online payment withdrawals with a transaction amount of ≥ 10,000 in the month, and the account type is a Class II account.

[0155] In this indicator, there are some basic fields or basic indicators that can be used directly:

[0156] Basic indicator fields: transferCount transaction times; moneySum transaction amount sum; accountType account type: second-class account; transferOut transaction amount greater than 10000 Wanglian account number; then, the page configuration is: [12M, 5, 10, [30D, 20, 25, ((moneySum < 1000 || treansferCount > 10 || (moneySum / treansferCount) < 100) && transferOut > 5 && accountType = 3)]]. Of course, during the configuration of the page, the user can also configure new scenario indicators, delete some scenario indicators or modify some scenario indicators, etc. This example does not impose special restrictions on this.

[0157] The exemplary embodiment of the present disclosure also provides a data processing method. Specifically, refer to Fig.14 As shown, the data processing method may include the following steps:

[0158] Step S1410, obtaining data to be processed, and performing syntax analysis on the data to be processed based on a preset syntax analyzer to obtain expressions to be processed included in the data to be processed and logical relationships between the expressions to be processed; wherein the syntax analyzer is generated by the syntax analyzer generation method described above;

[0159] Step S1420, generating a syntax tree to be processed based on the expressions to be processed and the logical relationship between the expressions to be processed;

[0160] Step S1430: convert the syntax tree to be processed into a structured query language, execute the structured query language, and obtain a data processing result corresponding to the data to be processed.

[0161] exist Fig.14 In the data processing method shown, on the one hand, by performing syntax analysis on the data to be processed based on a preset syntax analyzer, the expressions to be processed included in the data to be processed and the logical relationship between the expressions to be processed are obtained, and based on the expressions to be processed and the logical relationship between the expressions to be processed, a syntax tree to be processed is generated, and finally the syntax tree to be processed is converted into a structured query language, and the structured query language is executed to obtain a data processing result corresponding to the data to be processed. This solves the problem in the prior art that some indicators in the specific domain scenario cannot be analyzed by the syntax analyzer of the specific domain scenario, thereby resulting in low efficiency of indicator analysis and low accuracy of analysis results, thereby improving the efficiency of indicator analysis and at the same time improving the accuracy of analysis results.

[0162] The exemplary embodiment of the present disclosure also provides a device for generating a grammar analyzer. Specifically, refer to Fig.15 As shown, the syntax analyzer generation device may include an abstraction processing module 1510, a lexical symbol processing module 1520 and a syntax analyzer generation module 1530. Among them:

[0163] The abstraction processing module 1510 can be used to obtain the original scene indicators in the specific domain scene, and perform abstraction processing on the original scene indicators to obtain the lexical file in the specific domain scene;

[0164] The lexical symbol assembly module 1520 may be used to assemble the lexical symbols included in the lexical file to obtain a grammar file in the specific domain scenario;

[0165] The syntax analyzer generation module 1530 may be used to compile the lexical file and the syntax file based on a preset compilation tool to generate a syntax analyzer in the specific domain scenario.

[0166] In an exemplary embodiment of the present disclosure, the original scene indicator includes multiple types of date symbols, string symbols, number symbols, relational operation symbols, conventional operation symbols, comparison symbols, bracket symbols, and segmentation symbols;

[0167] The abstract processing module 1510 may also be configured to: abstract the date symbol to obtain a first lexical symbol corresponding to the date symbol; and / or abstract the string symbol to obtain a second lexical symbol corresponding to the string symbol; and / or abstract the numeric symbol to obtain a third lexical symbol corresponding to the numeric symbol; and / or abstract the relational operator to obtain a fourth lexical symbol corresponding to the relational operator; and / or abstract the conventional operator to obtain a fourth lexical symbol corresponding to the conventional operator. The fifth lexical symbol; and / or abstracting the comparison symbol to obtain a sixth lexical symbol corresponding to the comparison symbol; and / or abstracting the bracket symbol to obtain a seventh lexical symbol corresponding to the bracket symbol; and / or abstracting the separation symbol to obtain an eighth lexical symbol corresponding to the separation symbol; constructing a lexical file in the specific domain scenario according to the first lexical symbol and / or the second lexical symbol and / or the third lexical symbol and / or the fourth lexical symbol and / or the fifth lexical symbol and / or the sixth lexical symbol and / or the seventh lexical symbol and / or the eighth lexical symbol.

[0168] In an exemplary embodiment of the present disclosure, the lexical symbol assembly module 1520 can also be configured to: assemble the first lexical symbol and / or the second lexical symbol and / or the third lexical symbol and / or the fourth lexical symbol and / or the fifth lexical symbol and / or the sixth lexical symbol and / or the seventh lexical symbol and / or the eighth lexical symbol to obtain one or more expressions with a first calculation level; assemble the first expression and the first lexical symbol and / or the second lexical symbol and / or the third lexical symbol and / or the fourth lexical symbol and / or the fifth lexical symbol and / or the sixth lexical symbol and / or the seventh lexical symbol and / or the eighth lexical symbol to obtain one or more expressions with a second calculation level; repeat the calculation process of the expression with the second calculation level in sequence to obtain one or more expressions with other calculation levels; and construct a grammar file in the specific domain scenario according to one or more expressions with the first calculation level and / or one or more expressions with the second calculation level and / or one or more expressions with other calculation levels.

[0169] In an exemplary embodiment of the present disclosure, the syntax analyzer generation module 1530 can also be configured to: identify the lexical symbols included in the syntax file and the expressions composed of the lexical symbols based on the preset compilation tool, and identify the logical relationship between each of the expressions; wherein the logical relationship includes a nested logical relationship and / or a logical relationship with the same calculation priority; generate a syntax tree file according to the expression and the logical relationship between each of the expressions, and compile the syntax tree file based on the preset mutation tool to obtain the syntax analyzer in the specific domain scenario.

[0170] In an exemplary embodiment of the present disclosure, the generating device of the syntax analyzer may further include:

[0171] The logic filling module can be used to configure a syntax tree monitoring interface for each syntax file included in the syntax analyzer, and fill the calling logic and / or data processing logic corresponding to the syntax file in the syntax tree monitoring interface.

[0172] In an exemplary embodiment of the present disclosure, the generating device of the syntax analyzer may further include:

[0173] The user display interface generation module can be used to generate a user display interface corresponding to the specific domain scene according to the original scene indicators in the specific domain scene and the syntax analyzer, and display the user display interface.

[0174] In an exemplary embodiment of the present disclosure, the generating device of the syntax analyzer may further include:

[0175] A scene indicator updating module, which can be used to update the original scene indicator in response to a configuration operation on the original scene indicator included in the user display interface;

[0176] Wherein, updating the original scene indicator includes at least one of adding, deleting and modifying the original scene indicator.

[0177] The exemplary embodiment of the present disclosure also provides a data processing device. Specifically, refer to Fig.16 As shown, the data processing device may include a syntax parsing module 1610, a syntax tree generating module 1620 and a structured query language executing module 1630. Among them:

[0178] The syntax parsing module 1610 may be used to obtain data to be processed, and perform syntax analysis on the data to be processed based on a preset syntax analyzer to obtain expressions to be processed included in the data to be processed and logical relationships between the expressions to be processed; wherein the syntax analyzer is generated by any of the syntax analyzer generation methods described above;

[0179] The syntax tree generation module 1620 may be used to generate a syntax tree to be processed based on the expressions to be processed and the logical relationship between the expressions to be processed;

[0180] The structured query language execution module 1630 may be used to convert the syntax tree to be processed into a structured query language, execute the structured query language, and obtain a data processing result corresponding to the data to be processed.

[0181] The specific details of each module in the above-mentioned syntax analyzer generation device and data processing device have been described in detail in the corresponding syntax analyzer generation method and data processing method, so they will not be repeated here.

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

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

[0184] In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.

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

[0186] Refer to the following Fig.171700 according to this embodiment of the present disclosure is described. Fig.17 The electronic device 1700 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0187] like Fig.17 As shown, the electronic device 1700 is in the form of a general computing device. The components of the electronic device 1700 may include, but are not limited to: the at least one processing unit 1710, the at least one storage unit 1720, a bus 1730 connecting different system components (including the storage unit 1720 and the processing unit 1710), and a display unit 1740.

[0188] The storage unit stores a program code, which can be executed by the processing unit 1710, so that the processing unit 1710 performs the steps described in the "Exemplary Method" section of the present specification according to various exemplary embodiments of the present disclosure. For example, the processing unit 1710 can perform the following steps: Figure 1 Step S110 shown in: obtaining original scene indicators in a specific domain scenario, and abstracting the original scene indicators to obtain a lexical file in the specific domain scenario; step S120: assembling lexical symbols included in the lexical file to obtain a grammar file in the specific domain scenario; step S130: compiling the lexical file and the grammar file based on a preset compilation tool to generate a grammar analyzer in the specific domain scenario.

[0189] For another example, the processing unit 1710 may execute the following Fig.14 Step S1410 shown in: obtaining data to be processed, and performing syntax analysis on the data to be processed based on a preset syntax analyzer to obtain expressions to be processed included in the data to be processed and logical relationships between the expressions to be processed; wherein the syntax analyzer is generated by a syntax analyzer generation method described in any one of the above; step S1420: generating a syntax tree to be processed based on the expressions to be processed and the logical relationships between the expressions to be processed; step S1430: converting the syntax tree to be processed into a structured query language, executing the structured query language, and obtaining a data processing result corresponding to the data to be processed.

[0190] The storage unit 1720 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 17201 and / or a cache storage unit 17202 , and may further include a read-only storage unit (ROM) 17203 .

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

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

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

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

[0195] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present disclosure may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary implementations of the present disclosure described in the above "Exemplary Method" section of the present specification.

[0196] According to the program product for implementing the above method in the embodiment of the present disclosure, it can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.

[0197] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

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

[0199] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

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

[0201] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.

[0202] Other embodiments of the present disclosure will be readily apparent to those skilled in the art after considering the specification and practicing the inventions invented herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not invented by the present disclosure. The specification and examples are to be considered merely exemplary, and the true scope and spirit of the present disclosure are indicated by the claims.

Claims

1. A method for generating a grammar analyzer, characterized in that: include: Obtaining original scene indicators in a specific domain scenario, and abstracting the original scene indicators to obtain a lexical file in the specific domain scenario; wherein the specific domain scenario includes an e-commerce scenario or a payment scenario; Assembling the lexical symbols included in the lexical file to obtain a grammar file in the specific domain scenario, including: assembling the first lexical symbol and / or the second lexical symbol and / or the third lexical symbol and / or the fourth lexical symbol and / or the fifth lexical symbol and / or the sixth lexical symbol and / or the seventh lexical symbol and / or the eighth lexical symbol to obtain one or more expressions with a first calculation level; assembling the expressions with the first calculation level and the first lexical symbol and / or the second lexical symbol and / or the third lexical symbol and / or the fourth lexical symbol and / or the fifth lexical symbol and / or the sixth lexical symbol and / or the seventh lexical symbol and / or the eighth lexical symbol to obtain one or more expressions with a second calculation level; repeating the calculation process of the expressions with the second calculation level in sequence to obtain one or more expressions with other calculation levels; constructing the grammar file in the specific domain scenario according to the one or more expressions with the first calculation level and / or one or more expressions with the second calculation level and / or one or more expressions with other calculation levels; The lexical file and the grammar file are compiled based on a preset compilation tool to generate a grammar analyzer in the specific domain scenario, including: identifying the lexical symbols included in the grammar file and the expressions composed of the lexical symbols based on the preset compilation tool, and identifying the logical relationship between each of the expressions; wherein the logical relationship includes a nested logical relationship and / or a logical relationship with the same calculation priority; generating a grammar tree file according to the expression and the logical relationship between each of the expressions, and compiling the grammar tree file based on the preset compilation tool to obtain the grammar analyzer in the specific domain scenario.

2. The method for generating a grammar analyzer according to claim 1, characterized in that: The original scene indicators include multiple symbols of date symbols, string symbols, number symbols, relational operation symbols, conventional operation symbols, comparison symbols, bracket symbols and segmentation symbols; The original scene indicators are abstracted to obtain the lexical files in the specific domain scene, including: Abstracting the date symbol to obtain a first lexical symbol corresponding to the date symbol; and / or Abstracting the string symbol to obtain a second lexical symbol corresponding to the string symbol; and / or Abstracting the digital symbol to obtain a third lexical symbol corresponding to the digital symbol; and / or Abstracting the relational operator symbol to obtain a fourth lexical symbol corresponding to the relational operator symbol; and / or Abstracting the conventional operation symbol to obtain a fifth lexical symbol corresponding to the conventional operation symbol; and / or Abstracting the comparison symbol to obtain a sixth lexical symbol corresponding to the comparison symbol; and / or Performing abstract processing on the bracket symbol to obtain a seventh lexical symbol corresponding to the bracket symbol; and / or Abstracting the segmentation symbol to obtain an eighth lexical symbol corresponding to the segmentation symbol; According to the first lexical symbol and / or the second lexical symbol and / or the third lexical symbol and / or the fourth lexical symbol and / or the fifth lexical symbol and / or the sixth lexical symbol and / or the seventh lexical symbol and / or the eighth lexical symbol, a lexical file in the specific domain scenario is constructed.

3. The method for generating a grammar analyzer according to claim 1, characterized in that: The generation method of the grammar analyzer also includes: A syntax tree monitoring interface is configured for each syntax file included in the syntax analyzer, and the syntax tree monitoring interface is filled with calling logic and / or data processing logic corresponding to the syntax file.

4. The method for generating a grammar analyzer according to claim 1, characterized in that: The generation method of the grammar analyzer also includes: According to the original scene index in the specific domain scene and the syntax analyzer, a user display interface corresponding to the specific domain scene is generated, and the user display interface is displayed.

5. The method for generating a grammar analyzer according to claim 4, characterized in that: The generation method of the grammar analyzer also includes: In response to a configuration operation on an original scene indicator included in the user display interface, updating the original scene indicator; Wherein, updating the original scene indicator includes at least one of adding, deleting and modifying the original scene indicator.

6. A data processing method, characterized in that: include: Acquire data to be processed, and perform syntax analysis on the data to be processed based on a preset syntax analyzer to obtain expressions to be processed included in the data to be processed and logical relationships between the expressions to be processed; wherein the syntax analyzer is generated by the syntax analyzer generation method according to any one of claims 1 to 5; Generate a syntax tree to be processed based on the expressions to be processed and the logical relationship between the expressions to be processed; The syntax tree to be processed is converted into a structured query language, and the structured query language is executed to obtain a data processing result corresponding to the data to be processed.

7. A device for generating a grammar analyzer, characterized in that: include: An abstract processing module is used to obtain original scene indicators in a specific domain scenario, and perform abstract processing on the original scene indicators to obtain a lexical file in the specific domain scenario; wherein the specific domain scenario includes an e-commerce scenario or a payment scenario; A lexical symbol assembly module, used for assembling the lexical symbols included in the lexical file to obtain a grammar file in the specific domain scenario, including: assembling the first lexical symbol and / or the second lexical symbol and / or the third lexical symbol and / or the fourth lexical symbol and / or the fifth lexical symbol and / or the sixth lexical symbol and / or the seventh lexical symbol and / or the eighth lexical symbol to obtain one or more expressions with a first calculation level; assembling the expressions with the first calculation level and the first lexical symbol and / or the second lexical symbol and / or the third lexical symbol and / or the fourth lexical symbol and / or the fifth lexical symbol and / or the sixth lexical symbol and / or the seventh lexical symbol and / or the eighth lexical symbol to obtain one or more expressions with a second calculation level; repeating the calculation process of the expressions with the second calculation level in sequence to obtain one or more expressions with other calculation levels; constructing the grammar file in the specific domain scenario according to the one or more expressions with the first calculation level and / or one or more expressions with the second calculation level and / or one or more expressions with other calculation levels; A syntax analyzer generation module, used to compile the lexical file and the grammar file based on a preset compilation tool to generate a syntax analyzer in the specific domain scenario, including: identifying the lexical symbols included in the grammar file and the expressions composed of the lexical symbols based on the preset compilation tool, and identifying the logical relationship between each of the expressions; wherein the logical relationship includes a nested logical relationship and / or a logical relationship with the same calculation priority; generating a syntax tree file according to the expression and the logical relationship between each of the expressions, and compiling the syntax tree file based on the preset compilation tool to obtain the syntax analyzer in the specific domain scenario.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for generating a syntax analyzer according to any one of claims 1 to 5 and the data processing method according to claim 6 are implemented.

9. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to execute the syntax analyzer generation method according to any one of claims 1 to 5 and the data processing method according to claim 6 by executing the executable instructions.