more extensions by Codex + reuse the TenseX module

This commit is contained in:
Krasimir Angelov
2026-10-02 19:20:32 +02:00
parent bc7afae589
commit ea2fb317c5
22 changed files with 753 additions and 170 deletions
+115 -4
View File
@@ -6,7 +6,6 @@ concrete ExtendCze of Extend = CatCze **
iFem_Pron, youFem_Pron, weFem_Pron, youPlFem_Pron,
theyFem_Pron, theyNeutr_Pron, youPolFem_Pron, youPolPlFem_Pron
---- constant not found (yet)
,UttVPShort
,UttAccIP
,UttDatIP
,SubjRelNP
@@ -21,15 +20,35 @@ concrete ExtendCze of Extend = CatCze **
,ExistMassCN
,ExistIPQS
,ExistCN
,EmptyRelSlash
,DetNPMasc
,DetNPFem
,ComplBareVS
,CompIQuant
,CompBareCN
,PiedPipingQuestSlash
,PiedPipingRelSlash
,TPastSimple
,MkVPS
,BaseVPS
,ConsVPS
,ConjVPS
,PredVPS
,MkVPI
,BaseVPI
,ConsVPI
,ConjVPI
,ComplVPIVV
,PassVPSlash
,PassAgentVPSlash
,PresPartAP
,PastPartAP
,PastPartAgentAP
,CompoundN
,GerundCN
,GerundNP
,GerundAdv
,InOrderToVP
,ProgrVPSlash
,PositAdVAdj
,ApposNP
]
with (Grammar = GrammarCze)
**
@@ -37,7 +56,16 @@ open
ResCze, Prelude, (S = SyntaxCze), (P = ParadigmsCze)
in {
lin
TPastSimple = {s = [] ; t = Past} ;
lincat
VPS = {s : Agr => Str} ;
[VPS] = {s1,s2 : Agr => Str} ;
VPI = {s : Agr => Str} ;
[VPI] = {s1,s2 : Agr => Str} ;
[Comp] = {s1,s2 : Agr => Str} ;
[Imp] = {s1,s2 : Polarity => Agr => Str} ;
RNP = BoundNPForms ** {m : RNPHead ; isPron : Bool} ;
RNPList = {s1,s2,prep1,prep2 : Agr => Case => Str ; m : RNPHead} ;
@@ -45,6 +73,81 @@ param
RNPHead = AntecedentHead | FixedHead ModifierAgr ;
lin
MkVPS temp pol vp = {s = \\a =>
tenseClitic temp.t a ++ vp.clit ! a ++
tenseVerb temp.t vp.verb a pol.p ++ vp.compl ! a
} ;
BaseVPS x y = {s1 = x.s ; s2 = y.s} ;
ConsVPS x xs = {s1 = \\a => x.s ! a ++ SOFT_BIND ++ "," ++ xs.s1 ! a ; s2 = xs.s2} ;
ConjVPS conj xs = {s = \\a => conj.s1 ++ xs.s1 ! a ++ conj.s2 ++ xs.s2 ! a} ;
PredVPS np vps = sentence True (np.s ! Nom) [] (vps.s ! np.a) ;
MkVPI vp = {s = \\a => vp.verb.inf ++ vp.clit ! a ++ vp.compl ! a} ;
BaseVPI x y = {s1 = x.s ; s2 = y.s} ;
ConsVPI x xs = {s1 = \\a => x.s ! a ++ SOFT_BIND ++ "," ++ xs.s1 ! a ; s2 = xs.s2} ;
ConjVPI conj xs = {s = \\a => conj.s1 ++ xs.s1 ! a ++ conj.s2 ++ xs.s2 ! a} ;
ComplVPIVV vv vpi = {
verb = vv ; clitPresent = False ; clit = \\_ => vv.refl ; compl = vpi.s
} ;
BaseComp x y = {s1 = x.s ; s2 = y.s} ;
ConsComp x xs = {s1 = \\a => x.s ! a ++ SOFT_BIND ++ "," ++ xs.s1 ! a ; s2 = xs.s2} ;
ConjComp conj xs = {s = \\a => conj.s1 ++ xs.s1 ! a ++ conj.s2 ++ xs.s2 ! a} ;
BaseImp x y = {s1 = x.s ; s2 = y.s} ;
ConsImp x xs = {s1 = \\p,a => x.s ! p ! a ++ SOFT_BIND ++ "," ++ xs.s1 ! p ! a ; s2 = xs.s2} ;
ConjImp conj xs = {s = \\p,a => conj.s1 ++ xs.s1 ! p ! a ++ conj.s2 ++ xs.s2 ! p ! a} ;
PassVPSlash vp = {
verb = vp.verb ; clitPresent = True ;
clit = \\a => vp.clit ! a ++ "se" ++ vp.clitAfter ! a ;
compl = \\a => vp.compl ! a ++ vp.ind ! a
} ;
PassAgentVPSlash vp np =
let pass = PassVPSlash vp in pass ** {
compl = \\a => pass.compl ! a ++ "od" ++ np.prep ! Gen
} ;
PresPartAP vp =
let phrase = vp.verb.inf ++ vp.clit ! Ag Neutr Sg P3 ++ vp.compl ! Ag Neutr Sg P3 ;
ap = adjFormsAdjective (invarAdjForms phrase)
in ap ** {pred = longPredicate ap ; isPost = True} ;
PastPartAP vp =
let phrase = vp.verb.pastpartsg ++ vp.compl ! Ag Neutr Sg P3 ++ vp.ind ! Ag Neutr Sg P3 ;
ap = adjFormsAdjective (invarAdjForms phrase)
in ap ** {pred = longPredicate ap ; isPost = True} ;
PastPartAgentAP vp np =
let ap = PastPartAP vp in ap ** {
s = \\g,n,c => ap.s ! g ! n ! c ++ "od" ++ np.prep ! Gen ;
pred = \\a => ap.pred ! a ++ "od" ++ np.prep ! Gen ; isPost = True
} ;
CompoundN first head = head ** {
snom = head.snom ++ first.sgen ; sgen = head.sgen ++ first.sgen ;
sdat = head.sdat ++ first.sgen ; sacc = head.sacc ++ first.sgen ;
svoc = head.svoc ++ first.sgen ; sloc = head.sloc ++ first.sgen ;
sins = head.sins ++ first.sgen ; pnom = head.pnom ++ first.sgen ;
pgen = head.pgen ++ first.sgen ; pdat = head.pdat ++ first.sgen ;
pacc = head.pacc ++ first.sgen ; ploc = head.ploc ++ first.sgen ;
pins = head.pins ++ first.sgen
} ;
GerundCN vp = {
s = \\_,_ => vp.verb.inf ++ vp.clit ! Ag Neutr Sg P3 ++ vp.compl ! Ag Neutr Sg P3 ;
g = Neutr ; gPl = Neutr
} ;
GerundNP vp = MassNP (GerundCN vp) ;
GerundAdv vp = {s = vp.verb.inf ++ vp.clit ! Ag Neutr Sg P3 ++ vp.compl ! Ag Neutr Sg P3} ;
InOrderToVP vp = {s = "aby" ++ vp.verb.inf ++ vp.clit ! Ag Neutr Sg P3 ++ vp.compl ! Ag Neutr Sg P3} ;
ProgrVPSlash vp = vp ;
PositAdVAdj a = {s = a.nsnom} ;
ApposNP first second =
let forms = appendNPForms first (SOFT_BIND ++ "," ++ second.s ! Nom)
in first ** forms ** {clit = forms.s ; hasClit = False ; isDrop = False} ;
UseDAP dap = dapNP Neutr dap ;
UseDAPMasc dap = dapNP (Masc Anim) dap ;
UseDAPFem dap = dapNP Fem dap ;
-- Standalone oblique NPs use full forms, never clitics or prepositional forms.
UttAccNP np = {s = np.s ! Acc} ;
UttDatNP np = {s = np.s ! Dat} ;
@@ -106,6 +209,14 @@ lin
} ;
oper
dapNP : Gender -> Determiner -> S.NP = \g,dap ->
let forms : Case => Str = \\c => dap.s ! g ! c ;
agr = numeralAgr g dap P3 in
lin NP (npForms forms forms ** {
clit = forms ; a = agr ; m = numeralModAgr g dap ;
hasClit = False ; isDrop = False ; isPron = False
}) ;
BoundNPForms : Type = {
s,prep,before,prepBefore : Agr => Case => Str ; after : Agr => Str
} ;