feat(nlp): zero-dep NLP compression phase, +11pp token savings - #2
Open
zamalali wants to merge 2 commits into
Open
feat(nlp): zero-dep NLP compression phase, +11pp token savings#2zamalali wants to merge 2 commits into
zamalali wants to merge 2 commits into
Conversation
|
@zamalali is attempting to deploy a commit to the chatde's projects Team on Vercel. A member of the Team first needs to authorize it. |
Zero-dependency NLP module integrated as Phase 2.5 in the compression
pipeline. Implements Porter stemmer, NPMI collocation scoring, TF-IDF
importance weighting, clause deduplication, modifier stripping, and
sentence compression.
Backwards-compatible: compress(text, { nlp: false }) for old behavior.
Benchmark (cl100k_base): 21.9% -> 33.1% average savings.
59 new tests, 324 total, all passing.
zamalali
force-pushed
the
feat/nlp-compression
branch
from
March 14, 2026 23:19
b757d66 to
61acdfa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 2.5: Zero-dependency NLP compression
Adds a new NLP compression phase to the pipeline that runs between word abbreviation (Phase 2) and pattern detection (Phase 3). Pure JavaScript, zero external dependencies.
What it does
Benchmark results (same 5 official prompts, gpt-tokenizer cl100k_base)
Safety guarantees (83 stress-test invariants)
Files changed (8)
Backwards compatible
NLP is enabled by default (nlp: true) but can be disabled per-call:
compress(text, { nlp: false })
324 tests pass. All existing behavior preserved.