README.md

September 27, 2022 · View on GitHub

Inverse Text Normalization

1. How To Use

$ python inverse_normalize.py --text "text to be denormalized"

2. ITN Pipeline

There are 2 components in ITN pipeline:

  • pre-processing (before tagger)
  • non-standard word denormalization

2.1 Pre-Processing

Pre-ProcessingRawDenormalizedNote
Blacklist (Removal)呃这个呃啊我不知道这个我不知道via data/default/blacklist.tsv

2.2 Non-Standard-Words (NSW) Denormalization

NSW typeRawDenormalizedNote
Numbers共四百六十五篇约三百一十五万字共465篇约315万字
共计六点四二万人共计6.42万人
幸运一百幸运100enable_standalone_number=True (default) (ref)
幸运一百enable_standalone_number=False
Fraction总量的五分之一以上总量的1/5以上
相当于头发丝的十六分之一相当于头发丝的1/16
Percentage同比增长百分之六点三同比增长6.3%
Date二零零二年一月二十八日2002/01/28
二零零二年一月2002/01
Time八月十六号十二点之前08/16 12点之前
我是五点零二分开始的我是5:02开始的
于五点三十五分三十六秒发射于5:35:36发射
早上八点半准时开会8:30a.m.准时开会
Math比分定格在七十八比九十六比分定格在78:96
计算负二的绝对值是二计算-2的绝对值是2enable_standalone_number=True (default)
计算负二的绝对值是二enable_standalone_number=False
正负二的平方都是四±2的平方都是4enable_standalone_number=True (default)
正负二的平方都是四enable_standalone_number=False
Money价格是十三点五元价格是¥13.5
价格是十三点五美元价格是$13.5
Measure重达二十五千克重达25kg
最高气温三十八摄氏度最高气温38°C
速度是每小时十公里速度是10km/h
一年后一年后exclue_one=True (default) (ref)
1年后exclue_one=False
Number series可以拨打幺二三零六来咨询可以拨打12306来咨询
Whitelist (Replacement)三心二意三心二意

Acknowledge

  1. Thank the authors of foundational libraries like OpenFst & Pynini.
  2. Thank NeMo team & NeMo open-source community.
  3. Thank Jiayu Du, and SpeechColab organization.
  4. Referred Pynini for reading the FAR, and printing the shortest path of a lattice in the C++ runtime.
  5. Referred ITN of chinese_text_normalization for the data to build the tagger graph.