This is a simple little toy to generate sentences given some text as input. It makes sentences based on the probability of a word happening after a current word and runs until the current word has a "." in it.
It requires the wikipedia library (pip install wikipedia)
To use, try:
import sentence
p = sentence.SentenceGenerator()
p.parse("PUT RANDOM TEXT HERE.")
p.make_sentence("RANDOM")
# This will generate a sentence starting with 'RANDOM'
# Because of the limited input text, the sentence will be:
# RANDOM TEXT HERE.
# also try creating a text file full of text
# (for example the entire works of Shakespeare)
# then use p.parse_file("FILENAME") and use p.make_sentence