GitHunt
AR

Arjiit/Sent-Gen-CFG

Random Sentence Generator in Python using Context Free Grammars.

'randsent.py' is a Python script that generates random sentences.
It takes two arguments- a grammar file having CFG rules and the number of sentences to generate (1 by default). The grammar is in the format specified in the grammar file. It is expected to be in the same directory or provided with full path.
'-t' option generates tree structure instead of strings and '-b' option brackets the Sentences with {} and Noun Phrases with [].
The grammar can form Yes/No questions, Singular/Plural distinction and basic pronouns.
While the sentences formed are grammatical, they might be less sensible due to the limited vocabulary in the given grammar.

Contributors

Created April 13, 2019
Updated April 13, 2019