CN111913692A - Billing engine based on natural language design - Google Patents

Billing engine based on natural language design Download PDF

Info

Publication number
CN111913692A
CN111913692A CN202010638765.3A CN202010638765A CN111913692A CN 111913692 A CN111913692 A CN 111913692A CN 202010638765 A CN202010638765 A CN 202010638765A CN 111913692 A CN111913692 A CN 111913692A
Authority
CN
China
Prior art keywords
language
charging
rule
natural language
operator
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010638765.3A
Other languages
Chinese (zh)
Inventor
彭源林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Hanzhi Software Co ltd
Original Assignee
Guangzhou Hanzhi Software Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Hanzhi Software Co ltd filed Critical Guangzhou Hanzhi Software Co ltd
Priority to CN202010638765.3A priority Critical patent/CN111913692A/en
Publication of CN111913692A publication Critical patent/CN111913692A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Abstract

The invention discloses a billing engine based on natural language design, which comprises: the rule configuration file is used for customizing the rules of the natural language; the user-defined grammar convention is used for analyzing rule configuration and providing an analysis specification; the dynamic language template is used for combining the built-in operator, the extended operator and the regular language to carry out charging operation and returning a result; the user-defined operator is used for an expansion operator definition unit of the charging engine and is responsible for expansion aiming at different charging requirements; the ANTLR parser automatically generates a syntax tree according to input and displays the syntax tree visually; and the dynamic language compiler is used for converting the language script into java byte codes, loading the converted java byte codes into a JVM virtual machine through a java class loader for execution, completing the charging rule defined by the natural language, converting the converted java byte codes into the language script through an ANTLR parser, and finally converting the language script into complete conversion of the java byte codes. The invention realizes the customization of the fee calculation rule through the natural language.

Description

