espnet3.systems.f5tts.src.pinyin.register_f5_pinyin_g2p
Less than 1 minute
espnet3.systems.f5tts.src.pinyin.register_f5_pinyin_g2p
espnet3.systems.f5tts.src.pinyin.register_f5_pinyin_g2p() → None
Register g2p_type="f5_pinyin" into espnet2’s PhonemeTokenizer.
Lets CommonPreprocessor / build_tokenizer use F5’s pinyin tokenizer via token_type: phn, g2p_type: f5_pinyin (for the from-scratch case where you build your own vocab including a <unk> symbol). Idempotent.
- Returns:
None. The effect is the global registration.
Example
preprocessor:
_target_: espnet2.train.preprocessor.CommonPreprocessor
token_type: phn
g2p_type: f5_pinyinNOTE
This monkey-patches espnet2.text.phoneme_tokenizer, appending to g2p_choices and wrapping PhonemeTokenizer.__init__. Repeat calls are no-ops, so it is safe to call from several entry points. Use this path only when building your own vocab with a <unk>; to match F5’s fixed vocab.txt use F5PinyinPreprocessor instead, since ESPnet’s TokenIDConverter requires a <unk> that F5’s vocab lacks.
