DSL::Entity::Geographics

Grammars for geographic entities: countries, states, cities, ZIP codes, etc.

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.

DSL::Entity::Geographics v0.1.0

Grammars for geographic entities: countries, states, cities, ZIP codes, etc.

Authors

  • Anton Antonov

License

Artistic-2.0

Dependencies

DSL::Shared:ver<0.2.1+>

Test Dependencies

Provides

  • DSL::Entity::Geographics
  • DSL::Entity::Geographics::Actions::Bulgarian::Standard
  • DSL::Entity::Geographics::Actions::WL::Entity
  • DSL::Entity::Geographics::Actions::WL::System
  • DSL::Entity::Geographics::Grammar
  • DSL::Entity::Geographics::Grammar::EntityNames
  • DSL::Entity::Geographics::ResourceAccess

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.