Hi,
We are using the JSGF to restrict the decoder result within specific syntax. But sometimes decoder final result returns something that is out of grammar. For example, sometimes we receive result like "ALPHA FIVE MENU".
Code snippet for setting up the JSGF:
Jsgf jsgf = new Jsgf(joinPath(appDir, "models/test.gram")); JsgfRule rule = jsgf.getRule("<test.command>"); int lw = config.getInt("-lw"); FsgModel fsg = jsgf.buildFsg(rule, recognizer.getLogmath(), lw); recognizer.setFsg(BankAccountFragment.class.getSimpleName(), fsg); recognizer.setSearch(BankAccountFragment.class.getSimpleName());
Here is the JSGF file.
grammar test;
<alphanum> = ALPHA |
BRAVO |
CHARLIE |
DELTA |
ECHO |
FOXTROT |
GOLF |
HOTEL |
INDIA |
JULIET |
KILO |
LIMA |
MIKE |
NOVEMBER |
OSCAR |
PAPA |
QUEBEC |
ROMEO |
SIERRA |
TANGO |
UNIFORM |
VICTOR |
WHISKEY |
X-RAY |
YANKEE |
ZULU |
ONE |
TWO |
THREE |
FOUR |
FIVE |
SIX |
SEVEN |
EIGHT |
NINE |
ZERO ;
<spell> = <alphanum>+;
<words> = MENU |
CANCEL |
CONFIRM ;
public <command> = <spell> | <words>;
Please let me know if you need more info.
Thanks!