Answers.Body: <p>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:</p>
  <ul>
  <li><a href="http://wikspeak.sourceforge.net/" rel="nofollow noreferrer">Wikspeak</a>: 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.</li>
  <li><a href="https://github.com/espeak-ng/espeak-ng" rel="nofollow noreferrer">espeak-ng</a>: provides a CLI tool that does text-to-speech or text-to-IPA transcription</li>
  </ul>
  <pre><code># use the —-ipa flag to display the inferred IPA transcription
  espeak-ng -v en-US --ipa &quot;horse”
  # =&gt; hˈɔːɹs
  espeak-ng -v en-US --ipa &quot;hoarse&quot;
  # =&gt; hˈoːɹs
  </code></pre>
  <p>If you want a more automated solution, you could look into python libraries like <a href="https://pypi.org/project/eng-to-ipa/" rel="nofollow noreferrer">eng-to-ipa</a> 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.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-13T10:17:58.040Z
Answers.Text: 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?
Answers.UserDisplayName: Ben
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-13T10:20:58.370Z
Answers.Text: 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?
Answers.UserDisplayName: Ben
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-14T09:30:04.860Z
Answers.Text: @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](https://github.com/mozilla/TTS/))
Answers.UserDisplayName: vlthr
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-14T09:36:41.283Z
Answers.Text: Mozilla’s TTS seems to use the [phonemizer](https://pypi.org/project/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](https://github.com/mozilla/TTS/blob/e9e07844b77a43fb0864354791fb4cf72ffded11/TTS/tts/utils/synthesis.py#L13) text-to-model-input preprocessor function, [text util module](https://github.com/mozilla/TTS/blob/e9e07844b77a43fb0864354791fb4cf72ffded11/TTS/tts/utils/text/__init__.py))
Answers.UserDisplayName: vlthr
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-14T09:54:50.503Z
Answers.Text: @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](https://colab.research.google.com/github/as-ideas/DeepPhonemizer/blob/main/dp/notebooks/Inference_Example.ipynb)’s a deep learning model you could try.
Answers.UserDisplayName: vlthr
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-14T10:23:27.217Z
Answers.Text: Thanks a lot again! How has "The challenge is that the pronounciation isn’t fully specified by the latin alphabet" to be understood? For almost the entire vocabulary there is a pronunciation (covered by the pronunciation alphabet), or not?
Answers.UserDisplayName: Ben
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-15T06:18:10.447Z
Answers.Text: For dictionary words there is indeed an easy “specification” - someone has catalogued all the sounds that native speakers tend to make for a given latin alphabet word and simply published that as a lookup table. However, humans are so good at learning pronunciation that it’s easy to forget how much we deviate from the “ideal” pronunciations of each latin character. E.g. `the` can be "thuh" /ðə/ or "thee" /ði/ ` based on context,  `refuse` can be /ˈɹɛfjuːs/ or /ɹɪˈfjuːz/ based on meaning (_garbage_/_refusal_), and the words `tough`, `cough`, `dough` and `bough` all have different `ough` sounds.
Answers.UserDisplayName: vlthr
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-15T06:32:23.373Z
Answers.Text: That’s why an lookup table created from empirical observation of native speakers in a given region is the only fully reliable way to map from a word (plus extra information like tense) to its pronounciation(s). When humans encounter unfamiliar words, we infer plausible sounds based not just on the letters but on intuitions about word evolution and even history, like “does the word look like a latin or french import?” (leading to weirdness like [hyperforeignisms](https://en.wikipedia.org/wiki/Hyperforeignism)). That’s why fantasy names are hard - how would fantasy Englishmen say Worcestershire?
Answers.UserDisplayName: vlthr
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-15T06:39:02.133Z
Answers.Text: The last one is a good one :) Thanks again!
Answers.UserDisplayName: Ben
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-13T06:45:15.740Z
Answers.LastActivityDate: 2021-07-13T06:45:15.740Z
Answers.UserDisplayName: vlthr
Body: <p>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 &quot;general&quot; 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?</p>
  <p>Best would even be an online source where I could just type in those two words.</p>
  
Tags: <natural-language-processing><natural-language-understanding><speech-synthesis>
Title: How to measure the similarity the pronunciation of two words?
UserDisplayName: Ben
ThreadText: # How to measure the similarity the pronunciation of two words?
  
  (Asked by: username_0 on 2021-07-07)
  
  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.
  
  **Tags:** natural-language-processing, natural-language-understanding, speech-synthesis
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-07-13. Score: 1 | Accepted answer
  
  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](http://wikspeak.sourceforge.net/): 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](https://github.com/espeak-ng/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](https://pypi.org/project/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.
  
  > **Comments:**
  > **username_0**: 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?  
  > **username_0**: 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?  
  > **username_1**: @username_0 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](https://github.com/mozilla/TTS/))  
  > **username_1**: Mozilla’s TTS seems to use the [phonemizer](https://pypi.org/project/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](https://github.com/mozilla/TTS/blob/e9e07844b77a43fb0864354791fb4cf72ffded11/TTS/tts/utils/synthesis.py#L13) text-to-model-input preprocessor function, [text util module](https://github.com/mozilla/TTS/blob/e9e07844b77a43fb0864354791fb4cf72ffded11/TTS/tts/utils/text/__init__.py))  
  > **username_1**: @username_0 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](https://colab.research.google.com/github/as-ideas/DeepPhonemizer/blob/main/dp/notebooks/Inference_Example.ipynb)’s a deep learning model you could try.  
  > **username_0**: Thanks a lot again! How has "The challenge is that the pronounciation isn’t fully specified by the latin alphabet" to be understood? For almost the entire vocabulary there is a pronunciation (covered by the pronunciation alphabet), or not?  
  > **username_1**: For dictionary words there is indeed an easy “specification” - someone has catalogued all the sounds that native speakers tend to make for a given latin alphabet word and simply published that as a lookup table. However, humans are so good at learning pronunciation that it’s easy to forget how much we deviate from the “ideal” pronunciations of each latin character. E.g. `the` can be "thuh" /ðə/ or "thee" /ði/ ` based on context,  `refuse` can be /ˈɹɛfjuːs/ or /ɹɪˈfjuːz/ based on meaning (_garbage_/_refusal_), and the words `tough`, `cough`, `dough` and `bough` all have different `ough` sounds.  
  > **username_1**: That’s why an lookup table created from empirical observation of native speakers in a given region is the only fully reliable way to map from a word (plus extra information like tense) to its pronounciation(s). When humans encounter unfamiliar words, we infer plausible sounds based not just on the letters but on intuitions about word evolution and even history, like “does the word look like a latin or french import?” (leading to weirdness like [hyperforeignisms](https://en.wikipedia.org/wiki/Hyperforeignism)). That’s why fantasy names are hard - how would fantasy Englishmen say Worcestershire?  
  > **username_0**: The last one is a good one :) Thanks again!  
  
  ---
  
  