[UPDATE] New Darwin's Day App for 2019 --> https://wolfr.am/BkFupgWe
Note: In this post I will show how to create THIS APP
Here what happens when you type a name:
Even Mathematica has its own spiecies! In this case Storena Mathematica is a spider:
Today is the Darwin Day! So, let's celebrate the Origin of the Species by creating a nice application. Do you know if there is any Species with your name? Let's find it out!
First, we need the list of Species with their Scientific Names. Luckily, the Wolfram Language has already built-in this information:
listofEntities = EntityList[EntityClass["Species", "Species"]]
species = Table[StringReplace[listofEntities[[i]][[2]], "Species:" -> ""], {i, Length[listofEntities]}]
Now, we want to split each scientific name in two words. Following the binomial nomenclature the second part identifies the species within the genus and it is the part we are interested in. Before splitting them we will use StringInsert to put a blank between the two parts.
listofSNames = Table[StringInsert[species[[i]], " ", StringPosition[species[[i]], _?UpperCaseQ][[2, 1]]], {i, Length[species]}];
There are couple of Species with a strange format but we will ignore them here and we use the StringSplit function:
listof2ndParts = StringSplit[list = Select[listofSNames, StringQ[#] &]][[All,2]];
So far, so good. Now, we can already apply our key function: Nearest which will find the closest Species Name to our given name:
Nearest[listof2ndParts, "Jofre", 1]
We can create a specific function for it, let's call it nameToSpecie:
nameToSpecie[name_] := Nearest[listof2ndParts, name, 1]
Finally, we can easily create a FormFunction and Deploy it to the Wolfram Cloud:
CloudDeploy[FormFunction[{"name" -> <|"Interpreter" -> "String", "Input" -> "Darwin"|>}, nameToSpecie[#name] &], "Permissions" ->"Public"]
Happy Darwin Day!
Have fun discovering new Species and let me know what Species do you get.
I got this spider called Cyclosa Jose: