Add registry function for reading jsonl

This commit is contained in:
Matthew Honnibal 2020-09-29 16:49:09 +02:00
parent 1fd002180e
commit 43fc7a316d
1 changed files with 5 additions and 0 deletions

View File

@ -30,6 +30,11 @@ def create_jsonl_reader(
return JsonlTexts(path, min_length=min_length, max_length=max_length, limit=limit) 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]: def walk_corpus(path: Union[str, Path], file_type) -> List[Path]:
path = util.ensure_path(path) path = util.ensure_path(path)
if not path.is_dir() and path.parts[-1].endswith(file_type): if not path.is_dir() and path.parts[-1].endswith(file_type):