Skip to content

Commit ff76a57

Browse files
authored
CU-869a95nu1 Fix spacy model cleanup (#115)
* CU-869a95nu1: Fix spacy eokznier old path cleanup issue * CU-869a95nu1: Simplify spacy model saving somewhat
1 parent 398c904 commit ff76a57

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

medcat-v2/medcat/tokenizing/spacy_impl/tokenizers.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,9 @@ def save_internals_to(self, folder_path: str) -> str:
106106
folder_path, f"{TOKENIZER_PREFIX}{self._spacy_model_name}")
107107
if os.path.exists(subfolder):
108108
# NOTE: always overwrite
109-
shutil.rmtree(folder_path)
109+
shutil.rmtree(subfolder)
110110
logger.debug("Saving spacy model to '%s'", subfolder)
111-
cur_path = self._nlp._path
112-
if cur_path is None:
113-
raise ValueError(f"Unable to save spacy: {self._nlp}")
114-
shutil.copytree(cur_path, subfolder)
111+
self._nlp.to_disk(subfolder)
115112
return subfolder
116113

117114
def load_internals_from(self, folder_path: str) -> bool:

0 commit comments

Comments
 (0)