WordData can give you the IPA form of a word:
Gather[
WordData[#, "PhoneticForm"] & /@ {"pray", "prey", "wade", "weighed"}
]
(* {{"pr'ey", "pr'ey"}, {"w'eyd", "w'eyd"}} *)
EDIT
It seems WordData[word, "PhoneticForm"] no longer provides the proper IPA, however that data is still included in the paclet so we can make a new WordData property for that. (or override the the current PhoneticForm)
The IPA data is stored in a file called "IPAPronunciation.wdx" which contains a dispatch table with the "word"->"ipa" rules. It does not contain a _ -> Missing["NotAvailable"] so that is added.
Module[{
ipapath = FileNames@FileNameJoin[
{$UserBasePacletsDirectory,(*$ avoid SE indentation bug *)
"Repository", "WordData_IPAPronunciation-*", "Data", "IPAPronunciation.wdx"}],
iparules},
If[Quiet[Head[WordData["a", "IPA"]] =!= WordData] ||
ipapath == {} || ! FileExistsQ[Last@ipapath],
Return[$Failed, Module]];
iparules = Dispatch[Append[
Import[Last@ipapath][[2, 1]],
_ -> Missing["NotAvailable"]]];
Unprotect[WordData];
WordData[word_String, "IPA"] := word /. iparules;
DownValues[WordData] = RotateRight[DownValues[WordData]];
Protect[WordData];
]
WordData[#, "IPA"] & /@ {"pray", "prey", "wade", "weighed"}
(* {"prˈeɪ", "prˈeɪ", "wˈeɪd", "wˈeɪd"} *)
Some things used in above code:
Overloading second argument of CountryData
What can I use as the second argument to Return in my own functions?
If there is a neat way to add a rule to a dispatch table without redoing the Dispatch call feel free to edit.
WordData["smith","PhoneticForm"]– ssch Sep 11 '13 at 20:11