Billing engine based on natural language design
Technical Field
The invention relates to the technical field of packet service charging, in particular to a charging engine based on natural language design.
Background
Most of the billing engines on the market are developed and used mainly in telecommunication billing service, logistics management software and supply chain management software, and in the economic activities such as property charging. To solve this problem, a set of rule engines is generally developed to adapt to the rule customization of various complex scenarios. The charging engine can be specifically interpreted as that various charging rules and charging types are defined by the enterprise information management software according to the characteristics of the enterprise, so that the system automatically extracts the charge value meeting the service charging requirement, and the automatic charging function is realized.
Various complex and diversified service charging rules are customized through the rule charging engine, and the specific complex charging rules are combined, so that the comprehensive control of data processing in enterprise operation activities is realized, the control and management capability of the whole operation activities is comprehensively coordinated, the simplicity, visualization, integration and standardization of charging are realized, and the standardized charging management is achieved. However, as the business rules become more and more complex as the business develops, the definition of the rules becomes complex, and in order to simplify the operation steps of the user and lower the usage threshold of the user, a billing engine capable of performing billing according to natural language matching is required.
Disclosure of Invention
The invention aims to provide a charging engine designed based on natural language, which can realize the classified charging of services through natural language.
In order to achieve the purpose, the invention provides the following technical scheme:
the invention provides a billing engine based on natural language design, which comprises: the rule configuration file is used for a client system administrator, project implementation, developer and other related personnel to perform simple rule customization of natural language; the rule configurator is provided to cover the rule base and the expansion base of the industry, can be directly used for configuration at any time, and can finish the customization of the charging rule by a simple dragging operation mode.
And the self-defined grammar convention is used for analyzing rule configuration, providing standard analysis specifications and analyzing by ANTLR.
And the dynamic language template is used for a standard interface and an operation processing unit of the charging engine, combines the built-in operator, the extended operator and the rule language together to perform charging operation, and returns a result.
The user-defined operator is used for an expansion operator definition unit of the charging engine and is responsible for the expansion aiming at different charging requirements, and the format of the user-defined operator follows the grammar convention of the dynamic language;
the ANTLR parser automatically generates a syntax tree according to input and displays the syntax tree visually; providing a framework for automatically constructing a recognizer, a compiler and an interpreter translator of a custom language through syntax description for languages including Java, C + +, C #;
the language compiler is used for converting the language script into java byte codes; and loading the converted java bytecode into a JVM virtual machine through a java class loader for execution, thereby completing the charging rule defined by the natural language, converting the charging rule into a language script through an ANTLR parser, and finally converting the charging rule into complete conversion of the java bytecode.
A method for implementing a billing engine based on natural language design comprises the following steps:
s1, establishing a natural language rule base which comprises rule configuration files, custom grammar conventions and custom operators, is used for defining charging rules used by clients or property charging systems, telecommunication charging systems and transportation charging systems and describing operation criteria for different charges;
s2, setting a billing problem corresponding to the natural language rule base, calling a program or basic problem parameters set by an external system aiming at the rule, then delivering the basic problem parameters into a billing engine, and identifying and calculating by the billing engine;
s3, converting a charging rule definition file and a charging problem in a charging engine into a dynamic language syntactic structure code, compiling the dynamic language syntactic structure code into a Byte identified by a JVM (virtual machine) through a language compiler, and calculating according to rules through a definition value of a charging element to obtain a final charge result;
and S4, calculating and outputting the result by the arithmetic unit.
Further, the dynamic language adopts a Groovy language; the language compiler employs a Groovy script.
Further, the grammar convention includes a name operator for defining a name of a certain class of transformations; variables for intermediate variable definition, macro definition variables for effective identification functions in rules, and sub-function definitions for defining function names; the sub-function definition comprises a function name, parameters and a function execution body, is consistent with the function definition in the programming language, and has a return type of Map.
Further, the variables include general variables and local variables; the common variable is a return variable and refers to variable name definition on the left side of a middle number in rule configuration; local variables: refers to the variable name definition with the $ symbol to the left of the medium number in the rule configuration.
Compared with the prior art:
in order to solve the problem that the terminal user defined by the charging rule can conveniently customize the charging rules of various complex scenes; the invention adopts an industry module billing engine design based on natural language configuration; natural language is translated into computer language, which is used as a bridge for language translation through middleware or other tools. In the Java ecology, the over-normalization of Java syntax has resulted in many scripting languages, such as Groovy, JRbuy, and canister, where Groovy is relatively close to the original Java syntax specification and has the characteristics of most weak languages, which can conveniently convert the rules described in the natural language into the syntax specification descriptions that can be recognized by the Java compiler.
The syntax to be translated into Groovy for the rules defined in the natural language is also analyzed by the parser. Lexical analysis is a process in computer science that converts a sequence of characters into a sequence of words, Token. The program or function for Lexical analysis is called Lexical analyzer, which exists in the form of function and is called by grammar analyzer. Aiming at the domain tools of lexical and grammatical analysis, the open-source ANTLR is used for defining grammar rules to analyze natural languages, receiving word and language descriptions is achieved, and sentences for recognizing the languages can be generated.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a block diagram of a billing engine designed based on natural language in accordance with the present invention;
FIG. 2 is a diagram of a billing framework for a billing engine designed based on natural language in accordance with the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be described in detail below. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the examples given herein without any inventive step, are within the scope of the present invention.
Referring to fig. 1, the present invention provides a billing engine designed based on natural language, including:
the rule configuration file is used for a client system administrator, project implementation, developer and other related personnel to perform simple rule customization of natural language; the rule configurator is provided to cover the rule base and the expansion base of the industry, can be directly used for configuration at any time, and can finish the customization of the charging rule by a simple dragging operation mode.
And the self-defined grammar convention is used for analyzing rule configuration, providing standard analysis specifications and analyzing by ANTLR.
And the dynamic language template is used for a standard interface and an operation processing unit of the charging engine, combines the built-in operator, the extended operator and the rule language together to perform charging operation, and returns a result.
The user-defined operator is used for an expansion operator definition unit of the charging engine and is responsible for the expansion aiming at different charging requirements, and the format of the user-defined operator follows the grammar convention of the dynamic language;
the ANTLR parser automatically generates a syntax tree according to input and displays the syntax tree visually; providing a framework for automatically constructing a recognizer, a compiler and an interpreter translator of a custom language through syntax description for languages including Java, C + +, C #;
the language compiler is used for converting the language script into java byte codes; and loading the converted java bytecode into a JVM virtual machine through a java class loader for execution, thereby completing the charging rule defined by the natural language, converting the charging rule into a language script through an ANTLR parser, and finally converting the charging rule into complete conversion of the java bytecode.
Referring to fig. 2, an implementation method of a billing engine based on natural language design, based on the billing engine based on natural language design, includes the following steps:
step 1, establishing a natural language rule base, wherein the natural language rule base comprises rule configuration files, custom grammar conventions and custom operators, is used for defining charging rules used by customers or comprising a property charging system, a telecommunication charging system and a transportation charging system, and describes operation criteria aiming at different fees;
such as: property public facility insurance fee (insurance rate x total amount of insurance) and total area of insurance benefited property;
step 2, setting a billing problem corresponding to the natural language rule base, calling a program or basic problem parameters set by an external system aiming at the rule, then transferring the parameters into a billing engine, and identifying and calculating by the billing engine;
such as: total amount of insurances-a factor value that represents the transfer of an external system to the billing engine.
Premium rate-means the result is obtained by looking up a rate table.
Step 3, converting a charging rule definition file and a charging problem in a charging engine into a Groovy syntax structure code, compiling the charging rule definition file and the charging problem into Byte bytes recognized by a JVM virtual machine through a Groovy C compiler, and calculating according to rules to obtain a final charge result through a definition value of a charging element;
and 4, calculating by an arithmetic unit to obtain and output a result.
Further, the dynamic language adopts a Groovy language; the language compiler employs a Groovy script.
Further, the grammar convention includes a name operator for defining a name of a certain type of transformation, such as: area number-directly using the parameter value introduced in a certain charging problem;
variables for intermediate variable definition, such as: the cost of the greening tool-means that the cost of the greening tool is not returned to an external system;
macro definition variables for the active identification function in the rule, such as: the # insurance rate is the lookup ('elevator insurance rate', floor name) × coefficient;
the definition of a sub-function used to define a function name, such as: search for minimum shipping charge (consignor, carrier, mileage)
The freight rate is the lookup ('freight rate', consignor, carrier) × mileage
The minimum freight rate is the minimum (scalar, $ freight rate)
}
The sub-function definition comprises a function name, parameters and a function execution body, is consistent with the function definition in the programming language, and has a return type of Map.
Further, the variables include general variables and local variables; the common variable is a return variable and refers to variable name definition on the left side of a middle number in rule configuration; local variables: refers to the variable name definition with the $ symbol to the left of the medium number in the rule configuration. The scope of the common variable is used in the current statement; the scope of the local variable is valid in the statement block; such as a conditional statement body or a subfunction body of a loop statement body.
Embodiment operators predetermined, basic types of operations support:
arithmetic operator:
+、-、*、/、%、^。
the logical operator:
a name of >! And (& &), or (|),! .
The built-in function convention is as follows:
max/min function: max (number 1, number 2), min (number 1, number 2)
Summation function: summation (set, attribute value)
And searching a function: find (set)
Rounding function (in precision): rounding (numbers, digits); rounding off (integers)
Tail-rounding function: tail rounding (numbers);
carry rounding function: carry rounding (numbers);
date function: year (), month (), day ().
String function:
position-specifying character (character string, index)
Intercepting character string from left (character string, index)
Intercepting character string from right (character string, index)
String length (string).
Assignment statement:
the name of the expense result is an expense calculation expression;
utility premiums (look-up ('premium rate', utility number) total amount of money to be covered)/total area of insurance beneficiary;
where the lookup ('premium rate', utility number) is a lookup operator. The total amount of the application insurance is a nominal operator, and the value is transmitted through the parameter.
Each assignment statement generates a charging result item, the left part of the assignment statement is the name of the result item, and the calculation result of the expression at the right part is the numerical value of the result item.
Conditional statements:
defining: if (conditional expression) last
Sentence
}
Example (b): if (consignor ═ XX logistics company) and acceptor ═ driver', chinese curl
Freight calculation rule
}
Conditional expressions are necessarily inclusive of parenthesis and are certainly logical expressions, while statements in the statement body may be arbitrary statements, supporting statement nesting.
3. Loop statements
Defining: each of the last
Sentence
}
Example (b): order detail of each opening
Freight rate (customer rate) order detail (mileage)
}
The loop statement is used for sequentially processing the detail or the multiple details in each charging problem item, and the above example shows that the records in the order details in the charging problem are charged one by one to generate multiple charging results, that is, each detail is charged individually.
Note the convention:
the engine can support two annotation conventions, which are respectively:
// example code
-% -example code
Operator combination
The operators are the smallest processing units in the billing engine, and each operator is an independent billing block. The billing engine is formed by combining and nesting the units together and processing the billing of the problem according to the basic statement specification.
And (3) combining operators:
freight-mileage x lookup ('freight rate', carrier, consignor)
Description of the drawings: the above is the combined use of the search operator and the call operator.
Operator nesting use:
example (c): lookup ("freight rate", carrier, consignor, max (scalar, mileage))
Description of the drawings: the above is the nested use of operators.
In summary, in order to enable the terminal user defined by the charging rule to conveniently customize the charging rules of various complex scenes; the invention adopts an industry module billing engine design based on natural language configuration; the natural language is translated into the computer language, and the middleware is used as a bridge for language translation. Groovy is relatively close to the original Java grammar specification and has the characteristics of most weak languages, and can conveniently convert the rules described by a natural language into the grammar specification description which can be recognized by a Java compiler.
The syntax to be translated into Groovy for the rules defined in the natural language is also analyzed by the parser. Lexical analysis is a process in computer science that converts a sequence of characters into a sequence of words, Token. The program or function for Lexical analysis is called Lexical analyzer, which exists in the form of function and is called by grammar analyzer. Aiming at the domain tools of lexical and grammatical analysis, the open-source ANTLR is used for defining grammar rules to analyze natural languages, receiving word and language descriptions is achieved, and sentences for recognizing the languages can be generated.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (5)

