Fix omission of O action when creating blank entity recognizer

This commit is contained in:
Matthew Honnibal 2016-10-16 11:43:25 +02:00
parent 5444d38cc6
commit a079677984

View File

@ -13,7 +13,7 @@ cdef class EntityRecognizer(Parser):
@classmethod @classmethod
def blank(cls, Vocab vocab, **cfg): def blank(cls, Vocab vocab, **cfg):
if 'actions' not in cfg: if 'actions' not in cfg:
cfg['actions'] = {} cfg['actions'] = {0: {'': True}, 5: {'': True}}
entity_types = cfg.get('entity_types', ['']) entity_types = cfg.get('entity_types', [''])
for action_type in (1, 2, 3, 4): for action_type in (1, 2, 3, 4):
cfg['actions'][action_type] = {ent_type: True for ent_type in entity_types} cfg['actions'][action_type] = {ent_type: True for ent_type in entity_types}