Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. class Markov(dict):
  2. def __init__(self, source_file=None):
  3.  
  4. # Going to remove, just testing
  5. with open(source_file, 'r') as file:
  6. self.source = file.read().split()
  7.  
  8. if source_file:
  9. self.word_list = self.source
  10. self.markov = self.gen_markov(self.word_list)
  11. else:
  12. raise ValueError('No source file found')
  13.  
  14. def gen_markov(self, word_list):
  15. print('Nothing in here prints')
  16. for i in range(len(word_list) - 1):
  17. print('test')
  18. yield (word_list[i], word_list[i + 1])
  19.  
  20. if __name__ == "__main__":
  21. Markov('sampletest.txt')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement