Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions spacy/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -990,8 +990,7 @@ def remove_pipe(self, name: str) -> Tuple[str, PipeCallable]:
if name in self._config["initialize"]["components"]:
self._config["initialize"]["components"].pop(name)
# Make sure the name is also removed from the set of disabled components
if name in self.disabled:
self._disabled.remove(name)
self._disabled.discard(name)
self._link_components()
return removed

Expand Down
11 changes: 11 additions & 0 deletions spacy/tests/pipeline/test_pipe_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,17 @@ def test_remove_pipe(nlp, name):
assert removed_component == new_pipe


@pytest.mark.issue(14069)
def test_remove_disabled_pipe_then_readd(nlp):
nlp.add_pipe("sentencizer")
nlp.disable_pipe("sentencizer")
nlp.remove_pipe("sentencizer")
assert "sentencizer" not in nlp.disabled
nlp.add_pipe("sentencizer")
assert nlp.disabled == []
assert nlp.pipe_names == ["sentencizer"]


@pytest.mark.parametrize("name", ["my_component"])
def test_disable_pipes_method(nlp, name):
nlp.add_pipe("new_pipe", name=name)
Expand Down