Lingua::PT::Capitalizer - Simple text capitalize.
version 0.001
use Lingua::PT::Capitalizer; my $text = q(ESCRITOR, JORNALISTA, CONTISTA E POETA JOAQUIM MARIA MACHADO DE ASSIS); say capitalize($text); # Output: # Escritor, Jornalista, Contista e Poeta Joaquim Maria Machado de Assis $text = q(comprehensive perl archive network (CPAN)); say capitalize($text, 1); # Output: # Comprehensive Perl Archive Network (CPAN)
use Lingua::PT::Capitalizer (); my $capitalizer = Lingua::PT::Capitalizer->new(); my $text = q(ESCRITOR, JORNALISTA, CONTISTA E POETA JOAQUIM MARIA MACHADO DE ASSIS); say $capitalizer->capitalize($text); # Output: # Escritor, Jornalista, Contista e Poeta Joaquim Maria Machado de Assis $text = q(comprehensive perl archive network (CPAN)); say $capitalizer->capitalize($text, 1); # Output: # Comprehensive Perl Archive Network (CPAN)
This module format strings in title-case mode using common typographic rules for proper names in Portuguese Language.
Receive one or two arguments and return a capitalized string. If the second argument is 1, the upper case words won't be affected.
1
A data structure with some articles and prepositions that normaly stay in lower case.
If text.txt is a file with names/titles to capitalize, the easiest way to capitalize all is:
perl -MLingua::PT::Capitalizer -wpE'$_=capitalize' text.txt
# Procedural Interface my %lc_always = %{Lingua::PT::Capitalizer::lc_always} # OO Interface my %lc_always = $capitalizer->{lc_always}
Ronaldo Ferreira de Lima aka jimmy <jimmy at gmail>.
Text::Capitalize.
To install Lingua::PT::Capitalizer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lingua::PT::Capitalizer
CPAN shell
perl -MCPAN -e shell install Lingua::PT::Capitalizer
For more information on module installation, please visit the detailed CPAN module installation guide.