Food Preparation Workflows

In brief
This Raku Perl 6 package has grammar classes and action classes for the parsing and
interpretation of spoken commands that specify Food Preparation (FP) workflows.
It is envisioned that the interpreters (actions) are going to target different
programming languages: R, Mathematica, Python, Raku, etc.
This project is closely related to the project
SousChefSusana.
This diagram shows the conversational agent components this grammar addresses:

Installation
Standard/typical
From Zef ecosystem:
zef install DSL::English::FoodPreparationWorkflows
From GitHub:
zef install https://github.com/antononcube/Raku-DSL-English-FoodPreparationWorkflows.git
Manual installation
The preliminary versions of this package required manual installation.
These steps might be helpful for certain development efforts.
1. Install Raku : https://rakudo.org/downloads .
2. Make sure you have Zef Module Installer.
3. Open a command line program. (E.g. Terminal on Mac OS X.)
4. Run the commands:
zef install https://github.com/antononcube/Raku-DSL-Shared.git
zef install https://github.com/antononcube/Raku-DSL-Entity-English-Foods.git
zef install https://github.com/antononcube/Raku-DSL-Entity-English-Geographics.git
zef install https://github.com/antononcube/Raku-DSL-English-FoodPreparationWorkflows.git
Examples
Grammar parsing
Manual setup for parsing with the grammar provided by the package:
use DSL::English::FoodPreparationWorkflows;
use DSL::Entity::Foods;
use DSL::Entity::Geographics;
my $pCOMMAND = DSL::English::FoodPreparationWorkflows::Grammar;
$pCOMMAND.set-foods-resources(DSL::Entity::Foods::resource-access-object());
$pCOMMAND.set-geographics-resources(DSL::Entity::Geographics::resource-access-object());
$pCOMMAND.WHAT
# (Grammar)
Here is a "recommendation by profile" command parsing:
$pCOMMAND.parse('can you suggest a local cuisine')
# 「can you suggest a local cuisine」
# recommendations-by-profile-command => 「can you suggest a local cuisine」
# food-cuisine-spec => 「local cuisine」
# local-adjective => 「local」
Here is an "ingredients query" command parsing:
$pCOMMAND.parse('what number of dishes have low carbs')
# 「what number of dishes have low carbs」
# ingredient-query-command => 「what number of dishes have low carbs」
# ingredient-query-how-many-items-query => 「what number of dishes have low carbs」
# ingredient-query-body => 「dishes have low carbs」
# item-of-food-phrase => 「dishes 」
# dish-phrase => 「dishes」
# dishes-food-prep-word => 「dishes」
# ingredient-spec-list => 「low carbs」
# ingredient-spec => 「low carbs」
# low-adjective => 「low」
# carbs-food-prep-word => 「carbs」
Interpretation
The following commands give interpretations to a Wolfram Language (WL) recommender made based on
the WL paclet "MonadicSparseMatrixRecommender", [AAp4].
Here is a "recommendation by profile" command interpretation:
ToFoodPreparationWorkflowCode( 'i want to eat lunch from China', "WL-Ecosystem");
# smrSCS \[DoubleLongRightArrow]
# SMRMonRecommendByProfile[ {"PeriodMeal:lunch"} ] \[DoubleLongRightArrow]
# SMRMonJoinAcross["Warning"->False] \[DoubleLongRightArrow]
# SMRMonTakeValue[]
Another one:
ToFoodPreparationWorkflowCode( 'can you suggest dishes with protein', "WL-Ecosystem");
# smrSCS \[DoubleLongRightArrow]
# SMRRecommend[] \[DoubleLongRightArrow]
# SMRMonJoinAcross["Warning"->False] \[DoubleLongRightArrow]
# SMRMonTakeValue[]
Here is the interpretation of an "introspection query":
ToFoodPreparationWorkflowCode( 'show the timeline of when I ate Greek', "WL-Ecosystem");
# Block[{dsMeals=dsSCSMeals[Select[ ToLowerCase[#Cuisine] == "greek"&]]}, GroupBy[Normal@dsMeals, #UserID &, TimelinePlot[#Timestamp -> #PeriodMeal & /@ #, AspectRatio -> 1/4, ImageSize -> Large] &]]
TODO
These queries are not parsed or interpreted yet, but the future versions of the package would handle them:
Query for "what to cook now":
ToFoodPreparationWorkflowCode(
"what dish can i cook in the next two hours?;
why did you recommend that?",
"WL-Ecosystem");
Here is a more complicated, statistics pipeline specification:
ToFoodPreparationWorkflowCode(
"how many people ate dishes with feta last month;
what is the breakdown of calories over food groups;
where carbs are consumed the most;
plot the results;", "WL-Ecosystem")
Here is a recommendations (by collaborative filtering) specification:
ToFoodPreparationWorkflowCode(
"what people like me ate last week;
which of those I can cook tonight;
show me the ingredients and tools;", "WL-Ecosystem")
Here is the interpretation of an "ingredients query":
ToFoodPreparationWorkflowCode( 'what number of dishes do you know to have high protein', "WL-Ecosystem");
References
[AAp1] Anton Antonov,
DSL::Shared, Raku package,
(2020-2025),
GitHub/antononcube.
[AAp2] Anton Antonov,
DSL::Entity::Foods, Raku package,
(2021-2026),
GitHub/antononcube.
[AAp3] Anton Antonov,
DSL::Entity::Geographics, Raku package,
(2021-2024),
GitHub/antononcube.
[AAp4] Anton Antonov,
MonadicSparseMatrixRecommender, Wolfram Language paclet,
(2024),
Wolfram Language Paclet Repository.