mirror of https://github.com/explosion/spaCy.git
`Docs`: Fix rule-based matching example that expands named entities (#12495)
This commit is contained in:
parent
c95d320d28
commit
6db20b354f
|
@ -1682,6 +1682,8 @@ def expand_person_entities(doc):
|
||||||
if prev_token.text in ("Dr", "Dr.", "Mr", "Mr.", "Ms", "Ms."):
|
if prev_token.text in ("Dr", "Dr.", "Mr", "Mr.", "Ms", "Ms."):
|
||||||
new_ent = Span(doc, ent.start - 1, ent.end, label=ent.label)
|
new_ent = Span(doc, ent.start - 1, ent.end, label=ent.label)
|
||||||
new_ents.append(new_ent)
|
new_ents.append(new_ent)
|
||||||
|
else:
|
||||||
|
new_ents.append(ent)
|
||||||
else:
|
else:
|
||||||
new_ents.append(ent)
|
new_ents.append(ent)
|
||||||
doc.ents = new_ents
|
doc.ents = new_ents
|
||||||
|
|
Loading…
Reference in New Issue