From 9aa31fdcdd2f473802e6d7fe8dadfba7dc600a4b Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 8 Oct 2018 16:10:41 +0200 Subject: [PATCH] (Fin) Add prefix field to A --- src/finnish/AdjectiveFin.gf | 43 +++++++++++++++++++++-------------- src/finnish/CatFin.gf | 4 ++-- src/finnish/ConjunctionFin.gf | 2 +- src/finnish/NounFin.gf | 4 +++- src/finnish/ParadigmsFin.gf | 25 ++++++++++++-------- 5 files changed, 48 insertions(+), 30 deletions(-) diff --git a/src/finnish/AdjectiveFin.gf b/src/finnish/AdjectiveFin.gf index d725780fb..227695dea 100644 --- a/src/finnish/AdjectiveFin.gf +++ b/src/finnish/AdjectiveFin.gf @@ -5,54 +5,63 @@ concrete AdjectiveFin of Adjective = CatFin ** open ResFin, StemFin, Prelude in lin - PositA a = { + PositA a = a ** { s = \\_ => sAdjFull2nforms Posit a ; } ; - ComparA a np = - let acomp = sAdjFull2nforms Compar a in { + ComparA a np = + let acomp = sAdjFull2nforms Compar a in a ** { s = \\isMod,af => case isMod of { True => np.s ! NPCase Part ++ acomp ! af ; -- minua isompi _ => acomp ! af ++ "kuin" ++ np.s ! NPSep -- isompi kuin minä - } + } ; + hasPrefix = False } ; - CAdvAP ad ap np = { - s = \\m,af => ad.s ++ ap.s ! m ! af ++ ad.p ++ np.s ! NPSep + CAdvAP ad ap np = ap ** { + s = \\m,af => ad.s ++ ap.s ! m ! af ++ ad.p ++ np.s ! NPSep ; + hasPrefix = False } ; - UseComparA a = { + UseComparA a = a ** { s = \\_ => sAdjFull2nforms Compar a } ; -- $SuperlA$ belongs to determiner syntax in $Noun$. AdjOrd ord = { - s = \\_ => ord.s + s = \\_ => ord.s ; + p = [] ; hasPrefix = False } ; ComplA2 a np = { s = \\isMod,af => - preOrPost isMod (appCompl True Pos a.c2 np) (sAdjFull2nforms Posit a ! af) + preOrPost isMod (appCompl True Pos a.c2 np) (sAdjFull2nforms Posit a ! af) ; + p = [] ; hasPrefix = False } ; ReflA2 a = { s = \\isMod,af => preOrPost isMod - (appCompl True Pos a.c2 (reflPron (agrP3 Sg))) (sAdjFull2nforms Posit a ! af) + (appCompl True Pos a.c2 (reflPron (agrP3 Sg))) (sAdjFull2nforms Posit a ! af) ; + p = [] ; hasPrefix = False } ; - SentAP ap sc = { - s = \\b,a => ap.s ! b ! a ++ sc.s + SentAP ap sc = ap ** { + s = \\b,a => ap.s ! b ! a ++ sc.s ; + hasPrefix = False } ; - AdAP ada ap = { - s = \\b,af => ada.s ++ ap.s ! b ! af + AdAP ada ap = ap ** { + s = \\b,af => ada.s ++ ap.s ! b ! af ; + hasPrefix = False } ; - AdvAP ap adv = { - s = \\b,af => adv.s ++ ap.s ! b ! af -- luonnostaan vaalea + AdvAP ap adv = ap ** { + s = \\b,af => adv.s ++ ap.s ! b ! af ; -- luonnostaan vaalea + hasPrefix = False } ; UseA2 a = { - s = \\_ => sAdjFull2nforms Posit a + s = \\_ => sAdjFull2nforms Posit a ; + p = [] ; hasPrefix = False } ; } diff --git a/src/finnish/CatFin.gf b/src/finnish/CatFin.gf index 3607e78e5..e6e8f174e 100644 --- a/src/finnish/CatFin.gf +++ b/src/finnish/CatFin.gf @@ -42,7 +42,7 @@ concrete CatFin of Cat = CommonX ** open ResFin, StemFin, Prelude in { -- The $Bool$ tells whether usage is modifying (as opposed to -- predicative), e.g. "x on suurempi kuin y" vs. "y:tä suurempi luku". - AP = {s : Bool => NForm => Str} ; + AP = {s : Bool => NForm => Str ; p : Str ; hasPrefix : Bool} ; -- Noun @@ -89,7 +89,7 @@ concrete CatFin of Cat = CommonX ** open ResFin, StemFin, Prelude in { V2V = SVerb1 ** {c2 : Compl ; vi : VVType} ; ---- infinitive form V3 = SVerb1 ** {c2, c3 : Compl} ; - A = {s : Degree => SAForm => Str ; h : Harmony} ; + A = {s : Degree => SAForm => Str ; h : Harmony ; p : Str ; hasPrefix : Bool} ; A2 = {s : Degree => SAForm => Str ; h : Harmony ; c2 : Compl} ; N = SNoun ; diff --git a/src/finnish/ConjunctionFin.gf b/src/finnish/ConjunctionFin.gf index ba95340ad..9fb39a33d 100644 --- a/src/finnish/ConjunctionFin.gf +++ b/src/finnish/ConjunctionFin.gf @@ -16,7 +16,7 @@ concrete ConjunctionFin of Conjunction = isPron = False ; isNeg = ss.isNeg } ; - ConjAP conj ss = conjunctDistrTable2 Bool NForm conj ss ; + ConjAP conj ss = conjunctDistrTable2 Bool NForm conj ss ** { hasPrefix = False ; p = [] } ; ConjRS conj ss = conjunctDistrTable Agr conj ss ** { c = ss.c diff --git a/src/finnish/NounFin.gf b/src/finnish/NounFin.gf index e395290d2..7daa3e62b 100644 --- a/src/finnish/NounFin.gf +++ b/src/finnish/NounFin.gf @@ -215,7 +215,9 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, StemFin, Prelude in } ; AdjCN ap cn = { - s = \\nf => ap.s ! True ! (n2nform nf) ++ cn.s ! nf ; + s = case ap.hasPrefix of { + True => \\nf => ap.p ++ BIND ++ cn.s ! nf ; + False => \\nf => ap.s ! True ! (n2nform nf) ++ cn.s ! nf } ; h = cn.h } ; RelCN cn rs = {s = \\nf => cn.s ! nf ++ BIND ++ "," ++ rs.s ! agrP3 (numN nf) ; diff --git a/src/finnish/ParadigmsFin.gf b/src/finnish/ParadigmsFin.gf index bea18dd6a..c643b892d 100644 --- a/src/finnish/ParadigmsFin.gf +++ b/src/finnish/ParadigmsFin.gf @@ -177,17 +177,23 @@ oper } ; invarA : Str -> A -- invariant adjective, e.g. "kelpo" - = \s -> lin A {s = \\_,_ => s ; h = Back} ; ----- stemming adds bogus endings + = \s -> lin A {s = \\_,_ => s ; h = Back ; p = [] ; hasPrefix = False} ; ----- stemming adds bogus endings + prefixA : Str -> A -> A = \pr,a -> a ** { + p = pr ; + hasPrefix = True + } ; + -- Two-place adjectives need a case for the second argument. mkA2 = overload { mkA2 : Str -> A2 -- e.g. "vihainen" (jollekin) - = \s -> mkA s ** {c2 = mkPrep allative ; lock_A2 = <>} ; + = \a -> let adj = mkA a ; + in lin A2 (adj ** {c2 = casePrep allative}) ; mkA2 : Str -> Prep -> A2 -- e.g. "jaollinen" (mkPrep adessive) - = \a,p -> mkA a ** {c2 = p ; lock_A2 = <>} ; + = \a,p -> let adj = mkA a in lin A2 (adj ** {c2=p}) ; mkA2 : A -> Prep -> A2 -- e.g. "jaollinen" (mkPrep adessive) - = \a,p -> a ** {c2 = p ; lock_A2 = <>} ; + = \a,p -> lin A2 (a ** {c2 = p}) ; } ; @@ -637,25 +643,26 @@ mkVS = overload { mkA = overload { mkA : Str -> A = mkA_1 ; mkA : N -> A = \n -> noun2adjDeg n ** {lock_A = <>} ; - mkA : N -> (kivempaa,kivinta : Str) -> A = \n -> regAdjective n ; + mkA : N -> (kivempi,kivin : Str) -> A = \n -> regAdjective n ; mkA : (sana : AK) -> A = \w -> noun2adjDeg (nforms2snoun w.s) ; mkA : (hyva,parempi,paras : N) -> (hyvin,paremmin,parhaiten : Str) -> A - = \h,p,ps,hn,pn,ph -> lin A (mkAdj h p ps hn pn ph) ; - mkA : V -> A = presPartA ; + = \h,p,ps,hn,pn,ph -> lin A (mkAdj h p ps hn pn ph ** {p=[]; hasPrefix=False}) ; + mkA : V -> A = presActA ; } ; mkA_1 : Str -> A = \x -> lin A (noun2adjDeg (mk1N x)) ; -- auxiliaries - mkAdjective : (_,_,_ : SAdj) -> A = \hyva,parempi,paras -> + mkAdjective : (_,_,_ : SAdj) -> A = \hyva,parempi,paras -> lin A {s = table { Posit => hyva.s ; Compar => parempi.s ; Superl => paras.s } ; h = hyva.h ; ---- different for parempi, paras - lock_A = <> + p = [] ; + hasPrefix = False } ; regAdjective : SNoun -> Str -> Str -> A = \kiva, kivempi, kivin -> mkAdjective