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
+1 -1
View File
@@ -1,6 +1,6 @@
--# -path=.:../czech:../common:../abstract:../prelude
resource TryCze = ExtraCze, SyntaxCze, LexiconCze, ParadigmsCze -[mkAdv, mkDet,mkQuant]**
resource TryCze = ExtraCze, SyntaxCze, LexiconCze, ParadigmsCze -[mkAdv,mkAdN,mkIAdv,mkDet,mkIDet,mkIP,mkQuant,mkCard,mkPConj,mkVoc]**
open (P = ParadigmsCze) in {
-- oper
+23
View File
@@ -21,6 +21,18 @@ concrete AdjectiveCze of Adjective = CatCze ** open ResCze, Prelude in {
UseA2 a = let ap = adjFormsAdjective a in ap ** {pred = longPredicate ap ; isPost = True} ;
ReflA2 a =
let ap = adjFormsAdjective a ;
refl : Case => Str = table {
Nom | ResCze.Voc => "sebe" ; Gen | Acc => "sebe" ;
Dat | Loc => "sobě" ; Ins => "sebou"
} ;
compl = a.c.s ++ refl ! a.c.c
in ap ** {
s = \\g,n,c => ap.s ! g ! n ! c ++ compl ;
pred = \\agr => longPredicate ap ! agr ++ compl ; isPost = True
} ;
UseComparA a = let ap = adjFormsAdjective a.compar in ap ** {pred = longPredicate ap ; isPost = False} ;
ComparA a np = AdvAP (UseComparA a) {s = "než" ++ np.s ! Nom} ;
AdjOrd ord = ord ** {pred = longPredicate ord ; isPost = False} ;
@@ -30,4 +42,15 @@ concrete AdjectiveCze of Adjective = CatCze ** open ResCze, Prelude in {
pred = \\a => ap.pred ! a ++ adv.s ; isPost = True
} ;
SentAP ap sc = ap ** {
s = \\g,n,c => ap.s ! g ! n ! c ++ sc.s ;
pred = \\a => ap.pred ! a ++ sc.s ; isPost = True
} ;
CAdvAP cadv ap np = ap ** {
s = \\g,n,c => cadv.s ++ ap.s ! g ! n ! c ++ "než" ++ np.s ! Nom ;
pred = \\a => cadv.s ++ ap.pred ! a ++ "než" ++ np.s ! Nom ;
isPost = True
} ;
}
+11
View File
@@ -2,6 +2,17 @@ concrete AdverbCze of Adverb = CatCze **
open ResCze, Prelude in {
lin
PositAdvAdj a = {s = a.nsnom} ;
PositAdAAdj a = {s = a.nsnom} ;
AdAdv ada adv = {s = ada.s ++ adv.s} ;
AdnCAdv cadv = {s = cadv.s} ;
ComparAdvAdj cadv a np = {
s = cadv.s ++ a.nsnom ++ "než" ++ np.s ! Nom
} ;
ComparAdvAdjS cadv a sent = {
s = cadv.s ++ a.nsnom ++ "než" ++ sent.s
} ;
PrepNP prep np = {
s = fullComplement prep np.s np.prep
} ;
+12 -28
View File
@@ -1,24 +1,21 @@
concrete CatCze of Cat =
--- CommonX **
CommonX **
open ResCze, Prelude in {
lincat
Text = {s : Str} ;
Phr = {s : Str} ;
Utt = {s : Str} ;
S = ResCze.Sentence ;
Cl = {subj,clit,compl : Str ; verb : VerbForms ; a : Agr ; isDrop,clitPresent : Bool} ;
Cl = ResCze.Clause ;
Comp = {s : Agr => Str} ;
QS = {s,ind : Str} ;
QCl = {q,subj,clit,compl : Str ; verb : VerbForms ; a : Agr ; yesNo : Bool} ;
IAdv, IComp = {s : Str} ;
ClSlash = ResCze.Clause ** {c : ComplementCase ; ind : Str} ;
SSlash = {s : Str ; c : ComplementCase} ;
QCl = ResCze.Clause ** {q : Str ; yesNo : Bool} ;
IComp = {s : Str} ;
IP = {s : Case => Str ; a : Agr} ;
IDet = Determiner ;
IQuant = Adjective ;
Imp = {s : Bool => Agr => Str} ;
Imp = {s : Polarity => Agr => Str} ;
RS = {s : Agr => Str} ;
RCl = {subj,clit,compl : Agr => Str ; verb : VerbForms} ; ---- RAgr with composite RP
@@ -32,16 +29,16 @@ concrete CatCze of Cat =
V = ResCze.VerbForms ;
V2 = ResCze.VerbForms ** {c : ComplementCase} ;
V3 = ResCze.VerbForms ** {c,c2 : ComplementCase} ; -- c : direct object, c2 : indirect object
VS,VQ = ResCze.VerbForms ;
VS,VQ,VA = ResCze.VerbForms ;
VV = ResCze.VerbForms ** {isAux : Bool} ;
V2A,V2Q,V2S,V2V = ResCze.VerbForms ** {c : ComplementCase} ;
A = ResCze.DegreeForms ;
AP = ResCze.Adjective ** {pred : Agr => Str ; isPost : Bool} ;
A2 = ResCze.DegreeForms ** {c : ComplementCase} ;
AdA = {s : Str} ;
N = ResCze.NounForms ;
N2 = ResCze.NounForms ** {c2 : ComplementCase} ;
CN = ResCze.Noun ; -- {s : Number => Case => Str ; g : Gender}
-- Object-clitic eligibility and subject omission are independent.
-- Extend.ProDrop selects isDrop; clit ! Nom retains its empty constituent.
@@ -55,29 +52,16 @@ concrete CatCze of Cat =
Quant = {s : Gender => Number => Case => Str} ; -- same as AP
Predet = Adjective ** {postPron : Bool} ;
Num = Determiner ;
Card = Determiner ; -- {s : Gender => Case => Str ; size : NumSize} ;
Card,DAP = Determiner ; -- {s : Gender => Case => Str ; size : NumSize} ;
Pron = PronForms ** {poss : DemPronForms} ;
Adv = {s : Str} ;
Prep = ResCze.ComplementCase ; -- {s : Str ; c : Case ; hasPrep : Bool} ;
Conj = {s1,s2 : Str} ; ---- may need a number
Pol = {s : Str ; p : Bool} ;
Temp = {s : Str ; t : CTense} ;
Tense = {s : Str ; t : CTense} ;
Ant = {s : Str ; t : CTense} ;
PConj = {s : Str} ;
Voc = {s : Str} ;
AdN = {s : Str} ;
AdV = {s : Str} ;
CAdv = {s : Str} ;
SC = {s : Str} ;
linref
N = \s -> s.snom ;
A = \s -> s.msnom ;
Conj = \c -> c.s2 ;
lincat Numeral = Determiner ; ---- TODO: should contain Ord as well
+13 -2
View File
@@ -3,6 +3,7 @@ concrete ConjunctionCze of Conjunction = CatCze **
lincat
[Adv] = {s1,s2 : Str} ;
[CN] = {s1,s2 : Number => Case => Str ; g,gPl : Gender} ;
[AP] = {s1,s2 : Gender => Number => Case => Str ; pred1,pred2 : Agr => Str ; isPost : Bool} ;
[NP] = {s1,s2,prep1,prep2 : Case => Str ; a : Agr ; m : ModifierAgr} ;
[S] = {s1 : Sentence ; s2 : Str} ;
@@ -12,6 +13,16 @@ concrete ConjunctionCze of Conjunction = CatCze **
BaseAdv = twoSS ;
ConsAdv = consrSS comma ;
BaseCN x y = {s1 = x.s ; s2 = y.s ; g = x.g ; gPl = x.gPl} ;
ConsCN x xs = {
s1 = \\n,c => x.s ! n ! c ++ comma ++ xs.s1 ! n ! c ;
s2 = xs.s2 ; g = x.g ; gPl = x.gPl
} ;
ConjCN conj xs = {
s = \\n,c => conj.s1 ++ xs.s1 ! n ! c ++ conj.s2 ++ xs.s2 ! n ! c ;
g = xs.g ; gPl = xs.gPl
} ;
BaseAP x y = twoTable3 Gender Number Case x y
** {pred1 = x.pred ; pred2 = y.pred ; isPost = orB x.isPost y.isPost} ;
ConsAP x xs = consrTable3 Gender Number Case comma x xs
@@ -23,14 +34,14 @@ concrete ConjunctionCze of Conjunction = CatCze **
s2 = y.s ;
prep1 = x.prep ;
prep2 = y.prep ;
a = y.a ; m = x.m
a = y.a ; m = x.m ;
} ; -- clitics disappear ---- Agr TODO
ConsNP x xs = {
s1 = \\c => x.s ! c ++ comma ++ xs.s1 ! c ;
s2 = xs.s2 ;
prep1 = \\c => x.prep ! c ++ comma ++ xs.prep1 ! c ;
prep2 = xs.prep2 ;
a = xs.a ; m = x.m ----
a = xs.a ; m = x.m ; ----
} ;
BaseS x y = {s1 = x ; s2 = y.s} ;
+50
View File
@@ -0,0 +1,50 @@
--# -path=.:../abstract:../common:../prelude
concrete ConstructionCze of Construction = CatCze **
open ResCze, Prelude, (P = ParadigmsCze), (G = GrammarCze) in {
lincat
Timeunit, Hour, Monthday, Year, Language = {s : Str} ;
Weekday, Month = {s : Str ; n : NounForms} ;
lin
ready_VP = G.UseComp (G.CompAP (G.PositA (P.mkA "připravený"))) ;
has_age_VP card = {
verb = copulaVerbForms ; clitPresent = False ; clit = \\_ => [] ;
compl = \\a => card.s ! Neutr ! Nom ++ "let" ++ "starý"
} ;
cup_of_CN np = G.PossNP (G.UseN (P.mkN "šálek")) np ;
n_units_AP card cn adj =
G.AdvAP (G.PositA adj) {s = card.s ! Neutr ! Nom ++ cn.s ! Pl ! Gen} ;
n_units_of_NP card cn np =
G.AdvNP np {s = card.s ! Neutr ! Nom ++ cn.s ! Pl ! Gen} ;
intYear year = {s = year.s} ;
yearAdv year = {s = "v roce" ++ year.s} ;
weekdayN day = day.n ;
monthN month = month.n ;
weekdayPunctualAdv day = {s = "v" ++ day.s} ;
weekdayHabitualAdv day = {s = "každý" ++ day.s} ;
monday_Weekday = {s = "pondělí" ; n = P.mkN "pondělí"} ;
tuesday_Weekday = {s = "úterý" ; n = P.mkN "úterý"} ;
wednesday_Weekday = {s = "středa" ; n = P.mkN "středa"} ;
thursday_Weekday = {s = "čtvrtek" ; n = P.mkN "čtvrtek"} ;
friday_Weekday = {s = "pátek" ; n = P.mkN "pátek"} ;
saturday_Weekday = {s = "sobota" ; n = P.mkN "sobota"} ;
sunday_Weekday = {s = "neděle" ; n = P.mkN "neděle"} ;
january_Month = {s = "leden" ; n = P.mkN "leden"} ;
february_Month = {s = "únor" ; n = P.mkN "únor"} ;
march_Month = {s = "březen" ; n = P.mkN "březen"} ;
april_Month = {s = "duben" ; n = P.mkN "duben"} ;
may_Month = {s = "květen" ; n = P.mkN "květen"} ;
june_Month = {s = "červen" ; n = P.mkN "červen"} ;
july_Month = {s = "červenec" ; n = P.mkN "červenec"} ;
august_Month = {s = "srpen" ; n = P.mkN "srpen"} ;
september_Month = {s = "září" ; n = P.mkN "září"} ;
october_Month = {s = "říjen" ; n = P.mkN "říjen"} ;
november_Month = {s = "listopad" ; n = P.mkN "listopad"} ;
december_Month = {s = "prosinec" ; n = P.mkN "prosinec"} ;
}
+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
} ;
+5
View File
@@ -10,6 +10,8 @@ lin
subj = case experiencer.hasClit of {True => [] ; False => experiencer.s ! Dat} ;
clit = case experiencer.hasClit of {True => experiencer.clit ! Dat ; False => []} ;
compl = predicate.s ! Nom ; verb = copulaVerbForms ; a = predicate.a ;
finite = (mkClause [] [] [] copulaVerbForms predicate.a False False).finite ;
auxiliary = (mkClause [] [] [] copulaVerbForms predicate.a False False).auxiliary ;
isDrop = experiencer.hasClit ; clitPresent = experiencer.hasClit
} ;
@@ -18,6 +20,9 @@ lin
subj = case experiencer.hasClit of {True => [] ; False => experiencer.s ! Dat} ;
clit = case experiencer.hasClit of {True => experiencer.clit ! Dat ; False => []} ;
compl = [] ; verb = copulaVerbForms ; a = predicate.a ;
isDrop = False ; clitPresent = False ;
finite = (mkClause [] [] [] copulaVerbForms predicate.a False False).finite ;
auxiliary = (mkClause [] [] [] copulaVerbForms predicate.a False False).auxiliary ;
yesNo = False
} ;
}
+2 -1
View File
@@ -14,6 +14,7 @@ concrete GrammarCze of Grammar =
TextCze,
StructuralCze,
IdiomCze,
TenseCze
NamesCze,
TenseX
** {
}
+12 -25
View File
@@ -5,34 +5,21 @@ lin
ImpP3 np vp = {
s = "nechť" ++ vp.clit ! np.a ++
(case np.isDrop of {True => np.clit ! Nom ; False => np.s ! Nom}) ++
verbAgr vp.verb np.a True ++ vp.compl ! np.a
verbAgr vp.verb np.a Pos ++ vp.compl ! np.a
} ;
ImpersCl vp = let agr = Ag Neutr Sg P3 in {
subj = [] ;
clit = vp.clit ! agr ;
compl = vp.compl ! agr ;
verb = vp.verb ; clitPresent = vp.clitPresent ;
isDrop = True ;
a = agr
} ;
ImpersCl vp = let agr = Ag Neutr Sg P3 in
mkClause [] (vp.clit ! agr) (vp.compl ! agr) vp.verb agr True vp.clitPresent ;
GenericCl vp = let agr = Ag (Masc Anim) Pl P3 in {
subj = [] ;
clit = vp.clit ! agr ;
compl = vp.compl ! agr ;
verb = vp.verb ; clitPresent = vp.clitPresent ;
isDrop = True ;
a = agr
} ;
GenericCl vp = let agr = Ag (Masc Anim) Pl P3 in
mkClause [] (vp.clit ! agr) (vp.compl ! agr) vp.verb agr True vp.clitPresent ;
ExistNP np = {
clitPresent = False ;
subj, clit = [] ;
compl = np.s ! Nom ;
verb = iii_kupovatVerbForms "existovat" ;
isDrop = True ;
a = np.a
} ;
ExistNP np = mkClause [] [] (np.s ! Nom)
(iii_kupovatVerbForms "existovat") np.a True False ;
ExistNPAdv np adv =
let cl = ExistNP np in cl ** {compl = cl.compl ++ adv.s} ;
ProgrVP vp = vp ;
}
+2 -2
View File
@@ -2,8 +2,8 @@
concrete LangCze of Lang =
GrammarCze,
LexiconCze
-- ,ConstructionCze
LexiconCze,
ConstructionCze
-- ,DocumentationCze --# notpresent
,MarkupCze - [stringMark]
** {
-37
View File
@@ -1,50 +1,13 @@
resource MissingCze = open GrammarCze, Prelude in {
-- temporary definitions to enable the compilation of RGL API
oper AAnter : Ant = notYet "AAnter" ;
oper AdAdv : AdA -> Adv -> Adv = notYet "AdAdv" ;
oper AdNum : AdN -> Card -> Card = notYet "AdNum" ;
oper AdVVP : AdV -> VP -> VP = notYet "AdVVP" ;
oper AdnCAdv : CAdv -> AdN = notYet "AdnCAdv" ;
oper AdvSlash : ClSlash -> Adv -> ClSlash = notYet "AdvSlash" ;
oper CAdvAP : CAdv -> AP -> NP -> AP = notYet "CAdvAP" ;
oper CleftAdv : Adv -> S -> Cl = notYet "CleftAdv" ;
oper CleftNP : NP -> RS -> Cl = notYet "CleftNP" ;
oper ComparAdvAdj : CAdv -> A -> NP -> Adv = notYet "ComparAdvAdj" ;
oper ComparAdvAdjS : CAdv -> A -> S -> Adv = notYet "ComparAdvAdjS" ;
oper ComplN2 : N2 -> NP -> CN = notYet "ComplN2" ;
oper ComplN3 : N3 -> NP -> N2 = notYet "ComplN3" ;
oper ComplVA : VA -> AP -> VP = notYet "ComplVA" ;
oper DetNP : Det -> NP = notYet "DetNP" ;
oper ExistIP : IP -> QCl = notYet "ExistIP" ;
oper FunRP : Prep -> NP -> RP -> RP = notYet "FunRP" ;
oper OrdDigits : Digits -> Ord = notYet "OrdDigits" ;
oper OrdNumeral : Numeral -> Ord = notYet "OrdNumeral" ;
oper PPartNP : NP -> V2 -> NP = notYet "PPartNP" ;
oper PositAdvAdj : A -> Adv = notYet "PositAdvAdj" ;
oper PredSCVP : SC -> VP -> Cl = notYet "PredSCVP" ;
oper ProgrVP : VP -> VP = notYet "ProgrVP" ;
oper QuestSlash : IP -> ClSlash -> QCl = notYet "QuestSlash" ;
oper ReflA2 : A2 -> AP = notYet "ReflA2" ;
oper ReflVP : VPSlash -> VP = notYet "ReflVP" ;
oper RelCl : Cl -> RCl = notYet "RelCl" ;
oper RelNP : NP -> RS -> NP = notYet "RelNP" ;
oper RelSlash : RP -> ClSlash -> RCl = notYet "RelSlash" ;
oper SentAP : AP -> SC -> AP = notYet "SentAP" ;
oper SlashPrep : Cl -> Prep -> ClSlash = notYet "SlashPrep" ;
oper SlashV2A : V2A -> AP -> VPSlash = notYet "SlashV2A" ;
oper SlashV2Q : V2Q -> QS -> VPSlash = notYet "SlashV2Q" ;
oper SlashV2S : V2S -> S -> VPSlash = notYet "SlashV2S" ;
oper SlashV2V : V2V -> VP -> VPSlash = notYet "SlashV2V" ;
oper SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash = notYet "SlashV2VNP" ;
oper SlashVP : NP -> VPSlash -> ClSlash = notYet "SlashVP" ;
oper SlashVS : NP -> VS -> SSlash -> ClSlash = notYet "SlashVS" ;
oper SlashVV : VV -> VPSlash -> VPSlash = notYet "SlashVV" ;
oper TCond : Tense = notYet "TCond" ;
oper TFut : Tense = notYet "TFut" ;
oper TPast : Tense = notYet "TPast" ;
oper Use2N3 : N3 -> N2 = notYet "Use2N3" ;
oper UseN2 : N2 -> CN = notYet "UseN2" ;
oper UseSlash : Temp -> Pol -> ClSlash -> SSlash = notYet "UseSlash" ;
}
+41
View File
@@ -0,0 +1,41 @@
--# -path=.:../abstract:../common:../prelude
concrete NamesCze of Names = CatCze ** open ResCze, Prelude in {
lin
GivenName name =
npForms (\\_ => name.s) (\\_ => name.s) ** {
clit = \\_ => name.s ; a = Ag (Masc Anim) Sg P3 ; m = Mod (Masc Anim) Sg ;
hasClit = False ; isDrop = False ; isPron = False
} ;
MaleSurname name =
npForms (\\_ => name.s) (\\_ => name.s) ** {
clit = \\_ => name.s ; a = Ag (Masc Anim) Sg P3 ; m = Mod (Masc Anim) Sg ;
hasClit = False ; isDrop = False ; isPron = False
} ;
FemaleSurname name =
npForms (\\_ => name.s) (\\_ => name.s) ** {
clit = \\_ => name.s ; a = Ag Fem Sg P3 ; m = Mod Fem Sg ;
hasClit = False ; isDrop = False ; isPron = False
} ;
PlSurname name =
npForms (\\_ => name.s) (\\_ => name.s) ** {
clit = \\_ => name.s ; a = Ag (Masc Anim) Pl P3 ; m = Mod (Masc Anim) Pl ;
hasClit = False ; isDrop = False ; isPron = False
} ;
FullName name surname =
npForms (\\_ => name.s ++ surname.s) (\\_ => name.s ++ surname.s) ** {
clit = \\_ => name.s ++ surname.s ;
a = Ag (Masc Anim) Sg P3 ; m = Mod (Masc Anim) Sg ;
hasClit = False ; isDrop = False ; isPron = False
} ;
UseLN name =
npForms (\\_ => name.s) (\\_ => name.s) ** {
clit = \\_ => name.s ; a = Ag Neutr Sg P3 ; m = Mod Neutr Sg ;
hasClit = False ; isDrop = False ; isPron = False
} ;
PlainLN = UseLN ;
InLN name = {s = "v" ++ name.s} ;
AdjLN ap name = {s = ap.s ! Neutr ! Sg ! Nom ++ name.s} ;
}
+56 -2
View File
@@ -6,10 +6,11 @@ concrete NounCze of Noun =
lin
DetCN det cn =
let s : Case => Str = \\c => det.s ! nounGender cn (numSizeNumber det.size) ! c ++ numSizeForm cn.s det.size c
let s : Case => Str = \\c => det.s ! nounGender cn (numSizeNumber det.size) ! c ++ numSizeForm cn.s det.size c ;
agr = numeralAgr (nounGender cn (numSizeNumber det.size)) det P3
in npForms s s ** {
clit = s ;
a = numeralAgr (nounGender cn (numSizeNumber det.size)) det P3 ;
a = agr ;
m = numeralModAgr (nounGender cn (numSizeNumber det.size)) det ;
hasClit = False ; isDrop = False ; isPron = False ;
} ;
@@ -99,6 +100,59 @@ lin
UseN n = nounFormsNoun n ;
UseN2 n = nounFormsNoun n ;
ComplN2 n np =
let cn = nounFormsNoun n ;
obj = fullComplement n.c2 np.s np.prep
in cn ** {s = \\num,c => cn.s ! num ! c ++ obj} ;
PossNP cn np = cn ** {s = \\n,c => cn.s ! n ! c ++ np.s ! Gen} ;
PartNP cn np = cn ** {s = \\n,c => cn.s ! n ! c ++ np.s ! Gen} ;
DetNP det =
let forms : Case => Str = \\c => det.s ! Masc Inanim ! c ;
agr = numeralAgr (Masc Inanim) det P3 in
npForms forms forms ** {
clit = forms ; a = agr ;
m = numeralModAgr (Masc Inanim) det ;
hasClit = False ; isDrop = False ; isPron = False
} ;
AdNum ad num = num ** {s = \\g,c => ad.s ++ num.s ! g ! c} ;
DetDAP det = det ;
AdjDAP dap ap = dap ** {
s = \\g,c => dap.s ! g ! c ++ ap.s ! g ! numSizeNumber dap.size ! c
} ;
CountNP det np =
let forms : Case => Str = \\c => det.s ! Neutr ! c ++ np.s ! Gen ;
agr = numeralAgr Neutr det P3 in
npForms forms forms ** {
clit = forms ; a = agr ; m = Mod Neutr Pl ;
hasClit = False ; isDrop = False ; isPron = False
} ;
OrdNumeral num = {
s = \\g,n,c => num.s ! g ! c ;
pred = \\_ => num.s ! Neutr ! Nom ;
isPost = False
} ;
OrdDigits ds = {
s = \\_,_,_ => ds.s ++ SOFT_BIND ++ "." ;
pred = \\_ => ds.s ++ SOFT_BIND ++ "." ; isPost = False
} ;
ExtAdvNP np adv = AdvNP np adv ;
QuantityNP decimal unit =
let forms : Case => Str = \\_ => decimal.s ++ unit.s in
npForms forms forms ** {
clit = forms ; a = AgQuant Neutr ; m = Mod Neutr Pl ;
hasClit = False ; isDrop = False ; isPron = False
} ;
ApposCN cn np = {
s = \\n,c => cn.s ! n ! c ++ np.s ! c ; ---- TODO check apposition order
g = cn.g ; gPl = cn.gPl
+52 -2
View File
@@ -46,6 +46,8 @@ oper
= \nom,gen,g -> lin N (declensionNounForms nom gen g) ;
} ;
mkN2 : N -> Prep -> N2 = \n,c -> lin N2 (n ** {c2 = c}) ;
mkPN = overload {
-- Indeclinable name: every case uses the supplied string.
mkPN : Str -> Gender -> PN = \s,g -> lin PN {s = \\_ => s ; g = g} ;
@@ -133,7 +135,7 @@ oper
} ;
mkA2 : A -> Prep -> A2
= \a,p -> lin A2 (a ** {c = p}) ;
= \a,p -> lin A2 (a ** {c = p}) ;
-------------------------
-- Verbs
@@ -157,13 +159,14 @@ oper
pastpartsg = pastsg ; pastpartpl = pastpl ;
impsg2 = imp2sg ; imppl1 = imp1pl ; imppl2 = imp2pl
}) ;
mkV : Str -> V = \s -> lin V (mkVerb s) ;
} ;
-- Lexical reflexive clitics. The case-based interface accepts only Acc/Dat.
seV : V -> V = \v -> reflV v Acc ;
siV : V -> V = \v -> reflV v Dat ;
reflV : V -> Case -> V = \v,c -> v ** {
isRefl = True ; refl = case c of {Acc => "se" ; Dat => "si" ; _ => nonExist}
isRefl = True ; refl = case c of {Dat => "si" ; _ => "se"}
} ;
mkVS : V -> VS = \v -> lin VS v ;
@@ -196,6 +199,10 @@ oper
= \v,c -> lin V2 (v ** {c = {s = [] ; c = c ; hasPrep = False}}) ;
mkV2 : V -> Prep -> V2
= \v,p -> lin V2 (v ** {c = p}) ;
mkV2 : Str -> V2
= \s -> lin V2 ((mkVerb s) ** {
c = {s = [] ; c = Acc ; hasPrep = False}
}) ;
} ;
mkV3 = overload {
@@ -204,6 +211,11 @@ oper
c2 = {s = [] ; c = Dat ; hasPrep = False}}) ;
mkV3 : V -> Prep -> Prep -> V3
= \v,p,p2 -> lin V3 (v ** {c = p ; c2 = p2}) ;
mkV3 : Str -> V3
= \s -> lin V3 ((mkVerb s) ** {
c = {s = [] ; c = Acc ; hasPrep = False} ;
c2 = {s = [] ; c = Dat ; hasPrep = False}
}) ;
} ;
------------------------
@@ -230,5 +242,43 @@ oper
mkConj : Str -> Conj
= \s -> lin Conj {s1 = [] ; s2 = s} ;
------------------------
-- Generic lexical constructors
mkVerb : Str -> VerbForms = guessVerbForms ;
mkCard : Str -> Card = \s -> lin Card (invarDeterminer s Num5) ;
mkDet : Str -> Det = \s -> lin Det (invarDeterminer s Num5) ;
mkQuant : Str -> Quant = \s ->
lin Quant (adjFormsAdjective (mkA s)) ;
mkACard : Str -> ACard = \s -> lin ACard {s = s} ;
mkAdN : Str -> AdN = \s -> lin AdN {s = s} ;
mkAdV : Str -> AdV = \s -> lin AdV {s = s} ;
mkCAdv : Str -> CAdv = \s -> lin CAdv {s = s; p = []} ;
mkDConj : Str -> Conj = \s -> lin Conj {s1 = [] ; s2 = s} ;
mkGN : Str -> GN = \s -> lin GN {s = s} ;
mkIAdv : Str -> IAdv = \s -> lin IAdv {s = s} ;
mkIDet : Str -> IDet = \s -> lin IDet {s = \\_,_=>s; size=Num1; head=CountedHead} ;
mkIP : Str -> IP = \s -> lin IP {s = \\_=>s; a = Ag (Masc Anim) Sg P3} ;
mkIQuant : Str -> IQuant = \s -> lin IQuant {s = \\_,_,_=>s} ;
mkInterj : Str -> Interj = \s -> lin Interj {s = s} ;
mkLN : Str -> LN = \s -> lin LN {s = s} ;
mkMU : Str -> MU = \s -> lin MU {s = s; isPre=False} ;
mkPConj : Str -> PConj = \s -> lin PConj {s = s} ;
mkPredet : Str -> Predet = \s -> lin Predet {s = \\_,_,_=>s; postPron = False} ;
mkSN : Str -> SN = \s -> lin SN {s = s} ;
mkSubj : Str -> Subj = \s -> lin Subj {s = s} ;
mkVA : Str -> VA = \s -> lin VA (mkVerb s) ;
mkV2A : Str -> V2A = \s -> lin V2A ((mkVerb s) ** {
c = {s = [] ; c = Acc ; hasPrep = False}}) ;
mkV2Q : Str -> V2Q = \s -> lin V2Q ((mkVerb s) ** {
c = {s = [] ; c = Acc ; hasPrep = False}}) ;
mkV2S : Str -> V2S = \s -> lin V2S ((mkVerb s) ** {
c = {s = [] ; c = Acc ; hasPrep = False}}) ;
mkV2V : Str -> V2V = \s -> lin V2V ((mkVerb s) ** {
c = {s = [] ; c = Acc ; hasPrep = False}}) ;
mkVoc : Str -> {s : Str} = \s -> {s = s} ;
}
+12 -2
View File
@@ -4,11 +4,21 @@ lin
QuestIAdv adv cl = cl ** {q = adv.s ; yesNo = False} ;
QuestIComp comp np = {
q = comp.s ; subj = case np.isDrop of {True => np.clit ! Nom ; False => np.s ! Nom} ;
clit,compl = [] ; verb = copulaVerbForms ; a = np.a ; yesNo = False
clit,compl = [] ; verb = copulaVerbForms ; a = np.a ; yesNo = False ;
isDrop = np.isDrop ; clitPresent = False ;
finite = (mkClause [] [] [] copulaVerbForms np.a np.isDrop False).finite ;
auxiliary = (mkClause [] [] [] copulaVerbForms np.a np.isDrop False).auxiliary
} ;
QuestVP ip vp = {
q = ip.s ! Nom ; subj = [] ; clit = vp.clit ! ip.a ;
compl = vp.compl ! ip.a ; verb = vp.verb ; a = ip.a ; yesNo = False
compl = vp.compl ! ip.a ; verb = vp.verb ; a = ip.a ; yesNo = False ;
isDrop = True ; clitPresent = vp.clitPresent ;
finite = (mkClause [] [] [] vp.verb ip.a True vp.clitPresent).finite ;
auxiliary = (mkClause [] [] [] vp.verb ip.a True vp.clitPresent).auxiliary
} ;
QuestSlash ip cls = cls ** {
q = fullComplement cls.c ip.s ip.s ;
compl = cls.compl ++ cls.ind ; yesNo = False
} ;
CompIAdv adv = adv ;
CompIP ip = {s = ip.s ! Nom} ;
+20
View File
@@ -14,5 +14,25 @@ lin
IdRP = guessAdjForms "který" ;
RelCl cl = {
subj = \\_ => cl.subj ; clit = \\_ => cl.clit ;
compl = \\_ => cl.compl ; verb = cl.verb
} ;
RelSlash rp cls = {
subj = \\_ => cls.subj ; clit = \\_ => cls.clit ; verb = cls.verb ;
compl = \\a => case a of {
Ag g n _ => fullComplement cls.c
(\\c => (adjFormsAdjective rp).s ! g ! n ! c)
(\\c => (adjFormsAdjective rp).s ! g ! n ! c) ;
AgPol g => fullComplement cls.c
(\\c => (adjFormsAdjective rp).s ! g ! Sg ! c)
(\\c => (adjFormsAdjective rp).s ! g ! Sg ! c) ;
AgQuant g => fullComplement cls.c
(\\c => (adjFormsAdjective rp).s ! g ! Pl ! c)
(\\c => (adjFormsAdjective rp).s ! g ! Pl ! c)
} ++ cls.compl ++ cls.ind
} ;
}
+189 -23
View File
@@ -1,4 +1,4 @@
resource ResCze = open Prelude in {
resource ResCze = ParamX ** open Prelude in {
-- AR March 2020
-- sources:
@@ -8,22 +8,28 @@ resource ResCze = open Prelude in {
-- parameters
param
Number = Sg | Pl ;
Animacy = Anim | Inanim ;
Gender = Masc Animacy | Fem | Neutr ;
Case = Nom | Gen | Dat | Acc | Voc | Loc | Ins ; -- traditional order
Person = P1 | P2 | P3 ;
Agr = Ag Gender Number Person | AgPol Gender | AgQuant Gender ; -- polite singular: plural verb, singular predicate
CTense = CTPres | CTPast ; ----- TODO complete the tense system to match Czech verb morphology
oper
agrGender : Agr -> Gender = \a -> case a of {
Ag g _ _ => g ; AgPol g => g ; AgQuant g => g
} ;
agrNumber : Agr -> Number = \a -> case a of {
Ag _ n _ => n ; AgPol _ => Sg ; AgQuant _ => Pl
} ;
agrPerson : Agr -> Person = \a -> case a of {
Ag _ _ p => p ; _ => P3
} ;
-- phonology
oper
hardConsonant : pattern Str = #("d"|"t"|"g"|"h"|"k"|"n"|"r") ;
softConsonant : pattern Str = #("ť"|"ď"|"j"|"ň"|"ř"|"š"|"c"|"č"|"ž") ;
neutralConsonant : pattern Str = #("b"|"f"|"l"|"m"|"p"|"s"|"v") ;
@@ -669,7 +675,7 @@ adjFormsAdjective : AdjForms -> Adjective = \afs -> {
msdat = mlad + "ému" ;
fsacc,fsins = mlad + "ou" ;
msloc = mlad + "ém" ;
msins,pdat = mlad + "ým" ;
msins = mlad + "ým" ;
mpnom = addAdjI mlad ;
pgen = mlad + "ých" ;
pins = mlad + "ými" ;
@@ -729,7 +735,8 @@ adjFormsAdjective : AdjForms -> Adjective = \afs -> {
VerbForms : Type = PositiveVerbForms ** {
negpressg1,negpressg2,negpressg3,negprespl1,negprespl2,negprespl3,
negimpsg2,negimppl1,negimppl2,refl : Str ; isRefl : Bool
negimpsg2,negimppl1,negimppl2,
pastpartfsg,pastpartnsg,pastpartfpl,pastpartnpl,refl : Str ; isRefl : Bool
} ;
-- Prefix at lexical construction time, so ordinary spelling also parses.
@@ -739,7 +746,11 @@ adjFormsAdjective : AdjForms -> Adjective = \afs -> {
negpressg3 = "ne" + v.pressg3 ;
negprespl1 = "ne" + v.prespl1 ; negprespl2 = "ne" + v.prespl2 ;
negprespl3 = "ne" + v.prespl3 ;
negimpsg2 = "ne" + v.impsg2 ; negimppl1 = "ne" + v.imppl1 ; negimppl2 = "ne" + v.imppl2
negimpsg2 = "ne" + v.impsg2 ; negimppl1 = "ne" + v.imppl1 ; negimppl2 = "ne" + v.imppl2 ;
pastpartfsg = Predef.tk 1 v.pastpartsg + "la" ;
pastpartnsg = Predef.tk 1 v.pastpartsg + "lo" ;
pastpartfpl = Predef.tk 1 v.pastpartpl + "y" ;
pastpartnpl = Predef.tk 1 v.pastpartpl + "a"
} ;
-- Vocalization depends on the next realized token, not on the noun head.
@@ -801,22 +812,100 @@ adjFormsAdjective : AdjForms -> Adjective = \afs -> {
True => prep ! p.c ; False => bare ! p.c
} ;
verbAgr : VerbForms -> Agr -> Bool -> Str
= \vf,a,b -> case <a,b> of {
<Ag _ Sg P1,True> => vf.pressg1 ; <Ag _ Sg P1,False> => vf.negpressg1 ;
<Ag _ Sg P2,True> => vf.pressg2 ; <Ag _ Sg P2,False> => vf.negpressg2 ;
<Ag _ Sg P3 | AgQuant _,True> => vf.pressg3 ; <Ag _ Sg P3 | AgQuant _,False> => vf.negpressg3 ;
<Ag _ Pl P1,True> => vf.prespl1 ; <Ag _ Pl P1,False> => vf.negprespl1 ;
<Ag _ Pl P2 | AgPol _,True> => vf.prespl2 ; <Ag _ Pl P2 | AgPol _,False> => vf.negprespl2 ;
<Ag _ Pl P3,True> => vf.prespl3 ; <Ag _ Pl P3,False> => vf.negprespl3
verbAgr : VerbForms -> Agr -> Polarity -> Str
= \vf,a,b -> case a of {
Ag _ n p => case <n,p,b> of {
<Sg,P1,Pos> => vf.pressg1 ; <Sg,P1,Neg> => vf.negpressg1 ;
<Sg,P2,Pos> => vf.pressg2 ; <Sg,P2,Neg> => vf.negpressg2 ;
<Sg,P3,Pos> => vf.pressg3 ; <Sg,P3,Neg> => vf.negpressg3 ;
<Pl,P1,Pos> => vf.prespl1 ; <Pl,P1,Neg> => vf.negprespl1 ;
<Pl,P2,Pos> => vf.prespl2 ; <Pl,P2,Neg> => vf.negprespl2 ;
<Pl,P3,Pos> => vf.prespl3 ; <Pl,P3,Neg> => vf.negprespl3
} ;
AgPol _ => case b of {Pos => vf.prespl2 ; Neg => vf.negprespl2} ;
AgQuant _ => case b of {Pos => vf.pressg3 ; Neg => vf.negpressg3}
} ;
imperativeAgr : VerbForms -> Agr -> Bool -> Str = \v,a,pos -> case <a,pos> of {
<Ag _ Sg _,True> => v.impsg2 ; <Ag _ Sg _,False> => v.negimpsg2 ;
<Ag _ Pl P1,True> => v.imppl1 ; <Ag _ Pl P1,False> => v.negimppl1 ;
<_,True> => v.imppl2 ; <_,False> => v.negimppl2
imperativeAgr : VerbForms -> Agr -> Polarity -> Str = \v,a,pos -> case <a,pos> of {
<Ag _ Sg _,Pos> => v.impsg2 ; <Ag _ Sg _,Neg> => v.negimpsg2 ;
<Ag _ Pl P1,Pos> => v.imppl1 ; <Ag _ Pl P1,Neg> => v.negimppl1 ;
<_,Pos> => v.imppl2 ; <_,Neg> => v.negimppl2
} ;
pastPartAgr : VerbForms -> Agr -> Polarity -> Str = \v,a,pos ->
let form = case a of {
Ag g n _ => case <g,n> of {
<Masc _,Sg> => v.pastpartsg ; <Fem,Sg> => v.pastpartfsg ;
<Neutr,Sg> => v.pastpartnsg ; <Masc Anim,Pl> => v.pastpartpl ;
<Neutr,Pl> => v.pastpartnpl ; <_,Pl> => v.pastpartfpl
} ;
AgPol g => case g of {
Masc _ => v.pastpartsg ; Fem => v.pastpartfsg ; Neutr => v.pastpartnsg
} ;
AgQuant _ => v.pastpartfpl
}
in case pos of {Pos => form ; Neg => "ne" ++ BIND ++ form} ;
pastAux : Agr -> Str = \a -> case a of {
Ag _ n p => case <n,p> of {
<Sg,P1> => "jsem" ;
<Sg,P2> => "jsi" ;
<Pl,P1> => "jsme" ;
<Pl,P2> => "jste" ;
_ => []
} ;
AgPol _ => "jste" ;
AgQuant _ => []
} ;
conditionalAux : Agr -> Str = \a -> case a of {
Ag _ n p => case <n,p> of {
<Sg,P1> => "bych" ; <Sg,P2> => "bys" ; <Pl,P1> => "bychom" ;
<Pl,P2> => "byste" ; _ => "by"
} ; AgPol _ => "byste" ; AgQuant _ => "by"
} ;
futureAux : Agr -> Polarity -> Str = \a,pos ->
let form = case a of {
Ag _ n p => case <n,p> of {
<Sg,P1> => "budu" ; <Sg,P2> => "budeš" ; <Sg,P3> => "bude" ;
<Pl,P1> => "budeme" ; <Pl,P2> => "budete" ; <Pl,P3> => "budou"
} ;
AgQuant _ => "bude" ; AgPol _ => "budete"
}
in case pos of {Pos => form ; Neg => "ne" ++ BIND ++ form} ;
tenseVerb : Tense -> VerbForms -> Agr -> Polarity -> Str = \t,v,a,pos -> case t of {
Pres => verbAgr v a pos ;
Past => pastPartAgr v a pos ;
Fut => futureAux a pos ++ v.inf ;
Cond => pastPartAgr v a pos
} ;
tenseClitic : Tense -> Agr -> Str = \t,a -> case t of {
Past => pastAux a ; Cond => conditionalAux a ; _ => []
} ;
Clause : Type = {
subj,clit,compl : Str ; verb : VerbForms ; a : Agr ;
isDrop,clitPresent : Bool ;
finite : Tense => Polarity => Str ; auxiliary : Tense => Str
} ;
mkClause : Str -> Str -> Str -> VerbForms -> Agr -> Bool -> Bool -> Clause =
\subj,clit,compl,verb,a,isDrop,clitPresent -> {
subj = subj ; clit = clit ; compl = compl ; verb = verb ; a = a ;
isDrop = isDrop ; clitPresent = clitPresent ;
finite = table {
Pres => \\p => verbAgr verb a p ;
Past => \\p => pastPartAgr verb a p ;
Fut => \\p => tenseVerb Fut verb a p ;
Cond => \\p => pastPartAgr verb a p
} ;
auxiliary = table {
Pres => [] ; Past => pastAux a ; Fut => [] ; Cond => conditionalAux a
}
} ;
-- s is the ordinary order; fronted places the clitics first, ready for
-- an external host. clit/body retain the pieces needed by further fronting.
@@ -904,6 +993,83 @@ adjFormsAdjective : AdjForms -> Adjective = \afs -> {
pastpartpl = kry + "li" ;
} ;
-- Productive defaults for lexicons that only provide an infinitive. Czech
-- has many stem alternations, so irregular verbs should still use the full
-- principal-parts constructor; these classes cover the regular majority.
atVerbForms : Str -> VerbForms = \inf ->
let stem = Predef.tk 2 inf in withNeg {
inf = inf ;
pressg1 = stem + "ám" ; pressg2 = stem + "áš" ; pressg3 = stem + "á" ;
prespl1 = stem + "áme" ; prespl2 = stem + "áte" ; prespl3 = stem + "ají" ;
pastpartsg = stem + "al" ; pastpartpl = stem + "ali" ;
impsg2 = stem + "ej" ; imppl1 = stem + "ejme" ; imppl2 = stem + "ejte"
} ;
itVerbForms : Str -> VerbForms = \inf ->
let stem = Predef.tk 2 inf in withNeg {
inf = inf ;
pressg1 = stem + "ím" ; pressg2 = stem + "íš" ; pressg3 = stem + "í" ;
prespl1 = stem + "íme" ; prespl2 = stem + "íte" ; prespl3 = stem + "í" ;
pastpartsg = stem + "il" ; pastpartpl = stem + "ili" ;
impsg2 = stem ; imppl1 = stem + "me" ; imppl2 = stem + "te"
} ;
etVerbForms : Str -> Str -> VerbForms = \inf,pastVowel ->
let stem = Predef.tk 2 inf in withNeg {
inf = inf ;
pressg1 = stem + "ím" ; pressg2 = stem + "íš" ; pressg3 = stem + "í" ;
prespl1 = stem + "íme" ; prespl2 = stem + "íte" ; prespl3 = stem + "í" ;
pastpartsg = stem + pastVowel + "l" ; pastpartpl = stem + pastVowel + "li" ;
impsg2 = stem ; imppl1 = stem + "me" ; imppl2 = stem + "te"
} ;
noutVerbForms : Str -> VerbForms = \inf ->
let stem = Predef.tk 4 inf in withNeg {
inf = inf ;
pressg1 = stem + "nu" ; pressg2 = stem + "neš" ; pressg3 = stem + "ne" ;
prespl1 = stem + "neme" ; prespl2 = stem + "nete" ; prespl3 = stem + "nou" ;
pastpartsg = stem + "nul" ; pastpartpl = stem + "nuli" ;
impsg2 = stem + "ni" ; imppl1 = stem + "něme" ; imppl2 = stem + "něte"
} ;
nestVerbForms : Str -> VerbForms = \inf ->
let prefix = Predef.tk 4 inf ; stem = prefix + "nes" in withNeg {
inf = inf ;
pressg1 = stem + "u" ; pressg2 = stem + "eš" ; pressg3 = stem + "e" ;
prespl1 = stem + "eme" ; prespl2 = stem + "ete" ; prespl3 = stem + "ou" ;
pastpartsg = stem + "l" ; pastpartpl = stem + "li" ;
impsg2 = stem ; imppl1 = stem + "me" ; imppl2 = stem + "te"
} ;
jistVerbForms : VerbForms = withNeg {
inf = "jíst" ;
pressg1 = "jím" ; pressg2 = "jíš" ; pressg3 = "jí" ;
prespl1 = "jíme" ; prespl2 = "jíte" ; prespl3 = "jedí" ;
pastpartsg = "jedl" ; pastpartpl = "jedli" ;
impsg2 = "jez" ; imppl1 = "jezme" ; imppl2 = "jezte"
} ;
guessVerbForms : Str -> VerbForms = \inf -> case inf of {
"být" => copulaVerbForms ;
"mít" => haveVerbForms ;
"jíst" => jistVerbForms ;
_ + "ovat" => iii_kupovatVerbForms inf ;
_ + ("ýt" | "ít") => iii_krýtVerbForms inf ;
_ + "nout" => noutVerbForms inf ;
_ + "nést" => nestVerbForms inf ;
_ + "at" => atVerbForms inf ;
_ + "it" => itVerbForms inf ;
_ + "ět" => etVerbForms inf "ě" ;
_ + "et" => etVerbForms inf "e" ;
_ => let stem = Predef.tk 1 inf in withNeg {
inf = inf ;
pressg1 = stem + "u" ; pressg2 = stem + "eš" ; pressg3 = stem + "e" ;
prespl1 = stem + "eme" ; prespl2 = stem + "ete" ; prespl3 = stem + "ou" ;
pastpartsg = stem + "l" ; pastpartpl = stem + "li" ;
impsg2 = stem ; imppl1 = stem + "me" ; imppl2 = stem + "te"
}
} ;
---------------------------
-- Pronouns
+57 -12
View File
@@ -4,34 +4,79 @@ lin
-- A dropped subject still contributes an empty constituent, so PGF
-- retains the pronoun and constrains its person through agreement.
subj = case np.isDrop of {True => np.clit ! Nom ; False => np.s ! Nom} ;
verb = vp.verb ; clit = vp.clit ! np.a ; compl = vp.compl ! np.a ;
a = np.a ; isDrop = np.isDrop ; clitPresent = vp.clitPresent
clit = vp.clit ! np.a ; compl = vp.compl ! np.a ; verb = vp.verb ;
a = np.a ; isDrop = np.isDrop ; clitPresent = vp.clitPresent ;
finite = table {
Pres => \\p => verbAgr vp.verb np.a p ;
Past => \\p => pastPartAgr vp.verb np.a p ;
Fut => \\p => tenseVerb Fut vp.verb np.a p ;
Cond => \\p => pastPartAgr vp.verb np.a p
} ;
auxiliary = table {
Pres => [] ; Past => pastAux np.a ; Fut => [] ; Cond => conditionalAux np.a
}
} ;
UseCl temp pol cl = let v = pol.s ++ verbAgr cl.verb cl.a pol.p in
SlashVP np vp = {
subj = case np.isDrop of {True => np.clit ! Nom ; False => np.s ! Nom} ;
clit = vp.clit ! np.a ++ vp.clitAfter ! np.a ;
compl = vp.compl ! np.a ; ind = vp.ind ! np.a ; verb = vp.verb ; c = vp.c ;
a = np.a ; isDrop = np.isDrop ; clitPresent = vp.clitPresent ;
finite = table {
Pres => \\p => verbAgr vp.verb np.a p ;
Past => \\p => pastPartAgr vp.verb np.a p ;
Fut => \\p => tenseVerb Fut vp.verb np.a p ;
Cond => \\p => pastPartAgr vp.verb np.a p
} ;
auxiliary = table {Pres => [] ; Past => pastAux np.a ; Fut => [] ; Cond => conditionalAux np.a}
} ;
UseSlash temp pol cl = {
s = temp.s ++ cl.subj ++ cl.auxiliary ! temp.t ++ cl.clit ++
pol.s ++ cl.finite ! temp.t ! pol.p ++ cl.compl ++ cl.ind ; c = cl.c
} ;
AdvSlash cl adv = cl ** {compl = cl.compl ++ adv.s} ;
SlashPrep cl prep = cl ** {c = prep ; ind = []} ;
SlashVS np vs ssl =
let base = PredVP np {
verb = vs ; clitPresent = False ; clit = \\_ => vs.refl ;
compl = \\_ => SOFT_BIND ++ "," ++ ssl.s
}
in base ** {c = ssl.c ; ind = []} ;
UseCl temp pol cl = let v = pol.s ++ cl.finite ! temp.t ! pol.p ;
cs = cl.auxiliary ! temp.t ++ cl.clit in
case cl.isDrop of {
True => sentence cl.clitPresent (temp.s ++ cl.subj ++ v) cl.clit cl.compl ;
False => sentence cl.clitPresent (temp.s ++ cl.subj) cl.clit (v ++ cl.compl)
True => sentence True (temp.s ++ cl.subj ++ v) cs cl.compl ;
False => sentence True (temp.s ++ cl.subj) cs (v ++ cl.compl)
} ;
UseQCl temp pol cl = let v = pol.s ++ verbAgr cl.verb cl.a pol.p in {
UseQCl temp pol cl = let v = pol.s ++ cl.finite ! temp.t ! pol.p ;
cs = cl.auxiliary ! temp.t ++ cl.clit in {
s = temp.s ++ case cl.yesNo of {
True => v ++ cl.clit ++ cl.subj ++ cl.compl ;
False => cl.q ++ cl.clit ++ v ++ cl.subj ++ cl.compl
True => v ++ cs ++ cl.subj ++ cl.compl ;
False => cl.q ++ cs ++ v ++ cl.subj ++ cl.compl
} ;
ind = temp.s ++ case cl.yesNo of {
True => "jestli" ++ cl.clit ++ cl.subj ++ v ++ cl.compl ;
False => cl.q ++ cl.clit ++ v ++ cl.subj ++ cl.compl
True => "jestli" ++ cs ++ cl.subj ++ v ++ cl.compl ;
False => cl.q ++ cs ++ v ++ cl.subj ++ cl.compl
}
} ;
UseRCl temp pol rcl = {
s = \\a => temp.s ++ rcl.subj ! a ++ rcl.clit ! a ++
pol.s ++ verbAgr rcl.verb a pol.p ++ rcl.compl ! a
s = \\a => temp.s ++ rcl.subj ! a ++ tenseClitic temp.t a ++ rcl.clit ! a ++
pol.s ++ tenseVerb temp.t rcl.verb a pol.p ++ rcl.compl ! a
} ;
ImpVP vp = {s = \\pos,a =>
imperativeAgr vp.verb a pos ++ vp.clit ! a ++ vp.compl ! a
} ;
AdvImp adv imp = {s = \\pos,a => adv.s ++ imp.s ! pos ! a} ;
PredSCVP sc vp = PredVP
(npForms (\\_ => sc.s) (\\_ => sc.s) ** {
clit = \\_ => sc.s ; a = Ag Neutr Sg P3 ; m = Mod Neutr Sg ;
hasClit = False ; isDrop = False ; isPron = False}) vp ;
EmbedS s = {s = (frontSentence "že" s).s} ;
EmbedQS qs = {s = qs.ind} ;
EmbedVP vp = let agr = Ag Neutr Sg P3 in
+3 -2
View File
@@ -35,10 +35,11 @@ lin
-- as DetCN in NounCze, with the symbols in apposition
CNSymbNP det cn xs =
let s : Case => Str = \\c => det.s ! nounGender cn (numSizeNumber det.size) ! c ++ numSizeForm cn.s det.size c ++ xs.s
let s : Case => Str = \\c => det.s ! nounGender cn (numSizeNumber det.size) ! c ++ numSizeForm cn.s det.size c ++ xs.s ;
agr = numeralAgr (nounGender cn (numSizeNumber det.size)) det P3
in npForms s s ** {
clit = s ;
a = numeralAgr (nounGender cn (numSizeNumber det.size)) det P3 ;
a = agr ;
m = numeralModAgr (nounGender cn (numSizeNumber det.size)) det ;
hasClit = False ; isDrop = False ; isPron = False ;
} ;
-20
View File
@@ -1,20 +0,0 @@
concrete TenseCze of Tense =
CatCze **
open
ResCze,
Prelude
in {
lin
PNeg = {
s = [] ;
p = False
} ;
PPos = {
s = [] ;
p = True
} ;
ASimul = {s = [] ; t = CTPres} ;
TPres = {s = [] ; t = CTPres} ;
TTAnt t a = {s = t.s ++ a.s ; t = t.t} ; ----
}
+77 -7
View File
@@ -2,7 +2,7 @@ concrete VerbCze of Verb = CatCze ** open ResCze, Prelude in {
lin
UseV v = {
verb = v ; clitPresent = v.isRefl ;
verb = v ; clitPresent = False ;
clit = \\_ => v.refl ; compl = \\_ => []
} ;
@@ -19,7 +19,7 @@ lin
} ;
SlashV2a v = {
verb = v ; clitPresent = v.isRefl ;
verb = v ; clitPresent = False ;
clit = \\_ => v.refl ; compl = \\_ => [] ;
c = v.c ;
ind = \\_ => [] ; clitAfter = \\_ => []
@@ -31,7 +31,7 @@ lin
weak = case isClit of {True => np.clit ! v.c.c ; False => []} ;
before = cliticBefore v.c.c v.c2.c
in {
verb = v ; clitPresent = orB v.isRefl isClit ;
verb = v ; clitPresent = isClit ;
clit = \\_ => v.refl ++ case before of {True => weak ; False => []} ;
clitAfter = \\_ => case before of {True => [] ; False => weak} ;
compl = \\_ => case isClit of {True => [] ; False => fullComplement v.c np.s np.prep} ;
@@ -43,7 +43,7 @@ lin
weak = case isClit of {True => np.clit ! v.c2.c ; False => []} ;
before = cliticBefore v.c.c v.c2.c
in {
verb = v ; clitPresent = orB v.isRefl isClit ;
verb = v ; clitPresent = isClit ;
clit = \\_ => v.refl ++ case before of {True => [] ; False => weak} ;
clitAfter = \\_ => case before of {True => weak ; False => []} ;
compl = \\_ => [] ;
@@ -80,6 +80,76 @@ lin
compl = \\a => vp.compl ! a ++ adv.s
} ;
ExtAdvVP vp adv = AdvVP vp adv ;
AdVVP adv vp = vp ** {compl = \\a => adv.s ++ vp.compl ! a} ;
AdvVPSlash vp adv = vp ** {compl = \\a => vp.compl ! a ++ adv.s} ;
AdVVPSlash adv vp = vp ** {compl = \\a => adv.s ++ vp.compl ! a} ;
UseCopula = {
verb = copulaVerbForms ; clitPresent = False ;
clit,compl = \\_ => []
} ;
ComplVA va ap = {
verb = va ; clitPresent = False ; clit = \\_ => va.refl ;
compl = ap.pred
} ;
ReflVP vp = {
verb = vp.verb ; clitPresent = True ;
clit = \\a => vp.clit ! a ++ "se" ++ vp.clitAfter ! a ;
compl = \\a => vp.compl ! a ++ vp.ind ! a
} ;
VPSlashPrep vp prep = vp ** {
c = prep ; ind = \\_ => [] ; clitAfter = \\_ => []
} ;
SlashV2A v ap = {
verb = v ; clitPresent = False ; clit = \\_ => v.refl ;
clitAfter = \\_ => [] ; c = v.c ; ind = \\a => ap.pred ! a ;
compl = \\_ => []
} ;
SlashV2S v sent = {
verb = v ; clitPresent = False ; clit = \\_ => v.refl ;
clitAfter = \\_ => [] ; c = v.c ; ind = \\_ => SOFT_BIND ++ "," ++ sent.s ;
compl = \\_ => []
} ;
SlashV2Q v sent = {
verb = v ; clitPresent = False ; clit = \\_ => v.refl ;
clitAfter = \\_ => [] ; c = v.c ; ind = \\_ => SOFT_BIND ++ "," ++ sent.ind ;
compl = \\_ => []
} ;
SlashV2V v vp = {
verb = v ; clitPresent = False ; clit = \\_ => v.refl ;
clitAfter = \\_ => [] ; c = v.c ;
compl = \\_ => [] ;
ind = \\a => vp.verb.inf ++ vp.clit ! a ++ vp.compl ! a
} ;
SlashVV vv vp = {
verb = vv ; clitPresent = andB vv.isAux vp.clitPresent ;
clit = \\a => vv.refl ++ case vv.isAux of {True => vp.clit ! a ; False => []} ;
clitAfter = vp.clitAfter ; c = vp.c ;
compl = \\a => vp.verb.inf ++ case vv.isAux of {True => [] ; False => vp.clit ! a} ++ vp.compl ! a ;
ind = vp.ind
} ;
SlashV2VNP v np vp = {
verb = v ; clitPresent = np.hasClit ;
clit = \\a => v.refl ++ case hasCliticComplement v.c np.hasClit of {
True => np.clit ! v.c.c ; False => []} ;
clitAfter = vp.clitAfter ; c = vp.c ;
compl = \\a => case hasCliticComplement v.c np.hasClit of {
True => [] ; False => fullComplement v.c np.s np.prep} ++
vp.verb.inf ++ vp.clit ! a ++ vp.compl ! a ;
ind = vp.ind
} ;
-- VerbForms has no passive participle yet, so the reflexive passive is used:
-- "číslo se dělí" = "the number is divided"
PassV2 v = {
@@ -89,19 +159,19 @@ lin
} ;
ComplVV vv vp = {
verb = vv ; clitPresent = orB vv.isRefl (andB vv.isAux vp.clitPresent) ;
verb = vv ; clitPresent = andB vv.isAux vp.clitPresent ;
clit = \\a => vv.refl ++ case vv.isAux of {True => vp.clit ! a ; False => []} ;
compl = \\a => vp.verb.inf ++ case vv.isAux of {True => [] ; False => vp.clit ! a} ++ vp.compl ! a
} ;
ComplVS vs s = {
verb = vs ; clitPresent = vs.isRefl ;
verb = vs ; clitPresent = False ;
clit = \\_ => vs.refl ;
compl = \\_ => SOFT_BIND ++ "," ++ (frontSentence "že" s).s
} ;
ComplVQ v q = {
verb = v ; clitPresent = v.isRefl ; clit = \\_ => v.refl ;
verb = v ; clitPresent = False ; clit = \\_ => v.refl ;
compl = \\_ => SOFT_BIND ++ "," ++ q.ind
} ;
}