Repository navigation
fix(s09): match kana words in the keyword memory-selection fallback - #661
Open
shuhuNB515 wants to merge 1 commit into
Open
shuhuNB515 wants to merge 1 commit into
shuhuNB515 wants to merge 1 commit into
Conversation
keyword_memory_selection is the fallback used when LLM-based memory selection fails, but its word regex only matched ASCII words and Han characters -- a kana-only Japanese query extracted zero words, so the fallback always returned [] for exactly the audience the chapter already targets (TEMPORARY_MEMORY_MARKERS includes Japanese markers, and every chapter ships a Japanese README). Extend the regex with the kana range (\u3040-\u30ff). English and Chinese tokenization is unchanged; the substring-scoring heuristic stays as-is. The embedded s09 source in the web registry is synced. Fixes shareAI-lab#655
This branch has not been deployed
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 #655
Problem
keyword_memory_selection(s09_memory/code.py:274-276) is the fallback used when LLM-based memory selection fails, but its word regex matches only ASCII words and Han characters:Hiragana/katakana (
\u3040–\u30ff) are not covered, so a kana-only Japanese query (e.g. 「インデントはどうやってる?」) extracts zero words and the fallback always returns[]— despite the chapter clearly targeting Japanese users (TEMPORARY_MEMORY_MARKERSatcode.py:51-70includes Japanese markers; every chapter ships a Japanese README).Fix
Add the kana range to the alternation:
English/Chinese tokenization is unchanged; the substring-scoring heuristic stays as-is. The embedded s09 source in
web/src/data/generated/versions.jsonis synced.Verification
Ran the real chapter module end-to-end:
keyword_memory_selectionwith a matching kana catalog entry →["style.md"];[](heuristic semantics unchanged).python3 -m pytest tests/— 503 passed, 118 subtests passed.Disclosed AI assistance: found and fixed during an AI-assisted review; verified end-to-end against the real module and stand behind the change.