fix: converge four-letter e-stems so base and inflected forms match - #84
Merged
Merged
Conversation
#82 fixed the -ed/-es under-stripping from #69 but regressed a different class: four-letter bases ending in e. normalizeTrailingE guarded on length > 4, so file kept its e while filed stemmed to fil, and the pair stopped matching. Five pairs that matched before #82 broke: base/based, file/filed, date/dated, size/sized, time/timed. Relaxing the guard to > 3 converges them. The result is still three characters, which is the minimum token length tokenizeText keeps, and the -s path is unaffected: a word ending in s but not es cannot leave a trailing e behind. Cost: note and here now stem onto the stop words not and her and are dropped. That is the second stop-word filter working as designed, and it buys consistency for base, code, file, size, date, time, line, mode, page and role. Extends the round-trip table in signals.test.ts from 5 to 18 pairs so the -ed, -ing, -es, -s and trailing-e rules cannot drift apart again. Ranking is unchanged: npm run evaluate holds at top-1 62.5% / top-3 87.5%, and the only golden-report movement is the displayed stem code -> cod, with identical scores, order and confidence. Closes #83 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Fixes #83.
#82 fixed the
-ed/-esunder-stripping reported in #69, but the new rule regressed a different class of words: four-letter bases ending ine. Five pairs that matched before #82 stopped matching.Cause
normalizeTrailingEguarded onlength > 4, so a four-letter base kept itsewhile its inflected form stemmed one character shorter:file(4) is not> 4, so it staysfile.filed->-ed->normalizeVerbStem("fil")->fil. No match.Fix
One guard,
> 4->> 3. The result is still three characters, which is the minimum token lengthtokenizeTextkeeps.The
-spath needs no change: a word ending insbut notescannot leave a trailingebehind, sonormalizeTrailingEwould be a no-op there.filesalready routes through the-esrule.Verified
Three-way against
tokenizeTextat 352ec03 (pre-#82), b1990da (merged), and this branch:based/basefiled/filedated/datesized/sizetimed/timecoding/codeEverything #82 fixed stays fixed —
failed/fail,boxes/box,routing/route,parsing/parse,stopped/stop,cached/cache,created/create,invoices/invoice. 19 of 20 pairs in my check now converge; the one that does not iscases/case, which is unrelated and unchanged —caseis itself inSTOP_WORDS, so it is dropped before stemming.Cost
noteandherenow stem onto the stop wordsnotandherand are dropped entirely. That is the second stop-word filter intokenizeTextworking as designed — the same mechanism that already dropsdoes->doe. It buys consistency forbase,code,file,size,date,time,line,mode,page, androle, which is a much better trade for a repository-routing tool.I considered keeping
noteby skipping the strip when the result is a stop word, but that leavesnote/notesinconsistent with each other and adds a branch for two words, so I left it out.Impact on ranking
None measurable.
npm run evaluateholds at top-1 62.5% / top-3 87.5% over 8 cases, byte-identical tomain.The only golden-report movement is a displayed stem in a reason string:
Scores (17 / 8 / 6), ordering, and confidence are unchanged. Reasons have always displayed stems rather than the original words (
ignor,valu,creat,invoicare already there), so this is consistent with existing output.Test
Extends the existing round-trip table in
signals.test.tsfrom 5 pairs to 18. Asserting that an inflected form and its base stem to the same set, rather than to a specific literal string, is what keeps the-ed,-ing,-es,-s, and trailing-erules from disagreeing again — the previous literal-string assertions only ever covered pairs that happened to work, which is how both this regression and the original #69 got through.npm run cipasses end to end locally, including the regenerated Action bundle.🤖 Generated with Claude Code