Search code examples
phplinguisticsphoneticstranscription

Convert Arpabet to IPA with stress


I create a dictionary and have a problem with converting Arpabet representation of a word to IPA (International Phonetic Alphabet) with stress.

In Arpabet, you can find which vowel has a stress with the number after the vowel. For example, the word "upstairs" has the following Aprabet representation: AH0 P S T EH1 R Z. The number 1 after EH means that stress falls upon this vowel.

The problem:
I have to convert Arpabet to IPA keeping the stress, but in IPA format the stress is put not before the vowel, but before the whole syllable (see picture below), which in some cases may start with multiple consonants. So I have no idea how to do it programmatically.

enter image description here

Question: What is the best way to show IPA representation of the incoming word with a stress? I'm interested in a solution in any programming language, but most preferably in PHP.

P.S. sorry for my English. Just learning :)


Solution

  • In order to do this correctly, you need to parse the syllables of the given word. See this question for a discussion on syllable-parsing. Once you have parsed the syllables in the arpabet string, simply find the vowel with stress and assign the stress to the beginning of the syllable.