Created
September 24, 2019 20:16
-
-
Save thesauri/a35523494a3163e1489985a9f4eccfb3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import markovify | |
import sys | |
if len(sys.argv) < 2: | |
print("tinder.py chat-file.txt") | |
exit(1) | |
chat_file = sys.argv[1] | |
# Get raw text as string. | |
with open(chat_file) as f: | |
text = f.read() | |
# Build the model. | |
text_model = markovify.Text(text) | |
# Print five randomly-generated sentences | |
for i in range(5): | |
print(text_model.make_sentence(test_output=False)) | |
# Print three randomly-generated sentences of no more than 280 characters | |
for i in range(3): | |
print(text_model.make_short_sentence(280)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment