espnet3.systems.f5tts.src.pinyin.text_to_pinyin_ids
Less than 1 minute
espnet3.systems.f5tts.src.pinyin.text_to_pinyin_ids
espnet3.systems.f5tts.src.pinyin.text_to_pinyin_ids(text: str, vocab_char_map: Dict[str, int]) → ndarray
F5’s exact mapping: tokenize then map each token, unknown -> 0.
- Parameters:
- text – One raw transcript.
- vocab_char_map – Mapping from
load_vocab_char_map().
- Returns: Token ids as an
int64array.
Example
>>> text_to_pinyin_ids("abz", {" ": 0, "a": 1, "b": 2})
array([1, 2, 0])NOTE
F5’s vocabulary has no <unk>, so an unknown token maps to index 0, which is the literal space. That is upstream’s behaviour and is kept deliberately for checkpoint compatibility, but it means out-of-vocab text degrades silently rather than raising.
