refactor(eval): unify 3 eval-pipeline tokenizers via monolith bm25-memory.tokenize (PR-3 re-author)#7
Merged
jaytoone merged 1 commit intojaytoone:masterfrom May 10, 2026
Conversation
…mory.tokenize Per jaytoone#1 — re-author of PR jaytoone#3 (Draft hang-in/tunaCtx#3) directly into the upstream monolith path, since the boundary decision is to keep the package decomposition out of this functional cycle. Three eval sites stop defining their own `tokenize()` and load the canonical implementation from `src/hooks/bm25-memory.py` via `importlib.util` (the hyphenated filename rules out a normal `import`). Same loader pattern as the re-skinned PR-5 regression test. Sites converted: - benchmarks/eval/g1_docs_bm25_eval.py (was r'\d+[-–]\d+|\d+\.\d+|\w+') - benchmarks/eval/g1_longterm_baseline_eval.py (was r'\b\w+\b' — bm25 baseline) - benchmarks/eval/g2_docs_paraphrase_eval.py (was particle strip + decimal) Sites intentionally NOT converted (annotation rationale stays): - src/cli/telemetry.py — identifier-frequency stats, not BM25 ranking - src/retrieval/bm25_retriever.py — needs raw TF; canonical's dict.fromkeys() dedup would flatten code-search score distribution Once landed, eval and production go through the same tokenizer implementation, closing the eval/production divergence flagged in issue jaytoone#1. Validation: - All three files: AST OK - Monolith loader smoke test: tokenize('BM25와 검색하다 0.595') → ['bm25', 'bm25와', '검색하다', '0.595'] Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 10, 2026
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.
Summary
Re-author of Draft PR #3 directly into the upstream monolith path, per the boundary decision in #1 (comment 4414942453):
This PR keeps the
_bm25/package decomposition out and applies the eval/production tokenizer unification directly to the upstream paths.Sites converted
Three eval sites stop defining their own
tokenize()and load the canonical implementation fromsrc/hooks/bm25-memory.pyviaimportlib.util(the hyphenated filename rules out a normalimport). Same loader pattern as the re-skinned PR-5 regression test.benchmarks/eval/g1_docs_bm25_eval.pyr'\d+[-–]\d+|\d+\.\d+|\w+'benchmarks/eval/g1_longterm_baseline_eval.pyr'\b\w+\b'(bm25 baseline)benchmarks/eval/g2_docs_paraphrase_eval.py_KO_PARTICLES)After this PR, eval and production both go through the same
bm25-memory.tokenize().Sites intentionally NOT converted
Per the same #1 thread, two sites are kept divergent with annotated rationale:
src/cli/telemetry.pysrc/retrieval/bm25_retriever.pydict.fromkeys()dedup would flatten the score distribution on duplicate identifiers(These already have annotation comments in upstream — leaving as-is.)
Loader pattern
Validation
ast.parseOKtokenize('BM25와 검색하다 0.595')→['bm25', 'bm25와', '검색하다', '0.595']Closes / supersedes
Related: #1