paddlespeech.t2s.frontend.arpabet module

A phonology system with ARPABET symbols and limited punctuations. The G2P conversion is done by g2p_en.

Note that g2p_en does not handle words with hypen well. So make sure the input sentence is first normalized.

class paddlespeech.t2s.frontend.arpabet.ARPABET[source]

Bases: Phonetics

A phonology for English that uses ARPABET without stress as the phoneme vocabulary.

47 symbols = 39 phones + 4 punctuations + 4 special tokens(<pad> <unk> <s> </s>)

The current phoneme set contains 39 phonemes, vowels carry a lexical stress marker:

0 — No stress 1 — Primary stress 2 — Secondary stress

Phoneme Set:
Phoneme Example Translation

------- ------- ----------- AA odd AA D AE at AE T AH hut HH AH T AO ought AO T AW cow K AW AY hide HH AY D B be B IY CH cheese CH IY Z D dee D IY DH thee DH IY EH Ed EH D ER hurt HH ER T EY ate EY T F fee F IY G green G R IY N HH he HH IY IH it IH T IY eat IY T JH gee JH IY K key K IY L lee L IY M me M IY N knee N IY NG ping P IH NG OW oat OW T OY toy T OY P pee P IY R read R IY D S sea S IY SH she SH IY T tea T IY TH theta TH EY T AH UH hood HH UH D UW two T UW V vee V IY W we W IY Y yield Y IY L D Z zee Z IY ZH seizure S IY ZH ER

See http://www.speech.cs.cmu.edu/cgi-bin/cmudict for more details.

Attributes:
vocab_size

Vocab size.

Methods

__call__(sentence[, add_start_end])

Convert the input text sequence into pronunciation id sequence.

numericalize(phonemes)

Convert pronunciation sequence into pronunciation id sequence.

phoneticize(sentence[, add_start_end])

Normalize the input text sequence and convert it into pronunciation sequence. Args: sentence (str): The input text sequence.

reverse(ids)

Reverse the list of pronunciation id sequence to a 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.

phonemes = ['AA', 'AE', 'AH', 'AO', 'AW', 'AY', 'B', 'CH', 'D', 'DH', 'EH', 'ER', 'EY', 'F', 'G', 'HH', 'IH', 'IY', 'JH', 'K', 'L', 'M', 'N', 'NG', 'OW', 'OY', 'P', 'R', 'S', 'SH', 'T', 'TH', 'UW', 'UH', 'V', 'W', 'Y', 'Z', 'ZH']
phoneticize(sentence, add_start_end=False)[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.

punctuations = [',', '.', '?', '!']
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.

symbols = ['AA', 'AE', 'AH', 'AO', 'AW', 'AY', 'B', 'CH', 'D', 'DH', 'EH', 'ER', 'EY', 'F', 'G', 'HH', 'IH', 'IY', 'JH', 'K', 'L', 'M', 'N', 'NG', 'OW', 'OY', 'P', 'R', 'S', 'SH', 'T', 'TH', 'UW', 'UH', 'V', 'W', 'Y', 'Z', 'ZH', ',', '.', '?', '!']
property vocab_size

Vocab size.

class paddlespeech.t2s.frontend.arpabet.ARPABETWithStress[source]

Bases: Phonetics

A phonology for English that uses ARPABET with stress as the phoneme vocabulary.

77 symbols = 69 phones + 4 punctuations + 4 special tokens

Attributes:
vocab_size

Vocab size.

Methods

__call__(sentence[, add_start_end])

Convert the input text sequence into pronunciation id sequence. Args: sentence (str): The input text sequence.

numericalize(phonemes)

Convert pronunciation sequence into pronunciation id sequence.

phoneticize(sentence[, add_start_end])

Normalize the input text sequence and convert it into 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.

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.

phonemes = ['AA0', 'AA1', 'AA2', 'AE0', 'AE1', 'AE2', 'AH0', 'AH1', 'AH2', 'AO0', 'AO1', 'AO2', 'AW0', 'AW1', 'AW2', 'AY0', 'AY1', 'AY2', 'B', 'CH', 'D', 'DH', 'EH0', 'EH1', 'EH2', 'ER0', 'ER1', 'ER2', 'EY0', 'EY1', 'EY2', 'F', 'G', 'HH', 'IH0', 'IH1', 'IH2', 'IY0', 'IY1', 'IY2', 'JH', 'K', 'L', 'M', 'N', 'NG', 'OW0', 'OW1', 'OW2', 'OY0', 'OY1', 'OY2', 'P', 'R', 'S', 'SH', 'T', 'TH', 'UH0', 'UH1', 'UH2', 'UW0', 'UW1', 'UW2', 'V', 'W', 'Y', 'Z', 'ZH']
phoneticize(sentence, add_start_end=False)[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.

punctuations = [',', '.', '?', '!']
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.

symbols = ['AA0', 'AA1', 'AA2', 'AE0', 'AE1', 'AE2', 'AH0', 'AH1', 'AH2', 'AO0', 'AO1', 'AO2', 'AW0', 'AW1', 'AW2', 'AY0', 'AY1', 'AY2', 'B', 'CH', 'D', 'DH', 'EH0', 'EH1', 'EH2', 'ER0', 'ER1', 'ER2', 'EY0', 'EY1', 'EY2', 'F', 'G', 'HH', 'IH0', 'IH1', 'IH2', 'IY0', 'IY1', 'IY2', 'JH', 'K', 'L', 'M', 'N', 'NG', 'OW0', 'OW1', 'OW2', 'OY0', 'OY1', 'OY2', 'P', 'R', 'S', 'SH', 'T', 'TH', 'UH0', 'UH1', 'UH2', 'UW0', 'UW1', 'UW2', 'V', 'W', 'Y', 'Z', 'ZH', ',', '.', '?', '!']
property vocab_size

Vocab size.