Parse a corpus, manage it and extract themes from a corpus.
Project description
theme-extractor
Python toolkit to compare theme/topic extraction strategies on the same corpus, with:
- one unified CLI
- one unified JSON output schema
- offline-first execution options
- Elasticsearch/OpenSearch backend support
Why this project
theme-extractor helps you answer one practical question:
"Which extraction strategy works best for my corpus and constraints?"
It lets you run baseline lexical methods, embedding-based methods, and LLM-assisted methods with consistent outputs for easier comparison.
Core Commands
theme-extractor ingesttheme-extractor extracttheme-extractor benchmarktheme-extractor evaluatetheme-extractor reporttheme-extractor doctor
Quickstart
Prerequisite: start one backend first (local Docker guide: /howto/docker-local.md).
uv sync --group elasticsearch
uv run theme-extractor doctor --output data/out/doctor.json
uv run theme-extractor ingest --input data/raw --output data/out/ingest.json
uv run theme-extractor benchmark \
--methods baseline_tfidf,terms,significant_terms,keybert,bertopic \
--backend elasticsearch \
--backend-url http://localhost:9200 \
--index theme_extractor \
--focus both \
--output data/out/benchmark.json
uv run theme-extractor evaluate \
--input data/out/benchmark.json \
--output data/out/evaluation.json
uv run theme-extractor report \
--input data/out/benchmark.json \
--output data/out/report_benchmark.md
Run significant_text separately with --agg-field content (see /howto/benchmark.md).
Methods Available
- Baselines:
baseline_tfidftermssignificant_termssignificant_text
- Semantic:
keybertbertopic(embedding on/off, reductionnone/svd/nmf/umap, clusteringkmeans/hdbscan)
- Generative:
llm(offline fallback behavior supported)
What You Get
- Unified extraction schema:
- topic-first output (
topics) - optional document-topic links (
document_topics) - execution notes and metadata (
notes,metadata)
- topic-first output (
- Benchmark output:
- per-method outputs
- comparison block
- Quantitative proxies via
evaluate:- topic coherence proxy
- inter-topic diversity
- run-to-run stability
Documentation Map (How-To)
Detailed operations are intentionally kept in /howto:
/howto/ingest.md: ingestion, cleaning, stopwords, streaming mode/howto/extract.md: single-method extraction and interpretation/howto/benchmark.md: multi-method comparison workflow/howto/report.md: markdown reporting workflow/howto/release.md: PyPI/TestPyPI release workflow/howto/docker-local.md: local Docker stacks (Elasticsearch/OpenSearch)/howto/troubleshooting.md: common failures and fixes
Sphinx documentation is available under /docs (includes README, how-to pages, and API docstrings).
Build locally:
uv run sphinx-build -b html docs docs/_build/html
Configuration
Use .env.template as bootstrap:
cp .env.template .env
set -a; source .env; set +a
Important variable groups:
- backend/runtime (
THEME_EXTRACTOR_BACKEND*,THEME_EXTRACTOR_PROXY_URL) - ingestion stopwords (
THEME_EXTRACTOR_DEFAULT_STOPWORDS_ENABLED,THEME_EXTRACTOR_AUTO_STOPWORDS_*) - PDF OCR fallback (
THEME_EXTRACTOR_PDF_OCR_*) for scanned PDFs .msgextraction (THEME_EXTRACTOR_MSG_*) for metadata and attachment policy- local model resolution (
THEME_EXTRACTOR_LOCAL_MODELS_DIR) - BERTopic embedding cache (
THEME_EXTRACTOR_BERTOPIC_EMBEDDING_CACHE_*)
Project Governance
Community Standards
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file theme_extractor-0.1.0.tar.gz.
File metadata
- Download URL: theme_extractor-0.1.0.tar.gz
- Upload date:
- Size: 46.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3498324fe422e516b5f3e8bd4a691411bac2cb1f03404e7c4066bae9e682b926
|
|
| MD5 |
829556bfe2f2edd901fe53d7a12ea125
|
|
| BLAKE2b-256 |
ea065a53c11191a2cbdc221eb7e82cf8ab287bfbb57744e9b222c31fa546eca9
|
Provenance
The following attestation bundles were made for theme_extractor-0.1.0.tar.gz:
Publisher:
release.yml on Guillaume-Lombardo/theme-extractor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
theme_extractor-0.1.0.tar.gz -
Subject digest:
3498324fe422e516b5f3e8bd4a691411bac2cb1f03404e7c4066bae9e682b926 - Sigstore transparency entry: 947224590
- Sigstore integration time:
-
Permalink:
Guillaume-Lombardo/theme-extractor@bfd2e9002229fe56969b425e7fc17d542ad2295e -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Guillaume-Lombardo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bfd2e9002229fe56969b425e7fc17d542ad2295e -
Trigger Event:
release
-
Statement type:
File details
Details for the file theme_extractor-0.1.0-py3-none-any.whl.
File metadata
- Download URL: theme_extractor-0.1.0-py3-none-any.whl
- Upload date:
- Size: 59.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
549be03ce6759cf2dd6fd2e2582fe87e9abb90bd818bbd3877d2fc7af3d7be84
|
|
| MD5 |
574f77cde9c5b089ae5060d55316b015
|
|
| BLAKE2b-256 |
a6aff83572cb82fd2383013ebeff6acac3b4c025b50381de23a39b35fc830321
|
Provenance
The following attestation bundles were made for theme_extractor-0.1.0-py3-none-any.whl:
Publisher:
release.yml on Guillaume-Lombardo/theme-extractor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
theme_extractor-0.1.0-py3-none-any.whl -
Subject digest:
549be03ce6759cf2dd6fd2e2582fe87e9abb90bd818bbd3877d2fc7af3d7be84 - Sigstore transparency entry: 947224593
- Sigstore integration time:
-
Permalink:
Guillaume-Lombardo/theme-extractor@bfd2e9002229fe56969b425e7fc17d542ad2295e -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Guillaume-Lombardo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bfd2e9002229fe56969b425e7fc17d542ad2295e -
Trigger Event:
release
-
Statement type: