line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lingua::FI::Genitive; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
21565
|
use 5.008; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
42
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
35
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
2289
|
|
6
|
|
|
|
|
|
|
require Exporter; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
9
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw(genetiivi) ] ); |
10
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
11
|
|
|
|
|
|
|
our @EXPORT = qw( ); |
12
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# haluaa taivuttamattoman sanan |
16
|
|
|
|
|
|
|
# palauttaa taivutetun sanan |
17
|
|
|
|
|
|
|
sub genetiivi{ |
18
|
0
|
|
|
0
|
0
|
|
my($sana)=@_; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# järjestä ao. lista ensin pituuden mukaan, sitten aakkosjärjestykseen |
21
|
|
|
|
|
|
|
# konsonantit |
22
|
|
|
|
|
|
|
# viimeinen id=6 |
23
|
0
|
|
|
|
|
|
my $k ="bcdfghjklmnpqrstvwxz"; |
24
|
0
|
|
|
|
|
|
my $k2="smnl"; |
25
|
0
|
|
|
|
|
|
my $k5="k"; |
26
|
0
|
|
|
|
|
|
my $k4="lr"; |
27
|
0
|
|
|
|
|
|
my $k3="vh"; |
28
|
0
|
|
|
|
|
|
my $k6="h"; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# järjestä ao. lista ensin pituuden mukaan, sitten aakkosjärjestykseen |
31
|
|
|
|
|
|
|
# vokaalit |
32
|
|
|
|
|
|
|
# viimeinen id=2 |
33
|
0
|
|
|
|
|
|
my $v ="aeiouy"; |
34
|
0
|
|
|
|
|
|
my $v2="i"; |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
local $_=$sana; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# 1 = regex |
39
|
|
|
|
|
|
|
# 2 = käytettävän säännön id; viimeinen id = 68 |
40
|
|
|
|
|
|
|
# 3 = esimerkkisanan alku |
41
|
|
|
|
|
|
|
# 4 = esimerkkisanan loppu ; isolla kirjaimet, jotka ovat aina juuri nämä |
42
|
|
|
|
|
|
|
# 5 = esimerkkisanan lopun käännös ; isolla kirjaimet, jotka ovat aina juuri nämä |
43
|
|
|
|
|
|
|
# 6 = ryhmän id, johon regex kuuluu; viimeinen id = 10 |
44
|
|
|
|
|
|
|
# 7 = ryhmän järjestys; pienin ensin. Laita perään +, jos järjestys jaetaan jonkun muun kanssa |
45
|
|
|
|
|
|
|
# |
46
|
|
|
|
|
|
|
# 1 2 3 4 5 6 7 |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# säännöt, jotka toimivat myös nimille |
49
|
0
|
0
|
0
|
|
|
|
s/nen $ /sen !22 /x # kisu NEN > SEN |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|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
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# nimet |
52
|
|
|
|
|
|
|
|| s/^([A-Z].*)([kpqt])\2([$v])$ /$1$2$3n !67 /x # Ja tta tan 9 0 |
53
|
|
|
|
|
|
|
|| s/^([A-Z].*[$v]) $ /$1n !61 /x # Vil e eN 9 1 |
54
|
|
|
|
|
|
|
|| s/^([A-Z].*) $ /$1in !62 /x # Ki m mIN 9 2 |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# pronominit |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
#|| s/^minä $ /minun !63 /x # pronomini |
59
|
|
|
|
|
|
|
#|| s/^sinä $ /sinun !63 /x # pronomini |
60
|
|
|
|
|
|
|
#|| s/^hän $ /hänen !63 /x # pronomini |
61
|
|
|
|
|
|
|
#|| s/^me $ /meidän !63 /x # pronomini |
62
|
|
|
|
|
|
|
#|| s/^te $ /teidän !63 /x # pronomini |
63
|
|
|
|
|
|
|
#|| s/^he $ /heidän !63 /x # pronomini |
64
|
|
|
|
|
|
|
#|| s/^nämä $ /näiden !63 /x # pronomini |
65
|
|
|
|
|
|
|
|| s/^tuo $ /tuon !63 /x # pronomini |
66
|
|
|
|
|
|
|
|| s/^se $ /sen !63 /x # pronomini |
67
|
|
|
|
|
|
|
|| s/^nuo $ /noiden !63 /x # pronomini |
68
|
|
|
|
|
|
|
|| s/^ne $ /niiden !63 /x # pronomini |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# yksittäiset sanat, joita ei voi laittaa yhdyssanaan |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|| s/^aika $ /ajan !64 /x # vrt. taika -> taian |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# yksittäiset sanat, mahdolliset myös yhdyssanoissa |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|| s/poika $ /pojan !65 /x # reliikki |
77
|
|
|
|
|
|
|
|| s/mies $ /miehen !65 /x # vrt. hies -> hieksen |
78
|
|
|
|
|
|
|
|| s/yhteys $ /yhteyden !65 /x # vrt. risteys -> risteyksen |
79
|
|
|
|
|
|
|
|| s/haku $ /haun !65 /x # vrt. laku -> lakun |
80
|
|
|
|
|
|
|
|| s/laki $ /lain !65 /x # vrt. khaki -> khakin |
81
|
|
|
|
|
|
|
|| s/tuoli $ /tuolin !65 /x # vrt. huoli -> huolen |
82
|
|
|
|
|
|
|
|| s/henki $ /hengen !65 /x # vrt. renki -> rengin |
83
|
|
|
|
|
|
|
|| s/puomi $ /puomin !65 /x # vrt. luomi -> luomen |
84
|
|
|
|
|
|
|
|| s/[th]uuli $ /tuulen !65 /x # vrt. muuli -> muulin |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# kummallisuudet |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|| s/ruis $ /rukiin !66 /x |
89
|
|
|
|
|
|
|
|| s/ananas $ /ananaksen !66 /x |
90
|
|
|
|
|
|
|
|| s/business $ /busineksen !66 /x |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# numeraalit |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|| s/yksi $ /yhden !1 /x |
95
|
|
|
|
|
|
|
|| s/kaksi $ /kahden !1 /x |
96
|
|
|
|
|
|
|
|| s/kolme $ /kolmen !1 /x |
97
|
|
|
|
|
|
|
|| s/^viisi $ /viiden !1 /x # numero - kuitenkin aviisi -> aviisin |
98
|
|
|
|
|
|
|
|| s/kuusi $ /kuuden !1 /x |
99
|
|
|
|
|
|
|
|| s/kolmas $ /kolmannen !1 /x |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# lainasanat, jotka päättyvät vokaaliin |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|| s/( |
104
|
|
|
|
|
|
|
andante |
105
|
|
|
|
|
|
|
|delta |
106
|
|
|
|
|
|
|
|data |
107
|
|
|
|
|
|
|
|desi |
108
|
|
|
|
|
|
|
|curry |
109
|
|
|
|
|
|
|
|copy |
110
|
|
|
|
|
|
|
|collie |
111
|
|
|
|
|
|
|
|college |
112
|
|
|
|
|
|
|
|chippendale |
113
|
|
|
|
|
|
|
|city |
114
|
|
|
|
|
|
|
|bluffi |
115
|
|
|
|
|
|
|
|beige |
116
|
|
|
|
|
|
|
|bridge |
117
|
|
|
|
|
|
|
|boutique |
118
|
|
|
|
|
|
|
|cache |
119
|
|
|
|
|
|
|
|case |
120
|
|
|
|
|
|
|
|freestyle |
121
|
|
|
|
|
|
|
|foto |
122
|
|
|
|
|
|
|
|fleece |
123
|
|
|
|
|
|
|
|empire |
124
|
|
|
|
|
|
|
|epo |
125
|
|
|
|
|
|
|
|esperanto |
126
|
|
|
|
|
|
|
|extreme |
127
|
|
|
|
|
|
|
|fluori |
128
|
|
|
|
|
|
|
|expo |
129
|
|
|
|
|
|
|
|folklore |
130
|
|
|
|
|
|
|
|ellipsi |
131
|
|
|
|
|
|
|
|ensemble |
132
|
|
|
|
|
|
|
|forte |
133
|
|
|
|
|
|
|
) $ /$1n !59 /x |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
# lainasanat, jotka päättyvät konsonanttiin |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
|| s/( |
138
|
|
|
|
|
|
|
charleston |
139
|
|
|
|
|
|
|
|evergreen |
140
|
|
|
|
|
|
|
) $ /$1in !60 /x |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
# varmat säännöt, joissa etsimisosan säännöt ovat ilman muuttujia (esim. $1) |
144
|
|
|
|
|
|
|
|| s/^([vm])(er)i $ /$1$2en !33 /x # vERI > verEN |
145
|
|
|
|
|
|
|
|| s/(n)si $ /$1$1en !38 /x # ka NSI > nnEN |
146
|
|
|
|
|
|
|
|| s/(m)pi $ /$1$1en !11 /x # la MPI > mmEN |
147
|
|
|
|
|
|
|
|| s/(iel)i $ /$1en !19 /x # k IELI > elEN |
148
|
|
|
|
|
|
|
|| s/([yu]psi) $ /$1n !55 /x # r yPSI > ypsiN 8 1 |
149
|
|
|
|
|
|
|
|| s/(p)(s)i $ /$1$2en !32 /x # la PSI > psEN 8 2 |
150
|
|
|
|
|
|
|
|| s/das $ /taan !24 /x # hi DAS > TAAN |
151
|
|
|
|
|
|
|
|| s/([st])([ou]u)s $ /$1$2den !44 /x # out oUS > ouDEN |
152
|
|
|
|
|
|
|
|| s/([$v])\1 $ /$1$1n !58 /x # atelj ee > eeN |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
# sekalaiset säännöt |
155
|
|
|
|
|
|
|
|| s/(m)\1(a)s $ /$1p$2$2n !41 /x # ha MmAS > hamPaaN 3 -2 |
156
|
|
|
|
|
|
|
|| s/(n)\1(a)s $ /$1$1$2ksen !42 /x # ka NnAS > nnaKSEN 3 0 |
157
|
|
|
|
|
|
|
|| s/([$k ])\1(a)s $ /$1t$2$2n !36 /x # ma llAS > malTaaN 3 -1 |
158
|
|
|
|
|
|
|
|| s/([$k ])d(a)s $ /$1t$2$2n !40 /x # a hDAS > ahTaaN 3 -0.5 |
159
|
|
|
|
|
|
|
|| s/(n)\1e $ /$1teen !12 /x # la NnE > nTEEN 3 1+ |
160
|
|
|
|
|
|
|
|| s/(m)\1e $ /$1$1een !13 /x # a MmE > mmEEN 3 1+ |
161
|
|
|
|
|
|
|
|| s/([$k2])\1([$v ]) $ /$1$1$2n !29 /x # ki ssa > ssaN 3 2 |
162
|
|
|
|
|
|
|
|| s/([$k ])\1([$v ]) $ /$1$2n ! 2 /x # ta tti > tiN |
163
|
|
|
|
|
|
|
|| s/(r)si $ /$1$1en !43 /x # vi RSI > rrEN |
164
|
|
|
|
|
|
|
|| s/([$k ])([$k3])$v2 $ /$1$2en ! 3 /x # hi rvi > rvEN |
165
|
|
|
|
|
|
|
|| s/([$v ])\1s $ /$1$1den ! 4 /x # tilais uus > uuDEN 1 1 |
166
|
|
|
|
|
|
|
|| s/([$v ])([$v ])s $ /$1$2ksen ! 5 /x # lauk auS > auKSEN 1 2 |
167
|
|
|
|
|
|
|
|| s/([$v ])([$v ])ka $ /$1$2an ! 9 /x # s iiKA > iiAN |
168
|
|
|
|
|
|
|
|| s/([$v ])p([$v ]) $ /$1v$2n !16 /x # n aPa > aVaN |
169
|
|
|
|
|
|
|
|| s/([$v ])([$k ])(a)s $ /$1$2$2$3$3n !25 /x # hi DAS > TAAN 4 0 |
170
|
|
|
|
|
|
|
|| s/([$k ])([$k ])(a)s $ /$1$2$3$3n !37 /x # ka rvAS > karvaaN 3 0 |
171
|
|
|
|
|
|
|
|| s/([$v ])s $ /$1ksen !23 /x # tik aS > aKSEN 4 1 |
172
|
|
|
|
|
|
|
|| s/(tt)([$v])n $ /$1$2in !28 /x # 4 3 |
173
|
|
|
|
|
|
|
|| s/(t)(i)n $ /$1$1$2men !45 /x # lii TIN > ttiMEN 4 4+ |
174
|
|
|
|
|
|
|
|| s/(t)(o)n $ /$1$1$2man !26 /x # ehdo TON > ttoMAN 4 4+ |
175
|
|
|
|
|
|
|
|| s/(l)(i)n $ /$1$2men !30 /x # puhe LIN > liMEN 4 4+ |
176
|
|
|
|
|
|
|
|| s/(e)(n) $ /$1$2en !49 /x # ahv EN > enEN 4 5 |
177
|
|
|
|
|
|
|
|| s/([$v ])([$k ]) $ /$1$2in !17 /x # kerm it > itIN 4 6 |
178
|
|
|
|
|
|
|
|| s/([$v ])(\1si) $ /$1$2n !52 /x # m uuSI > uusiN 6 1 |
179
|
|
|
|
|
|
|
|| s/([$v ])si $ /$1den ! 6 /x # ka uSI > uDEN 6 2 |
180
|
|
|
|
|
|
|
|| s/([$v ])(t)(e) $ /$1$2$2$3$3n !20 /x # ka TE > tteeN 2 -2 |
181
|
|
|
|
|
|
|
|| s/d(e) $ /t$1$1n !21 /x # kai DE > TeeN 2 -1 |
182
|
|
|
|
|
|
|
|| s/(sk)(e) $ /$1$2$2n !50 /x # rui SKE > skeeN 2 -0.5 |
183
|
|
|
|
|
|
|
|| s/(k)(e) $ /$1$1$2$2n !46 /x # pil KE > kkeeN 2 -0.5 |
184
|
|
|
|
|
|
|
|| s/(e) $ /$1$1n !18 /x # ven E > eeN 2 0 |
185
|
|
|
|
|
|
|
|| s/(te[$k6])ti $ /$1din !56 /x # arkki TEhTI > tehDIN 2 1.1 |
186
|
|
|
|
|
|
|
|| s/(e[$k6])ti $ /$1den !57 /x # le hTI > hDEN 2 1.2 |
187
|
|
|
|
|
|
|
|| s/([$k6])t([$v ]) $ /$1d$2n !27 /x # jo hTo > hDoN 2 1 |
188
|
|
|
|
|
|
|
|| s/([$v ])t([$v ]) $ /$1d$2n !10 /x # ha uTa > uDaN 2 2 |
189
|
|
|
|
|
|
|
|| s/([$k ])(i)(v)i $ /$1$2$3en !14 /x # k ivI > ivEN 2 3 |
190
|
|
|
|
|
|
|
|| s/([$k ])(o)([$k ])i $ /$1$2$3in !51 /x # aero sOlI > olIN 5 1 |
191
|
|
|
|
|
|
|
|| s/(oni) $ /$1n !54 /x # p ONI > oniN 5 3 |
192
|
|
|
|
|
|
|
|| s/(o)([$k ])i $ /$1$2en !31 /x # hu OlI > olEN 5 4 |
193
|
|
|
|
|
|
|
|| s/([$k4])ta $ /$1$1an ! 7 /x # si lTA > llAN |
194
|
|
|
|
|
|
|
|| s/(n)k([$v ]) $ /$1g$2n !28 /x # la NKo > ngoN |
195
|
|
|
|
|
|
|
|| s/(n)t([$v ]) $ /$1$1$2n !15 /x # ka NTo > nnoN |
196
|
|
|
|
|
|
|
|| s/(au)ki $ /$1en !47 /x # h AUKI > auEN |
197
|
|
|
|
|
|
|
|| s/(oim|ie[$k])i $ /$1en !48 /x # t OIMI > oimEN |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
# perussäännöt |
200
|
|
|
|
|
|
|
|| s/([$v ]) $/$1n ! 8 /x # kirj a > aN 7 1 |
201
|
|
|
|
|
|
|
|| s/(.) $/$1in !53 /x # aid S > sIN 7 2 |
202
|
|
|
|
|
|
|
; |
203
|
|
|
|
|
|
|
|
204
|
0
|
|
|
|
|
|
m/^([^ ]*) *!(.*)/; |
205
|
0
|
|
|
|
|
|
return $1,$2; |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
1; |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
__END__ |