feat(pinyin): convert first of two third tones to second tone - #356
feat(pinyin): convert first of two third tones to second tone#356luojiyin1987 wants to merge 6 commits into
Conversation
📦 CDN vs Local 完整对比Updated at Sat, 22 Aug 2026 03:15:48 GMT 💡 提示: 此评论会在每次推送新提交时自动更新 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #356 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 29 29
Lines 26315 26364 +49
Branches 552 565 +13
=========================================
+ Hits 26315 26364 +49 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
PR Summary by Qodofeat(pinyin): apply third-tone sandhi for exactly two consecutive 3rd tones
AI Description
Diagram
High-Level Assessment
Files changed (10)
|
Code Review by Qodo
1. API size tables not updated
|
|
Thanks for your PR! |
|
Thanks for taking a look! That makes sense. Since toneSandhi is enabled by default, I agree that changing existing pronunciation behavior needs some care. No rush — please take your time. I'm happy to adjust the PR once you decide which behavior would be the best fit. |
Refs #286
Summary
originPinyinsotoneType: numreflects the change.toneSandhi: false.Examples
Out of scope
Triple third-tone runs need word boundary information. A follow-up design will cover 我很好,纸老虎,展览馆.
Verification
pnpm testpnpm --filter pinyin-pro lintpnpm build && pnpm sizePerformance
The first CI benchmark run (commit f0cfde6) reported a large regression signal. That run predates the fix below and is outdated.
getNumOfTone()classifier in the scan with a single lightweight regex test. The classifier did an array split plus up to six regex checks per character.pnpm comparemeasured 3.84 / 3.99 / 3.76 ms vs master 3.34 / 3.39 / 3.16 ms. The residual ~0.5 ms per full-text conversion (~15-19%) is the inherent cost of one extra pass over the result list whiletoneSandhidefaults to true.Bundle size: +279 B vs master (+0.09%).