Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Markov(dict):
- def __init__(self, source_file=None):
- # Going to remove, just testing
- with open(source_file, 'r') as file:
- self.source = file.read().split()
- if source_file:
- self.word_list = self.source
- self.markov = self.gen_markov(self.word_list)
- else:
- raise ValueError('No source file found')
- def gen_markov(self, word_list):
- print('Nothing in here prints')
- for i in range(len(word_list) - 1):
- print('test')
- yield (word_list[i], word_list[i + 1])
- if __name__ == "__main__":
- Markov('sampletest.txt')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement