DSL::Entity::Geographics
DSL::Entity::Geographics
Raku grammar classes for geographic entities (names.)
Installation
From Zef ecosystem:
zef install DSL::Entity::Geographics
From GitHub:
zef install https://github.com/antononcube/Raku-DSL-Entity-Geographics.git
Examples
Basic entity name retrieval
Here we show how the entity ID is retrieved using an adjective:
use DSL::Entity::Geographics;
ToGeographicEntityCode('Brazilian');
# "Brazil"
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", [AAp4].
Here are few grammar parsing examples:
use DSL::Entity::Geographics::Grammar;
my $pCOMMAND = DSL::Entity::Geographics::Grammar.new;
$pCOMMAND.set-resources(DSL::Entity::Geographics::resource-access-object());
say $pCOMMAND.parse('Argentina', rule => 'geographic-entity-command');
#ERROR: Possible misspelling of 'argentine' as 'argentina'.
# ļ½¢Argentinaļ½£
# entity-country-adjective => ļ½¢Argentinaļ½£
# 0 => ļ½¢Argentinaļ½£
# word-value => ļ½¢Argentinaļ½£
say $pCOMMAND.parse('United States of America', rule => 'geographic-entity-command');
# ļ½¢United States of Americaļ½£
# entity-country-name => ļ½¢United States of Americaļ½£
# 0 => ļ½¢United States of Americaļ½£
# word-value => ļ½¢Unitedļ½£
# word-value => ļ½¢Statesļ½£
# word-value => ļ½¢ofļ½£
# word-value => ļ½¢Americaļ½£
References
[AAp1] Anton Antonov, DSL::Shared Raku package, (2020), GitHub/antononcube.
[AAp2] Anton Antonov, DSL::Entity::Jobs Raku package, (2021), GitHub/antononcube.
[AAp3] Anton Antonov, DSL::Entity::Foods Raku package, (2021), GitHub/antononcube.
[AAp4] Anton Antonov, DSL::English::FoodPreparationWorkflows Raku package, (2021), GitHub/antononcube.