Random grammatical sentence generator using CFG

By Mason Simon

Context-free grammars (CFGs) can be used as a model for natural language. That means they capture the structure of language in a relatively simple form that can be reasoned about and used to generate new instances of natural language. My natural language processing book says CFGs were proven insufficient for modeling German spoken in Zurich (Speech and Language Processing (2nd Edition), p.538), but they’re good enough to bring you the following silly, random, grammatical sentences: