RulesNLP

Natural Lanaguage Parsing/Processing (NLP) is obviously useful in the context of business rules.

 

Rules are typically domain specific, hence you can usually distil a grammar (or vocabulary) to describe the rules in a non ambiguous way. You may then want to be able to have the rules physically represented in this restricted language.

This can be done mainly 2 ways, either templating (like the current DSL features) or via more free form sentence structure parsing - this latter is the "true" although less practical form of NLP.

 

This page talks about future directions and design ideas for Natural Language in rules.

 

Templating

The current DSL feature (as of version 3.x) provides some value in building simple grammars for expression rules in a natural language.

This is still quite basic, and a simple form of templating.

 

Michael spent some time on holidays thinking about this:

 

Some immediate enhancement options (a subset of the long term vision, perhaps):

 

 

Rule templates

  • We may have rule templates (for rule archetypes of WHOLE RULES) in the repository if needed.

 

Freeform natural language parsing

See Standford NLP group for the state of the art English language parsing.

 

Downside: very very hard for i18n - techniques are often bound tightly to a specific human language.

 

It is possible (and reasonably easy) to provide the ability to express contraints as freeform text, using sentence analysis given known operators and fields, and precedence, but this would be English centric.

For example:

 

age is less then than 42

The person's height is greater than the cutoff

 

Future directions

The above can be easily parsed with knowledge of the domain: fields(age, height), context (a field constraint, or a column constraint) and known operators relevant for the given fields (greater than, less than). Using this knowledge, we can scan the text and work out the expression (if there is any ambiguity then we raise an error). At this stage, I am not sure how useful this is, I have made it work, but have no real world use cases for this as yet - my opinion is that it is more useful to at least provide the option of guided editors (DSLs, decision tables) and a plain text view, rather then just free text on its own.

 

One interesting sub project may be to integrate with standfords NLP technology (which is available in Java). However, as standanfords software is GPL, the resultant system would have to be GPL licenced - nevertheless, working with the English pseudo-ast would be a useful technology proof (ie take the english AST - and map it to rule constructs like constraints, and actions - based on a limited list of actions and constraints).

 

Quick rule-add feature

Anyone who is a fan of Google calendar (as I am) may know of the "Quick add" feature. Basically with this option, you pop up a little line entry field, and type in a future appointment in plain text. The calendar then (server side) parses this request as best it can, and pops it in the calendar (and shows the entry to the user, where they can correct any misunderstandings). The equivalent with rules would be similar, where someone can type in a constraint (or a rule) and a rule will be created as best it can, and shown (whence they can correct it) - a good way of coaching people to enter rules (from then on they maintain the rule using the usual UI).

 

Referenced by: