mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-10-31 16:07:41 +03:00 
			
		
		
		
	* Remove unicode declarations * Remove Python 3.5 and 2.7 from CI * Don't require pathlib * Replace compat helpers * Remove OrderedDict * Use f-strings * Set Cython compiler language level * Fix typo * Re-add OrderedDict for Table * Update setup.cfg * Revert CONTRIBUTING.md * Revert lookups.md * Revert top-level.md * Small adjustments and docs [ci skip]
		
			
				
	
	
		
			21 lines
		
	
	
		
			726 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			726 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from spacy.util import load_model_from_path
 | |
| from spacy.lang.en import English
 | |
| 
 | |
| from ..util import make_tempdir
 | |
| 
 | |
| 
 | |
| def test_issue4707():
 | |
|     """Tests that disabled component names are also excluded from nlp.from_disk
 | |
|     by default when loading a model.
 | |
|     """
 | |
|     nlp = English()
 | |
|     nlp.add_pipe(nlp.create_pipe("sentencizer"))
 | |
|     nlp.add_pipe(nlp.create_pipe("entity_ruler"))
 | |
|     assert nlp.pipe_names == ["sentencizer", "entity_ruler"]
 | |
|     exclude = ["tokenizer", "sentencizer"]
 | |
|     with make_tempdir() as tmpdir:
 | |
|         nlp.to_disk(tmpdir, exclude=exclude)
 | |
|         new_nlp = load_model_from_path(tmpdir, disable=exclude)
 | |
|     assert "sentencizer" not in new_nlp.pipe_names
 | |
|     assert "entity_ruler" in new_nlp.pipe_names
 |