Extract, categorize, analyze, and template documentation from folders of docs and scripts
Project description
Document Corpus Analyzer
Extract, categorize, analyze, and template documentation from folders of docs and scripts.
Features
- Extract: Scan directories for Markdown and Python files, extract metadata (headings, links, code blocks, symbols)
- Classify: Rule-based document type classification (howto, runbook, architecture, reference, etc.)
- Analyze: Generate shape reports per category (heading frequency, code density, structure patterns)
- Generate: Create templates and lint rules based on analysis
- Rewrite: LLM-assisted document consolidation using local Ollama
Installation
# Clone the repository
git clone <repo-url>
cd corpus-analyzer
# Install with uv
uv sync
# Or install dev dependencies too
uv sync --all-extras
Quick Start
# Extract documents from a directory
uv run corpus-analyzer extract /path/to/docs --output corpus.sqlite
# Classify documents by type
uv run corpus-analyzer classify corpus.sqlite
# Analyze document shapes
uv run corpus-analyzer analyze corpus.sqlite --output reports/
# Generate templates
uv run corpus-analyzer generate-templates corpus.sqlite --output templates/
# Rewrite with LLM (requires Ollama running)
uv run corpus-analyzer rewrite corpus.sqlite --category howto --model llama3.2
Document Categories
| Category | Description |
|---|---|
persona |
Agent/role definitions |
howto |
Step-by-step guides |
runbook |
Operational procedures |
architecture |
System design docs |
reference |
API/config reference |
tutorial |
Learning-focused content |
adr |
Architecture Decision Records |
spec |
Specifications |
Development
# Run tests
make test
# Run linting
make lint
# Format code
make format
# Type checking
make typecheck
Configuration
Set environment variables or create a .env file:
CORPUS_DATABASE_PATH=corpus.sqlite
CORPUS_OLLAMA_HOST=http://localhost:11434
CORPUS_OLLAMA_MODEL=llama3.2
License
MIT
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
corpus_analyzer-0.1.0.tar.gz
(1.3 MB
view details)
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 corpus_analyzer-0.1.0.tar.gz.
File metadata
- Download URL: corpus_analyzer-0.1.0.tar.gz
- Upload date:
- Size: 1.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b30610baec65b92d36a130bfb6f18840b0267920d1da5e2ba019974c58782f2c
|
|
| MD5 |
5fcb6ef35788e4d6f2513ac8654b8303
|
|
| BLAKE2b-256 |
bb9a4df8f82422141ed275f67eb86b3d87266238a83f983989df5db5cd617def
|
File details
Details for the file corpus_analyzer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: corpus_analyzer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 99.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad506ba56095f4895c1b96fad1c65af58eacfbde88818430792f86673f5aa673
|
|
| MD5 |
647c63f5ba59b49f0898b8f191736c69
|
|
| BLAKE2b-256 |
ece76fcb58dcb2202fdc44ee7973057736ebbe8c939319563138fb4e61b642dd
|