Move reader

This commit is contained in:
Matthew Honnibal 2020-09-29 16:54:53 +02:00
parent 43fc7a316d
commit 4ad26f4a2f
2 changed files with 3 additions and 5 deletions

View File

@ -30,11 +30,6 @@ def create_jsonl_reader(
return JsonlTexts(path, min_length=min_length, max_length=max_length, limit=limit)
@util.registry.readers("srsly.read_json.v1")
def _read_json(loc: Path):
return srsly.read_json(loc)
def walk_corpus(path: Union[str, Path], file_type) -> List[Path]:
path = util.ensure_path(path)
if not path.is_dir() and path.parts[-1].endswith(file_type):

View File

@ -97,6 +97,9 @@ class registry(thinc.registry):
models = catalogue.create("spacy", "models", entry_points=True)
cli = catalogue.create("spacy", "cli", entry_points=True)
# We want json loading in the registry, so manually register srsly.read_json.
registry.readers("srsly.read_json.v0", srsly.read_json)
class SimpleFrozenDict(dict):
"""Simplified implementation of a frozen dict, mainly used as default