# How to measure the similarity the pronunciation of two words?

I would like to know how I could measure the pronunciation of two words. These two words are quite similar and differ only in one vowel. I know there is, e.g., the Hamming distance or the Levenshtein distance but they measure the "general" difference between words. I'm also interested in that but mainly I would like to know how they sound differently. I think there must be something like this to test text-to-speech results?

Best would even be an online source where I could just type in those two words.

There are a handful of tools available for manually comparing pronounciations, though all are limited in some way. Depending on your usecase, you might be interested in:

• Wikspeak: a tool that transcribes (single) words into IPA and generates a pronounciation. A web demo is available, though it’s a bit sensitive about browser versions.
• espeak-ng: provides a CLI tool that does text-to-speech or text-to-IPA transcription
# use the —-ipa flag to display the inferred IPA transcription
espeak-ng -v en-US --ipa "horse”
# => hˈɔːɹs
espeak-ng -v en-US --ipa "hoarse"
# => hˈoːɹs


If you want a more automated solution, you could look into python libraries like eng-to-ipa to do IPA transcription (including disambiguation when a word can map to multiple IPA transcriptions). You could then try applying edit distance measurements to the IPA transcriptions to estimate the similarity of the pronounciations.

• Thanks a lot! I know I didn't target this in my question but do you know if the IPA is used in text-to-speech? Means, do machines try to translate by making use of the IPA or are they "just" trained von human speech and the like?
– Ben
Jul 13, 2021 at 10:17
• In regard to Wikspeak: This, and I've seen 1-2 others, cannot apply the IPA to fantasy names. I wonder why is this? The IPA should be valid to any word and, e.g., Coca Cola or Pepsi works though they are fantasy names. But another fantasy word is unknown. Are they all are just using a lookup table? I thought the IPA is a kind of a system which should be applicable to "any" word?
– Ben
Jul 13, 2021 at 10:20
• @Ben About the use of IPA in text-to-speech engines: I’m not sure, but understanding is that most traditional text-to-speech engines use some smaller language-specific set of phonemes internally (the simplest engines being a lookup table from word to phonemes, then stringing together pre-recorded voice clips for each phoneme). Nowadays it may be possible to train end-to-end on text -> audio, but I imagine it’s usually easier to model the problem as text -> phoneme_sequence -> audio. (e.g. Mozilla’s TTS) Jul 14, 2021 at 9:30
• Mozilla’s TTS seems to use the phonemizer package for pre-processing text into a phoneme sequence that is given to a deep learning models as input, but at a glance it seems like it optionally allows passing a config flag to disable phoneme preprocessing. (see this text-to-model-input preprocessor function, text util module) Jul 14, 2021 at 9:36
• @Ben About Wikspeak and others not being able to transcribe fantasy names, you’re correct that they’re just using a lookup table (usually the CMU Pronouncing Dictionary for english). The challenge is that the pronounciation isn’t fully specified by the latin alphabet. In principle though it should be possible to guess a plausible IPA transcription for a fantasy name - here’s a deep learning model you could try. Jul 14, 2021 at 9:54