App-Lingua-BO-Wylie-Transliteration
view release on metacpan or search on metacpan
lib/App/Lingua/BO/Wylie/Transliteration.pm view on Meta::CPAN
}
method _build_SUPERSCRIPT_RX { make_rx( $self->SUPERSCRIPT ) };
method _build_SUBSCRIPT_RX { make_rx( $self->SUBSCRIPT ) };
method _build_PRESCRIPT_RX { make_rx( $self->PRESCRIPT ) };
method _build_SCRIPT_RX { make_rx( $self->SCRIPT ) };
method _build_SCRIPT_SUBJ_RX { make_rx( $self->SCRIPT ) };
method _build_POSTSCRIPT1_RX { make_rx( $self->POSTSCRIPT1 ) };
method _build_POSTSCRIPT2_RX { make_rx( $self->POSTSCRIPT2 ) };
method _build_VOWEL_RX { make_rx( $self->VOWEL ) };
method _build_scheme {
qr"
(?:
(?<script> @{[ $self->SCRIPT_RX ]} )
(?<sub> @{[ $self->SUBSCRIPT_RX ]} ? )
(?<vowel> @{[ $self->VOWEL_RX ]} )
(?<post1> @{[ $self->POSTSCRIPT1_RX ]} ? )
(?<post2> @{[ $self->POSTSCRIPT2_RX ]} ? )
|
(?<pre> @{[ $self->PRESCRIPT_RX ]} ? )
(?<script> @{[ $self->SCRIPT_RX ]} )
(?<sub> @{[ $self->SUBSCRIPT_RX ]} ? )
(?<vowel> @{[ $self->VOWEL_RX ]} )
(?<post1> @{[ $self->POSTSCRIPT1_RX ]} ? )
(?<post2> @{[ $self->POSTSCRIPT2_RX ]} ? )
|
(?<super> @{[ $self->SUPERSCRIPT_RX ]} ? )
(?<script> @{[ $self->SCRIPT_RX ]} )
(?<sub> @{[ $self->SUBSCRIPT_RX ]} ? )
(?<vowel> @{[ $self->VOWEL_RX ]} )
(?<post1> @{[ $self->POSTSCRIPT1_RX ]} ? )
(?<post2> @{[ $self->POSTSCRIPT2_RX ]} ? )
|
(?<pre> @{[ $self->PRESCRIPT_RX ]} ? )
(?<super> @{[ $self->SUPERSCRIPT_RX ]} ? )
(?<script> @{[ $self->SCRIPT_RX ]} )
(?<sub> @{[ $self->SUBSCRIPT_RX ]} ? )
(?<vowel> @{[ $self->VOWEL_RX ]} )
(?<post1> @{[ $self->POSTSCRIPT1_RX ]} ? )
(?<post2> @{[ $self->POSTSCRIPT2_RX ]} ? )
)
"ix
};
method transliterate($word) {
no strict;
no warnings;
my $output =
$word =~ s( @{[$self->scheme]} )[
my $o;
my $pre //= $+{pre };
my $super //= $+{super };
my $sub //= $+{sub };
my $script //= $+{script };
my $vowel //= $+{vowel };
my $post1 //= $+{post1 };
my $post2 //= $+{post2 };
# say "word : $word ";
# say "pre : $pre ";
# say "super : $super ";
# say "script: $script";
# say "sub : $sub ";
# say "vowel : $vowel ";
# say "post1 : $post1 ";
# say "post2 : $post2 ";
$o .= $self->PRESCRIPT -> {uc $pre} if defined $pre;
$o .= $self->SUPERSCRIPT -> {uc $super} if defined $super;
$o .= $self->SCRIPT_SUBJ -> {uc $script} if defined $script and defined $super;
$o .= $self->SCRIPT -> {uc $script} if defined $script and $super eq '';
$o .= $self->SUBSCRIPT -> {uc $sub} if defined $sub;
$o .= $self->VOWEL -> {uc $vowel} if defined $vowel and not uc($vowel) eq 'A';
$o .= $self->POSTSCRIPT1 -> {uc $post1} if defined $post1;
$o .= $self->POSTSCRIPT2 -> {uc $post2} if defined $post2;
return $o;
]giex;
return $output;
}
no Moo;
__END__
=pod
=head1 NAME
App::Lingua::BO::Wylie::Transliteration
=head1 VERSION
version 0.1.0
=head1 SYNOPSIS
Wylie transliterate can be used to transliterate words from Wylie Transliteration to (Classical) Tibetan (dbu med)
=for Pod::Coverage make_rx
=head1 BACKGROUND
When you have one (foreign) alphabet and would like to display it in a
different alphabet (example: Russian to Latin alphabet), you will
want to use a certain B<transliteration scheme>.
Just compare all the different names you can find "Dostojevski" transliterated
to, to see what enourmous differences there will be.
Now for the Classical Tibetan "dbu med" alphabet there exist two main
transliteration schemes:
=over
=item *
Library of Congress Transliteration
=item *
Wylie Transliteration
=back
Classical Tibetan alphabet itself works in a really interesting way.
( run in 0.574 second using v1.01-cache-2.11-cpan-d80b1682f3f )