Basic Grammar File Example and Explanation

Version 6

    This grammar file allows the one to three digit numbers that can be separated by up to three decimals.


    Ex. 1.12 1.12.21 123 1


    The top line let's Velocity know the version and how to recognize and interpret the grammar file.

    Next is a comment line meant for explanation of your grammar file.

    !grammar is necessary for velocity to call the name of the grammar file.

    !slot is where we define the properties you will defining.

    !start <Speech>; defines the Speech function.


    Note:  Every property, function and value must end with a semi colon.


    Here we call the <Speech> function and define our groupings as to how the information is to be displayed.

    The {@=#1;} and etc defines the character spacing.  Ex: <number><number> {@=#1+#2;} would write out the information 11 (oneone) as opposed to 1 1 (one space one).

    All groupings are separated by the bar symbol, |.

    The definitions must be concluded with a semi colon, ;.

    Spacing and enters do not matter, they are only there for aesthetics.


    Here we give the values to the property <number>.

    One of the great things about this, is that standard numerals, symbols and words are recognized by the application.

    Here you may also define pronunciation of words.  Ex. NINER {@ = "9";} states that the word niner is the number nine.

    Again we separate using the bar symbol, |, and we must end the values with a semi colon, ;.

    Also just as before spacing and enters do not matter, they are there for aesthetics.


    Finally we define the property <decimal>'s values the same as we did with pronunciation.



    To use the attached grammar file change the file extension from to just .bnf after downloading.


    Information on attaching and using a grammar file can be found here:


    Velocity with Speakeasy: How to add a grammar file and activate it within the project / How to add Speech to Text files