paddlespeech.t2s.frontend.zh_frontend module

class paddlespeech.t2s.frontend.zh_frontend.Frontend(g2p_model='g2pW', phone_vocab_path=None, tone_vocab_path=None, use_rhy=False)[source]

Bases: object

Methods

add_sp_if_no(phonemes)

Prosody mark #4 added at sentence end.

get_phonemes(sentence[, merge_sentences, ...])

Main function to do G2P

get_phonemes_ssml(ssml_inputs[, ...])

Main function to do G2P with SSML support.

get_input_ids

get_input_ids_ssml

add_sp_if_no(phonemes)[source]

Prosody mark #4 added at sentence end.

get_input_ids(sentence: str, merge_sentences: bool = True, get_tone_ids: bool = False, robot: bool = False, print_info: bool = False, add_blank: bool = False, blank_token: str = '<pad>', to_tensor: bool = True) Dict[str, List[Tensor]][source]
get_input_ids_ssml(sentence: str, merge_sentences: bool = True, get_tone_ids: bool = False, robot: bool = False, print_info: bool = False, add_blank: bool = False, blank_token: str = '<pad>', to_tensor: bool = True) Dict[str, List[Tensor]][source]
get_phonemes(sentence: str, merge_sentences: bool = True, with_erhua: bool = True, robot: bool = False, print_info: bool = False) List[List[str]][source]

Main function to do G2P

get_phonemes_ssml(ssml_inputs: list, merge_sentences: bool = True, with_erhua: bool = True, robot: bool = False, print_info: bool = False) List[List[str]][source]

Main function to do G2P with SSML support.

paddlespeech.t2s.frontend.zh_frontend.insert_after_character(lst, item)[source]

inset item after finals.

paddlespeech.t2s.frontend.zh_frontend.intersperse(lst, item)[source]