if not line:
continue
tup = line.split(" ")
freq, tag = None, None
if len(tup) == 2:
if tup[1].isdigit():
freq = tup[1]
else:
tag = tup[1]
elif len(tup) > 2:
freq, tag = tup[1], tup[2]
After Change
line = ln.strip()
if not isinstance(f, text_type):
try:
line = line.decode("utf-8").lstrip("\ufeff")
except UnicodeDecodeError:
raise ValueError("dictionary file %s must be utf-8" % f.name)
if not line:
continue