Repository navigation
fix(wiki-mcp): preserve katakana prolonged mark and add multilingual zero-hit fallback - #253
Merged
humandebri merged 3 commits intoDec 3, 2026
Conversation
…zero-hit fallback
…ack dedupe keys, simplify helpers, and add PBT
humandebri
deleted the
fix/hub-router-katakana-and-multilingual-fallback
branch
December 3, 2026 06:37
humandebri
restored the
fix/hub-router-katakana-and-multilingual-fallback
branch
December 3, 2026 06:38
humandebri
deleted the
fix/hub-router-katakana-and-multilingual-fallback
branch
December 3, 2026 06:39
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
Fixes two generic multilingual routing & retrieval issues in
workers/wiki-mcp/src/hub-router.ts:Preserve Katakana prolonged sound mark (
ー/\u30FC):tokenizeMultilingualandCJK_TOKENsplit Katakana words atー(e.g.,フリーランス→フリ+ランス,メールアドレス→ルアドレス).\p{Script=Katakana}[\p{Script=Katakana}\u30FC]+, preserving valid Katakana words including short forms (キー) and NFKC-normalized half-width katakana (ルーター→ルーター) while rejecting standalone or leading prolonged marks (ーネ,ーーー).Multilingual zero-hit fallback recovery (
buildFallbackAttempts+needsSearchFallback):asciiTokensand only triggered when/Knowledge/index.mdwas the sole node. Natural-language CJK/multilingual queries (or datasets with canonical pages likeoverview.mdalongsideindex.md) skipped recovery.ctx.searchHits.length === 0, extracts catalog-matched keywords (preserving exact hiragana name/tag matches likeふるさと, collapsing nested CJK variants like个人信息保护法vs个人信息, and keeping ASCII-first retries when all ASCII query tokens match), and retries up to 2 attempts with error resilience (catching retry failures so the best prior context is preserved).Review & Verification
tsc --noEmit: 0 errors.vitest run: 18/18 test files, 342/342 tests passed (including randomized EN/CJK property tests, 411x inverted-index benchmark speedup, and JA/KO/ZH/EN/mixed fallback contract tests).