Generating a grammar for statistical training | Synapse