improving mini res morpho

This commit is contained in:
aarne
2007-08-16 14:10:06 +00:00
parent 1f342b2c25
commit 5f0e8a16ec
8 changed files with 335 additions and 213 deletions

View File

@@ -4,6 +4,13 @@
resource MorphoIta = open Prelude in {
-- the lexicographer's API
oper
masculine, feminine : Gender ;
param
Number = Sg | Pl ;
Gender = Masc | Fem ;
@@ -16,6 +23,10 @@
Verb : Type = {s : Number => Str} ;
-- two-place verbs have a preposition
Verb2 : Type = Verb ** {c : Str} ;
-- this function takes the gender and both singular and plural forms
mkNoun : Gender -> Str -> Str -> Noun = \g,vino,vini -> {
@@ -28,16 +39,18 @@
-- this function takes the singular form
regNoun : Str -> Noun = \vino ->
let
vin = init vino ;
o = last vino
in
case o of {
"a" => mkNoun Fem vino (vin + "e") ; -- pizza
"o" | "e" => mkNoun Masc vino (vin + "i") ; -- vino, pane
_ => mkNoun Masc vino vino -- tram
} ;
regNoun : Str -> Noun = \vino ->
case vino of {
vin + c@("c" | "g") + "a"
=> mkNoun Fem vino (vin + c + "he") ; -- banche
vin + "a"
=> mkNoun Fem vino (vin + "e") ; -- pizza
vin + c@("c" | "g") + "o"
=> mkNoun Masc vino (vin + c + "hi") ; -- boschi
vin + ("o" | "e")
=> mkNoun Masc vino (vin + "i") ; -- vino, pane
_ => mkNoun Masc vino vino -- tram
} ;
-- to make nouns such as "carne", "università" feminine