line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Convert::CEGH::Transliterate; |
2
|
1
|
|
|
1
|
|
58012
|
use utf8; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
3
|
1
|
|
|
1
|
|
950
|
use Regexp::Ethiopic qw(:forms setForm); |
|
1
|
|
|
|
|
49196
|
|
|
1
|
|
|
|
|
10
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
BEGIN |
6
|
|
|
|
|
|
|
{ |
7
|
1
|
|
|
1
|
|
410
|
use base qw( Exporter ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
145
|
|
8
|
1
|
|
|
1
|
|
6
|
use vars qw( $COPTIC @EXPORT_OK $VERSION ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
98
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
3
|
@EXPORT_OK = qw( transliterate ); |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
|
|
2
|
$VERSION = "0.01"; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
|
|
60
|
$COPTIC = qr/[ϚCϢϤϦϨϬϮϪ]/; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub fromIPA |
19
|
|
|
|
|
|
|
{ |
20
|
4
|
|
|
4
|
0
|
10
|
my ($string, $script) = @_; |
21
|
|
|
|
|
|
|
|
22
|
4
|
|
|
|
|
15
|
$_ = $string; |
23
|
|
|
|
|
|
|
|
24
|
4
|
100
|
66
|
|
|
34
|
if ( $script =~ /^et/ ) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
25
|
1
|
|
|
|
|
8
|
tr/ʤʧΘv/ztzb/; |
26
|
1
|
|
|
|
|
5
|
s/k'/q/g; |
27
|
1
|
|
|
|
|
4
|
s/p'/P/g; |
28
|
1
|
|
|
|
|
4
|
s/s'/S/g; |
29
|
1
|
|
|
|
|
4
|
s/t'/T/g; |
30
|
1
|
|
|
|
|
3
|
s/d'/D/g; |
31
|
1
|
|
|
|
|
13
|
tr/abgdhwzħTjklmnsʕfSqrʃtξDPp/አበገደሀወዘሐጠየከለመነሠዐፈጸቀረሰተኀፀጰፐ/; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
elsif ( $script =~ /^he/ ) { |
34
|
1
|
|
|
|
|
9
|
tr/xfʤʧv/kpztb/; |
35
|
1
|
|
|
|
|
4
|
s/k'/q/g; |
36
|
1
|
|
|
|
|
4
|
s/s'/S/g; |
37
|
1
|
|
|
|
|
3
|
s/d'/d/g; |
38
|
1
|
|
|
|
|
32
|
s/p'/p/g; |
39
|
1
|
|
|
|
|
5
|
s/t'/t/g; |
40
|
1
|
|
|
|
|
3
|
s/ξ/h/g; |
41
|
1
|
|
|
|
|
9
|
tr/abgdhwzħΘjklmnsʕpSqrʃt/אבגדהוזחטיכלמנסעפצקרשת/; |
42
|
1
|
|
|
|
|
4
|
$_ = scalar reverse ( $_ ); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
elsif ( $script =~ /^el/ || $script =~ /^co/ ) { |
45
|
2
|
|
|
|
|
12
|
tr/ʤʧʕwv/ztabb/; |
46
|
2
|
|
|
|
|
7
|
s/ps/P/g; |
47
|
2
|
|
|
|
|
5
|
s/d'/d/g; |
48
|
2
|
|
|
|
|
5
|
s/p'/p/g; |
49
|
2
|
|
|
|
|
5
|
s/t'/t/g; |
50
|
2
|
|
|
|
|
5
|
s/ξ/h/g; |
51
|
2
|
|
|
|
|
16
|
tr/abgdazaΘaklmnxaprstafʧPa/ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΧΨΩ/; |
52
|
|
|
|
|
|
|
# |
53
|
|
|
|
|
|
|
# this is broken, the coptic extras are missing |
54
|
|
|
|
|
|
|
# and greek isn't mapping the extras, what is "w" is greek? |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
$_ |
58
|
4
|
|
|
|
|
19
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub toIPA |
62
|
|
|
|
|
|
|
{ |
63
|
|
|
|
|
|
|
|
64
|
4
|
|
|
4
|
0
|
7
|
$_ = $_[0]; |
65
|
|
|
|
|
|
|
|
66
|
4
|
50
|
33
|
|
|
59
|
if ( /$COPTIC/ || /\p{Greek}/ ) { |
67
|
0
|
|
|
|
|
0
|
$_ = uc($_); |
68
|
0
|
|
|
|
|
0
|
tr/ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ/abgdazaΘaklmnKaprstafxPa/; |
69
|
0
|
0
|
|
|
|
0
|
if ( /$COPTIC/ ) { |
70
|
0
|
|
|
|
|
0
|
tr/ϚCϢϤϦϨϪϬ/ssʃfxhʤʧ/; |
71
|
0
|
|
|
|
|
0
|
s/Ϯ/t/g; # really "ti" but we ignore the vowel. |
72
|
|
|
|
|
|
|
} |
73
|
0
|
|
|
|
|
0
|
s/[ϚϜ]/w/g; |
74
|
0
|
|
|
|
|
0
|
s/[ϘϞ]/k'/g; |
75
|
0
|
|
|
|
|
0
|
s/K/kh/g; |
76
|
0
|
|
|
|
|
0
|
s/P/ps/g; |
77
|
|
|
|
|
|
|
} |
78
|
4
|
50
|
|
|
|
22
|
if ( /\p{Ethiopic}/ ) { |
79
|
4
|
|
|
|
|
20
|
s/(.)/setForm($1,$ግዕዝ)/eg; |
|
12
|
|
|
|
|
146
|
|
80
|
4
|
|
|
|
|
88
|
tr/አበገደሀወዘሐጠየከለመነሠዐፈጸቀረሰተኀፀጰፐ/abgdhwzħTjklmnsʕfSqrʃtξDPp/; |
81
|
|
|
|
|
|
|
# |
82
|
|
|
|
|
|
|
# convert placeholder symbols to multiple symbols: |
83
|
|
|
|
|
|
|
# |
84
|
4
|
|
|
|
|
12
|
s/q/k'/g; |
85
|
4
|
|
|
|
|
8
|
s/P/p'/g; |
86
|
4
|
|
|
|
|
7
|
s/S/s'/g; |
87
|
4
|
|
|
|
|
7
|
s/T/t'/g; |
88
|
4
|
|
|
|
|
8
|
s/C/ʧ'/g; |
89
|
4
|
|
|
|
|
8
|
s/D/d'/g; |
90
|
|
|
|
|
|
|
} |
91
|
4
|
50
|
|
|
|
17
|
if ( /\p{Hebrew}/ ) { |
92
|
0
|
|
|
|
|
0
|
$_ = scalar reverse ( $_ ); |
93
|
|
|
|
|
|
|
# |
94
|
|
|
|
|
|
|
# map finals to initials/medials: |
95
|
|
|
|
|
|
|
# |
96
|
0
|
|
|
|
|
0
|
s/ך/כ/g; |
97
|
0
|
|
|
|
|
0
|
s/ץ/צ/g; |
98
|
0
|
|
|
|
|
0
|
s/ף/פ/g; |
99
|
0
|
|
|
|
|
0
|
s/ם/מ/g; |
100
|
0
|
|
|
|
|
0
|
s/ן/נ/g; |
101
|
0
|
|
|
|
|
0
|
tr/אבגדהוזחטיכלמנסעפצקרשת/abgdhwzħΘjklmnsʕpSqrʃt/; |
102
|
|
|
|
|
|
|
# |
103
|
|
|
|
|
|
|
# convert placeholder symbols to multiple symbols: |
104
|
|
|
|
|
|
|
# |
105
|
0
|
|
|
|
|
0
|
s/q/k'/; |
106
|
0
|
|
|
|
|
0
|
s/S/s'/; |
107
|
|
|
|
|
|
|
} |
108
|
4
|
|
|
|
|
9
|
s/(.)a/$1/g; # strip vowels except first |
109
|
|
|
|
|
|
|
|
110
|
4
|
|
|
|
|
13
|
$_; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub transliterate |
115
|
|
|
|
|
|
|
{ |
116
|
4
|
|
|
4
|
0
|
1195
|
my ( $to, @strings ) = @_; |
117
|
|
|
|
|
|
|
|
118
|
4
|
|
|
|
|
8
|
my ( @trans ) = (); |
119
|
4
|
|
|
|
|
9
|
foreach ( @strings ) { |
120
|
4
|
|
|
|
|
12
|
push ( @trans, fromIPA ( toIPA ( $_ ), $to ) ); |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
4
|
50
|
|
|
|
22
|
( wantarray ) ? @trans : $trans[0] ; |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
######################################################### |
128
|
|
|
|
|
|
|
# Do not change this, Do not put anything below this. |
129
|
|
|
|
|
|
|
# File must return "true" value at termination |
130
|
|
|
|
|
|
|
1; |
131
|
|
|
|
|
|
|
########################################################## |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
__END__ |