abnf2xml

Nuance Recognizer uses the XML grammar format, which is optimal for computers. However, some voice application developers may find it more efficient to write grammars in the ABNF format (encoded as ASCII or Latin-1), and then convert them to XML.

The abnf2xml utility takes grammars that have been written in Augmented Backus-Naur Form (ABNF) and translates them into the SRGS format of XML. The input for this utility is a text file containing a grammar written in ABNF format. The output is a text file containing the XML equivalent. The tool is available for Windows systems only.

The utility is located in: %SWISRSDK%\amd64\bin

ABNF grammars begin with the following lines (substitute the appropriate language code):

language LangCode;
mode speech;

Tip: To see the available command options, enter abnf2xml with no parameters in a DOS command window, in the directory where the tool is installed.

Usage

abnf2xml abnf_filename.abnf [outfilename.grxml]
   [-checkSyntax=ON|OFF]
   [-dtd=dtdname.dtd]
   [-ext=OutFileExtension]
   [-help]
   [-keep]
   [-warnings]

Options

abnf_filename.abnf

Specifies the relative or absolute location of the grammar file to convert.

outfilename.grxml

Specifies a name and location for the output file. By default, the output file will have the same name as the input file, but change the .abnf extension to a .grxml extension. If an output file name is specified, this is used instead.

-checkSyntax=ON|OFF

Determines whether the syntax of ECMAScript code in <tag> elements will be checked. If ON, ECMAScript syntax will be checked. If OFF, ECMAScript syntax will not be checked. If not specified, checking is ON by default.

-dtd=dtdname.dtd

Adds a DOCTYPE tag to the beginning of the converted file, using dtdname.dtd as the DTD file used in the DOCTYPE tag. If no file is specified, the DOCTYPE tag is not produced in the output file.

-ext=OutFileExtension

Specifies an alternative extension for the output file. By default the output file will have the same name and location as the input file but end in a .grxml extension, unless an output file name is specified or the -ext option is used. An extension specified with -ext overrides any extension specified for the outfile name (for example, outfile.grxml becomes outfile.OutFileExtension).

-help

Displays a help message summarizing the abnf2xml utility and how to use it.

-k[eep]

Keeps the output file even if there are errors during the conversion. By default, when there are errors the output file is deleted.

-warnings

Displays warnings in the error file. By default, warnings do not appear in the error file unless you use this option.

Examples

abnf2xml -warnings input.abnf output.grxml

The abnf2xml utility takes the input.abnf file and converts it to an XML file named output.grxml. This new file contains any warnings that were generated during the conversion.

To suppress syntax checking of ECMAScript code while converting an ABNF file, you would use:

abnf2xml -checkSyntax=OFF test.abnf

In this second example the output file would be named test.grxml (same name as the input file with the .grxml extension).