paddlespeech.t2s.frontend.phonectic module

class paddlespeech.t2s.frontend.phonectic.Chinese[source]

Bases: Phonetics

Normalize Chinese text sequence and convert it into ids.

Attributes
vocab_size

Vocab size.

Methods

__call__(sentence)

Convert the input text sequence into pronunciation id sequence. Args: sentence (str): The input text sequence. Returns: List[str]: The list of pronunciation id sequence.

numericalize(phonemes)

Convert pronunciation sequence into pronunciation id sequence. Args: phonemes(List[str]): The list of pronunciation sequence. Returns: List[int]: The list of pronunciation id sequence.

phoneticize(sentence)

Normalize the input text sequence and convert it into pronunciation sequence. Args: sentence(str): The input text sequence. Returns: List[str]: The list of pronunciation sequence.

reverse(ids)

Reverse the list of pronunciation id sequence to a list of pronunciation sequence. Args: ids (List[int]): The list of pronunciation id sequence. Returns: List[str]: The list of pronunciation sequence.

numericalize(phonemes)[source]

Convert pronunciation sequence into pronunciation id sequence. Args:

phonemes(List[str]): The list of pronunciation sequence.

Returns:

List[int]: The list of pronunciation id sequence.

phoneticize(sentence)[source]

Normalize the input text sequence and convert it into pronunciation sequence. Args:

sentence(str): The input text sequence.

Returns:

List[str]: The list of pronunciation sequence.

reverse(ids)[source]

Reverse the list of pronunciation id sequence to a list of pronunciation sequence. Args: ids (List[int]): The list of pronunciation id sequence. Returns:

List[str]: The list of pronunciation sequence.

property vocab_size

Vocab size.

class paddlespeech.t2s.frontend.phonectic.English(phone_vocab_path=None)[source]

Bases: Phonetics

Normalize the input text sequence and convert into pronunciation id sequence.

Attributes
vocab_size

Vocab size.

Methods

__call__(sentence)

Convert the input text sequence into pronunciation id sequence. Args: sentence(str): The input text sequence. Returns: List[str]: The list of pronunciation id sequence.

numericalize(phonemes)

Convert pronunciation sequence into pronunciation id sequence. Args: phonemes (List[str]): The list of pronunciation sequence. Returns: List[int]: The list of pronunciation id sequence.

phoneticize(sentence)

Normalize the input text sequence and convert it into pronunciation sequence. Args: sentence (str): The input text sequence. Returns: List[str]: The list of pronunciation sequence.

reverse(ids)

Reverse the list of pronunciation id sequence to a list of pronunciation sequence. Args: ids (List[int]): The list of pronunciation id sequence. Returns: List[str]: The list of pronunciation sequence.

get_input_ids

get_input_ids(sentence: str, merge_sentences: bool = False, to_tensor: bool = True) Tensor[source]
numericalize(phonemes)[source]

Convert pronunciation sequence into pronunciation id sequence. Args:

phonemes (List[str]): The list of pronunciation sequence.

Returns:

List[int]: The list of pronunciation id sequence.

phoneticize(sentence)[source]

Normalize the input text sequence and convert it into pronunciation sequence. Args:

sentence (str): The input text sequence.

Returns:

List[str]: The list of pronunciation sequence.

reverse(ids)[source]

Reverse the list of pronunciation id sequence to a list of pronunciation sequence. Args:

ids (List[int]): The list of pronunciation id sequence.

Returns:

List[str]: The list of pronunciation sequence.

property vocab_size

Vocab size.

class paddlespeech.t2s.frontend.phonectic.EnglishCharacter[source]

Bases: Phonetics

Normalize the input text sequence and convert it into character id sequence.

Attributes
vocab_size

Vocab size.

Methods

__call__(sentence)

Normalize the input text sequence and convert it into character id sequence. Args: sentence (str): The input text sequence. Returns: List[int]: List of a character id sequence.

numericalize(sentence)

Convert a text sequence into ids. Args: sentence (str): The input text sequence. Returns: List[int]: List of a character id sequence.

phoneticize(sentence)

Normalize the input text sequence. Args: sentence(str): The input text sequence. Returns: str: A text sequence after normalize.

reverse(ids)

Convert a character id sequence into text. Args: ids (List[int]): List of a character id sequence. Returns: str: The input text sequence.

numericalize(sentence)[source]

Convert a text sequence into ids. Args:

sentence (str): The input text sequence.

Returns:
List[int]:

List of a character id sequence.

phoneticize(sentence)[source]

Normalize the input text sequence. Args:

sentence(str): The input text sequence.

Returns:

str: A text sequence after normalize.

reverse(ids)[source]

Convert a character id sequence into text. Args:

ids (List[int]): List of a character id sequence.

Returns:

str: The input text sequence.

property vocab_size

Vocab size.

class paddlespeech.t2s.frontend.phonectic.Phonetics[source]

Bases: ABC

Methods

__call__(sentence)

Call self as a function.

numericalize

phoneticize

abstract numericalize(phonemes)[source]
abstract phoneticize(sentence)[source]