diff --git a/spacy/pipeline.pyx b/spacy/pipeline.pyx index bb4b96c02..2ce3bbb27 100644 --- a/spacy/pipeline.pyx +++ b/spacy/pipeline.pyx @@ -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']