Digit Grammar Literals

The digit grammar literal is always of type Grammar.

DigitGrammar:
DigitGrammarDeclarator [ComplexLiteralInputChars]
DigitGrammarDeclarator [Expression]
DigitGrammarDeclarator:
any case of DG
Digit grammar literals are used to represent a grammar that contains solely digits to be recognized. Its format is similar to the Digit File Grammar format where each entry is separate with a | character. Each entry is defined as key=value or key where the keys are defined as dtmf-x. Where x is from the set 0123456789*#ABCD or be one of star or pound and values would be the corresponding tag to be returned when key is pressed or recognized. An optional entry defined as word=true can be used to identify that the word representation of each DTMF digit must be automatically included during a recognition:
  • If the sequence of characters can be parsed as an Expression of type String, java.io.File or java.util.Properties, then the resulting grammar is a digit grammar where the expression specifies the inline content of the grammar, the filename where to retrieve the grammar or a properties object where the keys are expected to be defined as dtmf-x and the values would be the corresponding tag to be returned when the key is pressed or recognized.

  • If the sequence of characters cannot be parsed properly as described above, then it is considered to be the inline content of the digit grammar.

Example Digit Grammar Literals:
DG[digit-1=yes|digit-2=no]
DG[word=true|digit-star=cancel]
DG["digit-1=" + tag1 + "|digit-2=" + tag2]
DG[new java.io.File(u"C:\\myGrammar.digit")]