Codex adding missing functions

This commit is contained in:
Krasimir Angelov
2026-09-19 18:10:39 +02:00
parent 22559fe681
commit d9004e75a8
12 changed files with 284 additions and 4 deletions
+5
View File
@@ -49,6 +49,11 @@ concrete AdjectiveAfr of Adjective = CatAfr ** open ResAfr, Prelude in
isPre = ap.isPre isPre = ap.isPre
} ; } ;
AdvAP ap adv = {
s = \\a => ap.s ! a ++ adv.s ;
isPre = False
} ;
UseA2 a = { UseA2 a = {
s = a.s ! Posit ; s = a.s ! Posit ;
isPre = True isPre = True
+2 -1
View File
@@ -47,7 +47,7 @@ concrete CatAfr of Cat =
NP = {s : NPCase => Str ; a : Agr ; isPron : Bool} ; NP = {s : NPCase => Str ; a : Agr ; isPron : Bool} ;
Pron = Pronoun ; Pron = Pronoun ;
Det = {s,sp : Gender => Str ; n : Number ; a : Adjf} ; Det,DAP = {s,sp : Gender => Str ; n : Number ; a : Adjf} ;
Quant = { Quant = {
s : Bool => Number => Gender => Str ; s : Bool => Number => Gender => Str ;
sp : Number => Gender => Str ; sp : Number => Gender => Str ;
@@ -56,6 +56,7 @@ concrete CatAfr of Cat =
Predet = {s : Number => Gender => Str} ; Predet = {s : Number => Gender => Str} ;
Num = {s : Str ; n : Number ; isNum : Bool} ; Num = {s : Str ; n : Number ; isNum : Bool} ;
Card = {s : Gender => Case => Str ; n : Number} ; Card = {s : Gender => Case => Str ; n : Number} ;
ACard = {s : Str} ;
Ord = {s : AForm => Str} ; Ord = {s : AForm => Str} ;
-- Numeral -- Numeral
+5
View File
@@ -19,6 +19,8 @@ concrete ConjunctionAfr of Conjunction =
ConjRS conj ss = conjunctDistrTable2 Gender Number conj ss ; ConjRS conj ss = conjunctDistrTable2 Gender Number conj ss ;
ConjCN conj ss = conjunctDistrTable2 Adjf NForm conj ss ** {g = Neutr} ;
-- These fun's are generated from the list cat's. -- These fun's are generated from the list cat's.
BaseS = twoTable Order ; BaseS = twoTable Order ;
@@ -31,6 +33,8 @@ concrete ConjunctionAfr of Conjunction =
ConsAP xs x = consrTable AForm comma xs x ** {isPre = andB xs.isPre x.isPre} ; ConsAP xs x = consrTable AForm comma xs x ** {isPre = andB xs.isPre x.isPre} ;
BaseRS x y = twoTable2 Gender Number x y ** {c = y.c} ; BaseRS x y = twoTable2 Gender Number x y ** {c = y.c} ;
ConsRS xs x = consrTable2 Gender Number comma xs x ; ConsRS xs x = consrTable2 Gender Number comma xs x ;
BaseCN x y = twoTable2 Adjf NForm x y ;
ConsCN xs x = consrTable2 Adjf NForm comma xs x ;
lincat lincat
[S] = {s1,s2 : Order => Str} ; [S] = {s1,s2 : Order => Str} ;
@@ -38,5 +42,6 @@ concrete ConjunctionAfr of Conjunction =
[NP] = {s1,s2 : NPCase => Str ; a : Agr} ; [NP] = {s1,s2 : NPCase => Str ; a : Agr} ;
[AP] = {s1,s2 : AForm => Str ; isPre : Bool} ; [AP] = {s1,s2 : AForm => Str ; isPre : Bool} ;
[RS] = {s1,s2 : Gender => Number => Str} ; [RS] = {s1,s2 : Gender => Number => Str} ;
[CN] = {s1,s2 : Adjf => NForm => Str} ;
} }
+160 -2
View File
@@ -1,10 +1,155 @@
concrete ExtendAfr of Extend = concrete ExtendAfr of Extend =
CatAfr ** ExtendFunctor - [PassVPSlash,PassAgentVPSlash] CatAfr ** ExtendFunctor - [
VPS, BaseVPS, ConsVPS, MkVPS, ConjVPS, PredVPS,
VPI, BaseVPI, ConsVPI, MkVPI, ConjVPI, ComplVPIVV,
PassVPSlash, PassAgentVPSlash,
PresPartAP, PastPartAP, PastPartAgentAP, ProgrVPSlash,
RNP, RNPList, ReflRNP, ReflPron, ReflPoss, PredetRNP,
AdvRNP, AdvRVP, AdvRAP, ReflA2RNP, PossPronRNP,
ConjRNP, Base_rr_RNP, Base_nr_RNP, Base_rn_RNP,
Cons_rr_RNP, Cons_nr_RNP,
GenModNP, ComplBareVS, CompoundN, CompoundAP,
GerundCN, GerundNP, GerundAdv, ByVP, InOrderToVP,
ApposNP, UttVPShort, ComplSlashPartLast,
PositAdVAdj,
UseDAP, UseDAPMasc, UseDAPFem,
BaseComp, ConsComp, ConjComp, BaseImp, ConsImp, ConjImp
]
with with
(Grammar = GrammarAfr) ** (Grammar = GrammarAfr) **
open open
ParadigmsAfr, ResAfr in { ParadigmsAfr, ResAfr, Coordination, Prelude in {
lincat
VPS = {s : Order => Agr => Str} ;
[VPS] = {s1,s2 : Order => Agr => Str} ;
VPI = {s : Agr => Str} ;
[VPI] = {s1,s2 : Agr => Str} ;
lin BaseVPS = twoTable2 Order Agr ;
ConsVPS = consrTable2 Order Agr comma ;
MkVPS tm pol vp = {
s = \\o,a => (mkClause [] a vp).s ! tm.t ! tm.a ! pol.p ! o
} ;
ConjVPS conj vps = conjunctDistrTable2 Order Agr conj vps ;
PredVPS np vps = {
s = \\o => case o of {
Main | Sub => np.s ! NPNom ++ vps.s ! o ! np.a ;
Inv => vps.s ! Inv ! np.a ++ np.s ! NPNom
}
} ;
BaseVPI = twoTable Agr ;
ConsVPI = consrTable Agr comma ;
MkVPI vp = {s = \\a => infVPString vp a} ;
ConjVPI conj vpis = conjunctDistrTable Agr conj vpis ;
ComplVPIVV vv vpi = insertInf (vpi.s ! agrP3 Sg) (predVGen vv.isAux vv) ;
lincat
RNP = {s : Agr => Str ; isPron : Bool} ;
RNPList = {s1,s2 : Agr => Str} ;
lin ReflRNP vps rnp = insertObjNP rnp.isPron (\\a => appPrep vps.c2 (\\_ => rnp.s ! a)) vps ;
ReflPron = {s = reflPron ; isPron = True} ;
ReflPoss num cn = {
s = \\a => reflPossDet a ++ num.s ++ cn.s ! Strong ! NF num.n Nom ;
isPron = False
} ;
PredetRNP pred rnp = {
s = \\a => pred.s ! a.n ! a.g ++ rnp.s ! a ;
isPron = False
} ;
AdvRNP np prep rnp = {
s = \\a => np.s ! NPAcc ++ prep.s ++ rnp.s ! a ;
isPron = False
} ;
AdvRVP vp prep rnp = insertObj (\\a => prep.s ++ rnp.s ! a) vp ;
AdvRAP ap prep rnp = {
s = \\af => ap.s ! af ++ prep.s ++ rnp.s ! agrP3 Sg ;
isPre = False
} ;
ReflA2RNP a rnp = {
s = \\af => a.s ! Posit ! af ++ a.c2 ++ rnp.s ! agrP3 Sg ;
isPre = False
} ;
PossPronRNP pron num cn rnp = heavyNP {
s = \\c => pron.unstressed.poss ++ num.s ++ cn.s ! Strong ! NF num.n Nom ++
"van" ++ rnp.s ! pron.a ;
a = agrP3 num.n
} ;
ConjRNP conj rnps = conjunctDistrTable Agr conj rnps ** {isPron = False} ;
Base_rr_RNP = twoTable Agr ;
Base_nr_RNP np rnp = twoTable Agr {s = \\_ => np.s ! NPAcc} rnp ;
Base_rn_RNP rnp np = twoTable Agr rnp {s = \\_ => np.s ! NPAcc} ;
Cons_rr_RNP = consrTable Agr comma ;
Cons_nr_RNP np rnps = consrTable Agr comma {s = \\_ => np.s ! NPAcc} rnps ;
lin GenModNP num np cn = heavyNP {
s = \\c => np.s ! NPNom ++ "se" ++ cn.s ! Strong ! NF num.n Nom ;
a = agrP3 num.n
} ;
ComplBareVS v s = insertExtrapos (s.s ! Sub) (predV v) ;
CompoundN n1 n2 = {
s = \\f => n1.s ! NF Sg Nom ++ BIND ++ n2.s ! f ;
g = n2.g
} ;
CompoundAP noun adj = {
s = \\af => noun.s ! NF Sg Nom ++ BIND ++ adj.s ! Posit ! af ;
isPre = True
} ;
PresPartAP vp = {
s = \\_ => "wat" ++ (mkClause [] (agrP3 Sg) vp).s ! Pres ! Simul ! Pos ! Sub ;
isPre = False
} ;
PastPartAP vp = {
s = \\_ => partVP vp (agrP3 Sg) ;
isPre = True
} ;
PastPartAgentAP vp np = {
s = \\_ => partVP vp (agrP3 Sg) ++ "door" ++ np.s ! NPAcc ;
isPre = False
} ;
ProgrVPSlash vp = vp ;
GerundCN vp = {
s = \\_,_ => infVPString vp (agrP3 Sg) ;
g = Neutr
} ;
GerundNP vp = heavyNP {
s = \\_ => infVPString vp (agrP3 Sg) ;
a = agrP3 Sg
} ;
GerundAdv vp = {s = "door" ++ infVPString vp (agrP3 Sg)} ;
ByVP vp = {s = "door" ++ infVPString vp (agrP3 Sg)} ;
InOrderToVP vp = {s = "om" ++ infVPString vp (agrP3 Sg)} ;
ApposNP np1 np2 = heavyNP {
s = \\c => np1.s ! c ++ "," ++ np2.s ! c ;
a = np1.a
} ;
PositAdVAdj a = {s = a.s ! Posit ! APred} ;
UttVPShort vp = {s = vp.s.s ! VInf ++ vp.n2 ! agrP3 Sg ++ vp.a2} ;
ComplSlashPartLast vps np = insertObjNP np.isPron
(\\_ => np.s ! NPAcc ++ vps.c2) (vps ** {c2 = []}) ;
UseDAP dap = heavyNP {
s = \\_ => dap.sp ! Neutr ;
a = agrP3 dap.n
} ;
UseDAPMasc = UseDAP ;
UseDAPFem = UseDAP ;
lincat [Comp] = {s1,s2 : Agr => Str} ;
lin BaseComp = twoTable Agr ;
ConsComp = consrTable Agr comma ;
ConjComp = conjunctDistrTable Agr ;
lincat [Imp] = {s1,s2 : Polarity => ImpForm => Str} ;
lin BaseImp = twoTable2 Polarity ImpForm ;
ConsImp = consrTable2 Polarity ImpForm comma ;
ConjImp = conjunctDistrTable2 Polarity ImpForm ;
-- KA: guessed from PassV2 in Afrikaans and the equivalents in Dutch -- KA: guessed from PassV2 in Afrikaans and the equivalents in Dutch
lin PassVPSlash vps = lin PassVPSlash vps =
@@ -12,4 +157,17 @@ lin PassVPSlash vps =
PassAgentVPSlash vps np = PassAgentVPSlash vps np =
insertAdv (appPrep "door" np.s) (insertInf (vps.s.s ! VPerf) (predV word_V)) ; insertAdv (appPrep "door" np.s) (insertInf (vps.s.s ! VPerf) (predV word_V)) ;
oper
infVPString : ResAfr.VP -> Agr -> Str = \vp,a ->
"om" ++ vp.n0 ! a ++ vp.n2 ! a ++ vp.a2 ++ "te" ++
vp.s.s ! VInf ++ vp.inf.p1 ++ vp.ext ;
partVP : ResAfr.VP -> Agr -> Str = \vp,a ->
vp.s.s ! VPerf ++ vp.n0 ! a ++ vp.n2 ! a ++ vp.a2 ++ vp.inf.p1 ++ vp.ext ;
reflPossDet : Agr -> Str = \a -> case <a.n,a.p> of {
<Sg,P1> => "my" ; <Sg,P2> => "jou" ; <Sg,P3> => "sy" ;
<Pl,P1> => "ons" ; <Pl,P2> => "julle" ; <Pl,P3> => "hulle"
} ;
} }
+22
View File
@@ -20,6 +20,10 @@ concrete IdiomAfr of Idiom = CatAfr **
(insertObj (\\_ => np.s ! NPNom) (insertObj (\\_ => np.s ! NPNom)
(predV zijn_V)) ; (predV zijn_V)) ;
ExistNPAdv np adv =
mkClause "daar" (agrP3 np.a.n)
(insertAdv adv.s (insertObj (\\_ => np.s ! NPNom) (predV zijn_V))) ;
ExistIP ip = { ExistIP ip = {
s = \\t,a,p => s = \\t,a,p =>
let let
@@ -32,6 +36,24 @@ concrete IdiomAfr of Idiom = CatAfr **
} }
} ; } ;
ExistIPAdv ip adv = {
s = \\t,a,p =>
let cls = (mkClause "daar" (agrP3 ip.n)
(insertAdv adv.s (predV zijn_V))).s ! t ! a ! p ;
who = ip.s ! NPNom
in table {
QDir => who ++ cls ! Inv ;
QIndir => who ++ cls ! Sub
}
} ;
SelfAdvVP vp = insertAdv (reflPron ! agrP3 Sg) vp ;
SelfAdVVP vp = insertAdV (reflPron ! agrP3 Sg) vp ;
SelfNP np = heavyNP {
s = \\c => np.s ! c ++ reflPron ! np.a ;
a = np.a
} ;
ProgrVP vp = insertAdv ("aan" ++ "die" ++ useInfVP True vp) (predV zijn_V) ; --afr ProgrVP vp = insertAdv ("aan" ++ "die" ++ useInfVP True vp) (predV zijn_V) ; --afr
ImpPl1 vp = ImpPl1 vp =
+1
View File
@@ -3,5 +3,6 @@
concrete LangAfr of Lang = concrete LangAfr of Lang =
GrammarAfr, GrammarAfr,
LexiconAfr LexiconAfr
,ConstructionAfr
,DocumentationAfr --# notpresent ,DocumentationAfr --# notpresent
; ;
+29
View File
@@ -39,6 +39,11 @@ concrete NounAfr of Noun = CatAfr ** open ResAfr, Prelude in {
a = np.a a = np.a
} ; } ;
ExtAdvNP np adv = heavyNP {
s = \\c => np.s ! c ++ "," ++ adv.s ++ "," ;
a = np.a
} ;
DetQuantOrd quant num ord = DetQuantOrd quant num ord =
let let
n = num.n ; n = num.n ;
@@ -173,6 +178,30 @@ concrete NounAfr of Noun = CatAfr ** open ResAfr, Prelude in {
g = cn.g g = cn.g
} ; } ;
PossNP cn np = {
s = \\a,nc => cn.s ! a ! nc ++ "van" ++ np.s ! NPNom ;
g = cn.g
} ;
PartNP cn np = {
s = \\a,nc => cn.s ! a ! nc ++ "van" ++ np.s ! NPAcc ;
g = cn.g
} ;
CountNP det np = heavyNP {
s = \\c => det.s ! Neutr ++ "van" ++ np.s ! c ;
a = agrP3 det.n
} ;
DetDAP det = det ;
AdjDAP dap ap = {
s = \\g => dap.s ! g ++ ap.s ! AAttr ;
sp = \\g => dap.sp ! g ++ ap.s ! AAttr ;
n = dap.n ;
a = dap.a
} ;
ApposCN cn np = let g = cn.g in { ApposCN cn np = let g = cn.g in {
s = \\a,nc => cn.s ! a ! nc ++ np.s ! NPNom ; s = \\a,nc => cn.s ! a ! nc ++ np.s ! NPNom ;
g = g ; g = g ;
+31
View File
@@ -40,18 +40,49 @@ lin
pot1plus d e = addAttr {s = \\g => pot1plus d e = addAttr {s = \\g =>
e.s ! DUnit ! invNum ++ BIND ++ e.en ++ BIND ++ d.s ! DTen ! g ; n = Pl} ; e.s ! DUnit ! invNum ++ BIND ++ e.en ++ BIND ++ d.s ! DTen ! g ; n = Pl} ;
pot1as2 n = n ; pot1as2 n = n ;
pot21 = addAttr {s = cardOrd "honderd" "honderdste" ; n = Pl} ;
pot2 d = pot2 d =
addAttr {s = \\g => d.attr ++ cardOrd "honderd" "honderdste" ! g ; n = Pl} ; addAttr {s = \\g => d.attr ++ cardOrd "honderd" "honderdste" ! g ; n = Pl} ;
pot2plus d e = pot2plus d e =
addAttr {s = \\g => d.attr ++ "honderd" ++ BIND ++ e.s ! g ; n = Pl} ; addAttr {s = \\g => d.attr ++ "honderd" ++ BIND ++ e.s ! g ; n = Pl} ;
pot2as3 n = n ; pot2as3 n = n ;
pot31 = addAttr {s = cardOrd "duisend" "duisendste" ; n = Pl} ;
pot3 n = pot3 n =
addAttr {s = \\g => n.attr ++ cardOrd "duisend" "duisendste" ! g ; n = Pl} ; addAttr {s = \\g => n.attr ++ cardOrd "duisend" "duisendste" ! g ; n = Pl} ;
pot3plus n m = pot3plus n m =
addAttr {s = \\g => n.attr ++ "duisend" ++ m.s ! g ; n = Pl} ; addAttr {s = \\g => n.attr ++ "duisend" ++ m.s ! g ; n = Pl} ;
pot3as4 n = n ; pot3as4 n = n ;
pot3decimal d = addAttr {s = d.s ; n = d.n} ;
pot41 = addAttr {s = cardOrd "een miljoen" "miljoenste" ; n = Pl} ;
pot4 n = addAttr {
s = \\g => n.s ! invNum ++ cardOrd "miljoen" "miljoenste" ! g ;
n = Pl
} ;
pot4plus n m = addAttr {
s = \\g => n.s ! invNum ++ "miljoen" ++ m.s ! g ;
n = Pl
} ;
pot4as5 n = n ; pot4as5 n = n ;
pot4decimal d = addAttr {
s = \\g => d.s ! invNum ++ cardOrd "miljoen" "miljoenste" ! g ;
n = Pl
} ;
pot51 = addAttr {s = cardOrd "een miljard" "miljardste" ; n = Pl} ;
pot5 n = addAttr {
s = \\g => n.s ! invNum ++ cardOrd "miljard" "miljardste" ! g ;
n = Pl
} ;
pot5plus n m = addAttr {
s = \\g => n.s ! invNum ++ "miljard" ++ m.s ! g ;
n = Pl
} ;
pot5decimal d = addAttr {
s = \\g => d.s ! invNum ++ cardOrd "miljard" "miljardste" ! g ;
n = Pl
} ;
lincat lincat
Dig = TDigit ; Dig = TDigit ;
+12
View File
@@ -275,6 +275,18 @@ oper
oper
mkAdV : Str -> AdV = \s -> lin AdV {s=s} ;
mkAdA : Str -> AdA = \s -> lin AdA {s=s} ;
mkAdN : Str -> AdN = \s -> lin AdN {s=s} ;
mkACard : Str -> ACard = \s -> lin ACard {s=s} ;
mkCard : Str -> Number -> Card = \s,n -> lin Card {s=\\_,_=>s; n=n} ;
mkConj : Str -> Number -> Conj = \s,n -> lin Conj {s1=[]; s2=s; n=n} ;
mkSubj : Str -> Subj = \s -> lin Subj {s=s} ;
mkIDet : Str -> Number -> IDet = \s,n -> lin IDet {s=\\_=>s; n=n} ;
mkIQuant : Str -> IQuant = \s -> lin IQuant {s=\\_,_=>s} ;
mkCAdv : Str -> CAdv = \s -> lin CAdv {s=s; p=[]} ;
mkIAdv : Str -> IAdv = \s -> lin IAdv {s=s} ;
----2 Definitions of paradigms ----2 Definitions of paradigms
+1 -1
View File
@@ -480,7 +480,7 @@ param
infVP : Bool -> VP -> ((Agr => Str) * Str * Str) = \isAux, vp -> infVP : Bool -> VP -> ((Agr => Str) * Str * Str) = \isAux, vp ->
< <
\\agr => vp.n0 ! agr ++ vp.n2 ! agr ++ vp.a2, \\agr => vp.n0 ! agr ++ vp.n2 ! agr ++ vp.a2,
vp.a1 ! Pos ++ vp.a1 ! Pos ++
if_then_Str isAux [] "om" ++ "te" ++ vp.s.s ! VInf, if_then_Str isAux [] "om" ++ "te" ++ vp.s.s ! VInf,
vp.inf.p1 ++ vp.ext vp.inf.p1 ++ vp.ext
> ; > ;
+10
View File
@@ -62,6 +62,16 @@ concrete SentenceAfr of Sentence = CatAfr ** open ResAfr, Prelude in {
AdvS a s = {s = \\o => a.s ++ s.s ! Inv} ; AdvS a s = {s = \\o => a.s ++ s.s ! Inv} ;
ExtAdvS a s = {s = \\o => a.s ++ "," ++ s.s ! Inv} ;
SSubjS s1 subj s2 = {
s = \\o => s1.s ! o ++ "," ++ subj.s ++ s2.s ! Sub
} ;
AdvImp adv imp = {
s = \\p,i => adv.s ++ imp.s ! p ! i
} ;
RelS s r = {s = \\o => s.s ! o ++ "," ++ r.s ! Neutr ! Sg} ; RelS s r = {s = \\o => s.s ! o ++ "," ++ r.s ! Neutr ! Sg} ;
} }
+6
View File
@@ -78,8 +78,14 @@ concrete VerbAfr of Verb = CatAfr ** open Prelude, ResAfr in {
CompAdv a = {s = \\_ => a.s} ; CompAdv a = {s = \\_ => a.s} ;
AdvVP vp adv = insertAdv adv.s vp ; AdvVP vp adv = insertAdv adv.s vp ;
ExtAdvVP vp adv = insertAdv ("," ++ adv.s ++ ",") vp ;
AdVVP adv vp = insertAdV adv.s vp ; AdVVP adv vp = insertAdV adv.s vp ;
AdvVPSlash vp adv = vp ** {a2 = vp.a2 ++ adv.s} ;
AdVVPSlash adv vp = vp ** {a1 = \\a => adv.s ++ vp.a1 ! a} ;
VPSlashPrep vp prep = vp ** {c2 = prep.s} ;
ReflVP vp = insertObj (\\a => appPrep vp.c2 (\\_ => reflPron ! a )) vp ; ReflVP vp = insertObj (\\a => appPrep vp.c2 (\\_ => reflPron ! a )) vp ;
PassV2 v = insertInf (v.s ! VPerf) (predV word_V) ; PassV2 v = insertInf (v.s ! VPerf) (predV word_V) ;