10.4 Fix IPA pronunciations in Dictionary

Aug 29, '05 08:05:00AM

Contributed by: nohat

Tiger only hintThe Dictionary app, which debuted in 10.4, offers the ability to display pronunciations in (among other choices) US English (IPA) (International Phonetic Alphabet) in its preferences.

Unfortunately, the pronunciations given have some glaring errors. For example, the symbols for primary and secondary stress are swapped, and the symbol for the vowel sound of "cat" and "plan" is incorrect.

Thankfully, Apple had the forethought to keep the dictionary in an unencrypted XML format in /Library -> Dictionaries -> New Oxford American Dictionary.dict -> Contents -> dict_body. Thus, the following command will fix the dictionary in place:

$ perl -pi -e 's/\303\270/\303\246/g; tr/\313\214\313\210/\313\210\313\214/'\
 /Library/Dictionaries/New\ Oxford\ American\ Dictionary.dict/\
Contents/dict_body
Use -pi.bak (instead of -pi, after perl) if you want to make a backup of the dict_body file, which is 75 megabytes.

Note: This does break a few words which had their stress correctly marked originally, such as "Cupertino;" their stress is now backwards. It appears that the number of words with correct stress originally is a vanishingly small handful that were manually added by Apple, so while this fix doesn't fix everything, it makes most things correct.

Probably not many people care about IPA pronunciations, but for those of us who do, we really want them to be right! I also filed this as bugs 4225277 and 4225267 using bugreport.apple.com.

[robg adds: I tested this one by copying and pasting the above command, and it worked as described. I also manually backed up the dictionary, just in case...]

Comments (11)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20050823032821731