feat: V1.0 neural reranker (bert-tiny-chinese ONNX)#4
Merged
Conversation
- viterbi.rs: BIGRAM_WEIGHT 0.15 → 0.20 (context-sensitive disambiguation) - user_data.rs: runtime %APPDATA%\Migao\user_supplement.tsv loading - dict.rs: parse_tsv_into refactor; loads user supplement at startup - main.rs: new \migao report <garbled> <correct>\ subcommand - lib.rs: expose user_data module
- bopomofo.rs: chifan / cesuo / shizuo require neural reranker to pass
- Add src/reranker.rs: masked PLH scoring via ckiplab/bert-tiny-chinese (ONNX Runtime load-dynamic); global OnceLock with Mutex<Session> - Add src/tokenizer.rs: character-level BERT tokenizer with MASK_ID - Reranker uses minimum-margin threshold (0.40 nats) to avoid overriding Viterbi when BERT confidence is low (e.g. 遍/變 blocked, 實作/十座 accepted) - dict.rs: auto-modernise 喫→吃 at load time (799 compound entries) - supplement.tsv: add 裡/哪裡/這裡/那裡 modern variant entries - Cargo.toml: add ort=2.0.0-rc.12 (load-dynamic+ndarray), ndarray=0.17 - All 57 tests pass; eval tests test_eval_chifan/cesuo/shizuo all pass Bump version 0.5.0 → 1.0.0
386be37 to
0bf8d68
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.
Summary
ckiplab/bert-tiny-chineseONNX (≈45 MB),使用 masked PLH 對 Viterbi top-5 重新排序,透過 ONNX Runtimeload-dynamic載入,若模型檔不存在則優雅降級dict.rs載入時自動將所有 799 個喫條目映射為高優先吃版本裡/哪裡/這裡/那裡 現代變體條目通過的測試
test_eval_chifan: 你吃飯了嗎 ✅(字典現代化修正)test_eval_cesuo: 請問廁所在哪裡 ✅(supplement 修正)test_eval_shizuo: 這個功能還沒實作 ✅(reranker 修正,PLH diff 0.57)test_mass_zaishuo: 你可以再說一遍嗎 ✅(閾值保護,迴歸未發生)模型安裝(使用者端)
🤖 Generated with Claude Code