From fcbfff043fd98e72290a887a12b93ebc270aa992 Mon Sep 17 00:00:00 2001 From: maxirmx Date: Wed, 21 Oct 2015 15:52:34 +0300 Subject: [PATCH] Fixing encoding issue #3 --- spacy/lemmatizer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spacy/lemmatizer.py b/spacy/lemmatizer.py index ae5f5e615..3eb7d1a52 100644 --- a/spacy/lemmatizer.py +++ b/spacy/lemmatizer.py @@ -19,7 +19,10 @@ class Lemmatizer(object): index[pos] = read_index(path.join(data_dir, 'wordnet', 'index.%s' % pos)) exc[pos] = read_exc(path.join(data_dir, 'wordnet', '%s.exc' % pos)) if path.exists(path.join(data_dir, 'vocab', 'lemma_rules.json')): - rules = json.load(open(path.join(data_dir, 'vocab', 'lemma_rules.json'), encoding="UTF-8")) + if sys.version_info[0] == 3: + rules = json.load(open(path.join(data_dir, 'vocab', 'lemma_rules.json'), encoding="utf_8")) + else: + rules = json.load(open(path.join(data_dir, 'vocab', 'lemma_rules.json'))) else: rules = {} return cls(index, exc, rules)