diff --git a/spacy/pipeline/entityruler.py b/spacy/pipeline/entityruler.py index 35fefd02c..9bbbb2c48 100644 --- a/spacy/pipeline/entityruler.py +++ b/spacy/pipeline/entityruler.py @@ -266,8 +266,9 @@ class EntityRuler(object): DOCS: https://spacy.io/api/entityruler#from_disk """ path = ensure_path(path) - if path.is_file(): - patterns = srsly.read_jsonl(path) + depr_patterns_path = path.with_suffix(".jsonl") + if depr_patterns_path.is_file(): + patterns = srsly.read_jsonl(depr_patterns_path) self.add_patterns(patterns) else: cfg = {} diff --git a/spacy/tests/regression/test_issue3526.py b/spacy/tests/regression/test_issue3526.py index 62c9d5532..c6f513730 100644 --- a/spacy/tests/regression/test_issue3526.py +++ b/spacy/tests/regression/test_issue3526.py @@ -62,10 +62,9 @@ def test_entity_ruler_from_disk_old_format_safe(patterns, en_vocab): nlp = Language(vocab=en_vocab) ruler = EntityRuler(nlp, patterns=patterns, overwrite_ents=True) with make_tempdir() as tmpdir: - out_file = tmpdir / "entity_ruler.jsonl" - srsly.write_jsonl(out_file, ruler.patterns) - new_ruler = EntityRuler(nlp) - new_ruler = new_ruler.from_disk(out_file) + out_file = tmpdir / "entity_ruler" + srsly.write_jsonl(out_file.with_suffix(".jsonl"), ruler.patterns) + new_ruler = EntityRuler(nlp).from_disk(out_file) for pattern in ruler.patterns: assert pattern in new_ruler.patterns assert len(new_ruler) == len(ruler)