1. A method for generating a finite state grammar, the method comprising: (a) receiving user input of a plurality of sample phrases each comprising a plurality of words; (b) representing each sample phrase as a node in a tree; (c) forming a mathematical expression for each pair of nodes in the tree to represent the sample phrases associated with the pair of nodes, the mathematical expression comprising a plurality of words found in the sample phrases of the pair of nodes and an indication of whether a word is a common word that occurs in each of the plurality of phrases or an optional word that occurs in some of the plurality of phrases for the pair of nodes; (d) generating a compact mathematical expression by comparing the mathematical expressions one pair at a time, wherein the compact mathematical expression includes each of the plurality of words found in the sample phrases and an indication of whether each of the plurality of words is a common word or an optional word; (e) displaying the compact mathematical expression to a user; (f) allowing the user to alter the compact mathematical expression; (g) generating a finite state grammar corresponding to the altered compact mathematical expression; and (h) displaying the finite state grammar to the user.