line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lingua::UK::Translit; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
9159
|
use 5.006; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
43
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
36
|
|
6
|
1
|
|
|
1
|
|
4
|
use utf8; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
require Exporter; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
) ] ); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our @EXPORT = qw( |
19
|
|
|
|
|
|
|
&uk2ascii |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '0.10'; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my %ua2en = ( |
26
|
|
|
|
|
|
|
'а' => 'a', 'А' => 'A', |
27
|
|
|
|
|
|
|
'б' => 'b', 'Б' => 'B', |
28
|
|
|
|
|
|
|
'в' => 'v', 'В' => 'V', |
29
|
|
|
|
|
|
|
'г' => 'h', 'Г' => 'H', |
30
|
|
|
|
|
|
|
'ґ' => 'g', 'Ґ' => 'G', |
31
|
|
|
|
|
|
|
'д' => 'd', 'Д' => 'D', |
32
|
|
|
|
|
|
|
'е' => 'e', 'Е' => 'E', |
33
|
|
|
|
|
|
|
'є' => 'ie', 'Є' => 'Ie', |
34
|
|
|
|
|
|
|
'ж' => 'zh', 'Ж' => 'Zh', |
35
|
|
|
|
|
|
|
'з' => 'z', 'З' => 'Z', |
36
|
|
|
|
|
|
|
'и' => 'y', 'И' => 'Y', |
37
|
|
|
|
|
|
|
'і' => 'i', 'І' => 'I', |
38
|
|
|
|
|
|
|
'ї' => 'i', 'Ї' => 'I', |
39
|
|
|
|
|
|
|
'й' => 'i', 'Й' => 'I', |
40
|
|
|
|
|
|
|
'к' => 'k', 'К' => 'K', |
41
|
|
|
|
|
|
|
'л' => 'l', 'Л' => 'L', |
42
|
|
|
|
|
|
|
'м' => 'm', 'М' => 'M', |
43
|
|
|
|
|
|
|
'н' => 'n', 'Н' => 'N', |
44
|
|
|
|
|
|
|
'о' => 'o', 'О' => 'O', |
45
|
|
|
|
|
|
|
'п' => 'p', 'П' => 'P', |
46
|
|
|
|
|
|
|
'р' => 'r', 'Р' => 'R', |
47
|
|
|
|
|
|
|
'с' => 's', 'С' => 'S', |
48
|
|
|
|
|
|
|
'т' => 't', 'Т' => 'T', |
49
|
|
|
|
|
|
|
'у' => 'u', 'У' => 'U', |
50
|
|
|
|
|
|
|
'ф' => 'f', 'Ф' => 'F', |
51
|
|
|
|
|
|
|
'х' => 'kh', 'Х' => 'Kh', |
52
|
|
|
|
|
|
|
'ц' => 'ts', 'Ц' => 'Ts', |
53
|
|
|
|
|
|
|
'ч' => 'ch', 'Ч' => 'Ch', |
54
|
|
|
|
|
|
|
'ш' => 'sh', 'Ш' => 'Sh', |
55
|
|
|
|
|
|
|
'щ' => 'sch', 'Щ' => 'Sch', |
56
|
|
|
|
|
|
|
'ь' => '\'', 'Ь' => '\'', |
57
|
|
|
|
|
|
|
'ю' => 'iu', 'Ю' => 'Iu', |
58
|
|
|
|
|
|
|
'я' => 'ia', 'Я' => 'Ia' |
59
|
|
|
|
|
|
|
); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my %ua2enwb = ( |
62
|
|
|
|
|
|
|
'є' => 'ye', 'Є' => 'Ye', |
63
|
|
|
|
|
|
|
'ї' => 'y', 'Ї' => 'Y', |
64
|
|
|
|
|
|
|
'й' => 'y', 'Й' => 'Y', |
65
|
|
|
|
|
|
|
'ю' => 'yu', 'Ю' => 'Yu', |
66
|
|
|
|
|
|
|
'я' => 'ya', 'Я' => 'Ya' |
67
|
|
|
|
|
|
|
); |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub uk2ascii |
71
|
|
|
|
|
|
|
{ |
72
|
5
|
|
|
5
|
1
|
103
|
my $strin = shift; |
73
|
|
|
|
|
|
|
|
74
|
5
|
|
|
|
|
142
|
my @words = split ('\b',$strin); |
75
|
|
|
|
|
|
|
|
76
|
5
|
|
|
|
|
11
|
my $strans = ''; |
77
|
|
|
|
|
|
|
|
78
|
5
|
|
|
|
|
10
|
foreach my $word (@words){ |
79
|
|
|
|
|
|
|
|
80
|
49
|
|
|
|
|
214
|
my @c = split('',$word); |
81
|
|
|
|
|
|
|
|
82
|
49
|
|
|
|
|
96
|
my $wtrans = ''; |
83
|
|
|
|
|
|
|
|
84
|
49
|
|
|
|
|
102
|
for ( my $i = 0; $i <= $#c; $i++){ |
85
|
435
|
100
|
100
|
|
|
1329
|
if ( ($i == 0) and (exists $ua2enwb{$c[0]}) ){ |
|
|
100
|
|
|
|
|
|
86
|
11
|
|
|
|
|
33
|
$wtrans .= $ua2enwb{$c[0]}; |
87
|
|
|
|
|
|
|
} elsif (exists $ua2en{$c[$i]}){ |
88
|
269
|
100
|
100
|
|
|
968
|
if ( ($c[$i] eq 'г') and (($c[$i-1] eq 'з') or ($c[$i-1] eq 'З')) ){ |
|
|
100
|
66
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
66
|
|
|
|
|
89
|
2
|
|
|
|
|
7
|
$wtrans .= 'gh'; |
90
|
|
|
|
|
|
|
} elsif ( ($c[$i] eq 'Г') and (($c[$i-1] eq 'з') or ($c[$i-1] eq 'З')) ){ |
91
|
2
|
|
|
|
|
5
|
$wtrans .= 'Gh'; |
92
|
|
|
|
|
|
|
} else { |
93
|
265
|
|
|
|
|
713
|
$wtrans .= $ua2en{$c[$i]}; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
} else { |
96
|
155
|
|
|
|
|
321
|
$wtrans .= $c[$i]; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
} |
99
|
49
|
|
|
|
|
164
|
$strans .= $wtrans; |
100
|
|
|
|
|
|
|
} |
101
|
5
|
|
|
|
|
49
|
return $strans; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
1; |
105
|
|
|
|
|
|
|
__END__ |