Text::UnAbbrev - Expand abbreviations and acronyms.
version 0.03
use Text::UnAbbrev; my $unabbrev = Text::UnAbbrev->new( language => q(pt_BR), domain => q(Geography), subdomain => q(unidade_federativa), ); my @expand = $unabbrev->lookup(q(SP)); # São Paulo
Text::UnAbbrev is a "dictionary-like" "domain-oriented" module.
Take one or two arguments and returns a array with expansions found in dict()
dict()
A hashref with dictionary. The first three hashref levels are language, domain and subdomain, fourth and last hashref level is abbreviation/acronym. Each entry ending in a arrayref of expansions. Normally, this arrayref contains only one element, perhaps, unfortunately, in the same subdomain, an abbreviation/acronym can have more then one expansion.
The language definition. The language definition adopted by this module looks like locale definitions ( pt_BR, en_US ...). If boolean-false, all languages are used in lookup operations.
The domain definition. If boolean-false, all domains are used in lookup operations.
The subdomain definition. If boolean-false, all domains are used in lookup operations.
my @language = keys %{ $unabbrev->{dict} };
my @domain = keys %{ $unabbrev->{dict}{pt_BR} };
my @subdomain = keys %{ $unabbrev->{dict}{pt_BR}{DateTime} };
$unabbrev->$_(undef) foreach qw[language domain subdomain]; my @lookup = $unabbrev->lookup( q(SP), q(with_origin) ); # or create a new object my $unabbrev2 = Text::UnAbbrev->new(); my @lookup = $unabbrev2->lookup( q(SP), q(with_origin) );
The output can be:
[ [0] { 'Service Pack' => { 'domain' => "technology", 'language' => "en_US", 'subdomain' => "information" } }, [1] { 'São Paulo' => { 'domain' => "Geography", 'language' => "pt_BR", 'subdomain' => "unidade_federativa" } }, [2] { 'Santo Padre' => { 'domain' => "Grammar", 'language' => "pt_BR", 'subdomain' => "pronome_tratamento" } } ]
Contains all dictionary data files.
Improve documentation
Expand dictionaries
Ronaldo Ferreira de Lima aka jimmy <jimmy at gmail>.
Lingua::PT::Abbrev
DateTime::Locale::pt_BR
To install Text::UnAbbrev, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::UnAbbrev
CPAN shell
perl -MCPAN -e shell install Text::UnAbbrev
For more information on module installation, please visit the detailed CPAN module installation guide.