mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
* Automatically register any entity types pre-set on the tokens, so that the NER works with user-given entity types.
This commit is contained in:
parent
f0f92793f6
commit
c4a89d56bd
|
@ -262,6 +262,10 @@ class Language(object):
|
|||
if self.parser and parse:
|
||||
self.parser(tokens)
|
||||
if self.entity and entity:
|
||||
# Add any of the entity labels already set, in case we don't have them.
|
||||
for tok in tokens:
|
||||
if tok.ent_type != 0:
|
||||
self.entity.add_label(tok.ent_type)
|
||||
self.entity(tokens)
|
||||
return tokens
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user