Skip to content

arispoloway/sentence_generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages