Add EntityRecognizer.label property
@@ -1201,5 +1201,12 @@ cdef class EntityRecognizer(Parser):
return (EntityRecognizer, (self.vocab, self.moves, self.model),
None, None)
+ @property
+ def labels(self):
+ # Get the labels from the model by looking at the available moves, e.g.
+ # B-PERSON, I-PERSON, L-PERSON, U-PERSON
+ return [move.split('-')[1] for move in self.move_names
+ if move[0] in ('B', 'I', 'L', 'U')]
+
__all__ = ['Tagger', 'DependencyParser', 'EntityRecognizer', 'Tensorizer', 'TextCategorizer']