1. A billing engine designed based on natural language, comprising: the rule configuration file is used for a client system administrator, project implementation, developer and other related personnel to perform simple rule customization of natural language;
self-defining grammar convention for analyzing rule configuration, providing standard analysis specification, and analyzing by ANTLR;
the dynamic language template is used for a standard interface and an operation processing unit of the charging engine, combines the built-in operator, the extended operator and the regular language together to perform charging operation, and returns a result;
the user-defined operator is used for an expansion operator definition unit of the charging engine and is responsible for the expansion aiming at different charging requirements, and the format of the user-defined operator follows the grammar convention of the dynamic language;
the ANTLR parser automatically generates a syntax tree according to input and displays the syntax tree visually; providing a framework for automatically constructing a recognizer, a compiler and an interpreter translator of a custom language through syntax description for languages including Java, C + +, and C #;
the language compiler is used for converting the language script into java byte codes; and loading the converted java bytecode into a JVM virtual machine through a java class loader for execution, thereby completing the charging rule defined by the natural language, converting the charging rule into a language script through an ANTLR parser, and finally converting the charging rule into complete conversion of the java bytecode.
2. A method for implementing a billing engine based on natural language design, based on the billing engine based on natural language design of claim 1, comprising:
s1, establishing a natural language rule base, wherein the natural language rule base comprises rule configuration files, custom grammar conventions and custom operators, is used for defining charging rules used by clients or external systems and describing operation criteria aiming at different fees;
s2, setting a billing problem corresponding to the natural language rule base, calling a program or basic problem parameters set by an external system aiming at the rule, then delivering the basic problem parameters into a billing engine, and identifying and calculating by the billing engine;
s3, converting a charging rule definition file and a charging problem in a charging engine into a dynamic language syntactic structure code, compiling the dynamic language syntactic structure code into a Byte identified by a JVM (virtual machine) through a language compiler, and calculating according to rules through a definition value of a charging element to obtain a final charge result;
and S4, calculating and outputting the result by the arithmetic unit.
3. The method of a natural language based billing engine according to claim 1 or 2, wherein the dynamic language is Groovy language; the language compiler employs a Groovy script.
4. The method of claim 3, wherein the grammar convention includes nominal operator, variable, macro definition variable, and subfunction definition.
5. The method of claim 4, wherein the variables include common variables and local variables.
CN202010638765.3A 2020-07-03 2020-07-03 Billing engine based on natural language design Pending CN111913692A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010638765.3A CN111913692A (en) 2020-07-03 2020-07-03 Billing engine based on natural language design

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010638765.3A CN111913692A (en) 2020-07-03 2020-07-03 Billing engine based on natural language design

