learn_to_pronounce.addon.AddonManager

class learn_to_pronounce.addon.AddonManager(work_dir: str, locale: str)[source]

Manages addon creation, specifically adds all the necessary fields and artifacts. Addon later can be used with pronunciation_generation package. The work-flow - is that at each step of pronunciation learning recipe, addon is loaded, new artifact is added and addon is saved. In that way, one can restart addon building from any step.

__init__(work_dir: str, locale: str)[source]

constructor of addon manager

Parameters
work_dir: str

directory where all the temporal artifacts are stored

locale: str

locale of the pronunciation generation addon, for ex. en_us

add_lexicon(pd: PronunciationDictionary, graphemes: List[str], phonemes: List[str])[source]

Adds lexicon into addon. Also adds corresponding graphemes and phonemes

Parameters
pd: PronunciationDictionary

parsed lexicon that should be added into addon

graphemes: List[str]

list of valid graphemes (letters)

phonemes: List[str]

list of valid phonemes

add_pronunciation_fst(fst_path: str)[source]

Adds pronunciation FST into addon

Parameters
fst_path: str

path to FST model

add_spelling_fst(fst_path: str)[source]

Adds spelling FST into addon

Parameters
fst_path: str

path to FST model

save(path: str)[source]

Copies addon to the specified path

Parameters
path: str

path to copy addon to