1
0
forked from GitHub/gf-rgl

(Fin) Add prefix field to A

This commit is contained in:
Inari Listenmaa
2018-10-08 16:10:41 +02:00
parent d4f2df8aa4
commit 9aa31fdcdd
5 changed files with 48 additions and 30 deletions

View File

@@ -5,54 +5,63 @@ concrete AdjectiveFin of Adjective = CatFin ** open ResFin, StemFin, Prelude in
lin lin
PositA a = { PositA a = a ** {
s = \\_ => sAdjFull2nforms Posit a ; s = \\_ => sAdjFull2nforms Posit a ;
} ; } ;
ComparA a np = ComparA a np =
let acomp = sAdjFull2nforms Compar a in { let acomp = sAdjFull2nforms Compar a in a ** {
s = \\isMod,af => case isMod of { s = \\isMod,af => case isMod of {
True => np.s ! NPCase Part ++ acomp ! af ; -- minua isompi True => np.s ! NPCase Part ++ acomp ! af ; -- minua isompi
_ => acomp ! af ++ "kuin" ++ np.s ! NPSep -- isompi kuin minä _ => acomp ! af ++ "kuin" ++ np.s ! NPSep -- isompi kuin minä
}
} ; } ;
CAdvAP ad ap np = { hasPrefix = False
s = \\m,af => ad.s ++ ap.s ! m ! af ++ ad.p ++ np.s ! NPSep
} ; } ;
UseComparA a = { CAdvAP ad ap np = ap ** {
s = \\m,af => ad.s ++ ap.s ! m ! af ++ ad.p ++ np.s ! NPSep ;
hasPrefix = False
} ;
UseComparA a = a ** {
s = \\_ => sAdjFull2nforms Compar a s = \\_ => sAdjFull2nforms Compar a
} ; } ;
-- $SuperlA$ belongs to determiner syntax in $Noun$. -- $SuperlA$ belongs to determiner syntax in $Noun$.
AdjOrd ord = { AdjOrd ord = {
s = \\_ => ord.s s = \\_ => ord.s ;
p = [] ; hasPrefix = False
} ; } ;
ComplA2 a np = { ComplA2 a np = {
s = \\isMod,af => 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 = { ReflA2 a = {
s = \\isMod,af => s = \\isMod,af =>
preOrPost isMod 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 = { SentAP ap sc = ap ** {
s = \\b,a => ap.s ! b ! a ++ sc.s s = \\b,a => ap.s ! b ! a ++ sc.s ;
hasPrefix = False
} ; } ;
AdAP ada ap = { AdAP ada ap = ap ** {
s = \\b,af => ada.s ++ ap.s ! b ! af s = \\b,af => ada.s ++ ap.s ! b ! af ;
hasPrefix = False
} ; } ;
AdvAP ap adv = { AdvAP ap adv = ap ** {
s = \\b,af => adv.s ++ ap.s ! b ! af -- luonnostaan vaalea s = \\b,af => adv.s ++ ap.s ! b ! af ; -- luonnostaan vaalea
hasPrefix = False
} ; } ;
UseA2 a = { UseA2 a = {
s = \\_ => sAdjFull2nforms Posit a s = \\_ => sAdjFull2nforms Posit a ;
p = [] ; hasPrefix = False
} ; } ;
} }

View File

@@ -42,7 +42,7 @@ concrete CatFin of Cat = CommonX ** open ResFin, StemFin, Prelude in {
-- The $Bool$ tells whether usage is modifying (as opposed to -- The $Bool$ tells whether usage is modifying (as opposed to
-- predicative), e.g. "x on suurempi kuin y" vs. "y:tä suurempi luku". -- 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 -- Noun
@@ -89,7 +89,7 @@ concrete CatFin of Cat = CommonX ** open ResFin, StemFin, Prelude in {
V2V = SVerb1 ** {c2 : Compl ; vi : VVType} ; ---- infinitive form V2V = SVerb1 ** {c2 : Compl ; vi : VVType} ; ---- infinitive form
V3 = SVerb1 ** {c2, c3 : Compl} ; 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} ; A2 = {s : Degree => SAForm => Str ; h : Harmony ; c2 : Compl} ;
N = SNoun ; N = SNoun ;

View File

@@ -16,7 +16,7 @@ concrete ConjunctionFin of Conjunction =
isPron = False ; isNeg = ss.isNeg 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 ** { ConjRS conj ss = conjunctDistrTable Agr conj ss ** {
c = ss.c c = ss.c

View File

@@ -215,7 +215,9 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, StemFin, Prelude in
} ; } ;
AdjCN ap cn = { 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 } ; h = cn.h } ;
RelCN cn rs = {s = \\nf => cn.s ! nf ++ BIND ++ "," ++ rs.s ! agrP3 (numN nf) ; RelCN cn rs = {s = \\nf => cn.s ! nf ++ BIND ++ "," ++ rs.s ! agrP3 (numN nf) ;

View File

@@ -177,17 +177,23 @@ oper
} ; } ;
invarA : Str -> A -- invariant adjective, e.g. "kelpo" 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. -- Two-place adjectives need a case for the second argument.
mkA2 = overload { mkA2 = overload {
mkA2 : Str -> A2 -- e.g. "vihainen" (jollekin) 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) 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) 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 = overload {
mkA : Str -> A = mkA_1 ; mkA : Str -> A = mkA_1 ;
mkA : N -> A = \n -> noun2adjDeg n ** {lock_A = <>} ; 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 : (sana : AK) -> A = \w -> noun2adjDeg (nforms2snoun w.s) ;
mkA : (hyva,parempi,paras : N) -> (hyvin,paremmin,parhaiten : Str) -> A 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) ; = \h,p,ps,hn,pn,ph -> lin A (mkAdj h p ps hn pn ph ** {p=[]; hasPrefix=False}) ;
mkA : V -> A = presPartA ; mkA : V -> A = presActA ;
} ; } ;
mkA_1 : Str -> A = \x -> lin A (noun2adjDeg (mk1N x)) ; mkA_1 : Str -> A = \x -> lin A (noun2adjDeg (mk1N x)) ;
-- auxiliaries -- auxiliaries
mkAdjective : (_,_,_ : SAdj) -> A = \hyva,parempi,paras -> mkAdjective : (_,_,_ : SAdj) -> A = \hyva,parempi,paras -> lin A
{s = table { {s = table {
Posit => hyva.s ; Posit => hyva.s ;
Compar => parempi.s ; Compar => parempi.s ;
Superl => paras.s Superl => paras.s
} ; } ;
h = hyva.h ; ---- different for parempi, paras h = hyva.h ; ---- different for parempi, paras
lock_A = <> p = [] ;
hasPrefix = False
} ; } ;
regAdjective : SNoun -> Str -> Str -> A = \kiva, kivempi, kivin -> regAdjective : SNoun -> Str -> Str -> A = \kiva, kivempi, kivin ->
mkAdjective mkAdjective