Skip to content

Graph-Native Infrastructure for Context and Accountable AI Systems

fix(normalize): declare langdetect in a nlp-langdetect extra and in [all] (#1823)

Maxi93f98a36440b
diff --git a/README.md b/README.md
index 0fe05567..69e1f364 100644
--- a/README.md
+++ b/README.md
@@ -1528,6 +1528,7 @@ pip install "semantica[documents]" # Document parsing (docx, openpyxl,
pip install "semantica[embeddings-local]" # Local embeddings (sentence-transformers, fastembed, onnxruntime)
pip install "semantica[models-huggingface]" # HuggingFace models (transformers, torch)
pip install "semantica[nlp-spacy]" # spaCy NLP pipelines (spacy)
+pip install "semantica[nlp-langdetect]" # Language detection for LanguageDetector (langdetect)
pip install "semantica[viz]" # Visualization (matplotlib, seaborn, plotly, pyvis, graphviz)
pip install "semantica[media]" # Audio & computer vision (librosa, opencv-python)
pip install "semantica[graph-embeddings]" # Knowledge graph embeddings (gensim / Node2Vec)
diff --git a/pyproject.toml b/pyproject.toml
index 256c9569..faf3a36c 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -159,6 +159,11 @@ embeddings-local = [
nlp-spacy = [
"spacy>=3.4.0"
]
+# LanguageDetector (semantica.normalize); without it every text is reported
+# as the default language.
+nlp-langdetect = [
+ "langdetect>=1.0.9"
+]
# ---- Graph Backends ----
graph-neo4j = ["neo4j>=5.0.0"]
@@ -290,7 +295,7 @@ explorer-lite = [
# NOTE: there is no ``crewai`` extra to include here — see the comment above
# the (removed) crewai entry under "Agentic Framework Integrations".
all = [
- "semantica[viz,media,infra,cloud,monitoring,watch,llm-all,models-huggingface,embeddings-local,nlp-spacy,documents,ingest-git,graph-embeddings,split-all,graph-all,tripletstore-oxigraph,vectorstore-all,parse-docling,parse-pdf,ingest-parquet,ingest-arrow,shacl,explorer,agno,langchain,google-adk]"
+ "semantica[viz,media,infra,cloud,monitoring,watch,llm-all,models-huggingface,embeddings-local,nlp-spacy,nlp-langdetect,documents,ingest-git,graph-embeddings,split-all,graph-all,tripletstore-oxigraph,vectorstore-all,parse-docling,parse-pdf,ingest-parquet,ingest-arrow,shacl,explorer,agno,langchain,google-adk]"
]
# ---------------- DEVELOPMENT DEPENDENCIES (PEP 735) ----------------
diff --git a/requirements-ci.txt b/requirements-ci.txt
index 45503634..dd652a22 100644
--- a/requirements-ci.txt
+++ b/requirements-ci.txt
@@ -2579,6 +2579,10 @@ langchain-protocol==0.0.19 \
--hash=sha256:4cdf879a492a35980fd859ae792d3c65458ccaae504e183c9a10d7eac1f0720f \
--hash=sha256:79d90a1425122ac87e8052e2ec054fbd09c3edbf341bdfb6397112a495c7bf8c
# via langchain-core
+langdetect==1.0.9 \
+ --hash=sha256:7cbc0746252f19e76f77c0b1690aadf01963be835ef0cd4b56dddf2a8f1dfc2a \
+ --hash=sha256:cbc1fef89f8d062739774bd51eda3da3274006b3661d199c2655f6b3f6d605a0
+ # via semantica (pyproject.toml)
langsmith==0.12.1 \
--hash=sha256:34574d4411947f62825e8368fd172cad2505ddfb73bf5d8ed7c0e7a41e4c4879 \
--hash=sha256:8916c1a8daa4282511f311f569fd5cb2f0aba8d89a4d1761620ed37b57f72c00
@@ -6213,6 +6217,7 @@ six==1.17.0 \
--hash=sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274 \
--hash=sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81
# via
+ # langdetect
# python-dateutil
# rapidocr
# rfc3339-validator
diff --git a/tests/test_pyproject_extras.py b/tests/test_pyproject_extras.py
index d0b71a8d..c6c0317c 100644
--- a/tests/test_pyproject_extras.py
+++ b/tests/test_pyproject_extras.py
@@ -34,3 +34,12 @@ def test_all_bundles_include_parse_pdf():
def test_all_bundle_extraction_finds_known_extra():
"""Control: the extraction reads the right block (parse-docling is in)."""
assert "parse-docling" in _extras_in_all_bundles()
+
+
+def test_all_bundles_include_langdetect():
+ """#1807: without langdetect, LanguageDetector reports every text as the
+ default language, so ``semantica[all]`` has to pull it in."""
+ assert "nlp-langdetect" in _extras_in_all_bundles()
+ text = PYPROJECT.read_text(encoding="utf-8")
+ match = re.search(r"^nlp-langdetect = \[\n(.*?)^\]", text, re.MULTILINE | re.DOTALL)
+ assert match and "langdetect" in match.group(1)
diff --git a/uv.lock b/uv.lock
index 856cddce..09a1d2ce 100644
--- a/uv.lock
+++ b/uv.lock
@@ -3859,6 +3859,15 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/dd/c1/d10b371bcba7abce05e2b33910e39c33cfa496a53f13640b7b8e10bb4d2b/langcodes-3.5.1-py3-none-any.whl", hash = "sha256:b6a9c25c603804e2d169165091d0cdb23934610524a21d226e4f463e8e958a72", size = 183050, upload-time = "2025-12-02T16:21:59.954Z" },
]
+[[package]]
+name = "langdetect"
+version = "1.0.9"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "six" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/0e/72/a3add0e4eec4eb9e2569554f7c70f4a3c27712f40e3284d483e88094cc0e/langdetect-1.0.9.tar.gz", hash = "sha256:cbc1fef89f8d062739774bd51eda3da3274006b3661d199c2655f6b3f6d605a0", size = 981474, upload-time = "2021-05-07T07:54:13.562Z" }
+
[[package]]
name = "langsmith"
version = "0.13.0"
@@ -8270,6 +8279,7 @@ all = [
{ name = "ipywidgets" },
{ name = "kafka-python" },
{ name = "langchain-core" },
+ { name = "langdetect" },
{ name = "librosa", version = "0.11.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" },
{ name = "librosa", version = "1.0.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" },
{ name = "litellm" },
@@ -8505,6 +8515,9 @@ monitoring = [
{ name = "opentelemetry-semantic-conventions" },
{ name = "prometheus-client" },
]
+nlp-langdetect = [
+ { name = "langdetect" },
+]
nlp-spacy = [
{ name = "spacy" },
]
@@ -8640,6 +8653,7 @@ requires-dist = [
{ name = "ipywidgets", marker = "extra == 'viz'", specifier = ">=8.0.0" },
{ name = "kafka-python", marker = "extra == 'infra'", specifier = ">=3.0.2" },
{ name = "langchain-core", marker = "extra == 'langchain'", specifier = ">=0.3.0" },
+ { name = "langdetect", marker = "extra == 'nlp-langdetect'", specifier = ">=1.0.9" },
{ name = "librosa", marker = "extra == 'media'", specifier = ">=0.9.0" },
{ name = "litellm", marker = "extra == 'llm-litellm'", specifier = ">=1.83.9" },
{ name = "loguru", specifier = ">=0.7.3" },
@@ -8706,7 +8720,7 @@ requires-dist = [
{ name = "semantica", extras = ["llm-openai", "llm-groq", "llm-gemini", "llm-anthropic", "llm-ollama", "llm-deepseek", "llm-novita", "llm-litellm", "llm-instructor", "llm-typesafe"], marker = "extra == 'llm-all'" },
{ name = "semantica", extras = ["split-tiktoken", "split-community", "split-topic"], marker = "extra == 'split-all'" },
{ name = "semantica", extras = ["vectorstore-qdrant", "vectorstore-weaviate", "vectorstore-pinecone", "vectorstore-milvus", "vectorstore-pgvector", "vectorstore-sqlite", "vectorstore-faiss"], marker = "extra == 'vectorstore-all'" },
- { name = "semantica", extras = ["viz", "media", "infra", "cloud", "monitoring", "watch", "llm-all", "models-huggingface", "embeddings-local", "nlp-spacy", "documents", "ingest-git", "graph-embeddings", "split-all", "graph-all", "tripletstore-oxigraph", "vectorstore-all", "parse-docling", "parse-pdf", "ingest-parquet", "ingest-arrow", "shacl", "explorer", "agno", "langchain", "google-adk"], marker = "extra == 'all'" },
+ { name = "semantica", extras = ["viz", "media", "infra", "cloud", "monitoring", "watch", "llm-all", "models-huggingface", "embeddings-local", "nlp-spacy", "nlp-langdetect", "documents", "ingest-git", "graph-embeddings", "split-all", "graph-all", "tripletstore-oxigraph", "vectorstore-all", "parse-docling", "parse-pdf", "ingest-parquet", "ingest-arrow", "shacl", "explorer", "agno", "langchain", "google-adk"], marker = "extra == 'all'" },
{ name = "sentence-transformers", marker = "extra == 'embeddings-local'", specifier = ">=2.2.0" },
{ name = "simple-salesforce", marker = "extra == 'db-salesforce'", specifier = ">=1.12.0" },
{ name = "snowflake-connector-python", marker = "extra == 'db-snowflake'", specifier = ">=4.6.0" },
@@ -8729,7 +8743,7 @@ requires-dist = [
{ name = "weaviate-client", marker = "extra == 'vectorstore-weaviate'", specifier = ">=4.0.0" },
{ name = "websockets", marker = "extra == 'explorer'", specifier = ">=15.0.1" },
]
-provides-extras = ["llm-openai", "llm-groq", "llm-gemini", "llm-anthropic", "llm-ollama", "llm-deepseek", "llm-novita", "llm-litellm", "llm-instructor", "llm-typesafe", "llm-all", "documents", "parse-docling", "parse-pdf", "shacl", "db-snowflake", "db-databricks", "db-arrow", "db-salesforce", "db-redshift", "db-cassandra", "db-bigquery", "ingest-looker", "ingest-parquet", "ingest-arrow", "ingest-sap", "ingest-servicenow", "ingest-airflow", "ingest-git", "db-all", "models-huggingface", "embeddings-local", "nlp-spacy", "graph-neo4j", "graph-falkordb", "graph-amazon-neptune", "graph-apache-age", "graph-embeddings", "graph-all", "tripletstore-oxigraph", "vectorstore-faiss", "vectorstore-qdrant", "vectorstore-weaviate", "vectorstore-pinecone", "vectorstore-milvus", "vectorstore-pgvector", "vectorstore-sqlite", "vectorstore-all", "infra", "cloud", "monitoring", "viz", "media", "gpu", "agno", "langchain", "google-adk", "open-ontologies", "watch", "split-tiktoken", "split-community", "split-topic", "split-all", "explorer", "explorer-lite", "all"]
+provides-extras = ["llm-openai", "llm-groq", "llm-gemini", "llm-anthropic", "llm-ollama", "llm-deepseek", "llm-novita", "llm-litellm", "llm-instructor", "llm-typesafe", "llm-all", "documents", "parse-docling", "parse-pdf", "shacl", "db-snowflake", "db-databricks", "db-arrow", "db-salesforce", "db-redshift", "db-cassandra", "db-bigquery", "ingest-looker", "ingest-parquet", "ingest-arrow", "ingest-sap", "ingest-servicenow", "ingest-airflow", "ingest-git", "db-all", "models-huggingface", "embeddings-local", "nlp-spacy", "nlp-langdetect", "graph-neo4j", "graph-falkordb", "graph-amazon-neptune", "graph-apache-age", "graph-embeddings", "graph-all", "tripletstore-oxigraph", "vectorstore-faiss", "vectorstore-qdrant", "vectorstore-weaviate", "vectorstore-pinecone", "vectorstore-milvus", "vectorstore-pgvector", "vectorstore-sqlite", "vectorstore-all", "infra", "cloud", "monitoring", "viz", "media", "gpu", "agno", "langchain", "google-adk", "open-ontologies", "watch", "split-tiktoken", "split-community", "split-topic", "split-all", "explorer", "explorer-lite", "all"]
[package.metadata.requires-dev]
dev = [