extensions by Codex

This commit is contained in:
Krasimir Angelov committed 2026-10-11 20:43:06 +02:00
1 parent 1ddd8bd16c
commit fb3cf2203b
4 files changed
+156 -2

No files matched your search

+5 -1
View File
@@ -2,4 +2,8 @@
concrete CatSpa of Cat = CommonX -
[SC,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond,Pol,MU] ** CatRomance with
(ResRomance = ResSpa) ;
(ResRomance = ResSpa) ** {
lincat ACard = {s : Str} ;
} ;
+5
View File
@@ -31,6 +31,10 @@ lin
is_wrong_VP = mkVP (mkVA I.estar_V) (mkAP (mkA "equivocado")) ;
n_units_AP card cn a = mkAP (lin AdA (mkUtt (mkNP <lin Card card : Card> (lin CN cn)))) (lin A a) ;
n_units_of_NP card cn np =
mkNP card (lin CN (cn ** {
s = \\n => cn.s ! n ++ (np.s ! R.genitive).ton
})) ;
bottle_of_CN np = mkCN (lin N2 (mkN2 (mkN "botella" feminine) part_Prep)) np ;
cup_of_CN np = mkCN (lin N2 (mkN2 (mkN "taza") part_Prep)) np ;
@@ -82,6 +86,7 @@ lin InLanguage l = SyntaxSpa.mkAdv (mkPrep "en") (mkNP l) ;
lin
weekdayN w = w ;
monthN m = m ;
weekdayPN w = mkPN w ;
monthPN m = mkPN m ;
+117 -1
View File
@@ -1,6 +1,13 @@
--# -path=alltenses:../common:../abstract:../romance
concrete ExtendSpa of Extend = CatSpa ** ExtendRomanceFunctor -
[
EmptyRelSlash,
BaseVPI, ConsVPI, ConjVPI, MkVPI, ComplVPIVV,
BaseComp, ConsComp, ConjComp, BaseImp, ConsImp, ConjImp,
RNP, ReflRNP, ReflPron, ReflPoss, PredetRNP,
AdvRNP, AdvRVP, AdvRAP, ReflA2RNP, PossPronRNP, ReflPossPron,
ProgrVPSlash,
GerundNP, GerundCN,
CompVP,
CompoundAP,
CompoundN,
@@ -34,10 +41,109 @@ concrete ExtendSpa of Extend = CatSpa ** ExtendRomanceFunctor -
Coordination,
Prelude,
ParadigmsSpa,
(I=IrregSpa) in {
(I=IrregSpa),
(P=ParamX) in {
-- put your own definitions here
lin
EmptyRelSlash = RelSlash IdRP ;
lincat
RNP = {s : Agr => Case => Str ; isPron : Bool} ;
VPI = {s : Agr => Str} ;
[VPI] = {s1,s2 : Agr => Str} ;
lin
MkVPI vp = {s = \\a => infVP vp RPos a} ;
BaseVPI = twoTable Agr ;
ConsVPI = consrTable Agr comma ;
ConjVPI = conjunctDistrTable Agr ;
ComplVPIVV vv vpi =
insertComplement (\\a => prepCase vv.c2.c ++ vpi.s ! a) (predV vv) ;
lincat [Comp] = {s1,s2 : Agr => Str ; cop : CopulaType} ;
lin
BaseComp x y = twoTable Agr x y ** {cop = x.cop} ;
ConsComp xs x = consrTable Agr comma xs x ** xs ;
ConjComp conj cs = conjunctDistrTable Agr conj cs ** {cop = cs.cop} ;
lincat [Imp] = {s1,s2 : RPolarity => P.ImpForm => Gender => Str} ;
lin
BaseImp = twoTable3 RPolarity P.ImpForm Gender ;
ConsImp = consrTable3 RPolarity P.ImpForm Gender comma ;
ConjImp = conjunctDistrTable3 RPolarity P.ImpForm Gender ;
-- A progressive construction around a slash would fill or displace its
-- gap. The simple form is idiomatic in the relative and interrogative
-- contexts in which this constructor is used.
ProgrVPSlash vps = vps ;
-- Spanish uses the infinitive, not the gerund, as a nominal form.
GerundNP vp = let agr = Ag Masc Sg P3 in heavyNP {
s = \\_ => infVP vp RPos agr ;
a = agr
} ;
GerundCN vp = {
s = \\n => infVP vp RPos (Ag Masc n P3) ;
g = Masc
} ;
ReflRNP v rnp = case <rnp.isPron,v.c2.isDir> of {
<True,True> => insertRefl v ;
_ => insertComplement
(\\a => let agr = verbAgr a in
v.c2.s ++ rnp.s ! agr ! v.c2.c) v
} ;
ReflPron = {
s = \\agr,c => reflPron agr.n agr.p c ;
isPron = True
} ;
ReflPoss num cn = {
s = \\agr,c => possCase cn.g num.n c ++
possDet agr num.n cn.g ++ cn.s ! num.n ;
isPron = False
} ;
PredetRNP pred rnp = {
s = \\agr,c => pred.s ! complAgr agr ! c ++ rnp.s ! agr ! pred.c ;
isPron = False
} ;
AdvRNP np prep rnp = {
s = \\agr,c => (np.s ! c).ton ++ prep.s ++ rnp.s ! agr ! prep.c ;
isPron = False
} ;
AdvRVP vp prep rnp =
insertComplement (\\a => prep.s ++ rnp.s ! verbAgr a ! prep.c) vp ;
AdvRAP ap prep rnp = ap ** {
s = \\af => ap.s ! af ++ prep.s ++
rnp.s ! (aform2aagr af ** {p = P3}) ! prep.c ;
isPre = False
} ;
ReflA2RNP a rnp = a ** {
s = \\af => a.s ! af ++ a.c2.s ++
rnp.s ! (aform2aagr af ** {p = P3}) ! a.c2.c ;
isPre = False
} ;
PossPronRNP pron num cn rnp = heavyNP {
s = \\c => possCase cn.g num.n c ++ pron.poss ! num.n ! cn.g ++
cn.s ! num.n ++ rnp.s ! pron.a ! ResSpa.genitive ;
a = agrP3 cn.g num.n ;
hasClit = False ;
isNeg = False
} ;
ReflPossPron = PossPron he_Pron ;
iFem_Pron = agr2pron ! {g=Fem ; n=Sg ; p=P1} ;
youFem_Pron = agr2pron ! {g=Fem ; n=Sg ; p=P2} ;
weFem_Pron = agr2pron ! {g=Fem ; n=Pl ; p=P1} ;
@@ -116,6 +222,16 @@ lin PassVPSlash vps = passVPSlash vps [] ;
vps (let by = <Grammar.by8agent_Prep : Prep> in by.s ++ (np.s ! by.c).ton) ;
oper
possDet : Agr -> Number -> Gender -> Str = \agr,n,g ->
case <agr.n,agr.p> of {
<Sg,P1> => i_Pron.poss ! n ! g ;
<Sg,P2> => youSg_Pron.poss ! n ! g ;
<Sg,P3> => he_Pron.poss ! n ! g ;
<Pl,P1> => we_Pron.poss ! n ! g ;
<Pl,P2> => youPl_Pron.poss ! n ! g ;
<Pl,P3> => they_Pron.poss ! n ! g
} ;
passVPSlash : VPSlash -> Str -> VP = \vps, agent ->
let auxvp = predV auxPassive
in
+29
View File
@@ -62,14 +62,43 @@ lin pot1plus d e =
{s = \\g => d.s ! tiotal ! g ++ y_CardOrd g ++ e.s ! ental indip ! g ; n = Pl} ;
lin pot1as2 n = n ;
lin pot2 d = spl (d.s ! hundra False) ;
lin pot21 = spl (table {
NCard _ => "cien" ;
NOrd g n => regCard "centésimo" g n
}) ;
lin pot2plus d e =
{s = \\g => d.s ! hundra True ! g ++ e.s ! g ; n = Pl} ;
lin pot2as3 n = n ;
lin pot3 n = spl (\\g => n.s ! NCard Masc ++ mil g) ;
lin pot31 = spl (table {
NCard _ => "mil" ;
NOrd g n => regCard "milésimo" g n
}) ;
lin pot3plus n m = {s = \\g => n.s ! NCard Masc ++ mil g ++ m.s ! g ; n = Pl} ;
lin pot3decimal d = {s = \\_ => d.s ! NCard Masc ++ "mil" ; n = Pl} ;
lin pot3as4 n = n ;
lin pot41 = {s = \\co => case co of {
NCard _ => "un millón de" ;
NOrd g n => regCard "millonésimo" g n
} ; n = Pl} ;
lin pot4 n = {s = \\co => case co of {
NCard _ => n.s ! NCard Masc ++ "millones de" ;
NOrd g k => n.s ! NCard Masc ++ regCard "millonésimo" g k
} ; n = Pl} ;
lin pot4plus n m = {s = \\co => n.s ! NCard Masc ++ "millones" ++ m.s ! co ++ "de" ; n = Pl} ;
lin pot4decimal d = {s = \\_ => d.s ! NCard Masc ++ "millones de" ; n = Pl} ;
lin pot4as5 n = n ;
lin pot51 = {s = \\co => case co of {
NCard _ => "mil millones de" ;
NOrd g n => regCard "milmillonésimo" g n
} ; n = Pl} ;
lin pot5 n = {s = \\co => case co of {
NCard _ => n.s ! NCard Masc ++ "mil millones de" ;
NOrd g k => n.s ! NCard Masc ++ regCard "milmillonésimo" g k
} ; n = Pl} ;
lin pot5plus n m = {s = \\co => n.s ! NCard Masc ++ "mil millones" ++ m.s ! co ++ "de" ; n = Pl} ;
lin pot5decimal d = {s = \\_ => d.s ! NCard Masc ++ "mil millones de" ; n = Pl} ;
oper
mkTal : (x1,_,_,_,_,_,_,x8 : Str) -> {s : DForm => CardOrd => Str} =