line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::MultiPhone::no; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1629
|
use 5.006; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
42
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
4
|
use POSIX qw(setlocale LC_CTYPE); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
75
|
use base qw(Text::MultiPhone); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
238
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
6
|
use constant VOWELS => [qw(a e i o u y æ ø å)]; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
258
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = do { my @r = (q$Revision: 1.1.1.1 $ =~ /\d+/g); sprintf " %d." . "%02d" x $#r, @r }; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub pre_split { |
16
|
1
|
|
|
1
|
0
|
3
|
my ($self, $word) = @_; |
17
|
1
|
|
|
|
|
9
|
my $orgLocale = setlocale(LC_CTYPE); |
18
|
1
|
|
|
|
|
267
|
setlocale(LC_CTYPE, 'no_NO'); |
19
|
1
|
|
|
1
|
|
6
|
use locale; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
4
|
$word = lc($word); |
22
|
1
|
|
|
|
|
3
|
$word =~ s/qu/q/g; # q is always alone |
23
|
|
|
|
|
|
|
# sj/kj lyder |
24
|
1
|
|
|
|
|
3
|
$word =~ s/skj/sj/g; |
25
|
1
|
|
|
|
|
3
|
$word =~ s/ski/sji/g; |
26
|
1
|
|
|
|
|
3
|
$word =~ s/ki/sji/g; |
27
|
1
|
|
|
|
|
2
|
$word =~ s/tj/sj/g; |
28
|
1
|
|
|
|
|
4
|
$word =~ s/kj/sj/g; |
29
|
1
|
|
|
|
|
4
|
$word =~ s/gj/sj/g; |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
4
|
$word =~ s/aa/å/g; |
32
|
1
|
|
|
|
|
3
|
$word =~ s/ph/f/g; |
33
|
1
|
|
|
|
|
9
|
$word =~ s/(\w)\1/$1/g; # removing double characters |
34
|
1
|
|
|
|
|
6
|
$word =~ s/(\w{2})\1/$1/g; # removing double pairs as stst in "selbstständig" |
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
1
|
|
294
|
no locale; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
3
|
|
37
|
1
|
|
|
|
|
6
|
setlocale(LC_CTYPE, $orgLocale); |
38
|
1
|
|
|
|
|
5
|
return $word |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub process_bits { |
42
|
1
|
|
|
1
|
0
|
4
|
my ($self, @words) = @_; |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
3
|
my @results; |
45
|
1
|
|
|
|
|
3
|
foreach my $word (@words) { |
46
|
1
|
50
|
|
|
|
4
|
next unless defined $word; |
47
|
1
|
|
|
|
|
3
|
foreach my $part (@$word) { |
48
|
8
|
50
|
|
|
|
17
|
next unless defined $part; |
49
|
8
|
|
|
|
|
9
|
my $sequence = ${ $part }[0]; |
|
8
|
|
|
|
|
18
|
|
50
|
8
|
100
|
|
|
|
20
|
next unless $sequence; |
51
|
5
|
|
|
|
|
7
|
my @splits; |
52
|
|
|
|
|
|
|
|
53
|
5
|
50
|
33
|
|
|
105
|
if ($sequence =~ 'hv') { |
|
|
50
|
33
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
54
|
0
|
|
|
|
|
0
|
push @splits, 'w'; |
55
|
|
|
|
|
|
|
} elsif ($sequence =~ /v/) { |
56
|
|
|
|
|
|
|
# v sounds like w |
57
|
0
|
|
|
|
|
0
|
(my $subst = $sequence) =~ s/v/w/; |
58
|
0
|
|
|
|
|
0
|
push @splits, $subst; |
59
|
|
|
|
|
|
|
} elsif ($sequence =~ /y/) { |
60
|
|
|
|
|
|
|
# y sounds like u,i |
61
|
0
|
|
|
|
|
0
|
(my $subst = $sequence) =~ s/y/i/; |
62
|
0
|
|
|
|
|
0
|
push @splits, $subst; |
63
|
0
|
|
|
|
|
0
|
($subst = $sequence) =~ s/y/u/; |
64
|
0
|
|
|
|
|
0
|
push @splits, $subst; |
65
|
|
|
|
|
|
|
} elsif ($sequence eq 'u') { |
66
|
|
|
|
|
|
|
# u sounds like u,i |
67
|
0
|
|
|
|
|
0
|
push @splits, 'u'; |
68
|
0
|
|
|
|
|
0
|
push @splits, 'i'; |
69
|
|
|
|
|
|
|
} elsif ($sequence eq 'o') { |
70
|
|
|
|
|
|
|
# o sounds like u,o |
71
|
0
|
|
|
|
|
0
|
push @splits, 'u'; |
72
|
0
|
|
|
|
|
0
|
push @splits, 'o'; |
73
|
|
|
|
|
|
|
} elsif ($sequence eq 'å') { |
74
|
|
|
|
|
|
|
# o sounds like u,o |
75
|
0
|
|
|
|
|
0
|
push @splits, 'o'; |
76
|
|
|
|
|
|
|
} elsif ($sequence eq 'æ' or $sequence eq 'ae') { |
77
|
|
|
|
|
|
|
# æ sounds like a,e |
78
|
0
|
|
|
|
|
0
|
push @splits, 'a'; |
79
|
0
|
|
|
|
|
0
|
push @splits, 'e'; |
80
|
|
|
|
|
|
|
} elsif ($sequence eq 'ø' or $sequence eq 'oe') { |
81
|
|
|
|
|
|
|
# ö sounds like o,e |
82
|
0
|
|
|
|
|
0
|
push @splits, 'o'; |
83
|
0
|
|
|
|
|
0
|
push @splits, 'e'; |
84
|
|
|
|
|
|
|
} elsif ($sequence eq 'øy' or $sequence eq 'øi' or $sequence eq 'oy') { |
85
|
0
|
|
|
|
|
0
|
push @splits, 'oi'; |
86
|
|
|
|
|
|
|
} elsif ($sequence eq 'ai') { |
87
|
0
|
|
|
|
|
0
|
push @splits, 'ei'; |
88
|
|
|
|
|
|
|
} else { |
89
|
5
|
|
|
|
|
15
|
push @splits, $sequence; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
5
|
|
|
|
|
16
|
@$part = @splits; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
} |
95
|
1
|
|
|
|
|
5
|
return @words; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub post_join { |
99
|
1
|
|
|
1
|
0
|
3
|
my ($self, @words) = @_; |
100
|
|
|
|
|
|
|
# nothing to do here |
101
|
1
|
|
|
|
|
4
|
return @words; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
1; |