line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lingua::Deva::Maps; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
75
|
use v5.12.1; |
|
6
|
|
|
|
|
33
|
|
|
6
|
|
|
|
|
272
|
|
4
|
6
|
|
|
6
|
|
33
|
use strict; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
258
|
|
5
|
6
|
|
|
6
|
|
31
|
use warnings; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
152
|
|
6
|
6
|
|
|
6
|
|
33
|
use utf8; |
|
6
|
|
|
|
|
123
|
|
|
6
|
|
|
|
|
32
|
|
7
|
6
|
|
|
6
|
|
173
|
use charnames ':full'; |
|
6
|
|
|
|
|
20
|
|
|
6
|
|
|
|
|
48
|
|
8
|
|
|
|
|
|
|
|
9
|
6
|
|
|
6
|
|
5884
|
use Lingua::Deva::Maps::IAST; |
|
6
|
|
|
|
|
21
|
|
|
6
|
|
|
|
|
328
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=encoding UTF-8 |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Lingua::Deva::Maps - Default maps setup for Lingua::Deva |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
6
|
|
|
6
|
|
82
|
use Exporter; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
459
|
|
20
|
6
|
|
|
6
|
|
6267
|
use parent 'Exporter'; |
|
6
|
|
|
|
|
2473
|
|
|
6
|
|
|
|
|
32
|
|
21
|
|
|
|
|
|
|
our @EXPORT_OK = qw( %Consonants %Vowels %Diacritics %Finals |
22
|
|
|
|
|
|
|
$Inherent $Virama $Avagraha ); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 SYNOPSIS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
use Lingua::Deva::Maps::IAST; # or |
27
|
|
|
|
|
|
|
use Lingua::Deva::Maps::ISO15919; # or |
28
|
|
|
|
|
|
|
use Lingua::Deva::Maps::HK; # or |
29
|
|
|
|
|
|
|
use Lingua::Deva::Maps::ITRANS; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $d = Lingua::Deva->new(map => 'HK'); |
32
|
|
|
|
|
|
|
say $d->to_deva('gaNezaH'); # prints 'गणेशः' |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 DESCRIPTION |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
This module defines the default transliteration mappings for L |
37
|
|
|
|
|
|
|
and is intended for internal use. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
It does, however, provide the namespace for the ready-made transliteration |
40
|
|
|
|
|
|
|
schemes, |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=over 4 |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=item C |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
International Alphabet of Sanskrit Transliteration (I), |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=item C |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Simplified ISO 15919 (I), |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item C |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Harvard-Kyoto (I), and |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=item C |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
ITRANS (I). |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=back |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Users can also furnish their own transliteration schemes, but these must |
63
|
|
|
|
|
|
|
follow the layout of the existing schemes which is described in the following. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Every transliteration scheme provides four hashes, C<%Consonants>, C<%Vowels>, |
66
|
|
|
|
|
|
|
C<%Diacritics> (diacritic vowel signs), and C<%Finals> (I, |
67
|
|
|
|
|
|
|
I, I). The L module relies on this |
68
|
|
|
|
|
|
|
subdivision for its parsing and aksarization process. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Inside these hashes the keys are Latin script tokens and the values are the |
71
|
|
|
|
|
|
|
corresponding Devanagari characters: |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
"bh" => "\N{DEVANAGARI LETTER BHA}" # in %Consonants |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
The hash keys ("tokens") must be in canonically decomposed form |
76
|
|
|
|
|
|
|
(L). For example a key "ç" ("c" with cedilla) needs |
77
|
|
|
|
|
|
|
to be entered as C<"c\x{0327}">, ie. a "c" with combining cedilla. If the |
78
|
|
|
|
|
|
|
transliteration scheme is case-insensitive, the keys must be lowercase. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
In addition to the required four hash maps, a boolean variable C<$CASE> may be |
81
|
|
|
|
|
|
|
present. If it is, it specifies whether case distinctions by default do have |
82
|
|
|
|
|
|
|
significance (S ≠ I>) or not (S = I>) in the scheme. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
The default mappings of a L object can be completely customized |
85
|
|
|
|
|
|
|
through the optional constructor arguments |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=over 4 |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item * |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
L, L, L, |
92
|
|
|
|
|
|
|
L, Latin to Devanagari maps, |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item * |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
L, L, L, |
97
|
|
|
|
|
|
|
L, Devanagari to Latin maps, and |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item * |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
L, case-sensitivity. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=back |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
The first eight of these serve to override the default transliteration |
106
|
|
|
|
|
|
|
mappings (or the one passed through the L |
107
|
|
|
|
|
|
|
is easiest to start by copying and modifying one of the existing maps. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
# Include the relevant module |
110
|
|
|
|
|
|
|
use Lingua::Deva::Maps::IAST; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
# Copy map, modify, then pass to the constructor |
113
|
|
|
|
|
|
|
my %c = %Lingua::Deva::Maps::IAST::Consonants; |
114
|
|
|
|
|
|
|
$c{"c\x{0327}"} = delete $c{"s\x{0301}"}; |
115
|
|
|
|
|
|
|
my $d = Lingua::Deva->new( C => \%c ); |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
It is the user's responsibility to make reasonable customizations; eg. the |
118
|
|
|
|
|
|
|
vowels (C) and diacritics (C) maps normally need to be customized in |
119
|
|
|
|
|
|
|
unison. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Aside from all this, C also defines the global variables |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=over 4 |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=item C<$Inherent> |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
the inherent vowel I, |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=item C<$Virama> |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
I ( ्), and |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=item C<$Avagraha> |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
I (ऽ), |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=back |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
which are unlikely to need configurability. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=cut |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
# Setup default maps |
144
|
|
|
|
|
|
|
*Consonants = \%Lingua::Deva::Maps::IAST::Consonants; |
145
|
|
|
|
|
|
|
*Vowels = \%Lingua::Deva::Maps::IAST::Vowels; |
146
|
|
|
|
|
|
|
*Diacritics = \%Lingua::Deva::Maps::IAST::Diacritics; |
147
|
|
|
|
|
|
|
*Finals = \%Lingua::Deva::Maps::IAST::Finals; |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
# Global variables |
150
|
|
|
|
|
|
|
our $Inherent = "a"; |
151
|
|
|
|
|
|
|
our $Virama = "\N{DEVANAGARI SIGN VIRAMA}"; |
152
|
|
|
|
|
|
|
our $Avagraha = "\N{DEVANAGARI SIGN AVAGRAHA}"; |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
1; |