Fix encoding when opening files in Python 2.7, re Issue #539

This commit is contained in:
Matthew Honnibal 2016-10-20 14:42:56 +02:00
parent 339b56eb1f
commit f189a3cb00
2 changed files with 2 additions and 2 deletions

View File

@ -28,7 +28,7 @@ class Lemmatizer(object):
exc[pos] = read_exc(file_)
else:
exc[pos] = {}
with (path / 'vocab' / 'lemma_rules.json').open() as file_:
with (path / 'vocab' / 'lemma_rules.json').open('rb') as file_:
rules = json.load(file_)
return cls(index, exc, rules)

View File

@ -175,7 +175,7 @@ cdef class Matcher:
@classmethod
def load(cls, path, vocab):
if (path / 'gazetteer.json').exists():
with (path / 'gazetteer.json').open() as file_:
with (path / 'gazetteer.json').open('rb') as file_:
patterns = json.load(file_)
else:
patterns = {}