Fix GoldParse class when no entities

This commit is contained in:
Matthew Honnibal 2018-09-27 15:14:27 +02:00
parent c8a2841308
commit b9ef8ac616

View File

@ -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)