diff --git a/spacy/gold.pyx b/spacy/gold.pyx index 57473b002..183eed0cf 100644 --- a/spacy/gold.pyx +++ b/spacy/gold.pyx @@ -1,7 +1,5 @@ import numpy import codecs -import json -import ujson import random import re import os @@ -9,6 +7,11 @@ from os import path from libc.string cimport memset +try: + import ujson as json +except ImportError: + import json + def tags_to_entities(tags): entities = [] @@ -128,7 +131,7 @@ def read_json_file(loc, docs_filter=None): yield from read_json_file(path.join(loc, filename)) else: with open(loc) as file_: - docs = ujson.load(file_) + docs = json.load(file_) for doc in docs: if docs_filter is not None and not docs_filter(doc): continue