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

This commit is contained in:
Yiqing-Zhou authored and GitHub committed 2019-07-23 20:41:26 +08:00
1 parent bef0c629ca
commit b1019d2a8e
1 file changed
+1 -1
+1 -1
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