mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 01:48:04 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			25 lines
		
	
	
		
			635 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			635 B
		
	
	
	
		
			Python
		
	
	
	
	
	
import pytest
 | 
						|
from spacy.lang.en import English
 | 
						|
 | 
						|
 | 
						|
@pytest.mark.issue(8168)
 | 
						|
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")}
 |