From b9ef8ac61657b5c681170f0a8ff1c15ca85b2b71 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Thu, 27 Sep 2018 15:14:27 +0200 Subject: [PATCH] Fix GoldParse class when no entities --- spacy/gold.pyx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/spacy/gold.pyx b/spacy/gold.pyx index 77c5944ca..cd8d6dab4 100644 --- a/spacy/gold.pyx +++ b/spacy/gold.pyx @@ -431,19 +431,18 @@ cdef class GoldParse: if tags is None: tags = [None for _ in words] if heads is None: - heads = [None for token in words] + heads = [None for _ in words] if deps is None: deps = [None for _ in words] - if entities is None: - entities = [None for _ in words] if morphology is None: morphology = [None for _ in words] + if entities is None: + entities = [None for _ in words] elif len(entities) == 0: entities = ['O' for _ in words] elif not isinstance(entities[0], basestring): # Assume we have entities specified by character offset. entities = biluo_tags_from_offsets(doc, entities) - self.mem = Pool() self.loss = 0 self.length = len(doc)