I want to generate sentences randomly from a given context-free grammar.
Randomly is the important part because my grammar is quite large, and NLTK generates all the possible utterances which falls short on recursions (i.e. E -> A E
) and takes too long to generate "interesting" utterances in short time (interesting being unlike the other utterances preceding the current one).
Are there any Python libraries for that? Thanks!