speechio / chinese_text_normalization

Chinese text normalization for speech processing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

分数如何转换?

gbbin opened this issue · comments

“三分之二”转到“3/2”很容易做到,但是如何做到“三分之二”转到“2/3”? @xingchensong @dophist

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.

感谢帮助,把你的代码也看完了,收获很大。