1
0
forked from GitHub/gf-rgl

fix a few morphological paradigms for Dutch

This commit is contained in:
Inari Listenmaa
2018-01-11 18:36:33 +01:00
parent 4907a74b44
commit 0bce34d243

View File

@@ -34,16 +34,18 @@ resource ResDut = ParamX ** open Prelude, Predef in {
regNoun : Str -> Noun = \s -> case s of { regNoun : Str -> Noun = \s -> case s of {
_ + ("a" | "o" | "y" | "u" | "oe" | "é") => mkNoun s (s + "'s") Utr ; _ + ("a" | "o" | "y" | "u" | "oe" | "é") => mkNoun s (s + "'s") Utr ;
_ + ("oir" | "ion" | "je") => mkNoun s (s + "s") Neutr ; _ + ("oir" | "ion" | "je" | "c") => mkNoun s (s + "s") Neutr ;
? + ? + ? + _ + ? + ? + ? + _ +
("el" | "em" | "en" | "er" | "erd" | "aar" | "aard" | "ie") => -- unstressed ("el" | "em" | "en" | "er" | "erd" | "aar" | "aard" | "ie") => -- unstressed
mkNoun s (s + "s") Utr ; mkNoun s (s + "s") Utr ;
_ + ("i"|"u") => mkNoun s (endCons s + "en") Utr ; _ + ("i"|"u") => mkNoun s (endCons s + "en") Utr ;
b + v@("aa"|"ee"|"oo"|"uu") + c@? => mkNoun s (b + shortVoc v c + "en") Utr ; b + v@("aa"|"ee"|"oo"|"uu") + c@? => mkNoun s (b + shortVoc v c + "en") Utr ;
b + ("ei"|"eu"|"oe"|"ou"|"ie"|"ij"|"ui") + ? => mkNoun s (endCons s + "en") Utr ; b + ("ei"|"eu"|"oe"|"ou"|"ie"|"ij"|"ui") + ? => mkNoun s (endCons s + "en") Utr ;
_ + "ie" => mkNoun s (s + "ën") Utr ; _ + ("ie"|"ee") => mkNoun s (s + "ën") Utr ; -- zee→zeeën, knie→knieën.
b + v@("a"|"e"|"i"|"o"|"u" ) + c@? => mkNoun s (b + v + c + c + "en") Utr ; -- olie→oliën, industrie→industrieën with 2-arg constructor.
_ => mkNoun s (endCons s + "en") Utr b + v@("a"|"e"|"i"|"o"|"u") + c@? => mkNoun s (b + v + c + c + "en") Utr ;
_ + "e" => mkNoun s (s + "s") Utr ; -- vrede→vredes. Might not be a good generalisation though. /IL2018
_ => mkNoun s (endCons s + "en") Utr
} ; } ;
regNounG : Str -> Gender -> Noun = \s,g -> { regNounG : Str -> Gender -> Noun = \s,g -> {
@@ -180,17 +182,22 @@ param
} ; } ;
-- Pattern matching verbs -- Pattern matching verbs
-- Checking if the verb starts with "ver" is due to a bugfix in mkStem regarding ≥2-syllable verbs. /IL2018
smartVerb : (_,_:Str) -> Verb = \verb,stem -> smartVerb : (_,_:Str) -> Verb = \verb,stem ->
let raw = Predef.tk 2 verb; let raw = Predef.tk 2 verb;
vg : {ver : Str ; geet : Str } = case verb of {
"ver" + geten => {ver = "ver" ; geet = mkStem geten } ;
_ => {ver = [] ; geet = stem } } ;
vergeten : Str = verb ;
vergeet : Str = vg.ver + vg.geet ;
in in
case raw of { case raw of {
_+ ("k"|"f"|"s"|"c"|"h"|"p") => t_regVerb verb stem; _+ ("k"|"f"|"s"|"c"|"h"|"p") => t_regVerb vergeten vergeet ;
_+ "v" => v_regVerb verb; _+ "v" => v_regVerb vergeten vergeet ;
_+ "z" => z_regVerb verb; _+ "z" => z_regVerb vergeten vergeet ;
_+ ("t" | "tt") => t_end_regVerb verb; _+ ("t" | "tt") => t_end_regVerb vergeten vergeet ;
_+ "d" => d_end_regVerb verb; _+ "d" => d_end_regVerb vergeten vergeet ;
_ => d_regVerb vergeten vergeet
_ => d_regVerb verb stem
}; };
consonant : pattern Str = #("b"|"c"|"d"|"f"|"g"|"h"|"j"|"k"|"l"|"m"|"n"|"p"|"q"|"r"|"s"|"t"|"v"|"w"|"x"|"y"|"z") ; consonant : pattern Str = #("b"|"c"|"d"|"f"|"g"|"h"|"j"|"k"|"l"|"m"|"n"|"p"|"q"|"r"|"s"|"t"|"v"|"w"|"x"|"y"|"z") ;
@@ -200,10 +207,9 @@ param
-- If a stem ends in a 'z' then the 'z' changes into an 's' -- If a stem ends in a 'z' then the 'z' changes into an 's'
-- If a stem ends on a double consonant then one of them disappears -- If a stem ends on a double consonant then one of them disappears
-- If a stem ends on a consonant but that consonant has exactly 1 vowel before it -- If a stem ends on a consonant but that consonant has exactly 1 vowel before it
-- then we have to double this vowel -- then we have to double this vowel (but only if it's a monosyllable stem!)
-- Only if it's a monosyllable stem! mkStem : Str -> Str = \lopen ->
mkStem : Str -> Str =\lopen -> let
let
lop = tk 2 lopen ; --drop the -en lop = tk 2 lopen ; --drop the -en
lo = init lop ; lo = init lop ;
o = last lo ; o = last lo ;
@@ -218,10 +224,15 @@ param
werk = lop -- no changes to stem werk = lop -- no changes to stem
in in
case lop of { -- stress is on the first vowel, so latter one doesn't double. case lop of {
_+ #vowel + #consonant + #vowel + _ => lop ; -- this catches ademen, rekenen, schakelen etc. / IL2018 -- Penultimate is vowel, but it doesn't double: either because
#vowel + #consonant => loop ; _+ #vowel + _ + #vowel + #consonant => kerf ; -- a) ≥2 syllables, e.g. ademen, rekenen, schakelen
_+ #consonant + #vowel + #consonant => loop ; -- stressed vowel doubles. -- b) diphthong, e.g. vriezen (ij + #consonant falls into the default case!)
-- OBS. will do the wrong thing, if you use it on prefix verbs
_ + #vowel + ("w"|"j") => werk ; -- Don't double a vowel before a w or j (are there other consonants?)
_ + #vowel + #consonant => loop ; -- In other cases, a single penultimate vowel doubles.
_+ ("bb" | "dd" | "ff" | "gg" | "kk" | "ll" | "mm" | "nn" | "pp" | _+ ("bb" | "dd" | "ff" | "gg" | "kk" | "ll" | "mm" | "nn" | "pp" |
"rr" | "ss" | "tt") => zeg ; "rr" | "ss" | "tt") => zeg ;
_+ #consonant + ("v"|"z") => kerf ; _+ #consonant + ("v"|"z") => kerf ;
@@ -238,55 +249,40 @@ param
-- For regular verbs with past tense 'd' -- For regular verbs with past tense 'd'
d_regVerb : (_,_ :Str) -> Verb = \geeuwen,geeuw -> d_regVerb : (_,_ :Str) -> Verb = \geeuwen,geeuw ->
let stem = geeuw --- mkStem geeuwen mkVerb geeuw (geeuw + "t") geeuwen
in (geeuw + "de") (geeuw + "de") (geeuw + "den")
mkVerb stem (stem + "t") geeuwen ("ge" + geeuw + "d");
(stem + "de") (stem + "de") (stem + "den")
("ge" + stem + "d");
-- For regular verbs with past tense 't' -- For regular verbs with past tense 't'
t_regVerb : (_,_ :Str) -> Verb = \botsen,bots -> t_regVerb : (_,_ :Str) -> Verb = \botsen,bots ->
let bots = mkStem botsen
in
mkVerb bots (bots + "t") botsen mkVerb bots (bots + "t") botsen
(bots + "te") (bots + "te") (bots + "ten") (bots + "te") (bots + "te") (bots + "ten")
("ge" + bots + "t"); ("ge" + bots + "t");
-- For verbs that dont need an extra 't' at the end -- For verbs that dont need an extra 't' at the end
t_end_regVerb : Str -> Verb = \achten -> t_end_regVerb : (_,_ : Str) -> Verb = \achten,acht ->
let acht = mkStem achten
in
mkVerb acht (acht) achten mkVerb acht (acht) achten
(acht + "te") (acht +"te") (acht+"ten") ("ge"+acht); (acht + "te") (acht +"te") (acht+"ten") ("ge"+acht);
-- For verbs that dont need an extra 'd' at the end -- For verbs that dont need an extra 'd' at the end
d_end_regVerb : Str -> Verb = \aarden -> d_end_regVerb : (_,_ : Str) -> Verb = \aarden,aard ->
let aard = mkStem aarden
in
mkVerb aard (aard+"t") aarden mkVerb aard (aard+"t") aarden
(aard + "de") (aard +"de") (aard+"den") ("ge"+aard); (aard + "de") (aard +"de") (aard+"den") ("ge"+aard);
-- For verbs that need a vowel doubled in singular -- For verbs that need a vowel doubled in singular
add_vowel_regVerb : Str -> Verb = \absorberen -> add_vowel_regVerb : (_,_ : Str) -> Verb = \absorberen,stem ->
let stem = mkStem absorberen
in
case stem of { case stem of {
_+ ("t"|"k"|"f"|"s"|"c"|"h"|"p") => t_regVerb absorberen stem; _+ ("t"|"k"|"f"|"s"|"c"|"h"|"p") => t_regVerb absorberen stem;
_ => d_regVerb absorberen stem _ => d_regVerb absorberen stem
}; };
-- For verbs that have their stem ending with a 'z' -- For verbs that have their stem ending with a 'z'
z_regVerb : Str -> Verb = \omhelzen -> z_regVerb : (_,_ : Str) -> Verb = \omhelzen,stem ->
let stem = mkStem omhelzen d_regVerb omhelzen stem;
in
d_regVerb omhelzen stem;
-- For verbs that have their stem ending with a 'v' -- For verbs that have their stem ending with a 'v'
v_regVerb : Str -> Verb = \hoeven -> v_regVerb : (_,_ : Str) -> Verb = \hoeven,hoef ->
let hoef = mkStem hoeven mkVerb hoef (hoef +"t") hoeven (hoef+"de") (hoef+"de") (hoef+"den") ("ge"+hoef+"d");
in
mkVerb hoef (hoef +"t") hoeven (hoef+"de") (hoef+"de") (hoef+"den")
("ge"+hoef+"d");
zijn_V : VVerb = { zijn_V : VVerb = {
s = table { s = table {
@@ -427,7 +423,7 @@ param
---- The order of sentence is depends on whether it is used as a main ---- The order of sentence is depends on whether it is used as a main
---- clause, inverted, or subordinate. ---- clause, inverted, or subordinate.
oper oper
Preposition : Type = MergesWithPrep ** { s : Str } ; Preposition : Type = MergesWithPrep ** { s : Str } ;
-- This is a hack for appPrep: sometimes we don't really need a full NP -- This is a hack for appPrep: sometimes we don't really need a full NP
@@ -444,7 +440,6 @@ param
_ => prep.s ++ np.s ! NPAcc } ; _ => prep.s ++ np.s ! NPAcc } ;
param param
Order = Main | Inv | Sub ; Order = Main | Inv | Sub ;