From 245f91df78e2fd3977ec5b937bac67d3689dd41c Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Thu, 21 May 2020 19:42:13 +0200 Subject: [PATCH] Fix merge issues --- spacy/gold.pyx | 6 ++++++ spacy/tests/regression/test_issue5137.py | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/spacy/gold.pyx b/spacy/gold.pyx index 13e448342..5aa7da456 100644 --- a/spacy/gold.pyx +++ b/spacy/gold.pyx @@ -1050,6 +1050,12 @@ cdef class GoldParse: # avoid allocating memory if the doc does not contain any tokens if self.length == 0: + self.words = [] + self.tags = [] + self.heads = [] + self.labels = [] + self.ner = [] + self.morphs = [] # set a minimal orig so that the scorer can score an empty doc self.orig = TokenAnnotation(ids=[]) else: diff --git a/spacy/tests/regression/test_issue5137.py b/spacy/tests/regression/test_issue5137.py index 4b4e597d3..e9fd268c8 100644 --- a/spacy/tests/regression/test_issue5137.py +++ b/spacy/tests/regression/test_issue5137.py @@ -21,7 +21,8 @@ def test_issue5137(): def from_disk(self, path, **cfg): pass - Language.factories["my_component"] = lambda nlp, **cfg: MyComponent(nlp, **cfg) + factory = lambda nlp, model, **cfg: MyComponent(nlp, **cfg) + Language.factories["my_component"] = factory nlp = English() nlp.add_pipe(nlp.create_pipe("my_component"))