Rand Stats

DSL::Entity::Geographics

zef:antononcube

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.