Natural Language

Print Friendly, PDF & Email

◷ Reading Time: 2 minutes

The Natural Language editor is a web component based on JavaScript and HTML DOM which simply allows you to integrate the authoring experience into your web application. You can apply your own style by overriding its CSS configuration.

The NL editor allows you to write business rules and logic in a smart text editor

This smart editor for Natural Language:

  1. Builds colorful text from your rules based on different tokens depending on their types (i.e., values, operators, terms, etc.)
  2. Fully understands and integrates the references Business Glossaries
  3. Understands Logic calling, definition and parameterization
  4. Provides pop-ups to suggest terms, logic and expressions

API

Loading

// Creates a natural language editor
// return: reference to the NL editor
toNaturalLanguage(config)
 
// Load the NL content to editor
// content: string content of the NL in XML format
loadNaturalLanguage(content)
 
 
// Lists references glossaries
// return: an array of string
getGlossaries()

toNaturalLanguage

config is a JSON object that has:

  • size
size

Set the size of NL editor.

toNaturalLanguage(size: { width: 630, height: 500 })

Glossary

// Lists references glossaries
// return: an array of string
getGlossaries()
 
// Loads the glossary into NL editor to apply glossary token coloring logic
// content: string content of a glossary in XML format
loadGlossary(content)

Generate Model

// Generates the XML representation of the Natural Language 
getNaturalLanguage()

Parameters

signature on a web editor gives you the declaration section of a logic. This allows you to manage the value and types parameters of your logic in JavaScript.

var flow = flow.loadFlow(flowXml, flowHelper);
var signature = flow.signature;
// and now you have access to signature of the logic
// ...use properties and methods descried in API section...

API

Properties

// Returns input parameters
inputs
 
// Returns output parameters
outputs
 
// Returns input-output parameters
inputOutputs

Methods

// Adds input parameters
addInputs(names)
 
// Adds output parameters
addOutputs(names)
 
// Adds input-output parameters
addInputOutputs(names)
Updated on July 19, 2019

Was this article helpful?

Related Articles