From 2e92c6fb3a0e165ada41714f9c88af4f0cd3f624 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Thu, 20 Oct 2016 21:06:48 +0200 Subject: [PATCH] Fix JSON encoding issue on load --- spacy/lemmatizer.py | 2 +- spacy/matcher.pyx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spacy/lemmatizer.py b/spacy/lemmatizer.py index 9c8f0e716..78cd744cb 100644 --- a/spacy/lemmatizer.py +++ b/spacy/lemmatizer.py @@ -28,7 +28,7 @@ class Lemmatizer(object): exc[pos] = read_exc(file_) else: exc[pos] = {} - with (path / 'vocab' / 'lemma_rules.json').open('rb') as file_: + with (path / 'vocab' / 'lemma_rules.json').open('r', encoding='utf8') as file_: rules = json.load(file_) return cls(index, exc, rules) diff --git a/spacy/matcher.pyx b/spacy/matcher.pyx index fbfa18c1e..de7622dca 100644 --- a/spacy/matcher.pyx +++ b/spacy/matcher.pyx @@ -175,7 +175,7 @@ cdef class Matcher: @classmethod def load(cls, path, vocab): if (path / 'gazetteer.json').exists(): - with (path / 'gazetteer.json').open('rb') as file_: + with (path / 'gazetteer.json').open('r', encoding='utf8') as file_: patterns = json.load(file_) else: patterns = {}