#!/usr/bin/perl -s use utf8::all; use Lingua::PT::PLN; our ($v,$abc,$t); ## -t= type of syllabs ## -t=1 (as|sé:|di|o) (def) ## -t=2 (as|sé:|dio) ## -t=3 (a|ssé:|di|o) ## -v for verse syllabs ## -abc abc-musicnotation lyrics $t //= 1; while(<>){ my $x = accent({type=>$t},$_); if($abc){ for($x){ s/\|/-/g; s/://g; s/(ão:?)\h+(h?[aeiouáéíóú])/$1=$2/g; s/([aeouaáéíóú]:?)\h+(h?[aeiouáéíóú])/$1~$2/g; s/=/ /g; } } if($v){ for($x){ s/(ão:?)\h+(h?[aeiouáéíóú])/$1 | $2/g; s/([aeouaáéíóú]:?)\h+(h?[aeiouáéíóú])/$1_$2/g; s/(\w:?[,.!?]?)\h+(\w)/$1 | $2/g; } } print $x; } __END__ =encoding utf8 =head1 NAME pt-syllabes-split - devide syllabes and calculate accent =head1 SYNOPSIS pt-syllabes-split [options] files Options: -t=... select the type of syllabes -t=1 (as|sé:|di|o) (def) -t=2 (as|sé:|dio) ... good for translineation -t=3 (a|ssé:|di|o) ... good for phonetics -v for verse syllabs (FIXME: initial naif version) -abc calculate verse to abc-musicnotation lyrics agora eu vou-me embora agora embora inda não seja a hora will return a-go-ra~eu vou-me~em-bo-ra~a-go-ra em-bo-ra~in-da não se-ja~a ho-ra =head1 DESCRIPTION =head2 Option "-v" =head2 Option "-abc" This option is used to transform verses into abc-musicnotation lyrics. Accents are removed. Example: agora eu vou-me embora embora ainda não seja agora a hora will return a-go-ra~eu vou-me~em-bo-ra~em-bo-ra~a-in-da não se-ja~a-go-ra~a ho-ra (that still needs fixing) =head1 AUTHOR J.Joao Almeida, jj@di.uminho.pt =head1 SEE ALSO perl(1). =cut