Unverified Commit c4bc6688 authored by Thomas Wolf's avatar Thomas Wolf Committed by GitHub
Browse files

Merge pull request #860 from Yiqing-Zhou/patch-1

read().splitlines() -> readlines()
parents ba52fe69 b1019d2a
...@@ -67,10 +67,10 @@ def load_vocab(vocab_file): ...@@ -67,10 +67,10 @@ def load_vocab(vocab_file):
"""Loads a vocabulary file into a dictionary.""" """Loads a vocabulary file into a dictionary."""
vocab = collections.OrderedDict() vocab = collections.OrderedDict()
with open(vocab_file, "r", encoding="utf-8") as reader: with open(vocab_file, "r", encoding="utf-8") as reader:
tokens = reader.read().splitlines() tokens = reader.readlines()
for index, token in enumerate(tokens): for index, token in enumerate(tokens):
token = token.rstrip('\n')
vocab[token] = index vocab[token] = index
index += 1
return vocab return vocab
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment