1
0
forked from GitHub/gf-rgl

(Est) Reduce inflection table in VP

Include VForms in VP, only construct VPForms when making Cl
This commit is contained in:
Inari Listenmaa
2022-04-13 11:37:25 +08:00
committed by Meowyam
parent e06c3433b9
commit 21259015e0
7 changed files with 83 additions and 70 deletions

View File

@@ -80,21 +80,24 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in {
-- Open lexical classes, e.g. Lexicon -- Open lexical classes, e.g. Lexicon
V, VS, VQ = Verb1 ; -- = {s : VForm => Str ; sc : Case} ; V, VS, VQ = Verb1 ; -- = {s : VForm => Str ; sc : Case} ;
V2, VA, V2Q, V2S = Verb1 ** {c2 : Compl} ; V2, VA, V2Q, V2S = Verb2 ;
V2A = Verb1 ** {c2, c3 : Compl} ; V2A, V3 = Verb3 ;
VV = Verb1 ** {vi : InfForm} ; ---- infinitive form VV = Verb1 ** {vi : InfForm} ;
V2V = Verb1 ** {c2 : Compl ; vi : InfForm} ; ---- infinitive form V2V = Verb2 ** {vi : InfForm} ; -- infinitive form
V3 = Verb1 ** {c2, c3 : Compl} ;
A = Adjective ** {infl : Infl} ; A = Adjective ** {infl : Infl} ;
A2 = A ** {c2 : Compl} ; A2 = A ** {c2 : Compl} ;
N = Noun ; N = Noun ;
N2 = Noun ** {c2 : Compl ; isPre : Bool ; lock_N2 : {}} ; N2 = Noun ** {c2 : Compl ; isPre : Bool} ;
N3 = Noun ** {c2,c3 : Compl ; isPre,isPre2 : Bool ; lock_N3 : {}} ; N3 = Noun ** {c2,c3 : Compl ; isPre,isPre2 : Bool} ;
PN = {s : Case => Str} ; PN = {s : Case => Str} ;
oper Verb1 = Verb ** { sc : NPForm} ; --what is this for? --subject case, i.e. "ma näen kassi"/"mul on kass" linref
VP = \vp -> linV vp.v ;
V,VS,VQ = linV ;
V2,VA,V2S,V2Q = linV2 ;
} }

View File

@@ -395,7 +395,7 @@ concrete ExtendEst of Extend =
vp.s2 ! sentIsPos ! Pos ! agrP3 Sg -- raamatut vp.s2 ! sentIsPos ! Pos ! agrP3 Sg -- raamatut
++ vp.adv -- paremini ++ vp.adv -- paremini
++ vp.p -- ära ++ vp.p -- ära
++ (vp.s ! vif ! Simul ! Pos ! agrP3 Sg).fin -- tunda/tundes/tundmata/... ++ (mkVPForms vp.v ! vif ! Simul ! Pos ! agrP3 Sg).fin -- tunda/tundes/tundmata/...
++ vp.ext ; ++ vp.ext ;
--------------------------------- ---------------------------------

View File

@@ -60,7 +60,7 @@ concrete ExtraEst of ExtraEstAbs = CatEst **
} ; } ;
MkVPS t p vp = { -- Temp -> Pol -> VP -> VPS ; MkVPS t p vp = { -- Temp -> Pol -> VP -> VPS ;
s = \\a => let vps = vp.s ! VIFin t.t ! t.a ! p.p ! a s = \\a => let vps = mkVPForms vp.v ! VIFin t.t ! t.a ! p.p ! a
in in
t.s ++ p.s ++ t.s ++ p.s ++
vps.fin ++ vps.inf ++ vps.fin ++ vps.inf ++

View File

@@ -39,21 +39,14 @@ concrete IdiomEst of Idiom = CatEst **
ImpersCl vp = mkClause noSubj (agrP3 Sg) vp ; ImpersCl vp = mkClause noSubj (agrP3 Sg) vp ;
GenericCl vp = mkClause noSubj (agrP3 Sg) { GenericCl vp = mkClause noSubj (agrP3 Sg) (passiveVP vp) ;
s = \\_ => vp.s ! VIPass Pres ;
s2 = vp.s2 ;
adv = vp.adv ;
p = vp.p ;
ext = vp.ext ;
sc = vp.sc ;
} ;
ProgrVP vp = ProgrVP vp =
let let
inf = (vp.s ! VIInf InfMas ! Simul ! Pos ! agrP3 Sg).fin ; inf = (mkVPForms vp.v ! VIInf InfMas ! Simul ! Pos ! agrP3 Sg).fin ;
on = predV olla on = predV olla
in { in {
s = on.s ; v = verbOlema ;
s2 = \\b,p,a => vp.s2 ! b ! p ! a ++ inf ; s2 = \\b,p,a => vp.s2 ! b ! p ! a ++ inf ;
adv = vp.adv ; adv = vp.adv ;
p = vp.p ; p = vp.p ;
@@ -65,7 +58,7 @@ concrete IdiomEst of Idiom = CatEst **
-- The imperative is not available in a $VP$. -- The imperative is not available in a $VP$.
ImpPl1 vp = ImpPl1 vp =
let vps = vp.s ! VIPass Pres ! Simul ! Pos ! Ag Pl P1 let vps = mkVPForms vp.v ! VIPass Pres ! Simul ! Pos ! Ag Pl P1
in in
{s = vps.fin ++ vps.inf ++ {s = vps.fin ++ vps.inf ++
vp.s2 ! True ! Pos ! Ag Pl P1 ++ vp.p ++ vp.ext vp.s2 ! True ! Pos ! Ag Pl P1 ++ vp.p ++ vp.ext

View File

@@ -176,6 +176,13 @@ param
p : Str -- particle verbs p : Str -- particle verbs
} ; } ;
Verb1 : Type = Verb ** {sc : NPForm} ; --subject case, i.e. "ma näen kassi"/"mul on kass"
Verb2 : Type = Verb1 ** {c2 : Compl} ;
Verb3 : Type = Verb2 ** {c3 : Compl} ;
linV : Verb -> Str = \v -> v.s ! Inf InfMa ++ v.p ;
linV2 : Verb -> Str = \v -> v.s ! Inf InfMa ++ v.p ;
param param
VIForm = VIForm =
VIFin Tense VIFin Tense
@@ -187,7 +194,7 @@ param
oper oper
VP : Type = { VP : Type = {
s : VIForm => Anteriority => Polarity => Agr => {fin, inf : Str} ; v : Verb ;
s2 : Bool => Polarity => Agr => Str ; -- raamat/raamatu/raamatut s2 : Bool => Polarity => Agr => Str ; -- raamat/raamatu/raamatut
adv : Str ; adv : Str ;
p : Str ; --uninflecting component in multi-word verbs p : Str ; --uninflecting component in multi-word verbs
@@ -195,48 +202,63 @@ oper
sc : NPForm ; sc : NPForm ;
} ; } ;
predV : (Verb ** {sc : NPForm}) -> VP = \verb -> { passiveVerb : Verb -> Verb = \verb -> verb ** {
s = \\vi,ant,b,agr0 => s = table {
let Presn _ _ => verb.s ! PassPresn True ;
agr = verbAgr agr0 ; Impf _ _ => verb.s ! PassImpf True ; --# notpresent
verbs = verb.s ; Condit _ _ => verb.s ! ConditPass ; --# notpresent
part : Str = case vi of { ImperP3|ImperP1Pl|Imper _ => verb.s ! ImperPass ;
VIPass _ => verbs ! (PastPart Pass) ; PresPart _ => verb.s ! PresPart Pass ;
_ => verbs ! (PastPart Act) PastPart _ => verb.s ! PastPart Pass ;
} ; x => verb.s ! x }
} ;
einegole : Str * Str * Str = case <vi,agr.n> of { -- NB. only chooses passive verb forms, to get subject case need compl2subjcase, used in PassV2
<VIFin Pres> => <"ei", verbs ! Imper Sg, "ole"> ; passiveVP : VP -> VP = \vp -> vp ** {v = passiveVerb vp.v} ;
<VIFin Fut> => <"ei", verbs ! Imper Sg, "ole"> ;
<VIFin Cond> => <"ei", verbs ! Condit Sg P3, "oleks"> ;
<VIFin Past> => <"ei", part, "olnud"> ;
<VIImper, Sg> => <"ära", verbs ! Imper Sg, "ole"> ;
<VIImper, Pl> => <"ärge", verbs ! Imper Pl, "olge"> ;
<VIPass Pres> => <"ei", verbs ! PassPresn False, "ole"> ;
<VIPass Fut> => <"ei", verbs ! PassPresn False, "ole"> ; --# notpresent
<VIPass Cond> => <"ei", verbs ! ConditPass, "oleks"> ; --# notpresent
<VIPass Past> => <"ei", verbs ! PassImpf False, "olnud"> ; --# notpresent
<VIPresPart> => <"ei", verbs ! PresPart Act, "olev"> ; --# notpresent
<VIInf i> => <"ei", verbs ! Inf i, verbOlema.s ! Inf i>
} ; VPForms : Type = VIForm => Anteriority => Polarity => Agr => {fin, inf : Str} ;
ei : Str = einegole.p1 ; mkVPForms : Verb -> VPForms = \verb -> \\vi,ant,b,agr0 =>
neg : Str = einegole.p2 ; let
ole : Str = einegole.p3 ; agr = verbAgr agr0 ;
verbs = verb.s ;
part : Str = case vi of {
VIPass _ => verbs ! PastPart Pass ;
_ => verbs ! PastPart Act
} ;
olema : VForm => Str = verbOlema.s ; einegole : Str * Str * Str = case <vi,agr.n> of {
<VIFin Pres> => <"ei", verbs ! Imper Sg, "ole"> ;
<VIFin Fut> => <"ei", verbs ! Imper Sg, "ole"> ;
<VIFin Cond> => <"ei", verbs ! Condit Sg P3, "oleks"> ;
<VIFin Past> => <"ei", part, "olnud"> ;
<VIImper, Sg> => <"ära", verbs ! Imper Sg, "ole"> ;
<VIImper, Pl> => <"ärge", verbs ! Imper Pl, "olge"> ;
<VIPass Pres> => <"ei", verbs ! PassPresn False, "ole"> ;
<VIPass Fut> => <"ei", verbs ! PassPresn False, "ole"> ; --# notpresent
<VIPass Cond> => <"ei", verbs ! ConditPass, "oleks"> ; --# notpresent
<VIPass Past> => <"ei", verbs ! PassImpf False, "olnud"> ; --# notpresent
<VIPresPart> => <"ei", verbs ! PresPart Act, "olev"> ; --# notpresent
<VIInf i> => <"ei", verbs ! Inf i, verbOlema.s ! Inf i>
vf : Str -> Str -> {fin, inf : Str} = \x,y -> {fin = x ; inf = y} ; } ;
mkvf : VForm -> {fin, inf : Str} = \p -> case <ant,b> of { ei : Str = einegole.p1 ;
<Simul,Pos> => vf (verbs ! p) [] ; neg : Str = einegole.p2 ;
<Anter,Pos> => vf (olema ! p) part ; ole : Str = einegole.p3 ;
<Simul,Neg> => vf (ei ++ neg) [] ;
<Anter,Neg> => vf (ei ++ ole) part
} ;
passPol = case b of {Pos => True ; Neg => False} ; olema : VForm => Str = verbOlema.s ;
vf : Str -> Str -> {fin, inf : Str} = \x,y -> {fin = x ; inf = y} ;
mkvf : VForm -> {fin, inf : Str} = \p -> case <ant,b> of {
<Simul,Pos> => vf (verbs ! p) [] ;
<Anter,Pos> => vf (olema ! p) part ;
<Simul,Neg> => vf (ei ++ neg) [] ;
<Anter,Neg> => vf (ei ++ ole) part
} ;
passPol = case b of {Pos => True ; Neg => False} ;
in case vi of { in case vi of {
VIFin Past => mkvf (Impf agr.n agr.p) ; --# notpresent VIFin Past => mkvf (Impf agr.n agr.p) ; --# notpresent
@@ -252,6 +274,8 @@ oper
VIInf i => mkvf (Inf i) VIInf i => mkvf (Inf i)
} ; } ;
predV : Verb1 -> VP = \verb -> {
v = verb ; -- ignoring the subject
s2 = \\_,_,_ => [] ; s2 = \\_,_,_ => [] ;
adv = [] ; adv = [] ;
ext = [] ; --relative clause ext = [] ; --relative clause
@@ -329,7 +353,7 @@ oper
NPCase Nom => <agr,True> ; NPCase Nom => <agr,True> ;
_ => <agrP3 Sg,False> -- minule meeldib, minul on _ => <agrP3 Sg,False> -- minule meeldib, minul on
} ; } ;
verb = vp.s ! VIFin t ! a ! b ! agrfin.p1 ; verb = mkVPForms vp.v ! VIFin t ! a ! b ! agrfin.p1 ;
in {subj = sub b ; in {subj = sub b ;
fin = verb.fin ; fin = verb.fin ;
inf = verb.inf ; inf = verb.inf ;
@@ -389,7 +413,7 @@ oper
NPCase Nom => True ; -- mina tahan joosta NPCase Nom => True ; -- mina tahan joosta
_ => False -- minul peab auto olema _ => False -- minul peab auto olema
} ; } ;
verb = vp.s ! VIInf vi ! ant ! Pos ! agr ; -- no "ei" verb = mkVPForms vp.v ! VIInf vi ! ant ! Pos ! agr ; -- no "ei"
compl = vp.s2 ! fin ! pol ! agr ; -- but compl. case propagated compl = vp.s2 ! fin ! pol ! agr ; -- but compl. case propagated
adv = vp.adv adv = vp.adv
in in
@@ -590,8 +614,7 @@ oper
} ; } ;
} ; } ;
Noun = {s : NForm => Str} ; Noun : Type = {s : NForm => Str} ;
-- To form an adjective, it is usually enough to give a noun declension: the -- To form an adjective, it is usually enough to give a noun declension: the
-- adverbial form is regular. -- adverbial form is regular.
@@ -660,7 +683,7 @@ oper
-- Converts 6 given strings (Nom, Gen, Part, Illat, Gen, Part) into Noun -- Converts 6 given strings (Nom, Gen, Part, Illat, Gen, Part) into Noun
-- http://www.eki.ee/books/ekk09/index.php?p=3&p1=5&id=226 -- http://www.eki.ee/books/ekk09/index.php?p=3&p1=5&id=226
nForms2N : NForms -> Noun = \f -> nForms2N : NForms -> Noun = \f ->
let let
jogi = f ! 0 ; jogi = f ! 0 ;
joe = f ! 1 ; joe = f ! 1 ;

