Allow ent_id to be set in Token

This commit is contained in:
Matthew Honnibal 2017-03-31 14:00:14 +02:00
parent 9720103428
commit fc3900e5b2
1 changed files with 3 additions and 9 deletions

View File

@ -506,21 +506,15 @@ cdef class Token:
return self.c.ent_id return self.c.ent_id
def __set__(self, hash_t key): def __set__(self, hash_t key):
# TODO self.c.ent_id = key
raise NotImplementedError(
"Can't yet set ent_id from Token. Vote for this feature on the issue "
"tracker: http://github.com/spacy-io/spaCy")
property ent_id_: property ent_id_:
'''A (string) entity ID. Usually assigned by patterns in the Matcher.''' '''A (string) entity ID. Usually assigned by patterns in the Matcher.'''
def __get__(self): def __get__(self):
return self.vocab.strings[self.c.ent_id] return self.vocab.strings[self.c.ent_id]
def __set__(self, hash_t key): def __set__(self, name):
# TODO self.c.ent_id = self.vocab.strings[name]
raise NotImplementedError(
"Can't yet set ent_id_ from Token. Vote for this feature on the issue "
"tracker: http://github.com/spacy-io/spaCy")
property whitespace_: property whitespace_:
def __get__(self): def __get__(self):