From 6db20b354f0f950a8632c37271b9ff54dccb1655 Mon Sep 17 00:00:00 2001 From: Madeesh Kannan Date: Thu, 6 Apr 2023 11:45:58 +0200 Subject: [PATCH] `Docs`: Fix rule-based matching example that expands named entities (#12495) --- website/docs/usage/rule-based-matching.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/website/docs/usage/rule-based-matching.mdx b/website/docs/usage/rule-based-matching.mdx index 55c043015..7e88bdc1f 100644 --- a/website/docs/usage/rule-based-matching.mdx +++ b/website/docs/usage/rule-based-matching.mdx @@ -1682,6 +1682,8 @@ def expand_person_entities(doc): if prev_token.text in ("Dr", "Dr.", "Mr", "Mr.", "Ms", "Ms."): new_ent = Span(doc, ent.start - 1, ent.end, label=ent.label) new_ents.append(new_ent) + else: + new_ents.append(ent) else: new_ents.append(ent) doc.ents = new_ents