The CTK Development Page


Notes for grammar file syntax (CTK v1.0.9 onwards)

An example grammar definition: In the above example lines starting with a $ are variables that stand for sub-networks. They must be defined before they appear in the RHS od a rule.

Words such as 'up','down' etc refer to labelled HMMs. (Note, in the current CTK version HMMs are constrained to having character labels, but this restriction will be removed eventually!)

The following sets of braces have the following meanings

An expression can be composed of one or more alternative sequences separated by '|' e.g. (1|2|3) means '1' or '2' or '3'.

The final line of the grammar file is expanded into the grammar network that the decoder employs.

For example, a simple TIDigit grammar would be:

If there is an optional short silence, s, between digits then one could use the slightly more complex:

For more details see the HParse documentation in the HTKv1.5 manual.