MontrealCorpusTools / Montreal-Forced-Aligner

Command line utility for forced alignment using Kaldi
https://montrealcorpustools.github.io/Montreal-Forced-Aligner/
MIT License
1.27k stars 242 forks source link

Converting one arbitrary word to phonems - G2P #263

Open diff7 opened 3 years ago

diff7 commented 3 years ago

Hi guys!

I have run everything with Russian dataset to get alignments. Then I used these alignments to train a speech synthesis model (Fast Speech 2) on phoneme level. But then I can't figure out how to convert an arbitrary word to phonemes. So far I used generated dictionary it works but it's limited.

I was looking at your code how you generate the dictionary but may be there is a better way to do it. Basically, I am looking for way to map one word to the same phonemes you use in g2p for Russian.

Thanks in advance!

mmcauliffe commented 3 years ago

Are you thinking like within a script? There's an example you might be able to use in the GUI widgets for generating pronunciations for single words: https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/blob/main/montreal_forced_aligner/gui/widgets.py#L1297, it would just be a matter of importing the PyniniDictionaryGenerator class, loading the G2P model, etc. You could also create single word text files and feed them in via the command line script mfa g2p ...: https://montreal-forced-aligner.readthedocs.io/en/latest/g2p_dictionary_generating.html#g2p-dictionary-generating