mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 09:56:28 +03:00
283f64a98d
* bugfix for explosion/spaCy#8168 * add test for explosion/spaCy#8168
11 lines
501 B
Python
11 lines
501 B
Python
from spacy.lang.en import English
|
|
|
|
def test_issue8168():
|
|
nlp = English()
|
|
ruler = nlp.add_pipe("entity_ruler")
|
|
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)
|
|
|
|
assert ruler._ent_ids == {8043148519967183733: ('GPE', 'san-francisco')} |