From 8508b8be0190fb071ecdb138dfdfe28ca3752e18 Mon Sep 17 00:00:00 2001 From: inari Date: Thu, 19 Jun 2014 09:54:48 +0000 Subject: [PATCH] Major changes in Dutch: word order fixes, add particle verbs, fixes in verb smart paradigms --- lib/src/dutch/CatDut.gf | 9 ++-- lib/src/dutch/ExtraDut.gf | 5 +- lib/src/dutch/LexiconDut.gf | 4 +- lib/src/dutch/ParadigmsDut.gf | 19 ++++--- lib/src/dutch/ResDut.gf | 98 +++++++++++++++++++++-------------- lib/src/dutch/SentenceDut.gf | 10 ++-- lib/src/dutch/VerbDut.gf | 19 ++++--- 7 files changed, 97 insertions(+), 67 deletions(-) diff --git a/lib/src/dutch/CatDut.gf b/lib/src/dutch/CatDut.gf index 2390cb274..5e384c66a 100644 --- a/lib/src/dutch/CatDut.gf +++ b/lib/src/dutch/CatDut.gf @@ -34,7 +34,7 @@ concrete CatDut of Cat = -- Verb VP = ResDut.VP ; - VPSlash = ResDut.VP ** {c2 : Preposition} ; + VPSlash = ResDut.VP ** {c2 : Preposition * Bool} ; Comp = {s : Agr => Str} ; -- Adjective @@ -73,9 +73,10 @@ concrete CatDut of Cat = V, VS, VQ, VA = ResDut.VVerb ; VV = VVerb ** {isAux : Bool} ; - V2, V2A, V2S, V2Q = VVerb ** {c2 : Preposition} ; - V2V = VVerb ** {c2 : Preposition ; isAux : Bool} ; - V3 = VVerb ** {c2, c3 : Preposition} ; + V2, V2A, V2S, V2Q = VVerb ** {c2 : Preposition * Bool} ; + V2V = VVerb ** {c2 : Preposition * Bool ; isAux : Bool} ; + V3 = VVerb ** {c2, c3 : Preposition * Bool} ; + -- Preposition * Bool: True if there is a preposition (info needed for word order) A = Adjective ; A2 = Adjective ** {c2 : Preposition} ; diff --git a/lib/src/dutch/ExtraDut.gf b/lib/src/dutch/ExtraDut.gf index 77ed350d6..e88a7efda 100644 --- a/lib/src/dutch/ExtraDut.gf +++ b/lib/src/dutch/ExtraDut.gf @@ -120,8 +120,9 @@ lin insertAdv (appPrep "door" np.s) (insertInf (vps.s.s ! VPerf) (predV ResDut.worden_V)) ; lin - NominalizeVPSlashNP vpslash np = - let vp : ResDut.VP = insertObjNP np.isPron (\\_ => appPrep vpslash.c2 np.s) vpslash ; + NominalizeVPSlashNP vpslash np = + --False for negation place; doesn't matter because vp.a1 ! Pos is chosen + let vp : ResDut.VP = insertObjNP np.isPron False (\\_ => appPrep vpslash.c2.p1 np.s) vpslash ; agrDef : Agr = agrP3 Sg ; compl : Str = vp.n0 ! agrDef ++ vp.a1 ! Pos ++ vp.n2 ! agrDef ++ vp.s.prefix ; inf : Str = vp.inf.p1 ; diff --git a/lib/src/dutch/LexiconDut.gf b/lib/src/dutch/LexiconDut.gf index 251aed71e..a70bcea9a 100644 --- a/lib/src/dutch/LexiconDut.gf +++ b/lib/src/dutch/LexiconDut.gf @@ -200,7 +200,7 @@ leather_N = mkN "leer" neuter ; leave_V2 = mkV2 (mkV "verlaten" "verliet" "verlieten" "verlaten") ; leg_N = mkN "been" neuter ; lie_V = liggen_V ; -like_V2 = mkV2 houden_V van_Prep ; +like_V2 = mkV2 (partV (mkV "vinden") "leuk") ; listen_V2 = mkV2 "luisteren" ; live_V = mkV "leven" ; liver_N = mkN "lever" utrum ; @@ -208,7 +208,7 @@ long_A = mkA "lang" ; lose_V2 = mkV2 verliezen_V ; louse_N = mkN "luis" utrum ; love_N = mkN "liefde" utrum ; -love_V2 = mkV2 (mkV "lief" hebben_V) ; +love_V2 = mkV2 houden_V van_Prep ; man_N = mkN "man" utrum ; meat_N = mkN "vlees" neuter ; milk_N = mkN "melk" utrum ; diff --git a/lib/src/dutch/ParadigmsDut.gf b/lib/src/dutch/ParadigmsDut.gf index 327cedbda..7ad25ba69 100644 --- a/lib/src/dutch/ParadigmsDut.gf +++ b/lib/src/dutch/ParadigmsDut.gf @@ -267,14 +267,17 @@ oper mkV : V -> Str -> V = \s,v ->lin V (prefixV v s) ; ---- the same, in order matching Wiktionary-generated lexicon } ; zijnV v = lin V (v2vvAux v VZijn) ; - reflV v = lin V {s = v.s ; aux = v.aux ; prefix = v.prefix ; vtype = VRefl} ; + reflV v = lin V {s = v.s ; aux = v.aux ; particle = v.particle ; prefix = v.prefix ; vtype = VRefl} ; + + partV : V -> Str -> V = \vinden,leuk -> + vinden ** {particle = leuk} ; no_geV v = let vs = v.s in { s = table { VPerf => Predef.drop 2 (vs ! VPerf) ; p => vs ! p } ; - prefix = v.prefix ; lock_V = v.lock_V ; aux = v.aux ; vtype = v.vtype + prefix = v.prefix ; lock_V = v.lock_V ; particle = v.particle ; aux = v.aux ; vtype = v.vtype } ; fixprefixV s v = let vs = v.s in { @@ -282,16 +285,16 @@ oper VPerf => s + Predef.drop 2 (vs ! VPerf) ; p => s + vs ! p } ; - prefix = v.prefix ; lock_V = v.lock_V ; aux = v.aux ; vtype = v.vtype + prefix = v.prefix ; lock_V = v.lock_V ; aux = v.aux ; particle = v.particle ; vtype = v.vtype } ; zijn_V : V = lin V ResDut.zijn_V ; hebben_V : V = lin V ResDut.hebben_V ; mkV2 = overload { - mkV2 : Str -> V2 = \s -> lin V2 (v2vv (regVerb s) ** {c2 = []}) ; - mkV2 : V -> V2 = \s -> lin V2 (s ** {c2 = []}) ; - mkV2 : V -> Prep -> V2 = \s,p -> lin V2 (s ** {c2 = p.s}) ; + mkV2 : Str -> V2 = \s -> lin V2 (v2vv (regVerb s) ** {c2 = <[],False>}) ; + mkV2 : V -> V2 = \s -> lin V2 (s ** {c2 = <[],False>}) ; + mkV2 : V -> Prep -> V2 = \s,p -> lin V2 (s ** {c2 = }) ; } ; @@ -307,7 +310,7 @@ oper mkV3 : V -> Prep -> V3 = \v,p -> mkmaxV3 v (mkPrep []) p ; mkV3 : V -> V3 = \v -> mkmaxV3 v (mkPrep []) (mkPrep []) ; } ; - mkmaxV3 : V -> Prep -> Prep -> V3 = \v,c,d -> lin V3 (v ** {c2 = c.s ; c3 = d.s}) ; + mkmaxV3 : V -> Prep -> Prep -> V3 = \v,c,d -> lin V3 (v ** {c2 = ; c3 = }) ; @@ -473,7 +476,7 @@ oper -- werden_V = MorphoDut.werden_V ** {lock_V = <>} ; -- prepV2 : V -> Prep -> V2 ; - prepV2 v c = lin V2 (v ** {c2 = c.s}) ; + prepV2 v c = lin V2 (v ** {c2 = }) ; --if it has prep, needed for word order (place of negation) -- dirV2 v = prepV2 v (mkPrep [] accusative) ; -- datV2 v = prepV2 v (mkPrep [] dative) ; -- diff --git a/lib/src/dutch/ResDut.gf b/lib/src/dutch/ResDut.gf index 49be6e1ed..0f3b5d90e 100644 --- a/lib/src/dutch/ResDut.gf +++ b/lib/src/dutch/ResDut.gf @@ -5,7 +5,7 @@ -- -- (c) 2009 Femke Johansson and Aarne Ranta -resource ResDut = ParamX ** open Prelude in { +resource ResDut = ParamX ** open Prelude, Predef in { flags optimize=all ; @@ -163,6 +163,7 @@ resource ResDut = ParamX ** open Prelude in { } ; prefix = ein ; aux = verb.aux ; + particle = verb.particle ; vtype = verb.vtype } ; @@ -180,43 +181,36 @@ resource ResDut = ParamX ** open Prelude in { _ => 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") ; + vowel : pattern Str = #("a"|"e"|"i"|"o"|"u") ; -- To make a stem out of a verb -- If a stem ends in a 'v' then the 'v' changes into a 'f' -- 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 consonant but that consonant has exactly 1 vowel before it -- then we have to double this vowel - mkStem : Str -> Str =\werken -> - let stem = Predef.tk 2 werken + mkStem : Str -> Str =\lopen -> + let + lop = tk 2 lopen ; --drop the -en + lo = init lop ; + o = last lo ; + p = case last lop of { + "v" => "f" ; + "z" => "s" ; + p => p + } ; + loop = lo + o + p ; -- voiced consonant to unvoiced, vowel doubling + kerf = lo + p ; -- voiced consonant to unvoiced, no vowel doubling + zeg = tk 3 lopen ; -- double consonant disappearing + werk = lop -- no changes to stem + in - case stem of { - -- Vowel doubling for verbs whose stem does not end on 'v' or 'z' - _+ ("b"|"c"|"d"|"f"|"g"|"h"|"j"|"k"|"l"|"m"|"n"|"p"|"q"|"r"|"s"|"t"|"v"|"w"|"x"|"y"|"z") - + ("a"|"e"|"i"|"o"|"u") - + ("b"|"c"|"d"|"f"|"g"|"h"|"j"|"k"|"l"|"m"|"n"|"p"|"q"|"r"|"s"|"t"|"w"|"x"|"y") - => Predef.tk 2 stem + (Predef.tk 1 (Predef.dp 2 stem)) + Predef.dp 2 stem; - - -- Vowel doubling for verbs whose stem end on 'v' - _+ ("b"|"c"|"d"|"f"|"g"|"h"|"j"|"k"|"l"|"m"|"n"|"p"|"q"|"r"|"s"|"t"|"v"|"w"|"x"|"y"|"z") - + ("a"|"e"|"i"|"o"|"u") - + "v" => Predef.tk 2 stem + (Predef.tk 1 (Predef.dp 2 stem)) + - (Predef.tk 1 (Predef.dp 2 stem)) +"f"; - - -- Vowel doubling for verbs whose stem end on 'z`' - _+ ("b"|"c"|"d"|"f"|"g"|"h"|"j"|"k"|"l"|"m"|"n"|"p"|"q"|"r"|"s"|"t"|"v"|"w"|"x"|"y"|"z") - + ("a"|"e"|"i"|"o"|"u") - + "z" => Predef.tk 2 stem + (Predef.tk 1 (Predef.dp 2 stem)) + - (Predef.tk 1 (Predef.dp 2 stem)) + "s"; - - _+ "v" => (Predef.tk 1 stem) + "f"; - _+ "z" => (Predef.tk 1 stem) + "s"; - + case lop of { + _+ #consonant + #vowel + #consonant => loop ; _+ ("bb" | "dd" | "ff" | "gg" | "kk" | "ll" | "mm" | "nn" | "pp" | - "rr" | "ss" | "tt") => Predef.tk 1 stem; - - - _ => stem + "rr" | "ss" | "tt") => zeg ; + _+ #consonant + ("v"|"z") => kerf ; + _ => werk --default case, #consonant + #consonant }; @@ -297,6 +291,7 @@ resource ResDut = ParamX ** open Prelude in { } ; aux = VZijn ; prefix = [] ; + particle = [] ; vtype = VAct ; } ; @@ -318,6 +313,7 @@ resource ResDut = ParamX ** open Prelude in { } ; aux = VHebben ; prefix = [] ; + particle = [] ; vtype = VAct ; } ; @@ -339,6 +335,7 @@ resource ResDut = ParamX ** open Prelude in { } ; aux = VHebben ; prefix = [] ; + particle = [] ; vtype = VAct ; } ; @@ -360,11 +357,12 @@ resource ResDut = ParamX ** open Prelude in { } ; aux = VHebben ; prefix = [] ; + particle = [] ; vtype = VAct ; } ; worden_V = irregVerb2 "worden" "werd" "werden" "geworden" ** { - aux = VZijn ; prefix = [] ; vtype = VAct} ; + aux = VZijn ; prefix = [] ; particle = [] ; vtype = VAct} ; Pronoun : Type = { unstressed,stressed : {nom, acc, poss : Str} ; @@ -389,14 +387,18 @@ param Adjf = Strong | Weak ; - oper VVerb = Verb ** {prefix : Str ; aux : VAux ; vtype : VType} ; + oper VVerb = Verb ** {prefix : Str ; -- af + stappen + particle : Str ; -- non-inflecting component, e.g. leuk vinden + aux : VAux ; -- hebben or zijn + vtype : VType} ; -- active or reflexive + param VAux = VHebben | VZijn ; param VType = VAct | VRefl ; oper v2vvAux : Verb -> VAux -> VVerb = \v,a -> - {s = v.s ; aux = a ; prefix = [] ; vtype = VAct} ; + {s = v.s ; aux = a ; prefix = [] ; particle = [] ; vtype = VAct} ; v2vv : Verb -> VVerb = \v -> v2vvAux v VHebben ; @@ -405,7 +407,7 @@ param ---- clause, inverted, or subordinate. oper - Preposition = Str ; + Preposition = Str ; --* Bool; appPrep : Preposition -> (NPCase => Str) -> Str = \p,np -> p ++ np ! NPAcc ; ---- param @@ -470,8 +472,9 @@ param n2 : Agr => Str ; -- je vrouw a2 : Str ; -- vandaag isAux : Bool ; -- is a double infinitive - inf : Str * Bool ; -- sagen (True = non-empty) - ext : Str -- dass sie kommt + negBeforeObj : Bool ; -- ik schoop X niet ; ik houd niet van X ; dat is niet leuk + inf : Str * Bool ; -- zeggen (True = non-empty) + ext : Str -- dat je komt } ; predV : VVerb -> VP = predVGen False ; @@ -487,6 +490,7 @@ param n2 : Agr => Str = \\a => [] ; a2 : Str = [] ; isAux = isAux ; ---- + negBeforeObj = False ; inf : Str * Bool = <[],False> ; ext : Str = [] } ; @@ -498,15 +502,18 @@ param -- Extending a verb phrase with new constituents. - insertObj : (Agr => Str) -> VP -> VP = insertObjNP False ; + --when we call it with a normal VP, just copy the negBeforeObj field of the vp + insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> insertObjNP False vp.negBeforeObj obj vp; - insertObjNP : Bool -> (Agr => Str) -> VP -> VP = \isPron, obj,vp -> { + --this is needed when we call insertObjNP in ComplSlash: VPSlash is a subtype of VP so it works + insertObjNP : Bool -> Bool -> (Agr => Str) -> VP -> VP = \isPron,negBeforeObj,obj,vp -> { s = vp.s ; a1 = vp.a1 ; n0 = \\a => case isPron of {True => obj ! a ; _ => []} ++ vp.n0 ! a ; n2 = \\a => case isPron of {False => obj ! a ; _ => []} ++ vp.n2 ! a ; a2 = vp.a2 ; isAux = vp.isAux ; + negBeforeObj = negBeforeObj ; inf = vp.inf ; ext = vp.ext } ; @@ -518,6 +525,7 @@ param n2 = vp.n2 ; a2 = vp.a2 ; isAux = vp.isAux ; + negBeforeObj = vp.negBeforeObj ; inf = vp.inf ; ext = vp.ext } ; @@ -529,6 +537,8 @@ param n2 = vp.n2 ; a2 = vp.a2 ++ adv ; isAux = vp.isAux ; +-- hasPrep = vp.hasPrep ; + negBeforeObj = vp.negBeforeObj ; inf = vp.inf ; ext = vp.ext } ; @@ -540,6 +550,8 @@ param n2 = vp.n2 ; a2 = vp.a2 ; isAux = vp.isAux ; +-- hasPrep = vp.hasPrep ; + negBeforeObj = vp.negBeforeObj ; inf = vp.inf ; ext = vp.ext ++ ext } ; @@ -551,6 +563,8 @@ param n2 = vp.n2 ; a2 = vp.a2 ; isAux = vp.isAux ; ---- + negBeforeObj = vp.negBeforeObj ; +-- hasPrep = vp.hasPrep ; inf = ; ext = vp.ext } ; @@ -581,7 +595,11 @@ param neg = vp.a1 ! b ; obj0 = vp.n0 ! agr ; obj = vp.n2 ! agr ; - compl = obj0 ++ neg ++ obj ++ vp.a2 ++ vp.s.prefix ; + part = vp.s.particle ; + compl = case vp.negBeforeObj of { + True => neg ++ obj0 ++ obj ++ part ++ vp.a2 ++ vp.s.prefix ; + _ => obj0 ++ obj ++ neg ++ part ++ vp.a2 ++ vp.s.prefix + } ; inf = case of { --# notpresent => vp.s.s ! VInf ++ vp.inf.p1 ; --# notpresent @@ -604,7 +622,7 @@ param } } ; - auxVerb : VAux -> VVerb = \a -> case a of { + auxVerb : VAux -> Verb = \a -> case a of { VHebben => hebben_V ; VZijn => zijn_V } ; diff --git a/lib/src/dutch/SentenceDut.gf b/lib/src/dutch/SentenceDut.gf index 61cd41642..f345798ba 100644 --- a/lib/src/dutch/SentenceDut.gf +++ b/lib/src/dutch/SentenceDut.gf @@ -20,15 +20,19 @@ concrete SentenceDut of Sentence = CatDut ** open ResDut, Prelude in { verb = vp.s.s ! ps.p1 ; inf = vp.inf.p1 ; in - verb ++ ps.p2 ++ - vp.a1 ! pol ++ vp.n0 ! agr ++ vp.n2 ! agr ++ vp.a2 ++ inf ++ vp.ext + case vp.negBeforeObj of { + True => verb ++ ps.p2 ++ vp.a1 ! pol ++ vp.n0 ! agr ++ + vp.n2 ! agr ++ vp.a2 ++ inf ++ vp.ext ; + _ => verb ++ ps.p2 ++ vp.n0 ! agr ++ vp.n2 ! agr ++ + vp.a1 ! pol ++ vp.a2 ++ inf ++ vp.ext + } ; } ; SlashVP np vp = mkClause (np.s ! NPNom) np.a vp ** - {c2 = vp.c2} ; + {c2 = vp.c2.p1} ; --ClSlash has just Preposition, not Prep * Bool AdvSlash slash adv = { s = \\t,a,b,o => slash.s ! t ! a ! b ! o ++ adv.s ; diff --git a/lib/src/dutch/VerbDut.gf b/lib/src/dutch/VerbDut.gf index 2abecc23e..bafa93532 100644 --- a/lib/src/dutch/VerbDut.gf +++ b/lib/src/dutch/VerbDut.gf @@ -23,9 +23,9 @@ concrete VerbDut of Verb = CatDut ** open Prelude, ResDut in { SlashV2a v = predV (v2v v) ** {c2 = v.c2} ; Slash2V3 v np = - insertObj (\\_ => appPrep v.c2 np.s) (predVv v) ** {c2 = v.c3} ; + insertObj (\\_ => appPrep v.c2.p1 np.s) (predVv v) ** {c2 = v.c3} ; Slash3V3 v np = - insertObj (\\_ => appPrep v.c3 np.s) (predVv v) ** {c2 = v.c2} ; + insertObj (\\_ => appPrep v.c3.p1 np.s) (predVv v) ** {c2 = v.c2} ; SlashV2S v s = insertExtrapos (conjThat ++ s.s ! Sub) (predVv v) ** {c2 = v.c2} ; @@ -42,7 +42,8 @@ concrete VerbDut of Verb = CatDut ** open Prelude, ResDut in { SlashV2A v ap = insertObj (\\_ => ap.s ! APred) (predVv v) ** {c2 = v.c2} ; - ComplSlash vp np = insertObjNP np.isPron (\\_ => appPrep vp.c2 np.s) vp ; + --vp.c2.p2: if the verb has a preposition or not + ComplSlash vp np = insertObjNP np.isPron vp.c2.p2 (\\_ => appPrep vp.c2.p1 np.s) vp ; SlashVV v vp = let @@ -60,10 +61,12 @@ concrete VerbDut of Verb = CatDut ** open Prelude, ResDut in { insertExtrapos vpi.p3 ( insertInf vpi.p2 ( insertObj vpi.p1 ( - insertObj (\\_ => appPrep v.c2 np.s) ( + insertObj (\\_ => appPrep v.c2.p1 np.s) ( predVv v)))) ** {c2 = v.c2} ; - UseComp comp = insertObj comp.s (predV zijn_V) ; -- agr not used + -- True, because negation comes before copula complement + -- "ik ben niet groot" but "ik begrijp hem niet" + UseComp comp = insertObjNP False True comp.s (predV zijn_V) ; -- agr not used UseCopula = predV zijn_V ; @@ -75,16 +78,16 @@ concrete VerbDut of Verb = CatDut ** open Prelude, ResDut in { AdvVP vp adv = insertAdv adv.s vp ; AdVVP adv vp = insertAdV adv.s vp ; - ReflVP vp = insertObj (\\a => appPrep vp.c2 (\\_ => reflPron ! a)) vp ; + ReflVP vp = insertObj (\\a => appPrep vp.c2.p1 (\\_ => reflPron ! a)) vp ; PassV2 v = insertInf (v.s ! VPerf) (predV worden_V) ; - VPSlashPrep vp prep = vp ** {c2 = prep.s} ; + VPSlashPrep vp prep = vp ** {c2 = } ; ---- workaround for a subtyping bug oper v2v : VVerb -> VVerb = \v -> - {s = v.s ; aux = v.aux ; prefix = v.prefix ; vtype = v.vtype} ; + {s = v.s ; aux = v.aux ; prefix = v.prefix ; particle = v.particle ; vtype = v.vtype} ; predVv : VVerb -> ResDut.VP = \v -> predV (v2v v) ; }