token[-1] -> token.rstrip('\n')

This commit is contained in:
Yiqing-Zhou
2019-07-23 20:41:26 +08:00
committed by GitHub
parent bef0c629ca
commit b1019d2a8e

View File

@@ -69,7 +69,7 @@ def load_vocab(vocab_file):
with open(vocab_file, "r", encoding="utf-8") as reader:
tokens = reader.readlines()
for index, token in enumerate(tokens):
token = token[:-1]
token = token.rstrip('\n')
vocab[token] = index
return vocab