Skip to content

refactor: fix encoding and move str2bool to shared utils#352

Merged
pengzhendong merged 2 commits into
masterfrom
fix/misc-cleanup
Jun 9, 2026
Merged

refactor: fix encoding and move str2bool to shared utils#352
pengzhendong merged 2 commits into
masterfrom
fix/misc-cleanup

Conversation

@pengzhendong

@pengzhendong pengzhendong commented Jun 9, 2026

Copy link
Copy Markdown
Member

Summary

  • Add encoding="utf-8" to open() in CLI entry points (tn/main.py, itn/main.py) for Windows compatibility
  • Move str2bool from itn/main.py to tn/utils.py, removing TN's circular dependency on ITN

Test plan

  • All 1400 unit tests pass
  • CLI python -m tn and python -m itn work correctly
  • CI passes

…digit numbers (#283)

Replace phone_digits**3 | phone_digits**5 with an explicit phone.tsv
list of known short numbers (110, 119, 120, 12306, 10086, etc.).
This fixes 3-digit numbers like 500 being read as 五零零 instead of 五百.

11-digit mobile numbers (phone_digits**11) are unchanged.
- Add encoding="utf-8" to open() in tn/main.py and itn/main.py for
  Windows compatibility
- Move str2bool from itn/main.py to tn/utils.py to remove TN's
  dependency on ITN module
@pengzhendong pengzhendong merged commit eda83b9 into master Jun 9, 2026
1 check passed
@pengzhendong pengzhendong deleted the fix/misc-cleanup branch June 9, 2026 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant