Reference

Class

RiGrammar

Name

addRule

Description Adds a rule to the existing grammar, replacing any existing rule with the same name
Syntax
addRule(name, ruleStr, weight);
Parameters
Stringthe rule name
Stringthe rule definition
floatthe rule weight (optional, defaults to 1)
Returns
RiGrammarthis RiGrammar
Example
rg = new RiGrammar();
rg.addRule("<start>", "<animal>");
rg.addRule("<animal>", "cat | dog | chicken");
Platform Java / Javascript