Discovering Wolfram Food through AI

Isabel Skidmore - Tommy Peters - Gay Wilson

Wolfram | Alpha
November 3, 2023

Introduction to Wolfram Food

We have nutritional information properties for over 450,000 foods and over 150 nutrients:

(Entity["Crustaceans, lobster, northern, raw", Entity["Food","CrustaceansLobsterNorthernRaw::bqdp2"], "Entity[\"Food\", \"CrustaceansLobsterNorthernRaw::bqdp2\"]", "food"])[{(EntityProperty["relative omega six fatty acid content", EntityProperty["Food","RelativeTotalOmegaSixFattyAcidContent"], "EntityProperty[\"Food\", \"RelativeTotalOmegaSixFattyAcidContent\"]"]),(EntityProperty["relative omega three fatty acid content", EntityProperty["Food","RelativeTotalOmegaThreeFattyAcidContent"], "EntityProperty[\"Food\", \"RelativeTotalOmegaThreeFattyAcidContent\"]"]),(EntityProperty["relative butyric acid content", EntityProperty["Food","RelativeButyricAcidContent"], "EntityProperty[\"Food\", \"RelativeButyricAcidContent\"]"]),(EntityProperty["relative linoleic acid content", EntityProperty["Food","RelativeLinoleicAcidContent"], "EntityProperty[\"Food\", \"RelativeLinoleicAcidContent\"]"])},"Dataset"]

Food Classification and Data Structure

With a growing set of over 15,000 attributes and nearly 60 categories, we can represent a wide range of foods:

EntityValue[{(Entity["Apples, raw, red delicious, with skin", Entity["Food","ApplesRawRedDeliciousWithSkin::v353h"], "Entity[\"Food\", \"ApplesRawRedDeliciousWithSkin::v353h\"]", "food"]),(Entity["Da Vinci Gourmet Vanilla Syrup Sugar Free", Entity["Food","DaVinciGourmetVanillaSyrupSugarFree::ftgm3"], "Entity[\"Food\", \"DaVinciGourmetVanillaSyrupSugarFree::ftgm3\"]", "food"]),(Entity["Weight Watchers Blueberry Muffin", Entity["Food","WeightWatchersBlueberryMuffin::k48q8"], "Entity[\"Food\", \"WeightWatchersBlueberryMuffin::k48q8\"]", "food"])},"CategoricalPropertyValues","Dataset"]

Food Ontology Graph

Print@Row[{Show[,ImageSize->Scaled[0.45]],Column[{Style[Hyperlink[#],36,FontFamily->"Source Sans Pro"],Show[BarcodeImage[#,"QR"],ImageSize->Scaled[0.2]]},Alignment->Center]&["wolfr.am/foodgraph"]},Spacer[20]]

ChatGPT Wolfram Plugin

Access accurate food data and high level computation through Wolfram|Alpha and Wolfram Language:

ChatGPT Wolfram Plugin

Wolfram Food in Chat Notebooks

Wolfram Chat-Driven notebooks provide a variety of personas to assist with many tasks, including calculating nutrition using the ResourceFunction “NutritionReport”

Wolfram Food in Chat Notebooks

Wolfram Food in Chat Notebooks

We can then create visualizations with the data obtained, all without having to write a single line of code

Wolfram Food in Chat Notebooks

Clicking the red icon that appears when you hover over the code will create a cell below the chat cell containing the code, and evaluate it

(* create the associations *)
nutritionData=<|
  "Marinara Sauce"-><|"Fat"->5,"Protein"->1,"Carbs"->8|>,
  "Alfredo Sauce"-><|"Fat"->10,"Protein"->7,"Carbs"->9|>,
  "Barbecue Sauce"-><|"Fat"->0,"Protein"->0,"Carbs"->50|>
|>;

(* create the interactive pie chart *)
Manipulate[
PieChart[nutritionData[food],ChartLabels->Keys[nutritionData[food]],
  PlotLabel->food,ChartStyle->"Pastel"],
{{food,First@Keys[nutritionData],"Select Food"},Keys[nutritionData]}
]

Parsing Recipe Text

Parsing Recipe Text

(* Define the ingredients *)
ingredients=<|"Chicken Breasts"->Quantity[2,"Pieces"],
   "Red Bell Pepper"->Quantity[1,"Pieces"],
   "Green Bell Pepper"->Quantity[1,"Pieces"],
   "Onion"->Quantity[1,"Pieces"],
   "Vegetable Oil"->Quantity[2,"Tablespoons"],
   "Tortillas"->Missing["NotAvailable"],
   "Salt"->Missing["NotAvailable"],
   "Pepper"->Missing["NotAvailable"],
   "Cumin"->Quantity[1,"Teaspoons"],
   "Paprika"->Quantity[1,"Teaspoons"],
   "Garlic Powder"->Quantity[0.5,"Teaspoons"],
   "Onion Powder"->Quantity[0.5,"Teaspoons"],
   "Chili Powder"->Quantity[0.25,"Teaspoons"]|>;

(* Define the instructions *)
instructions={"Slice chicken and vegetables",
  "Mix fajita seasoning",
  "Cook chicken",
  "Remove chicken",
  "Cook vegetables",
  "Add chicken back",
  "Warm tortillas",
  "Fill tortillas"};

(* Define the edges *)
edges={DirectedEdge["Chicken Breasts","Slice chicken and vegetables"],
   DirectedEdge["Red Bell Pepper","Slice chicken and vegetables"],
   DirectedEdge["Green Bell Pepper","Slice chicken and vegetables"],
   DirectedEdge["Onion","Slice chicken and vegetables"],
   DirectedEdge["Slice chicken and vegetables","Cook chicken"],
   DirectedEdge["Vegetable Oil","Cook chicken"],
   DirectedEdge["Cumin","Mix fajita seasoning"],
   DirectedEdge["Paprika","Mix fajita seasoning"],
   DirectedEdge["Garlic Powder","Mix fajita seasoning"],
   DirectedEdge["Onion Powder","Mix fajita seasoning"],
   DirectedEdge["Chili Powder","Mix fajita seasoning"],
   DirectedEdge["Mix fajita seasoning","Cook chicken"],
   DirectedEdge["Cook chicken","Remove chicken"],
   DirectedEdge["Remove chicken","Cook vegetables"],
   DirectedEdge["Vegetable Oil","Cook vegetables"],
   DirectedEdge["Mix fajita seasoning","Cook vegetables"],
   DirectedEdge["Cook vegetables","Add chicken back"],
   DirectedEdge["Add chicken back","Warm tortillas"],
   DirectedEdge["Warm tortillas","Fill tortillas"],
   DirectedEdge["Tortillas","Warm tortillas"]};

(* Create the graph *)
Graph[Join[Keys[ingredients],instructions],edges,VertexLabels->"Name"]