Advertisement
lessientelrunya

dictionary

Jun 30th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. class Dictionary:
  2.  
  3.     def __init__(self):
  4.         self.words = set()
  5.  
  6.     def check(self, word):
  7.         return word.lower() in self.words
  8.  
  9.     def load(self, dictionary):
  10.         file = open(dictionary, "r")
  11.         for line in file:
  12.             self.words.add(line.rstrip("\n"))
  13.         file.close()
  14.         return True
  15.  
  16.     def size(self):
  17.         return len(self.words)
  18.  
  19.     def unload(self):
  20.         return True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement