Message Boards Message Boards

GROUPS:

How to get the list of all fruits that begin with the letter m?

Posted 9 years ago
9571 Views
|
5 Replies
|
10 Total Likes
|
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.
POSTED BY: Alex D
5 Replies
Posted 9 years ago
Wikipedia has a more complete listing if you're interested.
Culinary fruits starting with "M"
POSTED BY: Michael Hale
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.
POSTED BY: Shenghui Yang
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".
POSTED BY: Szabolcs Horvát
Posted 9 years ago
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. 
POSTED BY: Alex D
Input "edible fruit" in Wolfram Alpha and expand list using more. Need to press "more" twice to get to names beginning in m.
POSTED BY: S M Blinder
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract