基于语法规则的中文语法纠错_流口水:规则语法

基于语法规则的中文语法纠错

The Drools Rule Resource(DRL) has a different syntax and covering the syntax in the below section:

Drools规则资源(DRL)具有不同的语法,并在以下部分中介绍了该语法:

流口水:规则中的条件 (Drools: Conditions in Rules)

A rule can contain many conditions/patterns:

规则可以包含许多条件/模式:

  • Student(id == 001)

    学生(id == 001)

  • Employee(name == "Vivek")

    员工(姓名==“ Vivek”)

The above conditions checks if Student id is 1 and the Employee name is Vivek.

以上条件检查Student id是否为1以及Employee名称是否为Vivek

流口水:规则可变 (Drools: Variable in Rules)

A variable name in Drools starts with a $ dollar symbol.

Drools中的变量名以$符号开头。

$student : Student()

$student is the variable for Student() class.

$studentStudent()类的变量。

This is similar to Student student = new Student() in java. Drools can work with all the native Java types and even Enum.

这类似于Java中的Student student = new Student() 。 Drools可以使用所有本机Java类型甚至Enum

流口水:规则中的注释 (Drools: Comments in Rules)

In Drools 5.x, # or // can be used as a single line comments

在Drools 5.x中, #//可以用作单行注释

For Multi Line comments:

对于多行注释:

/* 
	Another line 
*/

流口水:规则中的功能 (Drools: Functions in Rules)

Functions are a convenience feature. They can be used in conditions and consequences. If there is any modification to be done in the then part of the rule, a normal static java helper function can be called.

功能是一项便利功能。 它们可以用于条件后果 。 如果在规则的第二部分中要进行任何修改,则可以调用普通的静态java帮助器函数。

function double calculateAreaofSquare(double value) 
{ 
    return value * value; 
}

流口水:方言 (Drools: Dialect)

Dialect specifies the syntax used in any code expression that is in a condition or a consequence. The default value is Java. Drools currently supports one more dialect called mvel.

方言指定处于条件结果的任何代码表达式中使用的语法。 默认值为JavaDrools当前支持多一个方言叫mvel

The default dialect can be specified at the package level as follows:

可以在包级别指定默认的方言 ,如下所示:

package org.mycompany.somePackage
dialect "mvel"

流口水:MVEL方言 (Drools: MVEL Dialect)

mvel is an expression language for Java-based applications. mvel supports field and method/getter access. It is based on Java syntax.

mvel是用于基于Java的应用程序的一种表达语言。 mvel支持字段和方法/获取器访问。 它基于Java语法。

流口水:无循环属性 (Drools: The no-loop attribute)

This attribute informs the rule engine that a rule should be activated only once per matched facts. If there is a generic condition in the rule, then this attribute should be used to avoid the infinite loop scenario.

此属性通知规则引擎,每个匹配的事实仅应激活一次规则。 如果规则中存在通用条件,则应使用此属性来避免无限循环情况。

流口水:显着 (Drools: Salience)

Salience is a very important feature of Rule Syntax.

Salience是规则语法的一个非常重要的功能。

It is used by the conflict resolution strategy to decide which rule to fire first.If there are two rules and both have the conditions are met, then salience is used to determine the order of rule firing. It has one attribute, which takes any expression that returns a number of type int (positive as well as negative numbers are valid). The higher the value, the more likely a rule will be picked up by the conflict resolution strategy to fire.

解决冲突的策略使用它来决定首先触发哪条规则。如果有两个规则并且都满足条件,则使用显着性来确定规则触发的顺序。 它具有一个属性,该属性可以接受任何返回整数类型(正数和负数均有效)的表达式。 该值越高,冲突解决策略就会激发一条规则来执行。

salience ($account.balance * 5)
salience 100

The default salience value is 0. We should keep this in mind when assigning salience values to some rules only. There are a lot of other features/parameters in the Rule Syntax but we have covered the important ones.

默认的显着性值为0 。 仅在为某些规则分配显着性值时,应牢记这一点。 规则语法中还有许多其他功能/参数,但我们已经介绍了重要的功能/参数。

翻译自: https://www.studytonight.com/drools/rule-syntax

基于语法规则的中文语法纠错

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值