mirror of https://github.com/explosion/spaCy.git
* 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:
|
if self.parser and parse:
|
||||||
self.parser(tokens)
|
self.parser(tokens)
|
||||||
if self.entity and entity:
|
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)
|
self.entity(tokens)
|
||||||
return tokens
|
return tokens
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue