Commit 63d8edc
authored
feat: add 亿级 support and strip commas for Chinese TN (#337)
* fix: strip commas in numbers for Chinese TN Measure (#284)
Use cdrewrite to remove commas between digits before matching numbers
in the Measure rule, so western-formatted numbers like 1,000,000米
correctly normalize to 一百万米.
Note: numbers exceeding 万级 (>99,999,999) still need 亿级 support
in Cardinal (#223), which is tracked separately.
* feat: add 亿级 support and strip commas for Chinese TN (#223, #284)
- Extend Cardinal number FST to support 亿级 (9-13 digit numbers)
using two 4-digit blocks to prevent ambiguity with shorter numbers
- Strip commas between digits in Measure rule for western-formatted
numbers like 299,792,458米
- Refactor Cardinal: extract four_nonzero/four_any helpers, remove
redundant add_weight and rmpunct from number patterns
Examples:
299,792,458米 => 两亿九千九百七十九万二千四百五十八米
100000001 => 一亿零一
1,000,000米 => 一百万米1 parent 53156d2 commit 63d8edc
2 files changed
Lines changed: 26 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
43 | | - | |
| 42 | + | |
44 | 43 | | |
45 | | - | |
| 44 | + | |
46 | 45 | | |
47 | | - | |
| 46 | + | |
48 | 47 | | |
49 | | - | |
50 | | - | |
51 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
52 | 57 | | |
53 | 58 | | |
54 | 59 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
62 | 68 | | |
63 | 69 | | |
64 | | - | |
65 | | - | |
| 70 | + | |
66 | 71 | | |
67 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
68 | 75 | | |
69 | 76 | | |
70 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
| |||
0 commit comments