1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
|
concrete NounFin of Noun = CatFin ** open ResFin, Prelude in {
flags optimize=all_subs ;
lin
-- The $Number$ is subtle: "nuo autot", "nuo kolme autoa" are both plural
-- for verb agreement, but the noun form is singular in the latter.
DetCN det cn =
let
n : Number = case det.isNum of {
True => Sg ;
_ => det.n
} ;
ncase : Case -> NForm = \c ->
case <n, c, det.isNum, det.isPoss, det.isDef> of {
<_, Nom, True,_,_> => NCase Sg Part ; -- kolme kytkintä(ni)
<_, _, True,False,_> => NCase Sg c ; -- kolmeksi kytkimeksi
<Pl,Nom, _,_,False> => NCase Pl Part ; -- kytkimiä
<_, Nom,_,True,_> => NPossNom n ; -- kytkime+ni on/ovat...
<_, Gen,_,True,_> => NPossNom n ; -- kytkime+ni vika
<_, Transl,_,True,_> => NPossTransl n ; -- kytkim(e|i)kse+ni
<_, Illat,_,True,_> => NPossIllat n ; -- kytkim(ee|ii)+ni
_ => NCase n c -- kytkin, kytkimen,...
}
in {
s = \\c => let k = npform2case n c in
det.s1 ! k ++ cn.s ! ncase k ++ det.s2 ;
a = agrP3 (case det.isDef of {
False => Sg ; -- autoja menee; kolme autoa menee
_ => det.n
}) ;
isPron = False
} ;
DetNP det =
let
n : Number = case det.isNum of {
True => Sg ;
_ => det.n
} ;
in {
s = \\c => let k = npform2case n c in
det.s1 ! k ; -- det.s2 is possessive suffix
a = agrP3 (case det.isDef of {
False => Sg ; -- autoja menee; kolme autoa menee
_ => det.n
}) ;
isPron = False
} ;
UsePN pn = {
s = \\c => pn.s ! npform2case Sg c ;
a = agrP3 Sg ;
isPron = False
} ;
UsePron p = p ** {isPron = True} ;
PredetNP pred np = {
s = \\c => pred.s ! np.a.n ! c ++ np.s ! c ;
a = np.a ;
isPron = np.isPron -- kaikki minun - ni
} ;
PPartNP np v2 = {
s = \\c => np.s ! c ++ v2.s ! PastPartPass (AN (NCase np.a.n Ess)) ;
a = np.a ;
isPron = np.isPron -- minun täällä - ni
} ;
AdvNP np adv = {
s = \\c => np.s ! c ++ adv.s ;
a = np.a ;
isPron = np.isPron -- minun täällä - ni
} ;
DetQuantOrd quant num ord = {
s1 = \\c => quant.s1 ! num.n ! c ++ num.s ! Sg ! c ++ ord.s ! Pl ! c ;
s2 = quant.s2 ;
n = num.n ;
isNum = num.isNum ;
isPoss = quant.isPoss ;
isDef = True
} ;
DetQuant quant num = {
s1 = \\c => quant.s1 ! num.n ! c ++ num.s ! Sg ! c ;
s2 = quant.s2 ;
n = num.n ;
isNum = case num.n of {Sg => False ; _ => True} ;
isPoss = quant.isPoss ;
isDef = True
} ;
{-
DetArtSg det cn =
let
n : Number = Sg ;
ncase : Case -> NForm = \c -> NCase n c ;
in {
s = \\c => let k = npform2case n c in
det.s1 ! Sg ! k ++ cn.s ! ncase k ;
a = agrP3 Sg ;
isPron = False
} ;
DetArtPl det cn =
let
n : Number = Pl ;
ncase : Case -> NForm = \c ->
case <n,c,det.isDef> of {
<Pl,Nom,False> => NCase Pl Part ; -- kytkimiä
_ => NCase n c -- kytkin, kytkimen,...
}
in {
s = \\c => let k = npform2case n c in
det.s1 ! Pl ! k ++ cn.s ! ncase k ;
a = agrP3 (case det.isDef of {
False => Sg ; -- autoja menee; kolme autoa menee
_ => Pl
}) ;
isPron = False
} ;
-}
PossPron p = {
s1 = \\_,_ => p.s ! NPCase Gen ;
s2 = BIND ++ possSuffix p.a ;
isNum = False ;
isPoss = True ;
isDef = True --- "minun kolme autoani ovat" ; thus "...on" is missing
} ;
NumSg = {s = \\_,_ => [] ; isNum = False ; n = Sg} ;
NumPl = {s = \\_,_ => [] ; isNum = False ; n = Pl} ;
NumCard n = n ** {isNum = case n.n of {Sg => False ; _ => True}} ; -- yksi talo/kaksi taloa
NumDigits numeral = {
s = \\n,c => numeral.s ! NCard (NCase n c) ;
n = numeral.n
} ;
OrdDigits numeral = {s = \\n,c => numeral.s ! NOrd (NCase n c)} ;
NumNumeral numeral = {
s = \\n,c => numeral.s ! NCard (NCase n c) ;
n = numeral.n
} ;
OrdNumeral numeral = {s = \\n,c => numeral.s ! NOrd (NCase n c)} ;
AdNum adn num = {
s = \\n,c => adn.s ++ num.s ! n ! c ;
n = num.n
} ;
OrdSuperl a = {s = \\n,c => a.s ! Superl ! AN (NCase n c)} ;
DefArt = {
s1 = \\_,_ => [] ;
s2 = [] ;
isNum,isPoss = False ;
isDef = True -- autot ovat
} ;
IndefArt = {
s1 = \\_,_ => [] ; -- Nom is Part in Pl: use isDef in DetCN
s2 = [] ;
isNum,isPoss,isDef = False -- autoja on
} ;
MassNP cn =
let
n : Number = Sg ;
ncase : Case -> NForm = \c -> NCase n c ;
in {
s = \\c => let k = npform2case n c in
cn.s ! ncase k ;
a = agrP3 Sg ;
isPron = False
} ;
UseN n = n ;
UseN2 n = n ;
Use2N3 f = {
s = f.s ;
c2 = f.c2 ;
isPre = f.isPre
} ;
Use3N3 f = {
s = f.s ;
c2 = f.c3 ;
isPre = f.isPre2
} ;
--- If a possessive suffix is added here it goes after the complements...
ComplN2 f x = {
s = \\nf => preOrPost f.isPre (f.s ! nf) (appCompl True Pos f.c2 x)
} ;
ComplN3 f x = {
s = \\nf => preOrPost f.isPre (f.s ! nf) (appCompl True Pos f.c2 x) ;
c2 = f.c3 ;
isPre = f.isPre2
} ;
AdjCN ap cn = {
s = \\nf => ap.s ! True ! AN (n2nform nf) ++ cn.s ! nf
} ;
RelCN cn rs = {s = \\nf => cn.s ! nf ++ rs.s ! agrP3 (numN nf)} ;
RelNP np rs = {
s = \\c => np.s ! c ++ "," ++ rs.s ! np.a ;
a = np.a ;
isPron = np.isPron ---- correct ?
} ;
AdvCN cn ad = {s = \\nf => cn.s ! nf ++ ad.s} ;
SentCN cn sc = {s = \\nf=> cn.s ! nf ++ sc.s} ;
ApposCN cn np = {s = \\nf=> cn.s ! nf ++ np.s ! NPCase Nom} ; --- luvun x
oper
numN : NForm -> Number = \nf -> case nf of {
NCase n _ => n ;
_ => Sg ---
} ;
}
|