• Stars
    star
    443
  • Rank 98,504 (Top 2 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created about 2 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Text Normalization & Inverse Text Normalization

Text Normalization & Inverse Text Normalization

0. Brief Introduction

WeTextProcessing: Production First & Production Ready Text Processing Toolkit

0.1 Text Normalization

Cover

0.2 Inverse Text Normalization

Cover

1. How To Use

1.1 Quick Start:

# install
pip install WeTextProcessing
# tn usage
>>> from tn.chinese.normalizer import Normalizer
>>> normalizer = Normalizer()
>>> normalizer.normalize("2.5平方电线")
# itn usage
>>> from itn.chinese.inverse_normalizer import InverseNormalizer
>>> invnormalizer = InverseNormalizer()
>>> invnormalizer.normalize("二点五平方电线")

1.2 Advanced Usage:

DIY your own rules && Deploy WeTextProcessing with cpp runtime !!

For users who want modifications and adapt tn/itn rules to fix badcase, please try:

git clone https://github.com/wenet-e2e/WeTextProcessing.git
cd WeTextProcessing
# `overwrite_cache` will rebuild all rules according to
#   your modifications on tn/chinese/rules/xx.py (itn/chinese/rules/xx.py).
#   After rebuild, you can find new far files at `$PWD/tn` and `$PWD/itn`.
python normalize.py --text "2.5平方电线" --overwrite_cache
python inverse_normalize.py --text "二点五平方电线" --overwrite_cache

Once you successfully rebuild your rules, you can deploy them either with your installed pypi packages:

# tn usage
>>> from tn.chinese.normalizer import Normalizer
>>> normalizer = Normalizer(cache_dir="PATH_TO_GIT_CLONED_WETEXTPROCESSING/tn")
>>> normalizer.normalize("2.5平方电线")
# itn usage
>>> from itn.chinese.inverse_normalizer import InverseNormalizer
>>> invnormalizer = InverseNormalizer(cache_dir="PATH_TO_GIT_CLONED_WETEXTPROCESSING/itn")
>>> invnormalizer.normalize("二点五平方电线")

Or with cpp runtime:

cmake -B build -S runtime -DCMAKE_BUILD_TYPE=Release
cmake --build build
# tn usage
cache_dir=PATH_TO_GIT_CLONED_WETEXTPROCESSING/tn
./build/processor_main --tagger $cache_dir/zh_tn_tagger.fst --verbalizer $cache_dir/zh_tn_verbalizer.fst --text "2.5平方电线"
# itn usage
cache_dir=PATH_TO_GIT_CLONED_WETEXTPROCESSING/itn
./build/processor_main --tagger $cache_dir/zh_itn_tagger.fst --verbalizer $cache_dir/zh_itn_verbalizer.fst --text "二点五平方电线"

2. TN Pipeline

Please refer to TN.README

3. ITN Pipeline

Please refer to ITN.README

Discussion & Communication

For Chinese users, you can aslo scan the QR code on the left to follow our offical account of WeNet. We created a WeChat group for better discussion and quicker response. Please scan the personal QR code on the right, and the guy is responsible for inviting you to the chat group.

Or you can directly discuss on Github Issues.

Acknowledge

  1. Thank the authors of foundational libraries like OpenFst & Pynini.
  2. Thank NeMo team & NeMo open-source community.
  3. Thank Zhenxiang Ma, 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 TN of NeMo for the data to build the tagger graph.
  6. Referred ITN of chinese_text_normalization for the data to build the tagger graph.

More Repositories

1

wenet

Production First and Production Ready End-to-End Speech Recognition Toolkit
Python
4,073
star
2

speech-synthesis-paper

List of speech synthesis papers.
989
star
3

wespeaker

Research and Production Oriented Speaker Verification, Recognition and Diarization Toolkit
Python
690
star
4

WenetSpeech

A 10000+ hours dataset for Chinese speech recognition
Shell
488
star
5

wekws

Production First and Production Ready End-to-End Keyword Spotting Toolkit
Python
444
star
6

wetts

Production First and Production Ready End-to-End Text-to-Speech Toolkit
Python
367
star
7

speech-recognition-papers

Towards hot directions in industrial end to end speech recognition
325
star
8

opencpop

Opencpop: A High-Quality Open Source Chinese Popular Song Database for Singing Voice Synthesis
207
star
9

wenet-kws

Production First and Production Ready End-to-End Keyword Spotting Toolkit
Python
142
star
10

west

We Speech Transcript based on LLM, in 300 lines of code.
Python
109
star
11

wesep

Target Speaker Extraction Toolkit
Python
80
star
12

wesignal

Production first, nn-based on-device signal processing toolkit.
63
star
13

WeTextProcessing.deprecated

C++
61
star
14

wesubtitle

用 OCR 提取视频硬字幕
Python
54
star
15

llm-papers

List of Large Lanugage Model Papers
51
star
16

wecut

video cut powered by AI
25
star
17

WeSpeech-AI

Open Source Speech/Text Data on AI
18
star
18

nn-singal-processing-papers

List of NN based singal processing papers
17
star
19

wenet_in_action_homework

WeNet 实战课程作业
Python
16
star
20

wenet-e2e.github.io

WeNet Community
CSS
1
star
21

wenet-contributors

Contributors of WeNet, including individual and companies.
1
star