#369 Decoder returns result that does not match JSGF grammar

next release
open
nobody
None
1
2014-08-15
2014-01-22
Agi Lim
No

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.

JSGF V1.0;

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!

Discussion