From 141f12b92e8a3ace4e3ba019f35ee2ff2fd8e7e3 Mon Sep 17 00:00:00 2001 From: Paul O'Leary McCann Date: Sun, 7 Nov 2021 18:56:23 +0900 Subject: [PATCH 1/3] Make Jsonl Corpus reader optional again --- spacy/training/corpus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spacy/training/corpus.py b/spacy/training/corpus.py index b30d918fd..733fc267e 100644 --- a/spacy/training/corpus.py +++ b/spacy/training/corpus.py @@ -41,7 +41,7 @@ def create_docbin_reader( @util.registry.readers("spacy.JsonlCorpus.v1") def create_jsonl_reader( - path: Union[str, Path], min_length: int = 0, max_length: int = 0, limit: int = 0 + path: Union[None, str, Path], min_length: int = 0, max_length: int = 0, limit: int = 0 ) -> Callable[["Language"], Iterable[Example]]: return JsonlCorpus(path, min_length=min_length, max_length=max_length, limit=limit) From 71fb00ed954fd758cc743d80dc52e77f3e9bc689 Mon Sep 17 00:00:00 2001 From: Paul O'Leary McCann Date: Mon, 8 Nov 2021 10:02:29 +0000 Subject: [PATCH 2/3] Update spacy/training/corpus.py Co-authored-by: Sofie Van Landeghem --- spacy/training/corpus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spacy/training/corpus.py b/spacy/training/corpus.py index 733fc267e..aab2eae94 100644 --- a/spacy/training/corpus.py +++ b/spacy/training/corpus.py @@ -41,7 +41,7 @@ def create_docbin_reader( @util.registry.readers("spacy.JsonlCorpus.v1") def create_jsonl_reader( - path: Union[None, str, Path], min_length: int = 0, max_length: int = 0, limit: int = 0 + path: Optional[Union[str, Path]], min_length: int = 0, max_length: int = 0, limit: int = 0 ) -> Callable[["Language"], Iterable[Example]]: return JsonlCorpus(path, min_length=min_length, max_length=max_length, limit=limit) From 8aa2d32ca92d3501695cdb057bcc7d479a0ab1df Mon Sep 17 00:00:00 2001 From: Paul O'Leary McCann Date: Mon, 8 Nov 2021 19:03:47 +0900 Subject: [PATCH 3/3] Update jsonlcorpus constructor types --- spacy/training/corpus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spacy/training/corpus.py b/spacy/training/corpus.py index aab2eae94..cf643feec 100644 --- a/spacy/training/corpus.py +++ b/spacy/training/corpus.py @@ -221,7 +221,7 @@ class JsonlCorpus: def __init__( self, - path: Union[str, Path], + path: Optional[Union[str, Path]], *, limit: int = 0, min_length: int = 0,