Skip to content

Enforce UTF-8 Encoding #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions data/example/build_glove.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

if __name__ == '__main__':
# Load vocab
with Path('vocab.words.txt').open() as f:
with Path('vocab.words.txt').open(encoding="utf8") as f:
word_to_idx = {line.strip(): idx for idx, line in enumerate(f)}
size_vocab = len(word_to_idx)

Expand All @@ -24,7 +24,7 @@
# Get relevant glove vectors
found = 0
print('Reading GloVe file (may take a while)')
with Path('glove.840B.300d.txt').open() as f:
with Path('glove.840B.300d.txt').open(encoding="utf8") as f:
for line_idx, line in enumerate(f):
if line_idx % 100000 == 0:
print('- At line {}'.format(line_idx))
Expand Down