DSL::Entity::Foods
Raku grammar classes for food and drink entities (food and drink names.)
Remark: The food entity names in this package were taken from an archived GitHub repository related to IBM's Watson engine.
I can no longer find that repository.
Installation
From Zef ecosystem:
zef install DSL::Entity::Foods
From GitHub:
zef install https://github.com/antononcube/Raku-DSL-Entity-Foods.git
Examples
use DSL::Entity::Foods;
say ToFoodEntityCode('banana split');
say ToFoodEntityCode('arizona ice tea');
say ToFoodEntityCode('high fructose corn syrup');
#ERROR: Possible misspelling of 'arizona iced tea' as 'arizona ice tea'.
# "WATSON_BananaSplit"
# "WATSON_ArizonaIcedTea"
# "WATSON_HighFructoseCornSyrup"
Grammar parsing
One of the main motivations for this package is to be able to use known country names and related adjectives
as grammar tokens. For example, in packages like "DSL::English::FoodPreparationWorkflows", [AAp2].
Here are few grammar parsing examples:
use DSL::Entity::Foods::Grammar;
my $pCOMMAND = DSL::Entity::Foods::Grammar.new;
$pCOMMAND.set-resources(DSL::Entity::Foods::resource-access-object());
say $pCOMMAND.parse('arizona iced tea', rule => 'food-entity-command');
# 「arizona iced tea」
# entity-food-name => 「arizona iced tea」
# 0 => 「arizona iced tea」
# entity-name-part => 「arizona」
# entity-name-part => 「iced」
# entity-name-part => 「tea」
say $pCOMMAND.parse('fried tomatoese', rule => 'food-entity-command');
#ERROR: Possible misspelling of 'fried tomatoes' as 'fried tomatoese'.
# 「fried tomatoese」
# entity-food-name => 「fried tomatoese」
# 0 => 「fried tomatoese」
# entity-name-part => 「fried」
# entity-name-part => 「tomatoese」
References
[AAp1] Anton Antonov,
DSL::Shared Raku package,
(2020),
GitHub/antononcube.
[AAp2] Anton Antonov,
DSL::English::FoodPreparationWorkflows Raku package,
(2021),
GitHub/antononcube.
[AAp3] Anton Antonov,
DSL::Entity::Jobs Raku package,
(2021),
GitHub/antononcube.