Publications (1)

Publication Number Publication Date
CN111913692A true CN111913692A (en) 2020-11-10

Family

ID=73227960

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010638765.3A Pending CN111913692A (en) 2020-07-03 2020-07-03 Billing engine based on natural language design

Country Status (1)

Country Link
CN (1) CN111913692A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113703740A (en) * 2021-09-17 2021-11-26 厦门中盾安信科技有限公司 Method and system for configuring and executing service request command based on service rule

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6915254B1 (en) * 1998-07-30 2005-07-05 A-Life Medical, Inc. Automatically assigning medical codes using natural language processing
CN1809109A (en) * 2006-02-20 2006-07-26 南京联创科技股份有限公司 Service language based preferential rule implementation method
CN102693150A (en) * 2012-05-11 2012-09-26 深圳市华为技术软件有限公司 Processing method and apparatus based on virtual machine of charging special field
CN103777961A (en) * 2014-02-19 2014-05-07 王广英 Mobile application billing software development kit, mobile application and mobile terminal
CN103927174A (en) * 2014-04-17 2014-07-16 北京视博数字电视科技有限公司 Service processing method and device
CN111178927A (en) * 2018-11-11 2020-05-19 千寻位置网络有限公司 Multi-dimension and strategy-based commodity pricing method and system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6915254B1 (en) * 1998-07-30 2005-07-05 A-Life Medical, Inc. Automatically assigning medical codes using natural language processing
CN1809109A (en) * 2006-02-20 2006-07-26 南京联创科技股份有限公司 Service language based preferential rule implementation method
CN102693150A (en) * 2012-05-11 2012-09-26 深圳市华为技术软件有限公司 Processing method and apparatus based on virtual machine of charging special field
CN103777961A (en) * 2014-02-19 2014-05-07 王广英 Mobile application billing software development kit, mobile application and mobile terminal
CN103927174A (en) * 2014-04-17 2014-07-16 北京视博数字电视科技有限公司 Service processing method and device
CN111178927A (en) * 2018-11-11 2020-05-19 千寻位置网络有限公司 Multi-dimension and strategy-based commodity pricing method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
且看且珍惜: "在智能交通系统中基于Drools BRMS实现业务规则动态管理", 《HTTP://WWW.360DOC.COM/CONTENT/14/0416/01/16650130_369336943.SHTML》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113703740A (en) * 2021-09-17 2021-11-26 厦门中盾安信科技有限公司 Method and system for configuring and executing service request command based on service rule

