From 4ef83ea80669c75e1d15a5b395671f3eeef43f02 Mon Sep 17 00:00:00 2001 From: aarne Date: Mon, 16 Jan 2006 20:42:52 +0000 Subject: [PATCH] reflexive and deponent as verb features added --- lib/resource-1.0/english/BasicEng.gf | 3 +- lib/resource-1.0/english/MorphoEng.gf | 2 +- lib/resource-1.0/english/ParadigmsEng.gf | 7 ++ lib/resource-1.0/english/ResEng.gf | 12 ++-- lib/resource-1.0/english/VerbEng.gf | 2 +- lib/resource-1.0/german/ParadigmsGer.gf | 17 +++-- lib/resource-1.0/german/ParamGer.gf | 2 + lib/resource-1.0/german/ResGer.gf | 18 +++-- lib/resource-1.0/scandinavian/DiffScand.gf | 22 ++++-- lib/resource-1.0/scandinavian/ParamScand.gf | 2 + lib/resource-1.0/scandinavian/ResScand.gf | 74 ++------------------- lib/resource-1.0/scandinavian/VerbScand.gf | 2 +- lib/resource-1.0/swedish/BasicSwe.gf | 9 ++- lib/resource-1.0/swedish/DiffSwe.gf | 8 +++ lib/resource-1.0/swedish/MorphoSwe.gf | 3 +- lib/resource-1.0/swedish/ParadigmsSwe.gf | 9 ++- 16 files changed, 89 insertions(+), 103 deletions(-) diff --git a/lib/resource-1.0/english/BasicEng.gf b/lib/resource-1.0/english/BasicEng.gf index 932258cd4..b2e9d4057 100644 --- a/lib/resource-1.0/english/BasicEng.gf +++ b/lib/resource-1.0/english/BasicEng.gf @@ -3,8 +3,7 @@ concrete BasicEng of Basic = CatEng ** open ParadigmsEng in { flags - startcat=Phr ; lexer=textlit ; unlexer=text ; - optimize=all ; + optimize=values ; lin airplane_N = regN "airplane" ; diff --git a/lib/resource-1.0/english/MorphoEng.gf b/lib/resource-1.0/english/MorphoEng.gf index eb3c51222..a45a2b82c 100644 --- a/lib/resource-1.0/english/MorphoEng.gf +++ b/lib/resource-1.0/english/MorphoEng.gf @@ -189,7 +189,7 @@ oper --- The particle always appears right after the verb. verbPart : Verb -> Str -> Verb = \v,p -> - {s = \\f => v.s ! f ++ p} ; + {s = \\f => v.s ! f ++ p ; isRefl = v.isRefl} ; verbNoPart : Verb -> Verb = \v -> verbPart v [] ; diff --git a/lib/resource-1.0/english/ParadigmsEng.gf b/lib/resource-1.0/english/ParadigmsEng.gf index f4a98f4f2..3a5006f46 100644 --- a/lib/resource-1.0/english/ParadigmsEng.gf +++ b/lib/resource-1.0/english/ParadigmsEng.gf @@ -235,6 +235,12 @@ oper partV : V -> Str -> V ; +--3 Reflexive verbs +-- +-- By default, verbs are not reflexive; this function makes them that. + + reflV : V -> V ; + --3 Two-place verbs -- -- Two-place verbs need a preposition, except the special case with direct object. @@ -423,6 +429,7 @@ oper mkV fit (fit + "s") y z fitting ; partV v p = verbPart v p ** {lock_V = <>} ; + reflV v = {s = v.s ; part = v.part ; lock_V = v.lock_V ; isRefl = True} ; mkV2 v p = v ** {s = v.s ; s1 = v.s1 ; c2 = p ; lock_V2 = <>} ; dirV2 v = mkV2 v [] ; diff --git a/lib/resource-1.0/english/ResEng.gf b/lib/resource-1.0/english/ResEng.gf index da7a65a08..d5a2b1c59 100644 --- a/lib/resource-1.0/english/ResEng.gf +++ b/lib/resource-1.0/english/ResEng.gf @@ -41,7 +41,7 @@ resource ResEng = ParamEng ** open Prelude in { } } ; - mkVerb : (_,_,_,_,_ : Str) -> {s : VForm => Str} = + mkVerb : (_,_,_,_,_ : Str) -> Verb = \go,goes,went,gone,going -> { s = table { VInf => go ; @@ -49,7 +49,8 @@ resource ResEng = ParamEng ** open Prelude in { VPast => went ; VPPart => gone ; VPresPart => going - } + } ; + isRefl = False } ; mkIP : (i,me,my : Str) -> Number -> {s : Case => Str ; n : Number} = @@ -77,7 +78,7 @@ resource ResEng = ParamEng ** open Prelude in { regA : Str -> {s : AForm => Str} = \warm -> mkAdjective warm (warm + "er") (warm + "est") (warm + "ly") ; - regV : Str -> {s : VForm => Str} = \walk -> + regV : Str -> Verb = \walk -> mkVerb walk (walk + "s") (walk + "ed") (walk + "ed") (walk + "ing") ; regNP : Str -> Number -> {s : Case => Str ; a : Agr} = \that,n -> @@ -97,7 +98,8 @@ resource ResEng = ParamEng ** open Prelude in { -- For $Verb$. Verb : Type = { - s : VForm => Str + s : VForm => Str ; + isRefl : Bool } ; VerbForms : Type = @@ -138,7 +140,7 @@ resource ResEng = ParamEng ** open Prelude in { => vf "would" ("have" ++ part) ; => vf "wouldn't" ("have" ++ part) } ; - s2 = \\_ => [] + s2 = \\a => if_then_Str verb.isRefl (reflPron ! a) [] } ; predAux : Aux -> VP = \verb -> { diff --git a/lib/resource-1.0/english/VerbEng.gf b/lib/resource-1.0/english/VerbEng.gf index 096bd0f43..a8f840849 100644 --- a/lib/resource-1.0/english/VerbEng.gf +++ b/lib/resource-1.0/english/VerbEng.gf @@ -27,7 +27,7 @@ concrete VerbEng of Verb = CatEng ** open ResEng in { PassV2 v = insertObj (\\_ => v.s ! VPPart) (predAux auxBe) ; - UseVS, UseVQ = \vv -> {s = vv.s ; c2 = []} ; -- no "to" + UseVS, UseVQ = \vv -> {s = vv.s ; c2 = [] ; isRefl = vv.isRefl} ; -- no "to" CompAP ap = ap ; CompNP np = {s = \\_ => np.s ! Acc} ; diff --git a/lib/resource-1.0/german/ParadigmsGer.gf b/lib/resource-1.0/german/ParadigmsGer.gf index 06863796c..5a963d7f6 100644 --- a/lib/resource-1.0/german/ParadigmsGer.gf +++ b/lib/resource-1.0/german/ParadigmsGer.gf @@ -175,6 +175,10 @@ oper seinV : V -> V ; habenV : V -> V ; +-- Reflexive verbs can take reflexive pronouns of different cases. + + reflV : V -> Case -> V ; + --3 Two-place verbs -- -- Two-place verbs need a preposition, except the special case with direct object @@ -332,16 +336,21 @@ oper in mkV singen singt sing sang saenge gesungen ; - prefixV p v = {s = v.s ; prefix = p ; lock_V = v.lock_V ; aux = v.aux} ; - habenV v = {s = v.s ; prefix = v.prefix ; lock_V = v.lock_V ; aux = VHaben} ; - seinV v = {s = v.s ; prefix = v.prefix ; lock_V = v.lock_V ; aux = VSein} ; + prefixV p v = + {s = v.s ; prefix = p ; lock_V = v.lock_V ; aux = v.aux ; vtype = v.vtype} ; + habenV v = + {s = v.s ; prefix = v.prefix ; lock_V = v.lock_V ; aux = VHaben ; vtype = v.vtype} ; + seinV v = + {s = v.s ; prefix = v.prefix ; lock_V = v.lock_V ; aux = VSein ; vtype = v.vtype} ; + reflV v c = + {s = v.s ; prefix = v.prefix ; lock_V = v.lock_V ; aux = VHaben ; vtype = VRefl c} ; no_geV v = let vs = v.s in { s = table { p@(VPastPart _) => Predef.drop 2 (vs ! p) ; p => vs ! p } ; - prefix = v.prefix ; lock_V = v.lock_V ; aux = v.aux + prefix = v.prefix ; lock_V = v.lock_V ; aux = v.aux ; vtype = v.vtype } ; mkV2 v c = v ** {c2 = c ; lock_V2 = <>} ; diff --git a/lib/resource-1.0/german/ParamGer.gf b/lib/resource-1.0/german/ParamGer.gf index c7c7de72e..60b519225 100644 --- a/lib/resource-1.0/german/ParamGer.gf +++ b/lib/resource-1.0/german/ParamGer.gf @@ -57,6 +57,8 @@ resource ParamGer = ParamX ** { param VAux = VHaben | VSein ; + param VType = VAct | VRefl Case ; + -- The order of sentence is depends on whether it is used as a main -- clause, inverted, or subordinate. diff --git a/lib/resource-1.0/german/ResGer.gf b/lib/resource-1.0/german/ResGer.gf index acffb9956..f1d28704c 100644 --- a/lib/resource-1.0/german/ResGer.gf +++ b/lib/resource-1.0/german/ResGer.gf @@ -62,7 +62,12 @@ resource ResGer = ParamGer ** open Prelude in { -- suffixes "t" and "st". Auxiliaries like "sein" will have to -- make extra cases even for this. - Verb : Type = {s : VForm => Str ; prefix : Str ; aux : VAux} ; + Verb : Type = { + s : VForm => Str ; + prefix : Str ; + aux : VAux ; + vtype : VType + } ; mkV : (x1,_,_,_,_,_,_,_,_,_,_,x12 : Str) -> Str -> VAux -> Verb = \geben,gebe,gibst,gibt,gebt,gib,gab,gabst,gaben,gabt,gaebe,gegeben,ein,aux -> @@ -91,7 +96,8 @@ resource ResGer = ParamGer ** open Prelude in { VPastPart a => (regA gegeben).s ! Posit ! a } ; prefix = ein ; - aux = aux + aux = aux ; + vtype = VAct } ; -- These functions cover many regular cases; full coverage inflectional patterns are @@ -237,7 +243,10 @@ resource ResGer = ParamGer ** open Prelude in { VPInfinit Anter => vf [] (vpart ++ haben) } ; a1 : Polarity => Str = negation ; - n2 : Agr => Str = \\_ => [] ; + n2 : Agr => Str = case verb.vtype of { + VAct => \\_ => [] ; + VRefl c => \\a => reflPron ! a ! c + } ; a2 : Str = [] ; ext : Str = [] } ; @@ -287,7 +296,8 @@ resource ResGer = ParamGer ** open Prelude in { v => sein.s ! v } ; prefix = [] ; - aux = VSein + aux = VSein ; + vtype = VAct } ; auxVV : Verb -> Verb ** {isAux : Bool} = \v -> v ** {isAux = True} ; diff --git a/lib/resource-1.0/scandinavian/DiffScand.gf b/lib/resource-1.0/scandinavian/DiffScand.gf index 0a4528ef7..d95c0fddc 100644 --- a/lib/resource-1.0/scandinavian/DiffScand.gf +++ b/lib/resource-1.0/scandinavian/DiffScand.gf @@ -25,8 +25,8 @@ interface DiffScand = open ResScand, Prelude in { artIndef : Gender => Str ; - verbHave : {s : VForm => Str} ; - verbBe : {s : VForm => Str} ; + verbHave : {s : VForm => Str ; vtype : VType} ; + verbBe : {s : VForm => Str ; vtype : VType} ; auxFut : Str ; auxCond : Str ; @@ -67,9 +67,13 @@ interface DiffScand = open ResScand, Prelude in { predV : Verb -> VP = \verb -> let - vfin : Tense -> Str = \t -> verb.s ! vFin t Act ; - vsup = verb.s ! VI (VSupin Act) ; - vinf = verb.s ! VI (VInfin Act) ; + diath = case verb.vtype of { + VPass => Pass ; + _ => Act + } ; + vfin : Tense -> Str = \t -> verb.s ! vFin t diath ; + vsup = verb.s ! VI (VSupin diath) ; + vinf = verb.s ! VI (VInfin diath) ; har : Tense -> Str = \t -> verbHave.s ! vFin t Act ; ha : Str = verbHave.s ! VI (VInfin Act) ; @@ -90,16 +94,20 @@ interface DiffScand = open ResScand, Prelude in { Fut => vf auxFut (ha ++ vsup) ; Cond => vf auxCond (ha ++ vsup) } ; - VPImperat => vf (verb.s ! VF (VImper Act)) [] ; + VPImperat => vf (verb.s ! VF (VImper diath)) [] ; VPInfinit Simul => vf [] vinf ; VPInfinit Anter => vf [] (ha ++ vsup) } ; a1 : Polarity => Str = negation ; - n2 : Agr => Str = \\_ => [] ; + n2 : Agr => Str = \\a => case verb.vtype of { + VRefl => reflPron a ; + _ => [] + } ; a2 : Str = [] ; ext : Str = [] ; en2,ea2,eext : Bool = False -- indicate if the field exists } ; +reflPron : Agr -> Str ; } diff --git a/lib/resource-1.0/scandinavian/ParamScand.gf b/lib/resource-1.0/scandinavian/ParamScand.gf index 62a41fea3..9239902cd 100644 --- a/lib/resource-1.0/scandinavian/ParamScand.gf +++ b/lib/resource-1.0/scandinavian/ParamScand.gf @@ -42,6 +42,8 @@ param | VPImperat | VPInfinit Anteriority ; + VType = VAct | VPass | VRefl ; + NPForm = NPNom | NPAcc | NPPoss GenNum ; --- AdjPronForm = APron GenNum Case ; --- AuxVerbForm = AuxInf | AuxPres | AuxPret | AuxSup ; diff --git a/lib/resource-1.0/scandinavian/ResScand.gf b/lib/resource-1.0/scandinavian/ResScand.gf index 1c94e04fd..676c89078 100644 --- a/lib/resource-1.0/scandinavian/ResScand.gf +++ b/lib/resource-1.0/scandinavian/ResScand.gf @@ -38,7 +38,7 @@ resource ResScand = ParamScand ** open Prelude in { } } ; - mkVerb : (x1,_,_,_,_,_,_,x8 : Str) -> {s : VForm => Str} = + mkVerb : (x1,_,_,_,_,_,_,x8 : Str) -> {s : VForm => Str ; vtype : VType} = \finna,finner,finn,fann,funnit,funnen,funnet,funna -> { s = table { VF (VPres Act) => finner ; @@ -48,7 +48,8 @@ resource ResScand = ParamScand ** open Prelude in { VI (VInfin v) => mkVoice v finna ; VI (VSupin v) => mkVoice v funnit ; VI (VPtPret a c)=> mkCase c (mkAdjPos a funnen funnet funna funna) - } + } ; + vtype = VAct } ; -- These are useful auxiliaries. @@ -81,29 +82,6 @@ resource ResScand = ParamScand ** open Prelude in { } } ; --- mkAdjective : (_,_,_,_ : Str) -> {s : AForm => Str} = --- \good,better,best,well -> { --- s = table { --- AAdj Posit => good ; --- AAdj Compar => better ; --- AAdj Superl => best ; --- AAdv => well --- } --- } ; --- --- mkVerb : (_,_,_,_,_ : Str) -> {s : VForm => Str} = --- \go,goes,went,gone,going -> { --- s = table { --- VInf => go ; --- VPres => goes ; --- VPast => went ; --- VPPart => gone ; --- VPresPart => going --- } --- } ; --- --- mkIP : (i,me,my : Str) -> Number -> {s : Case => Str ; n : Number} = --- \i,me,my,n -> let who = mkNP i me my n P3 in {s = who.s ; n = n} ; -- For $Noun$. @@ -137,7 +115,8 @@ resource ResScand = ParamScand ** open Prelude in { -- For $Verb$. Verb : Type = { - s : VForm => Str + s : VForm => Str ; + vtype : VType } ; VP = { @@ -187,51 +166,9 @@ resource ResScand = ParamScand ** open Prelude in { eext = vp.eext } ; --- presVerb : {s : VForm => Str} -> Agr -> Str = \verb -> --- agrVerb (verb.s ! VPres) (verb.s ! VInf) ; - infVP : VP -> Agr -> Str = \vp,a -> (vp.s ! VPInfinit Simul).inf ++ vp.n2 ! a ++ vp.a2 ++ vp.ext ; --- a1 --- agrVerb : Str -> Str -> Agr -> Str = \has,have,agr -> --- case agr of { --- {n = Sg ; p = P3} => has ; --- _ => have --- } ; --- --- have = agrVerb "has" "have" ; --- havent = agrVerb "hasn't" "haven't" ; --- does = agrVerb "does" "do" ; --- doesnt = agrVerb "doesn't" "don't" ; --- --- Aux = {pres,past : Polarity => Agr => Str ; inf,ppart : Str} ; --- --- auxBe : Aux = { --- pres = \\b,a => case of { --- => "am" ; --- => ["am not"] ; --- am not I --- _ => agrVerb (posneg b "is") (posneg b "are") a --- } ; --- past = \\b,a => agrVerb (posneg b "was") (posneg b "were") a ; --- inf = "be" ; --- ppart = "been" --- } ; --- --- posneg : Polarity -> Str -> Str = \p,s -> case p of { --- Pos => s ; --- Neg => s + "n't" --- } ; --- --- conjThat : Str = "that" ; --- --- reflPron : Agr => Str = table { --- {n = Sg ; p = P1} => "myself" ; --- {n = Sg ; p = P2} => "yourself" ; --- {n = Sg ; p = P3} => "itself" ; ---- --- {n = Pl ; p = P1} => "ourselves" ; --- {n = Pl ; p = P2} => "yourselves" ; --- {n = Pl ; p = P3} => "themselves" --- } ; -- For $Sentence$. @@ -253,7 +190,6 @@ resource ResScand = ParamScand ** open Prelude in { } } ; --- ---- For $Numeral$. -- -- mkNum : Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Str} = diff --git a/lib/resource-1.0/scandinavian/VerbScand.gf b/lib/resource-1.0/scandinavian/VerbScand.gf index 1c21346f5..c1e48c531 100644 --- a/lib/resource-1.0/scandinavian/VerbScand.gf +++ b/lib/resource-1.0/scandinavian/VerbScand.gf @@ -35,6 +35,6 @@ incomplete concrete VerbScand of Verb = CatScand ** open DiffScand, ResScand in PassV2 v = {s = \\_ => v.s ! VPPart} ; -} - UseVS, UseVQ = \vv -> {s = vv.s ; c2 = []} ; + UseVS, UseVQ = \vv -> {s = vv.s ; c2 = [] ; vtype = vv.vtype} ; } diff --git a/lib/resource-1.0/swedish/BasicSwe.gf b/lib/resource-1.0/swedish/BasicSwe.gf index 09996c808..521bbe177 100644 --- a/lib/resource-1.0/swedish/BasicSwe.gf +++ b/lib/resource-1.0/swedish/BasicSwe.gf @@ -3,8 +3,7 @@ concrete BasicSwe of Basic = CatSwe ** open ParadigmsSwe in { flags - startcat=Phr ; lexer=textlit ; unlexer=text ; - optimize=all ; + optimize=values ; lin airplane_N = regN "flygplan" neutrum ; @@ -93,8 +92,8 @@ lin have_V2 = dirV2 (mkV "ha" "har" "ha" "hade" "haft" "haft") ; ---- pp hear_V2 = dirV2 (mkV "höra" "hör" "hör" "hörde" "hört" "hörd") ; hill_N = regN "kulle" utrum ; - hope_VS = mkVS ((regV "önska")) ; ----- hope_VS = mkVS (depV (regV "hoppas")) ; +-- hope_VS = mkVS ((regV "önska")) ; + hope_VS = mkVS (depV (regV "hoppa")) ; horse_N = regN "häst" utrum ; hot_A = regADeg "het" ; house_N = regN "hus" neutrum ; @@ -105,7 +104,7 @@ lin know_V2 = dirV2 (mkV "veta" "vet" "vet" "visste" "vetat" "visst") ; lake_N = mkN "sjö" "sjön" "sjöar" "sjöarna" ; lamp_N = regN "lampa" utrum; - learn_V2 = dirV2 (mkV "lära" "lär" "lär" "lärde" "lärt" "lärd") ; ---- refl! + learn_V2 = dirV2 (reflV (mkV "lära" "lär" "lär" "lärde" "lärt" "lärd")) ; leather_N = mkN "läder" "lädret" "läder" "lädren" ; leave_V2 = dirV2 (regV "lämna") ; like_V2 = mkV2 (mk2V "tycka" "tyckte") "om" ; diff --git a/lib/resource-1.0/swedish/DiffSwe.gf b/lib/resource-1.0/swedish/DiffSwe.gf index 3356649fe..e08080e85 100644 --- a/lib/resource-1.0/swedish/DiffSwe.gf +++ b/lib/resource-1.0/swedish/DiffSwe.gf @@ -51,6 +51,14 @@ instance DiffSwe of DiffScand = open ResScand, Prelude in { Neutr => allt } ; + reflPron : Agr -> Str = \a -> case a of { + {gn = Plg ; p = P1} => "oss" ; + {gn = Plg ; p = P2} => "er" ; + {p = P1} => "mig" ; + {p = P2} => "dig" ; + {p = P3} => "sig" + } ; + relPron : GenNum => RCase => Str = \\gn,c => case c of { RNom => "som" ; RGen => "vars" ; diff --git a/lib/resource-1.0/swedish/MorphoSwe.gf b/lib/resource-1.0/swedish/MorphoSwe.gf index b374219c7..20e370db1 100644 --- a/lib/resource-1.0/swedish/MorphoSwe.gf +++ b/lib/resource-1.0/swedish/MorphoSwe.gf @@ -145,7 +145,8 @@ adj2Reg : Str -> Str -> Adjective = \vid,vitt -> funnet = funn ! Strong SgNeutr ! Nom ; funna = funn ! Strong Plg ! Nom in - mkVerb finna finner finn fann funnit funnen funnet funna ; + mkVerb finna finner finn fann funnit funnen funnet funna ** + {vtype=VAct} ; ptPretForms : Str -> AFormPos => Case => Str = \funnen -> \\a,c => let diff --git a/lib/resource-1.0/swedish/ParadigmsSwe.gf b/lib/resource-1.0/swedish/ParadigmsSwe.gf index 3f8cde2d9..c4ec0d2d0 100644 --- a/lib/resource-1.0/swedish/ParadigmsSwe.gf +++ b/lib/resource-1.0/swedish/ParadigmsSwe.gf @@ -229,9 +229,11 @@ oper --3 Deponent verbs. -- --- Some words are used in passive forms only, e.g. "hoppas". +-- Some words are used in passive forms only, e.g. "hoppas", some as +-- reflexive e.g. "ångra sig". depV : V -> V ; + reflV : V -> V ; --3 Two-place verbs -- @@ -338,8 +340,9 @@ oper irregV x y z = irregVerb x y z ** {s1 = [] ; lock_V = <>} ; - partV v p = {s = \\f => v.s ! f ++ p ; lock_V = <>} ; ----- depV v = deponentVerb v ** {lock_V = <>} ; + partV v p = {s = \\f => v.s ! f ++ p ; vtype = v.vtype ; lock_V = <>} ; + depV v = {s = v.s ; vtype = VPass ; lock_V = <>} ; + reflV v = {s = v.s ; vtype = VRefl ; lock_V = <>} ; mkV2 v p = v ** {s = v.s ; c2 = p ; lock_V2 = <>} ; dirV2 v = mkV2 v [] ;