def words(self):
if not self.words_data:
with io.open(self.data_file, "r", encoding="utf-8") as f:
words = f.read().splitlines()
unicode_transformer = UnicodeTransformer()
words = [unicode_transformer.transform(word) for word in words]
self.words_data = words
return self.words_data
After Change
def words(self):
if not self.words_data:
content = read(self.data_file).strip()
words = content.split("\n")
self.words_data = words
return self.words_data