rust-cave-001 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rust_cave_001-0.2.1/.github/ISSUE_TEMPLATE/bug_report.md +24 -0
- rust_cave_001-0.2.1/.github/ISSUE_TEMPLATE/feature_request.md +13 -0
- rust_cave_001-0.2.1/.github/workflows/ci.yml +90 -0
- rust_cave_001-0.2.1/.gitignore +55 -0
- rust_cave_001-0.2.1/ATTRIBUTION.md +42 -0
- rust_cave_001-0.2.1/BENCHMARKS.md +53 -0
- rust_cave_001-0.2.1/CHANGELOG.md +72 -0
- rust_cave_001-0.2.1/CODE_OF_CONDUCT.md +33 -0
- rust_cave_001-0.2.1/CONTINUE_HERE.md +61 -0
- rust_cave_001-0.2.1/CONTRIBUTING.md +56 -0
- rust_cave_001-0.2.1/Cargo.lock +267 -0
- rust_cave_001-0.2.1/Cargo.toml +16 -0
- rust_cave_001-0.2.1/LICENSE +21 -0
- rust_cave_001-0.2.1/PKG-INFO +189 -0
- rust_cave_001-0.2.1/README.md +164 -0
- rust_cave_001-0.2.1/SECURITY.md +13 -0
- rust_cave_001-0.2.1/benchmarks/__init__.py +0 -0
- rust_cave_001-0.2.1/benchmarks/benchmark.py +414 -0
- rust_cave_001-0.2.1/benchmarks/sample_texts.py +101 -0
- rust_cave_001-0.2.1/build.rs +86 -0
- rust_cave_001-0.2.1/pyproject.toml +38 -0
- rust_cave_001-0.2.1/src/classifier.rs +349 -0
- rust_cave_001-0.2.1/src/lib.rs +815 -0
- rust_cave_001-0.2.1/tests/conftest.py +24 -0
- rust_cave_001-0.2.1/tests/test_rust_cave_001.py +590 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
## Bug Report
|
|
2
|
+
|
|
3
|
+
**Description**
|
|
4
|
+
A clear description of the bug.
|
|
5
|
+
|
|
6
|
+
**Steps to Reproduce**
|
|
7
|
+
1.
|
|
8
|
+
2.
|
|
9
|
+
3.
|
|
10
|
+
|
|
11
|
+
**Expected Behavior**
|
|
12
|
+
What you expected to happen.
|
|
13
|
+
|
|
14
|
+
**Actual Behavior**
|
|
15
|
+
What actually happened.
|
|
16
|
+
|
|
17
|
+
**Environment**
|
|
18
|
+
- OS:
|
|
19
|
+
- Python version:
|
|
20
|
+
- Rust version:
|
|
21
|
+
- rust-cave-001 version:
|
|
22
|
+
|
|
23
|
+
**Additional Context**
|
|
24
|
+
Any other relevant information.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Feature Request
|
|
2
|
+
|
|
3
|
+
**Problem / Use Case**
|
|
4
|
+
What problem are you trying to solve?
|
|
5
|
+
|
|
6
|
+
**Proposed Solution**
|
|
7
|
+
Describe the feature you would like.
|
|
8
|
+
|
|
9
|
+
**Alternatives Considered**
|
|
10
|
+
Any alternative approaches you considered.
|
|
11
|
+
|
|
12
|
+
**Additional Context**
|
|
13
|
+
Any other relevant information or examples.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master, main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [master, main]
|
|
8
|
+
|
|
9
|
+
env:
|
|
10
|
+
CARGO_TERM_COLOR: always
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Set up Python
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.10"
|
|
22
|
+
|
|
23
|
+
- name: Install Rust
|
|
24
|
+
uses: dtolnay/rust-toolchain@stable
|
|
25
|
+
with:
|
|
26
|
+
components: rustfmt, clippy
|
|
27
|
+
|
|
28
|
+
- name: Cache cargo registry
|
|
29
|
+
uses: actions/cache@v4
|
|
30
|
+
with:
|
|
31
|
+
path: ~/.cargo/registry
|
|
32
|
+
key: cargo-registry-${{ hashFiles('Cargo.lock') }}
|
|
33
|
+
restore-keys: |
|
|
34
|
+
cargo-registry-
|
|
35
|
+
|
|
36
|
+
- name: Cache pip
|
|
37
|
+
uses: actions/cache@v4
|
|
38
|
+
with:
|
|
39
|
+
path: ~/.cache/pip
|
|
40
|
+
key: pip-${{ hashFiles('pyproject.toml') }}
|
|
41
|
+
restore-keys: |
|
|
42
|
+
pip-
|
|
43
|
+
|
|
44
|
+
- name: Install Python dependencies
|
|
45
|
+
run: |
|
|
46
|
+
sudo apt-get update -qq && sudo apt-get install -y -qq python3-dev
|
|
47
|
+
pip install --quiet maturin pytest
|
|
48
|
+
|
|
49
|
+
- name: Check Rust formatting
|
|
50
|
+
run: cargo fmt --check
|
|
51
|
+
|
|
52
|
+
- name: Check Rust clippy
|
|
53
|
+
run: cargo clippy -- -D warnings
|
|
54
|
+
|
|
55
|
+
- name: Rust tests
|
|
56
|
+
run: cargo test
|
|
57
|
+
|
|
58
|
+
- name: Build and install
|
|
59
|
+
env:
|
|
60
|
+
PYO3_PYTHON: python3.10
|
|
61
|
+
PYTHON: python3.10
|
|
62
|
+
run: maturin build --release --auditwheel skip -o dist/
|
|
63
|
+
|
|
64
|
+
- name: Install built wheel
|
|
65
|
+
run: pip install dist/*.whl --force-reinstall --no-deps
|
|
66
|
+
|
|
67
|
+
- name: Run Python tests
|
|
68
|
+
run: pytest tests/ -v
|
|
69
|
+
|
|
70
|
+
audit:
|
|
71
|
+
runs-on: ubuntu-latest
|
|
72
|
+
steps:
|
|
73
|
+
- uses: actions/checkout@v4
|
|
74
|
+
|
|
75
|
+
- name: Install Rust
|
|
76
|
+
uses: dtolnay/rust-toolchain@stable
|
|
77
|
+
|
|
78
|
+
- name: Cache cargo registry
|
|
79
|
+
uses: actions/cache@v4
|
|
80
|
+
with:
|
|
81
|
+
path: ~/.cargo/registry
|
|
82
|
+
key: cargo-registry-${{ hashFiles('Cargo.lock') }}
|
|
83
|
+
restore-keys: |
|
|
84
|
+
cargo-registry-
|
|
85
|
+
|
|
86
|
+
- name: Install cargo-audit
|
|
87
|
+
run: cargo install cargo-audit --locked
|
|
88
|
+
|
|
89
|
+
- name: Run cargo audit
|
|
90
|
+
run: cargo audit
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Rust
|
|
2
|
+
/target/
|
|
3
|
+
**/*.rs.bk
|
|
4
|
+
*.pdb
|
|
5
|
+
|
|
6
|
+
# Python
|
|
7
|
+
__pycache__/
|
|
8
|
+
*.py[cod]
|
|
9
|
+
*$py.class
|
|
10
|
+
*.so
|
|
11
|
+
.Python
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
|
|
28
|
+
# Virtual environments
|
|
29
|
+
.venv/
|
|
30
|
+
venv/
|
|
31
|
+
ENV/
|
|
32
|
+
env/
|
|
33
|
+
|
|
34
|
+
# PyO3
|
|
35
|
+
pyo3-0.*/
|
|
36
|
+
|
|
37
|
+
# IDE
|
|
38
|
+
.vscode/
|
|
39
|
+
.idea/
|
|
40
|
+
*.swp
|
|
41
|
+
*.swo
|
|
42
|
+
|
|
43
|
+
# Testing
|
|
44
|
+
.pytest_cache/
|
|
45
|
+
/test_remove_articles/
|
|
46
|
+
|
|
47
|
+
# Local config
|
|
48
|
+
.env
|
|
49
|
+
.env.local
|
|
50
|
+
|
|
51
|
+
# Internal docs
|
|
52
|
+
PUBLIC_READINESS_PLAN.md
|
|
53
|
+
|
|
54
|
+
# Local Cargo build config (target-dir on USB)
|
|
55
|
+
.cargo/
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Attribution
|
|
2
|
+
|
|
3
|
+
## Upstream Sources
|
|
4
|
+
|
|
5
|
+
### Caveman Compression SPEC & Original Implementation
|
|
6
|
+
|
|
7
|
+
- **Repository:** [wilpel/caveman-compression](https://github.com/wilpel/caveman-compression)
|
|
8
|
+
- **License:** MIT
|
|
9
|
+
- **Role:** Defines the Caveman Compression specification (SPEC.md) that rust-cave-001 implements. The 9 compression rules (sentence atomicity, word limit, connective elimination, active voice & present tense, preserve specifics, intensifier removal, article omission, pronoun handling, logical completeness) originate from this specification.
|
|
10
|
+
- **Files derived from SPEC:**
|
|
11
|
+
- `src/lib.rs` — all 7 compression rules (adapted from SPEC rules 1-9)
|
|
12
|
+
- `README.md` — "The 7 Compression Rules" section
|
|
13
|
+
- `BENCHMARKS.md` — methodology inspired by wilpel's benchmarks
|
|
14
|
+
|
|
15
|
+
### Token Reduction Concept
|
|
16
|
+
|
|
17
|
+
- **Repository:** [JuliusBrussee/caveman](https://github.com/JuliusBrussee/caveman)
|
|
18
|
+
- **License:** MIT
|
|
19
|
+
- **Role:** Market validation for output-side token compression (~37K GitHub stars). Proves massive demand for token reduction in AI agent contexts. rust-cave-001 addresses the complementary input-side problem.
|
|
20
|
+
|
|
21
|
+
### Hook-Based Compression Architecture (Reference)
|
|
22
|
+
|
|
23
|
+
- **Repository:** [claudioemmanuel/squeez](https://github.com/claudioemmanuel/squeez)
|
|
24
|
+
- **License:** MIT
|
|
25
|
+
- **Role:** Reference for Rust-based MCP server architecture and cross-host hook integration patterns.
|
|
26
|
+
|
|
27
|
+
## Third-Party Rust Crates
|
|
28
|
+
|
|
29
|
+
| Crate | Version | License | Purpose |
|
|
30
|
+
|-------|---------|---------|---------|
|
|
31
|
+
| [pyo3](https://crates.io/crates/pyo3) | 0.24.2 | Apache-2.0 | Python bindings |
|
|
32
|
+
| [lz4](https://crates.io/crates/lz4) | 1.0 | MIT | LZ4 block compression |
|
|
33
|
+
| [regex](https://crates.io/crates/regex) | 1.10 | MIT/Apache-2.0 | Text pattern matching |
|
|
34
|
+
|
|
35
|
+
## Build Tools
|
|
36
|
+
|
|
37
|
+
- [Maturin](https://github.com/PyO3/maturin) — Python wheel builder for Rust projects
|
|
38
|
+
- [PyO3](https://github.com/PyO3/pyo3) — Rust↔Python interoperability framework
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
*This project is MIT-licensed. All upstream works referenced above are also MIT-licensed where noted. Attribution is provided as a courtesy and in the spirit of open source collaboration.*
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Benchmarks
|
|
2
|
+
|
|
3
|
+
Benchmark results for rust-cave-001 v0.2.1.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
python3 benchmarks/benchmark.py
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## NLP Compression (`compress()`)
|
|
10
|
+
|
|
11
|
+
The Caveman Rules pipeline across 9 text types. Measured on aarch64 (Raspberry Pi 5).
|
|
12
|
+
|
|
13
|
+
| Text Type | Chars | → | Compressed | Reduction | Tokens | → | Compressed | Reduction | Time |
|
|
14
|
+
|---|---|---|---|---|---|---|---|---|---|
|
|
15
|
+
| Technical (short) | 61 | → | 32 | 47.5% | 11 | → | 5 | **54.5%** | 2.79ms |
|
|
16
|
+
| Technical (paragraph) | 369 | → | 147 | 60.2% | 54 | → | 22 | **59.3%** | 11.11ms |
|
|
17
|
+
| Conversational | 260 | → | 78 | 70.0% | 43 | → | 14 | **67.4%** | 8.58ms |
|
|
18
|
+
| Academic/Dense | 436 | → | 134 | 69.3% | 55 | → | 15 | **72.7%** | 8.37ms |
|
|
19
|
+
| Dialogue/Chat | 196 | → | 35 | 82.1% | 39 | → | 9 | **76.9%** | 5.57ms |
|
|
20
|
+
| Mixed (code+numbers) | 260 | → | 99 | 61.9% | 43 | → | 17 | **60.5%** | 8.32ms |
|
|
21
|
+
| Already minimal | 21 | → | 21 | 0.0% | 4 | → | 4 | 0.0% | 2.68ms |
|
|
22
|
+
| Repetitive | 179 | → | 107 | 40.2% | 36 | → | 20 | 44.4% | 11.04ms |
|
|
23
|
+
| Short sentences | 41 | → | 41 | 0.0% | 9 | → | 9 | 0.0% | 8.03ms |
|
|
24
|
+
|
|
25
|
+
**Summary:** Average token reduction **48.4%** (54.5% on texts with >4 tokens).
|
|
26
|
+
Average call time **7.4ms** on RPi 5 (aarch64).
|
|
27
|
+
|
|
28
|
+
## LZ4 Binary Compression (`my_compress`)
|
|
29
|
+
|
|
30
|
+
| Data Type | Size (B) | Compressed (B) | Ratio | Saved | Time |
|
|
31
|
+
|---|---|---|---|---|---|
|
|
32
|
+
| Repeated text (2KB) | 1,560 | 32 | **48.75x** | 97.9% | 7.6µs |
|
|
33
|
+
| Repeated text (10KB) | 7,800 | 57 | **136.84x** | 99.3% | 8.4µs |
|
|
34
|
+
| Random bytes (1KB) | 1,024 | 1,033 | 0.99x | -0.9% | 13.7µs |
|
|
35
|
+
| JSON-like (2KB) | 912 | 235 | 3.88x | 74.2% | 9.7µs |
|
|
36
|
+
| UTF-8 text (1KB) | 1,350 | 65 | 20.77x | 95.2% | 7.5µs |
|
|
37
|
+
| Small data (100B) | 100 | 15 | 6.67x | 85.0% | 7.2µs |
|
|
38
|
+
|
|
39
|
+
## Combined Pipeline: `compress()` → `my_compress()`
|
|
40
|
+
|
|
41
|
+
Applying NLP compression then LZ4 in sequence, measured end-to-end.
|
|
42
|
+
|
|
43
|
+
| Text | Original | After NLP | After LZ4 | Total Ratio | Total Time |
|
|
44
|
+
|---|---|---|---|---|---|
|
|
45
|
+
| Technical (short) | 61B | 32B | 38B | 1.61x | 2.9ms |
|
|
46
|
+
| Technical (paragraph) | 369B | 147B | 150B | 2.46x | 11.2ms |
|
|
47
|
+
| Conversational | 262B | 80B | 86B | **3.05x** | 8.8ms |
|
|
48
|
+
|
|
49
|
+
## Notes
|
|
50
|
+
|
|
51
|
+
- LZ4 has block overhead (~15B per block), so small blocks may expand on first call but decompress correctly.
|
|
52
|
+
- Random/incompressible data may have a tiny overhead from LZ4 block header.
|
|
53
|
+
- Timings are on a Raspberry Pi 5 (aarch64, Cortex-A76). Expect ~2-4x faster on x86_64.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.2.1] - 2026-05-15
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- `normalize_present_tense` ed-stripping: off-by-one in vowel detection (included→includ, sorted→sorte)
|
|
12
|
+
- Added 21 e-drop verb entries to map (agreed→agree, merged→merge, cached→cache, etc.)
|
|
13
|
+
- Tightened eeed guard to allow "agreed" → "agree" while still blocking "speed" → "spe"
|
|
14
|
+
- Added vowel-before-ded/ted check to prevent false e-drop on consonant patterns
|
|
15
|
+
|
|
16
|
+
## [0.2.0] - 2026-05-15
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
- **Present tense normalization** — `normalize_present_tense()` (SPEC Rule 4) converts past-tense verbs to present tense using a reverse conjugation map of 100+ verbs. Un-dead-coded from `#[allow(dead_code)]`.
|
|
20
|
+
- **Pronoun resolution** — `resolve_pronouns()` (SPEC Rule 8) replaces ambiguous pronouns (`it`, `they`, `them`) with preceding noun when 2+ candidates exist.
|
|
21
|
+
- **ATTRIBUTION.md** — Properly credits wilpel/caveman-compression SPEC, JuliusBrussee/caveman, claudioemmanuel/squeez, and all third-party crate dependencies.
|
|
22
|
+
- **`normalize_present_tense()` exposed** as a Python-callable function.
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
- Pipeline now applies 9 rules (was 7): pronoun resolution → active voice → present tense → articles → intensifiers → connectives → word limit → completeness check.
|
|
26
|
+
- Cargo.toml: v0.2.0, added authors and description.
|
|
27
|
+
- pyproject.toml: v0.2.0.
|
|
28
|
+
- README: Updated rules from 7 → 9, added SPEC attribution link.
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
- Benchmark sanity check: accepts both past and present tense passive voice output.
|
|
32
|
+
|
|
33
|
+
## [0.1.1] - 2026-05-15
|
|
34
|
+
|
|
35
|
+
### Added
|
|
36
|
+
- Benchmark suite (benchmarks/benchmark.py) — measures NLP compression ratios, LZ4 binary compression, and combined pipeline performance across 9 text types
|
|
37
|
+
- BENCHMARKS.md with detailed results and performance characteristics
|
|
38
|
+
- Sample texts dataset (benchmarks/sample_texts.py) for reproducible benchmarking
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
- README: Added benchmarks section, removed "No benchmark suite" known limitation
|
|
42
|
+
|
|
43
|
+
## [0.1.0] - 2026-05-12
|
|
44
|
+
|
|
45
|
+
### Added
|
|
46
|
+
- Initial public release
|
|
47
|
+
- LZ4 compression and decompression (`my_compress`, `decompress`)
|
|
48
|
+
- Token estimation via word-boundary regex (`estimate_tokens`)
|
|
49
|
+
- Compression statistics (`get_stats`)
|
|
50
|
+
- Bincode serialization pipeline (`serialize_compressed`, `deserialize_compressed`)
|
|
51
|
+
- Passive-to-active voice transformation (`preprocess_text`, `transform_active_voice`)
|
|
52
|
+
- Full Caveman Compression pipeline (`compress`) applying 7 rules:
|
|
53
|
+
1. Sentence splitting
|
|
54
|
+
2. Word limit (2-5 words per sentence)
|
|
55
|
+
3. Connective elimination
|
|
56
|
+
4. Active voice transformation
|
|
57
|
+
5. Intensifier removal
|
|
58
|
+
6. Article removal
|
|
59
|
+
7. Logical completeness check
|
|
60
|
+
- Verb conjugation map with 60+ irregular verbs
|
|
61
|
+
- Python package via PyO3/Maturin
|
|
62
|
+
- Pytest test suite (53 tests)
|
|
63
|
+
- MIT License
|
|
64
|
+
- CONTRIBUTING.md, CODE_OF_CONDUCT.md, SECURITY.md
|
|
65
|
+
- GitHub Actions CI workflow
|
|
66
|
+
- GitHub issue templates (bug report, feature request)
|
|
67
|
+
|
|
68
|
+
### Fixed
|
|
69
|
+
- Case-insensitive connective removal
|
|
70
|
+
- "this" article removal
|
|
71
|
+
- Trailing period stripping in active-voice agent position
|
|
72
|
+
- Word-merging prevention after connective elimination
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
6
|
+
|
|
7
|
+
## Our Standards
|
|
8
|
+
|
|
9
|
+
Examples of behavior that contributes to a positive environment:
|
|
10
|
+
|
|
11
|
+
- Using welcoming and inclusive language
|
|
12
|
+
- Being respectful of differing viewpoints and experiences
|
|
13
|
+
- Gracefully accepting constructive criticism
|
|
14
|
+
- Focusing on what is best for the community
|
|
15
|
+
- Showing empathy towards other community members
|
|
16
|
+
|
|
17
|
+
Examples of unacceptable behavior:
|
|
18
|
+
|
|
19
|
+
- The use of sexualized language or imagery and unwelcome sexual attention
|
|
20
|
+
- Trolling, insulting/derogatory comments, and personal or political attacks
|
|
21
|
+
- Public or private harassment
|
|
22
|
+
- Publishing others' private information without explicit permission
|
|
23
|
+
- Other conduct which could reasonably be considered inappropriate
|
|
24
|
+
|
|
25
|
+
## Enforcement
|
|
26
|
+
|
|
27
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project maintainers. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate.
|
|
28
|
+
|
|
29
|
+
## Attribution
|
|
30
|
+
|
|
31
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
|
|
32
|
+
|
|
33
|
+
[homepage]: https://www.contributor-covenant.org
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# rust-cave-001 — Session Reference (May 16, 2026)
|
|
2
|
+
|
|
3
|
+
## Resume Here
|
|
4
|
+
|
|
5
|
+
Code audit complete and fixes applied (v0.2.1). **Next: build the self-learning framework** — strategy selector that picks compression rules per input type.
|
|
6
|
+
|
|
7
|
+
### Quickstart
|
|
8
|
+
```
|
|
9
|
+
git clone https://github.com/ether-btc/rust-cave-001
|
|
10
|
+
cd rust-cave-001
|
|
11
|
+
source .venv/bin/activate
|
|
12
|
+
maturin develop --release
|
|
13
|
+
pytest tests/ -v # 66 tests, all pass
|
|
14
|
+
python3 benchmarks/benchmark.py
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Key References
|
|
18
|
+
| What | Value |
|
|
19
|
+
|------|-------|
|
|
20
|
+
| Repo | `github.com/ether-btc/rust-cave-001` (master) |
|
|
21
|
+
| Latest commit | `ce9088c` — "feat: add input text classifier for adaptive compression strategies" |
|
|
22
|
+
| Tags | v0.1.0, v0.1.1, v0.2.0, [v0.2.1](https://github.com/ether-btc/rust-cave-001/releases/tag/v0.2.1) |
|
|
23
|
+
| CI | Green — 66/66 tests, benchmarks 48.4% avg token reduction |
|
|
24
|
+
| Current version | **v0.2.1** (deduplicated maps, clean docs, fresh wheel, input classifier built) |
|
|
25
|
+
| Ceiling | 48.4% static — self-learning framework component (classifier) built, strategy selector next |
|
|
26
|
+
### What Exists
|
|
27
|
+
- **9 compression rules** in pipeline (`src/lib.rs`, 813 lines)
|
|
28
|
+
- **Input classifier** (`src/classifier.rs`, 353 lines) — 13-heuristic text type detection
|
|
29
|
+
- **Benchmark suite** (`benchmarks/benchmark.py`) — 9 text types, LZ4, combined pipeline
|
|
30
|
+
- **66 passing tests** (`tests/test_rust_cave_001.py`) — includes direct `normalize_present_tense` tests (26 new)
|
|
31
|
+
- **ATTRIBUTION.md** — credits upstream SPEC repos
|
|
32
|
+
- **Verb maps**: 94 unique entries (transform_active_voice) + 147 unique entries (normalize_present_tense)
|
|
33
|
+
|
|
34
|
+
### Latest Audit Findings Addressed (v0.2.1)
|
|
35
|
+
- ✅ Deduplicated verb conjugation maps (removed 27 duplicate entries)
|
|
36
|
+
- ✅ Bumped Cargo.toml/pyproject.toml v0.2.0 → v0.2.1
|
|
37
|
+
- ✅ De-hermesified pyproject.toml description for public consumption
|
|
38
|
+
- ✅ Fixed build.rs DEP_PYO3_ABI3 check (PY312 → PY310)
|
|
39
|
+
- ✅ Updated BENCHMARKS.md version reference (v0.1.0 → v0.2.1)
|
|
40
|
+
- ✅ Updated README.md verb count (~60 → ~100)
|
|
41
|
+
- ✅ Added 26 direct tests for normalize_present_tense (irregular, regular, same-form, capitalization)
|
|
42
|
+
- ✅ Removed dead code comment in preprocess_text
|
|
43
|
+
- ✅ CI formatting fixed (`cargo fmt` pass on build.rs + lib.rs)
|
|
44
|
+
|
|
45
|
+
### Latest Feature (v0.2.1+)
|
|
46
|
+
- ✅ **Input text classifier** (`src/classifier.rs`) — detects technical, conversational, academic, dialogue, minimal, mixed text types using 13 heuristic dimensions. Exposed as Python-callable `classify_text()` and `recommended_strategy_for_text()`.
|
|
47
|
+
|
|
48
|
+
### Next Steps (priority order)
|
|
49
|
+
1. **Wire classifier into compress()** — use `recommended_strategy()` to select rule subset per input type
|
|
50
|
+
2. **Auto-benchmark oracle** — measure which strategy wins for each text domain
|
|
51
|
+
3. **Publish to PyPI** — needs API token from pypi.org/manage/account/token/
|
|
52
|
+
4. **MCP server integration** — expose as MCP tool (reference: squeez architecture)
|
|
53
|
+
5. **Add Python tests for classifier** — test classify_text() and recommended_strategy_for_text()
|
|
54
|
+
6. **Expand verb map** — 94 → 150+ unique entries in transform_active_voice
|
|
55
|
+
|
|
56
|
+
### Upstream Repos to Watch
|
|
57
|
+
| Repo | Why | Absorb When |
|
|
58
|
+
|------|-----|-------------|
|
|
59
|
+
| wilpel/caveman-compression | Direct SPEC upstream, MLM/LLM modes | Framework phase |
|
|
60
|
+
| JuliusBrussee/caveman (37K ⭐) | Market validation, /caveman-compress | Post-framework |
|
|
61
|
+
| claudioemmanuel/squeez (~2K ⭐) | MCP server architecture, Rust hooks | Framework phase |
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Contributing Guide
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to rust-cave-001! This document will help you get started.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
1. Fork the repository on GitHub
|
|
8
|
+
2. Clone your fork:
|
|
9
|
+
```bash
|
|
10
|
+
git clone https://github.com/YOUR_USERNAME/rust-cave-001.git
|
|
11
|
+
cd rust-cave-001
|
|
12
|
+
```
|
|
13
|
+
3. Set up a Python virtual environment (recommended):
|
|
14
|
+
```bash
|
|
15
|
+
python3 -m venv .venv
|
|
16
|
+
source .venv/bin/activate
|
|
17
|
+
pip install maturin pytest
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Building
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Development build
|
|
24
|
+
maturin develop
|
|
25
|
+
|
|
26
|
+
# Release build
|
|
27
|
+
maturin develop --release
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Running Tests
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pytest tests/ -v
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Code Quality
|
|
37
|
+
|
|
38
|
+
- Run `cargo fmt` and `cargo clippy` before committing
|
|
39
|
+
- Ensure all tests pass before submitting a PR
|
|
40
|
+
- Add tests for new features
|
|
41
|
+
|
|
42
|
+
## Pull Request Process
|
|
43
|
+
|
|
44
|
+
1. Create a feature branch: `git checkout -b feature/my-feature`
|
|
45
|
+
2. Make your changes and add tests
|
|
46
|
+
3. Run the full test suite
|
|
47
|
+
4. Commit with a clear message
|
|
48
|
+
5. Push and open a Pull Request
|
|
49
|
+
|
|
50
|
+
## Code of Conduct
|
|
51
|
+
|
|
52
|
+
Be respectful and constructive. We welcome contributors of all skill levels.
|
|
53
|
+
|
|
54
|
+
## Questions?
|
|
55
|
+
|
|
56
|
+
Open a GitHub Discussion or Issue. We are happy to help.
|