Similar Documents

Publication Publication Date Title
CN107704265B (en) Configurable rule generation method for service flow
CN111708539B (en) Application program code conversion method and device, electronic equipment and storage medium
US7631299B2 (en) System for modifying software using reusable software components
US8196126B2 (en) Methods and systems for dynamically generating and optimizing code for business rules
CN100492290C (en) Method for acquiring and converting the state of component in the time of operation during software dynamic evolvement
US20030158759A1 (en) Method of modifying software by defining business rules
US20030172367A1 (en) Method of modifying software via a network
CN107644323A (en) A kind of intelligent checks system of service-oriented stream
US8849673B2 (en) Rule generation
CN109697050B (en) Demand description model design method facing E-commerce field based on knowledge graph
US20070006134A1 (en) Data processing method compatible with an object modeling formalism
US20120167065A1 (en) Compiler compiler system with syntax-controlled runtime and binary application programming interfaces
US20200364037A1 (en) Code conversion method and system
Cánovas Izquierdo et al. A domain specific language for extracting models in software modernization
Grønmo et al. Comparison of three model transformation languages
CN108153522B (en) Method for generating Spark and Hadoop program codes by midcore based on model conversion
CN111913692A (en) Billing engine based on natural language design
Manaf et al. SBVR2Alloy: an SBVR to alloy compiler
CN113050928A (en) Method, system, equipment and medium for event extension in workflow
Nogueira et al. Application of heuristics in business process models to support software requirements specification
CN116755669A (en) Low code development method and tool based on DSL language operation model
Hinkelmann et al. ArchiMEO: A Standardized Enterprise Ontology based on the ArchiMate Conceptual Model.
CN115421782A (en) SDK compatible method applied to iOS terminal, storage device and intelligent terminal
Hruby Ontology-based domain-driven design
CN115145584A (en) Parser generation method, data processing method, medium, and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20201110

RJ01 Rejection of invention patent application after publication