g2p#

(s3prl.dataio.encoder.g2p)

Basic G2P

Authors:
  • Heng-Jui Chang 2022

G2P#

class s3prl.dataio.encoder.g2p.G2P(file_list: Optional[List[str]] = None, allow_unk: bool = False)[source][source]#

Bases: object

Grapheme-to-phoneme

Parameters:
  • file_list (List[str], optional) – List of lexicon files. Defaults to None.

  • allow_unk (bool) – If false, raise Error when a word can not be recognized by this basic G2P

encode(text: str) str[source][source]#

Converts grapheme-based sentences to phonemes

Parameters:

text (str) – Sentence

Returns:

Phonemized sentence

Return type:

str