Given two words x and y, I'd like to find the set of all words that rhyme with x and are synonymous with y. Is this possible with WordData
or WolframAlpha
?
2 Answers
$\begingroup$
$\endgroup$
Here's a start....
x = "healed";
y = "pay";
Intersection[
WolframAlpha["synonyms of " <> y, {{"Synonyms:WordData", 1}, "ComputableData"}, InputAssumptions -> {"*MC.%7E-_*WordData-"}],
WolframAlpha["rhymes with " <> x, {{"Rhyme:WordData", 1}, "ComputableData"},
PodStates -> {"Rhyme:WordData__More"}, InputAssumptions -> {"*MC.%7E-_*WordData-"}]
]
{yield}
Meh, this isn't exhaustive, but it's as good as W|A can do it seems.
$\begingroup$
$\endgroup$
I found that wolfram|Alpha wasn't good enough, by RhymeZone is a great site for this, and they even support near rhymes. Here's an example:
Rhymes[r_] := Rhymes[r] = Module[{url, links, rhy},
url=StringTemplate["http://www.rhymezone.com/r/rhyme.cgi?Word=`1`&typeofrhyme=perfect&org1=syl&org2=l&org3=y"][r];
Check[links=Import[url,"Hyperlinks"],Return@$Failed];
rhy=Flatten[StringCases[#,"http://www.rhymezone.com/r/d="~~w__:>StringReplace[w,"_"->" "]]&/@links];
Return @ rhy
]
Synonyms[s_] := Synonyms[s] = Module[{url, links, syn},
url=StringTemplate["http://www.rhymezone.com/r/rhyme.cgi?Word=`1`&typeofrhyme=syn&org1=syl&org2=l&org3=y"][s];
Check[links=Import[url,"Hyperlinks"],Return@$Failed];
syn=Flatten[StringCases[#,"http://www.rhymezone.com/r/d="~~w__:>StringReplace[w,"_"->" "]]&/@links];
Return @ syn
]
RhymesWithXSynonymWithY[x_, y_] := Intersection[Rhymes@x, Synonyms@y]