line = ln.strip().decode("utf-8").lstrip("\ufeff")
if not line:
continue
tup = line.split(" ")
freq, tag = None, None
if len(tup) == 2:
if tup[1].isdigit():
freq = tup[1]
After Change
if freq is not None:
freq = freq.strip()
if tag is not None:
tag = tag.strip()
self.add_word(word, freq, tag)
def add_word(self, word, freq=None, tag=None):