This file contains hidden or 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 random | |
from markov import MarkovGenerator | |
from markov_by_char import CharacterMarkovGenerator | |
# word MarkovGenerator | |
generator = MarkovGenerator(n=2, max=500) | |
# character MarkovGenerator | |
#generator = CharacterMarkovGenerator(n=3, max=100) |
This file contains hidden or 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
# This program generates random poems that contain zero English words | |
import random | |
import re | |
# create dictionary using scrabble dictionary plus 'a' and 'i' | |
dictionary = [] | |
for line in open('sowpods.txt'): | |
line = line.strip() | |
dictionary.append(line) |
This file contains hidden or 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 sys | |
all_concordance = dict() | |
for line in open('kim-tweets.txt'): | |
line = line.strip() | |
line = line.replace(".", "") | |
line = line.replace(",", "") | |
line_words = line.split(" ") | |
for word in line_words: |
This file contains hidden or 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 sys | |
import random | |
all_words = list() | |
for line in open('kim-tweets.txt'): | |
line = line.strip() | |
line = line.lower() | |
line = line.replace(".", "") | |
line = line.replace(",", "") |
This file contains hidden or 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 sys | |
myWords = [] | |
for line in sys.stdin: | |
line = line.strip() | |
words = line.split(" ") | |
for word in words: | |
if len(word) < 3: | |
myWords.append(word) |