Natural commands

Print Friendly, PDF & Email

◷ Reading Time: 2 minutes

Natural Language commands

An Xml document can represent a Natural Language (NL) document. The following table shows the available commands to model Natural Language using Xml Language.

Natural

Main container of an NL model. This contains all the related elements for Natural Language.

Parameters

name

  1. Description: Sets the name for an NL rule
  2. Mandatory: Yes
  3. Type: String

Internal Commands

DslDeclarationGlossary

Sample

<Natural name="Potential theft rating calculation">
  <Glossary>
    <Term name="Price" expression="car.Price" domain="Numeric" />
    <Term name="Car is listed in HTPA" expression="probList.Contains(car.Made+'-'+car.Model)" domain="Boolean" />
    <Term name="Theft Rating" expression="car.TheftCategory=$value" domain="Options">
      <Option value="High" />
      <Option value="Low" />
      <Option value="Moderate" />
    </Term>
    <Term name="Car is Convertible" expression="car.Convertible" domain="Boolean" />
  </Glossary>
  <Dsl>
 
     given car, probList
 
 
     when  
     	r1 and
     	r2 and
     	r3 and
     	r4 and
     	r5
     end	
 
 
     when r1
     	Car is Convertible 
     then
     	Theft Rating is High
     end
 
 
     when r2
     	Car is listed in HTPA and
     	Price ge 45000 
 
     then
     	Theft Rating is High
     end
 
 
     when r3
     	Car is listed in HTPA
     then
     	Theft Rating is High
     end
 
 
     when r4
     	Car is listed in HTPA is  false and
     	Price is [20000;45000]
     then 
     	Theft Rating is Low
     end
 
 
     when r5
     	Car is not listed in HTPA and
     	Price < 20000
     then
     	Theft Rating is low
     end
 
 
     when Car is not listed in HTPA
     	Car is listed in HTPA is false
     end
 
</Dsl>
</Natural>

Declaration

Summary

This section is a container for the referencing types and defining parameters in all logic (e.g., Procedural, Flow, Validation, etc.).

Parameters

This command has no parameters.

Internal Commands

This command requires Define in its scope.

Sample

<Declaration>
   <Define name="minAge" value="18i" direction="local" />
</Declaration>

Glossary

A glossary is a dictionary that defines all of the business terms and their domains.

View signature

Dsl

The Dsl element contains the actual rule body in the Natural Language format.

Summary

This section in an Natural Language document provides the actual rules and logic in Natural Language format as a text body of the element.

Parameters

This command has no parameters.

Internal Commands
Sample

<Dsl>
    when r5
	Car is not listed in HTPA and
	Price le 20000
    then
	Theft Rating is low
    end
 
    when Car is not listed in HTPA
	Car is listed in HTPA is false
    end
</Dsl>

View signature | View Natural Language

Updated on July 31, 2019

Was this article helpful?

Related Articles