mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 01:46:28 +03:00
Add EntityRecognizer.label property
This commit is contained in:
parent
017bc2ef2f
commit
350c8d25b0
|
@ -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']
|
||||
|
|
Loading…
Reference in New Issue
Block a user