if previous_label > 0: # If remaining previous not O we must write it.
entity_label = config.id2label[previous_label]
add_entity(data, doc_name, entity_label, previous_offset)
in line 163 to 165 , entity_label is "str" type
def add_entity(data, doc_name, label, offset):
entity_label = config.id2label[label] if label > 0 else None
if entity_label is not None:
anafora.AnaforaEntity()
entity = anafora.AnaforaEntity()
num_entities = len(data.xml.findall("annotations/entity"))
entity.id = "%s@%s" % (num_entities, doc_name)
entity.spans = ((offset[0], offset[1]),)
entity.type = entity_label.replace("B-", "")
data.annotations.append(entity)
in line 123 to 132
But label is "int" type in entity_label = config.id2label[label] if label > 0 else None
in line 163 to 165 , entity_label is "str" type
in line 123 to 132
But label is "int" type in entity_label = config.id2label[label] if label > 0 else None