spaCy/spacy/tests/regression/test_issue8168.py

23 lines
596 B
Python
Raw Normal View History

from spacy.lang.en import English
2021-06-28 12:48:00 +03:00
def test_issue8168():
nlp = English()
ruler = nlp.add_pipe("entity_ruler")
2021-06-28 12:48:00 +03:00
patterns = [
{"label": "ORG", "pattern": "Apple"},
{
"label": "GPE",
"pattern": [{"LOWER": "san"}, {"LOWER": "francisco"}],
"id": "san-francisco",
},
{
"label": "GPE",
"pattern": [{"LOWER": "san"}, {"LOWER": "fran"}],
"id": "san-francisco",
},
]
ruler.add_patterns(patterns)
2021-06-28 12:48:00 +03:00
assert ruler._ent_ids == {8043148519967183733: ("GPE", "san-francisco")}