route66h
(Alex D)
April 15, 2014, 10:38am
1
How to get the list of all fruits that begin with the letter m? (using Wolfram Alpha)
In SQL the query would be something like:
SELECT names FROM fruits WHERE names like "m%";
I wonder if there’s some way I can do this using Wolfram Alpha?
Result will be like this: Mango, Mandarin, Marachino, …, etc.
sblinder
(S M Blinder)
April 15, 2014, 5:59pm
2
Input “edible fruit” in Wolfram Alpha and expand list using more. Need to press “more” twice to get to names beginning in m.
route66h
(Alex D)
April 15, 2014, 8:00pm
3
It works. But is there a way to filter those names to view only those that start with the letter “m”? I’m interested in ability of WolframAlpha to make exact queries like SQL does.
shenghuiy
(Shenghui Yang)
April 15, 2014, 10:06pm
4
Use the WolframAlpha API in Mathematica give you the result:
data = WolframAlpha["edible Fruits", {{"Hyponym:WordData", 1}, "ComputableData"},
PodStates -> {"Hyponym:WordData__More", "Hyponym:WordData__More", "Hyponym:WordData__More", "Hyponym:WordData__More"}]
Filter the result:
In[27]:= Cases[data,x_/;StringMatchQ[x,"m"~~__]]
Out[27]= {mamey,mammee,mammee apple,mango,mangosteen,marang,marmalade plum,medlar,melon,mombin,monstera}
If you work with Python well, you can follow this link to create a list from the wolfram alpha API in general.
szhorvat
(Szabolcs Horvát)
April 16, 2014, 1:55pm
5
Is it possible to do this with a single call to WordData (which doesn’t need an internet connection once the data is downloaded)?
I can do it like this, but this looks more complicated than necesary:
data = Join @@ (WordData /@ WordData[]);
Cases[data, {_, "Noun", "EdibleFruit"}]
Some fruit, such as apple or pear, appear under “FalseFruit” but not “EdibleFruit”.
Wikipedia has a more complete listing if you’re interested.
Culinary fruits starting with “M”