Skip to content

Graph-Native Infrastructure for Context and Accountable AI Systems

route spaCy model loads through process cache

Accute92f04bc01a325
diff --git a/semantica/split/methods.py b/semantica/split/methods.py
index 8c338dc6..f2b3f525 100644
--- a/semantica/split/methods.py
+++ b/semantica/split/methods.py
@@ -93,6 +93,7 @@ from ..utils.exceptions import ProcessingError
from ..utils.helpers import safe_import
from ..utils.logging import get_logger
from .semantic_chunker import Chunk
+from ..semantic_extract.methods import load_spacy_model
logger = get_logger("split_methods")
@@ -336,7 +337,7 @@ def split_by_sentences(
# Try spaCy first
if SPACY_AVAILABLE and kwargs.get("use_spacy", True):
try:
- nlp = spacy.load("en_core_web_sm")
+ nlp = load_spacy_model("en_core_web_sm")
doc = nlp(text)
sentences = [sent.text for sent in doc.sents]
except Exception:
diff --git a/semantica/split/semantic_chunker.py b/semantica/split/semantic_chunker.py
index 079ba976..5d712627 100644
--- a/semantica/split/semantic_chunker.py
+++ b/semantica/split/semantic_chunker.py
@@ -35,6 +35,8 @@ from ..utils.exceptions import ProcessingError
from ..utils.helpers import safe_import
from ..utils.logging import get_logger
from ..utils.progress_tracker import get_progress_tracker
+from ..semantic_extract.methods import load_spacy_model
+
spacy, SPACY_AVAILABLE = safe_import("spacy")
@@ -79,7 +81,8 @@ class SemanticChunker:
if SPACY_AVAILABLE:
model_name = config.get("model", "en_core_web_sm")
try:
- self.nlp = spacy.load(model_name)
+ # self.nlp = spacy.load(model_name)
+ self.nlp = load_spacy_model(model_name)
except OSError:
self.logger.warning(
f"spaCy model {model_name} not found. Using fallback chunking."