Grapheme-to-Phoneme¶
Grapheme to Phoneme related modeling class
-
class
pororo.tasks.phoneme_conversion.
PororoG2pFactory
(task: str, lang: str, model: Optional[str])[source]¶ Bases:
pororo.tasks.utils.base.PororoFactoryBase
Conduct grapheme to phoneme conversion
English (g2p.en)
dataset: g2pE
metric: N/A
Korean (g2p.ko)
dataset: g2pK
metric: N/A
Japanese (g2p.ja)
dataset: romkan
metric: N/A
Chinese (g2p.zh)
dataset: g2pM (Park et al. 2020)
metric: N/A
- Parameters
- Returns
converted phoneme sentence
- Return type
Examples
>>> g2p = Pororo(task="g2p", lang="ko") >>> g2p("어제는 날씨가 맑았는데, 오늘은 흐리다.") '어제는 날씨가 말간는데, 오느른 흐리다.' >>> g2p("어제는 날씨가 맑았는데, 오늘은 흐리다.", align=True) [('어제는', '어제는'), ('날씨가', '날씨가'), ('맑았는데,', '말간는데,'), ('오늘은', '오느른'), ('흐리다.', '흐리다.')] >>> g2p_en = Pororo(task="g2p", lang="en") >>> g2p_en("I have $250 in my pocket.") ['AY1', ' ', 'HH', 'AE1', 'V', ' ', 'T', 'UW1', ' ', 'HH', 'AH1', 'N', 'D', 'R', 'AH0', 'D', ' ', 'F', 'IH1', 'F', 'T', 'IY0', ' ', 'D', 'AA1', 'L', 'ER0', 'Z', ' ', 'IH0', 'N', ' ', 'M', 'AY1', ' ', 'P', 'AA1', 'K', 'AH0', 'T', ' ', '.'] >>> g2p_zh = Pororo(task="g2p", lang="zh") >>> g2p_zh("然而,他红了20年以后,他竟退出了大家的视线。") 'ran2 er2 , ta1 hong2 le5 2 0 nian2 yi3 hou4 , ta1 jing4 tui4 chu1 le5 da4 jia1 de5 shi4 xian4 。' >>> g2p_zh("然而,他红了20年以后,他竟退出了大家的视线。", align=True) [('然', 'ran2'), ('而', 'er2'), (',', ','), ('他', 'ta1'), ('红', 'hong2'), ('了', 'le5'), ('2', '2'), ('0', '0'), ('年', 'nian2'), ...] >>> g2p_zh("然而,他红了20年以后,他竟退出了大家的视线。", align=True, tone=False) [('然', 'ran'), ('而', 'er'), (',', ','), ('他', 'ta'), ('红', 'hong'), ('了', 'le'), ('2', '2'), ('0', '0'), ('年', 'nian'), ...] >>> g2p_ja = Pororo(task="g2p", lang="ja") >>> g2p_ja("pythonが大好きです") 'python ga daisuki desu' >>> g2p_ja("pythonが大好きです", align=True) [('python', 'python'), ('が', 'ga'), ('大好き', 'daisuki'), ('です', 'desu')]
-
class
pororo.tasks.phoneme_conversion.
PororoG2PKo
(model, config)[source]¶ Bases:
pororo.tasks.utils.base.PororoSimpleBase
-
class
pororo.tasks.phoneme_conversion.
PororoG2PEn
(model, config)[source]¶ Bases:
pororo.tasks.utils.base.PororoSimpleBase
-
class
pororo.tasks.phoneme_conversion.
PororoG2PZh
(model, config)[source]¶ Bases:
pororo.tasks.utils.base.PororoSimpleBase