分数如何转换?
gbbin opened this issue · comments
Binbin Gu commented
“三分之二”转到“3/2”很容易做到,但是如何做到“三分之二”转到“2/3”? @xingchensong @dophist
Xingchen Song(宋星辰) commented
we convert fractions with two-stage method:
- stage-1 : tag and construct fraction structure
- "三分之二" ==> “fraction { denominator: "3" frac: "/" numerator: "2" }”
- stage-2 : reorder and deconstruct
- “fraction { denominator: "3" frac: "/" numerator: "2" }” ==> “fraction { numerator: "2" frac: "/" denominator: "3" }” ==> "2/3"
We have impl this functionality for Chinese ITN in wenet-text-processing, feel free to have a try.
Note that wenet-text-processing is still in progress and it only support CN ITN currently. We plan to add rules for EN ITN/ EN TN/ CN TN, if u are interested in building those rules, any PR is welcomed.
Binbin Gu commented
感谢帮助,把你的代码也看完了,收获很大。