jeudi 3 octobre 2019

Generating Sentences *Randomly* Given a CFG

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!




Aucun commentaire:

Enregistrer un commentaire