View File

@@ -11,7 +11,7 @@ concrete SentenceEst of Sentence = CatEst ** open Prelude, ResEst in {
ImpVP vp = { ImpVP vp = {
s = \\pol,agr => s = \\pol,agr =>
let let
verb = vp.s ! VIImper ! Simul ! pol ! agr ; verb = mkVPForms vp.v ! VIImper ! Simul ! pol ! agr ;
compl = vp.s2 ! False ! pol ! agr ++ vp.ext --- False = like inf (osta auto) compl = vp.s2 ! False ! pol ! agr ++ vp.ext --- False = like inf (osta auto)
in --(ära) loe raamat(ut) läbi in --(ära) loe raamat(ut) läbi
verb.fin ++ verb.inf ++ compl ++ vp.p ; verb.fin ++ verb.inf ++ compl ++ vp.p ;

View File

@@ -79,13 +79,7 @@ concrete VerbEst of Verb = CatEst ** open Prelude, ResEst in {
ReflVP v = insertObjPre (\\fin,b,agr => appCompl fin b v.c2 (reflPron agr)) v ; ReflVP v = insertObjPre (\\fin,b,agr => appCompl fin b v.c2 (reflPron agr)) v ;
PassV2 v = PassV2 v = let vp : VP = passiveVP (predV v) in vp ** {
let vp = predV v in vp ** {
s = \\vf => case vf of {
VIFin t => vp.s ! VIPass t ;
-- VIImper => v.s ! ImperPass ; -- TODO: include these forms from V into VP
-- VIPresPart => v.s ! PresPart Pass ;
x => vp.s ! x } ;
sc = compl2subjcase v.c2 -- koer valitakse ; koerale räägitakse sc = compl2subjcase v.c2 -- koer valitakse ; koerale räägitakse
} ; } ;