line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Undiacritic; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
45471
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
69
|
|
4
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
132
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.06'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter; |
8
|
|
|
|
|
|
|
our @ISA = qw(Exporter); ## no critic |
9
|
|
|
|
|
|
|
our @EXPORT_OK = qw(undiacritic); |
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
502
|
use charnames ':full'; |
|
2
|
|
|
|
|
24722
|
|
|
2
|
|
|
|
|
11
|
|
12
|
2
|
|
|
2
|
|
2940
|
use Unicode::Normalize qw(decompose); |
|
2
|
|
|
|
|
3670
|
|
|
2
|
|
|
|
|
281
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub undiacritic { |
15
|
11
|
|
|
11
|
1
|
1526
|
my $characters = shift; |
16
|
|
|
|
|
|
|
|
17
|
11
|
100
|
|
|
|
29
|
if ( !$characters ) { return $characters; } |
|
3
|
|
|
|
|
15
|
|
18
|
|
|
|
|
|
|
|
19
|
8
|
|
|
|
|
73
|
$characters = decompose($characters); |
20
|
8
|
|
|
|
|
51
|
$characters =~ s/\p{NonspacingMark}//gxms; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
return join('', |
23
|
|
|
|
|
|
|
map { |
24
|
8
|
|
|
|
|
29
|
(ord($_) > 127) |
25
|
12
|
100
|
|
|
|
80
|
? do { |
26
|
1
|
|
|
|
|
7
|
my $charname = charnames::viacode(ord $_); |
27
|
1
|
|
|
|
|
154
|
$charname =~ s/\s WITH \s .+ \z//x; |
28
|
1
|
|
|
|
|
6
|
charnames::string_vianame($charname); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
: $_; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
split //, $characters |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |