Skip to content

Commit

Permalink
Modify: enable UTF-8 encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
MelodicTechno committed Jul 26, 2024
1 parent e6b18cc commit 20494f6
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class TokenEmbedding:
data_dir = d2l.download_extract(embedding_name)
# GloVe website: https://nlp.stanford.edu/projects/glove/
# fastText website: https://fasttext.cc/
with open(os.path.join(data_dir, 'vec.txt'), 'r') as f:
with open(os.path.join(data_dir, 'vec.txt'), 'r', encoding='utf-8') as f:
for line in f:
elems = line.rstrip().split(' ')
token, elems = elems[0], [float(elem) for elem in elems[1:]]
Expand Down

0 comments on commit 20494f6

Please sign in to comment.