Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #/usr/bin/env python
- import random
- import sys
- import markovgen
- import string
- import os
- from time import sleep
- vowels = ['a', 'e', 'i', 'o', 'u']
- consonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']
- def _vowel():
- return random.choice(vowels)
- def _consonant():
- return random.choice(consonants)
- def _cv():
- return _consonant() + _vowel()
- def _cvc():
- return _cv() + _consonant()
- def _syllable():
- return random.choice([_vowel, _cv, _cvc])()
- def create_fake_word():
- syllables = []
- for x in range(random.randint(2,3)):
- syllables.append(_syllable())
- return ''.join(syllables)
- def is_punct_char(char):
- return char in string.punctuation
- def is_not_punct_char(char):
- return not is_punct_char(char)
- sleep(random.randint(10,60))
- n = 20
- counter = 1
- while counter <= n :
- file_ = open('/home/minecraft/McMyAdmin2/Exec/jeeves.txt')
- # from http://agiliq.com/blog/2009/06/generating-pseudo-random-text-with-markov-chains-u/
- markov = markovgen.Markov(file_)
- sentence = markov.generate_markov_text().capitalize().replace("\"","\\\'")
- senlen = len(sentence)
- if is_not_punct_char(sentence[senlen - 1]) :
- sentence += '.'
- command_sayrandom = "screen -S McMyAdmin -p 0 -X stuff \"$(printf \"say "
- command_sayrandom += sentence
- command_sayrandom += " \\r\\n\")\""
- os.system(command_sayrandom)
- counter += 1
- sleep (random.randint(10,120))
- print "done"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement