Extensions by Codex

This commit is contained in:
Krasimir Angelov
2026-10-03 17:44:07 +02:00
parent 4ce6d21291
commit caaa5ab871
16 changed files with 387 additions and 20 deletions
+5 -1
View File
@@ -15,7 +15,7 @@ concrete CatLat of Cat = CommonX-[Adv] ** open ResLat, Prelude in {
---- Sentence ---- Sentence
-- --
Cl = Clause ; Cl = Clause ;
ClSlash = Clause ; ClSlash = Clause ** {c2 : Preposition} ;
Imp = {s : Polarity => VImpForm => Str} ; Imp = {s : Polarity => VImpForm => Str} ;
-- --
---- Question ---- Question
@@ -57,7 +57,10 @@ concrete CatLat of Cat = CommonX-[Adv] ** open ResLat, Prelude in {
Ord = { s : Gender => Number => Case => Str } ; Ord = { s : Gender => Number => Case => Str } ;
Num = {s : Gender => Case => Str ; n : Number} ; Num = {s : Gender => Case => Str ; n : Number} ;
Card = {s : Gender => Case => Str ; n : Number} ; Card = {s : Gender => Case => Str ; n : Number} ;
ACard = {s : Str} ;
Quant = Quantifier ; Quant = Quantifier ;
DAP = Determiner ;
SSlash = Sentence ** {c2 : Preposition} ;
-- --
---- Numeral ---- Numeral
-- --
@@ -91,6 +94,7 @@ concrete CatLat of Cat = CommonX-[Adv] ** open ResLat, Prelude in {
A2 = Adjective ** { c : Prep} ; A2 = Adjective ** { c : Prep} ;
linref linref
Cl = \cl -> defaultSentence (combineClause "" cl Pres Simul Pos VQFalse) ! SOV ;
NP = \np -> combineNounPhrase np ! PronNonDrop ! APreN ! DPostN ! Nom ; NP = \np -> combineNounPhrase np ! PronNonDrop ! APreN ! DPostN ! Nom ;
VP = \vp -> vp.adv ++ vp.inf ! VInfActPres ++ vp.obj ++ vp.compl ! Ag Masc Sg Nom ; VP = \vp -> vp.adv ++ vp.inf ! VInfActPres ++ vp.obj ++ vp.compl ! Ag Masc Sg Nom ;
S = \s -> defaultSentence s ! SOV ; S = \s -> defaultSentence s ! SOV ;
+27 -5
View File
@@ -23,8 +23,8 @@ concrete ConjunctionLat of Conjunction =
det = { s, sp = \\_ => [] } ; det = { s, sp = \\_ => [] } ;
} ; } ;
-- ConjAdv : Conj -> ListAdv -> Adv ; -- here or there ConjAdv conj xs = mkAdverb (conj.s1 ++ (xs.s ! conj.c).init ++
-- ConjAdv conj ss = mkAdv (conjunctDistrSS conj (ss.l ! conj.c) ).s ; conj.s2 ++ (xs.s ! conj.c).last ++ conj.s3) ;
-- ConjNP : Conj -> ListNP -> NP ; -- she or we -- ConjNP : Conj -> ListNP -> NP ; -- she or we
ConjNP conj nps = ConjNP conj nps =
@@ -45,8 +45,15 @@ concrete ConjunctionLat of Conjunction =
det = { s , sp = \\_ => ""} ; det = { s , sp = \\_ => ""} ;
} ; } ;
-- ConjAP : Conj -> ListAP -> AP ; ConjAP conj xs = {s = \\a => conj.s1 ++ (xs.s ! conj.c).init ! a ++
-- ConjAP conj ss = conjunctDistrTable Agr conj (ss.l ! conj.c) ; conj.s2 ++ (xs.s ! conj.c).last ! a ++ conj.s3} ;
ConjCN conj xs = {
s = \\n,c => conj.s1 ++ (xs.s ! conj.c).init.s ! n ! c ++
conj.s2 ++ (xs.s ! conj.c).last.s ! n ! c ++ conj.s3 ;
g = (xs.s ! conj.c).last.g ;
preap, postap = {s = \\_ => ""} ; adv = ""
} ;
-- --
-- DConjS = conjunctDistrSS ; -- DConjS = conjunctDistrSS ;
@@ -85,11 +92,25 @@ concrete ConjunctionLat of Conjunction =
} ; } ;
-- BaseAdv : Adv -> Adv -> ListAdv -- BaseAdv : Adv -> Adv -> ListAdv
BaseAdv x y = BaseAdv x y =
{ {
s = \\_ => { init = x.s ! Posit ; last = y.s ! Posit } s = \\_ => { init = x.s ! Posit ; last = y.s ! Posit }
} ; } ;
BaseAP x y = {s = \\_ => {init = x.s ; last = y.s}} ;
ConsAP x xs = {s = \\c => {
init = \\a => coord c {init = (xs.s ! c).init ! a; last = (xs.s ! c).last ! a};
last = x.s
}} ;
BaseCN x y = {s = \\_ => {init = x; last = y}} ;
ConsCN x xs = {s = \\c => {
init = {
s = \\n,k => coord c {init = (xs.s ! c).init.s ! n ! k; last = (xs.s ! c).last.s ! n ! k};
g = (xs.s ! c).last.g; preap,postap={s=\\_=>""}; adv=""};
last = x
}} ;
-- ConsAdv : Adv -> ListAdv -> ListAdv -- ConsAdv : Adv -> ListAdv -> ListAdv
ConsAdv x xs = ConsAdv x xs =
{ {
@@ -137,6 +158,7 @@ concrete ConjunctionLat of Conjunction =
[Adv] = { s: Coordinator => {init,last : Str}} ; [Adv] = { s: Coordinator => {init,last : Str}} ;
[NP] = { s : Coordinator => {init,last : PronDropForm => AdvPos => DetPos => Case => Str} ; g : Gender ; n : Number ; p : Person ; isBase : Bool } ; [NP] = { s : Coordinator => {init,last : PronDropForm => AdvPos => DetPos => Case => Str} ; g : Gender ; n : Number ; p : Person ; isBase : Bool } ;
[AP] = {s : Coordinator => {init,last : Agr => Str } } ; [AP] = {s : Coordinator => {init,last : Agr => Str } } ;
[CN] = {s : Coordinator => {init,last : CommonNoun} } ;
[RS] = { s : Coordinator => { init, last : Gender => Number => Str }} ; [RS] = { s : Coordinator => { init, last : Gender => Number => Str }} ;
oper oper
-- Generates a new number value given two number values. -- Generates a new number value given two number values.
+40 -1
View File
@@ -2,4 +2,43 @@
concrete ConstructionLat of Construction = CatLat ** concrete ConstructionLat of Construction = CatLat **
open SyntaxLat, SymbolicLat, ParadigmsLat, open SyntaxLat, SymbolicLat, ParadigmsLat,
(L = LexiconLat), (E = ExtraLat), (G = GrammarLat), (I = IrregLat), (R = ResLat), (N = NounLat), Prelude in { (L = LexiconLat), (E = ExtraLat), (G = GrammarLat), (I = IrregLat), (R = ResLat), (N = NounLat), Prelude in {
}
lincat Timeunit, Hour, Weekday, Month, Monthday, Year, Language = {s : Str} ;
lin
ready_VP = R.insertAdj ((mkA "paratus").s ! R.Posit) (R.predV R.esseAux) ;
has_age_VP card = (R.predV R.esseAux) ** {
compl = \\a => card.s ! R.Masc ! R.Acc ++ "annos" ++ case a of {
R.Ag R.Masc _ _ => "natus"; R.Ag R.Fem _ _ => "nata"; _ => "natum"}
} ;
n_units_AP card unit adj = {s = \\a => card.s ! R.Masc ! R.Acc ++ unit.s ! R.Pl ! R.Acc ++ adj.s ! R.Posit ! a} ;
n_units_of_NP card unit np = R.dummyNP (card.s ! R.Masc ! R.Nom ++ unit.s ! R.Pl ! R.Nom ++
R.combineNounPhrase np ! R.PronNonDrop ! R.APostN ! R.DPreN ! R.Gen) ** {n=R.Pl} ;
cup_of_CN np = G.PossNP (G.UseN (mkN "poculum")) np ;
monday_Weekday = ss "dies Lunae";
tuesday_Weekday = ss "dies Martis";
wednesday_Weekday = ss "dies Mercurii";
thursday_Weekday = ss "dies Iovis";
friday_Weekday = ss "dies Veneris";
saturday_Weekday = ss "dies Saturni";
sunday_Weekday = ss "dies Solis";
january_Month = ss "Ianuarius";
february_Month = ss "Februarius";
march_Month = ss "Martius";
april_Month = ss "Aprilis";
may_Month = ss "Maius";
june_Month = ss "Iunius";
july_Month = ss "Iulius";
august_Month = ss "Augustus";
september_Month = ss "September";
october_Month = ss "October";
november_Month = ss "November";
december_Month = ss "December";
weekdayPunctualAdv d = mkAdv ("die" ++ d.s) ;
weekdayHabitualAdv d = mkAdv (d.s) ;
weekdayN d = constN d.s R.Masc ;
monthN m = constN m.s R.Masc ;
intYear i = i ;
yearAdv y = mkAdv ("anno" ++ y.s) ;
}
+131 -1
View File
@@ -13,11 +13,82 @@
-- (c) Aarne Ranta 2017-08-20 under LGPL and BSD -- (c) Aarne Ranta 2017-08-20 under LGPL and BSD
concrete ExtendLat of Extend = CatLat ** open ResLat in { concrete ExtendLat of Extend = CatLat ** open ResLat, Prelude in {
lincat
VPS = {s : Gender => Number => Person => Str} ;
[VPS] = {s : Coordinator => {init,last : Gender => Number => Person => Str}} ;
VPI = {s : Agr => Str} ;
[VPI] = {s : Coordinator => {init,last : Agr => Str}} ;
[Imp] = {s : Coordinator => {init,last : Polarity => VImpForm => Str}} ;
[Comp] = {s : Coordinator => {init,last : Agr => Str}} ;
RNP = {s : Agr => Case => Str} ;
RNPList = {s : Agr => Case => Str} ;
oper
reflPron : Case => Str = table {
Nom | Voc => ""; Acc | Abl => "se"; Gen => "sui"; Dat => "sibi"
} ;
lin lin
-- GenNP : NP -> Quant ; -- this man's -- GenNP : NP -> Quant ; -- this man's
GenNP np = { s = \\_ => combineNounPhrase np ! PronNonDrop ! APostN ! DPreN ! Gen ; sp = \\_ => ""} ; GenNP np = { s = \\_ => combineNounPhrase np ! PronNonDrop ! APostN ! DPreN ! Gen ; sp = \\_ => ""} ;
GenModNP num np cn = {
s = \\_,c => cn.s ! num.n ! c ++ combineNounPhrase np ! PronNonDrop ! APostN ! DPreN ! Gen ;
n = num.n; g = cn.g; p = P3; adv = cn.adv;
preap = cn.preap; postap = cn.postap;
det = {s,sp = \\_ => ""; n = num.n}
} ;
UseDAP dap = {
s = \\_,c => dap.s ! Neutr ! c; n=dap.n; g=Neutr; p=P3; adv="";
preap,postap={s=\\_=>""}; det={s,sp=\\_=>"";n=dap.n}
} ;
UseDAPMasc dap = {
s = \\_,c => dap.s ! Masc ! c; n=dap.n; g=Masc; p=P3; adv="";
preap,postap={s=\\_=>""}; det={s,sp=\\_=>"";n=dap.n}
} ;
UseDAPFem dap = {
s = \\_,c => dap.s ! Fem ! c; n=dap.n; g=Fem; p=P3; adv="";
preap,postap={s=\\_=>""}; det={s,sp=\\_=>"";n=dap.n}
} ;
EmptyRelSlash slash = {s = \\_,_ => slash} ;
MkVPS t pol vp = {s = \\g,n,p =>
vp.adv ++ vp.obj ++ pol.s ++ vp.compl ! Ag g n Nom ++ t.s ++
vp.s ! VAct (anteriorityToVAnter t.a) (tenseToVTense t.t) n p ! VQFalse} ;
BaseVPS x y = {s = \\_ => {init=x.s; last=y.s}} ;
ConsVPS x xs = {s = \\c => {
init = \\g,n,p => (xs.s ! c).init ! g ! n ! p ++ bindComma ++ (xs.s ! c).last ! g ! n ! p;
last = x.s}} ;
ConjVPS conj xs = {s = \\g,n,p => conj.s1 ++
(xs.s ! conj.c).init ! g ! n ! p ++ conj.s2 ++
(xs.s ! conj.c).last ! g ! n ! p ++ conj.s3} ;
PredVPS np vps = (combineClause "" (mkClause np emptyVP) Pres Simul Pos VQFalse) ** {
v = \\_ => vps.s ! np.g ! np.n ! np.p
} ;
MkVPI vp = {s = \\a => vp.adv ++ vp.obj ++ vp.compl ! a ++ vp.inf ! VInfActPres} ;
BaseVPI x y = {s = \\_ => {init=x.s; last=y.s}} ;
ConsVPI x xs = {s = \\c => {
init = \\a => (xs.s ! c).init ! a ++ bindComma ++ (xs.s ! c).last ! a;
last = x.s}} ;
ConjVPI conj xs = {s = \\a => conj.s1 ++
(xs.s ! conj.c).init ! a ++ conj.s2 ++
(xs.s ! conj.c).last ! a ++ conj.s3} ;
ComplVPIVV vv vpi = (predV vv) ** {compl = vpi.s} ;
BaseImp x y = {s=\\_=>{init=x.s;last=y.s}} ;
ConsImp x xs = {s=\\c=>{init=\\p,f=>(xs.s!c).init!p!f++bindComma++(xs.s!c).last!p!f;last=x.s}} ;
ConjImp conj xs = {s=\\p,f=>conj.s1++(xs.s!conj.c).init!p!f++conj.s2++(xs.s!conj.c).last!p!f++conj.s3} ;
BaseComp x y = {s = \\_ => {init = x.s; last = y.s}} ;
ConsComp x xs = {s = \\c => {
init = \\a => (xs.s ! c).init ! a ++ bindComma ++ (xs.s ! c).last ! a;
last = x.s}} ;
ConjComp conj xs = {s = \\a => conj.s1 ++
(xs.s ! conj.c).init ! a ++ conj.s2 ++
(xs.s ! conj.c).last ! a ++ conj.s3} ;
-- GenIP : IP -> IQuant ; -- whose -- GenIP : IP -> IQuant ; -- whose
-- GenRP : Num -> CN -> RP ; -- whose car -- GenRP : Num -> CN -> RP ; -- whose car
@@ -92,6 +163,9 @@ concrete ExtendLat of Extend = CatLat ** open ResLat in {
-- PastPartAP : VPSlash -> AP ; -- lost (opportunity) ; (opportunity) lost in space -- PastPartAP : VPSlash -> AP ; -- lost (opportunity) ; (opportunity) lost in space
PastPartAP vp = { s = \\ag => vp.part ! VPassPerf ! ag ++ vp.adv ++ vp.c.s} ; -- TODO PastPartAP vp = { s = \\ag => vp.part ! VPassPerf ! ag ++ vp.adv ++ vp.c.s} ; -- TODO
PastPartAgentAP vp np = {s = \\ag => vp.part ! VPassPerf ! ag ++ vp.adv ++
"ab" ++ combineNounPhrase np ! PronNonDrop ! APostN ! DPreN ! Abl} ;
PresPartAP vp = {s = \\ag => vp.part ! VActPres ! ag ++ vp.obj ++ vp.compl ! ag ++ vp.adv} ;
-- PastPartAgentAP : VPSlash -> NP -> AP ; -- (opportunity) lost by the company -- PastPartAgentAP : VPSlash -> NP -> AP ; -- (opportunity) lost by the company
-- -- this is a generalization of Verb.PassV2 and should replace it in the future. -- -- this is a generalization of Verb.PassV2 and should replace it in the future.
@@ -100,6 +174,14 @@ concrete ExtendLat of Extend = CatLat ** open ResLat in {
PassVPSlash vp = vp ** { PassVPSlash vp = vp ** {
s = \\a => case a of { VAct _ t n p => vp.pass ! VPass t n p } ; s = \\a => case a of { VAct _ t n p => vp.pass ! VPass t n p } ;
} ; } ;
PassAgentVPSlash vp np = (PassVPSlash vp) ** {
adv = vp.adv ++ "ab" ++ combineNounPhrase np ! PronNonDrop ! APostN ! DPreN ! Abl
} ;
ComplBareVS vs s = vs ** {
s = \\a,q => vs.act ! a; pass=\\p,q=>vs.pass ! p;
compl=\\_=>defaultSentence s ! SOV; adv=""; obj=""
} ;
ProgrVPSlash vp = vp ;
-- -- the form with an agent may result in a different linearization -- -- the form with an agent may result in a different linearization
-- -- from an adverbial modification by an agent phrase. -- -- from an adverbial modification by an agent phrase.
@@ -164,6 +246,54 @@ concrete ExtendLat of Extend = CatLat ** open ResLat in {
preap = { s = \\_ => "" } ; preap = { s = \\_ => "" } ;
} ; } ;
ExistsNP np = mkClause np (predV esseAux) ;
AdvIsNP adv np = mkClause np (insertAdv adv (predV esseAux)) ;
ExistMassCN cn = mkClause (cn ** {s=\\_,c=>cn.s ! Sg ! c; n=Sg;p=P3;
det={s,sp=\\_=>"";n=Sg}}) (predV esseAux) ;
ExistPluralCN cn = mkClause (cn ** {s=\\_,c=>cn.s ! Pl ! c; n=Pl;p=P3;
det={s,sp=\\_=>"";n=Pl}}) (predV esseAux) ;
PrepCN prep cn = mkAdverb (prep.s ++ cn.s ! Sg ! prep.c) ;
CompBareCN cn = {s = \\a => case a of {Ag _ n c => cn.s ! n ! c}} ;
AdjAsCN ap = {s=\\n,c=>ap.s ! Ag Neutr n c;g=Neutr;
preap,postap={s=\\_=>""};adv=""} ;
ReflPron = {s = \\_,c => reflPron ! c} ;
ReflPoss num cn = {s = \\_,c =>
(createPronouns Masc Sg P3).p2 ! PronRefl ! Ag cn.g num.n c ++ cn.s ! num.n ! c} ;
ReflRNP vp rnp = vp ** {
compl = \\a => rnp.s ! a ! vp.c.c ++ vp.compl ! a
} ;
AdvRNP np prep rnp = {s = \\a,c =>
combineNounPhrase np ! PronNonDrop ! APostN ! DPreN ! c ++ prep.s ++ rnp.s ! a ! prep.c} ;
AdvRVP vp prep rnp = vp ** {compl = \\a => vp.compl ! a ++ prep.s ++ rnp.s ! a ! prep.c} ;
AdvRAP ap prep rnp = {s = \\a => ap.s ! a ++ prep.s ++ rnp.s ! a ! prep.c} ;
ReflA2RNP a rnp = {s = \\ag => a.s ! Posit ! ag ++ a.c.s ++ rnp.s ! ag ! a.c.c} ;
PossPronRNP pron num cn rnp =
let base = {
s = \\_,c => cn.s ! num.n ! c;
n = num.n; g = cn.g; p = P3; adv = rnp.s ! Ag pron.pers.g pron.pers.n Nom ! Gen;
preap=cn.preap; postap=cn.postap;
det={s=\\c=>pron.poss.s ! PronNonRefl ! Ag cn.g num.n c; sp=\\_=>""; n=num.n}
}
in base ;
CompoundN n1 n2 = {s = \\n,c => n2.s ! n ! c ++ n1.s ! Sg ! Gen; g=n2.g} ;
CompoundAP n a = {s = \\ag => n.s ! Sg ! Gen ++ a.s ! Posit ! ag} ;
GerundCN vp = {s = \\_,_ => vp.inf ! VInfActPres ++ vp.obj ++ vp.adv;
g=Neutr; preap,postap={s=\\_=>""}; adv=""} ;
GerundNP vp = dummyNP (vp.inf ! VInfActPres ++ vp.obj ++ vp.adv) ;
GerundAdv vp = mkAdverb (vp.inf ! VInfActPres ++ vp.obj ++ vp.adv) ;
ByVP vp = mkAdverb ("gerundio" ++ vp.inf ! VInfActPres ++ vp.obj ++ vp.adv) ;
InOrderToVP vp = mkAdverb ("ut" ++ vp.inf ! VInfActPres ++ vp.obj ++ vp.adv) ;
ApposNP np app = np ** {adv = np.adv ++ bindComma ++
combineNounPhrase app ! PronNonDrop ! APostN ! DPreN ! Nom ++ bindComma} ;
PositAdVAdj a = {s = a.adv.s ! Posit} ;
CompS s = {s = \\_ => "quod" ++ defaultSentence s ! SOV} ;
CompQS qs = {s = \\_ => qs.s ! QIndir} ;
CompVP ant pol vp = {s = \\a => pol.s ++ vp.inf ! VInfActPres ++ vp.obj ++ vp.compl ! a ++ vp.adv} ;
ComplSlashPartLast vp np = insertObj np vp.c vp ;
UttVPShort vp = {s = vp.imp ! VImp1 Sg ++ vp.obj ++ vp.compl ! Ag Masc Sg Acc ++ vp.adv} ;
-- -- infinitive complement for IAdv -- -- infinitive complement for IAdv
-- PredIAdvVP : IAdv -> VP -> QCl ; -- how to walk? -- PredIAdvVP : IAdv -> VP -> QCl ; -- how to walk?
+1 -1
View File
@@ -122,7 +122,7 @@ concrete ExtraLat of ExtraLatAbs =
-- SlashVP_VP_Ellipsis : NP -> VPSlash -> ClSlash ; -- (whom) he sees -- SlashVP_VP_Ellipsis : NP -> VPSlash -> ClSlash ; -- (whom) he sees
SlashVP_VP_Ellipsis np = SlashVP_VP_Ellipsis np =
mkClause np emptyVP ; mkClause np emptyVP ** {c2 = mkPreposition "" Acc} ;
-- FunRP_RP_Ellipsis : Prep -> NP -> RP ; -- FunRP_RP_Ellipsis : Prep -> NP -> RP ;
FunRP_RP_Ellipsis p np = FunRP p np (lin RP { s = \\_ => "" }) ; FunRP_RP_Ellipsis p np = FunRP p np (lin RP { s = \\_ => "" }) ;
+19 -2
View File
@@ -2,7 +2,24 @@ concrete IdiomLat of Idiom = CatLat ** open Prelude, ResLat in {
-- --
-- flags optimize=all_subs ; -- flags optimize=all_subs ;
-- --
-- lin lin
ImpersCl vp = mkClause emptyNP vp ;
GenericCl vp = mkClause (dummyNP "quis") vp ;
ExistNP np = mkClause np (predV esseAux) ;
ExistNPAdv np adv = mkClause np (insertAdv adv (predV esseAux)) ;
ExistIP ip = {
s=\\_=>"";o=\\_=>"";v=\\t,a,_,p=>esseAux.act ! VAct (anteriorityToVAnter a) (tenseToVTense t) ip.n P3;
det={s,sp=\\_=>""};compl="";neg=\\_,_=>"";adv="";q=ip.s ! Nom
} ;
ExistIPAdv ip adv = (ExistIP ip) ** {adv=adv.s ! Posit} ;
ProgrVP vp = vp ;
ImpPl1 vp = {s = vp.obj ++ vp.compl ! Ag Masc Pl Nom ++ vp.imp ! VImp1 Pl ++ vp.adv} ;
ImpP3 np vp = {s = combineNounPhrase np ! PronNonDrop ! APostN ! DPreN ! Nom ++
vp.obj ++ vp.compl ! Ag np.g np.n Nom ++ vp.imp ! VImp2 np.n np.p ++ vp.adv} ;
SelfAdvVP vp = vp ** {adv = vp.adv ++ "ipse"} ;
SelfAdVVP = SelfAdvVP ;
SelfNP np = np ** {postap={s=\\a=>case a of {Ag g n c =>
table {Masc=>"ipse";Fem=>"ipsa";Neutr=>"ipsum"}!g}}} ;
-- ImpersCl vp = mkClause "it" (agrP3 Sg) vp ; -- ImpersCl vp = mkClause "it" (agrP3 Sg) vp ;
-- GenericCl vp = mkClause "one" (agrP3 Sg) vp ; -- GenericCl vp = mkClause "one" (agrP3 Sg) vp ;
-- --
@@ -26,4 +43,4 @@ concrete IdiomLat of Idiom = CatLat ** open Prelude, ResLat in {
-- --
-- ImpPl1 vp = {s = "let's" ++ infVP True vp (AgP1 Pl)} ; -- ImpPl1 vp = {s = "let's" ++ infVP True vp (AgP1 Pl)} ;
-- --
} }
+2 -2
View File
@@ -470,8 +470,8 @@ oper
adjfull : (bonus,bona,bonum : Str) -> Adjective = \bonus,bona,bonum -> adjfull : (bonus,bona,bonum : Str) -> Adjective = \bonus,bona,bonum ->
case <bonus,bona,bonum> of { case <bonus,bona,bonum> of {
<_ + ("er"|"us"|"ur"|"tr"), _ + "a" , _ + "um"> => adj12 bonus ; <_ + ("er"|"us"|"ur"|"tr"), _ + "a" , _ + "um"> => adj12 bonus ;
<_ + ("er"|"is"), _ + "is" , _ + "e" > => adj3x bonus bonum ; -- FISHY? <_ + ("er"|"is"), _ + "is" , _ + "e" > => adj3x bonus bona ;
<_ + "ior" , _ + "ior", _ + "ius"> => adj3x bonus bonum ; -- FISHY? <_ + "ior" , _ + "ior", _ + "ius"> => adj3x bonus (bonus + "is") ;
<_ + "os" , _ + "os" , _ + "on"> => adjgre bonus bona bonum ; <_ + "os" , _ + "os" , _ + "on"> => adjgre bonus bona bonum ;
<_ + "es" , _ + "es" , _ + "es"> => adjgre bonus bona bonum ; <_ + "es" , _ + "es" , _ + "es"> => adjgre bonus bona bonum ;
<_ + "os" , _ + ("e"|"a") , _ + "on"> => adjgre bonus bona bonum ; <_ + "os" , _ + ("e"|"a") , _ + "on"> => adjgre bonus bona bonum ;
+55 -1
View File
@@ -89,6 +89,17 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
n = num.n n = num.n
} ; } ;
DetQuantOrd quant num ord = {
s = \\g,c => quant.s ! Ag g num.n c ++ num.s ! g ! c ++ ord.s ! g ! num.n ! c ;
sp = \\g,c => quant.sp ! Ag g num.n c ;
n = num.n
} ;
DetDAP det = det ;
AdjDAP det ap = det ** {
sp = \\g,c => ap.s ! Ag g det.n c ++ det.sp ! g ! c
} ;
PossPron p = { s = \\a => p.poss.s ! PronNonRefl ! a ; sp = \\_ => "" } ; PossPron p = { s = \\a => p.poss.s ! PronNonRefl ! a ; sp = \\_ => "" } ;
@@ -100,6 +111,9 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
NumPl = {s = \\_,_ => [] ; n = Pl} ; NumPl = {s = \\_,_ => [] ; n = Pl} ;
NumCard n = n ; NumCard n = n ;
NumDigits d = {s = \\_,_ => d.s ; n = Pl} ;
NumDecimal d = {s = \\_,_ => d.s ; n = Pl} ;
QuantityNP d mu = dummyNP (d.s ++ mu.s) ** {n=Pl;g=Neutr} ;
-- --
-- NumDigits n = {s = n.s ! NCard ; n = n.n} ; -- NumDigits n = {s = n.s ! NCard ; n = n.n} ;
-- OrdDigits n = {s = n.s ! NOrd} ; -- OrdDigits n = {s = n.s ! NOrd} ;
@@ -109,6 +123,13 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
NumNumeral numeral = { s = numeral.s ; n = numeral.n } ; NumNumeral numeral = { s = numeral.s ; n = numeral.n } ;
-- OrdNumeral : Numeral -> Ord ; -- fifty-first -- OrdNumeral : Numeral -> Ord ; -- fifty-first
OrdNumeral numeral = { s = numeral.ord } ; OrdNumeral numeral = { s = numeral.ord } ;
OrdDigits d = {s = \\_,_,_ => d.s} ;
OrdSuperl a = {s = \\g,n,c => a.s ! Superl ! Ag g n c} ;
OrdNumeralSuperl numeral a = {
s = \\g,n,c => numeral.s ! g ! c ++ a.s ! Superl ! Ag g n c
} ;
AdNum adn num = num ** {s = \\g,c => adn.s ++ num.s ! g ! c} ;
-- --
-- AdNum adn num = {s = adn.s ++ num.s ; n = num.n} ; -- AdNum adn num = {s = adn.s ++ num.s ; n = num.n} ;
-- --
@@ -164,6 +185,39 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
AdjCN ap cn = -- AP -> CN -> CN AdjCN ap cn = -- AP -> CN -> CN
addAdjToCN (lin AP ap) (lin CN cn) Post ; addAdjToCN (lin AP ap) (lin CN cn) Post ;
AdvCN cn adv = cn ** {adv = cn.adv ++ adv.s ! Posit} ;
RelCN cn rs = cn ** {
adv = cn.adv ++ bindComma ++ rs.s ! cn.g ! Sg
} ;
SentCN cn sc = cn ** {adv = cn.adv ++ sc.s} ;
PossNP cn np = cn ** {
s = \\n,c => cn.s ! n ! c ++
combineNounPhrase np ! PronNonDrop ! APostN ! DPreN ! Gen
} ;
PartNP cn np = cn ** {
s = \\n,c => cn.s ! n ! c ++ "ex" ++
combineNounPhrase np ! PronNonDrop ! APostN ! DPreN ! Abl
} ;
ComplN2 n2 np = lin CN (n2 ** {
s = \\n,c => n2.s ! n ! c ++ appPrep n2.c
(combineNounPhrase np ! PronNonDrop ! APostN ! DPreN)
; preap, postap = {s = \\_ => ""} ; adv = ""
}) ;
ComplN3 n3 np = n3 ** {
s = \\n,c => n3.s ! n ! c ++ appPrep n3.c
(combineNounPhrase np ! PronNonDrop ! APostN ! DPreN) ;
c = n3.c2
} ;
Use2N3 n3 = n3 ** {c = n3.c} ;
Use3N3 n3 = n3 ** {c = n3.c2} ;
-- RelCN cn rs = { -- RelCN cn rs = {
-- s = \\n,c => cn.s ! n ! c ++ rs.s ! agrgP3 n cn.g ; -- s = \\n,c => cn.s ! n ! c ++ rs.s ! agrgP3 n cn.g ;
-- g = cn.g -- g = cn.g
@@ -184,4 +238,4 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
CountNP det np = np ** { CountNP det np = np ** {
det = { s = \\c => det.s ! np.g ! c ++ np.det.s ! c ; sp = \\c => det.sp ! np.g ! c ++ np.det.sp ! c } ; det = { s = \\c => det.s ! np.g ! c ++ np.det.s ! c ; sp = \\c => det.sp ! np.g ! c ++ np.det.sp ! c } ;
}; };
} }
+16
View File
@@ -5,6 +5,8 @@ concrete NumeralLat of Numeral = CatLat ** open ParadigmsLat, Prelude, ResLat, P
Sub100 = TNumeral ; Sub100 = TNumeral ;
Sub1000 = TNumeral ; Sub1000 = TNumeral ;
Sub1000000 = TNumeral ; Sub1000000 = TNumeral ;
Sub1000000000 = TNumeral ;
Sub1000000000000 = TNumeral ;
lin lin
num x = x ; num x = x ;
@@ -150,6 +152,18 @@ concrete NumeralLat of Numeral = CatLat ** open ParadigmsLat, Prelude, ResLat, P
ord = \\_,_,_ => nonExist -- TODO ord = \\_,_,_ => nonExist -- TODO
} ; } ;
pot3as4 n = n ;
pot41 = pot01 ** {s=\\_,_=>"decies centena milia";n=plural} ;
pot4 n = n ** {s=\\g,c=>n.s ! g ! c ++ "decies centena milia";n=plural} ;
pot4plus m n = n ** {s=\\g,c=>m.s ! g ! c ++ "decies centena milia" ++ n.s ! g ! c;n=plural} ;
pot4as5 n = n ;
pot51 = pot01 ** {s=\\_,_=>"miliens decies centena milia";n=plural} ;
pot5 n = n ** {s=\\g,c=>n.s ! g ! c ++ "miliens decies centena milia";n=plural} ;
pot5plus m n = n ** {s=\\g,c=>m.s ! g ! c ++ "miliens decies centena milia" ++ n.s ! g ! c;n=plural} ;
pot3decimal d = pot01 ** {s=\\_,_=>d.s ++ "milia";n=plural} ;
pot4decimal d = pot01 ** {s=\\_,_=>d.s ++ "decies centena milia";n=plural} ;
pot5decimal d = pot01 ** {s=\\_,_=>d.s ++ "miliens decies centena milia";n=plural} ;
oper oper
mkDigit : (ones, eleven, tens, hundreds, ord : Str) -> Str -> Below8 -> TDigit = mkDigit : (ones, eleven, tens, hundreds, ord : Str) -> Str -> Below8 -> TDigit =
\ones, eleven, tens, hundreds, ord -> \ones, eleven, tens, hundreds, ord ->
@@ -210,6 +224,8 @@ concrete NumeralLat of Numeral = CatLat ** open ParadigmsLat, Prelude, ResLat, P
D_9 = mkDig "IX" "XIX" "XC" "CM" "(IX)" "(XC)" "(CM)" ; D_9 = mkDig "IX" "XIX" "XC" "CM" "(IX)" "(XC)" "(CM)" ;
PosDecimal d = d ** {hasDot=False} ; PosDecimal d = d ** {hasDot=False} ;
NegDecimal d = d ** {s = "-" ++ d.s; hasDot=False} ;
IFrac d f = d ** {s = d.s ++ "." ++ f.s ! one; hasDot=True} ;
oper oper
TDig = { TDig = {
+5
View File
@@ -48,6 +48,11 @@ oper
pluralN : N -> N = \n -> lin N (ResLat.pluralNoun n) ; pluralN : N -> N = \n -> lin N (ResLat.pluralNoun n) ;
singularN : N -> N = \n -> lin N (ResLat.singularNoun n) ; singularN : N -> N = \n -> lin N (ResLat.singularNoun n) ;
constN : Str -> Gender-> N = \s,g -> lin N (ResLat.constNoun s g); constN : Str -> Gender-> N = \s,g -> lin N (ResLat.constNoun s g);
compoundN : N -> A -> N = \n,a -> lin N {
s = \\num,cas => n.s ! num ! cas ++ a.s ! Posit ! Ag n.g num cas ;
g = n.g
} ;
mkA = overload { mkA = overload {
mkA : (verbum : Str) -> A -- Nominative masculine mkA : (verbum : Str) -> A -- Nominative masculine
+3 -2
View File
@@ -18,7 +18,7 @@ concrete PhraseLat of Phrase = CatLat ** open Prelude, ResLat in {
-- UttIAdv : IAdv -> Utt -- UttIAdv : IAdv -> Utt
UttIAdv iadv = iadv ; UttIAdv iadv = iadv ;
-- UttNP : NP -> Utt -- UttNP : NP -> Utt
UttNP np = {s = np.adv ++ (combineNounPhrase np) ! PronNonDrop ! APostN ! DPreN ! Nom} ; UttNP np = {s = (combineNounPhrase np) ! PronNonDrop ! APostN ! DPreN ! Nom} ;
-- UttVP : VP -> Utt -- UttVP : VP -> Utt
UttVP vp = ss (vp.inf ! VInfActPres) ; UttVP vp = ss (vp.inf ! VInfActPres) ;
@@ -29,7 +29,8 @@ concrete PhraseLat of Phrase = CatLat ** open Prelude, ResLat in {
-- UttCard : Card -> Utt -- UttCard : Card -> Utt
UttCard card = ss (card.s ! Masc ! Nom); UttCard card = ss (card.s ! Masc ! Nom);
-- UttCN : CN -> Utt -- UttCN : CN -> Utt
UttCN cn = ss (cn.s ! Sg ! Nom) ; UttCN cn = ss (cn.preap.s ! Ag cn.g Sg Nom ++ cn.s ! Sg ! Nom ++
cn.postap.s ! Ag cn.g Sg Nom ++ cn.adv) ;
-- UttInterj : Interj -> Utt -- UttInterj : Interj -> Utt
UttInterj interj = interj ; UttInterj interj = interj ;
NoPConj = {s = []} ; NoPConj = {s = []} ;
+15
View File
@@ -40,6 +40,21 @@ concrete QuestionLat of Question = CatLat ** open ResLat, IrregLat, Prelude in {
det = { s , sp = \\_=> [] ; n = Sg } ; -- default number singilar det = { s , sp = \\_=> [] ; n = Sg } ; -- default number singilar
compl = "" ; compl = "" ;
} ; } ;
QuestSlash ip cl = cl ** {
q = ip.s ! cl.c2.c ++ cl.c2.s
} ;
PrepIP prep ip = {s = prep.s ++ ip.s ! prep.c} ;
AdvIP ip adv = ip ** {s = \\c => ip.s ! c ++ adv.s ! Posit} ;
IdetCN det cn = {s = \\c => det.s ! cn.g ! c ++ cn.s ! det.n ! c; n=det.n} ;
IdetIP det = {s = det.s ! Masc; n=det.n} ;
IdetQuant quant num = {
s = \\g,c => quant.s ! Ag g num.n c ++ num.s ! g ! c;
sp = \\_,_ => ""; n=num.n
} ;
CompIP ip = {s = ip.s ! Nom} ;
AdvIAdv ia adv = {s = ia.s ++ adv.s ! Posit} ;
-- --
-- --
-- PrepIP p ip = {s = p.s ++ ip.s ! Acc} ; -- PrepIP p ip = {s = p.s ++ ip.s ! Acc} ;
+2
View File
@@ -3,6 +3,8 @@ concrete RelativeLat of Relative = CatLat ** open ResLat in {
-- flags optimize=all_subs ; -- flags optimize=all_subs ;
-- --
lin lin
RelCl cl = {s = \\_,_ => cl} ;
-- --
-- RelCl cl = { -- RelCl cl = {
-- s = \\t,a,p,_ => "such" ++ "that" ++ cl.s ! t ! a ! p ! ODir ; -- s = \\t,a,p,_ => "such" ++ "that" ++ cl.s ! t ! a ! p ! ODir ;
+5 -1
View File
@@ -1218,7 +1218,11 @@ oper
} , } ,
table { table {
PronNonRefl => PronNonRefl =>
\\_ => nonExist ; \\_ => case <g,n> of {
<_,Sg> => "eius" ;
<Fem,Pl> => "earum" ;
<_,Pl> => "eorum"
} ;
PronRefl => PronRefl =>
table { table {
Ag Masc Sg c => ( pronForms "suus" "suum" "sui" "suo" "suo" ) ! c ; Ag Masc Sg c => ( pronForms "suus" "suum" "sui" "suo" "suo" ) ! c ;
+33 -3
View File
@@ -6,6 +6,21 @@ concrete SentenceLat of Sentence = CatLat ** open Prelude, ResLat in {
PredVP np vp = -- NP -> VP -> Cl PredVP np vp = -- NP -> VP -> Cl
mkClause np vp ; mkClause np vp ;
PredSCVP sc vp = mkClause (dummyNP sc.s) vp ;
ImpVP vp = {
s = \\pol,form => case pol of {
Neg => case form of {VImp1 Pl => "nolite"; VImp2 Pl _ => "nolite"; _ => "noli"};
Pos => ""
} ++
vp.adv ++ vp.obj ++ vp.compl ! Ag Masc Sg Acc ++
case pol of {Neg => vp.inf ! VInfActPres ; Pos => vp.imp ! form}
} ;
AdvImp adv imp = imp ** {
s = \\p,f => adv.s ! Posit ++ imp.s ! p ! f
} ;
-- --
-- PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp ; -- PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp ;
-- --
@@ -25,7 +40,7 @@ concrete SentenceLat of Sentence = CatLat ** open Prelude, ResLat in {
-- SlashVP : NP -> VPSlash -> ClSlash ; -- (whom) he sees -- SlashVP : NP -> VPSlash -> ClSlash ; -- (whom) he sees
SlashVP np vp = SlashVP np vp =
mkClause np ( vp ** {c2 = vp.c2} ) ; mkClause np vp ** {c2 = vp.c} ;
-- --
-- AdvSlash slash adv = { -- AdvSlash slash adv = {
-- s = \\t,a,b,o => slash.s ! t ! a ! b ! o ++ adv.s ; -- s = \\t,a,b,o => slash.s ! t ! a ! b ! o ++ adv.s ;
@@ -33,7 +48,23 @@ concrete SentenceLat of Sentence = CatLat ** open Prelude, ResLat in {
-- } ; -- } ;
-- SlashPrep : Cl -> Prep -> ClSlash ; -- (with whom) he walks -- SlashPrep : Cl -> Prep -> ClSlash ; -- (with whom) he walks
SlashPrep cl prep = cl ** {c2 = prep.s} ; SlashPrep cl prep = cl ** {c2 = prep} ;
AdvSlash cl adv = cl ** {adv = adv.s ! Posit ++ cl.adv} ;
EmbedS s = {s = "quod" ++ defaultSentence s ! SOV} ;
EmbedQS qs = {s = qs.s ! QIndir} ;
EmbedVP vp = {s = vp.adv ++ vp.obj ++ vp.compl ! Ag Masc Sg Nom ++ vp.inf ! VInfActPres} ;
ExtAdvS adv s = s ** {sadv = adv.s ! Posit ++ s.sadv} ;
SSubjS s1 subj s2 = s1 ** {
sadv = subj.s ++ defaultSentence s2 ! SOV ++ s1.sadv
} ;
RelS s rs = s ** {sadv = s.sadv ++ rs.s ! Neutr ! Sg} ;
UseSlash t p cl = combineClause (t.s ++ p.s) cl t.t t.a p.p VQFalse ** {c2 = cl.c2} ;
-- --
-- SlashVS np vs slash = -- SlashVS np vs slash =
-- mkClause (combineNounPhrase np ! PronNonDrop ! Nom) np.a -- mkClause (combineNounPhrase np ! PronNonDrop ! Nom) np.a
@@ -82,4 +113,3 @@ concrete SentenceLat of Sentence = CatLat ** open Prelude, ResLat in {
-- ctr = contrNeg True ; -- contracted negations -- ctr = contrNeg True ; -- contracted negations
-- --
} }
+28
View File
@@ -63,6 +63,32 @@ concrete VerbLat of Verb = CatLat ** open (S=StructuralLat),ResLat,IrregLat,Extr
ComplSlash vp np = -- VPSlash -> NP -> VP ComplSlash vp np = -- VPSlash -> NP -> VP
insertObj np vp.c vp ; insertObj np vp.c vp ;
SlashV2S v s = (predV2 v) ** {
compl = \\_ => defaultSentence s ! SOV
} ;
SlashV2V v vp = (predV v) ** {
compl = \\_ => vp.adv ++ vp.obj ++ vp.compl ! Ag Masc Sg Nom ++ vp.inf ! VInfActPres
; c = mkPreposition "" Acc
} ;
SlashVV v vp = (predV v) ** {
compl = \\_ => vp.adv ++ vp.obj ++ vp.compl ! Ag Masc Sg Nom ++ vp.inf ! VInfActPres ;
c = vp.c
} ;
SlashV2VNP v np vp = (predV v) ** {
obj = combineNounPhrase np ! PronNonDrop ! APostN ! DPreN ! Acc ;
compl = \\_ => vp.adv ++ vp.obj ++ vp.compl ! Ag Masc Sg Nom ++ vp.inf ! VInfActPres ;
c = vp.c
} ;
ReflVP vp = insertObj
(emptyNP ** {s = \\_,c => (createPronouns Masc Sg P3).p1 ! PronNonDrop ! PronRefl ! c})
vp.c vp ;
VPSlashPrep vp prep = vp ** {c = prep} ;
-- SlashVV : VV -> VPSlash -> VPSlash ; -- want to buy -- SlashVV : VV -> VPSlash -> VPSlash ; -- want to buy
-- SlashVV vv vp = -- SlashVV vv vp =
-- insertObj (\\a => infVP vv.isAux vp a) (predVV vv) ** -- insertObj (\\a => infVP vv.isAux vp a) (predVV vv) **
@@ -97,6 +123,8 @@ concrete VerbLat of Verb = CatLat ** open (S=StructuralLat),ResLat,IrregLat,Extr
-- AdvVP : VP -> Adv -> VP ; -- sleep here -- AdvVP : VP -> Adv -> VP ; -- sleep here
AdvVP vp adv = insertAdv adv vp ; AdvVP vp adv = insertAdv adv vp ;
ExtAdvVP vp adv = insertAdv adv vp ;
-- ExtAdvVP vp adv = vp -- ExtAdvVP vp adv = vp
-- AdVVP : AdV -> VP -> VP ; -- always sleep -- AdVVP : AdV -> VP -> VP ; -- always sleep