bootphon / phonemizer

Simple text to phones converter for multiple languages
https://bootphon.github.io/phonemizer/
GNU General Public License v3.0
1.18k stars 165 forks source link

Custom Pronunciation Dictionary #89

Open donand opened 2 years ago

donand commented 2 years ago

Is your feature request related to a problem? Please describe.

Is it possible to pass a custom pronunciation dictionary to the phonemize() function?

Describe the solution you'd like

For example, the sentence Hello Andrea how are you is transcribed to həlˈoʊ ˈændɹiə hˈaʊ ɑːɹ juː in en-us.

Let's say that I want a custom transcription for the word Andrea that is andrˈɛa and not ˈændɹiə, how could I do it?

By passing a dictionary with custom transcriptions this problem would be solved, but I don't know if it's possible to do it in espeak-ng. The dictionary would have entries like

andrea andrˈɛa
hello həlˈoʊ
...

Describe alternatives you've considered

Another solution could be to pass the word Andrea already transcribed in input in this way Hello {andrˈɛa} how are you, maybe tagged in some way, and get this in output həlˈoʊ andrˈɛa hˈaʊ ɑːɹ juː