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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
|
--# -path=.:../romance:../common:../abstract:../../prelude
--1 Romanian Lexical Paradigms
--
-- Ramona Enache 2008 - 2009
--
resource ParadigmsRon =
open
(Predef=Predef),
Prelude,
MorphoRon,
CatRon,
BeschRon in {
flags optimize=all ;
--2 Parameters
--
-- To abstract over gender names, we define the following identifiers.
oper
NGender : Type ;
masculine : NGender ;
feminine : NGender ;
neuter : NGender ;
Gender : Type ;
Masculine : Gender ;
Feminine : Gender ;
--To abstract over animacy, we define the following :
Anim : Type ;
animate : Anim ;
inanimate : Anim;
-- To abstract over number names, we define the following.
Number : Type ;
singular : Number ;
plural : Number ;
-- prepositions which require cases :
Preposition : Type ;
NCase : Type ;
Acc : NCase ;
Dat : NCase ;
Gen : NCase ;
mkPrep : Str -> NCase -> Prep ;
noPrep : NCase -> Prep ;
--2 Nouns
--3 Relational nouns
--
-- Relational nouns need a noun and a preposition.
mkN2 : N -> Prep -> N2 ;
mkN2 n p = n ** {lock_N2 = <> ; c2 = p};
-- Three-place relational nouns need two prepositions.
mkN3 : N -> Prep -> Prep -> N3 ;
mkN3 n p q = n ** {lock_N3 = <> ; c2 = p ; c3 = q };
--3 Proper names and noun phrases
--
-- Proper names need a string and a gender. If no gender is given, the
-- feminine is used for strings ending with "e", the masculine for other strings.
mkPN = overload {
mkPN : Str -> PN = mkPropN ;
mkPN : Str -> Gender -> PN = mkPropNoun ;
mkPN : Str -> Gender -> Number -> PN = mkProperNoun;
} ;
mkPropN : Str -> PN = \Ion ->
case last Ion of
{ "a" => mkPropNoun Ion Feminine ;
_ => mkPropNoun Ion Masculine
};
mkPropNoun : Str -> Gender -> PN = \Ion, gen ->
mkProperNoun Ion gen singular ;
mkProperNoun : Str -> Gender -> Number -> PN = \Ion, gen, num ->
{s = table {ANomAcc => Ion;
AGenDat => case <last Ion,gen> of
{ <"a",Fem> => init Ion + "ei" ;
_ => "lui" ++ Ion
};
AVoc => Ion
};
g = gen ;
n = num ;
lock_PN = <>
};
--3 Two-place adjectives
--
-- Two-place adjectives need a preposition for their second argument.
mkA2 : A -> Prep -> A2 ;
mkA2 a p = a ** {c2 = p ; lock_A2 = <>} ;
--.
--2 Definitions of the paradigms
--
-- The definitions should not bother the user of the API. So they are
-- hidden from the document.
NGender = MorphoRon.NGender ;
Number = MorphoRon.Number ;
Anim = MorphoRon.Animacy ;
Gender = MorphoRon.Gender ;
NCase = MorphoRon.NCase ;
masculine = NMasc ;
feminine = NFem ;
neuter = NNeut ;
singular = Sg ;
plural = Pl ;
animate = Animate ;
inanimate = Inanimate ;
Masculine = Masc ;
Feminine = Fem ;
Acc = Ac ;
Dat = Da ;
Gen = Ge ;
Preposition = Compl ;
mkPrep ss cc = {s = ss ; c = cc; isDir = True; lock_Prep = <>} ;
noPrep cc = mkPrep [] cc ;
compN : N -> Str -> N ;
compN x y = composeN x y ** {lock_N = <>} ;
ccompN : N -> Str -> N ;
ccompN x y = ccompose x y ** {lock_N = <>} ;
mkNI : Str -> Str -> NGender -> N;
mkNI s ss g = mkIn (mkNomIrreg s ss g) ** {lock_N = <>} ;
regN : Str -> NGender -> N ;
regN s g = mkIn (mkNomReg s g) ** {lock_N = <>};
mkVI : Str -> Str -> Str -> N;
mkVI s ss sss = mkIn (mkNomVIrreg s ss sss) ** {lock_N = <>} ;
mkIn : N -> N ;
mkIn n = mkInanimate n ** {lock_N = <> };
mkAnim : N -> N ;
mkAnim n = mkAnimate n ** {lock_N = <> };
chV : Str -> N -> N ;
chV s n = mkVocc n s ** {lock_N = <> } ;
--smart paradigm for inferring the gender of the nouns
--partly based on the paper
--"COVERT SEMANTIC AND MORPHOPHONEMIC CATEGORIES IN THE ROMANIAN GENDER SYSTEM"
-- by Jan Louis Perkowski, Emil Vrabie
mkSPN : Str -> N ;
mkSPN s = case s of
{ x + ("ã"|"e"|"a") => regN s feminine ;
x + ("el"|"mp"|"mb"|"en"|"id"|"at"|"ete"|"ol"|"et"|"or") => regN s masculine ;
_ => regN s neuter
};
mkNN : Str -> Str -> N ;
mkNN s ss = case s of
{ x + ("ã"|"e"|"a") => mkNI s ss feminine ;
_ => case ss of
{x + "uri" => mkNI s ss neuter ;
x + "e" => mkNI s ss neuter ;
_ => mkNI s ss masculine
}
};
mkN = overload {
mkN : Str -> Str -> NGender -> N = mkNI; -- worst case - we need Singular + Plural form + gender
mkN : Str -> Str -> Str -> N = mkVI; -- very irregular nouns - feminine
mkN : Str -> Str -> N = mkNN; -- needed Singular + Plural form, infers gender
mkN : Str -> NGender -> N = regN; -- needed Singular + gender, infers Plural form
mkN : Str -> N = mkSPN; -- needed Singular form, infers gender and Plural form
} ;
--because the plurals ending in "uri" are becoming less and less frequent for neuter nouns,
--and because there is no way of infering the plural form by looking at the structure of the word
--we treat this case separately :
mkNR : Str -> N;
mkNR s = mkIn (mkNomNeut s) ** {lock_N = <>} ;
--------------------------------------------------------------------
mkA = overload {
mkA : Str -> Str -> Str -> Str -> Str -> A = mk5A ;--worst case -- all 4 forms are needed + form for adverb
mkA : Str -> Str -> Str -> Str -> A = mk4A; -- 4 forms are needed
mkA : Str -> A = regA; -- regular adjectives
};
mk4A : Str -> Str -> Str -> Str -> A;
mk4A a b c d =
let adj = mkAdjSpec a b c d in
{s = table { Posit => adj.s ;
Compar => \\f => "mai" ++ (adj.s ! f) ++ "decât";
Superl => table {AF g n a c => artDem g n c ++ "mai" ++ adj.s ! (AF g n Indef c) ;
AA => artDem Masc Sg ANomAcc ++ "mai" ++ adj.s ! AA
}
}; isPre = False ; lock_A = <>} ;
mk5A : Str -> Str -> Str -> Str -> Str -> A ;
mk5A a b c d e =
let adj = mkAdjSSpec a b c d e in
{s = table { Posit => adj.s ;
Compar => \\f => "mai" ++ (adj.s ! f) ++ "decât";
Superl => table {AF g n a c => artDem g n c ++ "mai" ++ adj.s ! (AF g n Indef c);
AA => artDem Masc Sg ANomAcc ++ "mai" ++ adj.s ! AA
}
}; isPre = False ; lock_A = <>} ;
regA : Str -> A = \auriu -> let adj = mkAdjReg auriu in
{s = table {Posit => adj.s ;
Compar => \\f => "mai" ++ (adj.s ! f) ++ "decât";
Superl => table {AF g n a c => artDem g n c ++ "mai" ++ adj.s ! (AF g n Indef c);
AA => artDem Masc Sg ANomAcc ++ "mai" ++ adj.s ! AA
}
}; isPre = False ; lock_A = <> } ;
invarA : Str -> A = \auriu ->
let adj =mkAdjInvar auriu in
{s = table { Posit => adj.s ;
Compar => \\f => "mai" ++ (adj.s ! f) ++ "decât";
Superl => table {AF g n a c => artDem g n c ++ "mai" ++ adj.s ! (AF g n Indef c);
AA => artDem Masc Sg ANomAcc ++ "mai" ++ adj.s ! AA
}
}; isPre = False ; lock_A = <>} ;
mkRMut : Str -> A = \auriu ->
let adj = mkRegMut auriu in
{s = table { Posit => adj.s ;
Compar => \\f => "mai" ++ (adj.s ! f) ++ "decât";
Superl => table {AF g n a c => artDem g n c ++ "mai" ++ adj.s ! (AF g n Indef c);
AA => artDem Masc Sg ANomAcc ++ "mai" ++ adj.s ! AA
}
}; isPre = False ; lock_A = <>} ;
mkSMut : Str -> A = \auriu ->
let adj = mkSpecMut auriu in
{s = table { Posit => adj.s ;
Compar => \\f => "mai" ++ (adj.s ! f) ++ "decât";
Superl => table {AF g n a c => artDem g n c ++ "mai" ++ adj.s ! (AF g n Indef c);
AA => artDem Masc Sg ANomAcc ++ "mai" ++ adj.s ! AA
}
}; isPre = False ; lock_A = <>} ;
mkADeg : A -> A -> A ;
noComp : A -> A ;
prefA : A -> A ;
mkADeg a b =
{s = table {Posit => a.s ! Posit ; _ => b.s ! Posit} ; isPre = a.isPre ; lock_A = <>} ;
noComp a =
{s = \\_ => a.s ! Posit ;
isPre = a.isPre ;
lock_A = <>} ;
prefA a = {s = a.s ; isPre = True ; lock_A = <>} ;
--Adverbs :
mkAdv : Str -> Adv ;
mkAdV : Str -> AdV ;
mkAdA : Str -> AdA ;
mkAdv x = ss x ** {lock_Adv = <>} ;
mkAdV x = ss x ** {lock_AdV = <>} ;
mkAdA x = ss x ** {lock_AdA = <>} ;
--Verbs :
oper regV : Str -> Verbe = \s ->
case s of
{ x + ("chea"|"ghea") => mkV61 s ;
x + "ea" => mkV69 s ;
x + "ca" => mkV8 s ;
x + "ga" => mkV9 s ;
x + "eia" => mkV11 s;
x + "ia" => mkV10 s;
x + "a" => mkV6 s ;
x + "e" => mkV79 s ;
x + "ui" => mkV121 s ;
x + "ii" => mkV120 s ;
x + "i" => mkV119 s ;
x + "î" => mkV141 s
};
oper mkV : Str -> V = \s -> mkNV (regV s) ;
mkV2S : V -> Prep -> V2S ;
-- mkVV : V -> VV ;
mkV2V : V -> Prep -> Prep -> V2V ;
mkVA : V -> VA ;
mkV2A : V -> Prep -> Prep -> V2A ;
mkVQ : V -> VQ ;
mkV2Q : V -> Prep -> V2Q ;
mkAS : A -> AS ;
mkA2S : A -> Prep -> A2S ;
mkAV : A -> Prep -> AV ;
mkA2V : A -> Prep -> Prep -> A2V ;
mmkV3 : V -> Prep -> Prep -> V3;
mmkV3 v p q = v ** {c2 = p ; c3 = q ; lock_V3 = <>} ;
dirV3 : V -> V3 ;
dirV3 v = mmkV3 v (noPrep Ac) (noPrep Da) ;
mkV3 = overload {
mkV3 : V -> V3 = dirV3 ;
mkV3 : V -> Prep -> Prep -> V3 = mmkV3
} ;
V0 : Type = V ;
AS, AV : Type = A ;
A2S, A2V : Type = A2 ;
mkV0 : V -> V0 ;
mkV0 v = v ** {lock_V0 = <>} ;
mmkV2 : V -> Prep -> V2 ;
mmkV2 v p = v ** {c2 = p ; lock_V2 = <>} ;
dirV2 : V -> V2 ;
dirV2 v = mmkV2 v (noPrep Ac) ;
mmkV3 : V -> Prep -> Prep -> V3 ;
mmkV3 v p q = v ** {c2 = p ; c3 = q ; lock_V3 = <>} ;
mkVS : V -> VS ;
mkVS v = v ** {m = \\_ => Indic ; lock_VS = <>} ;
mkV2S v p = mmkV2 v p ** {mn,mp = Indic ; lock_V2S = <>} ;
-- mkVV v = v ** {c2 = complAcc ; lock_VV = <>} ;
-- deVV v = v ** {c2 = complGen ; lock_VV = <>} ;
--aVV v = v ** {c2 = complDat ; lock_VV = <>} ;
mkV2V v p q = mmkV3 v p q ** {lock_V2V = <>} ;
mkVA v = v ** {lock_VA = <>} ;
mkV2A v p q = mmkV3 v p q ** {lock_V2A = <>} ;
mkVQ : V -> VQ ;
mkVQ v = v ** {lock_VQ = <>} ;
mkV2Q : V -> Prep -> V2Q ;
mkV2Q v p = mmkV2 v p ** {lock_V2Q = <>} ;
mkAS v = v ** {lock_AS = <>} ; ---- more moods
mkA2S v p = mkA2 v p ** {lock_A2S = <>} ;
mkAV v p = v ** {c = p.p1 ; s2 = p.p2 ; lock_AV = <>} ;
mkA2V v p q = mkA2 v p ** {s3 = q.p2 ; c3 = q.p1 ; lock_A2V = <>} ;
mkOrd : A -> Ord ;
mkOrd a = {s = a.s ! Posit ; isPre = a.isPre ; lock_Ord = <>} ;
--mkComp a =
--let adj = a.s ! Posit in
--{ s = table {Posit => adj ;
-- Compar => \\f => "mai" ++ adj ! f ++ "decât";
-- Superl => table {AF g n a c => (artDem g n c) ++ "mai" ++ adj ! (AF g n a c);
-- AA => "cel"++"mai" ++ adj ! AA
-- }
-- };
-- isPre = a.isPre ;
-- lock_A = <>
-- };
} ;
|