Function Repository Resource:

FoodEntityCommonName

Source Notebook

Transform a food entity to its common name

Contributed by: Wolfram Staff

ResourceFunction["FoodEntityCommonName"][entity]

transforms an implicit food entity to its common name.

ResourceFunction["FoodEntityCommonName"][entityinstance]

transforms an implicit food entity and quantity to its common name and quantity.

Details and Options

FoodEntityCommonName can be applied to a single food entity, a list of entities, or a food entity and quantity, such as 6 ounces or 200 grams.
FoodEntityCommonName can be used with the yellow-box form of the food entity or the InputForm.
Food common names are useful for creating chart labels for visualizations and for communicating with an LLM about food, including recipe development.

Examples

Basic Examples (3) 

Apply FoodEntityCommonName to an implicit food entity:

In[1]:=
ResourceFunction[
 "FoodEntityCommonName", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][
Entity["Food", {EntityProperty["Food", "FoodType"] -> ContainsExactly[{
Entity["FoodType", "Salmon"]}], EntityProperty["Food", "AddedFoodTypes"] -> ContainsExactly[{}], EntityProperty["Food", "Preparation"] -> Entity[
    "FoodPreparation", "Grilled"]}]]
Out[1]=

The input form of a food entity is supported:

In[2]:=
ResourceFunction[
 "FoodEntityCommonName", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][
 Entity["Food", {EntityProperty["Food", "FoodType"] -> ContainsExactly[{Entity["FoodType", "OliveOil"]}], EntityProperty["Food", "AddedFoodTypes"] -> ContainsExactly[{}]}]]
Out[2]=

Apply FoodEntityCommonName to a list of food entities:

In[3]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/66680418-c5e9-46ce-936f-cf5009b78f93"]
Out[3]=

Scope (1) 

Apply FoodEntityCommonName to an EntityInstance of a food and quantity:

In[4]:=
ResourceFunction[
 "FoodEntityCommonName", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][
 EntityInstance[Entity[
  "Food", {EntityProperty["Food", "FoodType"] -> ContainsExactly[{
Entity["FoodType", "Flour"]}], EntityProperty["Food", "AddedFoodTypes"] -> ContainsExactly[{}], EntityProperty["Food", "Variety"] -> Entity[
     "FoodVariety", "AllPurpose"]}], Quantity[250, "Grams"]]]
Out[4]=

Neat Examples (2) 

Use FoodEntityCommonName to create labels for a BarChart:

In[5]:=
luteinFoods = {Entity[
   "Food", {EntityProperty["Food", "FoodType"] -> ContainsExactly[{
Entity["FoodType", "Kale"]}], EntityProperty[
      "Food", "AddedFoodTypes"] -> ContainsExactly[{}]}], Entity[
   "Food", {EntityProperty["Food", "FoodType"] -> ContainsExactly[{
Entity["FoodType", "Spinach"]}], EntityProperty[
      "Food", "AddedFoodTypes"] -> ContainsExactly[{}]}], Entity[
   "Food", {EntityProperty["Food", "FoodType"] -> ContainsExactly[{
Entity["FoodType", "MustardGreens"]}], EntityProperty[
      "Food", "AddedFoodTypes"] -> ContainsExactly[{}]}], Entity[
   "Food", {EntityProperty["Food", "FoodType"] -> ContainsExactly[{
Entity["FoodType", "CollardGreens"]}], EntityProperty[
      "Food", "AddedFoodTypes"] -> ContainsExactly[{}]}], Entity[
   "Food", {EntityProperty["Food", "FoodType"] -> ContainsExactly[{
Entity["FoodType", "Arugula"]}], EntityProperty[
      "Food", "AddedFoodTypes"] -> ContainsExactly[{}]}]};
luteinStrings = ResourceFunction[
   "FoodEntityCommonName", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"] /@ luteinFoods;
luteinValues = EntityValue[#, EntityProperty["Food", "RelativeLuteinPlusZeaxanthinContent"]] & /@ luteinFoods // N;
BarChart[luteinValues, AxesLabel -> "\[Mu]g/g", ChartLabels -> Placed[luteinStrings, Top, Rotate[#, Pi/4] &], ChartStyle -> ColorData["Crayola", "ForestGreen"], PlotLabel -> "Lutein in Leafy Greens"]
Out[6]=

Convert a list of ingredients to string names:

In[7]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/4d7f069c-f538-4ac7-b302-cd84eb27f2ae"]
Out[7]=

Pass the names to the LLM to create a recipe:

In[8]:=
LLMResourceFunction[
  "RecipeSuggest"][ingredients, "Include ingredients with amounts and instructions. No extra headings in the instructions. Add ingredients if needed for a complete recipe."]
Out[8]=

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 1.0.1 – 20 October 2025
  • 1.0.0 – 06 September 2024

Related Resources

License Information