Repository navigation
Fix tone sandhi alignment when unknown characters are ignored - #386
Open
lanqing431 wants to merge 1 commit into
Open
lanqing431 wants to merge 1 commit into
lanqing431 wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
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.
PR 描述
预分词输入同时使用
tone_sandhi=True和errors='ignore'时,无拼音汉字的结果会被提前移除,但变调仍按原汉字位置索引。例如lazy_pinyin(['鿅不对'], tone_sandhi=True, errors='ignore')抛出IndexError。保留被忽略字符的空位置,完成变调和风格转换后才移除。变调在非空连续片段内处理,避免跨过被忽略的字符连读;支持
ToneSandhiMixin和UltimateConverter,以及返回None/空列表的 errors 回调。不改动三声及“一”“不”的既有语言学规则。自测
python -m pytest tests/ pypinyin/ --random-order:1142 passed,2 skipped,包含模块 doctest。python -m mypy --strict pypinyin:45 个源码文件通过。git diff --check通过。Python 3.12.10 / Windows。启用 coverage 的运行在收集未修改的生成词库时未能完成,本次不报告覆盖率;不带 coverage 的完整测试已通过。全文件 pre-commit 另发现原有
docs/CHANGELOG.rst缺末尾换行,该文件未纳入此修改。本修改由 Codex 协助实现与验证。