line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lingua::FI::Kontti; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=pod |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Lingua::FI::Kontti - Finnish Pig Latin (kontinkieli) |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NIMI |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Lingua::FI::Kontti - kontinkieli |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use Lingua::FI::Kontti qw(kontita); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
print kontita("on meillä hauska täti"), "\n"; |
18
|
|
|
|
|
|
|
# will print "kon ontti keillä montti kauska hontti koti täntti\n"; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
print kontita("on meillä hauska täti", "tunkki"), "\n"; |
21
|
|
|
|
|
|
|
# will print "tun onkki teillä munkki tauska hunkki tuti tänkki\n"; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 KÄYTTÖ |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use Lingua::FI::Kontti qw(kontita); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
print kontita("on meillä hauska täti"), "\n"; |
28
|
|
|
|
|
|
|
# tulostaa "kon ontti keillä montti kauska hontti koti täntti\n"; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
print kontita("on meillä hauska täti", "tunkki"), "\n"; |
31
|
|
|
|
|
|
|
# tulostaa "tun onkki teillä munkki tauska hunkki tuti tänkki\n"; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 DESCRIPTION |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Similar to Pig Latin of English |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
English We're gonna rock around the clock tonight |
38
|
|
|
|
|
|
|
Pig Latin E'reway onnagay ockray aroundway ethay ockclay onighttay |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
there's a tongue-and-brain-twisting "secret" kids' language for |
41
|
|
|
|
|
|
|
Finnish, called "kontinkieli" ("kontti speak"). In principle the |
42
|
|
|
|
|
|
|
transformation is simple: the beginning of the word you want to |
43
|
|
|
|
|
|
|
translate is switched with the beginning of the word "kontti". In |
44
|
|
|
|
|
|
|
practice it's a little bit more complicated that that because one has |
45
|
|
|
|
|
|
|
to know the Finnish syllable division and vowel harmony rules. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
With this module you can converse like a pro with Finnish kids. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
In addition to the standard "secret key" I you can use |
50
|
|
|
|
|
|
|
any other word that according to Finnish syllable division rules |
51
|
|
|
|
|
|
|
starts with CVCC (consonant-vowel-consonant-constant) syllable, |
52
|
|
|
|
|
|
|
like for example I, I, I, I, I. |
53
|
|
|
|
|
|
|
Give the keyword as the second argument. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 KUVAUS |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Tällä modulilla voit kääntää suomea kontiksi. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
"Salaisen avaimen" I sijasta voit käyttää mitä tahansa sanaa joka |
60
|
|
|
|
|
|
|
suomeksi tavutettuna alkaa KVKK-tavulla (konsonantti-vokaali-konsonantti- |
61
|
|
|
|
|
|
|
konsonantti), kuten esimerkiksi I, I, I, I, |
62
|
|
|
|
|
|
|
I. Anna avainsana toisena argumenttina. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Englannin puhujilla on samankaltainen lastenkieli, "sikalatina" (Pig Latin), |
65
|
|
|
|
|
|
|
yllä esimerkki. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=over 4 |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item * |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Pig Latin translator |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
http://www.snowcrest.net/donnelly/piglatin.html |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item * |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Rock Around the Clock |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Bill Haley and the Comets |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=back |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 KIITOKSET |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=over 4 |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item * |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Sikalatinakäännin |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
http://www.snowcrest.net/donnelly/piglatin.html |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item * |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Rock Around the Clock |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Bill Haley and the Comets |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=back |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 AUTHOR |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Jarkko Hietaniemi |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 COPYRIGHT |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Copyright 2001 Jarkko Hietaniemi |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 LICENSE |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
114
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 TEKIJÄ |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Jarkko Hietaniemi |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 TEKIJÄNOIKEUS |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Copyright 2001 Jarkko Hietaniemi |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 LISENSSI |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Tämä kirjastomoduli on vapaa; voit jakaa ja/tai muuttaa sitä samojen |
127
|
|
|
|
|
|
|
ehtojen mukaisesti kuin Perliä itseään. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=cut |
130
|
|
|
|
|
|
|
|
131
|
1
|
|
|
1
|
|
764
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
47
|
|
132
|
|
|
|
|
|
|
|
133
|
1
|
|
|
1
|
|
6
|
use vars qw($VERSION @ISA @EXPORT_OK); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
156
|
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
$VERSION = 0.02; |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
require Exporter; |
138
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
139
|
|
|
|
|
|
|
@EXPORT_OK = qw(kontita); |
140
|
|
|
|
|
|
|
|
141
|
1
|
|
|
1
|
|
958
|
use Lingua::FI::Hyphenate 'tavuta'; |
|
1
|
|
|
|
|
502
|
|
|
1
|
|
|
|
|
1451
|
|
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
my $vp = "aeiouyäåö"; |
144
|
|
|
|
|
|
|
my $vI = "AEIOUYÅÄÖ"; |
145
|
|
|
|
|
|
|
my $v = "$vp$vI"; |
146
|
|
|
|
|
|
|
my $kp = "bcdfghjklmnpqrstvwxz"; |
147
|
|
|
|
|
|
|
my $kI = "BCDFGHJKLMNPQRSTVWXZ"; |
148
|
|
|
|
|
|
|
my $k = "$kp$kI"; |
149
|
|
|
|
|
|
|
my $V = "[$v]"; |
150
|
|
|
|
|
|
|
my $K = "[$k]"; |
151
|
|
|
|
|
|
|
my $p = "$vp$kp"; |
152
|
|
|
|
|
|
|
my $I = "$vI$kI"; |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub kontita { |
155
|
43
|
|
|
43
|
0
|
510
|
my $s = shift; |
156
|
|
|
|
|
|
|
|
157
|
43
|
50
|
|
|
|
101
|
my $kontti = @_ ? shift : "kontti"; |
158
|
|
|
|
|
|
|
|
159
|
43
|
|
|
|
|
103
|
my @ak = tavuta($kontti); |
160
|
|
|
|
|
|
|
|
161
|
43
|
50
|
|
|
|
2740
|
die "kontita: '$kontti' ei ala KVKK\n" |
162
|
|
|
|
|
|
|
unless $ak[0] =~ /^($K)($V)($K)($K)/; |
163
|
|
|
|
|
|
|
|
164
|
43
|
|
|
|
|
72
|
my $k1 = substr($kontti, 0, 1); |
165
|
43
|
|
|
|
|
122
|
my $v1 = substr($kontti, 1, 1); |
166
|
43
|
|
|
|
|
52
|
my $k2 = substr($kontti, 2, 1); |
167
|
43
|
|
|
|
|
82
|
my $k3 = substr($kontti, 3, 1); |
168
|
|
|
|
|
|
|
|
169
|
43
|
|
|
|
|
50
|
my $kontitettu = ''; |
170
|
|
|
|
|
|
|
|
171
|
43
|
|
|
|
|
268
|
for my $s (split(/([$v$k]+)/, $s)) { |
172
|
86
|
100
|
|
|
|
515
|
$kontitettu .= $s, next unless $s =~ /[$v$k]/; |
173
|
43
|
|
|
|
|
93
|
my @k = @ak; |
174
|
43
|
|
|
|
|
103
|
my @t = tavuta($s); |
175
|
43
|
100
|
|
|
|
4131
|
if ($t[0] =~ /^($K)($V)$/) { # talo |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
176
|
4
|
|
|
|
|
11
|
$t[0] = $k1 . $v1 ; # kolo |
177
|
4
|
|
|
|
|
16
|
$k[0] = $1 . $2 . $k2 . $k3; # tantti |
178
|
|
|
|
|
|
|
} elsif ($t[0] =~ /^($K)($V)($K)$/) { # marras |
179
|
1
|
|
|
|
|
6
|
$t[0] = $k1 . $v1 . $3; # korras |
180
|
1
|
|
|
|
|
6
|
$k[0] = $1 . $2 . $k2 . $k3; # mantti |
181
|
|
|
|
|
|
|
} elsif ($t[0] =~ /^($K)($V)($V)$/) { |
182
|
9
|
100
|
|
|
|
31
|
if ($2 eq $3) { # saari |
|
|
100
|
|
|
|
|
|
183
|
4
|
|
|
|
|
9
|
$t[0] = $k1 . $v1 . $v1; # koori |
184
|
4
|
|
|
|
|
12
|
$k[0] = $1 . $2 . $k2 . $k3; # santti |
185
|
|
|
|
|
|
|
} elsif ($3 eq $v1) { # huomenta |
186
|
1
|
|
|
|
|
5
|
$t[0] = $k1 . $v1 . $2; # koumenta |
187
|
1
|
|
|
|
|
4
|
$k[0] = $1 . $2 . $k2 . $k3; # huntti |
188
|
|
|
|
|
|
|
} else { # taivas |
189
|
4
|
|
|
|
|
152
|
$t[0] = $k1 . $v1 . $3; # koivas |
190
|
4
|
|
|
|
|
15
|
$k[0] = $1 . $2 . $k2 . $k3; # tantti |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
} elsif ($t[0] =~ /^($K)($V)($V)($K)$/) { |
193
|
7
|
100
|
|
|
|
20
|
if ($2 eq $3) { # saarni |
194
|
2
|
|
|
|
|
7
|
$t[0] = $k1 . $v1 . $v1 . $4; # koorni |
195
|
2
|
|
|
|
|
15
|
$k[0] = $1 . $2 . $k2 . $k3; # kantti |
196
|
|
|
|
|
|
|
} else { # hiekka |
197
|
5
|
|
|
|
|
17
|
$t[0] = $k1 . $2 . $3 . $4; # kiekka |
198
|
5
|
|
|
|
|
14
|
$k[0] = $1 . $v1 . $k2 . $k3; # hontti |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
} elsif ($t[0] =~ /^($V)($K)$/) { # alku |
201
|
4
|
|
|
|
|
13
|
$t[0] = $k1 . $v1 . $2; # kolku |
202
|
4
|
|
|
|
|
11
|
$k[0] = $1 . $k2 . $k3; # antti |
203
|
|
|
|
|
|
|
} elsif ($t[0] =~ /^($V)$/) { # ase |
204
|
5
|
|
|
|
|
12
|
$t[0] = $k1 . $v1; # kose |
205
|
5
|
|
|
|
|
16
|
$k[0] = $1 . $k2 . $k3; # antti |
206
|
|
|
|
|
|
|
} elsif ($t[0] =~ /^($V)($V)$/) { |
207
|
4
|
100
|
|
|
|
22
|
if ($1 eq $2) { # aari |
|
|
100
|
|
|
|
|
|
208
|
1
|
|
|
|
|
5
|
$t[0] = $k1 . $v1 . $v1; # koori |
209
|
1
|
|
|
|
|
4
|
$k[0] = $1 . $k2 . $k3; # antti |
210
|
|
|
|
|
|
|
} elsif ($2 eq 'ö') { # yö |
211
|
1
|
|
|
|
|
6
|
$t[0] = $k1 . $2 . $1; # köy |
212
|
1
|
|
|
|
|
4
|
$k[0] = $1 . $k2 . $k3; # yntti |
213
|
|
|
|
|
|
|
} else { # autio |
214
|
2
|
|
|
|
|
41
|
$t[0] = $k1 . $v1 . $2; # koutio |
215
|
2
|
|
|
|
|
7
|
$k[0] = $1 . $k2 . $k3; # antti |
216
|
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
} elsif ($t[0] =~ /^($K)($V)($K)($K)$/) { # tausta |
218
|
0
|
|
|
|
|
0
|
$t[0] = $k1 . $v1 . $3 . $4; # kousta |
219
|
0
|
|
|
|
|
0
|
$k[0] = $1 . $2 . $k2 . $k3; # tantti |
220
|
|
|
|
|
|
|
} elsif ($t[0] =~ /^($V)($V)($K)$/) { |
221
|
2
|
100
|
|
|
|
7
|
if ($1 eq $2) { # aarni |
222
|
1
|
|
|
|
|
4
|
$t[0] = $k1 . $v1 . $v1 . $3; # koorni |
223
|
1
|
|
|
|
|
4
|
$k[0] = $1 . $k2 . $k3; # antti |
224
|
|
|
|
|
|
|
} else { # aukko |
225
|
1
|
|
|
|
|
4
|
$t[0] = $k1 . $v1 . $2 . $3; # koukko |
226
|
1
|
|
|
|
|
4
|
$k[0] = $1 . $k2 . $k3; # antti |
227
|
|
|
|
|
|
|
} |
228
|
|
|
|
|
|
|
} elsif ($t[0] =~ /^($V)($K)($K)$/) { # arkku |
229
|
1
|
|
|
|
|
5
|
$t[0] = $k1 . $v1 . $2 . $3; # korkku |
230
|
1
|
|
|
|
|
4
|
$k[0] = $1 . $k2 . $k3; # antti |
231
|
|
|
|
|
|
|
} elsif ($t[0] =~ /^($K)($K)($V)$/) { # trapetsi |
232
|
2
|
|
|
|
|
5
|
$t[0] = $k1 . $v1; # kopetsi |
233
|
2
|
|
|
|
|
8
|
$k[0] = $1 . $2 . $3 . $k2 . $k3; # trantti |
234
|
|
|
|
|
|
|
} elsif ($t[0] =~ /^($K)($K)($V)($K)$/) { # traktori |
235
|
1
|
|
|
|
|
4
|
$t[0] = $k1 . $2 . $v1 . $4; # kroktori |
236
|
1
|
|
|
|
|
4
|
$k[0] = $1 . $3 . $k2 . $k3; # tantti |
237
|
|
|
|
|
|
|
} elsif ($t[0] =~ /^($K)($K)($V)($V)$/) { |
238
|
2
|
100
|
|
|
|
7
|
if ($3 eq $4) { # traani |
239
|
1
|
|
|
|
|
4
|
$t[0] = $k1 . $v1 . $v1; # kooni |
240
|
1
|
|
|
|
|
4
|
$k[0] = $1 . $2 . $3 . $k2 . $k3; # trantti |
241
|
|
|
|
|
|
|
} else { # trauma |
242
|
1
|
|
|
|
|
4
|
$t[0] = $k1 . $v1 . $4; # kouma |
243
|
1
|
|
|
|
|
5
|
$k[0] = $1 . $2 . $3 . $k2 . $k3; # trantti |
244
|
|
|
|
|
|
|
} |
245
|
|
|
|
|
|
|
} elsif ($t[0] =~ /^($K)($K)($V)($V)($K)$/) { # truantti |
246
|
0
|
|
|
|
|
0
|
$t[0] = $k1 . $v1 . $4 . $5; # koantti |
247
|
0
|
|
|
|
|
0
|
$k[0] = $1 . $2 . $3 . $k2 . $k3; # trantti |
248
|
|
|
|
|
|
|
} elsif ($t[0] =~ /^($K)($K)($V)($K)($K)$/) { # transsi |
249
|
1
|
|
|
|
|
6
|
$t[0] = $k1 . $v1 . $4 . $5; # konssi |
250
|
1
|
|
|
|
|
5
|
$k[0] = $1 . $2 . $3 . $k2 . $k3; # trantti |
251
|
|
|
|
|
|
|
} |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
# vokaalisointu |
254
|
|
|
|
|
|
|
|
255
|
43
|
100
|
|
|
|
74
|
@t = map { tr/aouAOU/äöyÄÖY/; $_ } @t if grep { /[yäöYÄÖ]/ } @t; |
|
21
|
|
|
|
|
199
|
|
|
21
|
|
|
|
|
53
|
|
|
96
|
|
|
|
|
286
|
|
256
|
43
|
100
|
|
|
|
59
|
@k = map { tr/aouAOU/äöyÄÖY/; $_ } @k if grep { /[yäöYÄÖ]/ } @k; |
|
22
|
|
|
|
|
28
|
|
|
22
|
|
|
|
|
55
|
|
|
86
|
|
|
|
|
254
|
|
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
# Iso alkukirjain |
259
|
43
|
|
|
|
|
85
|
my $a = substr($t[0], 0, 1); |
260
|
43
|
|
|
|
|
57
|
my $b = substr($k[0], 0, 1); |
261
|
43
|
50
|
33
|
|
|
792
|
if ($a =~ /^[$p]/ && $b =~ /^[$I]/) { |
262
|
0
|
|
|
|
|
0
|
substr($t[0], 0, 1) = substr($I, index($p, $a), 1); |
263
|
0
|
|
|
|
|
0
|
substr($k[0], 0, 1) = substr($p, index($I, $b), 1); |
264
|
|
|
|
|
|
|
} |
265
|
|
|
|
|
|
|
|
266
|
43
|
|
|
|
|
295
|
$kontitettu .= join("", @t) . " " . join("", @k) |
267
|
|
|
|
|
|
|
} |
268
|
|
|
|
|
|
|
|
269
|
43
|
|
|
|
|
169
|
return $kontitettu; |
270
|
|
|
|
|
|
|
} |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
1; |