1
0
forked from GitHub/gf-rgl

Merge branch 'master' into reflexiveNPs

This commit is contained in:
Hans Leiss
2022-07-16 13:20:31 +02:00
131 changed files with 46289 additions and 1515 deletions

View File

@@ -27,6 +27,7 @@ Jpn,Japanese,japanese,,,,,,,,y
Kor,Korean,korean,,,n,y,y,y,n,n
Lat,Latin,latin,,,,,y,y,n,y
Lav,Latvian,latvian,,,,,,,y,y
May,Malay,malay,,,y,,,,n,y
Mlt,Maltese,maltese,,,,,,,,y
Mon,Mongolian,mongolian,,,,,,n,,y
Nep,Nepali,nepali,,,,,,n,,y
1 Code Name Directory Functor Unlexer Present All Try Symbolic Compatibility Synopsis
27 Kor Korean korean n y y y n n
28 Lat Latin latin y y n y
29 Lav Latvian latvian y y
30 May Malay malay y n y
31 Mlt Maltese maltese y
32 Mon Mongolian mongolian n y
33 Nep Nepali nepali n y

View File

@@ -185,7 +185,7 @@ concrete ExtendEng of Extend =
mkVPS : Temp -> Pol -> VP -> VPS = \t,p,vp -> lin VPS {
s = \\o,a =>
let
verb = vp.s ! t.t ! t.a ! p.p ! o ! a ; -- choice of Order determines aux or not
verb = mkVerbForms a vp ! t.t ! t.a ! p.p ! o ! a ; -- choice of Order determines aux or not
compl = vp.s2 ! a ++ vp.ext
in {fin = verb.aux ++ t.s ++ p.s ;
inf = verb.adv ++ vp.ad ! a ++ verb.fin ++ verb.inf ++ vp.p ++ compl} ;
@@ -288,16 +288,12 @@ lin BaseImp = twoTable2 CPolarity ImpForm ;
let
be = predAux auxBe ;
ppt = vps.ptp
in {
s = be.s ;
p = [] ;
prp = be.prp ;
ptp = be.ptp ;
inf = be.inf ;
ad = \\_ => [] ;
s2 = \\a => vps.ad ! a ++ ppt ++ vps.p ++ vps.s2 ! a ++ ag ++ vps.c2 ; ---- place of agent
isSimple = False ;
ext = vps.ext
in be ** {
p = [] ;
ad = \\_ => [] ;
s2 = \\a => vps.ad ! a ++ ppt ++ vps.p ++ vps.s2 ! a ++ ag ++ vps.c2 ; ---- place of agent
isSimple = False ;
ext = vps.ext
} ;
lin

View File

@@ -75,7 +75,7 @@ concrete ExtraEng of ExtraEngAbs = CatEng **
MkVPS t p vp = {
s = \\a =>
let
verb = vp.s ! t.t ! t.a ! p.p ! oDir ! a ;
verb = mkVerbForms a vp ! t.t ! t.a ! p.p ! oDir ! a ;
verbf = verb.aux ++ verb.adv ++ verb.fin ++ verb.inf ;
in t.s ++ p.s ++ vp.ad ! a ++ verbf ++ vp.p ++ vp.s2 ! a ++ vp.ext
} ;
@@ -180,17 +180,13 @@ lin
let
be = predAux auxBe ;
ppt = vps.ptp
in {
s = be.s ;
p = [] ;
prp = be.prp ;
ptp = be.ptp ;
inf = be.inf ;
ad = \\_ => [] ;
s2 = \\a => vps.ad ! a ++ ppt ++ vps.p ++ vps.s2 ! a ++ ag ++ vps.c2 ; ---- place of agent
isSimple = False ;
ext = vps.ext
} ;
in be ** {
p = [] ;
ad = \\_ => [] ;
s2 = \\a => vps.ad ! a ++ ppt ++ vps.p ++ vps.s2 ! a ++ ag ++ vps.c2 ; ---- place of agent
isSimple = False ;
ext = vps.ext
} ;
lin
PassVPSlash vps = passVPSlash vps [] ;
@@ -242,7 +238,7 @@ lin
let
subj = np.s ! npNom ;
agr = np.a ;
verb = vp.s ! t ! a ! b ! o ! agr ;
verb = mkVerbForms agr vp ! t ! a ! b ! o ! agr ;
compl = vp.s2 ! agr
in
case o of {
@@ -256,7 +252,7 @@ lin
let
subj = np.s ! npNom ;
agr = np.a ;
verb = vp.s ! t ! a ! b ! o ! agr ;
verb = mkVerbForms agr vp ! t ! a ! b ! o ! agr ;
compl = vp.s2 ! agr
in
case o of {

View File

@@ -44,4 +44,3 @@ concrete IdiomEng of Idiom = CatEng ** open Prelude, ResEng in {
} ;
}

View File

@@ -159,12 +159,12 @@ param
s = table {
AAdj Posit c => adjCompar.s ! AAdj Posit c ;
AAdv => adjCompar.s ! AAdv ;
_ => nonExist } ; -- IL 06/2021. Replace with an actual string, if this causes problems.
_ => nonExist } ; -- IL 2021-06. Replace with an actual string, if this causes problems.
isMost = True } ;
_ => adjCompar
} ;
-- IL 06/2021: remove "more" and "most" from A & A2's inflection table
-- IL 2021-06: remove "more" and "most" from A & A2's inflection table
getCompar : Case -> Adjective -> Str = \c,a -> case a.isMost of {
True => "more" ++ a.s ! AAdj Posit c ;
False => a.s ! AAdj Compar c
@@ -252,18 +252,59 @@ param
Tense => Anteriority => CPolarity => Order => Agr =>
{aux, adv, fin, inf : Str} ; -- would, not, sleeps, slept
VP : Type = {
s : VerbForms ;
p : Str ; -- verb particle
prp : Str ; -- present participle
ptp : Str ; -- past participle
inf : Str ; -- the infinitive form ; VerbForms would be the logical place
ad : Agr => Str ; -- sentence adverb (can be Xself, hence Agr)
s2 : Agr => Str ; -- complement
ext : Str ; -- extreposed field such as S, QS, VP
isSimple : Bool -- regulates the place of participle used as adjective
} ;
{- IL 2022-04: reduce the fields in VP and make the grammar better suited for morphological analysis
All verbs except auxiliaries only need 6 forms inside VP, and other forms can be built in PredVP.
Auxiliaries need more forms. So we make VP an extension of Aux, and add a parameter that tells
which strategy to use when building a Cl: use the 4 forms, or use the fields in Aux.
(If we treat auxiliaries as normal verbs, we get "you don't be __" for "you aren't __".)
If we didn't care about morphological lexicon, we could just fill the Aux fields for all verbs:
morphologically distinct forms like "can't" for auxiliaries, and periphrastic constructions
like "doesn't sing/eat/play" for other verbs. However, then morphologically analysing the word
"doesn't" returns every single function that constructs a VP, which clutters morpho analysis.
So we use two sets of fields and a parameter for which strategy to choose in PredVP. This results
in significantly fewer fields than previously, and is better for morphological analysis.
-}
VP : Type = {
-- The common parts
p : Str ; -- verb particle
ad : Agr => Str ; -- sentence adverb (can be Xself, hence Agr)
s2 : Agr => Str ; -- complement
ext : Str ; -- extreposed field such as S, QS, VP
prp : Str ; -- present participle
ptp : Str ; -- past participle
inf : Str ; -- the infinitive form
isSimple : Bool ; -- regulates the place of participle used as adjective
-- The variable parts, depending on whether the main verb of the VP is auxiliary or not
isAux : Bool ;
auxForms : { -- nonExist when isAux=False
past, --# notpresent
contr,
pres : Polarity => Agr => Str ;
} ;
nonAuxForms : { -- nonExist when isAux=True
pres : Agr => Str ; -- sing/sings ; can be streamlined into two forms if needed
past : Str ; --# notpresent
}
} ;
-- called from mkClause, when we finally put together all forms for a Cl
mkVerbForms : Agr -> VP -> VerbForms = \agr,vp -> case vp.isAux of {
True =>
let aux : Aux = vp.auxForms ** {
inf = vp.inf ;
ppart = vp.ptp ;
prpart = vp.prp } ;
in auxVerbForms aux ;
False =>
let fin : Str = vp.nonAuxForms.pres ! agr ;
inf : Str = vp.inf ;
part : Str = vp.ptp ;
in nonAuxVerbForms fin inf part
vp.nonAuxForms.past --# notpresent
} ;
SlashVP = VP ** {c2 : Str ;
gapInMiddle : Bool;
@@ -276,20 +317,57 @@ param
cBind : Str -> Str = \s -> Predef.BIND ++ ("'" + s) ;
predV : Verb -> VP = \verb -> {
s = \\t,ant,b,ord,agr =>
let
inf = verb.s ! VInf ;
fin = presVerb verb agr ;
part = verb.s ! VPPart ;
in
case <t,ant,b,ord> of {
p = verb.p ; -- Common to all verbs
prp = verb.s ! VPresPart ;
ptp = verb.s ! VPPart ;
inf = verb.s ! VInf ;
ad = \\_ => [] ;
ext = [] ;
isSimple = True ; ---- but really depends on whether p == []
s2 = \\a => if_then_Str verb.isRefl (reflPron ! a) [] ;
isAux = False ; -- Specific to non-Aux verbs
auxForms = {
contr,
past, --# notpresent
pres = \\_,_ => nonExist} ;
nonAuxForms = {
pres = \\agr => presVerb verb agr ;
past = verb.s ! VPast ; --# notpresent
}
} ;
predAux : Aux -> VP = \aux -> {
p = [] ; -- Common to all verbs
prp = aux.prpart ;
ptp = aux.ppart ;
inf = aux.inf ;
ad = \\_ => [] ;
ext = [] ;
isSimple = True ;
s2 = \\_ => [] ;
isAux = True ; -- Specific to Aux verbs
auxForms = aux ;
nonAuxForms = {
past = nonExist ; --# notpresent
pres = \\_ => nonExist}
} ;
nonAuxVerbForms : (fin,inf,part : Str) ->
(past : Str) -> --# notpresent
VerbForms = \fin,inf,part
,past --# notpresent
->
\\tns,ant,pol,ord,agr =>
case <tns,ant,pol,ord> of {
<Pres,Simul,CPos,ODir _> => vff fin [] ;
<Pres,Simul,CPos,OQuest> => vf (does agr) inf ;
<Pres,Anter,CPos,ODir True> => vf (haveContr agr) part ; --# notpresent
<Pres,Anter,CPos,_> => vf (have agr) part ; --# notpresent
<Pres,Anter,CNeg c,ODir True> => vfn c (haveContr agr) (haventContr agr) part ; --# notpresent
<Pres,Anter,CNeg c,_> => vfn c (have agr) (havent agr) part ; --# notpresent
<Past,Simul,CPos,ODir _> => vff (verb.s ! VPast) [] ; --# notpresent
<Past,Simul,CPos,ODir _> => vff past [] ; --# notpresent
<Past,Simul,CPos,OQuest> => vf "did" inf ; --# notpresent
<Past,Simul,CNeg c,_> => vfn c "did" "didn't" inf ; --# notpresent
<Past,Anter,CPos,ODir True> => vf (cBind "d") part ; --# notpresent
@@ -314,18 +392,9 @@ param
<Cond,Anter,CNeg c,_> => vfn c "would" "wouldn't" ("have" ++ part) ; --# notpresent
<Pres,Simul,CNeg c,_> => vfn c (does agr) (doesnt agr) inf
} ;
p = verb.p ;
prp = verb.s ! VPresPart ;
ptp = verb.s ! VPPart ;
inf = verb.s ! VInf ;
ad = \\_ => [] ;
ext = [] ;
isSimple = True ; ---- but really depends on whether p == []
s2 = \\a => if_then_Str verb.isRefl (reflPron ! a) []
} ;
predAux : Aux -> VP = \verb -> {
s = \\t,ant,cb,ord,agr =>
auxVerbForms : Aux -> VerbForms = \verb ->
\\t,ant,cb,ord,agr =>
let
b = case cb of {
CPos => Pos ;
@@ -371,17 +440,7 @@ param
<Pres,Simul,CPos, _> => vf fin [] ;
<Pres,Simul,CNeg c,ODir True> => vfn c cfinp fin [] ;
<Pres,Simul,CNeg c, _> => vfn c finp fin []
} ;
p = [] ;
prp = verb.prpart ;
ptp = verb.ppart ;
inf = verb.inf ;
ad = \\_ => [] ;
ext = [] ;
isSimple = True ;
s2 = \\_ => []
} ;
} ;
vff : Str -> Str -> {aux, adv, fin, inf : Str} = \x,y ->
{aux = [] ; adv = [] ; fin = x ; inf = y} ;
@@ -395,7 +454,7 @@ param
False => {aux = x ; adv = "not" ; fin = [] ; inf = z}
} ;
{- IL 24/04/2018 To fix scope of reflexives:
{- IL 2018-04 To fix scope of reflexives:
a) ComplSlash ( … ReflVP … ) X: reflexive should agree with X
LangEng> l PredVP (UsePron i_Pron) (ComplSlash (SlashV2V beg_V2V (ReflVP (SlashV2a like_V2))) (UsePron he_Pron))
I beg him to like /himself/
@@ -421,42 +480,22 @@ param
insertExtra obj vp ** {c2 = vp.c2 ; gapInMiddle = vp.gapInMiddle ; missingAdv = vp.missingAdv } ;
--- AR 7/3/2013 move the particle after the object
insertObjPartLast : (Agr => Str) -> VP -> VP = \obj,vp -> {
s = vp.s ;
insertObjPartLast : (Agr => Str) -> VP -> VP = \obj,vp -> vp ** {
p = [] ; -- remove particle from here
prp = vp.prp ;
ptp = vp.ptp ;
inf = vp.inf ;
ad = vp.ad ;
s2 = \\a => obj ! a ++ vp.s2 ! a ++ vp.p ; -- and put it here ; corresponds to insertObjPre
isSimple = False ;
ext = vp.ext
} ;
--- The adverb should be before the finite verb.
insertAdV : Str -> VP -> VP = \ad -> insertAdVAgr (\\_ => ad) ;
insertAdVAgr : (Agr => Str) -> VP -> VP = \ad,vp -> {
s = vp.s ;
p = vp.p ;
prp = vp.prp ;
ptp = vp.ptp ;
inf = vp.inf ;
insertAdVAgr : (Agr => Str) -> VP -> VP = \ad,vp -> vp ** {
ad = \\a => vp.ad ! a ++ ad ! a ;
s2 = \\a => vp.s2 ! a ;
isSimple = False ;
ext = vp.ext
} ;
insertExtra : Str -> VP -> VP = \e,vp -> {
s = vp.s ;
p = vp.p ;
prp = vp.prp ;
ptp = vp.ptp ;
inf = vp.inf ;
ad = vp.ad ;
s2 = vp.s2 ;
insertExtra : Str -> VP -> VP = \e,vp -> vp ** {
isSimple = False ;
ext = vp.ext ++ e --- there should be at most one, one might think; but: I would say that it will be raining if I saw clouds
} ;
@@ -523,7 +562,7 @@ param
haveContr = agrVerb (cBind "s") (cBind "ve") ;
haventContr = agrVerb (cBind "s not") (cBind "ve not") ;
Aux = {
Aux : Type = {
pres : Polarity => Agr => Str ;
contr : Polarity => Agr => Str ; -- contracted forms
past : Polarity => Agr => Str ; --# notpresent
@@ -589,7 +628,7 @@ param
\subj,agr,vp -> {
s = \\t,a,b,o =>
let
verb = vp.s ! t ! a ! b ! o ! agr ;
verb = mkVerbForms agr vp ! t ! a ! b ! o ! agr ;
compl = vp.s2 ! agr ++ vp.ext
in
case o of {

View File

@@ -11,15 +11,15 @@ concrete AdjectiveEst of Adjective = CatEst ** open ResEst, Prelude in {
} ;
ComparA a np = {
s = \\isMod,af => case isMod of {
True => np.s ! NPCase Elat ++ a.s ! Compar ! AN af ; -- minust suurem
_ => a.s ! Compar ! AN af ++ "kui" ++ np.s ! NPCase Nom -- suurem kui mina
True => linNP (NPCase Elat) np ++ a.s ! Compar ! AN af ; -- minust suurem
_ => a.s ! Compar ! AN af ++ "kui" ++ linNP (NPCase Nom) np -- suurem kui mina
} ;
infl = Regular ; --a.infl
} ;
CAdvAP ad ap np = {
s = \\m,af => ad.s ++ ap.s ! m ! af ++ ad.p ++ np.s ! NPCase Nom ;
infl = ap.infl
s = \\m,af => ad.s ++ ap.s ! m ! af ++ ad.p ++ linNP (NPCase Nom) np ;
infl = ap.infl
} ;
UseComparA a = {
s = \\_,nf => a.s ! Compar ! AN nf ;
@@ -34,14 +34,14 @@ concrete AdjectiveEst of Adjective = CatEst ** open ResEst, Prelude in {
ComplA2 adj np = {
s = \\isMod,af =>
s = \\isMod,af =>
preOrPost isMod (appCompl True Pos adj.c2 np) (adj.s ! Posit ! AN af) ;
infl = adj.infl
} ;
ReflA2 adj = {
s = \\isMod,af =>
preOrPost isMod
s = \\isMod,af =>
preOrPost isMod
(appCompl True Pos adj.c2 (reflPron (agrP3 Sg))) (adj.s ! Posit ! AN af) ;
infl = adj.infl
} ;

View File

@@ -5,13 +5,13 @@ concrete AdverbEst of Adverb = CatEst ** open ResEst, Prelude in {
lin
PositAdvAdj a = {s = a.s ! Posit ! AAdv} ;
ComparAdvAdj cadv a np = {
s = cadv.s ++ a.s ! Posit ! AAdv ++ cadv.p ++ np.s ! NPCase Nom
s = cadv.s ++ a.s ! Posit ! AAdv ++ cadv.p ++ linNP (NPCase Nom) np
} ;
ComparAdvAdjS cadv a s = {
s = cadv.s ++ a.s ! Posit ! AAdv ++ cadv.p ++ s.s
} ;
PrepNP prep np = {s = preOrPost prep.isPre prep.s (np.s ! prep.c)} ;
PrepNP prep np = {s = appCompl True Pos prep np} ;
AdAdv = cc2 ;

View File

@@ -1,6 +1,6 @@
--# -path=.:../abstract:../common:../prelude:../api
concrete AllEst of AllEstAbs =
concrete AllEst of AllEstAbs =
LangEst, -- - [SlashV2VNP,SlashVV, TFut], ---- to speed up linking; to remove spurious parses
ExtendEst -- - [ProDrop, ProDropPoss, S_OSV, S_VSO, S_ASV] -- to exclude spurious parses
**

View File

@@ -1,4 +1,4 @@
abstract AllEstAbs =
abstract AllEstAbs =
Lang,
ExtraEstAbs
Extend
** {} ;

View File

@@ -20,43 +20,38 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in {
-- Question
QCl = {s : ResEst.Tense => Anteriority => Polarity => Str} ;
IP = {s : NPForm => Str ; n : Number} ;
IComp = {s : Agr => Str} ;
IDet = {s : Case => Str ; n : Number ; isNum : Bool} ;
IP = ResEst.IPhrase ;
IComp = {s : Agr => Str} ;
IDet = ResEst.IDeterminer ;
IQuant = {s : Number => Case => Str} ;
-- Relative
RCl = {s : ResEst.Tense => Anteriority => Polarity => Agr => Str ; c : NPForm} ;
RP = {s : Number => NPForm => Str ; a : RAgr} ;
RP = ResEst.RelPron ;
-- Verb
VP = ResEst.VP ;
VPSlash = ResEst.VP ** {c2 : Compl} ;
Comp = {s : Agr => Str} ;
VPSlash = ResEst.VP ** {c2 : Compl} ;
Comp = {s : Agr => Str} ;
-- Adjective
-- The $Bool$ in s tells whether usage is modifying (as opposed to
-- predicative), e.g. "x on suurem kui y" vs. "y:st suurem arv".
-- The $Infl$ in infl tells whether the adjective inflects as a
-- The $Infl$ in infl tells whether the adjective inflects as a
-- modifier: e.g. "väsinud mehele" vs. "mees muutus väsinuks".
AP = {s : Bool => NForm => Str ; infl : Infl} ;
AP = ResEst.APhrase ;
-- Noun
CN = {s : NForm => Str} ;
CN = ResEst.CNoun ;
Pron = {s : NPForm => Str ; a : Agr} ;
NP = {s : NPForm => Str ; a : Agr ; isPron : Bool} ;
Det = {
s : Case => Str ; -- minun kolme
sp : Case => Str ; -- se (substantival form)
n : Number ; -- Pl (agreement feature for verb)
isNum : Bool ; -- True (a numeral is present)
isDef : Bool -- True (verb agrees in Pl, Nom is not Part) --I: actually, can we get rid of this?
} ;
NP = ResEst.NPhrase ;
DAP, Det = ResEst.Determiner ;
---- QuantSg, QuantPl = {s : Case => Str ; isDef : Bool} ;
Ord = {s : NForm => Str} ;
Predet = {s : Number => NPForm => Str} ;
@@ -74,26 +69,37 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in {
Conj = {s1,s2 : Str ; n : Number} ;
----b DConj = {s1,s2 : Str ; n : Number} ;
Subj = {s : Str} ;
Prep = Compl ;
Prep = ResEst.Compl ;
-- Open lexical classes, e.g. Lexicon
V, VS, VQ = Verb1 ; -- = {s : VForm => Str ; sc : Case} ;
V2, VA, V2Q, V2S = Verb1 ** {c2 : Compl} ;
V2A = Verb1 ** {c2, c3 : Compl} ;
VV = Verb1 ** {vi : InfForm} ; ---- infinitive form
V2V = Verb1 ** {c2 : Compl ; vi : InfForm} ; ---- infinitive form
V3 = Verb1 ** {c2, c3 : Compl} ;
V, VS, VQ = ResEst.Verb1 ; -- = {s : VForm => Str ; sc : Case} ;
V2, VA, V2Q, V2S = ResEst.Verb2 ;
V2A, V3 = ResEst.Verb3 ;
VV = ResEst.Verb1 ** {vi : InfForms} ;
V2V = ResEst.Verb2 ** {vi : InfForms} ;
A = Adjective ** {infl : Infl} ;
A2 = A ** {c2 : Compl} ;
A = ResEst.Adjective ** {infl : Infl} ;
A2 = ResEst.Adjective ** {infl : Infl ; c2 : Compl} ;
N = Noun ;
N2 = Noun ** {c2 : Compl ; isPre : Bool ; lock_N2 : {}} ;
N3 = Noun ** {c2,c3 : Compl ; isPre,isPre2 : Bool ; lock_N3 : {}} ;
N = ResEst.Noun ;
N2 = ResEst.Noun ** {
postmod : Str ; -- postmod, because N2 can come from N3+complement via ComplN3
c2 : Compl ;
isPre : Bool} ;
N3 = ResEst.Noun ** { -- no postmod, because N3 can only come from lexical funs
c2,c3 : Compl ;
isPre,isPre2 : Bool
} ;
PN = {s : Case => Str} ;
oper Verb1 = Verb ** { sc : NPForm} ; --what is this for? --subject case, i.e. "ma näen kassi"/"mul on kass"
linref
VP = \vp -> linV vp.v ;
NP = linNP (NPCase Nom) ;
CN = linCN (NCase Sg Nom) ;
V,VS,VQ = linV ;
V2,VA,V2S,V2Q,V3 = linV2 ;
IDet = linIDet ;
}

View File

@@ -9,11 +9,12 @@ concrete ConjunctionEst of Conjunction =
ConjAdv = conjunctDistrSS ;
ConjCN = conjunctDistrTable NForm ;
ConjCN conj ss = conjunctDistrTable NForm conj ss ** ss ;
ConjNP conj ss = conjunctDistrTable NPForm conj ss ** {
a = conjAgr (Ag conj.n P3) ss.a ; -- P3 is the maximum
isPron = False
isPron = False ;
postmod = ss.postmod
} ;
ConjAP conj ss = conjunctDistrTableAdj conj ss ;
@@ -28,20 +29,20 @@ concrete ConjunctionEst of Conjunction =
ConsS = consrSS comma ;
BaseAdv = twoSS ;
ConsAdv = consrSS comma ;
BaseCN = twoTable NForm ;
ConsCN = consrTable NForm comma ;
BaseNP x y = twoTable NPForm x y ** {a = conjAgr x.a y.a} ;
ConsNP xs x = consrTable NPForm comma xs x ** {a = conjAgr xs.a x.a} ;
BaseCN x y = twoTable NForm (mergeCN x) y ** {postmod = y.postmod} ;
ConsCN x xs = consrTable NForm comma (mergeCN x) xs ** xs ;
BaseNP x y = twoTable NPForm (mergeNP x) y ** {a = conjAgr x.a y.a ; postmod = y.postmod} ;
ConsNP x xs = consrTable NPForm comma (mergeNP x) xs ** {a = conjAgr xs.a x.a ; postmod = xs.postmod} ;
BaseAP x y = twoTableAdj x y ;
ConsAP xs x = consrTableAdj comma x xs ;
ConsAP x xs = consrTableAdj comma x xs ;
BaseRS x y = twoTable Agr x y ** {c = y.c} ;
ConsRS xs x = consrTable Agr comma xs x ** {c = xs.c} ;
ConsRS x xs = consrTable Agr comma x xs ** {c = xs.c} ;
lincat
[S] = {s1,s2 : Str} ;
[Adv] = {s1,s2 : Str} ;
[CN] = {s1,s2 : NForm => Str} ;
[NP] = {s1,s2 : NPForm => Str ; a : Agr} ;
[CN] = {s1,s2 : NForm => Str ; postmod : Str} ;
[NP] = {s1,s2 : NPForm => Str ; a : Agr ; postmod : Str} ;
[AP] = {s1,s2 : {s : Bool => NForm => Str ; infl : Infl }} ;
[RS] = {s1,s2 : Agr => Str ; c : NPForm} ;
@@ -53,7 +54,7 @@ concrete ConjunctionEst of Conjunction =
s2 = y
} ;
consrTableAdj : Str -> [AP] -> {s : Bool => NForm => Str ; infl : Infl} -> [AP] = \c,xs,x ->
consrTableAdj : Str -> APhrase -> [AP] -> [AP] = \c,x,xs ->
let
ap1 = xs.s1 ;
ap2 = xs.s2
@@ -74,7 +75,6 @@ concrete ConjunctionEst of Conjunction =
} ;
infl = Regular } ;
s2 = x ;
lock_ListAP = <>
} ;
@@ -102,4 +102,7 @@ concrete ConjunctionEst of Conjunction =
infl = Regular
} ;
-- for CN and NP with discontinuous fields, put all stuff in s field
mergeNP : NPhrase -> NPhrase = \np -> np ** {s = \\c => linNP c np} ;
mergeCN : CNoun -> CNoun = \cn -> cn ** {s = \\nf => linCN nf cn} ;
}

View File

@@ -1,6 +1,6 @@
--# -path=alltenses:.:../abstract:../api:../common
concrete ConstructionEst of Construction = CatEst **
concrete ConstructionEst of Construction = CatEst **
open SyntaxEst, SymbolicEst, ParadigmsEst, (L = LexiconEst), (E = ExtraEst), (R = ResEst), Prelude in {
flags coding=utf8 ;
@@ -12,7 +12,7 @@ lin
ill_VP = mkVP (mkA "haige") ;
ready_VP = mkVP (ParadigmsEst.mkA "valmis") ;
has_age_VP card =
has_age_VP card =
let n_years_AdA : AdA = lin AdA (mkUtt (lin NP (mkNP <lin Card card : Card> L.year_N)))
in mkVP (mkAP n_years_AdA L.old_A) ;
@@ -25,19 +25,19 @@ lin
-- some more things
weather_adjCl ap = mkCl (mkVP (lin AP ap)) ;
is_right_VP = mkVP have_V2 (lin NP (mkNP (ParadigmsEst.mkN "õigus"))) ;
is_wrong_VP = mkVP (ParadigmsEst.mkV "eksima") ;
n_units_AP card cn a = mkAP (lin AdA (mkUtt (lin NP (mkNP <lin Card card : Card> (lin CN cn))))) (lin A a) ;
{-
glass_of_CN np = mkCN (lin N2 (mkN2 (mkN "klaas") (mkPrep partitive))) (lin NP np) | mkCN (lin N2 (mkN2 (mkN "klaasitäis") (mkPrep partitive))) (lin NP np) ;
glass_of_CN np = mkCN (lin N2 (mkN2 (mkN "klaas") (casePrep partitive))) (lin NP np) | mkCN (lin N2 (mkN2 (mkN "klaasitäis") (casePrep partitive))) (lin NP np) ;
where_go_QCl np = mkQCl (lin IAdv (ss "kuhu")) (mkCl np (mkVP L.go_V)) ;
where_come_from_QCl np = mkQCl (lin IAdv (ss "kust")) (mkCl np (mkVP L.come_V)) ;
go_here_VP = mkVP (mkVP L.go_V) (mkAdv "siia") ;
come_here_VP = mkVP (mkVP L.come_V) (mkAdv "siia") ;
come_from_here_VP = mkVP (mkVP L.come_V) (mkAdv "sealt") ;
@@ -61,16 +61,16 @@ lin
monthAdv m = SyntaxEst.mkAdv in_Prep (mkNP m) ;
yearAdv y = SyntaxEst.mkAdv (prePrep nominative "aastal") y ;
---- dayMonthAdv d m = ParadigmsEst.mkAdv (d.s ! R.NPCase R.Nom ++ BIND ++ "." ++ m.s ! R.NCase R.Sg R.Part) ;
---- dayMonthAdv d m = ParadigmsEst.mkAdv (d.s ! R.NPCase R.Nom ++ BIND ++ "." ++ m.s ! R.NCase R.Sg R.Part) ;
---- monthYearAdv m y = SyntaxEst.mkAdv in_Prep (mkNP (mkNP m) (SyntaxEst.mkAdv (casePrep nominative) y)) ;
---- dayMonthYearAdv d m y =
---- lin Adv {s = d.s ! R.NPCase R.Nom ++ BIND ++ "." ++ m.s ! R.NCase R.Sg R.Part ++ y.s ! R.NPCase R.Nom} ;
---- dayMonthYearAdv d m y =
---- lin Adv {s = d.s ! R.NPCase R.Nom ++ BIND ++ "." ++ m.s ! R.NCase R.Sg R.Part ++ y.s ! R.NPCase R.Nom} ;
intYear = symb ;
intMonthday = symb ;
oper
pointWeekday : Weekday -> Str = \w -> (SyntaxEst.mkAdv (casePrep essive) (mkNP w.noun)).s ;
pointWeekday : Weekday -> Str = \w -> (SyntaxEst.mkAdv (casePrep essive) (mkNP w.noun)).s ;
lincat Language = N ;
@@ -86,11 +86,11 @@ lin
oper mkLanguage : Str -> N = \s -> mkN (s ++ "keel") ;
oper mkWeekday : Str -> Weekday = \d ->
oper mkWeekday : Str -> Weekday = \d ->
lin Weekday {
noun = mkN d ;
noun = mkN d ;
habitual = ParadigmsEst.mkAdv (d + "iti") ; --kolmapäeviti
} ;
} ;
lin monday_Weekday = mkWeekday "esmaspäev" ;
@@ -101,9 +101,9 @@ lin friday_Weekday = mkWeekday "reede" ;
lin saturday_Weekday = mkWeekday "laupäev" ;
lin sunday_Weekday = mkWeekday "pühapäev" ;
lin january_Month = mkN "jaanuar" ;
lin january_Month = mkN "jaanuar" ;
lin february_Month = mkN "veebruar" ;
lin march_Month = mkN "märts" ;
lin march_Month = mkN "märts" ;
lin april_Month = mkN "aprill" ;
lin may_Month = mkN "mai" ;
lin june_Month = mkN "juuni" ;

View File

@@ -2,5 +2,5 @@
-- documentation of Estonian in Estonian: the default introduced in LangEst
concrete DocumentationEst of Documentation = CatEst **
concrete DocumentationEst of Documentation = CatEst **
DocumentationEstFunctor with (Terminology = TerminologyEst) ;

View File

@@ -2,5 +2,5 @@
-- documentation of Estonian in English
concrete DocumentationEstEng of Documentation = CatEst **
concrete DocumentationEstEng of Documentation = CatEst **
DocumentationEstFunctor with (Terminology = TerminologyEng) ;

View File

@@ -1,6 +1,6 @@
--# -path=.:../abstract:../common
incomplete concrete DocumentationEstFunctor of Documentation = CatEst ** open
incomplete concrete DocumentationEstFunctor of Documentation = CatEst ** open
Terminology, -- the interface
ResEst,
ParadigmsEst,
@@ -23,25 +23,31 @@ lincat
oper
heading : N -> Str = \n -> (nounHeading n).s ;
caseplus2nf : N -> ResEst.Number -> CasePlus -> Str = \noun,num,cas ->
noun.s ! NCase num cas.c ++ cas.suf ;
caseplus2af : (AForm => Str) -> ResEst.Number -> CasePlus -> Str = \adj,num,cas ->
adj ! AN (NCase num cas.c) ++ cas.suf ;
lin
InflectionN, InflectionN2, InflectionN3 = \noun -> {
t = "s" ;
s1 = heading1 (heading noun_Category) ;
s2 = inflNoun (\nf -> noun.s ! nf)
s2 = inflNoun (caseplus2nf noun)
} ;
InflectionA, InflectionA2 = \adj ->
InflectionA, InflectionA2 = \adj ->
let posit : (AForm => Str) = adj.s ! Posit ;
compar : (AForm => Str) = adj.s ! Compar ;
superl : (AForm => Str) = adj.s ! Superl ;
in
in
{ t = "a" ;
s1 = heading1 (heading adjective_Category) ;
s2 = inflNoun (\nf -> posit ! AN nf) ++
heading2 (heading comparative_Parameter) ++
inflNoun (\nf -> compar ! AN nf) ++
heading2 (heading superlative_Parameter) ++
inflNoun (\nf -> superl ! AN nf)
s2 = inflNoun (caseplus2af posit) ++
heading2 (heading comparative_Parameter) ++
inflNoun (caseplus2af compar) ++
heading2 (heading superlative_Parameter) ++
inflNoun (caseplus2af superl)
} ;
InflectionAdv, InflectionAdV, InflectionAdA, InflectionAdN = \adv -> {
@@ -58,91 +64,93 @@ lin
InflectionV v = {
t = "v" ;
s1 = heading1 (heading verb_Category) ++
s1 = heading1 (heading verb_Category) ++
paragraph (verbExample (S.mkCl S.she_NP v)) ;
s2 = inflVerb v
} ;
InflectionV2 v = {
t = "v" ;
s1 = heading1 (heading verb_Category) ++
s1 = heading1 (heading verb_Category) ++
paragraph (verbExample (S.mkCl S.she_NP v S.something_NP)) ;
s2 = inflVerb v
} ;
InflectionV3 v = {
t = "v" ;
s1 = heading1 (heading verb_Category) ++
s1 = heading1 (heading verb_Category) ++
paragraph (verbExample (S.mkCl S.she_NP v S.something_NP S.something_NP)) ;
s2 = inflVerb v
} ;
InflectionV2V v = {
t = "v" ;
s1 = heading1 (heading verb_Category) ++
s1 = heading1 (heading verb_Category) ++
paragraph (verbExample (S.mkCl S.she_NP v S.we_NP (S.mkVP (L.sleep_V)))) ;
s2 = inflVerb v
} ;
InflectionV2S v = {
t = "v" ;
s1 = heading1 (heading verb_Category) ++
s1 = heading1 (heading verb_Category) ++
paragraph (verbExample (S.mkCl S.she_NP v S.we_NP (lin S (ss "...")))) ;
s2 = inflVerb v
} ;
InflectionV2Q v = {
t = "v" ;
s1 = heading1 (heading verb_Category) ++
s1 = heading1 (heading verb_Category) ++
paragraph (verbExample (S.mkCl S.she_NP v S.we_NP (lin QS (ss "...")))) ;
s2 = inflVerb v
} ;
InflectionV2A v = {
t = "v" ;
s1 = heading1 (heading verb_Category) ++
s1 = heading1 (heading verb_Category) ++
paragraph (verbExample (S.mkCl S.she_NP v S.we_NP L.beautiful_A)) ;
s2 = inflVerb v
} ;
InflectionVV v = {
t = "v" ;
s1 = heading1 (heading verb_Category) ++
s1 = heading1 (heading verb_Category) ++
paragraph (verbExample (S.mkCl S.she_NP v (S.mkVP (L.sleep_V)))) ;
s2 = inflVerb v
} ;
InflectionVS v = {
t = "v" ;
s1 = heading1 (heading verb_Category) ++
s1 = heading1 (heading verb_Category) ++
paragraph (verbExample (S.mkCl S.she_NP v (lin S (ss "...")))) ;
s2 = inflVerb v
} ;
InflectionVQ v = {
t = "v" ;
s1 = heading1 (heading verb_Category) ++
s1 = heading1 (heading verb_Category) ++
paragraph (verbExample (S.mkCl S.she_NP v (lin QS (ss "...")))) ;
s2 = inflVerb v
} ;
InflectionVA v = {
t = "v" ;
s1 = heading1 (heading verb_Category) ++
s1 = heading1 (heading verb_Category) ++
paragraph (verbExample (S.mkCl S.she_NP v L.beautiful_A)) ;
s2 = inflVerb v
} ;
oper
oper
verbExample : CatEst.Cl -> Str = \cl -> (S.mkUtt cl).s ;
{-
-} --# notpresent
inflVerb : CatEst.V -> Str = \verb ->
let
let
--verb = sverb2verbSep verb0 ;
vfin : ResEst.VForm -> Str = \f ->
verb.s ! f ;
vinf : ResEst.InfForms -> Str = \if ->
applyInfFormsV if verb.s ;
nounNounHeading : Parameter -> Parameter -> Str = \n1,n2 ->
(S.mkUtt (G.PossNP (S.mkCN n1) (S.mkNP n2))).s ;
in
@@ -152,7 +160,7 @@ oper
th (heading singular_Parameter) ++
th (heading plural_Parameter)
++ th (heading passive_Parameter) --# notpresent
) ++
) ++
tr (th "1.p" ++ td (vfin (Presn Sg P1)) ++ td (vfin (Presn Pl P1))
++ intagAttr "td" "rowspan=3" (vfin (PassPresn True)) --# notpresent
) ++
@@ -167,13 +175,13 @@ oper
th (heading singular_Parameter) ++
th (heading plural_Parameter)
++ th (heading passive_Parameter) --# notpresent
) ++
) ++
tr (th "1.p" ++ td (vfin (Impf Sg P1)) ++ td (vfin (Impf Pl P1))
++ intagAttr "td" "rowspan=3" (vfin (PassImpf True))) ++
tr (th "2.p" ++ td (vfin (Impf Sg P2)) ++ td (vfin (Impf Pl P2))) ++
tr (th "3.p" ++ td (vfin (Impf Sg P3)) ++ td (vfin (Impf Pl P3))) ++
tr (th (heading negative_Parameter) ++
td (vfin (PastPart Act)) ++
td (vfin (PastPart Act)) ++
td (vfin (PastPart Pass)) ++
td (vfin (PassImpf False)))
) ++
@@ -183,12 +191,12 @@ oper
th (heading singular_Parameter) ++
th (heading plural_Parameter)
++ th (heading passive_Parameter) --# notpresent
) ++
) ++
tr (th "1.p" ++ td (vfin (Condit Sg P1)) ++ td (vfin (Condit Pl P1))
++ intagAttr "td" "rowspan=3" "TODO pass condit (nt loetaks)" --# notpresent
) ++
tr (th "2.p" ++ td (vfin (Condit Sg P2)) ++ td (vfin (Condit Pl P2))) ++
tr (th "3.p" ++ td (vfin (Condit Sg P3)) ++ td (vfin (Condit Pl P3)))
tr (th "3.p" ++ td (vfin (Condit Sg P3)) ++ td (vfin (Condit Pl P3)))
) ++
heading3 (nounNounHeading present_Parameter quotative_Parameter) ++
frameTable (
@@ -196,8 +204,8 @@ oper
th (heading singular_Parameter) ++
th (heading plural_Parameter)
++ th (heading passive_Parameter) --# notpresent
) ++
tr (th "isik." ++ td (vfin (Quotative Act))
) ++
tr (th "isik." ++ td (vfin (Quotative Act))
++ intagAttr "td" "rowspan=3" (vfin (Quotative Act)) --# notpresent
) ++
tr (th "umbis." ++ td (vfin (Quotative Pass)) ++ td (vfin (Quotative Pass))
@@ -208,61 +216,62 @@ oper
th (heading singular_Parameter) ++
th (heading plural_Parameter)
++ th (heading passive_Parameter) --# notpresent
) ++
) ++
tr (th "1.p" ++ td "" ++ td (vfin ImperP1Pl) ++
intagAttr "td" "rowspan=3" (vfin ImperPass)) ++
tr (th "2.p" ++ td (vfin (Imper Sg)) ++ td (vfin (Imper Pl))) ++
tr (th "3.p" ++ td (vfin (ImperP3)) ++ td (vfin ImperP3))
tr (th "3.p" ++ td (vfin (ImperP3)) ++ td (vfin ImperP3))
) ++
heading2 (nounPluralHeading nominal_form_ParameterType).s ++
heading3 (heading infinitive_Parameter) ++
frameTable (
tr (intagAttr "th" "rowspan=2" "da" ++
th (heading nominative_Parameter) ++ td (vfin (Inf InfDa))) ++
tr (th (heading inessive_Parameter) ++ td (vfin (Inf InfDes))) ++
th (heading nominative_Parameter) ++ td (vinf InfDa)) ++
tr (th (heading inessive_Parameter) ++ td (vinf InfDes)) ++
tr (intagAttr "th" "rowspan=5" "ma" ++
th (heading illative_Parameter) ++ td (vfin (Inf InfMa))) ++
tr (th (heading inessive_Parameter) ++ td (vfin (Inf InfMas))) ++
tr (th (heading elative_Parameter) ++ td (vfin (Inf InfMast))) ++
tr (th (heading abessive_Parameter) ++ td (vfin (Inf InfMata))) ++
tr (th (heading translative_Parameter) ++ td (vfin (Inf InfMaks)))
tr (intagAttr "th" "rowspan=6" "ma" ++
th (heading illative_Parameter) ++ td (vinf InfMa)) ++
tr (th (heading inessive_Parameter) ++ td (vinf InfMas)) ++
tr (th (heading elative_Parameter) ++ td (vinf InfMast)) ++
tr (th (heading abessive_Parameter) ++ td (vinf InfMata)) ++
tr (th (heading abessive_Parameter) ++ td (vinf InfMaks)) ++
tr (th (heading translative_Parameter) ++ td (vinf InfMine))
) ++
) ++
heading3 (heading participle_Parameter) ++
frameTable (
tr (intagAttr "th" "rowspan=2" (heading present_Parameter) ++
th (heading active_Parameter) ++
tr (intagAttr "th" "rowspan=2" (heading present_Parameter) ++
th (heading active_Parameter) ++
td (vfin (PresPart Act))) ++
tr (th (heading passive_Parameter) ++
tr (th (heading passive_Parameter) ++
td (vfin (PresPart Pass))) ++
tr (intagAttr "th" "rowspan=2" (heading perfect_Parameter) ++
th (heading active_Parameter) ++
tr (intagAttr "th" "rowspan=2" (heading perfect_Parameter) ++
th (heading active_Parameter) ++
td (vfin (PastPart Act ))) ++
tr (th (heading passive_Parameter) ++
tr (th (heading passive_Parameter) ++
td (vfin (PastPart Pass )))
) ; --}
inflNoun : (NForm -> Str) -> Str = \nouns ->
frameTable (
tr (th "" ++ th (heading singular_Parameter) ++ th (heading plural_Parameter) ) ++
tr (th (heading nominative_Parameter) ++ td (nouns (NCase Sg Nom)) ++ td (nouns (NCase Pl Nom))) ++
tr (th (heading genitive_Parameter) ++ td (nouns (NCase Sg Gen)) ++ td (nouns (NCase Pl Gen))) ++
tr (th (heading partitive_Parameter) ++ td (nouns (NCase Sg Part)) ++ td (nouns (NCase Pl Part))) ++
tr (th (heading translative_Parameter) ++ td (nouns (NCase Sg Transl)) ++ td (nouns (NCase Pl Transl))) ++
tr (th (heading essive_Parameter) ++ td (nouns (NCase Sg Ess)) ++ td (nouns (NCase Pl Ess))) ++
tr (th (heading inessive_Parameter) ++ td (nouns (NCase Sg Iness)) ++ td (nouns (NCase Pl Iness))) ++
tr (th (heading elative_Parameter) ++ td (nouns (NCase Sg Elat)) ++ td (nouns (NCase Pl Elat))) ++
tr (th (heading illative_Parameter) ++ td (nouns (NCase Sg Illat)) ++ td (nouns (NCase Pl Illat))) ++
tr (th (heading adessive_Parameter) ++ td (nouns (NCase Sg Adess)) ++ td (nouns (NCase Pl Adess))) ++
tr (th (heading ablative_Parameter) ++ td (nouns (NCase Sg Ablat)) ++ td (nouns (NCase Pl Ablat))) ++
tr (th (heading allative_Parameter) ++ td (nouns (NCase Sg Allat)) ++ td (nouns (NCase Pl Allat))) ++
tr (th (heading abessive_Parameter) ++ td (nouns (NCase Sg Abess)) ++ td (nouns (NCase Pl Abess))) ++
tr (th (heading comitative_Parameter) ++ td (nouns (NCase Sg Comit)) ++ td (nouns (NCase Pl Comit))) ++
tr (th (heading instructive_Parameter) ++ td (nouns (NCase Sg Termin)) ++ td (nouns (NCase Pl Termin))
)) ;
inflNoun : (Number -> CasePlus -> Str) -> Str = \nouns ->
frameTable (
tr (th "" ++ th (heading singular_Parameter) ++ th (heading plural_Parameter)) ++
tr (th (heading nominative_Parameter) ++ td (nouns Sg Nominative) ++ td (nouns Pl Nominative)) ++
tr (th (heading genitive_Parameter) ++ td (nouns Sg Genitive) ++ td (nouns Pl Genitive)) ++
tr (th (heading partitive_Parameter) ++ td (nouns Sg Partitive) ++ td (nouns Pl Partitive)) ++
tr (th (heading translative_Parameter) ++ td (nouns Sg Translative) ++ td (nouns Pl Translative)) ++
tr (th (heading essive_Parameter) ++ td (nouns Sg Essive) ++ td (nouns Pl Essive)) ++
tr (th (heading inessive_Parameter) ++ td (nouns Sg Inessive) ++ td (nouns Pl Inessive)) ++
tr (th (heading elative_Parameter) ++ td (nouns Sg Elative) ++ td (nouns Pl Elative)) ++
tr (th (heading illative_Parameter) ++ td (nouns Sg Illative) ++ td (nouns Pl Illative)) ++
tr (th (heading adessive_Parameter) ++ td (nouns Sg Adessive) ++ td (nouns Pl Adessive)) ++
tr (th (heading ablative_Parameter) ++ td (nouns Sg Ablative) ++ td (nouns Pl Ablative)) ++
tr (th (heading allative_Parameter) ++ td (nouns Sg Allative) ++ td (nouns Pl Allative)) ++
tr (th (heading abessive_Parameter) ++ td (nouns Sg Abessive) ++ td (nouns Pl Abessive)) ++
tr (th (heading comitative_Parameter) ++ td (nouns Sg Comitative) ++ td (nouns Pl Comitative)) ++
tr (th (heading instructive_Parameter) ++ td (nouns Sg Terminative) ++ td (nouns Pl Terminative))
) ;
lin
NoDefinition t = {s=t.s};
@@ -274,6 +283,6 @@ lin
MkTag i = ss (i.t) ;
{- --# notpresent
-}
-}
}

View File

@@ -3,19 +3,29 @@
concrete ExtendEst of Extend =
CatEst ** ExtendFunctor -
[
VPS, ListVPS, VPI, ListVPI, VPS2, ListVPS2, VPI2, ListVPI2, RNP, RNPList,
AdAdV, AdjAsCN, AdjAsNP, ApposNP,
BaseVPS, ConsVPS, BaseVPI, ConsVPI, BaseVPS2, ConsVPS2, BaseVPI2, ConsVPI2,
MkVPS, ConjVPS, PredVPS, MkVPI, ConjVPI, ComplVPIVV,
MkVPS2, ConjVPS2, ComplVPS2, MkVPI2, ConjVPI2, ComplVPI2,
Base_nr_RNP, Base_rn_RNP, Base_rr_RNP, ByVP, CompBareCN,
CompIQuant, CompQS, CompS, CompVP, ComplBareVS, ComplGenVV, ComplSlashPartLast, ComplVPSVV, CompoundAP,
CompoundN, ConjRNP, ConjVPS, ConsVPS, Cons_nr_RNP, Cons_rr_RNP, DetNPFem, EmbedPresPart,
ExistsNP, FocusAP, FocusAdV, FocusAdv, FocusObj, FrontExtPredVP, GenIP, GenModIP, GenModNP, GenNP, GenRP,
GerundAdv, GerundCN, GerundNP, IAdvAdv, ICompAP, InOrderToVP, InvFrontExtPredVP, MkVPS, NominalizeVPSlashNP,
PassAgentVPSlash, PassVPSlash, PastPartAP, PastPartAgentAP, PositAdVAdj, PredVPS, PredVPSVV, PredetRNP, PrepCN,
PresPartAP, PurposeVP, ReflPoss, ReflPron, ReflRNP, SlashBareV2S, SlashV2V,
UncontractedNeg, UttAccIP, UttAccNP, UttAdV, UttDatIP, UttDatNP, UttVPShort, WithoutVP, BaseVPS2, ConsVPS2, ConjVPS2, ComplVPS2, MkVPS2
-- Extensions of VP
VPS, ListVPS, VPI, ListVPI, VPS2, ListVPS2, VPI2, ListVPI2,
MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS, QuestVPS, SQuestVPS, RelVPS,
MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV,
MkVPS2, BaseVPS2, ConsVPS2, ConjVPS2, ComplVPS2, ReflVPS2,
MkVPI2, BaseVPI2, ConsVPI2, ConjVPI2, ComplVPI2,
-- Reflexives
RNP, RNPList, Base_nr_RNP, Base_rn_RNP, Base_rr_RNP, ConjRNP, Cons_nr_RNP, Cons_rr_RNP, PredetRNP, ReflRNP, ReflPoss, ReflPron,
-- Rest in alphabetical order
AdAdV, AdjAsCN, AdjAsNP, ApposNP, AdvIsNP, A2VPSlash, ByVP,
CardCNCard, CompBareCN, CompIQuant, CompQS, CompS, CompVP,
ComplBareVS, ComplGenVV, ComplSlashPartLast, ComplVPSVV, CompoundAP, CompoundN,
EmbedPresPart, EmbedSSlash, EmptyRelSlash, ExistsNP, ExistCN, ExistMassCN, ExistPluralCN,
FocusAP, FocusAdV, FocusAdv, FocusObj, FrontComplDirectVQ, FrontComplDirectVS,
GenIP, GenModIP, GenModNP, GenNP, GenRP, GerundAdv, GerundCN, GerundNP,
IAdvAdv, ICompAP, InOrderToVP, N2VPSlash, NominalizeVPSlashNP,
PassAgentVPSlash, PassVPSlash, PastPartAP, PastPartAgentAP, PositAdVAdj,
PredAPVP, PredIAdvVP, PredVPSVV, PresPartAP, PrepCN, ProDrop, ProgrVPSlash, PurposeVP,
SlashBareV2S, UttAccIP, UttAccNP, UttAdV, UttDatIP, UttDatNP, UttVPShort, WithoutVP
]
with
(Grammar = GrammarEst) **
@@ -24,6 +34,7 @@ concrete ExtendEst of Extend =
GrammarEst,
ResEst,
(R=ResEst),
(X=ExtraEst),
IdiomEst,
Coordination,
Prelude,
@@ -31,257 +42,399 @@ concrete ExtendEst of Extend =
LexiconEst,
ParadigmsEst in {
---------------------------------
-- VPS, VPI, VPS2 + list versions
lincat
VPS = X.VPS ;
[VPS] = X.ListVPS ;
VPI = X.VPI ;
[VPI] = X.ListVPI ;
VPS2 = X.VPS ** {c2 : Compl} ;
[VPS2] = X.ListVPS ** {c2 : Compl} ;
VPI2 = X.VPI ** {c2 : Compl} ;
[VPI2] = X.ListVPI ** {c2 : Compl} ;
linref
VPS = X.linVPS (agrP3 Sg) ;
VPI = X.linVPI InfMa ;
lin
-- : NP -> Quant ; -- this man's
GenNP np = {
s,sp = \\_,_ => np.s ! NPCase Gen ;
MkVPS = X.MkVPS ;
BaseVPS = X.BaseVPS ;
ConsVPS = X.ConsVPS ;
ConjVPS = X.ConjVPS ;
PredVPS = X.PredVPS ;
-- QuestVPS
-- SQuestVPS
-- RelVPS
MkVPI = X.MkVPI ;
BaseVPI = X.BaseVPI ;
ConsVPI = X.ConsVPI ;
ConjVPI = X.ConjVPI ;
ComplVPIVV = X.ComplVPIVV ;
MkVPS2 t p vps = MkVPS t p vps ** {c2 = vps.c2} ;
-- BaseVPS2, ConsVPS2, ConjVPS2,
ComplVPS2 v np = lin VPS (v ** {
-- TODO: param to record whether it's pos or neg, so we get right form of np
s = \\agr => v.s ! agr ++ appCompl True Pos v.c2 np ;
}) ;
-- ReflVPS2 v rnp =
-- MkVPI2, BaseVPI2, ConsVPI2, ConjVPI2, ComplVPI2,
---------------------------------
-- RNP + all related funs
lincat
RNP = {s : Agr => NPForm => Str} ;
RNPList = {s1,s2 : Agr => NPForm => Str} ;
oper
rnp2np : Agr -> RNP -> NPhrase = \agr,rnp -> emptyNP ** {
a = agr ;
s = rnp.s ! agr ;
isPron = False ; -- ??
} ;
lin
-- : VPSlash -> RNP -> VP ; -- support my family and myself
ReflRNP vps rnp = insertObj (\\b,p,a => appCompl True Pos vps.c2 (rnp2np a rnp)) vps ;
-- : RNP
ReflPron = {s = \\agr,npf => (reflPron agr).s ! npf} ;
-- : Num -> CN -> RNP ; -- my car(s)
ReflPoss num cn = {
s = \\a,npf => possPron ! a ++ num.s ! Sg ! Nom ++
case npf of {
NPCase c => cn.s ! NCase num.n c ;
NPAcc => cn.s ! NCase num.n Gen } ;
} ;
PredetRNP predet rnp = {
s = \\a,c => case a of {
Ag n p => predet.s ! n ! c ++ rnp.s ! a ! c ;
AgPol => predet.s ! Pl ! c ++ rnp.s ! a ! c }
} ;
ConjRNP conj rpns = conjunctDistrTable2 Agr NPForm conj rpns ;
Base_rr_RNP x y = twoTable2 Agr NPForm x y ;
Base_nr_RNP x y = twoTable2 Agr NPForm {s = \\a => x.s} y ;
Base_rn_RNP x y = twoTable2 Agr NPForm x {s = \\a => y.s} ;
Cons_rr_RNP x xs = consrTable2 Agr NPForm comma x xs ;
Cons_nr_RNP x xs = consrTable2 Agr NPForm comma {s = \\a => x.s} xs ;
{-
-- : Pron -> Num -> CN -> RNP -> NP ; -- his abandonment of his wife and children
PossPronRNP pron num cn rnp =
-- : NP -> Prep -> RNP -> RNP ; -- a dispute with his wife
AdvRAP adv rp =
-- : VP -> Prep -> RNP -> VP ; -- lectured about her travels
AdvRNP adv rp =
-- : AP -> Prep -> RNP -> AP ; -- adamant in his refusal
AdvRVP adv rp =
-}
oper
possPron : Agr => Str = table {
Ag Sg P1 => "minu" ;
Ag Sg P2 => "sinu" ;
Ag Sg P3 => "tema" ;
Ag Pl P1 => "meie" ;
Ag Pl P2 => "teie" ;
Ag Pl P3 => "nende" ;
AgPol => "teie"
} ;
---------------------------------
-- A - B
lin
AdAdV ad adv = AdAdv ad adv ;
-- : AP -> CN ; -- a green one ; en grön (Swe)
AdjAsCN ap = emptyCN ** {s = ap.s ! True} ; -- True = attributive ; False = predicative
-- : AP -> NP
AdjAsNP ap = MassNP (AdjAsCN ap) ;
-- : NP -> NP -> NP
ApposNP np1 np2 = np2 ** {
s = \\nf => np1.s ! nf ++ np2.s ! nf ; -- comma or not?
} ;
-- : Adv -> NP -> Cl ; -- here is the tree / here are the trees
AdvIsNP adv np = mkClause (\_ -> adv.s) (agrP3 Sg) (UseComp (CompNP np)) ;
-- : A2 -> VPSlash
A2VPSlash a2 = UseComp (CompAP (UseA2 a2)) ** {c2 = a2.c2} ;
-- : VP -> Adv ;
ByVP = GerundAdv ;
---------------------------------
-- C
lin
-- : VS -> S -> VP ;
ComplBareVS v s = insertExtrapos s.s (predV v) ;
-- : N -> N -> N ; -- control system / controls system / control-system
CompoundN noun cn = cn ** {
s = \\nf => noun.s ! NCase Sg Gen ++ BIND ++ cn.s ! nf
} ;
-- : N -> A -> AP ; -- language independent / language-independent
CompoundAP n a = PositA (a ** {s = \\d,af => n.s ! NCase Sg Nom ++ BIND ++ a.s ! d ! af}) ;
-- : VS -> Utt -> VP ; -- say: "today"
ComplDirectVS vs utt = insertExtrapos (BIND ++ ":" ++ utt.s) (predV vs) ;
-- : VQ -> Utt -> VP ; -- ask: "when"
ComplDirectVQ vq utt = insertExtrapos (BIND ++ ":" ++ utt.s) (predV vq) ;
-- : S -> Comp ; -- (the fact is) that she sleeps
CompS s = {s = \\_ => "et" ++ s.s} ;
-- : QS -> Comp ; -- (the question is) who sleeps
CompQS qs = {s = \\_ => qs.s } ;
-- : Ant -> Pol -> VP -> Comp ; -- (she is) to go
CompVP ant pol vp = {s = \\a => infVPAnt ant.a (NPCase Nom) pol.p a vp InfDa } ;
-- ComplGenVV v a p vp = insertObj (\\agr => a.s ++ p.s ++ infVP v.typ vp a.a p.p agr)
-- (predVV v) ;
-- ComplSlashPartLast vps np = {} ; --- AR 7/3/2013
---------------------------------
-- E - F
lin
-- : VP -> SC ; -- looking at Mary (is fun) / filmide vaatamine (on tore) / ___ga abielus olemine,
EmbedPresPart vp = {s = infVP (NPCase Gen) Pos (agrP3 Sg) vp InfMine } ;
EmbedSSlash s = {s = s.s ++ s.c2.s} ;
-- : ClSlash -> RCl ; -- he lives in
EmptyRelSlash cls = {
s = \\t,a,p,_ => cls.s ! t ! a ! p ++ cls.c2.s ;
c = NPCase Nom
} ;
-- : CN -> Cl ; -- there is a car / there is no car ; there is beer / there is no beer ; there are
-- TODO: these all use the literal "exist" verb. Does Estonian have a construction for "there is"?
ExistCN, ExistMassCN = \cn -> ExistsNP (MassNP cn) ;
ExistPluralCN cn = ExistsNP (DetCN (DetQuant IndefArt NumPl) cn) ;
-- : NP -> Cl ; -- there exists a number / there exist numbers
ExistsNP = IdiomEst.ExistNP ;
-- : AP -> NP -> Utt ; -- green was the tree
FocusAP ap np =
let pred : VP = UseComp (CompNP np) ;
subj : NP = AdjAsNP ap ;
cl : Cl = PredVP subj pred ;
in UttS (UseCl (TTAnt TPres ASimul) PPos cl) ; -- use AdvIsNP for similar construction but that returns a Cl instead
-- : Ad[vV] -> S -> Utt -- today I will sleep
FocusAdV, FocusAdv = \adv,s -> cc2 adv s ;
-- : NP -> SSlash -> Utt ; -- her I love
FocusObj np sslash = {s = appCompl True Pos sslash.c2 np ++ sslash.s} ;
-- : NP -> VS -> Utt -> Cl ; -- "I am here", she said
FrontComplDirectVS np vs utt =
let cl : Cl = PredVP np (UseV vs) ;
in cl ** {s = \\t,a,p,o => utt.s ++ bindComma ++ cl.s ! t ! a ! p ! o} ;
-- : NP -> VQ -> Utt -> Cl ; -- "where", she asked
FrontComplDirectVQ np vq utt =
let cl : Cl = PredVP np (UseV vq) ;
in cl ** {s = \\t,a,p,o => utt.s ++ bindComma ++ cl.s ! t ! a ! p ! o} ;
---------------------------------
-- G
lin
-- : NP -> Quant ; -- this man's
GenNP np = {
s,sp = \\_,_ => linNP (NPCase Gen) np ;
isNum = False ;
isDef = True ;
isNeg = False
} ;
isNeg = False
} ;
-- : IP -> IQuant ; -- whose
GenIP ip = { s = \\_,_ => ip.s ! NPCase Gen } ;
-- : IP -> IQuant ; -- whose
GenIP ip = {s = \\_,_ => linIP (NPCase Gen) ip} ;
-- : Num -> CN -> RP ; -- whose car
GenRP num cn = {
s = \\n,c => let k = npform2case num.n c in relPron ! NCase n Gen ++ cn.s ! NCase num.n k ;
a = RNoAg
} ;
-- : Num -> CN -> RP ; -- whose car
GenRP num cn = {
s = \\n,c => let k = npform2case num.n c
in relPron ! NCase n Gen ++ cn.s ! NCase num.n k ;
a = RNoAg
} ;
-- In case the first two are not available, the following applications should in any case be.
-- : Num -> NP -> CN -> NP ; -- this man's car(s)
GenModNP num np cn = DetCN (DetQuant (GenNP (lin NP np)) num) cn ;
-- : Num -> NP -> CN -> NP ; -- this man's car(s)
GenModNP num np cn = DetCN (DetQuant (GenNP (lin NP np)) num) cn ;
-- : Num -> IP -> CN -> IP ; -- whose car(s)
GenModIP num ip cn = IdetCN (IdetQuant (GenIP (lin IP ip)) num) cn ;
-- : Num -> IP -> CN -> IP ; -- whose car(s)
GenModIP num ip cn = IdetCN (IdetQuant (GenIP (lin IP ip)) num) cn ;
{-
-- : VP -> Adv
GerundAdv vp = {s = infVPdefault vp InfDes} ;
-- : VP -> CN -- publishing of the document (can get a determiner)
GerundCN vp = emptyCN ** {
s = \\nf => infVPdefault vp {stem = InfM ; suf = []}
++ ine.s ! nf ;
} where {
ine : N = mkN "ine" "ise" "ist" "isesse" "iste" "isi"
} ;
-- : VP -> NP -- publishing the document (by nature definite)
GerundNP vp = MassNP (GerundCN vp) ;
lincat
VPS = {s : Agr => Str} ;
[VPS] = {s1,s2 : Agr => Str} ;
VPI = {s : VVType => Agr => Str} ;
[VPI] = {s1,s2 : VVType => Agr => Str} ;
---------------------------------
-- I - N
lin
BaseVPS = twoTable Agr ;
ConsVPS = consrTable Agr comma ;
BaseVPI = twoTable2 VVType Agr ;
ConsVPI = consrTable2 VVType Agr comma ;
MkVPS t p vp = mkVPS (lin Temp t) (lin Pol p) (lin VP vp) ;
ConjVPS c xs = conjunctDistrTable Agr c xs ;
PredVPS np vps = {s = np.s ! npNom ++ vps.s ! np.a} ;
-- : AP -> IComp ; -- "how old"
ICompAP ap = icompAP "kui" ap ;
MkVPI vp = mkVPI (lin VP vp) ;
ConjVPI c xs = conjunctDistrTable2 VVType Agr c xs ;
ComplVPIVV vv vpi = insertObj (\\a => vpi.s ! vv.typ ! a) (predVV vv) ;
-- : Adv -> IAdv ; -- "how often"
IAdvAdv adv = { s = "kui" ++ adv.s } ;
-- : VP -> Adv -- et raamatut paremini näha
InOrderToVP vp = {s = "et" ++ infVPdefault vp InfDa} ;
-- : N2 -> VPSlash
N2VPSlash n2 = UseComp (CompCN (UseN2 n2)) ** {c2 = n2.c2} ;
-- : VPSlash -> NP -> NP ; publishing of the document
-- NominalizeVPSlashNP vpslash np = {} ;
-------- two-place verb conjunction
lincat
VPS2 = {s : Agr => Str ; c2 : Str} ;
[VPS2] = {s1,s2 : Agr => Str ; c2 : Str} ;
VPI2 = {s : VVType => Agr => Str ; c2 : Str} ;
[VPI2] = {s1,s2 : VVType => Agr => Str ; c2 : Str} ;
---------------------------------
-- P
lin
MkVPS2 t p vpsl = mkVPS (lin Temp t) (lin Pol p) (lin VP vpsl) ** {c2 = vpsl.c2} ;
MkVPI2 vpsl = mkVPI (lin VP vpsl) ** {c2 = vpsl.c2} ;
BaseVPS2 x y = twoTable Agr x y ** {c2 = y.c2} ; ---- just remembering the prep of the latter verb
ConsVPS2 x xs = consrTable Agr comma x xs ** {c2 = xs.c2} ;
BaseVPI2 x y = twoTable2 VVType Agr x y ** {c2 = y.c2} ; ---- just remembering the prep of the latter verb
ConsVPI2 x xs = consrTable2 VVType Agr comma x xs ** {c2 = xs.c2} ;
-- : VPSlash -> NP -> VP ; -- be begged by her to go
PassAgentVPSlash vps np = let vp : VP = PassVPSlash vps in vp ** {
adv = vp.adv ++ appCompl True Pos by8agent_Prep np ;
} ;
ConjVPS2 c xs = conjunctDistrTable Agr c xs ** {c2 = xs.c2} ;
ConjVPI2 c xs = conjunctDistrTable2 VVType Agr c xs ** {c2 = xs.c2} ;
-- : VPSlash -> VP ; -- be forced to sleep
PassVPSlash vps = vps ** {
s = \\vf => case vf of {
VIFin t => vps.s ! VIPass t ;
x => vps.s ! x } ;
sc = compl2subjcase vps.c2
} ;
-- : VPSlash -> AP ; -- täna leitud
PastPartAP vp = {
s = \\_,_ => vp2adv <vp : VP> <True : Bool> <PastPart Pass : VForm> ;
infl = Invariable
} ;
ComplVPS2 vps2 np = {} ;
ComplVPI2 vpi2 np = {} ;
-- : VP -> AP ; -- (the man) looking at Mary / filme vaatav (mees)
PresPartAP vp = {
s = \\_,_ => vp2adv vp True VIPresPart ;
infl = Invariable
} ;
oper
mkVPS : Temp -> Pol -> VP -> VPS = \t,p,vp -> lin VPS {} ;
mkVPI : VP -> VPI = \vp -> lin VPI {} ;
-- : VPSlash -> NP -> AP -- hobisukeldujate poolt leitud (süvaveepomm)
PastPartAgentAP vp np = {
s = \\_,_ => appCompl True Pos by8agent_Prep np
++ vp2adv <vp : VP> <True : Bool> <PastPart Pass : VForm> ;
infl = Invariable
} ;
-----
-}
PositAdVAdj = PositAdvAdj ;
lin
-- : AP -> IComp ; -- "how old"
ICompAP ap = icompAP "kui" ap ;
-- : AP -> VP -> Cl ; -- it is good to walk / on hea kõndida
PredAPVP ap vp =
let heaOllaVP : VP = insertObj (\\_,_,_ => ap.s ! True ! NCase Sg Nom) vp ; -- puts AP into the s2 field
heaOllaComp : Comp = CompVP ASimul PPos heaOllaVP ; -- chooses InfDa, fixes word order
heaOlla : VP = UseComp heaOllaComp -- looks silly, but I want to reuse the abstract syntax funs :-P
in existClause noSubj (agrP3 Sg) heaOlla ;
-- : Adv -> IAdv ; -- "how often"
IAdvAdv adv = { s = "kui" ++ adv.s } ;
-- : IAdv -> VP -> QCl ; -- how to walk?
PredIAdvVP iadv vp = {s = \\t,a,p => iadv.s ++ infVPdefault vp InfMa} ;
-- : VP -> AP ; -- (the man) looking at Mary / filme vaatav (mees)
PresPartAP vp = {
s = \\_,_ => vp2adv vp True VIPresPart ;
infl = Invariable
} ;
PrepCN prep cn = PrepNP prep (MassNP cn) ;
{- TODO: need to change VP to get the following 3 functions to work properly:
1) Add "mine" form into VP (or switch to a BIND solution and just add a stem)
2) Change s2 in VP so that we can manipulate the complement to be in genitive!
-- : VP -> SC ; -- looking at Mary (is fun) / filmide vaatamine (on tore)
EmbedPresPart vp =
let vpGen = vp ; --** { s2 = \\_,_,_ => vp.s2 ! True ! Pos ! }
{s = vp2adv vp True VI } ;
ProDrop pron = pron ** {s = \\_ => []} ;
-- : VP -> CN -- publishing of the document (can get a determiner)
GerundCN vp = {} ;
ProgrVPSlash vps = ProgrVP vps ** vps ;
-- : VP -> NP -- publishing the document (by nature definite)
GerundNP vp = {} ;
-}
PurposeVP = InOrderToVP ; --- is there a difference?
-- : VPSlash -> AP ; -- täna leitud
PastPartAP vp = {
s = \\_,_ => vp2adv vp True (VIPass Past) ;
infl = Invariable } ;
oper
-- calling infVP with the "default arguments": NPCase Nom, Pos, agrP3 Sg
infVPdefault : VP -> InfForms -> Str = infVP (NPCase Nom) Pos (agrP3 Sg) ;
-- : VPSlash -> NP -> AP -- hobisukeldujate poolt leitud (süvaveepomm)
PastPartAgentAP vp np = {
s = \\_,_ => np.s ! NPCase Gen ++ "poolt"
++ vp2adv vp True (VIPass Past) ;
infl = Invariable } ;
vp2adv = overload {
-- : VP -> Adv
GerundAdv vp =
{ s = vp2adv vp True (VIInf InfDes) } ;
WithoutVP vp = -- ilma raamatut nägemata
{ s = "ilma" ++ vp2adv vp False (VIInf InfMata) } ;
InOrderToVP vp = -- et raamatut paremini näha
{ s = "et" ++ vp2adv vp True (VIInf InfDa) } ;
ByVP vp =
{ s = vp2adv vp True (VIInf InfDes) } ;
oper
vp2adv : R.VP -> Bool -> VIForm -> Str = \vp,sentIsPos,vif ->
vp.s2 ! sentIsPos ! Pos ! agrP3 Sg -- raamatut
++ vp.adv -- paremini
++ vp.p -- ära
++ (vp.s ! vif ! Simul ! Pos ! agrP3 Sg).fin -- tunda/tundes/tundmata/...
++ vp.ext ;
lin
{-
NominalizeVPSlashNP vpslash np = {} ;
PassVPSlash vps = passVPSlash (lin VPS vps) [] ;
PassAgentVPSlash vps np = passVPSlash (lin VPS vps) ("by" ++ np.s ! NPAcc) ;
--- AR 7/3/2013
ComplSlashPartLast vps np = {} ;
-}
-- : NP -> Cl ; -- there exists a number / there exist numbers
ExistsNP = IdiomEst.ExistNP ;
{-
ComplBareVS v s = insertExtra s.s (predV v) ;
SlashBareV2S v s = insertExtrac s.s (predVc v) ;
-}
-- : N -> N -> N ; -- control system / controls system / control-system
CompoundN noun cn = lin N {
s = \\nf => noun.s ! NCase Sg Gen ++ BIND ++ cn.s ! nf
vp2adv : R.VP -> Bool -> VIForm -> Str = \vp,sentIsPos,vif ->
let vpforms : {fin,inf : Str} = case vif of {
VIInf if => applyInfFormsVP {stem=if ; suf="a"} vp ; --- this oper shouldn't be used if you want to use an InfForm but just trying to be robust here
_ => mkVPForms vp.v ! vif ! Simul ! Pos ! agrP3 Sg} ;
in vp.s2 ! sentIsPos ! Pos ! agrP3 Sg -- raamatut
++ vp.adv -- paremini
++ vp.p -- ära
++ vpforms.fin -- tunda/tundes/tundmata/...
++ vpforms.inf -- TODO is this necessary???
++ vp.ext ;
vp2adv : R.VP -> Bool -> VForm -> Str = \vp,sentIsPos,vf ->
vp.s2 ! sentIsPos ! Pos ! agrP3 Sg -- raamatut
++ vp.adv -- paremini
++ vp.p -- ära
++ vp.v.s ! vf -- tuntud
++ vp.ext
} ;
{-
-- : N -> A -> AP ; -- language independent / language-independent
CompoundAP noun adj = {} ;
-- : VS -> Utt -> VP ; -- say: "today"
ComplDirectVS vs utt = {} ;
-- : VQ -> Utt -> VP ; -- ask: "when"
ComplDirectVQ vq utt = {} ;
-- : NP -> VS -> Utt -> Cl ; -- "I am here", she said
FrontComplDirectVS np vs utt = {} ;
-- : NP -> VQ -> Utt -> Cl ; -- "where", she asked
FrontComplDirectVQ np vq utt = {} ;
-}
-- : AP -> VP -> Cl ; -- it is good to walk / on hea kõndida
PredAPVP ap vp =
let heaOllaVP : VP = insertObj (\\_,_ => ap.s) vp ; -- puts AP into the s2 field
heaOllaComp : Comp = CompVP ASimul PPos heaOlla ; -- chooses InfDa, fixes word order
heaOlla : VP = UseComp heaOllaComp -- looks silly, but I want to reuse the abstract syntax funs :-P
in existClause noSubj (agrP3 Sg) heaOlla ;
oper
testCl = PredAPVP (PositA good_A) (UseV walk_V) ;
---------------------------------
-- S - W
lin
-- : AP -> CN ; -- a green one ; en grön (Swe)
AdjAsCN ap = { s = ap.s ! True } ; -- True = it's a modifier, not a predicate
-- SlashBareV2S v s = insertExtrapos s.s (predV v) ** v ;
AdjAsNP ap = {
s = table { NPCase c => ap.s ! True ! NCase Sg c ;
NPAcc => ap.s ! True ! NCase Sg Gen } ;
a = agrP3 Sg ;
isPron = False
} ;
{-
lincat
RNP = {s : Agr => Str} ;
RNPList = {s1,s2 : Agr => Str} ;
UseDAP,
UseDAPFem,
UseDAPMasc = DetNP ;
lin
ReflRNP vps rnp = insertObjPre (\\a => vps.c2 ++ rnp.s ! a) vps ;
UttAccIP ip = {s = linIP NPAcc ip} ;
UttAccNP np = {s = linNP NPAcc np} ;
UttAdV adv = adv ;
UttDatIP ip = {s = linIP (NPCase Part) ip} ; -- is partitive a reasonable translation?
UttDatNP np = {s = linNP (NPCase Part) np} ;
-- : RNP
ReflPron = {s = reflPron} ;
-- : VP -> Utt ; -- There's no "short form", so just using InfDa instead of InfMa
UttVPShort vp = {s = infVPdefault vp InfDa} ;
ReflPoss num cn = {s = \\a => possPron ! a ++ num.s ! Nom ++ cn.s ! num.n ! Nom} ;
PredetRNP predet rnp = {s = \\a => predet.s ++ rnp.s ! a} ;
ConjRNP conj rpns = conjunctDistrTable Agr conj rpns ;
Base_rr_RNP x y = twoTable Agr x y ;
Base_nr_RNP x y = twoTable Agr {s = \\a => x.s ! NPAcc} y ;
Base_rn_RNP x y = twoTable Agr x {s = \\a => y.s ! NPAcc} ;
Cons_rr_RNP x xs = consrTable Agr comma x xs ;
Cons_nr_RNP x xs = consrTable Agr comma {s = \\a => x.s ! NPAcc} xs ;
---- TODO: RNPList construction
ComplGenVV v a p vp = insertObj (\\agr => a.s ++ p.s ++
infVP v.typ vp a.a p.p agr)
(predVV v) ;
-}
-- : S -> Comp ; -- (the fact is) that she sleeps
CompS s = {s = \\_ => "et" ++ s.s} ;
-- : QS -> Comp ; -- (the question is) who sleeps
CompQS qs = {s = \\_ => qs.s } ;
-- : Ant -> Pol -> VP -> Comp ; -- (she is) to go
CompVP ant pol vp = {s = \\a => infVPAnt ant.a (NPCase Nom) pol.p a vp InfDa } ;
-- English-specific
-- : Pol
UncontractedNeg = { s = [] ; p = Neg } ;
-- : VP -> Utt ; -- There's no "short form", so just using InfMa instead of InfDa
UttVPShort vp = {s = infVP (NPCase Nom) Pos (agrP3 Sg) vp InfMa} ;
--TODO: maybe InfMa should be default in PhraseEst and InfDa here?
-- : VP -> Adv ; -- ilma raamatut nägemata
WithoutVP vp = {s = "ilma" ++ infVPdefault vp InfMata} ;
}
}

View File

@@ -1,56 +1,90 @@
concrete ExtraEst of ExtraEstAbs = CatEst **
open ResEst, MorphoEst, Coordination, Prelude, NounEst, StructuralEst, (R = ParamX) in {
concrete ExtraEst of ExtraEstAbs = CatEst **
open ResEst, MorphoEst, Coordination, Prelude, NounEst, StructuralEst, (R = ParamX), (P = ParadigmsEst) in {
flags coding=utf8;
lin
GenNP np = {
s,sp = \\_,_ => np.s ! NPCase Gen ;
s,sp = \\_,_ => linNP (NPCase Gen) np ;
isNum = False ;
isDef = True ; --- "Jussin kolme autoa ovat" ; thus "...on" is missing
isNeg = False
isNeg = False
} ;
GenCN = caseCN Gen ; -- soome mees
ComitCN = caseCN Comit ; -- puudega mets
ElatCN = caseCN Elat ; -- puust laud
AbessCN = caseCN Abess ; -- autota pere
TerminCN = caseCN Termin ; -- maani kleit
GenCN = caseCN Genitive ; -- soome mees
ComitCN = caseCN Comitative ; -- puudega mets
ElatCN = caseCN Elative ; -- puust laud
AbessCN = caseCN Abessive ; -- autota pere
TerminCN = caseCN Terminative ; -- maani kleit
GenIP ip = {s = \\_,_ => ip.s ! NPCase Gen} ;
GenIP ip = {s = \\_,_ => linIP (NPCase Gen) ip} ;
GenRP num cn = {
s = \\n,c => let k = npform2case num.n c in relPron ! NCase n Gen ++ cn.s ! NCase num.n k ;
a = RNoAg
s = \\n,c => let k = npform2case num.n c in relPron ! NCase n Gen ++ cn.s ! NCase num.n k ;
a = RNoAg
--- a = RAg (agrP3 num.n)
} ;
oper
caseCN : Case -> NP -> CN -> CN = \c,np,cn ->
lin CN { s = \\nf => np.s ! NPCase c ++ cn.s ! nf } ;
oper
caseCN : CasePlus -> NP -> CN -> CN = \c,np,cn -> cn ** {
s = \\nf => appCompl True Pos (P.casePrep c) np ++ cn.s ! nf
} ;
lincat
VPI = {s : InfForm => Str} ;
[VPI] = {s1,s2 : InfForm => Str} ;
-- VPI = {s : Str} ;
-- [VPI] = {s1,s2 : Str} ;
VPI = LinVPI ;
[VPI] = LinListVPI ;
oper
LinVPI : Type = {s : InfStem => Str} ;
LinListVPI : Type = {s1,s2 : InfStem => Str} ;
linVPI : InfForms -> LinVPI -> Str = \inf,vpi -> vpi.s ! inf.stem ;
-- Version that uses InfStem
infVPIF : NPForm -> Polarity -> Agr -> VP -> InfStem -> Str = \sc,pol,agr,vp,if ->
infVPAnt Simul sc pol agr vp {stem=if ; suf="a"} ;
lin
BaseVPI = twoTable InfForm ;
ConsVPI = consrTable InfForm comma ;
BaseVPI = twoTable InfStem ;
ConsVPI = consrTable InfStem comma ;
MkVPI vp = {s = \\i => infVP (NPCase Nom) Pos (agrP3 Sg) vp i} ;
ConjVPI = conjunctDistrTable InfForm ;
ComplVPIVV vv vpi =
insertObj (\\_,_,_ => vpi.s ! vv.vi) (predV vv) ;
MkVPI vp = {s = \\i => infVPIF (NPCase Nom) Pos (agrP3 Sg) vp i} ;
ConjVPI = conjunctDistrTable InfStem ;
ComplVPIVV vv vpi =
insertObj (\\_,_,_ => vpi.s ! vv.vi.stem) (predV vv) ;
lincat
VPS = {
s : Agr => Str ;
VPS = LinVPS ;
[VPS] = LinListVPS ;
oper
LinVPS : Type = {
s : Agr => Str ;
sc : NPForm ; --- can be different for diff parts
} ;
[VPS] = {
s1,s2 : Agr => Str ;
LinListVPS : Type = {
s1,s2 : Agr => Str ;
sc : NPForm ; --- take the first: minä osaan kutoa ja täytyy virkata
} ;
linVPS : Agr -> {s : Agr => Str} -> Str = \agr,vps -> vps.s ! agr ;
-- This internal oper isn't used in any of the RGL linearisations, but can be useful for application grammars
-- It produces a telegraphic style in past participle, 'võetud …' instead of 'on/oli võetud …'.
-- It differs from PastPartAP in word order, and it also takes polarity.
TelegraphicPastPartPassVPS : Pol -> ResEst.VP -> VPS = \p,vp ->
let sentIsPos : Bool = case p.p of {
Neg => False ;
Pos => True } ;
neg : Str = case p.p of {
Neg => "ei" ;
Pos => [] } ;
in lin VPS {
s = \\a => neg -- ei
++ vp.v.s ! (PastPart Pass) -- võetud
++ vp.s2 ! sentIsPos ! p.p ! a -- vereanalüüs
++ vp.adv -- eile
++ vp.p
++ vp.ext ;
sc = vp.sc
};
lin
BaseVPS x y = twoTable Agr x y ** {sc = x.sc} ;
ConsVPS x y = consrTable Agr comma x y ** {sc = x.sc} ;
@@ -60,7 +94,7 @@ concrete ExtraEst of ExtraEstAbs = CatEst **
} ;
MkVPS t p vp = { -- Temp -> Pol -> VP -> VPS ;
s = \\a => let vps = vp.s ! VIFin t.t ! t.a ! p.p ! a
s = \\a => let vps = mkVPForms vp.v ! VIFin t.t ! t.a ! p.p ! a
in
t.s ++ p.s ++
vps.fin ++ vps.inf ++
@@ -79,102 +113,101 @@ concrete ExtraEst of ExtraEstAbs = CatEst **
PassAgentVPSlash vp np = vp ;
{-
s = {s = vp.s.s ; h = vp.s.h ; p = vp.s.p ; sc = npform2subjcase vp.c2.c} ;
s2 = \\b,p,a => np.s ! NPCase Nom ++ vp.s2 ! b ! p ! a ;
s = {s = vp.s.s ; h = vp.s.h ; p = vp.s.p ; sc = npform2subjcase vp.c2.c} ;
s2 = \\b,p,a => linNP (NPCase Nom) np ++ vp.s2 ! b ! p ! a ;
adv = vp.adv ;
ext = vp.ext ;
vptyp = vp.vptyp ;
} ; -}
AdvExistNP adv np =
mkClause (\_ -> adv.s) np.a (insertObj
(\\_,b,_ => np.s ! NPCase Nom) (predV (verbOlema ** {sc = NPCase Nom}))) ;
AdvExistNP adv np =
mkClause (\_ -> adv.s) np.a (insertObj
(\\_,b,_ => linNP (NPCase Nom) np) (predV (verbOlema ** {sc = NPCase Nom}))) ;
RelExistNP prep rp np = {
s = \\t,ant,bo,ag =>
let
s = \\t,ant,bo,ag =>
let
n = complNumAgr ag ;
cl = mkClause
cl = mkClause
(\_ -> appCompl True Pos prep (rp2np n rp))
np.a
(insertObj
(\\_,b,_ => np.s ! NPCase Nom)
np.a
(insertObj
(\\_,b,_ => linNP (NPCase Nom) np)
(predV (verbOlema ** {sc = NPCase Nom}))) ;
in
in
cl.s ! t ! ant ! bo ! SDecl ;
c = NPCase Nom
} ;
AdvPredNP adv v np =
mkClause (\_ -> adv.s) np.a (insertObj
(\\_,b,_ => np.s ! NPCase Nom) (predV v)) ;
mkClause (\_ -> adv.s) np.a (insertObj
(\\_,b,_ => linNP (NPCase Nom) np) (predV v)) ;
ICompExistNP adv np =
let cl = mkClause (\_ -> adv.s ! np.a) np.a (insertObj
(\\_,b,_ => np.s ! NPCase Nom) (predV (verbOlema ** {sc = NPCase Nom}))) ;
ICompExistNP adv np =
let cl = mkClause (\_ -> adv.s ! np.a) np.a (insertObj
(\\_,b,_ => linNP (NPCase Nom) np) (predV (verbOlema ** {sc = NPCase Nom}))) ;
in {
s = \\t,a,p => cl.s ! t ! a ! p ! SDecl
} ;
IAdvPredNP iadv v np =
let cl = mkClause (\_ -> iadv.s) np.a (insertObj
(\\_,b,_ => np.s ! v.sc) (predV v)) ;
let cl = mkClause (\_ -> iadv.s) np.a (insertObj
(\\_,b,_ => linNP v.sc np) (predV v)) ;
in {
s = \\t,a,p => cl.s ! t ! a ! p ! SDecl
} ;
-- i_implicPron = mkPronoun [] "minun" "minua" "minuna" "minuun" Sg P1 ;
whatPart_IP = {
whatPart_IP = emptyIP ** {
s = table {
NPCase Nom | NPAcc => "mi" ;
NPCase Nom | NPAcc => "mida" ;
c => whatSg_IP.s ! c
} ;
n = Sg
} ;
PartCN cn =
let
PartCN cn =
let
acn = DetCN (DetQuant IndefArt NumSg) cn
in {
in acn ** {
s = table {
NPCase Nom | NPAcc => acn.s ! NPCase ResEst.Part ;
c => acn.s ! c
} ;
a = acn.a ;
} ;
isPron = False ; isNeg = False
} ;
--The reflexive possessive "oma"
--for "ta näeb oma koera" instead of *"tema koera"
OmaPoss = {s,sp = \\_,_ => "oma" ; isDef,isNeg,isNum = False} ;
ma_Pron = shortPronoun "ma" "mu" "mind" "minu" Sg P1 ;
sa_Pron = shortPronoun "sa" "su" "sind" "sinu" Sg P2;
ta_Pron = shortPronoun "ta" "ta" "teda" "tema" Sg P3 ;
me_Pron =
me_Pron =
{s = table {
NPCase Nom => "me" ;
n => (we_Pron.s) ! n
n => (we_Pron.s) ! n
} ;
a = Ag Pl P1 } ;
a = Ag Pl P1 } ;
te_Pron =
te_Pron =
{s = table {
NPCase Nom => "te" ;
n => (youPl_Pron.s) ! n
n => (youPl_Pron.s) ! n
} ;
a = Ag Pl P2 } ;
a = Ag Pl P2 } ;
nad_Pron =
{s = table {
NPCase Nom => "nad" ;
n => (they_Pron.s) ! n
n => (they_Pron.s) ! n
} ;
a = Ag Pl P3 } ;
a = Ag Pl P3 } ;
---- copied from VerbEst.CompAP, should be shared
ICompAP ap = {
s = \\agr =>
s = \\agr =>
let
n = complNumAgr agr ;
c = case n of {
@@ -187,68 +220,68 @@ concrete ExtraEst of ExtraEstAbs = CatEst **
IAdvAdv adv = {s = "kui" ++ adv.s} ;
ProDrop p = {
s = table {NPCase (Nom | Gen) => [] ; c => p.s ! c} ;
s = table {NPCase (Nom | Gen) => [] ; c => p.s ! c} ;
---- drop Gen only works in adjectival position
a = p.a
} ;
-- : Pron -> Quant ;
-- : Pron -> Quant ;
ProDropPoss p = {
s = \\_,_ => "oma" ;
sp = \\_,_ => p.s ! NPCase Gen ;
isNum = False ;
isDef = True ;
isDef = True ;
isNeg = False
} ;
lincat
lincat
ClPlus, ClPlusObj, ClPlusAdv = ClausePlus ;
Part = {s : Str} ;
lin
S_SVO part t p clp =
let
lin
S_SVO part t p clp =
let
cl = clp.s ! t.t ! t.a ! p.p ;
pa = part.s ----
in
{s = t.s ++ p.s ++ cl.subj ++ pa ++ cl.fin ++ cl.inf ++ cl.compl ++ cl.adv ++ cl.ext} ;
{s = t.s ++ p.s ++ cl.subj ++ pa ++ cl.fin ++ cl.inf ++ cl.compl ++ cl.adv ++ cl.ext} ;
S_OSV part t p clp =
let
S_OSV part t p clp =
let
cl = clp.s ! t.t ! t.a ! p.p ;
pa = part.s ----
in
{s = t.s ++ p.s ++ cl.compl ++ pa ++ cl.subj ++ cl.fin ++ cl.inf ++ cl.adv ++ cl.ext} ;
S_VSO part t p clp =
let
{s = t.s ++ p.s ++ cl.compl ++ pa ++ cl.subj ++ cl.fin ++ cl.inf ++ cl.adv ++ cl.ext} ;
S_VSO part t p clp =
let
cl = clp.s ! t.t ! t.a ! p.p ;
pa = part.s
in
{s = t.s ++ p.s ++ cl.fin ++ pa ++ cl.subj ++ cl.inf ++ cl.compl ++ cl.adv ++ cl.ext} ;
S_ASV part t p clp =
let
{s = t.s ++ p.s ++ cl.fin ++ pa ++ cl.subj ++ cl.inf ++ cl.compl ++ cl.adv ++ cl.ext} ;
S_ASV part t p clp =
let
cl = clp.s ! t.t ! t.a ! p.p ;
pa = part.s
in
{s = t.s ++ p.s ++ cl.adv ++ pa ++ cl.subj ++ cl.fin ++ cl.inf ++ cl.compl ++ cl.ext} ;
{s = t.s ++ p.s ++ cl.adv ++ pa ++ cl.subj ++ cl.fin ++ cl.inf ++ cl.compl ++ cl.ext} ;
S_OVS part t p clp =
let
S_OVS part t p clp =
let
cl = clp.s ! t.t ! t.a ! p.p ;
pa = part.s ----
in
{s = t.s ++ p.s ++ cl.compl ++ pa ++ cl.fin ++ cl.inf ++ cl.subj ++ cl.adv ++ cl.ext} ;
{s = t.s ++ p.s ++ cl.compl ++ pa ++ cl.fin ++ cl.inf ++ cl.subj ++ cl.adv ++ cl.ext} ;
PredClPlus np vp = mkClausePlus (subjForm np vp.sc) np.a vp ;
PredClPlusFocSubj np vp = insertKinClausePlus 0 (mkClausePlus (subjForm np vp.sc) np.a vp) ;
PredClPlusFocVerb np vp = insertKinClausePlus 1 (mkClausePlus (subjForm np vp.sc) np.a vp) ;
PredClPlusObj np vps obj =
PredClPlusObj np vps obj =
insertObjClausePlus 0 False (\\b => appCompl True b vps.c2 obj) (mkClausePlus (subjForm np vps.sc) np.a vps) ;
PredClPlusFocObj np vps obj =
PredClPlusFocObj np vps obj =
insertObjClausePlus 0 True (\\b => appCompl True b vps.c2 obj) (mkClausePlus (subjForm np vps.sc) np.a vps) ;
PredClPlusAdv np vp adv =
PredClPlusAdv np vp adv =
insertObjClausePlus 1 False (\\_ => adv.s) (mkClausePlus (subjForm np vp.sc) np.a vp) ;
PredClPlusFocAdv np vp adv =
PredClPlusFocAdv np vp adv =
insertObjClausePlus 1 True (\\_ => adv.s) (mkClausePlus (subjForm np vp.sc) np.a vp) ;
ClPlusWithObj c = c ;
@@ -256,4 +289,4 @@ concrete ExtraEst of ExtraEstAbs = CatEst **
gi_Part = ss "gi" | ss "ki" ;
}
}

View File

@@ -33,7 +33,7 @@ abstract ExtraEstAbs = Extra [
me_Pron : Pron ;
te_Pron : Pron ;
nad_Pron : Pron ;
OmaPoss : Quant ; -- Reflexive possessive "oma"
ProDropPoss : Pron -> Quant ; -- vaimoni --TODO Is this relevant in Estonian? Is the agreement of pronoun ever needed, or is it the same as oma?

View File

@@ -1,6 +1,6 @@
concrete GrammarEst of Grammar =
NounEst,
VerbEst,
concrete GrammarEst of Grammar =
NounEst,
VerbEst,
AdjectiveEst,
AdverbEst,
NumeralEst,

View File

@@ -1,20 +1,20 @@
concrete IdiomEst of Idiom = CatEst **
concrete IdiomEst of Idiom = CatEst **
open MorphoEst, ParadigmsEst, Prelude in {
flags optimize=all_subs ; coding=utf8;
lin
ExistNP np =
let
ExistNP np =
let
cas : Polarity -> NPForm = \p -> case p of {
Pos => NPCase Nom ; -- on olemas lammas
Neg => NPCase Part -- ei ole olemas lammast
} ;
vp = insertObj (\\_,b,_ => "olemas" ++ np.s ! cas b) (predV olla)
vp = insertObj (\\_,b,_ => "olemas" ++ linNP (cas b) np) (predV olla)
in
existClause noSubj (agrP3 Sg) vp ;
ExistIP ip =
ExistIP ip =
let
cas : NPForm = NPCase Nom ; ---- also partitive in Extra
vp = insertObj (\\_,b,_ => "olemas") (predV olla) ;
@@ -28,7 +28,7 @@ concrete IdiomEst of Idiom = CatEst **
CleftNP np rs = mkClause (\_ -> "see") (agrP3 Sg)
(insertExtrapos (rs.s ! np.a)
(insertObj (\\_,_,_ => np.s ! NPCase Nom) (predV olla))) ;
(insertObj (\\_,_,_ => linNP (NPCase Nom) np) (predV olla))) ;
-- This gives the almost forbidden "se on Porissa kun Matti asuu".
-- Est: "see on Toris, kus Mati elab" (?)
@@ -39,35 +39,20 @@ concrete IdiomEst of Idiom = CatEst **
ImpersCl vp = mkClause noSubj (agrP3 Sg) vp ;
GenericCl vp = mkClause noSubj (agrP3 Sg) {
s = \\_ => vp.s ! VIPass Pres ;
s2 = vp.s2 ;
adv = vp.adv ;
p = vp.p ;
ext = vp.ext ;
sc = vp.sc ;
} ;
GenericCl vp = mkClause noSubj (agrP3 Sg) (passiveVP vp) ;
ProgrVP vp =
let
inf = (vp.s ! VIInf InfMas ! Simul ! Pos ! agrP3 Sg).fin ;
on = predV olla
in {
s = on.s ;
s2 = \\b,p,a => vp.s2 ! b ! p ! a ++ inf ;
adv = vp.adv ;
p = vp.p ;
ext = vp.ext ;
sc = vp.sc ;
} ;
ProgrVP vp = vp ** {
v = verbOlema ;
s2 = \\b,p,a => vp.s2 ! b ! p ! a ++ (applyInfFormsVP InfMas vp).fin ;
} ;
-- This gives "otetaan oluet" instead of "ottakaamme oluet".
-- The imperative is not available in a $VP$.
ImpPl1 vp =
let vps = vp.s ! VIPass Pres ! Simul ! Pos ! Ag Pl P1
ImpPl1 vp =
let vps = mkVPForms vp.v ! VIPass Pres ! Simul ! Pos ! Ag Pl P1
in
{s = vps.fin ++ vps.inf ++
{s = vps.fin ++ vps.inf ++
vp.s2 ! True ! Pos ! Ag Pl P1 ++ vp.p ++ vp.ext
} ;

View File

@@ -1,6 +1,6 @@
concrete LexiconEst of Lexicon = CatEst ** open MorphoEst, ParadigmsEst, Prelude in {
flags
flags
optimize=values ; coding=utf8;
@@ -65,7 +65,7 @@ lin
-- Unfortunately, we cannot use a similar trick for the source (*Põltsamaast vs Põltsamaalt).
distance_N3 = mkN3 (mkN "kaugus") celative (casePrep terminative) ;
doctor_N = mkN "arst" ;
dog_N = mkN "koer" "koera" "koera" ;
dog_N = mkN "koer" "koera" "koera" "koerasse" "koerte" "koeri" ;
door_N = mkN "uks" "ukse" "ust" "uksesse" "uste" "uksi" ;
drink_V2 = mkV2 (mkV "jooma") cpartitive ;
easy_A2V = mkA2 (mkA (mkN "lihtne" "lihtsa" "lihtsat" "lihtsasse" "lihtsate" "lihtsaid")) callative ;
@@ -160,7 +160,7 @@ lin
science_N = mkN "teadus" ;
sea_N = mkN "meri" "mere" "merd" "merre" "merede" "meresid" ;
seek_V2 = mkV2 (mkV "otsima") cpartitive ;
see_V2 = mkV2 (mkV "nägema" "näha") ;
see_V2 = mkV2 (mkV "nägema" "näha") cpartitive ;
sell_V3 = mkV3 (mkV "müüma" "müüa" "müüb" "müüakse" "müüge" "müüs" "müünud" "müüdud") accPrep callative ;
send_V3 = mkV3 (mkV "saatma") accPrep callative ;
sheep_N = mkN "lammas" "lamba" "lammast" ;
@@ -216,7 +216,7 @@ lin
yellow_A = mkA (mkN "kollane" "kollase" "kollast" "kollasesse" "kollaste" "kollaseid") ;
young_A = mkA (mkN "noor" "noore" "noort") ;
do_V2 = mkV2 (mkV "tegema" "teha") ;
do_V2 = mkV2 (mkV "tegema" "teha") ;
now_Adv = mkAdv "nüüd" ;
already_Adv = mkAdv "juba" ;
@@ -232,7 +232,7 @@ lin
correct_A = mkA (mkN "õige" "õige" "õiget" "õigesse" "õigete" "õigeid") ;
dry_A = mkA (mkN "kuiv" "kuiva" "kuiva") "kuivem" "kuiveim" ;
dull_A = mkA "igav" ;
full_A = mkA (mkN "täis" "täie" "täit" "täide" "täied" "täite") "täiem" "täiim" Invariable ; -- 'täis' is one of the non-inflecting adjectives
full_A = mkA (mkN "täis" "täie" "täit" "täide" "täite" "täisi") "täiem" "täiim" Invariable ; -- 'täis' is one of the non-inflecting adjectives
heavy_A = mkA "raske" ;
near_A = mkA "lähedane" ;
rotten_A = mkA "mäda" ;
@@ -366,7 +366,7 @@ lin
oper
mkOrd1 : N -> Ord ;
mkOrd1 x = {s = x.s ; lock_Ord = <> } ;
mkOrd1 x = lin Ord x ;
cpartitive = casePrep partitive ;
ctranslative = casePrep translative ;
celative = casePrep elative ;

View File

@@ -1,11 +1,12 @@
resource MakeStructuralEst = open CatEst, ParadigmsEst, MorphoEst, Prelude in {
oper
mkConj : Str -> Str -> ParadigmsEst.Number -> Conj = \x,y,n ->
{s1 = x ; s2 = y ; n = n ; lock_Conj = <>} ;
mkSubj : Str -> Subj = \x ->
{s = x ; lock_Subj = <>} ;
mkIQuant : Str -> IQuant = \s ->
{s = \\n,c => s ; lock_IQuant = <>} ; ----
oper
mkConj : Str -> Str -> ParadigmsEst.Number -> Conj = \x,y,n -> lin Conj {
s1 = x ;
s2 = y ;
n = n
} ;
mkSubj : Str -> Subj = \x -> lin Subj {s = x} ;
mkIQuant : Str -> IQuant = \s -> lin IQuant {s = \\n,c => s} ;
}

View File

@@ -11,7 +11,7 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in {
flags optimize=all ; coding=utf8;
oper
----------------------
-- morph. paradigms --
----------------------
@@ -19,7 +19,7 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in {
--Noun paradigms in HjkEst
--Comparative adjectives
--(could just use hjk_type_IVb_audit "suurem" "a")
--(could just use hjk_type_IVb_audit "suurem" "a")
-- Comparative adjectives inflect in the same way
-- TODO: confirm this
dSuurempi : Str -> NForms = \suurem ->
@@ -47,17 +47,17 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in {
saama
(saa + "da")
(saa + "b")
(saa + "dakse")
(saa + "dakse")
(saa + "ge") -- Imper Pl
sai
(saa + "nud")
(saa + "nud")
(saa + "dud") ;
-- TS 49
-- no d/t in da, takse ; imperfect 3sg ends in s
cKaima : (_ : Str) -> VForms = \kaima ->
let
kai = Predef.tk 2 kaima ;
kai = Predef.tk 2 kaima ;
in vForms8
kaima
(kai + "a")
@@ -65,10 +65,10 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in {
(kai + "akse")
(kai + "ge")
(kai + "s")
(kai + "nud")
(kai + "nud")
(kai + "dud") ;
-- TS 49
-- TS 49
-- vowel changes in da, takse, no d/t ; imperfect 3sg ends in i
cJooma : (_ : Str) -> VForms = \jooma ->
let
@@ -78,7 +78,7 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in {
u = case o of {
"o" => "u" ;
"ö" => "ü" ;
_ => o
_ => o
} ;
q = case o of {
("o"|"ö") => "õ" ;
@@ -91,9 +91,9 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in {
juua
(joo + "b")
(juua + "kse")
(joo + "ge")
(joo + "ge")
j6i
(joo + "nud")
(joo + "nud")
(joo + "dud") ;
-- TS 50-52 (elama, muutuma, kirjutama), 53 (tegelema) alt forms
@@ -105,10 +105,10 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in {
elama
(ela + "da")
(ela + "b")
(ela + "takse")
(ela + "takse")
(ela + "ge") -- Imperative P1 Pl
(ela + "s") -- Imperfect P3 Sg
(ela + "nud")
(ela + "s") -- Imperfect P3 Sg
(ela + "nud")
(ela + "tud") ;
-- TS 53 (tegelema)
@@ -121,12 +121,12 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in {
tegelema
(tegel + "da")
(tegele + "b")
(tegel + "dakse")
(tegel + "dakse")
(tegel + "ge") -- Imperative P1 Pl
(tegele + "s") -- Imperfect P3 Sg
(tegel + "nud")
(tegel + "dud") ;
(tegele + "s") -- Imperfect P3 Sg
(tegel + "nud")
(tegel + "dud") ;
-- TS 54 (tulema)
-- consonant assimilation (l,r,n) in da, takse
-- d in tud, g in ge
@@ -146,7 +146,7 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in {
(tul + "i")
(tul + "nud")
(tul + "dud") ;
-- TS 55-56 (õppima, sündima)
-- t in takse, tud ; consonant gradation on stem
cLeppima : (_ : Str) -> VForms = \leppima ->
@@ -154,7 +154,7 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in {
leppi = Predef.tk 2 leppima ;
i = last leppi ;
lepp = init leppi ;
lepi = (weaker lepp) + i
lepi = (weaker lepp) + i
in vForms8
leppima
(leppi + "da")
@@ -164,7 +164,7 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in {
(leppi + "s") -- Imperfect P3 Sg
(leppi + "nud")
(lepi + "tud") ;
-- TS 57 (lugema)
-- Like 55-56 but irregular gradation patterns, that shouldn't be in HjkEst.weaker
--including also marssima,valssima
@@ -184,7 +184,7 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in {
_ + ("uge"|"ude") => l + "oe" ;
_ + #c + "ssi" => (init lug) + e;
_ => (weaker lug) + e
_ => (weaker lug) + e
} ;
in vForms8
lugema
@@ -195,8 +195,8 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in {
(luge + "s") -- Imperfect P3 Sg
(luge + "nud")
(loe + "tud") ;
-- TS 58 muutma, saatma,
-- like laskma (TS 62, 64), but no reduplication of stem consonant (muutma~muuta, not *muutta)
-- like andma (TS 63) but different takse (muudetakse vs. antakse)
@@ -213,8 +213,8 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in {
(muut + "is")
(muut + "nud")
(muud + "etud") ; -- always e?
-- TS 59-60 (petma~petetakse, jätma~jäetakse)
-- TS 59-60 (petma~petetakse, jätma~jäetakse)
-- takse given as second argument
cPetma : (_,_ : Str) -> VForms = \petma,jaetakse ->
let
@@ -251,8 +251,8 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in {
(jatt + "is")
(jat + "nud")
(ko + "etud") ;
-}
-}
-- TS 61 (laulma)
--vowel (a/e) given with the second argument
--veenma,naerma
@@ -268,7 +268,7 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in {
(kuul + "is")
(kuul + "nud")
(kuul + "dud") ;
-- TS 62 (tõusma), 64 (mõksma)
-- vowel (a/e) given with the second argument
-- doesn't give alt. forms joosta, joostes
@@ -283,9 +283,9 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in {
(las + "takse")
(las + "ke")
(lask + "is")
(lask + "nud")
(lask + "nud")
(las + "tud") ;
-- TS 62 alt forms
cJooksma : (_ : Str) -> VForms = \jooksma ->
let
@@ -298,10 +298,10 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in {
(joos + "takse")
(joos + "ke")
(jooks + "is")
(jooks + "nud")
(jooks + "nud")
(joos + "tud") ;
-- TS 63 (andma, murdma, hoidma)
-- TS 63 (andma, murdma, hoidma)
-- vowel given in second arg (andma~annab; tundma~tunneb)
cAndma : (_,_ : Str) -> VForms = \andma,annab ->
let
@@ -310,18 +310,18 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in {
ann = weaker and ; --murr, hoi
te = case (last ann) of { --to prevent teadma~teaab
"a" => init ann ;
_ => ann
_ => ann
} ;
in vForms8
andma
(and + "a")
annab
annab
(an + "takse")
(and + "ke")
(and + "is")
(and + "nud")
(an + "tud") ;
-- TS 65 (pesema)
-- a consonant stem verb in disguise
cPesema : (_ : Str) -> VForms = \pesema ->
@@ -356,9 +356,9 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in {
(nag + "i")
(nai + "nud")
(nah + "tud") ;
-- TS 67-68 (hüppama, tõmbama)
-- TS 67-68 (hüppama, tõmbama)
-- strong stem in ma, b, s
-- weak stem in da, takse, ge, nud, tud
-- t in da, takse; k in ge
@@ -387,7 +387,7 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in {
omb = Predef.tk 2 omble ;
omm = case omb of {
"mõt" => "mõe" ; --some "double weak" patterns; however weaker (weaker omb) makes the coverage worse
_ => weaker omb
_ => weaker omb
} ;
ommel = omm + e + l ;
in vForms8
@@ -416,23 +416,11 @@ resource MorphoEst = ResEst ** open Prelude, Predef, HjkEst in {
(satu + "tud") ; -- PastPartPass
-----------------
-- auxiliaries --
-----------------
{- Noun internal opers moved to ResEst
These used to be here:
NForms : Type = Predef.Ints 5 => Str ;
Noun : Type = {s: NForm => Str } ;
nForms6 : (x1,_,_,_,_,x6 : Str) -> NForms ;
n2nforms : Noun -> NForms ;
nForms2N : NForms -> Noun ;
-}
-- Adjective forms
AForms : Type = {
@@ -445,22 +433,21 @@ These used to be here:
aForms2A : AForms -> Adjective = \afs -> {
s = table {
Posit => table {
AN n => (nForms2N afs.posit).s ! n ;
AN n => (nForms2N afs.posit).s ! n ;
AAdv => afs.adv_posit
} ;
Compar => table {
AN n => (nForms2N afs.compar).s ! n ;
AN n => (nForms2N afs.compar).s ! n ;
AAdv => afs.adv_compar
} ;
Superl => table {
AN n => (nForms2N afs.superl).s ! n ;
AN n => (nForms2N afs.superl).s ! n ;
AAdv => afs.adv_superl
}
} ;
lock_A = <>
} ;
nforms2aforms : NForms -> AForms = \nforms ->
nforms2aforms : NForms -> AForms = \nforms ->
let
suure = init (nforms ! 1) ;
suur = Predef.tk 4 (nforms ! 8) ;
@@ -473,21 +460,12 @@ These used to be here:
adv_superl = suur + "immin" ;
} ;
{- Verb internal opers moved to ResEst
These used to be here:
VForms : Type = Predef.Ints 7 => Str ;
vForms8 : (x1,_,_,_,_,_,_,x8 : Str) -> VForms ;
regVForms : (x1,_,_,x4 : Str) -> VForms ;
vforms2V : VForms -> Verb ;
-}
-----------------------
-- for Structural
-----------------------
caseTable : Number -> Noun -> Case => Str = \n,cn ->
caseTable : Number -> Noun -> Case => Str = \n,cn ->
\\c => cn.s ! NCase n c ;
mkDet : Number -> Noun -> {
@@ -505,35 +483,30 @@ caseTable : Number -> Noun -> Case => Str = \n,cn ->
-- Here we define personal and relative pronouns.
-- input forms: Nom, Gen, Part
-- Note that the Fin version required 5 input forms, the
-- Est pronouns thus seem to be much simpler.
-- TODO: remove NPAcc?
-- I: keep NPAcc; see appCompl in ResEst, it takes care of finding a right case for various types of complements; incl. when pronouns get different treatment than nouns (PassVP).
-- NPAcc is same as Part for Pron, and same as Gen for other nominals.
-- ResEst.appCompl returns right case for various types of complements,
-- incl. when pronouns get different treatment than nouns (like in PassV2).
mkPronoun : (_,_,_ : Str) -> Number -> Person ->
{s : NPForm => Str ; a : Agr} =
{s : NPForm => Str ; a : Agr} =
\mina, minu, mind, n, p ->
let {
minu_short = ie_to_i minu
} in
} in
{s = table {
NPCase Nom => mina ;
NPCase Gen => minu ;
NPCase Part => mind ;
NPCase Transl => minu + "ks" ;
NPCase Ess => minu + "na" ;
NPCase Iness => minu_short + "s" ;
NPCase Elat => minu_short + "st" ;
NPCase Illat => minu_short + "sse" ;
NPCase Adess => minu_short + "l" ;
NPCase Ablat => minu_short + "lt" ;
NPCase Allat => minu_short + "le" ;
NPCase Abess => minu + "ta" ;
NPCase Comit => minu + "ga" ;
NPCase Termin => minu + "ni" ;
NPAcc => mind
} ;
a = Ag n p
} ;
} ;
-- meiesse/teiesse -> meisse/teisse
ie_to_i : Str -> Str ;
@@ -543,77 +516,67 @@ caseTable : Number -> Noun -> Case => Str = \n,cn ->
_ => x
} ;
shortPronoun : (_,_,_,_ : Str) -> Number -> Person ->
{s : NPForm => Str ; a : Agr} =
-- NB. This doesn't work correctly with stem+suffix based solution:
-- Ess, Abess, Comit, Termin all use the long Gen stem.
-- Alternative 1: let Gen be long form, leaving only Nom and Part actually short
-- Alternative 2: leave Gen short, postprocess Ess, Abess, Comit, Termin in application
-- Alternative 3: include two Gen stems in NPForm
shortPronoun : (_,_,_,_ : Str) -> Number -> Person ->
{s : NPForm => Str ; a : Agr} =
\ma, mu, mind, minu, n, p ->
let shortMa = mkPronoun ma mu mind n p ;
mulle : Str = case mu of {
"mu" => "mulle" ;
"mu" => "mulle" ;
"su" => "sulle" ;
_ => shortMa.s ! NPCase Allat
_ => shortMa.s ! NPCase Allat
} ;
in shortMa ** { s = table {
NPCase Gen => minu ; -- this is Alternative 1, see comment above. Comment out for Alternative 2.
NPCase Allat => mulle ;
NPCase Transl => minu + "ks" ;
NPCase Ess => minu + "na" ;
NPCase Abess => minu + "ta" ;
NPCase Comit => minu + "ga" ;
NPCase Termin => minu + "ni" ;
x => shortMa.s ! x } } ;
oper
relPron : NForm => Str =
let mis = nForms2N (nForms6 "mis" "mille" "mida" "millesse" "mille" "mida")
in fixPlNom "mis" mis.s ;
relPron : NForm => Str =
let mis = nForms2N (nForms6 "mis" "mille" "mida" "millesse" "mille" "mida")
in fixPlNom "mis" mis.s ;
kesPron : NForm => Str =
let kes = nForms2N (nForms6 "kes" "kelle" "keda" "kellesse" "kelle" "keda")
let kes = nForms2N (nForms6 "kes" "kelle" "keda" "kellesse" "kelle" "keda")
in fixPlNom "kes" kes.s ;
ProperName = {s : Case => Str} ;
-- TODO: generate using mkPronoun
pronSe : ProperName = {
s = table {
Nom => "see" ;
Gen => "selle" ;
Part => "seda" ;
Transl => "selleks" ;
Ess => "sellena" ;
Iness => "selles" ;
Elat => "sellest" ;
Illat => "sellesse" ;
Adess => "sellel" ;
Ablat => "sellelt" ;
Allat => "sellele" ;
Abess => "selleta" ;
Comit => "sellega" ;
Termin => "selleni"
Allat => "sellele"
} ;
} ;
-- TODO: generate using mkPronoun
pronNe : ProperName = {
s = table {
Nom => "need" ;
Gen => "nende" ;
Part => "neid" ;
Transl => "nendeks" ;
Ess => "nendena" ;
Iness => "nendes" ;
Elat => "nendest" ;
Illat => "nendesse" ;
Adess => "nendel" ;
Ablat => "nendelt" ;
Allat => "nendele" ;
Abess => "nendeta" ;
Comit => "nendega" ;
Termin => "nendeni"
Allat => "nendele"
} ;
} ;

View File

@@ -7,30 +7,23 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in
-- The $Number$ is subtle: "nuo autot", "nuo kolme autoa" are both plural
-- for verb agreement, but the noun form is singular in the latter.
DetCN det cn =
DetCN det cn =
let
n : Number = case det.isNum of {
True => Sg ;
_ => det.n
} ;
ncase : NPForm -> Case * NForm = \c ->
let k = npform2case n c
in
let k = npform2case n c
in
case <n, c, det.isNum, det.isDef> of {
<_, NPAcc, True,_> => <Nom,NCase Sg Part> ; -- kolm kassi (as object)
<_, NPCase Nom, True,_> => <Nom,NCase Sg Part> ; -- kolm kassi (as subject)
--Only the last word gets case ending.
<_, NPCase Comit, _, _> => <Gen,NCase n Comit> ; -- kolme kassiga
<_, NPCase Abess, _, _> => <Gen,NCase n Abess> ; -- kolme kassita
<_, NPCase Ess, _, _> => <Gen,NCase n Ess> ; -- kolme kassina
<_, NPCase Termin,_, _> => <Gen,NCase n Termin> ; -- kolme kassini
<_, _, True,_> => <k, NCase Sg k> ; -- kolmeks kassiks (all other cases)
_ => <k, NCase n k> -- kass, kassi, ... (det is not a number)
}
in {
s = \\c => let
in cn ** {
s = \\c => let
k = ncase c ;
in
det.s ! k.p1 ++ cn.s ! k.p2 ;
@@ -42,15 +35,15 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in
isPron = False
} ;
DetNP det =
DetNP det =
let
n : Number = case det.isNum of {
True => Sg ;
_ => det.n
} ;
in {
in emptyNP ** {
s = \\c => let k = npform2case n c in
det.sp ! k ;
det.sp ! k ;
a = agrP3 (case det.isDef of {
False => Sg ; -- autoja menee; kolme autoa menee
_ => det.n
@@ -58,41 +51,28 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in
isPron = False
} ;
UsePN pn = {
s = \\c => pn.s ! npform2case Sg c ;
UsePN pn = emptyNP ** {
s = \\c => pn.s ! npform2case Sg c ;
a = agrP3 Sg ;
isPron = False
} ;
UsePron p = p ** {isPron = True} ;
UsePron p = p ** {isPron = True ; postmod = []} ;
PredetNP pred np = {
PredetNP pred np = np ** {
s = \\c => pred.s ! complNumAgr np.a ! c ++ np.s ! c ;
a = np.a ;
isPron = np.isPron -- kaikki minun - ni
} ;
PPartNP np v2 =
let
let
num : Number = complNumAgr np.a ;
part : Str = v2.s ! (PastPart Pass) ;
adj : NForms = hjk_type_IVb_maakas part ;
partGen : Str = adj ! 1 ;
partEss : Str = partGen + "na"
in {
s = \\c => np.s ! c ++ part ; --partEss ;
a = np.a ;
isPron = np.isPron -- minun täällä - ni
} ;
in np ** {postmod = np.postmod ++ part} ;
AdvNP np adv = {
s = \\c => np.s ! c ++ adv.s ;
a = np.a ;
isPron = np.isPron -- minun täällä - ni
} ;
AdvNP np adv = np ** {postmod = np.postmod ++ adv.s} ;
DetQuantOrd quant num ord = {
s = \\c => quant.s ! num.n ! c ++ num.s ! Sg ! c ++ ord.s ! NCase num.n c ;
sp = \\c => quant.sp ! num.n ! c ++ num.s ! Sg ! c ++ ord.s ! NCase num.n c ;
s = \\c => quant.s ! num.n ! c ++ num.s ! Sg ! c ++ ord.s ! NCase num.n c ;
sp = \\c => quant.sp ! num.n ! c ++ num.s ! Sg ! c ++ ord.s ! NCase num.n c ;
n = num.n ;
isNum = num.isNum ;
isDef = quant.isDef
@@ -106,13 +86,28 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in
isDef = quant.isDef
} ;
DetDAP det = det ;
AdjDAP dap ap = dap ** {
s = \\c => dap.s ! c ++
case ap.infl of {
Regular => ap.s ! True ! NCase dap.n c ;
_ => ap.s ! True ! NCase dap.n Nom ---- participle
} ;
sp = \\c => dap.sp ! c ++
case ap.infl of {
Regular => ap.s ! True ! NCase dap.n c ;
_ => ap.s ! True ! NCase dap.n Nom ---- participle
} ;
} ;
PossPron p = {
s,sp = \\_,_ => p.s ! NPCase Gen ;
isNum = False ;
isDef = True --- "minun kolme autoani ovat" ; thus "...on" is missing
} ;
PossNP cn np = {s = \\nf => np.s ! NPCase Gen ++ cn.s ! nf };
PossNP cn np = np ** {s = \\nf => linNP (NPCase Gen) np ++ cn.s ! nf} ;
NumSg = {s = \\_,_ => [] ; isNum = False ; n = Sg} ;
NumPl = {s = \\_,_ => [] ; isNum = False ; n = Pl} ;
@@ -120,19 +115,19 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in
NumCard n = n ** {isNum = case n.n of {Sg => False ; _ => True}} ; -- üks raamat/kaks raamatut
NumDigits numeral = {
s = \\n,c => numeral.s ! NCard (NCase n c) ;
n = numeral.n
s = \\n,c => numeral.s ! NCard (NCase n c) ;
n = numeral.n
} ;
OrdDigits numeral = {s = \\nc => numeral.s ! NOrd nc} ;
NumNumeral numeral = {
s = \\n,c => numeral.s ! NCard (NCase n c) ;
s = \\n,c => numeral.s ! NCard (NCase n c) ;
n = numeral.n
} ;
OrdNumeral numeral = {s = \\nc => numeral.s ! NOrd nc} ;
AdNum adn num = {
s = \\n,c => adn.s ++ num.s ! n ! c ;
s = \\n,c => adn.s ++ num.s ! n ! c ;
n = num.n
} ;
@@ -141,17 +136,17 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in
OrdSuperl a = {s = \\nc => "kõige" ++ a.s ! Compar ! AN nc} ;
DefArt = {
s = \\_,_ => [] ;
sp = table {Sg => pronSe.s ; Pl => pronNe.s} ;
s = \\_,_ => [] ;
sp = table {Sg => pronSe.s ; Pl => pronNe.s} ;
isNum = False ;
isDef = True -- autot ovat
} ;
IndefArt = {
s = \\_,_ => [] ; --use isDef in DetCN
sp = \\n,c =>
(nForms2N (nForms6 "üks" "ühe" "üht" "ühesse" "ühtede"
"ühtesid")).s ! NCase n c ;
sp = \\n,c =>
(nForms2N (nForms6 "üks" "ühe" "üht" "ühesse" "ühtede"
"ühtesid")).s ! NCase n c ;
isNum,isDef = False -- autoja on
} ;
@@ -159,64 +154,65 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in
let
n : Number = Sg ;
ncase : Case -> NForm = \c -> NCase n c ;
in {
in cn ** {
s = \\c => let k = npform2case n c in
cn.s ! ncase k ;
cn.s ! ncase k ;
a = agrP3 Sg ;
isPron = False
} ;
UseN n = n ;
UseN n = emptyCN ** {
s = n.s
} ;
UseN2 n = n ;
Use2N3 f = lin N2 {
s = f.s ;
c2 = f.c2 ;
isPre = f.isPre
Use2N3 f = f ** {
postmod = []
} ;
Use3N3 f = lin N2 {
s = f.s ;
Use3N3 f = f ** {
c2 = f.c3 ;
isPre = f.isPre2 ;
postmod = []
} ;
ComplN2 f x = let compl : Str = appCompl True Pos f.c2 x in {
s = \\nf => case f.isPre of {
True => f.s ! nf ; -- N2 is pre, so compl goes into postmod
False => compl ++ f.s ! nf -- N2 isn't pre, compl goes in s before the N2
} ;
postmod = f.postmod ++ if_then_Str f.isPre compl []
} ;
-- N2 is subtype of CN, so we can reuse result of ComplN2 as a base for our CN.
-- The decision of noun-complement order is only done once, in ComplN2.
ComplN3 f x = let cn : CN = ComplN2 (Use2N3 f) x in cn ** {
c2 = f.c3 ;
isPre = f.isPre2
} ;
ComplN2 f x = {
s = \\nf => preOrPost f.isPre (f.s ! nf) (appCompl True Pos f.c2 x)
} ;
ComplN3 f x = lin N2 {
s = \\nf => preOrPost f.isPre (f.s ! nf) (appCompl True Pos f.c2 x) ;
c2 = f.c3 ;
isPre = f.isPre2
} ;
AdjCN ap cn = {
s = \\nf =>
AdjCN ap cn = cn ** {
s = \\nf =>
case ap.infl of {
(Invariable|Participle) => ap.s ! True ! (NCase Sg Nom) ++ cn.s ! nf ; --valmis kassile; väsinud kassile
Regular => case nf of {
NCase num (Ess|Abess|Comit|Termin) => ap.s ! True ! (NCase num Gen) ++ cn.s ! nf ; --suure kassiga, not *suurega kassiga
_ => ap.s ! True ! nf ++ cn.s ! nf
}
}
Invariable|Participle => ap.s ! True ! NCase Sg Nom ++ cn.s ! nf ; --valmis kassile; väsinud kassile
Regular => ap.s ! True ! nf ++ cn.s ! nf -- Ess,Abess,Comit,Termin will only get case ending after the CN, so suure kassiga, not *suurega kassiga
}
} ;
RelCN cn rs = {s = \\nf => cn.s ! nf ++ rs.s ! agrP3 (numN nf)} ;
RelCN cn rs = cn ** { -- exception to postmod rule, because RS depends on Agr
s = \\nf => cn.s ! nf ++ rs.s ! agrP3 (numN nf)
} ;
RelNP np rs = {
s = \\c => np.s ! c ++ "," ++ rs.s ! np.a ;
a = np.a ;
RelNP np rs = np ** {
postmod = np.postmod ++ "," ++ rs.s ! np.a ;
isPron = np.isPron ---- correct ?
} ;
AdvCN cn ad = {s = \\nf => cn.s ! nf ++ ad.s} ;
AdvCN cn ad = cn ** {postmod = cn.postmod ++ ad.s} ;
SentCN cn sc = {s = \\nf=> cn.s ! nf ++ sc.s} ;
SentCN cn sc = cn ** {postmod = cn.postmod ++ sc.s} ;
ApposCN cn np = {s = \\nf=> cn.s ! nf ++ np.s ! NPCase Nom} ; --- luvun x
ApposCN cn np = cn ** {postmod = cn.postmod ++ linNP (NPCase Nom) np} ; --- luvun x
oper
numN : NForm -> Number = \nf -> case nf of {

View File

@@ -2,12 +2,12 @@
--
-- Based on the Finnish Lexical Paradigms by Aarne Ranta 2003--2008
--
-- This is an API to the user of the resource grammar
-- This is an API to the user of the resource grammar
-- for adding lexical items. It gives functions for forming
-- expressions of open categories: nouns, adjectives, verbs.
--
--
-- Closed categories (determiners, pronouns, conjunctions) are
-- accessed through the resource syntax API and $Structural.gf$.
-- accessed through the resource syntax API and $Structural.gf$.
--
-- The main difference with $MorphoEst.gf$ is that the types
-- referred to are compiled resource grammar types. We have moreover
@@ -23,19 +23,20 @@
-- @author Kaarel Kaljurand
-- @version 2013-10-21
resource ParadigmsEst = open
(Predef=Predef),
Prelude,
resource ParadigmsEst = open
(Predef=Predef),
Prelude,
MorphoEst,
(ResEst=ResEst),
HjkEst,
CatEst
in {
flags optimize=noexpand ; coding=utf8;
--2 Parameters
--2 Parameters
--
-- To abstract over gender, number, and (some) case names,
-- To abstract over gender, number, and (some) case names,
-- we define the following identifiers. The application programmer
-- should always use these constants instead of the constructors
-- defined in $ResEst$.
@@ -62,6 +63,8 @@ oper
abessive : Case ; -- e.g. "karbita"
comitative : Case ; -- e.g. "karbiga"
InfForm : Type ;
infDa : InfForm ; -- e.g. "lugeda"
infDes : InfForm ; -- e.g. "lugedes"
infMa : InfForm ; -- e.g. "lugema"
@@ -69,6 +72,7 @@ oper
infMaks : InfForm ; -- e.g. "lugemaks"
infMast : InfForm ; -- e.g. "lugemast"
infMata : InfForm ; -- e.g. "lugemata"
infMine : InfForm ; -- e.g. "lugemine"
-- The following type is used for defining *rection*, i.e. complements
-- of many-place verbs and adjective. A complement can be defined by
@@ -79,19 +83,25 @@ oper
postGenPrep : Str -> Prep ; -- genitive postposition, e.g. "taga"
casePrep : Case -> Prep ; -- just case, e.g. adessive
mkPrep : overload {
mkPrep : Str -> Prep ; -- API-friendly version of postGenPrep—many applications assume there is a `mkX : Str -> X' available for any X
mkPrep : Case -> Prep ; -- API-friendly version of casePrep
mkPrep : Case -> Str -> Prep ; -- API-friendly version of postPrep
} ;
--2 Conjunctions, adverbs
mkAdv : Str -> Adv ;
mkAdV : Str -> AdV ;
mkAdN : Str -> AdN ;
mkAdA : Str -> AdA ;
mkAdv : Str -> Adv ;
mkAdV : Str -> AdV ;
mkAdN : Str -> AdN ;
mkAdA : Str -> AdA ;
mkConj : overload {
mkConj : Str -> Conj ; -- just one word, default number Sg: e.g. "ja"
mkConj : Str -> Number -> Conj ; --just one word + number: e.g. "ja" Pl
mkConj : Str -> Str -> Conj ; --two words, default number: e.g. "nii" "kui"
mkConj : Str -> Str -> Conj ; --two words, default number: e.g. "nii" "kui"
mkConj : Str -> Str -> Number -> Conj ; --two words + number: e.g. "nii" "kui" Pl
} ;
@@ -139,7 +149,7 @@ oper
-- Non-comparison one-place adjectives are just like nouns.
-- The regular adjectives are based on $regN$ in the positive.
-- Comparison adjectives have three forms.
-- Comparison adjectives have three forms.
-- The comparative and the superlative
-- are always inflected in the same way, so the nominative of them is actually
-- enough (TODO: confirm).
@@ -154,9 +164,9 @@ oper
-- Two-place adjectives need a case for the second argument.
mkA2 : A -> Prep -> A2 -- e.g. "vihane" (postGenPrep "peale")
= \a,p -> a ** {c2 = p ; lock_A2 = <>};
= \a,p -> lin A2 (a ** {c2 = p}) ;
invA : Str -> A ; -- invariable adjectives, such as genitive attributes ; no agreement to head, no comparison forms.
invA : Str -> A ; -- invariable adjectives, such as genitive attributes ; no agreement to head, no comparison forms.
--2 Verbs
--
@@ -237,8 +247,8 @@ oper
mkV2V : V -> Prep -> V2V ; -- e.g. "käskima" adessive
mkV2V : Str -> V2V ; -- e.g. "käskima" adessive
} ;
mkV2Vf : V -> Prep -> InfForm -> V2V ; -- e.g. "keelama" partitive infMast
mkV2Vf : V -> Prep -> InfForm -> V2V ; -- e.g. "keelama" partitive infMast
mkVA : overload {
mkVA : V -> Prep -> VA ; -- e.g. "muutuma" translative
mkVA : Str -> VA ; -- string, default case translative
@@ -248,21 +258,21 @@ oper
mkV2A : V -> Prep -> Prep -> V2A ; -- e.g. "värvima" genitive translative
mkV2A : Str -> V2A ; -- string, default cases genitive and translative
} ;
mkVQ : overload {
mkVQ : V -> VQ ;
mkVQ : Str -> VQ ;
mkVQ : V -> VQ ;
mkVQ : Str -> VQ ;
} ;
mkV2Q : V -> Prep -> V2Q ; -- e.g. "küsima" ablative
mkV2Q : V -> Prep -> V2Q ; -- e.g. "küsima" ablative
mkAS : A -> AS ; --%
mkA2S : A -> Prep -> A2S ; --%
mkAV : A -> AV ; --%
mkA2V : A -> Prep -> A2V ; --%
-- Notice: categories $AS, A2S, AV, A2V$ are just $A$,
-- Notice: categories $AS, A2S, AV, A2V$ are just $A$,
-- and the second argument is given
-- as an adverb. Likewise
-- as an adverb. Likewise
-- $V0$ is just $V$.
V0 : Type ; --%
@@ -272,48 +282,73 @@ oper
-- The definitions should not bother the user of the API. So they are
-- hidden from the document.
Case = MorphoEst.Case ;
Case = MorphoEst.CasePlus ;
Number = MorphoEst.Number ;
singular = Sg ;
plural = Pl ;
nominative = Nom ;
genitive = Gen ;
partitive = Part ;
illative = Illat ;
inessive = Iness ;
elative = Elat ;
allative = Allat ;
adessive = Adess ;
ablative = Ablat ;
translative = Transl ;
terminative = Termin ;
essive = Ess ;
abessive = Abess ;
comitative = Comit ;
nominative = Nominative ;
genitive = Genitive ;
partitive = Partitive ;
illative = Illative ;
inessive = Inessive ;
elative = Elative ;
allative = Allative ;
adessive = Adessive ;
ablative = Ablative ;
translative = Translative ;
terminative = Terminative ;
essive = Essive ;
abessive = Abessive ;
comitative = Comitative ;
-- IL 2022-04: after introducing stem+suffixes, 4 other cases have just genitive stems.
-- isActuallyGenitive is needed for those mkN2 and mkN3 instances that take a Prep as an argument,
-- and actual Gen gets isPre=True, and those with genitive stem+suffix should get False.
-- This is confusing and error-prone, consider restructuring/renaming things later.
isActuallyGenitive : MorphoEst.CasePlus -> Bool = \c -> case c of {
{c = MorphoEst.Gen ; suf = ""} => True ;
_ => False
} ;
-- combination of stem + suffix, e.g. infDes = {stem = InfD ; suf = "es"} ;
InfForm = ResEst.InfForms ;
infDa = InfDa ; infMa = InfMa ; infMast = InfMast ;
infDes = InfDes ; infMas = InfMas ; infMaks = InfMaks ; infMata = InfMata ;
infDes = InfDes ; infMas = InfMas ; infMaks = InfMaks ; infMata = InfMata ; infMine = InfMine ;
prePrep : Case -> Str -> Prep =
\c,p -> {c = NPCase c ; s = p ; isPre = True ; lock_Prep = <>} ;
postPrep : Case -> Str -> Prep =
\c,p -> {c = NPCase c ; s = p ; isPre = False ; lock_Prep = <>} ;
postGenPrep p = {
c = NPCase genitive ; s = p ; isPre = False ; lock_Prep = <>} ;
casePrep : Case -> Prep =
\c -> {c = NPCase c ; s = [] ; isPre = True ; lock_Prep = <>} ;
accPrep = {c = NPAcc ; s = [] ; isPre = True ; lock_Prep = <>} ;
mkAdposition : (isPre : Bool) -> Case -> Str -> Prep = \isPre,c,p -> lin Prep {
c = casep2npformp c ;
s = p ;
isPre = isPre
} ;
prePrep : Case -> Str -> Prep = mkAdposition True ;
postPrep : Case -> Str -> Prep = mkAdposition False ;
postGenPrep : Str -> Prep = postPrep genitive ;
mkPrep = overload {
mkPrep : Str -> Prep = postGenPrep ;
mkPrep : Case -> Prep = casePrep ;
mkPrep : Case -> Str -> Prep = postPrep ;
mkPrep : (isPre : Bool) -> Case -> Str -> Prep = mkAdposition
} ;
-- The Prep's isPre field is used in a special (hacky) way in mkN3 and mkN2.
-- Used to be able to match whether the Prep's case is Gen, but now several
-- Preps use the genitive stem, so we need to check if it's actually genitive.
casePrep : Case -> Prep = \c -> mkAdposition (isActuallyGenitive c) c [] ;
mkAdv : Str -> Adv = \str -> {s = str ; lock_Adv = <>} ;
mkAdV : Str -> AdV = \str -> {s = str ; lock_AdV = <>} ;
mkAdN : Str -> AdN = \str -> {s = str ; lock_AdN = <>} ;
mkAdA : Str -> AdA = \str -> {s = str ; lock_AdA = <>} ;
-- NPAcc is different, it's not formed from a Case(Plus)
accPrep : Prep = lin Prep {
c = case2npformp NPAcc ;
s = [] ;
isPre = True
} ;
mkAdv : Str -> Adv = \str -> lin Adv (ss str) ;
mkAdV : Str -> AdV = \str -> lin AdV (ss str) ;
mkAdN : Str -> AdN = \str -> lin AdN (ss str) ;
mkAdA : Str -> AdA = \str -> lin AdA (ss str) ;
mkConj = overload {
mkConj : Str -> Conj = \ja -> lin Conj ((sd2 "" ja) ** {n = Sg}) ;
mkConj : Str -> Number -> Conj = \ja,num -> lin Conj ((sd2 "" ja) ** {n = num}) ;
@@ -321,7 +356,7 @@ oper
mkConj : Str -> Str -> Number -> Conj = \nii,kui,num -> lin Conj ((sd2 nii kui) ** {n = num}) ;
} ;
mkPConj s = ss s ** {lock_PConj = <>} ;
mkPConj s = lin PConj (ss s) ;
mkN = overload {
mkN : (nisu : Str) -> N = mk1N ;
@@ -335,43 +370,42 @@ oper
} ;
-- Adjective forms (incl. comp and sup) are derived from noun forms
mk1A : Str -> A = \suur ->
let aforms = aForms2A (nforms2aforms (hjk_type suur))
in aforms ** {infl = Regular } ;
mkNA : N -> A = \suur ->
let aforms = aForms2A (nforms2aforms (n2nforms suur)) ;
in aforms ** {infl = Regular } ;
mk1A : Str -> A = \suur ->
let aforms = aForms2A (nforms2aforms (hjk_type suur))
in lin A (aforms ** {infl = Regular}) ;
mkNA : N -> A = \suur ->
let aforms = aForms2A (nforms2aforms (n2nforms suur)) ;
in lin A (aforms ** {infl = Regular}) ;
mk1N : (link : Str) -> N = \s -> nForms2N (hjk_type s) ** {lock_N = <> } ;
mk1N : (link : Str) -> N = \s -> lin N (nForms2N (hjk_type s)) ;
-- mk2N, mk3N, mk4N make sure that the user specified forms end up in the paradigm,
-- even though the rest is wrong
mk2N : (link,lingi : Str) -> N = \link,lingi ->
let nfs : NForms = (nForms2 link lingi) ;
mk2N : (link,lingi : Str) -> N = \link,lingi ->
let nfs : NForms = (nForms2 link lingi) ;
nfs_fixed : NForms = table {
0 => link ;
1 => lingi ;
2 => nfs ! 2 ;
3 => nfs ! 3 ;
4 => nfs ! 4 ;
5 => nfs ! 5
5 => nfs ! 5
} ;
in nForms2N nfs_fixed ** {lock_N = <> } ;
in lin N (nForms2N nfs_fixed) ;
mk3N : (tukk,tuku,tukku : Str) -> N = \tukk,tuku,tukku ->
let nfs : NForms = (nForms3 tukk tuku tukku) ;
mk3N : (tukk,tuku,tukku : Str) -> N = \tukk,tuku,tukku ->
let nfs : NForms = (nForms3 tukk tuku tukku) ;
nfs_fixed : NForms = table {
0 => tukk ;
1 => tuku ;
2 => tukku ;
3 => nfs ! 3 ;
4 => nfs ! 4 ;
5 => nfs ! 5
5 => nfs ! 5
} ;
in nForms2N nfs_fixed ** {lock_N = <> } ;
in lin N (nForms2N nfs_fixed) ;
mk4N : (paat,paadi,paati,paate : Str) -> N = \paat,paadi,paati,paate ->
@@ -381,20 +415,20 @@ oper
1 => paadi ;
2 => paati ;
3 => nfs ! 3 ;
4 => nfs ! 4 ;
4 => nfs ! 4 ;
5 => paate
} ;
in nForms2N nfs_fixed ** {lock_N = <> } ;
in lin N (nForms2N nfs_fixed) ;
mk6N : (oun,ouna,ouna,ounasse,ounte,ounu : Str) -> N =
\a,b,c,d,e,f -> nForms2N (nForms6 a b c d e f) ** {lock_N = <> } ;
\a,b,c,d,e,f -> lin N (nForms2N (nForms6 a b c d e f)) ;
mkStrN : Str -> N -> N = \sora,tie -> {
s = \\c => sora + tie.s ! c ; lock_N = <>
mkStrN : Str -> N -> N = \sora,tie -> tie ** {
s = \\c => sora + tie.s ! c
} ;
mkNN : N -> N -> N = \oma,tunto -> {
s = \\c => oma.s ! c + tunto.s ! c ; lock_N = <>
mkNN : N -> N -> N = \oma,tunto -> tunto ** {
s = \\c => oma.s ! c + tunto.s ! c ;
} ; ---- TODO: oma in possessive suffix forms
@@ -510,7 +544,7 @@ oper
-- voolik/vooliku/voolikut
<_ + #c, _ + #v, _ + #v + "t"> => hjk_type_IVb_audit tukk u ;
_ => nForms2 tukk tuku
_ => nForms2 tukk tuku
} ;
nForms4 : (_,_,_,_ : Str) -> NForms = \paat,paadi,paati,paate ->
@@ -518,33 +552,33 @@ oper
-- distinguish between joonis and segadus
<_ +("ne"|"s"), _+"se", _+"st", _+"seid"> => hjk_type_Va_otsene paat ;
<_ +("ne"|"s"), _+"se", _+"st", _+"si"> => hjk_type_Vb_oluline paat ;
<_ +"ne", _+"se", _+"set", _+"seid"> => nForms3 paat paadi paati ; -- -ne adjectives ('algne') are not like 'tõuge'
--distinguish between kõne and aine
<_ +"e", _+"e", _+"et", _+"sid"> => hjk_type_III_ratsu paat ;
<_ +"e", _+"e", _+"et", _+"sid"> => hjk_type_III_ratsu paat ;
<_ +"e", _+"e", _+"et", _+"eid"> => hjk_type_VII_touge2 paat paadi ;
_ => nForms3 paat paadi paati
_ => nForms3 paat paadi paati
} ;
{-
--Version that uses pl gen instead of pl part
nForms4 : (_,_,_,_ : Str) -> NForms = \paat,paadi,paati,paatide ->
nForms4 : (_,_,_,_ : Str) -> NForms = \paat,paadi,paati,paatide ->
case <paat,paadi,paati,paatide> of {
-- pl gen can't distinguish between joonis and segadus
-- <_ +("ne"|"s"), _+"se", _+"st", _+"seid"> => hjk_type_Va_otsene paat ;
-- <_ +("ne"|"s"), _+"se", _+"st", _+"si"> => hjk_type_Vb_oluline paat ;
--pl gen can distinguish between kõne and aine
--plus side that any noun that is formed with 4-arg,
--the user given forms are inserted to the paradigm,
--the user given forms are inserted to the paradigm,
--and more forms are created from pl gen, none from pl part
<_ +"e", _+"e", _+"et", _+"de"> => hjk_type_III_ratsu paat ;
<_ +"e", _+"e", _+"et", _+"de"> => hjk_type_III_ratsu paat ;
<_ +"e", _+"e", _+"et", _+"te"> => hjk_type_VII_touge2 paat paadi ;
_ => nForms3 paat paadi paati
} ;
_ => nForms3 paat paadi paati
} ;
-}
mkN2 = overload {
@@ -552,57 +586,61 @@ oper
mkN2 : N -> Prep -> N2 = mmkN2
} ;
mmkN2 : N -> Prep -> N2 = \n,c -> n ** {c2 = c ; isPre = mkIsPre c ; lock_N2 = <>} ;
mkN3 = \n,c,e -> n ** {c2 = c ; c3 = e ;
mmkN2 : N -> Prep -> N2 = \n,c -> lin N2 (n ** {
c2 = c ;
isPre = mkIsPre c ;
postmod = []
}) ;
mkN3 = \n,c,e -> lin N3 (n ** {
c2 = c ; c3 = e ;
isPre = mkIsPre c ; -- matka Londonist Pariisi
isPre2 = mkIsPre e ; -- Suomen voitto Ruotsista
lock_N3 = <>
} ;
mkIsPre : Prep -> Bool = \p -> case p.c of {
}) ;
mkIsPre : Prep -> Bool = \p -> case p.c.npf of {
NPCase Gen => notB p.isPre ; -- Jussin veli (prep is <Gen,"",True>, isPre becomes False)
_ => True -- syyte Jussia vastaan, puhe Jussin puolesta
} ;
mkPN = overload {
mkPN : Str -> PN = mkPN_1 ;
mkPN : N -> PN = \s -> {s = \\c => s.s ! NCase Sg c ; lock_PN = <>} ;
mkPN : N -> PN = \s -> lin PN {s = \\c => s.s ! NCase Sg c} ;
} ;
mkPN_1 : Str -> PN = \s -> {s = \\c => (mk1N s).s ! NCase Sg c ; lock_PN = <>} ;
mkPN_1 : Str -> PN = \s -> lin PN {s = \\c => (mk1N s).s ! NCase Sg c} ;
-- adjectives
mkA = overload {
mkA : Str -> A = mkA_1 ;
mkA : N -> A = \n -> noun2adjDeg n ** {infl = Regular ; lock_A = <>} ;
mkA : N -> A = \n -> noun2adjDeg n ** {infl = Regular} ;
mkA : N -> (parem,parim : Str) -> A = regAdjective ;
mkA : N -> (infl : Infl) -> A = \n,infl -> noun2adjDeg n ** {infl = infl ; lock_A = <>} ;
mkA : N -> (infl : Infl) -> A = \n,infl -> noun2adjDeg n ** {infl = infl} ;
-- TODO: temporary usage of regAdjective1
mkA : N -> (valmim,valmeim : Str) -> (infl : Infl) -> A =
\n,c,s,infl -> (regAdjective1 n c s) ** {infl = infl ; lock_A = <>} ;
\n,c,s,infl -> (regAdjective1 n c s) ** {infl = infl} ;
} ;
invA balti = {s = \\_,_ => balti ; infl = Invariable ; lock_A = <>} ;
invA balti = lin A {s = \\_,_ => balti ; infl = Invariable} ;
mkA_1 : Str -> A = \x -> noun2adjDeg (mk1N x) ** {infl = Regular ; lock_A = <>} ;
mkA_1 : Str -> A = \x -> noun2adjDeg (mk1N x) ** {infl = Regular } ;
-- auxiliaries
mkAdjective : (_,_,_ : Adj) -> A = \hea,parem,parim ->
{s = table {
mkAdjective : (_,_,_ : Adj) -> A = \hea,parem,parim -> lin A ({
s = table {
Posit => hea.s ;
Compar => parem.s ;
Superl => parim.s
} ;
infl = Regular ;
lock_A = <>
} ;
}) ;
-- Adjectives whose comparison forms are explicitly given.
-- The inflection of these forms with the audit-rule always works.
regAdjective : Noun -> Str -> Str -> A = \posit,compar,superl ->
mkAdjective
(noun2adj posit)
mkAdjective
(noun2adj posit)
(noun2adjComp False (nForms2N (hjk_type_IVb_audit compar "a")))
(noun2adjComp False (nForms2N (hjk_type_IVb_audit superl "a"))) ;
@@ -617,7 +655,7 @@ oper
-- e.g. lai -> laiem -> laiim? / laieim?
-- See also: http://www.eki.ee/books/ekk09/index.php?p=3&p1=4&id=208
-- Rather use "kõige" + Comp instead of the superlative.
noun2adjDeg : Noun -> Adjective = \kaunis ->
noun2adjDeg : Noun -> A = \kaunis ->
let
kauni = (kaunis.s ! NCase Sg Gen) ;
-- Convert the final 'i' to 'e' for the superlative
@@ -637,31 +675,17 @@ oper
mkV : (aru : Str) -> (saama : V) -> V = mkPV ; -- particle verbs
} ;
mk1V : Str -> V = \s ->
let vfs = vforms2V (vForms1 s) in
vfs ** {sc = NPCase Nom ; lock_V = <>} ;
mk2V : (_,_ : Str) -> V = \x,y ->
let
vfs = vforms2V (vForms2 x y)
in vfs ** {sc = NPCase Nom ; lock_V = <>} ;
mk3V : (_,_,_ : Str) -> V = \x,y,z ->
let
vfs = vforms2V (vForms3 x y z)
in vfs ** {sc = NPCase Nom ; lock_V = <>} ;
mk4V : (x1,_,_,x4 : Str) -> V = \a,b,c,d ->
let
vfs = vforms2V (vForms4 a b c d)
in vfs ** {sc = NPCase Nom ; lock_V = <>} ;
mk8V : (x1,_,_,_,_,_,_,x8 : Str) -> V = \a,b,c,d,e,f,g,h ->
let
vfs = vforms2V (vForms8 a b c d e f g h)
in vfs ** {sc = NPCase Nom ; lock_V = <>} ;
mkPV : (aru : Str) -> (saama : V) -> V = \aru,saama ->
{s = saama.s ; p = aru ; sc = saama.sc ; lock_V = <> } ;
-- This used to be the last case: _ => Predef.error (["expected infinitive, found"] ++ ottaa)
-- regexp example: ("" | ?) + ("a" | "e" | "i") + _ + "aa" =>
vforms2v : ResEst.VForms -> CatEst.V = \vfs -> lin V (vforms2verb vfs ** {sc = NPCase Nom}) ;
mk1V : Str -> V = \s -> vforms2v (vForms1 s) ;
mk2V : (_,_ : Str) -> V = \x,y -> vforms2v (vForms2 x y) ;
mk3V : (_,_,_ : Str) -> V = \x,y,z -> vforms2v (vForms3 x y z) ;
mk4V : (x1,_,_,x4 : Str) -> V = \a,b,c,d -> vforms2v (vForms4 a b c d) ;
mk8V : (x1,_,_,_,_,_,_,x8 : Str) -> V = \a,b,c,d,e,f,g,h -> vforms2v (vForms8 a b c d e f g h) ;
mkPV : (aru : Str) -> (saama : V) -> V = \aru,saama -> saama ** {p=aru} ;
-- This used to be the last case: _ => Predef.error (["expected infinitive, found"] ++ ottaa)
-- regexp example: ("" | ?) + ("a" | "e" | "i") + _ + "aa" =>
vForms1 : Str -> VForms = \lugema ->
let
luge = Predef.tk 2 lugema ;
@@ -672,7 +696,7 @@ oper
-- Small class of CVVma
? + ("ä"|"õ"|"i") + "ima" =>
cKaima lugema ; --käima,viima,võima
? + ("aa"|"ee"|"ää") + "ma" =>
? + ("aa"|"ee"|"ää") + "ma" =>
cSaama lugema ; -- saama,jääma,keema
? + ("oo"|"öö"|"üü") + "ma" =>
cJooma lugema ; --jooma,looma,lööma,müüma,pooma,sööma,tooma
@@ -680,30 +704,30 @@ oper
-- TS 53
_ + #c + #v + "elema" =>
cTegelema lugema ; --not aelema
-- TS 54
-- Small class, just list all members
("tule"|"sure"|"pane") + "ma" =>
cTulema lugema ;
-- TS 55-57
-- Consonant gradation
-- Regular (55-56)'leppima' and irregular (57) 'lugema'
-- For reliable results regarding consonant gradation, use mk3V
_ + "ndima" =>
cLeppima lugema ;
_ + #lmnr + ("k"|"p"|"t"|"b") + ("ima"|"uma") =>
_ + #lmnr + ("k"|"p"|"t"|"b") + ("ima"|"uma") =>
cLeppima lugema ;
_ + ("sk"|"ps"|"ks"|"ts"|"pl") + ("ima") => --|"uma") =>
_ + ("sk"|"ps"|"ks"|"ts"|"pl") + ("ima") => --|"uma") =>
cLeppima lugema ;
_ + ("hk"|"hm"|"hn"|"hr"|"ht") + ("ima") => --most *hCuma are TS 51 (muutuma)
_ + ("hk"|"hm"|"hn"|"hr"|"ht") + ("ima") => --most *hCuma are TS 51 (muutuma)
cLeppima lugema ;
_ + #c + "ssima" => --weaker *ss = *ss; should be weaker Css = Cs
cLugema lugema ;
_ + ("pp"|"kk"|"tt"|"ss"|"ff"|"nn"|"mm"|"ll"|"rr") + ("ima"|"uma") =>
_ + ("pp"|"kk"|"tt"|"ss"|"ff"|"nn"|"mm"|"ll"|"rr") + ("ima"|"uma") =>
cLeppima lugema ;
-- TS 59 (petma, tapma)
-- TS 59 (petma, tapma)
-- Use mk4V for TS 60 (jätma, võtma)
? + #v + ("tma"|"pma") =>
cPetma lugema (luge + "etakse") ;
@@ -714,31 +738,31 @@ oper
-- TS 61 (laulma,kuulma,naerma,möönma)
-- Default vowel e for lma, a for (r|n)ma.
-- Other vowel with mk3V.
_ + "lma" =>
cKuulma lugema (loe + "eb") ;
_ + "lma" =>
cKuulma lugema (loe + "eb") ;
_ + ("r"|"n") + "ma" =>
cKuulma lugema (loe + "ab") ;
-- TS 63 (andma,hoidma)
-- Other vowel than a (tundma~tunneb) with mk3V
_ + "dma" =>
cAndma lugema (loe + "ab") ;
-- TS 62, 64 (tõusma,mõskma), default vowel e
-- 62 alt form (jooksma,joosta) with mk2V
-- Other vowel than e with mk3V
_ + #c + "ma" =>
_ + #c + "ma" =>
cLaskma lugema (loe + "eb") ;
-- TS 65 (pesema)
#c + #v + "sema" =>
cPesema lugema ;
-- TS 66 (nägema)
-- Small class, just list all members
("nägema"|"tegema") =>
cNagema lugema ;
-- TS 67-68 with mk2V
-- no 100% way to distinguish from 50-52 that end in ama
@@ -754,7 +778,7 @@ oper
-- Default case
_ =>
cElama lugema
} ;
} ;
vForms2 : (_,_ : Str) -> VForms = \petma,petta ->
-- Arguments: ma infinitive, da infinitive
@@ -781,22 +805,22 @@ oper
-- * Non-detectable gradation (sattuma~satub ; pettuma~pettub)
-- * Non-default vowel in b for TS 58-64 (laulma~laulab)
case <taguma,taguda,taob> of {
--to be sure about vowel in b
<_ + "dma", _ + "da", _> => cAndma taguma taob ;
<_, _ + #vv + #lmnr + "da", _> => cKuulma taguma taob ;
<_, _ + #c + "ta", _> => cLaskma taguma taob ;
<_, _ + #c + "ta", _> => cLaskma taguma taob ;
--irregular gradation
<_, _, (""|#c) + #c + #v + #v + "b"> => cLugema taguma ; --57
--to be sure about consonant gradation
<_ + #c + "lema", _, _> => vForms2 taguma taguda ; --catch "-Clema" first
<_ + #v + "ma", _+"da", _> => cSattumaPettuma taguma taob ;
<_ + #v + "ma", _+"da", _> => cSattumaPettuma taguma taob ;
<_,_,_> => vForms2 taguma taguda
<_,_,_> => vForms2 taguma taguda
} ;
vForms4 : (x1,_,_,x4 : Str) -> VForms = \jatma,jatta,jatab,jaetakse ->
-- 4 forms needed to get full paradigm for regular verbs
-- (source: http://www.eki.ee/books/ekk09/index.php?p=3&p1=5&id=227)
@@ -804,7 +828,7 @@ oper
-- Filter out known irregularities and give rest to regVForms.
-- Not trying to match TS 49 ; can't separate käima (49) from täima (50), or detect compounds like taaslooma.
case <jatma,jatta,jatab,jaetakse> of {
<_, _+("kka"|"ppa"|"tta"),
<_, _+("kka"|"ppa"|"tta"),
_, _+"takse"> => cPetma jatma jaetakse ;
<_ + "dma", _,
_, _+"takse"> => cAndma jatma jatab ;
@@ -813,15 +837,15 @@ oper
<_, _ + "ha", _, _> => cNagema jatma ;
<_ + #v + "sema", _ + "sta", _, _> => cPesema jatma ;
<_,_,_,_> => regVForms jatma jatta jatab jaetakse
} ;
caseV c v = {s = v.s ; p = v.p; sc = NPCase c ; lock_V = <>} ;
} ;
vOlema = verbOlema ** {sc = NPCase Nom ; lock_V = <>} ;
vMinema = verbMinema ** {sc = NPCase Nom ; lock_V = <>} ;
caseV c v = v ** {sc = NPCase c.c} ;
mk2V2 : V -> Prep -> V2 = \v,c -> v ** {c2 = c ; lock_V2 = <>} ;
caseV2 : V -> Case -> V2 = \v,c -> mk2V2 v (casePrep c) ;
vOlema = lin V (verbOlema ** {sc = NPCase Nom}) ;
vMinema = lin V (verbMinema ** {sc = NPCase Nom}) ;
mk2V2 : V -> Prep -> V2 = \v,c -> lin V2 (v ** {c2 = c}) ;
caseV2 : V -> Case -> V2 = \v,c -> mk2V2 v (casePrep c) ;
dirV2 v = mk2V2 v accPrep ;
@@ -837,69 +861,69 @@ oper
dirV2 : V -> V2 ;
mkV3 = overload {
mkV3 : V -> Prep -> Prep -> V3 = \v,p,q -> v ** {c2 = p ; c3 = q ; lock_V3 = <>} ;
mkV2 : V -> V3 = \v -> v ** {c2 = accPrep ;
c3 = (casePrep allative) ;
lock_V3 = <>} ;
mkV2 : Str -> V3 = \str -> (mkV str) ** {c2 = accPrep ;
c3 = (casePrep allative) ;
lock_V3 = <>} ;
} ;
mkV3 : V -> Prep -> Prep -> V3 = \v,p,q -> lin V3 (v ** {c2 = p ; c3 = q}) ;
mkV3 : V -> V3 = \v -> lin V3 (v ** {c2 = accPrep ; c3 = casePrep allative}) ;
mkV3 : Str -> V3 = \str ->
let v : V = mkV str
in lin V3 (v ** {c2 = accPrep ; c3 = casePrep allative})
} ;
dirV3 v p = mkV3 v accPrep (casePrep p) ;
dirdirV3 v = dirV3 v allative ;
mkVS = overload {
mkVS : V -> VS = \v -> v ** {lock_VS = <>} ;
mkVS : Str -> VS = \str -> (mkV str) ** {lock_VS = <>} ;
mkVS : V -> VS = \v -> lin VS v ;
mkVS : Str -> VS = \str -> let v : V = mkV str in lin VS v ;
} ;
mkVV = overload {
mkVV : V -> VV = \v -> mkVVf v infDa ;
mkVV : Str -> VV = \str -> mkVVf (mkV str) infDa ;
} ;
mkVVf v f = v ** {vi = f ; lock_VV = <>} ;
} ;
mkVVf v f = lin VV (v ** {vi = f}) ;
mkVQ = overload {
mkVQ : V -> VQ = \v -> v ** {lock_VQ = <>} ;
mkVQ : Str -> VQ = \str -> (mkV str) ** {lock_VQ = <>} ;
mkVQ : V -> VQ = \v -> lin VQ v ;
mkVQ : Str -> VQ = \str -> let v : V = mkV str in lin VQ v ;
} ;
V0 : Type = V ;
AS, A2S, AV : Type = A ;
A2V : Type = A2 ;
mkV0 v = v ** {lock_V = <>} ;
mkV0 v = v ;
mkV2S = overload {
mkV2S : V -> Prep -> V2S = \v,p -> (mk2V2 v p) ** {lock_V2S = <>} ;
mkV2S : Str -> V2S = \str -> (mk2V2 (mkV str) (casePrep allative)) ** {lock_VS = <>} ;
mkV2S : V -> Prep -> V2S = \v,p -> lin V2S (mk2V2 v p) ;
mkV2S : Str -> V2S = \str ->
let v : V = mkV str
in lin V2S (mk2V2 v (casePrep allative))
} ;
-- mkV2S v p = mk2V2 v p ** {lock_V2S = <>} ;
mkV2V = overload {
mkV2V : V -> Prep -> V2V = \v,p -> mkV2Vf v p infMa ;
mkV2V : V -> V2V = \v -> mkV2Vf v (casePrep genitive) infMa ;
mkV2V : Str -> V2V = \str -> mkV2Vf (mkV str) (casePrep genitive) infMa ;
} ;
mkV2Vf v p f = mk2V2 v p ** {vi = f ; lock_V2V = <>} ;
} ;
mkV2Vf v p f = lin V2V (mk2V2 v p ** {vi = f}) ;
mkVA = overload {
mkVA : V -> Prep -> VA = \v,p -> v ** {c2 = p ; lock_VA = <>} ;
mkVA : V -> VA = \v -> v ** {c2 = casePrep translative ; lock_VA = <>} ;
mkVA : Str -> VA = \str -> (mkV str) ** {c2 = casePrep translative ; lock_VA = <>} ;
mkVA : V -> Prep -> VA = \v,p -> lin VA (v ** {c2 = p}) ;
mkVA : V -> VA = \v -> lin VA (v ** {c2 = casePrep genitive}) ;
mkVA : Str -> VA = \str -> let v : V = mkV str in
lin VA (v ** {c2 = casePrep genitive}) ;
} ;
mkV2A = overload {
mkV2A : V -> Prep -> Prep -> V2A = \v,p,q -> v ** {c2 = p ; c3 = q ; lock_V2A = <>} ;
mkV2A : V -> V2A = \v -> v ** {c2 = casePrep genitive ;
c3 = casePrep translative ;
lock_V2A = <>} ;
mkV2A : Str -> V2A = \str -> (mkV str) ** {c2 = casePrep genitive ;
c3 = casePrep translative ;
lock_V2A = <>} ;
mkV2A = overload {
mkV2A : V -> Prep -> Prep -> V2A = \v,p,q ->
lin V2A (v ** {c2 = p ; c3 = q}) ;
mkV2A : V -> V2A = \v ->
lin V2A (v ** {c2 = casePrep genitive ; c3 = casePrep translative}) ;
mkV2A : Str -> V2A = \str -> let v : V = mkV str in
lin V2A (v ** {c2 = casePrep genitive ; c3 = casePrep translative}) ;
} ;
mkV2Q v p = mk2V2 v p ** {lock_V2Q = <>} ;
mkV2Q v p = lin V2Q (mk2V2 v p) ;
mkAS v = v ** {lock_A = <>} ;
mkA2S v p = mkA2 v p ** {lock_A = <>} ;
mkAV v = v ** {lock_A = <>} ;
mkA2V v p = mkA2 v p ** {lock_A2 = <>} ;
mkAS a = a ;
mkA2S a p = mkA2 a p ;
mkAV a = a ;
mkA2V a p = mkA2 a p ;
} ;

View File

@@ -9,12 +9,12 @@ concrete PhraseEst of Phrase = CatEst ** open ResEst, (P = Prelude) in {
UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p ! Ag Pl P2} ;
UttImpPol pol imp = {s = pol.s ++ imp.s ! pol.p ! AgPol} ;
UttIP ip = {s = ip.s ! NPCase Nom} ;
UttIP ip = {s = linIP (NPCase Nom) ip} ;
UttIAdv iadv = iadv ;
UttNP np = {s = np.s ! NPCase Nom} ;
UttVP vp = {s = infVP (NPCase Nom) Pos (agrP3 Sg) vp InfDa} ;
UttNP np = {s = linNP (NPCase Nom) np} ;
UttVP vp = {s = infVP (NPCase Nom) Pos (agrP3 Sg) vp InfMa} ;
UttAdv adv = adv ;
UttCN np = {s = np.s ! NCase Sg Nom} ;
UttCN cn = {s = linCN (NCase Sg Nom) cn} ;
UttAP np = {s = np.s ! P.False ! NCase Sg Nom} ;
UttCard n = {s = n.s ! Sg ! Nom} ;
UttInterj i = i ;
@@ -23,6 +23,6 @@ concrete PhraseEst of Phrase = CatEst ** open ResEst, (P = Prelude) in {
PConjConj conj = {s = conj.s2} ;
NoVoc = {s = []} ;
VocNP np = {s = "," ++ np.s ! NPCase Nom} ;
VocNP np = {s = "," ++ linNP (NPCase Nom) np} ;
}

View File

@@ -8,16 +8,16 @@ concrete QuestionEst of Question = CatEst ** open ResEst, Prelude in {
s = \\t,a,p => cl.s ! t ! a ! p ! SQuest
} ;
QuestVP ip vp =
let
QuestVP ip vp =
let
cl = mkClause (subjForm (ip ** {isPron = False ; a = agrP3 ip.n}) vp.sc) (agrP3 ip.n) vp
in {
s = \\t,a,p => cl.s ! t ! a ! p ! SDecl
} ;
QuestSlash ip slash = {
s = \\t,a,p =>
let
s = \\t,a,p =>
let
cls = slash.s ! t ! a ! p ;
who = appCompl True p slash.c2 (ip ** {a = agrP3 ip.n ; isPron = False})
in
@@ -29,74 +29,68 @@ concrete QuestionEst of Question = CatEst ** open ResEst, Prelude in {
} ;
QuestIComp icomp np = {
s = \\t,a,p =>
let
s = \\t,a,p =>
let
vp = predV (verbOlema ** {sc = NPCase Nom}) ;
cl = mkClause (subjForm np vp.sc) np.a vp ;
in
icomp.s ! np.a ++ cl.s ! t ! a ! p ! SDecl
} ;
PrepIP p ip = {s =
PrepIP p ip = {s =
appCompl True Pos p (ip ** {a = agrP3 ip.n ; isPron = False})} ;
AdvIP ip adv = {
s = \\c => ip.s ! c ++ adv.s ;
n = ip.n
AdvIP ip adv = ip ** {
postmod = ip.postmod ++ adv.s ;
} ;
-- The computation of $ncase$ is a special case of that in $NounEst.DetCN$,
-- since we don't have possessive suffixes or definiteness.
--- It could still be nice to have a common oper...
-- The computation of $IdetCN$ is a special case of that in $NounEst.DetCN$,
-- because the interrogative doesn't agree.
IdetCN idet cn = let n = idet.n in {
s = \\c =>
let
k : Case = npform2case n c ;
icase : Case = Nom ; --case k of { --mis kassiga
-- (Ess|Abess|Comit|Termin) => Gen ;
-- _ => k
-- } ;
ncase : NForm = case <icase,idet.isNum> of {
<Nom, True> => NCase Sg Part ; -- mitkä kolme kytkintä
<_, True> => NCase Sg k ; -- miksi kolmeksi kytkimeksi
_ => NCase n k -- mitkä kytkimet
IdetCN idet cn = emptyIP ** {
s = \\c =>
let
k : Case = npform2case n c ;
ncase : NForm = case <k,idet.isNum> of {
<Nom, True> => NCase Sg Part ; -- TODO estonian example (Fin was "mitkä kolme kytkintä")
<_, True> => NCase Sg k ; -- TODO estonian example (Fin was "miksi kolmeksi kytkimeksi")
_ => NCase n k -- TODO estonian example (Fin was "mitkä kytkimet")
}
in
idet.s ! icase ++ cn.s ! ncase ;
n = n
} ;
idet.s ! Nom ++ -- mis
idet.post ! k ++ -- kolme
cn.s ! ncase ; -- kassi+ga
n = idet.n ; -- needed for agreement, "mis kolm kassi mängivad"
} where {
n : Number = case idet.isNum of {
True => Sg ;
False => idet.n } ;
} ;
IdetIP idet = let n = idet.n in {
s = \\c =>
let
IdetIP idet = let n = idet.n in emptyIP ** {
s = \\c =>
let
k = npform2case n c ;
in
idet.s ! k ;
case idet.isNum of {
True => idet.s ! Nom ++ idet.post ! k ;
False => idet.s ! k ++ idet.post ! k
} ;
n = n
} ;
IdetQuant idet num =
let
n = num.n ;
isn = num.isNum
in {
s = \\k =>
let
ncase = case <k,isn> of {
<Nom, True> => NCase Sg Part ; -- mitkä kolme kytkintä
<_, True> => NCase Sg k ; -- miksi kolmeksi kytkimeksi
_ => NCase n k -- mitkä kytkimet
}
in
idet.s ! n ! k ++ num.s ! Sg ! k ;
n = n ;
isNum = isn
-- The quant and the num may be inflected in different cases:
-- * mis kolme koeraga, mis kolmega
-- * millega
-- * mille 3-ga (this would be the preferable output, but currently outputs "mis 3ga")
IdetQuant idet num = num ** {
s = \\c => idet.s ! num.n ! c ;
post = \\c => num.s ! Sg ! c ;
} ;
AdvIAdv i a = {s = i.s ++ a.s} ;
CompIAdv a = {s = \\_ => a.s} ;
CompIP ip = {s = \\_ => ip.s ! NPCase Nom} ;
CompIP ip = {s = \\_ => linIP (NPCase Nom) ip} ;
}

View File

@@ -11,32 +11,34 @@ concrete RelativeEst of Relative = CatEst ** open Prelude, ResEst, MorphoEst in
} ;
RelVP rp vp = {
s = \\t,ant,b,ag =>
let
s = \\t,ant,b,ag =>
let
agr = case rp.a of {
RNoAg => ag ;
RAg a => a
} ;
cl = mkClause
(subjForm {s = rp.s ! (complNumAgr agr) ;
a = agr ; isPron = False} vp.sc) agr vp
cl = mkClause
(subjForm
(emptyNP ** {s = rp.s ! complNumAgr agr ; a = agr})
vp.sc)
agr vp
in
cl.s ! t ! ant ! b ! SDecl ;
c = NPCase Nom
} ;
RelSlash rp slash = {
s = \\t,a,p,ag =>
let
s = \\t,a,p,ag =>
let
cls = slash.s ! t ! a ! p ;
who = appCompl True p slash.c2 (rp2np (complNumAgr ag) rp)
in
who ++ cls ;
c = slash.c2.c
c = slash.c2.c.npf
} ;
FunRP p np rp = {
s = \\n,c => appCompl True Pos p (rp2np n rp) ++ np.s ! c ; --- is c OK?
s = \\n,c => appCompl True Pos p (rp2np n rp) ++ linNP c np ; --- is c OK?
a = RAg np.a
} ;

View File

@@ -15,16 +15,35 @@ resource ResEst = ParamX ** open Prelude in {
-- This is the $Case$ as needed for both nouns and $NP$s.
param
Case = Nom | Gen | Part
| Illat | Iness | Elat | Allat | Adess | Ablat
| Transl | Ess | Termin | Abess | Comit;
Case = Nom | Gen | Part | Transl
| Illat | Iness | Elat | Allat | Adess | Ablat
;
NForm = NCase Number Case ;
NForm = NCase Number Case ;
oper
-- Reduce the Case parameter: many cases use the Genitive stem and just add suffix to it
CasePlus : Type = {
c : Case ; -- e.g. Gen
suf : Str -- e.g. "ga" for comitative
} ;
Nominative = {c = Nom ; suf = []} ;
Genitive = {c = Gen ; suf = []} ;
Partitive = {c = Part ; suf = []} ;
Illative = {c = Illat ; suf = []} ;
Inessive = {c = Iness ; suf = []} ;
Elative = {c = Elat ; suf = []} ;
Allative = {c = Allat ; suf = []} ;
Adessive = {c = Adess ; suf = []} ;
Ablative = {c = Ablat ; suf = []} ;
Translative = {c = Transl ; suf = []} ;
Terminative = {c = Gen ; suf = BIND ++ "ni"} ;
Essive = {c = Gen ; suf = BIND ++ "na"} ;
Abessive = {c = Gen ; suf = BIND ++ "ta"} ;
Comitative = {c = Gen ; suf = BIND ++ "ga"} ;
param
-- Agreement of $NP$ has number*person and the polite second ("te olette valmis").
Agr = Ag Number Person | AgPol ;
oper
@@ -38,8 +57,34 @@ resource ResEst = ParamX ** open Prelude in {
} ;
oper
NP = {s : NPForm => Str ; a : Agr ; isPron : Bool} ;
IPhrase : Type = {
s : NPForm => Str ; -- the noun phrase + premodifiers
postmod : Str ; -- adverb, RS, etc. other postmods
n : Number
} ;
NPhrase : Type = {
s : NPForm => Str ; -- the noun phrase + premodifiers
postmod : Str ; -- adverb, RS, etc. other postmods
a : Agr ;
isPron : Bool
} ;
emptyNP : NPhrase = {
s = \\_ => [] ;
postmod = [] ;
a = agrP3 Sg ;
isPron = False
} ;
emptyIP : IPhrase = {
s = \\_ => [] ;
postmod = [] ;
n = Sg ;
} ;
linNP : NPForm -> NPhrase -> Str = \npf,np -> np.s ! npf ++ np.postmod ;
linIP : NPForm -> IPhrase -> Str = \npf,ip -> ip.s ! npf ++ ip.postmod ;
--
--2 Adjectives
--
@@ -52,20 +97,30 @@ param
Infl = Regular | Participle | Invariable ;
oper
Adjective : Type = {s : Degree => AForm => Str; lock_A : {}} ;
Adjective : Type = {s : Degree => AForm => Str} ;
APhrase : Type = {s : Bool => NForm => Str ; infl : Infl} ;
--2 Noun phrases
--
-- Two forms of *virtual accusative* are needed for nouns in singular,
-- the nominative and the genitive one ("loen raamatu"/"loe raamat").
-- For nouns in plural, only a nominative accusative exists in positive clauses.
-- Two forms of *virtual accusative* are needed for nouns in singular,
-- the nominative and the genitive one ("loen raamatu"/"loe raamat").
-- For nouns in plural, only a nominative accusative exists in positive clauses.
-- Pronouns use the partitive as their accusative form ("mind", "sind"), in both
-- positive and negative, indicative and imperative clauses.
param
param
NPForm = NPCase Case | NPAcc ;
oper
NPFormPlus : Type = {
npf : NPForm ; -- e.g. NPCase Gen
suf : Str -- e.g. "ga" for comitative
} ;
casep2npformp : CasePlus -> NPFormPlus = \cp -> cp ** {npf = NPCase cp.c} ;
case2npformp : NPForm -> NPFormPlus = \npf-> {npf = npf ; suf = []} ;
npform2case : Number -> NPForm -> Case = \n,f ->
-- type signature: workaround for gfc bug 9/11/2007
@@ -80,14 +135,14 @@ oper
-- A special form is needed for the negated plural imperative.
param
VForm =
Inf InfForm
VForm =
Inf InfStem
| Presn Number Person
| Impf Number Person
| Condit Number Person
| ConditPass --loetagu
| Imper Number
| ImperP3
| ImperP3
| ImperP1Pl
| ImperPass
| PassPresn Bool
@@ -98,21 +153,37 @@ param
;
Voice = Act | Pass ;
InfForm =
InfDa -- lugeda
| InfDes -- lugedes
| InfMa -- lugema
| InfMas -- lugemas
| InfMast -- lugemast
| InfMata -- lugemata
| InfMaks -- lugemaks
;
InfStem =
InfD -- luge+da/des, but can be irregular: tulla, tulles
| InfM -- lugema/mas/mast/maks/mata/mine
;
oper
InfForms : Type = {stem : InfStem ; suf : Str} ;
InfDa, InfDes, InfMa, InfMas, InfMast, InfMata, InfMaks, InfMine : InfForms ;
InfDa = {stem = InfD ; suf = "a"} ; -- lugeda
InfDes = {stem = InfD ; suf = "es"} ; -- lugedes
InfMa = {stem = InfM ; suf = "a"} ; -- lugema
InfMas = {stem = InfM ; suf = "as"} ; -- lugemas
InfMast = {stem = InfM ; suf = "ast"} ; -- lugemast
InfMata = {stem = InfM ; suf = "ata"} ; -- lugemata
InfMaks = {stem = InfM ; suf = "aks"} ; -- lugemaks
InfMine = {stem = InfM ; suf = "ine"} ; -- lugemine
applyInfFormsVP : InfForms -> VP -> {fin,inf : Str} = \if,vp ->
let vpforms : VPForms = mkVPForms vp.v ;
stemOnly : {fin,inf : Str} = vpforms ! VIInf if.stem ! Simul ! Pos ! agrP3 Sg ;
in stemOnly ** {fin = glue stemOnly.fin if.suf} ; -- Despite the name, the infinite form is in the "fin" field, "inf" contains participle
applyInfFormsV : InfForms -> (VForm => Str) -> Str = \if,vf ->
glue (vf ! Inf if.stem) if.suf ;
param
SType = SDecl | SQuest | SInv ;
--2 For $Relative$
RAgr = RNoAg | RAg Agr ;
--2 For $Numeral$
@@ -122,23 +193,27 @@ param
--2 Transformations between parameter types
oper
agrP3 : Number -> Agr = \n ->
agrP3 : Number -> Agr = \n ->
Ag n P3 ;
conjAgr : Agr -> Agr -> Agr = \a,b -> case <a,b> of {
<Ag n p, Ag m q> => Ag (conjNumber n m) (conjPerson p q) ;
<Ag n p, AgPol> => Ag Pl (conjPerson p P2) ;
<AgPol, Ag n p> => Ag Pl (conjPerson p P2) ;
_ => b
_ => b
} ;
---
Compl : Type = {s : Str ; c : NPForm ; isPre : Bool} ;
Compl : Type = {s : Str ; c : NPFormPlus ; isPre : Bool} ;
appCompl : Bool -> Polarity -> Compl -> NP -> Str = \isFin,b,co,np ->
emptyCompl : Compl = {s = "" ; c = case2npformp NPAcc ; isPre = False} ;
npfplus2compl : NPFormPlus -> Compl = \npf -> {s = [] ; c = npf ; isPre = False} ;
appCompl : Bool -> Polarity -> Compl -> NPhrase -> Str = \isFin,b,co,np ->
let
c = case co.c of {
c = case co.c.npf of {
NPAcc => case b of {
Neg => NPCase Part ; -- ma ei näe raamatut/sind
Pos => case isFin of {
@@ -149,20 +224,18 @@ param
}
}
} ;
_ => co.c
_ => co.c.npf
} ;
{-
c = case <isFin, b, co.c, np.isPron> of {
<_, Neg, NPAcc,_> => NPCase Part ; -- en näe taloa/sinua
<_, Pos, NPAcc,True> => NPAcc ; -- näen/täytyy sinut
<False,Pos, NPAcc,False> => NPCase Nom ; -- täytyy nähdä talo
<_,_,coc,_> => coc
} ;
-}
nps = np.s ! c
nps = np.s ! c ++ co.c.suf ; -- complement's NPFormPlus may include suffix for the cases based on Gen stem, e.g. comitative "ga"
in
preOrPost co.isPre co.s nps ;
preOrPost co.isPre co.s nps ++ np.postmod ;
-- Used for passive; c2 of V2/VPSlash becomes sc of VP
compl2subjcase : Compl -> NPForm = \compl ->
case compl.c.npf of {
NPCase Gen => NPCase Nom ; -- valisin koera -> koer valitakse
_ => compl.c.npf -- rääkisin koerale -> koerale räägitakse
} ;
-- For $Verb$.
Verb : Type = {
@@ -170,67 +243,89 @@ param
p : Str -- particle verbs
} ;
Verb1 : Type = Verb ** {sc : NPForm} ; --subject case, i.e. "ma näen kassi"/"mul on kass"
Verb2 : Type = Verb1 ** {c2 : Compl} ;
Verb3 : Type = Verb2 ** {c3 : Compl} ;
linV2, linV : Verb -> Str = \v -> applyInfFormsV InfMa v.s ++ v.p ;
param
VIForm =
VIFin Tense
| VIInf InfForm
VIFin Tense
| VIInf InfStem
| VIPass Tense
| VIPresPart
| VIImper
;
| VIPresPart
| VIImper
;
oper
VP : Type = {
s : VIForm => Anteriority => Polarity => Agr => {fin, inf : Str} ;
v : Verb ;
s2 : Bool => Polarity => Agr => Str ; -- raamat/raamatu/raamatut
adv : Str ;
p : Str ; --uninflecting component in multi-word verbs
ext : Str ;
sc : NPForm ;
} ;
predV : (Verb ** {sc : NPForm}) -> VP = \verb -> {
s = \\vi,ant,b,agr0 =>
let
agr = verbAgr agr0 ;
verbs = verb.s ;
part : Str = case vi of {
VIPass _ => verbs ! (PastPart Pass) ;
_ => verbs ! (PastPart Act)
} ;
einegole : Str * Str * Str = case <vi,agr.n> of {
<VIFin Pres> => <"ei", verbs ! Imper Sg, "ole"> ;
<VIFin Fut> => <"ei", verbs ! Imper Sg, "ole"> ;
<VIFin Cond> => <"ei", verbs ! Condit Sg P3, "oleks"> ;
<VIFin Past> => <"ei", part, "olnud"> ;
<VIImper, Sg> => <"ära", verbs ! Imper Sg, "ole"> ;
<VIImper, Pl> => <"ärge", verbs ! Imper Pl, "olge"> ;
<VIPass Pres> => <"ei", verbs ! PassPresn False, "ole"> ;
<VIPass Fut> => <"ei", verbs ! PassPresn False, "ole"> ; --# notpresent
<VIPass Cond> => <"ei", verbs ! ConditPass, "oleks"> ; --# notpresent
<VIPass Past> => <"ei", verbs ! PassImpf False, "olnud"> ; --# notpresent
<VIPresPart> => <"ei", verbs ! PresPart Act, "olev"> ; --# notpresent
<VIInf i> => <"ei", verbs ! Inf i, verbOlema.s ! Inf i>
} ;
ei : Str = einegole.p1 ;
neg : Str = einegole.p2 ;
ole : Str = einegole.p3 ;
olema : VForm => Str = verbOlema.s ;
vf : Str -> Str -> {fin, inf : Str} = \x,y -> {fin = x ; inf = y} ;
mkvf : VForm -> {fin, inf : Str} = \p -> case <ant,b> of {
<Simul,Pos> => vf (verbs ! p) [] ;
<Anter,Pos> => vf (olema ! p) part ;
<Simul,Neg> => vf (ei ++ neg) [] ;
<Anter,Neg> => vf (ei ++ ole) part
} ;
passiveVerb : Verb -> Verb = \verb -> verb ** {
s = table {
Presn _ _ => verb.s ! PassPresn True ;
Impf _ _ => verb.s ! PassImpf True ; --# notpresent
Condit _ _ => verb.s ! ConditPass ; --# notpresent
ImperP3 => verb.s ! ImperPass ;
Imper Sg => verb.s ! PassPresn False ; -- weird hack, because the Imper Sg field is used for negative form; if VP undergoes PassV*, then its negation should also be in passive.
PresPart _ => verb.s ! PresPart Pass ;
PastPart _ => verb.s ! PastPart Pass ;
x => verb.s ! x }
} ;
passPol = case b of {Pos => True ; Neg => False} ;
-- NB. only chooses passive verb forms, to get subject case need compl2subjcase, used in PassV2
passiveVP : VP -> VP = \vp -> vp ** {v = passiveVerb vp.v} ;
VPForms : Type = VIForm => Anteriority => Polarity => Agr => {fin, inf : Str} ;
mkVPForms : Verb -> VPForms = \verb -> \\vi,ant,b,agr0 =>
let
agr = verbAgr agr0 ;
verbs = verb.s ;
part : Str = case vi of {
VIPass _ => verbs ! PastPart Pass ;
_ => verbs ! PastPart Act
} ;
einegole : Str * Str * Str = case <vi,agr.n> of {
<VIFin Pres> => <"ei", verbs ! Imper Sg, "ole"> ;
<VIFin Fut> => <"ei", verbs ! Imper Sg, "ole"> ;
<VIFin Cond> => <"ei", verbs ! Condit Sg P3, "oleks"> ;
<VIFin Past> => <"ei", part, "olnud"> ;
<VIImper, Sg> => <"ära", verbs ! Imper Sg, "ole"> ;
<VIImper, Pl> => <"ärge", verbs ! Imper Pl, "olge"> ;
<VIPass Pres> => <"ei", verbs ! PassPresn False, "ole"> ;
<VIPass Fut> => <"ei", verbs ! PassPresn False, "ole"> ; --# notpresent
<VIPass Cond> => <"ei", verbs ! ConditPass, "oleks"> ; --# notpresent
<VIPass Past> => <"ei", verbs ! PassImpf False, "olnud"> ; --# notpresent
<VIPresPart> => <"ei", verbs ! PresPart Act, "olev"> ; --# notpresent
<VIInf i> => <"ei", verbs ! Inf i, verbOlema.s ! Inf i>
} ;
ei : Str = einegole.p1 ;
neg : Str = einegole.p2 ;
ole : Str = einegole.p3 ;
olema : VForm => Str = verbOlema.s ;
vf : Str -> Str -> {fin, inf : Str} = \x,y -> {fin = x ; inf = y} ;
mkvf : VForm -> {fin, inf : Str} = \p -> case <ant,b> of {
<Simul,Pos> => vf (verbs ! p) [] ;
<Anter,Pos> => vf (olema ! p) part ;
<Simul,Neg> => vf (ei ++ neg) [] ;
<Anter,Neg> => vf (ei ++ ole) part
} ;
passPol = case b of {Pos => True ; Neg => False} ;
in case vi of {
VIFin Past => mkvf (Impf agr.n agr.p) ; --# notpresent
@@ -246,23 +341,25 @@ oper
VIInf i => mkvf (Inf i)
} ;
predV : Verb1 -> VP = \verb -> {
v = verb ; -- ignoring the subject case of Verb, it is stored in VP.sc later
s2 = \\_,_,_ => [] ;
adv = [] ;
ext = [] ; --relative clause
p = verb.p ; --particle verbs
sc = verb.sc
sc = verb.sc
} ;
insertObj : (Bool => Polarity => Agr => Str) -> VP -> VP = \obj,vp ->
insertObj : (Bool => Polarity => Agr => Str) -> VP -> VP = \obj,vp ->
vp ** { s2 = \\fin,b,a => vp.s2 ! fin ! b ! a ++ obj ! fin ! b ! a } ;
insertObjPre : (Bool => Polarity => Agr => Str) -> VP -> VP = \obj,vp ->
insertObjPre : (Bool => Polarity => Agr => Str) -> VP -> VP = \obj,vp ->
vp ** { s2 = \\fin,b,a => obj ! fin ! b ! a ++ vp.s2 ! fin ! b ! a } ;
insertAdv : Str -> VP -> VP = \adv,vp ->
insertAdv : Str -> VP -> VP = \adv,vp ->
vp ** { adv = vp.adv ++ adv } ;
insertExtrapos : Str -> VP -> VP = \obj,vp ->
insertExtrapos : Str -> VP -> VP = \obj,vp ->
vp ** { ext = vp.ext ++ obj } ;
-- For $Sentence$.
@@ -280,12 +377,12 @@ oper
-- declarative sentence with the yes/no-queryword "kas".
-- SQuest: "kas" + SDecl
-- It would be also correct to use the Finnish structure, just without the ko-particle.
-- Inari: added a third SType, SInv.
-- Inari: added a third SType, SInv.
-- Not sure if SInv is needed, but keeping it for possible future use.
-- There's need for an inverted word order with auxiliary verbs; infVP handles that. ComplVV calls infVP, which inverts the word order for the complement VP, and puts it into the resulting VP's `compl' field.
-- SInv made by mkClause would be for cases where you just need to construct an inverted word order, and then call it from some other place; application grammar (TODO: api oper for SType) or ExtraEst.
mkClause : (Polarity -> Str) -> Agr -> VP -> Clause = \sub,agr,vp ->
{ s = \\t,a,b =>
mkClause : (Polarity -> Str) -> Agr -> VP -> Clause = \sub,agr,vp ->
{ s = \\t,a,b =>
let
c = (mkClausePlus sub agr vp).s ! t ! a ! b ;
-- saan sinust aru 0
@@ -294,51 +391,51 @@ oper
-- [sind näha] 0 tahtnud
-- täna olen ma sinust aru saanud
invCl = c.adv ++ c.fin ++ c.subj ++ c.compl ++ c.p ++ c.inf ++ c.ext
in
in
table {
SDecl => declCl ;
SQuest => "kas" ++ declCl ;
SInv => invCl
SInv => invCl
}
} ;
existClause : (Polarity -> Str) -> Agr -> VP -> Clause = \sub,agr,vp ->
{ s = \\t,a,b =>
existClause : (Polarity -> Str) -> Agr -> VP -> Clause = \sub,agr,vp ->
{ s = \\t,a,b =>
let
c = (mkClausePlus sub agr vp).s ! t ! a ! b ;
-- (mis) on olnud olemas (lammas)
declCl = c.subj ++ c.fin ++ c.inf ++ c.compl ;
in
in
table {
SQuest => "kas" ++ declCl ;
_ => declCl
_ => declCl
}
} ;
mkClausePlus : (Polarity -> Str) -> Agr -> VP -> ClausePlus =
\sub,agr,vp -> {
s = \\t,a,b =>
let
s = \\t,a,b =>
let
agrfin = case vp.sc of {
NPCase Nom => <agr,True> ;
_ => <agrP3 Sg,False> -- minule meeldib, minul on
} ;
verb = vp.s ! VIFin t ! a ! b ! agrfin.p1 ;
in {subj = sub b ;
fin = verb.fin ;
inf = verb.inf ;
verb = mkVPForms vp.v ! VIFin t ! a ! b ! agrfin.p1 ;
in {subj = sub b ;
fin = verb.fin ;
inf = verb.inf ;
compl = vp.s2 ! agrfin.p2 ! b ! agr ;
p = vp.p ;
adv = vp.adv ;
ext = vp.ext ;
adv = vp.adv ;
ext = vp.ext ;
}
} ;
insertKinClausePlus : Predef.Ints 1 -> ClausePlus -> ClausePlus = \p,cl -> {
insertKinClausePlus : Predef.Ints 1 -> ClausePlus -> ClausePlus = \p,cl -> {
s = \\t,a,b =>
let
c = cl.s ! t ! a ! b
let
c = cl.s ! t ! a ! b
in
case p of {
0 => {subj = c.subj ++ gi ; fin = c.fin ; inf = c.inf ; -- Jussikin nukkuu
@@ -348,43 +445,44 @@ oper
}
} ;
insertObjClausePlus : Predef.Ints 1 -> Bool -> (Polarity => Str) -> ClausePlus -> ClausePlus =
\p,ifKin,obj,cl -> {
insertObjClausePlus : Predef.Ints 1 -> Bool -> (Polarity => Str) -> ClausePlus -> ClausePlus =
\p,ifKin,obj,cl -> {
s = \\t,a,b =>
let
let
c = cl.s ! t ! a ! b ;
co = obj ! b ++ if_then_Str ifKin (kin b) [] ;
in case p of {
0 => {subj = c.subj ; fin = c.fin ; inf = c.inf ;
0 => {subj = c.subj ; fin = c.fin ; inf = c.inf ;
compl = co ; p = c.p ; adv = c.compl ++ c.adv ; ext = c.ext ; h = c.h} ; -- Jussi juo maitoakin
1 => {subj = c.subj ; fin = c.fin ; inf = c.inf ;
1 => {subj = c.subj ; fin = c.fin ; inf = c.inf ;
compl = c.compl ; p = c.p ; adv = co ; ext = c.adv ++ c.ext ; h = c.h} -- Jussi nukkuu nytkin
}
} ;
kin : Polarity -> Str =
kin : Polarity -> Str =
\p -> case p of {Pos => "gi" ; Neg => "gi"} ;
--allomorph "ki", depends only on phonetic rules "üks+ki", "ühe+gi"
--allomorph "ki", depends only on phonetic rules "üks+ki", "ühe+gi"
--waiting for post construction in GF :P
gi : Str = "gi" ;
-- This is used for subjects of passives: therefore isFin in False.
subjForm : NP -> NPForm -> Polarity -> Str = \np,sc,b ->
appCompl False b {s = [] ; c = sc ; isPre = True} np ;
subjForm : NPhrase -> NPForm -> Polarity -> Str = \np,sc,b ->
appCompl False b {s = [] ; c = case2npformp sc ; isPre = True} np ;
infVP : NPForm -> Polarity -> Agr -> VP -> InfForm -> Str = infVPAnt Simul ;
infVP : NPForm -> Polarity -> Agr -> VP -> InfForms -> Str = infVPAnt Simul ;
infVPAnt : Anteriority -> NPForm -> Polarity -> Agr -> VP -> InfForm -> Str =
infVPAnt : Anteriority -> NPForm -> Polarity -> Agr -> VP -> InfForms -> Str =
\ant,sc,pol,agr,vp,vi ->
let
fin = case sc of { -- subject case
NPCase Nom => True ; -- mina tahan joosta
_ => False -- minul peab auto olema
let
complCase = case sc of { -- choosing case for the complement. sometimes this function is called so that sc is the VP's subject case, but other times it's some other form.
NPCase Nom => True ;
_ => False
} ;
verb = vp.s ! VIInf vi ! ant ! Pos ! agr ; -- no "ei"
compl = vp.s2 ! fin ! pol ! agr ; -- but compl. case propagated
verbStem = mkVPForms vp.v ! VIInf vi.stem ! ant ! Pos ! agr ; -- no "ei"
verb = verbStem ** {fin = glue verbStem.fin vi.suf} ;
compl = vp.s2 ! complCase ! pol ! agr ; -- but compl. case propagated
adv = vp.adv
in
-- inverted word order; e.g.
@@ -393,12 +491,12 @@ oper
--TODO adv placement?
--TODO inf ++ fin or fin ++ inf? does it ever become a case here?
-- The definitions below were moved here from $MorphoEst$ so that
-- The definitions below were moved here from $MorphoEst$ so that
-- auxiliary of predication can be defined.
verbOlema : Verb =
verbOlema : Verb =
let olema = mkVerb
"olema" "olla" "olen" "ollakse"
"olema" "olla" "olen" "ollakse"
"olge" "oli" "olnud" "oldud"
in {s = table {
Presn _ P3 => "on" ;
@@ -407,9 +505,9 @@ oper
p = []
} ;
verbMinema : Verb =
let minema = mkVerb
"minema" "minna" "läheb" "minnakse"
verbMinema : Verb =
let minema = mkVerb
"minema" "minna" "läheb" "minnakse"
"minge" "läks" "läinud" "mindud"
in {s = table {
Impf Sg P1 => "läksin" ;
@@ -422,20 +520,17 @@ oper
} ;
p = []
} ;
--3 Verbs
--Auxiliary for internal use
mkVerb : (x1,_,_,_,_,_,_,x8 : Str) -> Verb =
\tulema,tulla,tuleb,tullakse,tulge,tuli,tulnud,tuldud ->
vforms2V (vForms8
tulema tulla tuleb tullakse tulge tuli tulnud tuldud
) ;
mkVerb : (x1,_,_,_,_,_,_,x8 : Str) -> Verb =
\tulema,tulla,tuleb,tullakse,tulge,tuli,tulnud,tuldud ->
vforms2verb (vForms8 tulema tulla tuleb tullakse tulge tuli tulnud tuldud) ;
--below moved here from MorphoEst
VForms : Type = Predef.Ints 7 => Str ;
vForms8 : (x1,_,_,_,_,_,_,x8 : Str) -> VForms =
\tulema,tulla,tuleb,tullakse,tulge,tuli,tulnud,tuldud ->
table {
@@ -449,40 +544,40 @@ oper
7 => tuldud
} ;
vforms2V : VForms -> Verb = \vh ->
vforms2verb : VForms -> Verb = \vh ->
let
tulema = vh ! 0 ;
tulla = vh ! 1 ;
tuleb = vh ! 2 ;
tullakse = vh ! 3 ; --juuakse; loetakse
tulge = vh ! 4 ; --necessary for tulla, surra (otherwise *tulege, *surege)
tulema = vh ! 0 ;
tulla = vh ! 1 ;
tuleb = vh ! 2 ;
tullakse = vh ! 3 ; --juuakse; loetakse
tulge = vh ! 4 ; --necessary for tulla, surra (otherwise *tulege, *surege)
tuli = vh ! 5 ; --necessary for jooma-juua-jõi
tulnud = vh ! 6 ;
tuldud = vh ! 7 ; --necessary for t/d in tuldi; loeti
tull_ = init tulla ; --juu(a); saad(a); tull(a);
tulles = tull_ + "es" ; --juues; saades; tulles;
tule_ = init tuleb ;
lask_ = Predef.tk 2 tulema ;
laulev = case (last lask_) of { --sooma~soov ; laulma~laulev
("a"|"e"|"i"|"o"|"u"|"õ"|"ä"|"ö"|"ü") => lask_ + "v" ;
_ => lask_ + "ev" } ; --consonant stem in -ma, add e
--imperfect stem
kaisi_ = case (Predef.dp 3 tuli) of {
"sis" => lask_ + "i" ; --tõusin, tõusis
_ + "i" => tuli ; --jõin, jõi
_ => lask_ + "si" --käisin, käis; muutsin, muutis
};
};
tuld_ = Predef.tk 2 tuldud ; --d/t choice for tuldi etc.
tulgu = (init tulge) + "u" ;
in
{s = table {
Inf InfDa => tulla ;
Inf InfDes => tulles ;
Inf InfD => tull_ ;
Inf InfM => init tulema ;
Presn Sg P1 => tule_ + "n" ;
Presn Sg P2 => tule_ + "d" ;
Presn Sg P3 => tuleb ;
@@ -504,27 +599,22 @@ oper
ConditPass => tuld_ + "aks" ; --# notpresent
Imper Sg => tule_ ; -- tule / ära tule
Imper Pl => tulge ; -- tulge / ärge tulge
ImperP3 => tulgu ; -- tulgu (ta/nad)
ImperP3 => tulgu ; -- tulgu (ta/nad)
ImperP1Pl => tulge + "m" ; -- tulgem
ImperPass => tuld_ + "agu" ; --tuldagu
PassPresn True => tullakse ;
PassPresn False => tuld_ + "a" ; --da or ta
PassImpf True => tuld_ + "i" ; --di or ti
PassImpf False => tuldud ;
PassImpf False => tuldud ;
Quotative Act => lask_ + "vat" ;
Quotative Pass => tuld_ + "avat" ; --d or t
PresPart Act => laulev ;
PresPart Pass => tuld_ + "av" ; --d or t
PastPart Act => tulnud ;
PastPart Pass => tuldud ;
Inf InfMa => tulema ;
Inf InfMas => tulema + "s" ;
Inf InfMast => tulema + "st" ;
Inf InfMata => tulema + "ta" ;
Inf InfMaks => tulema + "ks"
PastPart Pass => tuldud
} ;
sc = NPCase Nom ;
p = []
p = []
} ;
-- For regular verbs, paradigm from 4 base forms
@@ -541,12 +631,12 @@ oper
"t" => "k" ;
_ => "g"
} ;
toit_ = case (last vestle_) of {
toit_ = case (last vestle_) of {
("t"|"d") => vesteld_ ; --toit(ma) -> toitke;
_ => vestel_ --vestle(ma) -> vestelge
} ;
laski_ = case (last vestle_) of {
("a"|"e"|"i"|"o"|"u"|"õ"|"ä"|"ö"|"ü")
laski_ = case (last vestle_) of {
("a"|"e"|"i"|"o"|"u"|"õ"|"ä"|"ö"|"ü")
=> vestle_ ; --vestle(ma) -> vestles
_ => vestle_ + "i" --lask(ma) -> laskis
} ;
@@ -560,10 +650,10 @@ oper
(laski_ + "s") --ma: kindla kõneviisi lihtmineviku pöörded;
(toit_ + "nud") --da: isikulise tegumoe mineviku kesksõna
(jaet_ + "ud"); --takse: ülejäänud umbisikulise tgm vormid
regVerb : (_,_,_,_ : Str) -> Verb = \kinkima,kinkida,kingib,kingitakse ->
vforms2V (regVForms kinkima kinkida kingib kingitakse) ;
vforms2verb (regVForms kinkima kinkida kingib kingitakse) ;
noun2adj : Noun -> Adj = noun2adjComp True ;
@@ -574,8 +664,8 @@ oper
-- parem -> paremini
-- parim -> kõige paremini | parimalt?
noun2adjComp : Bool -> Noun -> Adj = \isPos,tuore ->
let
tuoreesti = Predef.tk 1 (tuore.s ! NCase Sg Gen) + "sti" ;
let
tuoreesti = Predef.tk 1 (tuore.s ! NCase Sg Gen) + "sti" ;
tuoreemmin = Predef.tk 2 (tuore.s ! NCase Sg Gen) + "in"
in {s = table {
AN f => tuore.s ! f ;
@@ -584,8 +674,16 @@ oper
} ;
} ;
Noun = {s : NForm => Str} ;
Noun : Type = {s : NForm => Str} ;
CNoun : Type = Noun ** {postmod : Str} ;
emptyCN : CNoun = {
s = \\nf => [] ;
postmod = []
} ;
linCN : NForm -> CNoun -> Str = \nf,cn -> cn.s ! nf ++ cn.postmod ;
-- To form an adjective, it is usually enough to give a noun declension: the
-- adverbial form is regular.
@@ -596,26 +694,26 @@ oper
compAP = icompAP [] ;
icompAP : Str -> {s : Bool => NForm => Str} -> {s : Agr => Str} = \kui,ap ->
{ s = \\agr =>
let n = complNumAgr agr ;
{ s = \\agr =>
let n = complNumAgr agr ;
in kui ++ ap.s ! False ! NCase n Nom } ;
compCN : Noun -> {s : Agr => Str} = \cn ->
{ s = \\agr =>
let n = complNumAgr agr ;
compCN : Noun -> {s : Agr => Str} = \cn ->
{ s = \\agr =>
let n = complNumAgr agr ;
in cn.s ! NCase n Nom } ;
-- Reflexive pronoun.
-- Reflexive pronoun.
--- Possessive could be shared with the more general $NounFin.DetCN$.
reflPron : Agr -> NP = \agr ->
let
reflPron : Agr -> NPhrase = \agr ->
let
ise = nForms2N (nForms6 "ise" "enda" "ennast" "endasse" "endi" "endid") ;
n = case agr of {
AgPol => Sg ;
Ag n _ => n } ;
in {
in emptyNP ** {
s = table {
NPAcc => "ennast" ;
NPCase c => fixPlNom "endid" ise.s ! NCase n c
@@ -632,7 +730,7 @@ oper
NForms : Type = Predef.Ints 5 => Str ;
nForms6 : (x1,_,_,_,_,x6 : Str) -> NForms =
nForms6 : (x1,_,_,_,_,x6 : Str) -> NForms =
\jogi,joe,joge,joesse, -- sg nom, gen, part, ill
jogede,jogesid -> table { -- pl gen, part,
0 => jogi ;
@@ -640,7 +738,7 @@ oper
2 => joge ;
3 => joesse ;
4 => jogede ;
5 => jogesid
5 => jogesid
} ;
n2nforms : Noun -> NForms = \ukko -> table {
@@ -649,12 +747,12 @@ oper
2 => ukko.s ! NCase Sg Part ;
3 => ukko.s ! NCase Sg Illat ;
4 => ukko.s ! NCase Pl Gen ;
5 => ukko.s ! NCase Pl Part
5 => ukko.s ! NCase Pl Part
} ;
-- Converts 6 given strings (Nom, Gen, Part, Illat, Gen, Part) into Noun
-- http://www.eki.ee/books/ekk09/index.php?p=3&p1=5&id=226
nForms2N : NForms -> Noun = \f ->
nForms2N : NForms -> Noun = \f ->
let
jogi = f ! 0 ;
joe = f ! 1 ;
@@ -662,44 +760,39 @@ oper
joesse = f ! 3 ;
jogede = f ! 4 ;
jogesid = f ! 5 ;
in
in
{s = table {
NCase Sg Nom => jogi ;
NCase Sg Gen => joe ;
NCase Sg Part => joge ;
NCase Sg Transl => joe + "ks" ;
NCase Sg Ess => joe + "na" ;
NCase Sg Iness => joe + "s" ;
NCase Sg Elat => joe + "st" ;
NCase Sg Illat => joesse ;
NCase Sg Adess => joe + "l" ;
NCase Sg Ablat => joe + "lt" ;
NCase Sg Allat => joe + "le" ;
NCase Sg Abess => joe + "ta" ;
NCase Sg Comit => joe + "ga" ;
NCase Sg Termin => joe + "ni" ;
NCase Pl Nom => joe + "d" ;
NCase Pl Gen => jogede ;
NCase Pl Part => jogesid ;
NCase Pl Transl => jogede + "ks" ;
NCase Pl Ess => jogede + "na" ;
NCase Pl Iness => jogede + "s" ;
NCase Pl Elat => jogede + "st" ;
NCase Pl Illat => jogede + "sse" ;
NCase Pl Adess => jogede + "l" ;
NCase Pl Ablat => jogede + "lt" ;
NCase Pl Allat => jogede + "le" ;
NCase Pl Abess => jogede + "ta" ;
NCase Pl Comit => jogede + "ga" ;
NCase Pl Termin => jogede + "ni"
NCase Pl Allat => jogede + "le"
} --;
-- lock_N = <>
}
} ;
oper
rp2np : Number -> {s : Number => NPForm => Str ; a : RAgr} -> NP = \n,rp -> {
-- Technically, we could also add a postmod field for RP,
-- because multiple applications of FunRP add multiple complements.
-- But I will only add it if I see a real-world sentence that uses multiple applications of FunRP.
RelPron : Type = {s : Number => NPForm => Str ; a : RAgr} ;
rp2np : Number -> RelPron -> NPhrase = \n,rp -> emptyNP ** {
s = rp.s ! n ;
a = agrP3 Sg ; -- does not matter (--- at least in Slash)
isPron = False -- has no special accusative
@@ -707,7 +800,19 @@ oper
etta_Conj : Str = "et" ;
heavyDet : PDet -> PDet ** {sp : Case => Str} = \d -> d ** {sp = d.s} ;
Determiner : Type = {
s : Case => Str ; -- minun kolme
sp : Case => Str ; -- se (substantival form)
n : Number ; -- Pl (agreement feature for verb)
isNum : Bool ; -- True (a numeral is present)
isDef : Bool -- True (verb agrees in Pl, Nom is not Part) --I: actually, can we get rid of this?
} ;
IDeterminer : Type = {s, post : Case => Str ; n : Number ; isNum : Bool} ;
linIDet : IDeterminer -> Str = \idet -> idet.s ! Nom ++ idet.post ! Nom ;
heavyDet : PDet -> Determiner = \d -> d ** {sp = d.s} ;
PDet : Type = {
s : Case => Str ;
n : Number ;
@@ -715,9 +820,9 @@ oper
isDef : Bool
} ;
heavyQuant : PQuant -> PQuant ** {sp : Number => Case => Str} = \d ->
d ** {sp = d.s} ;
PQuant : Type =
{s : Number => Case => Str ; isDef : Bool} ;
heavyQuant : PQuant -> PQuant ** {sp : Number => Case => Str} = \d ->
d ** {sp = d.s} ;
PQuant : Type =
{s : Number => Case => Str ; isDef : Bool} ;
}

View File

@@ -9,17 +9,17 @@ concrete SentenceEst of Sentence = CatEst ** open Prelude, ResEst in {
PredSCVP sc vp = mkClause (\_ -> sc.s) (agrP3 Sg) vp ;
ImpVP vp = {
s = \\pol,agr =>
let
verb = vp.s ! VIImper ! Simul ! pol ! agr ;
s = \\pol,agr =>
let
verb = mkVPForms vp.v ! VIImper ! Simul ! pol ! agr ;
compl = vp.s2 ! False ! pol ! agr ++ vp.ext --- False = like inf (osta auto)
in --(ära) loe raamat(ut) läbi
verb.fin ++ verb.inf ++ compl ++ vp.p ;
verb.fin ++ verb.inf ++ compl ++ vp.p ;
} ;
-- The object case is formed at the use site of $c2$, in $Relative$ and $Question$.
SlashVP np vp = {
SlashVP np vp = {
s = \\t,a,p => (mkClause (subjForm np vp.sc) np.a vp).s ! t ! a ! p ! SDecl ;
c2 = vp.c2
} ;
@@ -30,13 +30,13 @@ concrete SentenceEst of Sentence = CatEst ** open Prelude, ResEst in {
} ;
SlashPrep cl prep = {
s = \\t,a,p => cl.s ! t ! a ! p ! SDecl ;
s = \\t,a,p => cl.s ! t ! a ! p ! SDecl ;
c2 = prep
} ;
SlashVS np vs slash = {
s = \\t,a,p =>
(mkClause (subjForm np vs.sc) np.a
SlashVS np vs slash = {
s = \\t,a,p =>
(mkClause (subjForm np vs.sc) np.a
(insertExtrapos (etta_Conj ++ slash.s)
(predV vs))
).s ! t ! a ! p ! SDecl ;

View File

@@ -34,7 +34,7 @@ concrete StructuralEst of Structural = CatEst **
either7or_DConj = sd2 "kas" "või" ** {n = Sg} ;
everybody_NP = makeNP (mkN "igaüks") Sg ;
every_Det = mkDet Sg (mkN "iga") ;
everything_NP = makeNP ((mkN "kõik") ** {lock_N = <>}) Sg ;
everything_NP = makeNP (mkN "kõik") Sg ;
everywhere_Adv = ss "kõikjal" ;
few_Det = mkDet Sg (mkN "mõni") ;
--- first_Ord = {s = \\n,c => (mkN "ensimmäinen").s ! NCase n c} ;
@@ -48,6 +48,7 @@ concrete StructuralEst of Structural = CatEst **
how8much_IAdv = ss "kui palju" ;
how8many_IDet = {
s = \\c => "kui" ++ (mkN "mitu" "mitme" "mitut" "TODO" "TODO" "TODO").s ! NCase Sg c ;
post = \\c => [] ;
n = Sg ;
isNum = False
} ;
@@ -78,10 +79,8 @@ concrete StructuralEst of Structural = CatEst **
quite_Adv = ss "üsna" ;
she_Pron = mkPronoun "tema" "tema" "teda" Sg P3 ;
so_AdA = ss "nii" ;
somebody_NP = {
somebody_NP = emptyNP ** {
s = \\c => jokuPron ! Sg ! npform2case Sg c ;
a = agrP3 Sg ;
isPron = False
} ;
someSg_Det = heavyDet {
s = jokuPron ! Sg ;
@@ -92,10 +91,8 @@ concrete StructuralEst of Structural = CatEst **
isNum = False ; isDef = True ;
n = Pl
} ;
something_NP = {
something_NP = emptyNP ** {
s = \\c => mikaInt ! Sg ! npform2case Sg c ;
a = agrP3 Sg ;
isPron = False
} ;
somewhere_Adv = ss "kuskil" ;
that_Quant = heavyQuant {
@@ -133,11 +130,11 @@ concrete StructuralEst of Structural = CatEst **
very_AdA = ss "väga" ;
want_VV = mkVV (mkV "tahtma") ;
we_Pron = mkPronoun "meie" "meie" "meid" Pl P1 ;
whatPl_IP = {
whatPl_IP = emptyIP ** {
s = table {NPAcc => "mida" ; c => mikaInt ! Pl ! npform2case Pl c} ;
n = Pl
} ;
whatSg_IP = {
whatSg_IP = emptyIP ** {
s = \\c => mikaInt ! Sg ! npform2case Sg c ;
n = Sg
} ;
@@ -145,11 +142,11 @@ concrete StructuralEst of Structural = CatEst **
when_Subj = ss "kui" ;
where_IAdv = ss "kus" ;
which_IQuant = { s = mikaInt } ;
whoSg_IP = {
whoSg_IP = emptyIP ** {
s = table {NPAcc => "keda" ; c => kukaInt ! Sg ! npform2case Sg c} ;
n = Sg
} ;
whoPl_IP = {
whoPl_IP = emptyIP ** {
s = table {NPAcc => "keda" ; c => kukaInt ! Pl ! npform2case Pl c} ;
n = Pl
} ;
@@ -198,27 +195,21 @@ oper
}
} ;
--TODO does this work?
mikaInt : MorphoEst.Number => (MorphoEst.Case) => Str =
mikaInt : MorphoEst.Number => MorphoEst.Case => Str =
let {
mi = mkN "mille"
mi : N = mkN "mis" "mille" "mida" "millesse" "millede" "mida"
} in
table {
Sg => table {
Nom => "mis" ;
Gen => "mille" ;
Part => "mida" ;
c => mi.s ! NCase Sg c
} ;
Pl => table {
Nom => "mis" ;
Gen => "mille" ;
Part => "mida" ;
c => mi.s ! NCase Pl c
}
} ;
kukaInt : MorphoEst.Number => (MorphoEst.Case) => Str =
kukaInt : MorphoEst.Number => MorphoEst.Case => Str =
let
kuka = mkN "kes" "kelle" "keda" "kellesse"
"kellede" "keda" ;
@@ -256,12 +247,10 @@ oper
oper
makeNP : N -> MorphoEst.Number -> CatEst.NP ;
makeNP noun num = {
makeNP : N -> MorphoEst.Number -> NPhrase ;
makeNP noun num = emptyNP ** {
s = \\c => noun.s ! NCase num (npform2case num c) ;
a = agrP3 num ;
isPron = False ;
lock_NP = <>
} ;
lin
@@ -273,16 +262,14 @@ lin
} ;
if_then_Conj = {s1 = "kui" ; s2 = "siis" ; n = Sg} ;
nobody_NP = {
nobody_NP = emptyNP ** {
s = \\c => "mitte" ++ kukaanPron ! Sg ! npform2case Sg c ;
a = agrP3 Sg ;
isPron = False
} ;
nothing_NP = {
nothing_NP = emptyNP ** {
s = \\c => "mitte" ++ mikaanPron ! Sg ! npform2case Sg c ;
a = agrP3 Sg ;
isPron = False
} ;
at_least_AdN = ss "vähemalt" ;

View File

@@ -8,20 +8,14 @@ lin
FloatPN i = {s = \\c => i.s} ; --- c
NumPN i = {s = \\c => i.s!Sg!Nom } ; --- c
CNIntNP cn i = {
s = \\c => cn.s ! NCase Sg (npform2case Sg c) ++ i.s ;
a = agrP3 Sg ;
isPron = False
CNIntNP cn i = let np : NP = NounEst.MassNP cn in np ** {
postmod = np.postmod ++ i.s ;
} ;
CNSymbNP det cn xs = let detcn = NounEst.DetCN det cn in {
s = \\c => detcn.s ! c ++ xs.s ;
a = detcn.a ;
isPron = False
CNSymbNP det cn xs = let np : NP = NounEst.DetCN det cn in np ** {
postmod = np.postmod ++ xs.s ;
} ;
CNNumNP cn i = {
s = \\c => cn.s ! NCase Sg (npform2case Sg c) ++ i.s ! Sg ! Nom ;
a = agrP3 Sg ;
isPron = False
CNNumNP cn i = let np : NP = NounEst.MassNP cn in np ** {
postmod = np.postmod ++ i.s ! Sg ! Nom ;
} ;
SymbS sy = sy ;
@@ -29,7 +23,7 @@ lin
SymbNum n = {s = \\_,_ => n.s ; isNum = True ; n = Pl} ;
SymbOrd n = {s = \\_ => glue n.s "."} ;
lincat
lincat
Symb, [Symb] = SS ;

View File

@@ -1,6 +1,6 @@
--# -path=.:../abstract:../common
concrete TerminologyEst of Terminology = CatEst ** open
concrete TerminologyEst of Terminology = CatEst ** open
ResEst,
ParadigmsEst,
(G = GrammarEst),
@@ -17,9 +17,9 @@ lincat
ParameterType = G.N ;
Parameter = G.N ;
Modifier = G.A ;
Heading = {s : Str} ;
lin
noun_Category = mkN "käändsõna" ;
@@ -59,7 +59,7 @@ lin
active_Parameter = mkN "isikuline tegumood" ;
passive_Parameter = mkN "umbsikuline tegumood" ;
imperative_Parameter = mkN "käskiv kõneviis" "käskiva kõneviisi";
indicative_Parameter = mkN "kindel kõneviis" "kindla kõneviisi";
conjunctive_Parameter = mkN "konjunktiiv" ;
@@ -67,7 +67,7 @@ lin
present_Parameter = mkN "olevik" ;
past_Parameter = mkN "lihtminevik" ;
future_Parameter = mkN "futuur" ; ---- ???
future_Parameter = mkN "futuur" ; ---- ???
conditional_Parameter = mkN "tingiv kõneviis" "tingiva kõneviisi";
perfect_Parameter = mkN "täisminevik" ;
quotative_Parameter = mkN "kaudne kõneviis" "kaudse kõneviisi";

View File

@@ -9,17 +9,17 @@ concrete VerbEst of Verb = CatEst ** open Prelude, ResEst in {
SlashV2a v = predV v ** {c2 = v.c2} ;
Slash2V3 v np =
insertObj
Slash2V3 v np =
insertObj
(\\fin,b,_ => appCompl fin b v.c2 np) (predV v) ** {c2 = v.c3} ;
Slash3V3 v np =
insertObj
Slash3V3 v np =
insertObj
(\\fin,b,_ => appCompl fin b v.c3 np) (predV v) ** {c2 = v.c2} ;
ComplVV v vp =
insertObj
(\\_,b,a => infVP v.sc b a vp v.vi)
(predV {s = v.s ;
ComplVV v vp =
insertObj
(\\_,b,a => infVP v.sc b a vp v.vi)
(predV {s = v.s ;
p = v.p ;
sc = case vp.sc of {
NPCase Nom => v.sc ; -- minul tuleb kirjutada (VV 'tulema' determines the subject case)
@@ -30,76 +30,68 @@ concrete VerbEst of Verb = CatEst ** open Prelude, ResEst in {
ComplVS v s = insertExtrapos (etta_Conj ++ s.s) (predV v) ;
ComplVQ v q = insertExtrapos ( q.s) (predV v) ;
ComplVA v ap =
insertObj
(\\_,b,agr =>
ComplVA v ap =
insertObj
(\\_,b,agr =>
let n = (complNumAgr agr) in
ap.s ! False ! (NCase n (npform2case n v.c2.c))) --- v.cs.s ignored
ap.s ! False ! (NCase n (npform2case n v.c2.c.npf))) --- v.cs.s ignored
(predV v) ;
SlashV2S v s =
SlashV2S v s =
insertExtrapos (etta_Conj ++ s.s) (predV v) ** {c2 = v.c2} ;
SlashV2Q v q =
SlashV2Q v q =
insertExtrapos (q.s) (predV v) ** {c2 = v.c2} ;
SlashV2V v vp =
SlashV2V v vp =
insertObj (\\_,b,a => infVP v.sc b a vp v.vi) (predV v) ** {c2 = v.c2} ;
---- different infinitives
SlashV2A v ap =
insertObj
(\\fin,b,_ =>
ap.s ! False ! (NCase Sg (npform2case Sg v.c3.c))) ----agr to obj
SlashV2A v ap =
insertObj
(\\fin,b,_ =>
ap.s ! False ! (NCase Sg (npform2case Sg v.c3.c.npf))) ----agr to obj
(predV v) ** {c2 = v.c2} ;
ComplSlash vp np = insertObjPre (\\fin,b,_ => appCompl fin b vp.c2 np) vp ;
UseComp comp =
UseComp comp =
insertObj (\\_,_ => comp.s) (predV (verbOlema ** {sc = NPCase Nom})) ;
SlashVV v vp =
insertObj
(\\_,b,a => infVP v.sc b a vp v.vi)
(predV {s = v.s ;
SlashVV v vp =
insertObj
(\\_,b,a => infVP v.sc b a vp v.vi)
(predV {s = v.s ;
p = v.p ;
sc = case vp.sc of {
NPCase Nom => v.sc ; -- minun täytyy pestä auto
c => c -- minulla täytyy olla auto
}
}
}
) ** {c2 = vp.c2} ; ---- correct ??
SlashV2VNP v np vp =
insertObjPre
SlashV2VNP v np vp =
insertObjPre
(\\fin,b,a => appCompl True b v.c2 np ++ ---- fin -> stack overflow
infVP v.sc b a vp v.vi)
infVP v.sc b a vp v.vi)
(predV v) ** {c2 = vp.c2} ;
AdvVP vp adv = insertAdv adv.s vp ;
AdvVPSlash vp adv = insertAdv adv.s vp ** vp ;
VPSlashPrep vp prep = vp ** {c2 = prep} ;
AdVVP adv vp = insertAdv adv.s vp ;
ReflVP v = insertObjPre (\\fin,b,agr => appCompl fin b v.c2 (reflPron agr)) v ;
PassV2 v =
let
vp = predV v ;
subjCase = case v.c2.c of { --this is probably a reason to not get rid of NPAcc; TODO check
NPCase Gen => NPCase Nom ; --valisin koera -> koer valitakse
_ => v.c2.c --rääkisin koerale -> koerale räägitakse
}
in {
s = \\_ => vp.s ! VIPass Pres ;
s2 = \\_,_,_ => [] ;
adv = [] ;
p = vp.p ;
ext = vp.ext ;
sc = subjCase -- koer valitakse ; koerale räägitakse
PassV2 v = let vp : VP = passiveVP (predV v) in vp ** {
sc = compl2subjcase v.c2 -- koer valitakse ; koerale räägitakse
} ;
----b UseVS, UseVQ = \v -> v ** {c2 = {s = [] ; c = NPAcc ; isPre = True}} ;
CompAP = compAP ;
CompAP = compAP ;
CompCN = compCN ;
CompNP np = {s = \\_ => np.s ! NPCase Nom} ;
CompNP np = {s = \\_ => linNP (NPCase Nom) np} ;
CompAdv a = {s = \\_ => a.s} ;
}
@@ -108,17 +100,17 @@ concrete VerbEst of Verb = CatEst ** open Prelude, ResEst in {
--2 The object case
--
-- The rules involved are ComplV2 and ComplVV above.
-- The work is done jointly in ResEst.infVP and appCompl.
-- The work is done jointly in ResEst.infVP and appCompl.
-- Cases to test: l -table (to see negated forms)
--```
-- minun täytyy ostaa auto
-- PredVP (UsePron i_Pron) (ComplVV must_VV
-- PredVP (UsePron i_Pron) (ComplVV must_VV
-- (ComplV2 buy_V2 (DetCN (DetSg (SgQuant DefArt) NoOrd) (UseN car_N))))
-- minä tahdon ostaa auton
-- PredVP (UsePron i_Pron) (ComplVV want_VV
-- PredVP (UsePron i_Pron) (ComplVV want_VV
-- (ComplV2 buy_V2 (DetCN (DetSg (SgQuant DefArt) NoOrd) (UseN car_N))))
-- minulla täytyy olla auto
-- PredVP (UsePron i_Pron) (ComplVV must_VV
-- PredVP (UsePron i_Pron) (ComplVV must_VV
-- (ComplV2 have_V2 (DetCN (DetSg (SgQuant DefArt) NoOrd) (UseN car_N))))
--```
-- Unfortunately, there is no nice way to say "I want to have a car".

View File

@@ -0,0 +1,126 @@
-- Comitative, Essive, Abessive and Terminative cases are not in the inflection table of nominal categories,
-- instead they use the Genitive stem and add a suffix with BIND token.
-- Here are tests for those cases.
-- NB. Ignore any weirdness with the word "koos".
-- That just happens to be the linearisation of with_Prep,
-- we can as easily replace it with just the case -ga,
-- or in an application, have two versions, one "koos …ga" and other just "…ga".
-- But do point out any other unexpected weirdness/ungrammaticality!
-- Comitative, case attaches to the noun
Lang: PredVP (UsePron i_Pron) (AdvVP (UseV play_V) (PrepNP with_Prep (DetCN (DetQuant this_Quant NumSg) (UseN dog_N))))
LangEng: I play with this dog
LangEst: mina mängin koos selle koera BIND ga
Lang: PredVP (UsePron we_Pron) (AdvVP (UseV play_V) (PrepNP with_Prep (DetCN (DetQuant this_Quant NumPl) (UseN dog_N))))
LangEng: we play with these dogs
LangEst: meie mängime koos nende koerte BIND ga
-- Interrogative versions
-- First, reason why the interrogative pronoun doesn't inflect is this http://www.eki.ee/books/ekk09/index.php?p=5&p1=3&id=452
-- "Üldse ei ühildu: asesõnad mis (kui ta ei osuta omadusele, vaid on identifitseerivas funktsioonis) [..],
-- nt 'Mis keelt te räägite?' "
-- So because of that, it doesn't inflect in any position. Here is the eki example:
Lang: QuestSlash (IdetCN (IdetQuant which_IQuant NumSg) (UseN language_N)) (SlashVP (UsePron youSg_Pron) (SlashV2a speak_V2))
LangEng: which language do you speak
LangEst: mis keelt sina räägid
-- But should the interrogative inflect when PrepIP is applied? Or is "koos mis koeraga" still fine?
Lang: QuestIAdv (PrepIP with_Prep (IdetCN (IdetQuant which_IQuant NumSg) (UseN dog_N))) (PredVP (UsePron youSg_Pron) (UseV play_V))
LangEng: with which dog do you play
LangEst: koos mis koera BIND ga sina mängid
Lang: QuestIAdv (PrepIP with_Prep (IdetCN (IdetQuant which_IQuant NumPl) (UseN dog_N))) (PredVP (UsePron youPl_Pron) (UseV play_V))
LangEng: with which dogs do you play
LangEst: koos mis koerte BIND ga teie mängite
-- Adding a number, does it affect the behaviour of
-- a) suffix attachment? b) agreement of interrogative?
Lang: PredVP (UsePron i_Pron) (AdvVP (UseV play_V) (PrepNP with_Prep (DetCN (DetQuant this_Quant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3)))))))) (UseN dog_N))))
LangEng: I play with these three dogs
LangEst: mina mängin koos nende kolme koera BIND ga
Lang: PredVP (UsePron i_Pron) (AdvVP (UseV play_V) (PrepNP with_Prep (DetCN (DetQuant this_Quant (NumCard (NumDigits (IDig D_3)))) (UseN dog_N))))
LangEng: I play with these 3 dogs
LangEst: mina mängin koos nende 3 koera BIND ga
Lang: QuestIAdv (PrepIP with_Prep (IdetCN (IdetQuant which_IQuant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3)))))))) (UseN dog_N))) (PredVP (UsePron youPol_Pron) (UseV play_V))
LangEng: with which three dogs do you play
LangEst: koos mis kolme koera BIND ga teie mängite
Lang: QuestIAdv (PrepIP with_Prep (IdetCN (IdetQuant which_IQuant (NumCard (NumDigits (IDig D_3)))) (UseN dog_N))) (PredVP (UsePron youPl_Pron) (UseV play_V))
LangEng: with which 3 dogs do you play
LangEst: koos mis 3 koera BIND ga teie mängite
-- Technically the version below is better, but we'd need to add another param and who wants that :-P
-- LangEst: koos mille 3 koera BIND ga teie mängite
------------------------------------------------------------------------------------------
-- Now we skip the content word, and make the determiner (possibly with number) into NP/IP
-- The relevant functions are DetNP : Det -> NP and IDetIP : IDet -> IP
-- No number, case attaches to determiner/interrogative
Lang: PredVP (UsePron i_Pron) (AdvVP (UseV play_V) (PrepNP with_Prep (DetNP (DetQuant this_Quant NumPl))))
LangEng: I play with these
LangEst: mina mängin koos nende BIND ga
Lang: QuestIAdv (PrepIP with_Prep whoSg_IP) (PredVP (UsePron youSg_Pron) (UseV sing_V))
LangEng: with whom do you sing
LangEst: koos kelle BIND ga sina laulad
Lang: QuestIAdv (PrepIP with_Prep whoPl_IP) (PredVP (UsePron youSg_Pron) (UseV sing_V))
LangEng: with whom do you sing
LangEst: koos kellede BIND ga sina laulad
-- Adding a number to a determiner, does this affect the comitative suffix placement?
-- Context of the sentence is an ellipsis, "I sing with these 3 (singers)"
Lang: PredVP (UsePron i_Pron) (AdvVP (UseV sing_V) (PrepNP with_Prep (DetNP (DetQuant this_Quant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3)))))))))))
LangEng: I sing with these three
LangEst: mina laulan koos nende kolme BIND ga
-- Orthography should be 3-ga, but this can be easily postprocessed in applications, so I don't bother
Lang: PredVP (UsePron i_Pron) (AdvVP (UseV sing_V) (PrepNP with_Prep (DetNP (DetQuant this_Quant (NumCard (NumDigits (IDig D_3)))))))
LangEng: I sing with these 3
LangEst: mina laulan koos nende 3 BIND ga
-- Adding a number to an interrogative, how does suffix placement + agreement work now?
Lang: QuestIAdv (PrepIP with_Prep (IdetIP (IdetQuant which_IQuant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3)))))))))) (PredVP (UsePron youSg_Pron) (UseV sing_V))
LangEng: with which three do you sing
LangEst: koos mis kolme BIND ga sina laulad
Lang: QuestIAdv (PrepIP with_Prep (IdetIP (IdetQuant which_IQuant (NumCard (NumDigits (IDig D_3)))))) (PredVP (UsePron youSg_Pron) (UseV sing_V))
LangEng: with which 3 do you sing
LangEst: koos mis 3 BIND ga sina laulad
-- Also ok:
-- LangEst: koos mille 3 BIND ga sina laulad
-- Adding premodifiers to the number, does that change anything?
-- None of the alternatives sounds actually good, so we just use the same strategy as interrogative + number
-- This can be one of the cases where some trees in the RGL don't make sense, and so application grammarians should use other trees that make more sense.
-- Leaving these ungrammatical/nonsensical edge cases here just for documentation, and to catch any unintended side effects of later tweaks to the grammar.
Lang: PredVP (UsePron i_Pron) (AdvVP (UseV sing_V) (PrepNP with_Prep (DetNP (DetQuant this_Quant (NumCard (AdNum at_most_AdN (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3))))))))))))
LangEng: I sing with these at most three
LangEst: mina laulan koos nende kuni kolme BIND ga
Lang: QuestIAdv (PrepIP with_Prep (IdetIP (IdetQuant which_IQuant (NumCard (AdNum at_most_AdN (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3))))))))))) (PredVP (UsePron youSg_Pron) (UseV sing_V))
LangEng: with which at most three do you sing
LangEst: koos mis kuni kolme BIND ga sina laulad
-- Appendix: if you really want to ask "with which at most three do you sing", you can use these strategies
-- koos kellega (kuni kolmega) sina laulad? -- this one is by far the best
-- koos kellega (kuni kolm) sina laulad? --
-- koos kellega (kuni 3) sina laulad? --
-- koos kellega (kuni 3-ga) sina laulad? --
-- Now I get it, the sentence doesn't have any asking verb, "kellega koos sina laulad" VS "kellega koos sina *tahad* laulda?"
-- If you want the answerer to specify the up-to-three to sing together with, then you have to let specify also whether-or-not the answerer even wants to sing :-)
-- *) kuni kolmega nendest, kellega sina laulaud? -- this is correct but just weird
-- *) kuni kolmega nendest, kellega sina tahad laulda? -- this is correct and understandable

View File

@@ -0,0 +1,52 @@
-- Test cases related to the agreement of interrogative pronouns
-- for tests about interrogative agreement in comitative, see comitative.gftest
-- As object: case of the numberal is determined by the verb's object case
-- For comparison, the Finnish linearisation is
-- LangFin: mitkä kahdeksan opiskelijaa sinä näet
-- Estonian partitive here comes from see_V2
Lang: QuestSlash (IdetCN (IdetQuant which_IQuant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n8)))))))) (UseN student_N)) (SlashVP (UsePron youSg_Pron) (SlashV2a see_V2))
LangEng: which eight students do you see
LangEst: mis kaheksat tudengit sina näed
-- In Finnish, partitive comes from the number (mitkä kahdeksan opiskelijaa sinä myyt opettajille)
-- In Estonian, we have eight and student both in genitive.
Lang: QuestSlash (IdetCN (IdetQuant which_IQuant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n8)))))))) (UseN student_N)) (SlashVP (UsePron youSg_Pron) (Slash3V3 sell_V3 (DetCN (DetQuant DefArt NumPl) (UseN teacher_N))))
LangEng: which eight students do you sell to the teachers
LangEst: mis kaheksa tudengi sina müüd õpetajatele
-- Both Finnish and Estonian inflect eight and student, Finnish also inflects which (mistä kahdeksasta opiskelijasta sinä pidät)
Lang: QuestSlash (IdetCN (IdetQuant which_IQuant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n8)))))))) (UseN student_N)) (SlashVP (UsePron youSg_Pron) (SlashV2a like_V2))
LangEng: which eight students do you like
LangEst: mis kaheksast tudengist sina pead lugu
-- For comparison, this is Finnish partitive coming from the verb: the word "eight" is also inflected
Lang: QuestSlash (IdetCN (IdetQuant which_IQuant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n8)))))))) (UseN student_N)) (SlashVP (UsePron youSg_Pron) (SlashV2a love_V2))
LangEng: which eight students do you love
LangEst: mis kaheksat tudengit sina armastad
-- LangFin: mitä kahdeksaa opiskelijaa sinä rakastat
-- As subject
-- No numeral in IDet
Lang: QuestVP (IdetCN (IdetQuant which_IQuant NumSg) (UseN horse_N)) (UseV play_V)
LangEng: which horse plays
LangEst: mis hobune mängib
Lang: QuestVP (IdetCN (IdetQuant which_IQuant NumPl) (UseN horse_N)) (UseV play_V)
LangEng: which horses play
LangEst: mis hobused mängivad
-- With numeral
-- Number 1 doesn't behave like numerals
Lang: QuestVP (IdetCN (IdetQuant which_IQuant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01))))))) (UseN horse_N)) (UseV play_V)
LangEng: which one horse plays
LangEst: mis üks hobune mängib
Lang: QuestVP (IdetCN (IdetQuant which_IQuant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n8)))))))) (UseN horse_N)) (UseV play_V)
LangEng: which eight horses play
LangEst: mis kaheksa hobust mängivad

View File

@@ -62,7 +62,7 @@ concrete StructuralFin of Structural = CatFin **
less_CAdv = X.mkCAdv "vähemmän" "kuin" ;
many_Det = MorphoFin.mkDet Sg (snoun2nounBind (mkN "moni" "monia")) ;
more_CAdv = X.mkCAdv "enemmän" "kuin" ;
most_Predet = {s = \\n,c => (nForms2N (dSuurin "useinta")).s ! NCase n (npform2case n c)} ;
most_Predet = {s = \\n,c => (nForms2N (dSuurin "usein")).s ! NCase n (npform2case n c)} ;
much_Det = MorphoFin.mkDet Sg (snoun2nounBind (exceptNomN (mkN "paljo") "paljon")) ** {isNum = True} ; --Harmony not relevant, it's just a CommonNoun
must_VV = mkVV (caseV genitive (mkV "täytyä")) ;
no_Utt = ssp "INTERJ" "ei" ;

View File

@@ -4,6 +4,11 @@ concrete AdjectiveMay of Adjective = CatMay ** open ResMay, Prelude in {
lin
-- : AP -> Adv -> AP ; -- warm by nature
AdvAP ap adv = ap ** {
s = ap.s ++ adv.s ;
} ;
-- : A -> AP ;
PositA a = a ** {
compar = [] ;
@@ -39,6 +44,8 @@ concrete AdjectiveMay of Adjective = CatMay ** open ResMay, Prelude in {
-- AdjOrd ord = ord ** {
-- compar = []
-- } ;
-- AdjOrd : Ord -> AP =
AdjOrd ord = ord ;
-- Sentence and question complements defined for all adjectival
-- phrases, although the semantics is only clear for some adjectives.
@@ -56,7 +63,6 @@ concrete AdjectiveMay of Adjective = CatMay ** open ResMay, Prelude in {
-- It can also be postmodified by an adverb, typically a prepositional phrase.
-- : AP -> Adv -> AP ; -- warm by nature
-- AdvAP ap adv = ap ** {} ;
}

View File

@@ -13,6 +13,8 @@ lin
-- : Prep -> NP -> Adv ;
PrepNP prep np = {s = applyPrep prep np} ;
-- PrepNP to_Prep (UsePron youSg_Pron)
-- Adverbs can be modified by 'adadjectives', just like adjectives.
--AdAdv : AdA -> Adv -> Adv ; -- very quickly

View File

@@ -3,6 +3,6 @@
concrete AllMay of AllMayAbs =
LangMay,
ExtendMay
** {
** open ParadigmsMay in {
lin sing_V2 = mkV2 "nyanyi" ;
} ;

View File

@@ -120,4 +120,16 @@ concrete CatMay of Cat = CommonX - [IAdv] ** open ResMay, Prelude in {
N2 = ResMay.Noun2 ;
N3 = ResMay.Noun3 ;
PN = ResMay.PNoun ;
linref
CN = \cn -> cn.s ! NF Sg Bare ++ cn.heavyMod;
ClSlash = \cl -> cl.subj ++ cl.pred ! Root ! Pos ++ cl.c2.s;
RCl = \cl -> cl.subj ++ cl.pred ! P1 ! Pos;
Cl = \cl -> cl.subj ++ cl.pred ! Active ! Pos;
Det = linDet ;
}
-- Determiner : Type = Quant ** {
-- pr : Str ; -- prefix for numbers
-- n : NumType ; -- number as in 5 (noun in singular), Sg or Pl
-- } ;

View File

@@ -1,8 +1,105 @@
--# -path=.:../common:../abstract
concrete ExtendMay of Extend = CatMay
-- ** ExtendFunctor - []
-- with (Grammar=GrammarMay)
** open Prelude, ResMay, NounMay in {
** ExtendFunctor - [
VPS -- finite VP's with tense and polarity
, ListVPS
, VPI
, ListVPI -- infinitive VP's (TODO: with anteriority and polarity)
, MkVPS
, PredVPS
-- excluded because RGL funs needed for them not implemented yet
, SlashBareV2S
, PredAPVP
, ComplBareVS
,PresPartAP, PastPartAP
,GenModNP, GenNP, GenRP
,CompoundN
,GerundNP
-- VPS2 ; -- have loved (binary version of VPS)
-- [VPS2] {2} ; -- has loved, hates"
-- VPI2 ; -- to love (binary version of VPI)
-- [VPI2] {2} ; -- to love, to hate
]
with (Grammar=GrammarMay)
** open Prelude, Coordination, ResMay, NounMay in {
lincat
VPS, VPI = SS ;
ListVPS, ListVPI = ListX ;
lin
-- MkVPS : Temp -> Pol -> VP -> VPS ; -- hasn't slept
MkVPS t p vp = {
s = t.s ++ p.s ++ vp.s ! Active ! p.p;
} ;
-- BaseVPS : VPS -> VPS -> ListVPS ;
BaseVPS vps vps2 = twoSS vps vps2 ;
-- ConsVPS : VPS -> ListVPS -> ListVPS ;
ConsVPS str listvps vps = consSS "," listvps vps ;
-- ConjVPS : Conj -> [VPS] -> VPS ; -- has walked and won't sleep
ConjVPS conj listvps = conjunctX conj listvps ;
-- PredVPS : NP -> VPS -> S ; -- she [has walked and won't sleep]
PredVPS np vps = {
s = np.s ! Bare ++ vps.s ;
} ;
-- SQuestVPS : NP -> VPS -> QS ; -- has she walked
-- QuestVPS : IP -> VPS -> QS ; -- who has walked
-- RelVPS : RP -> VPS -> RS ; -- which won't sleep
-- MkVPI : VP -> VPI ; -- to sleep (TODO: Ant and Pol)
MkVPI vp = {s = linVP vp} ;
-- BaseVPI : VPI -> VPI -> ListVPI ;
BaseVPI vpi vpi2 = twoSS vpi vpi2 ;
-- ConsVPI : VPI -> ListVPI -> ListVPI ;
ConsVPI str listvpi vpi = consSS "," listvpi vpi ;
-- ConjVPI : Conj -> [VPI] -> VPI ; -- to sleep and to walk
-- ComplVPIVV : VV -> VPI -> VP ; -- must sleep and walk
ComplVPIVV vv vpi = useV {
s = \\vf => vv.s ++ vpi.s
} ;
-- PresPartAP : VP -> AP ; -- (the man) looking at Mary
PresPartAP vp = {
s = linVP vp
} ;
PastPartAP vp = {
s = linVP vp
} ;
-- GenModNP : Num -> NP -> CN -> NP ; -- this man's car(s)
GenModNP n np cn = variants {};
-- GenNP : NP -> Quant ; -- this man's
GenNP np = variants {};
-- GenRP : Num -> CN -> RP ; -- whose car
GenRP n cn = variants {};
-- CompoundN : N -> N -> N ; -- control system / controls system / control-system
CompoundN n1 n2 = n2 ** {
s = \\nf => n1.s ! NF Sg Bare ++ n2.s ! nf
} ;
-- GerundNP : VP -> NP ; -- publishing the document (by nature definite)
GerundNP vp = emptyNP ** {
s = \\_ => linVP vp
} ;
-- MkVPS2 : Temp -> Pol -> VPSlash -> VPS2 ; -- has loved
-- ConjVPS2 : Conj -> [VPS2] -> VPS2 ; -- has loved and now hates
-- ComplVPS2 : VPS2 -> NP -> VPS ; -- has loved and now hates that person
-- ReflVPS2 : VPS2 -> RNP -> VPS ; -- have loved and now hate myself and my car
-- MkVPI2 : VPSlash -> VPI2 ; -- to love
-- ConjVPI2 : Conj -> [VPI2] -> VPI2 ; -- to love and hate
-- ComplVPI2 : VPI2 -> NP -> VPI ; -- to love and hate that person
} ;

View File

@@ -9,7 +9,7 @@ concrete GrammarMay of Grammar =
RelativeMay,
ConjunctionMay,
PhraseMay,
TextX - [IAdv],
TextX - [AAnter, TFut, TCond, IAdv],
StructuralMay,
IdiomMay,
TenseX - [AAnter, TFut, TCond, IAdv]
@@ -17,9 +17,8 @@ concrete GrammarMay of Grammar =
flags startcat = Phr ;
lin
AAnter = {s = "sudah" ; a = ParamX.Anter} ;
TFut = {s = "akan" ; t = ParamX.Fut} ;
TCond = {s = "akan" ; t = ParamX.Cond} ;
lin AAnter = {s = "sudah" ; a = ParamX.Anter} ; --# notpresent
TFut = {s = "akan" ; t = ParamX.Fut} ; --# notpresent
TCond = {s = "akan" ; t = ParamX.Cond} ; --# notpresent
} ;

View File

@@ -1,7 +1,7 @@
--1 Idiom: Idiomatic Expressions
concrete IdiomMay of Idiom = CatMay ** open Prelude, ResMay, VerbMay, NounMay, StructuralMay in {
concrete IdiomMay of Idiom = CatMay ** open Prelude, ResMay, VerbMay, QuestionMay, NounMay, StructuralMay in {
-- This module defines constructions that are formed in fixed ways,
-- often different even in closely related languages.
@@ -14,10 +14,17 @@ concrete IdiomMay of Idiom = CatMay ** open Prelude, ResMay, VerbMay, NounMay, S
subj = [] ;
pred = \\vf,pol => vp.s ! Root ! pol -- force no prefix -- TODO check if legit?
} ;
{-
-- GenericCl : VP -> Cl ; -- one sleeps
GenericCl = \vp -> predVP impersNP (passVP vp) ;
-- : NP -> Cl ; -- there is a house
ExistNP np = predVP np (useV copula) ;
-- ExistIP : IP -> QCl ; -- which houses are there
ExistIP ip = QuestVP ip (useV copula) ;
-- GenericCl : VP -> Cl ; -- one sleeps
GenericCl = \vp -> predVP emptyNP vp ;
{-
CleftNP : NP -> RS -> Cl ; -- it is I who did it
CleftAdv : Adv -> S -> Cl ; -- it is here she slept

View File

@@ -4,54 +4,54 @@ concrete LexiconMay of Lexicon = CatMay **
----
-- A
-- lin add_V3 = mkV3 "" ;
-- lin airplane_N = mkN "" ;
-- lin add_V3 = mkV3 "tambah" ;
lin airplane_N = mkN "kapal terbang" ;
-- lin alas_Interj = mkInterj "" ;
-- lin already_Adv = mkA "" ;
-- lin animal_N = mkN "동물" ;
-- lin answer_V2S = mkV2S "" ;
-- lin apartment_N = mkN "" ;
-- lin apple_N = mkN "" ;
-- lin art_N = mkN "" ;
-- lin ashes_N = mkN "" ;
-- lin ask_V2Q = mkV2 "" ;
lin already_Adv = mkA "sudah" ;
lin animal_N = mkN "haiwan" ;
-- lin answer_V2S = mkV2S "jawab" ;
lin apartment_N = mkN "pangsapuri" ;
lin apple_N = mkN "epal" ;
lin art_N = mkN "seni" ;
lin ashes_N = mkN "abu" ;
lin ask_V2Q = mkV2 "tanya" ;
----
-- B
-- lin baby_N = mkN "" ;
-- lin back_N = mkN "" ;
lin baby_N = mkN "bayi" Animate ;
lin back_N = mkN "belakang" ;
-- lin bad_A = mkA "" ;
-- lin bank_N = mkN "" ;
lin bank_N = mkN "bank" ;
-- lin bark_N = mkN "" ;
lin beautiful_A = mkA "cantik" ;
-- lin become_VA = mkVA "" ;
-- lin beer_N = mkN "" ;
-- lin become_VA = mkVA "jadi" ;
lin beer_N = mkN "bir" ;
-- lin beg_V2V = mkV2 "" ;
-- lin belly_N = mkN "" ;
-- lin big_A = mkA "" ;
-- lin bike_N = mkN "" ;
-- lin bird_N = mkN "" ;
lin big_A = mkA "besar" ;
lin bike_N = mkN "basikal" ;
lin bird_N = mkN "burung" ;
-- lin bite_V2 = mkV2 "" ;
lin black_A = mkA "hitam" ;
-- lin blood_N = mkN "" ;
lin blood_N = mkN "darah" ;
-- lin blow_V = mkV "" ;
-- lin blue_A = mkA "" ;
-- lin boat_N = mkN "" ;
-- lin bone_N = mkN "" ;
lin blue_A = mkA "biru" ;
lin boat_N = mkN "perahu" ;
lin bone_N = mkN "tulang" ;
-- lin boot_N = mkN "" ;
-- lin boss_N = mkN "" ;
lin book_N = mkN "buku" ;
-- lin boy_N = mkN "" ;
-- lin bread_N = mkN "" ;
lin break_V2 = mkV2 "patahkan" ; -- TODO figure out if -kan needs to be separated
lin bread_N = mkN "roti" ;
lin break_V2 = mkV4 "patah" "kan"; -- TODO figure out if -kan needs to be separated
-- lin breast_N = mkN "" ;
-- lin breathe_V = mkV "" ;
-- lin broad_A = mkA "" ;
-- lin brother_N2 = mkN "" ;
-- lin brother_N2 = mkN "abang" Animate;
-- lin brown_A = mkA "" ;
-- lin burn_V = mkV "" ;
-- lin butter_N = mkN "" ;
lin burn_V = mkV "bakar" ;
lin butter_N = mkN "mentega" ;
lin buy_V2 = mkV2 "beli" ;
----
@@ -68,10 +68,10 @@ lin cat_N = mkN "kucing" ;
-- lin child_N = mkN "" ;
-- lin church_N = mkN "" ;
-- lin city_N = mkN "" ;
-- lin clean_A = mkA "" ;
lin clean_A = mkA "bersih" ;
-- lin clever_A = mkA "" ;
-- lin close_V2 = mkV2 "" ;
-- lin cloud_N = mkN "" ;
lin cloud_N = mkN "awan" ;
-- lin coat_N = mkN "" ;
-- lin cold_A = mkA "" ;
lin come_V = mkV "datang" ;
@@ -80,7 +80,7 @@ lin come_V = mkV "datang" ;
-- lin count_V2 = mkV2 "" ;
-- lin country_N = mkN "" ;
-- lin cousin_N = mkN "" ;
-- lin cow_N = mkN "" ;
lin cow_N = mkN "embu" ;
-- lin cut_V2 = mkV2 "" ;
----
@@ -94,8 +94,10 @@ lin come_V = mkV "datang" ;
-- lin do_V2 = lin V2 egin_V ;
-- lin doctor_N = mkN "" ;
lin dog_N = mkN "anjing" ;
-- lin door_N = mkN "" ;
lin drink_V2 = mkV2 "minum" ;
lin door_N = mkN "pintu" ;
lin drink_V2 = let drink' : V2 = mkV2 "minum" in drink' ** {
s = \\_ => "minum" ;
};
-- lin dry_A = mkA "" ;
-- lin dull_A = mkA "" ;
-- lin dust_N = mkN "" ;
@@ -105,7 +107,9 @@ lin drink_V2 = mkV2 "minum" ;
-- lin ear_N = mkN "" ;
-- lin earth_N = mkN "" ;
lin eat_V2 = mkV2 "makan" ;
lin eat_V2 = let eat' : V2 = mkV2 "makan" in eat' ** {
s = \\_ => "makan" ;
};
-- lin egg_N = mkN "" ;
-- lin empty_A = mkA "" ;
-- lin enemy_N = mkN "" ;
@@ -148,7 +152,7 @@ lin father_N2 = mkN2 "bapa" ;
-- lin garden_N = mkN "" ;
-- lin girl_N = mkN "" ;
lin give_V3 = mkV3 (mkV "beri" Meng) emptyPrep datPrep ;
lin give_V3 = mkV3 (mkV "beri" Meng) emptyPrep datPrep ; -- memberi for living and memberikan for nonliving
-- lin glove_N = mkN "" ;
lin go_V = mkV "pergi" ;
-- lin gold_N = mkN "" ;
@@ -186,7 +190,7 @@ lin house_N = mkN "rumah" ;
-- lin ice_N = mkN "" ;
-- lin industry_N = mkN "" ;
-- lin iron_N = mkN "" ;
-- lin john_PN = mkPN "" ;
lin john_PN = mkPN "Yohanes" ;
-- lin jump_V = mkV "" ;
-- lin kill_V2 = mkV2 "" ;
lin king_N = mkN "raja" ;
@@ -220,7 +224,11 @@ lin long_A = mkA "panjang" ;
-- lin lose_V2 = mkV2 "" ;
-- lin louse_N = mkN "" ;
-- lin love_N = mkN "" ;
lin love_V2 = mkV2 "cinta" ;
-- lin love_V2 = let love' : V2 = mkV2 "cinta" in love' ** {
-- s = \\_ => "mencintai" ;
-- passive = "dicintai" ;
-- } ;
lin love_V2 = mkV4 "cinta" "i";
----
-- M
@@ -255,7 +263,7 @@ lin now_Adv = mkAdv "sekarang" ;
-- lin oil_N = mkN "" ;
lin old_A = mkA "tua" ;
-- lin open_V2 = mkV2 "" ;
lin open_V2 = mkV2 "buka" ;
lin paint_V2A = mkV2 "cat" ;
-- lin paper_N = mkN "" ;
-- lin paris_PN = mkPN "Paris" ;
@@ -296,7 +304,7 @@ lin read_V2 = mkV2 "baca" ;
-- lin round_A = mkA "" ;
-- lin rub_V2 = mkV2 "" ;
-- lin rubber_N = mkN "" ;
-- lin rule_N = mkN "" ;
lin rule_N = mkN "peraturan" ;
-- lin run_V = mkV "" ;
----
@@ -312,7 +320,7 @@ lin science_N = mkN "sains" ;
lin see_V2 = mkV2 "lihat" ;
-- lin seed_N = mkN "" ;
-- lin seek_V2 = mkV2 "" ;
lin sell_V3 = mkV3 (mkV "jual" Meng) emptyPrep emptyPrep ; -- TODO
-- lin sell_V3 = mkV3 (mkV "jual" Meng) emptyPrep emptyPrep ; -- TODO
-- lin send_V3 = mkV3 "" ;
-- lin sew_V = mkV "" ;
-- lin sharp_A = mkA "" ;
@@ -347,7 +355,7 @@ lin song_N = mkN "lagu" ;
-- lin steel_N = mkN "" ;
-- lin stick_N = mkN "" ;
-- lin stone_N = mkN "" ;
-- lin stop_V = mkV "" ;
lin stop_V = mkV "henti" ;
-- lin stove_N = mkN "" ;
-- lin straight_A = mkA "" ;
-- lin student_N = mkN "" ;
@@ -414,7 +422,7 @@ lin woman_N = mkN "perempuan" ;
-- lin wonder_VQ = mkVQ "" ;
-- lin wood_N = mkN "" ;
-- lin worm_N = mkN "" ;
-- lin write_V2 = mkV2 "" ;
lin write_V2 = mkV2 "tulis" ;
-- lin year_N = mkN "" ;
-- lin yellow_A = mkA "" ;
lin young_A = mkA "muda" ;

View File

@@ -9,8 +9,6 @@ oper AdjCN : AP -> CN -> CN = notYet "AdjCN" ;
oper AdjDAP : DAP -> AP -> DAP = notYet "AdjDAP" ;
oper AdjOrd : Ord -> AP = notYet "AdjOrd" ;
oper AdnCAdv : CAdv -> AdN = notYet "AdnCAdv" ;
oper AdvAP : AP -> Adv -> AP = notYet "AdvAP" ;
oper AdvCN : CN -> Adv -> CN = notYet "AdvCN" ;
oper AdvIAdv : IAdv -> Adv -> IAdv = notYet "AdvIAdv" ;
oper AdvIP : IP -> Adv -> IP = notYet "AdvIP" ;
oper AdvNP : NP -> Adv -> NP = notYet "AdvNP" ;
@@ -114,7 +112,6 @@ oper Use2N3 : N3 -> N2 = notYet "Use2N3" ;
oper Use3N3 : N3 -> N2 = notYet "Use3N3" ;
oper UseA2 : A2 -> AP = notYet "UseA2" ;
oper UseComparA : A -> AP = notYet "UseComparA" ;
oper UsePN : PN -> NP = notYet "UsePN" ;
oper UseQCl : Temp -> Pol -> QCl -> QS = notYet "UseQCl" ;
oper UseSlash : Temp -> Pol -> ClSlash -> SSlash = notYet "UseSlash" ;
oper UttAP : AP -> Utt = notYet "UttAP" ;
@@ -192,7 +189,6 @@ oper but_PConj : PConj = notYet "but_PConj" ;
oper butter_N : N = notYet "butter_N" ;
oper camera_N : N = notYet "camera_N" ;
oper can8know_VV : VV = notYet "can8know_VV" ;
oper can_VV : VV = notYet "can_VV" ;
oper cap_N : N = notYet "cap_N" ;
oper carpet_N : N = notYet "carpet_N" ;
oper ceiling_N : N = notYet "ceiling_N" ;
@@ -363,7 +359,6 @@ oper mountain_N : N = notYet "mountain_N" ;
oper mouth_N : N = notYet "mouth_N" ;
oper much_Det : Det = notYet "much_Det" ;
oper music_N : N = notYet "music_N" ;
oper must_VV : VV = notYet "must_VV" ;
oper n_unit_CN : Card -> CN -> CN -> CN = notYet "n_unit_CN" ;
oper n_units_AP : Card -> CN -> A -> AP = notYet "n_units_AP" ;
oper n_units_of_NP : Card -> CN -> NP -> NP = notYet "n_units_of_NP" ;

View File

@@ -19,8 +19,7 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in {
} ;
-- : PN -> NP ;
-- UsePN pn = pn ** {
-- } ;
UsePN pn = MassNP (UseN pn) ;
-- : Pron -> NP ;
UsePron pron = pron ** {
@@ -40,7 +39,9 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in {
-- s = \\c => v2.s ! ??? ++ np.s ! c } ; ----
-- : NP -> Adv -> NP ; -- Paris today ; boys, such as ..
--AdvNP,ExtAdvNP = \np,adv -> np ** {} ;
AdvNP,ExtAdvNP = \np,adv -> np ** {
s = \\pos => np.s ! pos ++ adv.s
} ;
-- : NP -> RS -> NP ; -- Paris, which is here
RelNP np rs = np ** {
@@ -51,7 +52,7 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in {
-- : Det -> NP ;
DetNP det = emptyNP ** {
s = \\_ => det.s ;
s = \\_ => linDet det ;
} ;
-- MassNP : CN -> NP ;
@@ -68,13 +69,17 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in {
DetQuant quant num = quant ** {
pr = num.s ; -- if it's not a number or digit, num.s is empty
s = quant.s ;
n = num.n
n = num.n ;
count = "ke" ++ BIND ++ num.s ++ BIND ++ "-" ++ BIND ++ num.s;
} ;
-- : Quant -> Num -> Ord -> Det ; -- these five best
-- DetQuantOrd quant num ord =
-- let theseFive = DetQuant quant num in theseFive ** {
-- } ;
-- : Quant -> Num -> Ord -> Det ;
DetQuantOrd quant num ord = quant ** {
pr = num.s ;
n = num.n ;
s = ord.s ++ quant.s ;
count = "" ;
} ;
-- Whether the resulting determiner is singular or plural depends on the
-- cardinal.
@@ -107,18 +112,21 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in {
OrdDigits digs = digs ** { s = digs.s ! NOrd } ;
-}
-- : Numeral -> Ord ;
-- OrdNumeral num = num ** {
-- s = \\_ => num.ord
-- } ;
OrdNumeral num = {
s = num.ord
} ;
-- : A -> Ord ;
-- OrdSuperl a = {
-- } ;
OrdSuperl a = {
s = "ter" ++ BIND ++ a.s
} ;
-- One can combine a numeral and a superlative.
-- : Numeral -> A -> Ord ; -- third largest
-- OrdNumeralSuperl num a = num ** { } ;
OrdNumeralSuperl num a = {
s = num.ord ++ "ter" ++ BIND ++ a.s
} ;
-- : Quant
DefArt = mkQuant [] ;
@@ -167,6 +175,11 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in {
heavyMod = cn.heavyMod ++ rs.s ! P3
} ;
-- : CN -> Adv -> CN ;
AdvCN cn adv = cn ** {
heavyMod = cn.heavyMod ++ adv.s
} ;
{-
-- : CN -> Adv -> CN ;
AdvCN cn adv = cn ** { } ;
@@ -199,6 +212,14 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in {
}
} ;
-- : Det -> NP -> NP ;
CountNP det np = np **
{
s = \\pos => det.count ++ np.s ! pos;
} ; -- Nonsense for DefArt or IndefArt
-- : CN -> NP -> CN ; -- glass of wine / two kilos of red apples
-- PartNP cn np = cn ** {
-- } ;

View File

@@ -96,6 +96,7 @@ oper
} ;
-- To make Sub* funs directly from a string.
-- ordnumeral from here
mkNum : Str -> LinNumber = \s -> {
n = Pl ;
s = \\_ => s ; -- Indep vs. Attrib only matters for number 1

View File

@@ -9,6 +9,7 @@ oper
-- should always use these constants instead of the constructors
-- defined in $ResSom$.
noPrep : Prep = mkPrep "" ;
--2 Nouns
@@ -26,7 +27,9 @@ oper
mkA : (adj : Str) -> A ;
} ;
-- mkA2 : Str -> Prep -> A2 ;
mkA2 : overload {
mkA2 : (adj : Str) -> Prep -> A2 ;
} ;
--2 Verbs
@@ -56,8 +59,10 @@ oper
-- = \s -> lin VA (regV s) ;
-- mkVQ : Str -> VQ
-- = \s -> lin VQ (regV s) ;
-- mkVS : Str -> VS
-- = \s -> lin VS (regV s) ;
mkVS : overload {
mkV : (root : Str) -> V ; -- Verb that takes meng as a active prefix
mkV : (root : Str) -> Prefix -> V -- Root and prefix
} ;
--
-- mkV2A : Str -> V2A
-- = \s -> lin V2A (regV s ** {c2 = noPrep}) ;
@@ -93,6 +98,7 @@ oper
mkN = overload {
mkN : Str -> N = \s -> lin N (mkNoun s) ;
mkN : Str -> Animacy -> N = \s,a -> lin N (mkNoun s) ;
} ;
@@ -101,6 +107,12 @@ oper
mkN2 : N -> N2 = \n -> lin N2 (n ** {c2 = dirPrep}) ;
} ;
mkN3 = overload {
mkN3 : Str -> N3 = \s -> lin N3 (mkNoun s ** {c2,c3 = dirPrep}) ;
mkN3 : N -> N3 = \n -> lin N3 (n ** {c2,c3 = dirPrep}) ;
mkN3 : N -> Prep -> Prep -> N3 = \n,c2,c3 -> lin N3 (n ** {c2,c3 = dirPrep}) ;
} ;
mkPN = overload {
mkPN : Str -> PN = \s -> lin PN {s = \\_ => s} ;
} ;
@@ -109,6 +121,11 @@ oper
mkA : (adj : Str) -> A = \s -> lin A (mkAdj s) ;
} ;
mkA2 = overload {
mkA2 : (adj : Str) -> A = \s -> lin A2 (mkAdj s) ;
mkA2 : A -> Prep -> A = \a,p -> lin A2 (a) ;
} ;
mkV = overload {
mkV : Str -> V = \v -> lin V (mkVerb v Ber) ;
mkV : Str -> Prefix -> V = \v,p -> lin V (mkVerb v p)
@@ -133,6 +150,12 @@ oper
lin V3 (mkVerb3 v p q)
} ;
mkV4 = overload {
mkV4 : Str -> Str -> V2 = \v2,str ->
lin V2 (mkVerb4 (mkVerb v2 Meng) dirPrep str) ;
mkV4 : V -> Prep -> Str -> V2 = \v,p,str -> lin V2 (mkVerb4 v p str)
} ;
mkVV = overload {
mkVV : Str -> VV = \vv -> lin VV (ss vv)
} ;

View File

@@ -85,6 +85,8 @@ param
NPAgr = NotPron | IsPron Person ;
Animacy = Animate | Inanimate ;
oper
poss2str : Possession -> Str = \p -> case p of {
Bare => [] ;
@@ -130,12 +132,17 @@ param
param
PrepType = DirObj | EmptyPrep | OtherPrep ;
--------------------------------------------------------------------------------
-- Adverbs
--------------------------------------------------------------------------------
-- Verbs
param
VForm =
Root -- infinitive, imperative, …
| Active
| Imperative
;
Prefix =

View File

@@ -8,16 +8,15 @@ concrete PhraseMay of Phrase = CatMay ** open Prelude, ResMay in {
UttIAdv iadv = iadv ;
UttNP np = {s = np.s ! Bare} ;
UttIP ip = {s = ip.sp ! NF Sg Bare} ;
UttImpSg pol imp = { s = pol.s ++ imp.s ! Sg ! pol.p } ;
UttImpPol pol imp = {s = pol.s ++ imp.s ! Sg ! pol.p} ;
UttVP vp = {s = linVP vp} ;
UttAP ap = { s = ap.s } ;
{-
UttImpSg pol imp =
UttImpPl pol imp =
UttImpPol = UttImpSg ;
UttVP vp = {s = } ;
UttAdv adv = {s = } ;
UttCN n = {s = } ;
UttCard n = {s = } ;
UttAP ap = { s = ap.s ! } ;
UttInterj i = i ;
-}
NoPConj = {s = []} ;

View File

@@ -21,7 +21,8 @@ lin
-- if isPre is True, then: "berapa kucing"
s = case iquant.isPre of { False => iquant.s ; True => [] };
-- if isPre is False, use s: "kucing berapa"
n = num.n
n = num.n ;
count = "" ;
} ;
-- : IP -> ClSlash -> QCl ; -- whom does John love
@@ -59,7 +60,6 @@ lin
} ;
} ;
-- : IP -> IComp ;
CompIP ip = {s = ip.s ! Bare } ; -- who (is it)

View File

@@ -3,33 +3,36 @@ concrete RelativeMay of Relative = CatMay ** open
lin
-- : Cl -> RCl ; -- such that John loves her
-- RelCl cl = ;
-- : Cl -> RCl ; -- such that John loves her
-- RelCl cl = cl ** {
-- subj = cl.subj ;
-- pred = cl.pred ;
-- };
-- : RP -> VP -> RCl ;
RelVP rp vp = {
subj = rp.s ;
pred = \\per => vp.s ! Root ;
pred = \\per,pol => vp.s ! Active ! pol;
} ;
-- : RP -> ClSlash -> RCl ; -- who I went with
RelSlash rp cls = {
subj = rp.s -- yang
++ cls.subj ; -- saya
++ cls.subj ; -- aku
pred = \\per,pol =>
let object : Str = case cls.c2.prepType of {
OtherPrep
=> cls.c2.obj ! per ; -- depends on the head, not known yet
_ => [] -- if the preposition is dir.obj or empty, no obj. pronoun
} ;
in cls.pred ! Root ! pol -- ikut sama
in cls.pred ! Active ! pol -- ikut sama
++ object -- dengan+nya
} ;
-- : RP ;
IdRP = {s = "yang"} ;
-- Mintz page 49: Saya jumpa orang /yang kaki+nya/ patah.
-- Mintz page 49: aku jumpa orang /yang kaki+nya/ patah.
-- 'I met a man /whose foot/ was broken.'
-- : Prep -> NP -> RP -> RP ; -- the mother of whom
-- FunRP prep np rp = {} ;

View File

@@ -60,6 +60,12 @@ oper
empty = []
} ;
mkNounPhrase : Str -> NounPhrase = \str -> {
s = \\_ => str ;
a = NotPron ;
empty = []
} ;
mkIP : Str -> IPhrase = \str -> {
s = \\_ => str ;
a = NotPron ;
@@ -81,9 +87,14 @@ oper
isPre : Bool ;
} ;
linDet : Determiner -> Str = \det -> det.pr ++ det.s ;
-- add field in determiner for kedua-dua numbers
Determiner : Type = Quant ** {
pr : Str ; -- prefix for numbers
n : NumType ; -- number as in 5 (noun in singular), Sg or Pl
count: Str ;
} ;
CardNum : Type = {
@@ -127,16 +138,17 @@ oper
sp = \\_ => str
} ;
mkDet : Str -> Number -> Determiner = \str, num -> mkQuant str ** {
mkDet : Str -> Str -> Number -> Determiner = \cnt, str, num -> mkQuant str ** {
pr = "" ;
n = NoNum num ;
count = "" ;
} ;
mkIdet : Str -> Str -> Number -> Bool -> Determiner = \str, standalone, num, isPre -> mkDet str num ** {
mkIdet : Str -> Str -> Str -> Number -> Bool -> Determiner = \cnt, str, standalone, num, isPre -> mkDet cnt str num ** {
pr = case isPre of {True => str ; False => [] } ;
-- if isPre is True, then: "berapa kucing"
s = case isPre of { False => str ; True => [] };
count = cnt ;
sp = \\_ => standalone ;
} ;
@@ -209,23 +221,35 @@ oper
c3 : Preposition
} ;
Verb4 : Type = Verb ** {
c2 : Preposition ;
passive : Str
} ;
-- VV : Type = Verb ** {vvtype : VVForm} ;
mkVerb : Str -> Prefix -> Verb = \str,p -> {
s = table {
Root => str ;
Active => prefix p str
Active => prefix p str ;
Imperative => str ++ BIND ++ "kan"
}
} ;
mkVerb2 : Verb -> Preposition -> Verb2 = \v,pr -> v ** {
c2 = pr ;
passive = "di" + v.s ! Root -- TODO check
passive = "di" ++ BIND ++ v.s ! Root
} ;
mkVerb3 : Verb -> (p,q : Preposition) -> Verb3 = \v,p,q ->
mkVerb2 v p ** {c3 = q} ;
mkVerb4 : Verb -> Preposition -> Str -> Verb4 = \v,pr,str -> v ** {
s = \\_ => v.s ! Active ++ str;
c2 = pr ;
passive = "di" ++ BIND ++ v.s ! Root ++ str
} ;
copula : Verb = {s = \\_ => "ada"} ; -- TODO
------------------
-- Adv
@@ -259,6 +283,9 @@ oper
s = \\vf,pol => nounneg pol ++ s ;
} ;
linVP : VerbPhrase -> Str = \vp -> vp.s ! Active ! Pos;
-- https://www.reddit.com/r/indonesian/comments/gsizsv/when_to_use_tidak_bukan_jangan_belum/
verbneg : Polarity -> Str = \pol -> case pol of {
Neg => "tidak" ; -- or "tak"?
@@ -269,6 +296,11 @@ oper
Neg => "bukan" ;
Pos => []
} ;
impneg : Polarity -> Str = \pol -> case pol of {
Neg => "jangan" ;
Pos => []
} ;
--------------------------------------------------------------------------------
-- Cl, S

View File

@@ -24,6 +24,19 @@ lin
-- : Cl -> Prep -> ClSlash ; -- (with whom) he walks
SlashPrep cl prep = cl ** {c2 = prep} ;
--2 Imperatives
-- : VP -> Imp ;
ImpVP vp = {
s = \\num,pol => case pol of {
Neg => "jangan" ++ vp.s ! Imperative ! Pos;
Pos => vp.s ! Imperative ! Pos
}
} ;
-- : VP -> SC ;
EmbedVP vp = {s = vp.s ! Root ! Pos} ;
{-
-- : NP -> VS -> SSlash -> ClSlash ; -- (whom) she says that he loves
SlashVS np vs ss = {} ;
@@ -34,7 +47,7 @@ lin
--2 Imperatives
-- : VP -> Imp ;
ImpVP vp = {s = \\num,pol => linVP (VImp num pol) Statement vp} ;
-- ImpVP vp = {s = \\num,pol => linVP (VImp num pol) Statement vp} ;
--2 Embedded sentences

View File

@@ -55,15 +55,14 @@ lin and_Conj = {s2 = "dan" ; s1 = [] ; n = Pl} ;
-----------------
-- *Det and Quant
lin how8many_IDet = mkIdet "berapa" "berapa banyak" Sg True;
lin how8many_IDet = mkIdet "berapa" "berapa banyak" "" Sg True;
lin every_Det = mkDet "semua" "semua" Sg ; -- to check
{-}
lin all_Predet = {s = ""} ;
lin not_Predet = { s = "" } ;
lin only_Predet = { s = "" } ;
lin most_Predet = {s = ""} ;
lin every_Det = {s = ""} ;
lin few_Det = R.indefDet "" pl ;
lin many_Det = R.indefDet "" pl ;
lin much_Det = R.indefDet "" sg ;
@@ -78,6 +77,9 @@ lin which_IQuant = mkQuant "yang mana" ** {isPre = False} ;
-----
-- NP
lin somebody_NP = mkNounPhrase "seorang" ; --todo
{-
lin everybody_NP = defNP "" N.NumPl ;
lin everything_NP = defNP "" N.NumSg ;
@@ -110,7 +112,18 @@ lin in_Prep = mkPrep "di" ;
-- lin part_Prep = mkPrep ;
lin possess_Prep = mkPrep [] ; -- TODO check Mintz p. 39-40, 2.2.1.2
-- lin through_Prep = mkPrep ;
lin to_Prep = mkPrep "ke" ;
-- lin to_Prep = mkPrep "ke" ;
lin to_Prep =
let ke : Preposition = mkPrep "ke";
kepada : Preposition = mkPrep "kepada" ;
in ke ** {
obj = kepada.obj
} ;
-- lin have_V2 = let have' : V2 = mkV2 "ada" in have' ** {
-- s = \\_ => "ada" ;
-- passive = "diadakan" ;
-- } ;
-- lin under_Prep = mkPrep "" ;
lin with_Prep = mkPrep "dengan" ;
-- lin without_Prep = mkPrep "" ;
@@ -120,9 +133,9 @@ lin with_Prep = mkPrep "dengan" ;
-- Pronouns are closed class, no constructor in ParadigmsMay.
lin it_Pron = mkPron "dia" P3 ;
lin i_Pron = mkPron "saya" P1 ;
lin i_Pron = mkPron "aku" P1 ;
lin youPol_Pron = mkPron "kamu" P2 ;
lin youSg_Pron = mkPron "awak" P2 ;
lin youSg_Pron = mkPron "kamu" P2 ;
lin he_Pron = mkPron "dia" P3 ;
lin she_Pron = mkPron "dia" P3 ;
-- inclusive we
@@ -163,8 +176,8 @@ lin have_V2 = let have' : V2 = mkV2 "ada" in have' ** {
passive = "diadakan" ;
} ;
-- lin can8know_VV = can_VV ; -- can (capacity)
-- lin can_VV = mkVV "" ; -- can (possibility)
-- lin must_VV = mkVV "" ;
lin can_VV = mkVV "boleh" ; -- can (possibility)
lin must_VV = mkVV "perlu" ;
lin want_VV = mkVV "mahu" ;
------

View File

@@ -16,7 +16,7 @@ lin
-- : VV -> VP -> VP ;
ComplVV vv vp = vp ** useV {
s = \\vf => vv.s ++ vp.s ! Root ! Pos
s = \\vf => vv.s ++ linVP vp
} ;
-- : VS -> S -> VP ;
@@ -54,12 +54,11 @@ lin
-- : V3 -> NP -> VPSlash ; -- give (it) to her
Slash3V3 v3 iobj = useV {
s = \\vf => v3.s ! vf ++ iobj.s ! Bare ++ applyPrep v3.c3 emptyNP;
s = \\vf => v3.s ! vf ++ applyPrep v3.c3 emptyNP ++ iobj.s ! Bare;
--iobj.s ! Bare -- applyPrep v3.c3 iobj -- TODO check if this works for all -- probably not
} ** {
c2 = v3.c2 ;-- Now the VPSlash is missing only the direct object
adjCompl = []
} ;
-- insertObjc : (Agr => Str) -> SlashVP -> SlashVP = \obj,vp ->
@@ -101,6 +100,13 @@ lin
adjCompl = vps.adjCompl ;
} ;
-- SlashVV vv vp = vp ** useV {
-- s = \\vf => vv.s ++ linVP vp ;
-- c2 = vp.c2 ;
-- passive = vv.s ++ vp.passive;
-- adjCompl = vp.adjCompl ;
-- } ;
-- : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy
-- SlashV2VNP v2v np vps =
@@ -112,6 +118,11 @@ lin
s = \\vf,pol => vp.s ! vf ! pol ++ adv.s
} ;
-- : AdV -> VP -> VP ; -- always sleep
AdVVP adv vp = vp ** {
s = \\vf,pol => vp.s ! vf ! pol ++ adv.s
} ;
{-
-- : VPSlash -> Adv -> VPSlash ; -- use (it) here
AdvVPSlash = insertAdv ;
@@ -119,9 +130,6 @@ lin
-- : VP -> Adv -> VP ; -- sleep , even though ...
ExtAdvVP vp adv = ;
-- : AdV -> VP -> VP ; -- always sleep
AdVVP adv vp = vp ** {adv = adv} ;
-- : AdV -> VPSlash -> VPSlash ; -- always use (it)
AdVVPSlash adv vps = vps ** { adv = adv.s ++ vps.adv } ;
-}

View File

@@ -3,4 +3,4 @@ Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron he_Pron) (ComplSlas
LangMay: dia memberi kucing kepadaku
Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron he_Pron) (ComplSlash (Slash3V3 give_V3 (UsePron i_Pron)) (MassNP (UseN cat_N)))))
LangMay: dia memberi saya kucing
LangMay: dia memberi aku kucing

View File

@@ -8,4 +8,32 @@ LangMay: lima kucing ini
Lang: DetCN (DetQuant (PossPron i_Pron) (NumCard (NumNumeral (num (pot2as3 (pot2 (pot0 n7))))))) (UseN cat_N)
LangEng: my seven hundred cats
LangMay: tujuh ratus kucing saya
LangMay: tujuh ratus kucing aku
Lang: AdjCN (AdjOrd (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2))))))) (UseN cat_N)
LangEng: second cat
LangMay: kucing kedua
Lang: DetQuantOrd IndefArt NumPl (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2))))))
LangEng: second
LangMay: kedua
Lang: UttNP (DetCN (DetQuantOrd (PossPron i_Pron) NumSg (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2))))))) (UseN cat_N))
LangEng: my second cat
LangMay: kucing kedua aku
Lang: UttNP (DetCN (DetQuantOrd (PossPron i_Pron) (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2))))))) (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2))))))) (UseN cat_N))
LangEng: my two second cats
LangMay: dua kucing kedua aku
Lang: CountNP (DetQuant IndefArt (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2)))))))) (DetCN (DetQuant (PossPron i_Pron) NumPl) (UseN cat_N))
LangEng: two of my cats
LangMay: kedua-dua kucing aku
Lang: MassNP (AdjCN (AdjOrd (OrdNumeralSuperl (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3))))) big_A)) (UseN cat_N))
LangEng: third biggest cat
LangMay: kucing ketiga terbesar
Lang: MassNP (AdjCN (AdjOrd (OrdSuperl big_A)) (UseN cat_N))
LangEng: biggest cat
LangMay: kucing terbesar

View File

@@ -1,11 +1,19 @@
Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant that_Quant NumSg) (UseN dog_N)) (PassV2 love_V2))
LangEng: that dog is loved
LangMay: anjing itu dicinta
LangMay: anjing itu dicintai
Lang: UseCl (TTAnt TPres ASimul) PNeg (PredVP (DetCN (DetQuant that_Quant NumSg) (UseN dog_N)) (PassV2 love_V2))
LangEng: that dog isn't loved
LangMay: anjing itu tidak dicinta
LangMay: anjing itu tidak dicintai
Lang: UseCl (TTAnt TPres ASimul) PNeg (PredVP (DetCN (DetQuant that_Quant NumSg) (UseN dog_N)) (ComplVV want_VV (PassV2 love_V2)))
LangEng: that dog doesn't want to be loved
LangMay: anjing itu tidak mahu dicinta
LangMay: anjing itu tidak mahu dicintai
Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant that_Quant NumSg) (UseN book_N)) (PassV2 read_V2))
LangEng: that book is read
LangMay: buku itu dibaca
Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant that_Quant NumSg) (UseN book_N)) (AdvVP (PassV2 read_V2) (PrepNP to_Prep (UsePron youSg_Pron))))
LangEng: that book is read to you
LangMay: buku itu dibacakan kepada kamu

View File

@@ -14,18 +14,18 @@ LangMay: kucing-kucingku dengan orang itu
-- to get "memukulnya", we need to define it in the entry of hit_V2 at the moment.
-- if that should be variable on a more general level, let me know.
Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a hit_V2) (UsePron he_Pron)))
LangMay: saya memukul dia
LangMay: aku memukul dia
-------------
-- Possession
-- that is my cat
Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (DetNP (DetQuant that_Quant NumSg)) (UseComp (CompNP (DetCN (DetQuant (PossPron i_Pron) NumSg) (UseN cat_N)))))
LangMay: itu kucing saya
LangMay: itu kucing aku
-- that cat is mine
Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant that_Quant NumSg) (UseN cat_N)) (UseComp (CompNP (DetNP (DetQuant (PossPron i_Pron) NumSg)))))
LangMay: kucing itu saya
LangMay: kucing itu aku
-- his/her cat is green
Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant (PossPron he_Pron) NumSg) (UseN cat_N)) (UseComp (CompAP (PositA green_A))))
@@ -33,14 +33,14 @@ LangMay: kucing dia hijau
-- I read his/her book -- two variants, different trees
Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a read_V2) (DetCN (DetQuant IndefArt NumSg) (PossNP (UseN book_N) (UsePron she_Pron)))))
LangMay: saya membaca bukunya
LangMay: aku membaca bukunya
Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a read_V2) (DetCN (DetQuant (PossPron he_Pron) NumSg) (UseN book_N))))
LangMay: saya membaca buku dia
LangMay: aku membaca buku dia
-- I read his/her father's book
Lang: UseCl (TTAnt TPast ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a read_V2) (DetCN (DetQuant DefArt NumSg) (PossNP (UseN book_N) (DetCN (DetQuant DefArt NumSg) (PossNP (UseN2 father_N2) (UsePron she_Pron)))))))
LangMay: saya membaca buku bapanya
LangMay: aku membaca buku bapanya
-- Only the noun phrase
Lang: MassNP (PossNP (UseN book_N) (UsePron he_Pron))
@@ -66,4 +66,4 @@ LangMay: kucingku dia
Lang: DetCN (DetQuant (PossPron i_Pron) NumSg) (PossNP (UseN cat_N) (UsePron she_Pron))
LangEng: my cat of hers
LangMay: kucingnya saya
LangMay: kucingnya aku

View File

@@ -16,11 +16,11 @@ LangMay: berapa banyak kucing
Lang: UseQCl (TTAnt TPres ASimul) PPos (QuestCl (PredVP (UsePron youSg_Pron) (ComplSlash (SlashV2a teach_V2) (DetCN (DetQuant DefArt NumSg) (UseN cat_N)))))
LangEng: do you teach the cat
LangMay: adakah awak mengajar kucing
LangMay: adakah kamu mengajar kucing
Lang: UseQCl (TTAnt TPres ASimul) PNeg (QuestCl (PredVP (UsePron youSg_Pron) (ComplSlash (SlashV2a teach_V2) (DetCN (DetQuant DefArt NumSg) (UseN cat_N)))))
LangEng: don't you teach the cat
LangMay: adakah awak tidak mengajar kucing
LangMay: adakah kamu tidak mengajar kucing
Lang: UseQCl (TTAnt TPres ASimul) PPos (QuestVP (IdetCN (IdetQuant which_IQuant NumSg) (UseN cat_N)) (ComplSlash (SlashV2a teach_V2) (UsePron he_Pron)))
LangEng: which cat teaches him
@@ -28,19 +28,19 @@ LangMay: kucing yang mana mengajar dia
Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv where_IAdv (PredVP (UsePron youSg_Pron) (UseV go_V)))
LangEng: where did you go
LangMay: awak pergi mana
LangMay: kamu pergi mana
Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv why_IAdv (PredVP (UsePron youSg_Pron) (UseV go_V)))
LangEng: why did you go
LangMay: mengapa awak pergi
LangMay: mengapa kamu pergi
Lang: UseQCl (TTAnt TPast ASimul) PNeg (QuestIAdv why_IAdv (PredVP (UsePron youSg_Pron) (UseV go_V)))
LangEng: why didn't you go
LangMay: mengapa awak tidak pergi
LangMay: mengapa kamu tidak pergi
Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestSlash (IdetCN (IdetQuant which_IQuant NumSg) (UseN woman_N)) (SlashVP (UsePron youSg_Pron) (SlashV2a see_V2)))
LangEng: which woman did you see
LangMay : awak melihat perempuan yang mana
LangMay : kamu melihat perempuan yang mana
# -- should be to whom did mother give the meat
Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestSlash whoSg_IP (SlashVP (MassNP (UseN2 mother_N2)) (Slash3V3 give_V3 (DetCN (DetQuant DefArt NumSg) (UseN meat_N)))))
@@ -50,7 +50,7 @@ LangMay: ibu memberi daging kepada siapa
# -- should be to whom did mother talk the meat
Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestSlash whoSg_IP (SlashVP (MassNP (UseN2 mother_N2)) (Slash3V3 talk_V3 (DetCN (DetQuant DefArt NumSg) (UseN meat_N)))))
LangEng: whom did mother talk about the meat to
LangMay: ibu bercakap daging dengan siapa
LangMay: ibu bercakap tentang daging dengan siapa
Lang: UseQCl (TTAnt TPres ASimul) PPos (QuestVP whoSg_IP (ComplVV want_VV (UseV go_V)))
LangEng: who wants to go
@@ -62,7 +62,7 @@ LangMay: siapa kucing
Lang: UseQCl (TTAnt TPres ASimul) PPos (QuestIAdv how_IAdv (PredVP (DetCN (DetQuant (PossPron youSg_Pron) NumSg) (UseN2 mother_N2)) (ComplSlash (SlashV2A paint_V2A (PositA black_A)) (DetCN (DetQuant DefArt NumSg) (UseN house_N)))))
LangEng: how does your mother paint the house black
LangMay: bagaimana ibu awak mengecat rumah hitam
LangMay: bagaimana ibu kamu mengecat rumah hitam
Lang: UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv why_IAdv (PredVP (UsePron she_Pron) (ComplSlash (SlashV2a eat_V2) (DetCN (DetQuant DefArt NumSg) (UseN meat_N)))))
LangEng: why did she eat the meat

View File

@@ -3,7 +3,7 @@
Lang: DetCN (DetQuant IndefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseV walk_V))))
LangEng: a cat that walks
LangMay: kucing yang jalan
LangMay: kucing yang berjalan
Lang: DetCN (DetQuant IndefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (ComplSlash (SlashV2a drink_V2) (MassNP (UseN milk_N))))))
LangEng: a cat that drinks milk
@@ -17,7 +17,7 @@ LangMay: susu yang kucing minum
-- We can find another RGL tree that produces the more natural variant. This tree produces this variant.
Lang: DetCN (DetQuant DefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash IdRP (SlashPrep (PredVP (DetCN (DetQuant DefArt NumSg) (UseN dog_N)) (UseV walk_V)) with_Prep))))
LangEng: the cat that the dog walks with
LangMay: kucing yang anjing jalan dengannya
LangMay: kucing yang anjing berjalan dengannya
--------------------------------------------------------------
-- Determiner placement
@@ -25,30 +25,31 @@ LangMay: kucing yang anjing jalan dengannya
-- TODO check determiner placement?
Lang: DetCN (DetQuant this_Quant NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseV walk_V))))
LangEng: this cat that walks
LangMay: kucing ini yang jalan
LangMay: kucing ini yang berjalan
Lang: DetCN (DetQuant (PossPron i_Pron) NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (ComplSlash (SlashV2a drink_V2) (MassNP (UseN milk_N))))))
LangEng: my cat that drinks milk
LangMay: kucing saya yang minum susu
LangMay: kucing aku yang minum susu
-- TODO verb form?
Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (DetNP (DetQuant this_Quant NumSg)) (UseComp (CompNP (DetCN (DetQuant DefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseV walk_V))))))))
LangEng: this is the cat that walks
LangMay: ini kucing yang jalan
LangMay: ini kucing yang berjalan
--------------------------------------------------------------
-- Complex example: "the book that his/her father gave him/her"
-- 1. His father gave him a book
-- should be "memberikan buku" as book is dead
Lang: UseCl (TTAnt TPast ASimul) PPos (PredVP (MassNP (ComplN2 father_N2 (UsePron he_Pron))) (ComplSlash (Slash2V3 give_V3 (MassNP (UseN book_N))) (UsePron he_Pron)))
LangMay: bapanya memberi buku kepadanya
-- 2. A book that her father gave her
-- TODO: would it be better as "buku yang bapanya beri kepadanya"? (Or any other variation?)
Lang: DetCN (DetQuant DefArt NumSg) (RelCN (UseN book_N) (UseRCl (TTAnt TPast ASimul) PPos (RelSlash IdRP (SlashVP (DetCN (DetQuant DefArt NumSg) (ComplN2 father_N2 (UsePron she_Pron))) (Slash3V3 give_V3 (UsePron she_Pron))))))
LangMay: buku yang bapanya beri dia
LangMay: buku yang bapanya memberi kepada dia
-- The preposition "kepada" comes from the definition of give_V3 in LexiconMay.gf.
-- If "buku yang bapanya beri kepadanya" is correct in general, but sometimes
@@ -61,14 +62,14 @@ LangMay: buku yang bapanya beri dia
-- then we can do it in the resource grammar.
-- I want to read the book that my father gave me
-- TODO check: would "saya mahu baca buku yang bapaku beri kepadaku" be better?
-- TODO check: would "aku mahu baca buku yang bapaku beri kepadaku" be better?
Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashVV want_VV (SlashV2a read_V2)) (DetCN (DetQuant DefArt NumSg) (RelCN (UseN book_N) (UseRCl (TTAnt TPast ASimul) PPos (RelSlash IdRP (SlashVP (DetCN (DetQuant DefArt NumSg) (ComplN2 father_N2 (UsePron i_Pron))) (Slash3V3 give_V3 (UsePron i_Pron)))))))))
LangMay: saya mahu baca buku yang bapaku beri saya
LangMay: aku mahu membaca buku yang bapaku memberi kepada aku
-- I want to read the book that my father read
Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashVV want_VV (SlashV2a read_V2)) (DetCN (DetQuant DefArt NumSg) (RelCN (UseN book_N) (UseRCl (TTAnt TPast ASimul) PPos (RelSlash IdRP (SlashVP (DetCN (DetQuant DefArt NumSg) (ComplN2 father_N2 (UsePron i_Pron))) (SlashV2a read_V2))))))))
LangMay: saya mahu baca buku yang bapaku baca
LangMay: aku mahu membaca buku yang bapaku membaca
-- bonus tree: we can also generate "bapa saya", not just "bapaku"
-- bonus tree: we can also generate "bapa aku", not just "bapaku"
Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplVV want_VV (ComplSlash (SlashV2a read_V2) (DetCN (DetQuant DefArt NumSg) (RelCN (UseN book_N) (UseRCl (TTAnt TPast ASimul) PPos (RelSlash IdRP (SlashVP (DetCN (DetQuant (PossPron i_Pron) NumSg) (UseN2 father_N2)) (SlashV2a read_V2)))))))))
LangMay: saya mahu baca buku yang bapa saya baca
LangMay: aku mahu membaca buku yang bapa aku membaca

View File

@@ -18,8 +18,11 @@ LangMay: kucing akan berjalan
Lang: ExtAdvS (SubjS if_Subj (UseCl (TTAnt TPast ASimul) PPos (PredVP (UsePron i_Pron) (UseV walk_V)))) (UseCl (TTAnt TCond ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (UseN cat_N)) (UseV walk_V)))
LangEng: if I walked , the cat would walk
LangMay: sekiranya saya berjalan , kucing akan berjalan
LangMay: sekiranya aku berjalan , kucing akan berjalan
Lang: ExtAdvS (SubjS when_Subj (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseV walk_V)))) (UseCl (TTAnt TFut ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (UseN cat_N)) (UseV walk_V)))
LangEng: when I walk , the cat will walk
LangMay: kalau saya berjalan , kucing akan berjalan
LangMay: kalau aku berjalan , kucing akan berjalan
---

View File

@@ -9,42 +9,41 @@
Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant (PossPron i_Pron) NumSg) (UseN cat_N)) (UseV walk_V)))
LangEng: my cat walks
LangMay: kucing saya berjalan
LangMay: kucing aku berjalan
-- As a verbal complement
Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant (PossPron i_Pron) NumSg) (UseN cat_N)) (ComplVV want_VV (UseV walk_V))))
LangEng: my cat wants to walk
LangMay: kucing saya mahu jalan
LangMay: kucing aku mahu berjalan
-- Transitive verbs
Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a read_V2) (DetCN (DetQuant this_Quant NumSg) (UseN book_N)))))
LangEng: I read this book
LangMay: saya membaca buku ini
LangMay: aku membaca buku ini
-- As a verbal complement
Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplVV want_VV (ComplSlash (SlashV2a read_V2) (DetCN (DetQuant this_Quant NumSg) (UseN book_N))))))
LangEng: I want to read this book
LangMay: saya mahu baca buku ini
LangMay: aku mahu membaca buku ini
-- How about words like mengajar and belajar? Is the prefix more important here?
Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (AdvVP (ComplSlash (SlashV2a learn_V2) (MassNP (UseN science_N))) (PrepNP in_Prep (DetCN (DetQuant DefArt NumSg) (UseN school_N))))))
LangEng: I learn science in the school
LangMay: saya belajar sains di sekolah
LangMay: aku belajar sains di sekolah
Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (AdvVP (ComplSlash (SlashV2a teach_V2) (MassNP (UseN science_N))) (PrepNP in_Prep (DetCN (DetQuant DefArt NumSg) (UseN school_N))))))
LangEng: I teach science in the school
LangMay: saya mengajar sains di sekolah
LangMay: aku mengajar sains di sekolah
-- The way the grammar is currently defined, we'd get the same output for both "I want to learn/study science". Is this correct, or should one or both of the verbs keep the ber/meng prefix in this context?
Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (AdvVP (ComplVV want_VV (ComplSlash (SlashV2a teach_V2) (MassNP (UseN science_N)))) (PrepNP in_Prep (DetCN (DetQuant DefArt NumSg) (UseN school_N))))))
LangEng: I want to teach science in the school
LangMay: saya mahu ajar sains di sekolah
LangMay: aku mahu mengajar sains di sekolah
Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (AdvVP (ComplVV want_VV (ComplSlash (SlashV2a learn_V2) (MassNP (UseN science_N)))) (PrepNP in_Prep (DetCN (DetQuant DefArt NumSg) (UseN school_N))))))
LangEng: I want to learn science in the school
LangMay: saya mahu belajar sains di sekolah
LangMay: aku mahu belajar sains di sekolah
-- How about interaction with passive? These sentences are very artificial, but imagine they made sense:
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant this_Quant NumSg) (UseN book_N)) (AdvVP (PassV2 learn_V2) (PrepNP in_Prep (DetCN (DetQuant DefArt NumSg) (UseN school_N))))))) NoVoc
@@ -62,12 +61,12 @@ LangMay: buku ini diajar di sekolah
Lang: DetCN (DetQuant IndefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseV walk_V))))
LangEng: a cat that walks
LangMay: kucing yang jalan
LangMay: kucing yang berjalan
-- In a context
Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a buy_V2) (DetCN (DetQuant IndefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseV walk_V))))))))
LangEng: I buy a cat that walks
LangMay: saya membeli kucing yang jalan
LangMay: aku membeli kucing yang berjalan
-- Transitive verbs
@@ -84,11 +83,11 @@ LangMay: susu yang kucing minum
-- Both in context
Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a buy_V2) (DetCN (DetQuant IndefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (ComplSlash (SlashV2a drink_V2) (MassNP (UseN milk_N))))))))))
LangEng: I buy a cat that drinks milk
LangMay: saya membeli kucing yang minum susu
LangMay: aku membeli kucing yang minum susu
Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a buy_V2) (MassNP (RelCN (UseN milk_N) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash IdRP (SlashVP (DetCN (DetQuant IndefArt NumSg) (UseN cat_N)) (SlashV2a drink_V2)))))))))
LangEng: I buy milk that a cat drinks
LangMay: saya membeli susu yang kucing minum
LangMay: aku membeli susu yang kucing minum
----------------------------------------
@@ -102,11 +101,21 @@ LangMay: hujan sekarang
-- In a context
Lang: UttS (AdvS (SubjS if_Subj (UseCl (TTAnt TPast ASimul) PNeg (ImpersCl (UseV rain_V0)))) (ExtAdvS now_Adv (UseCl (TTAnt TCond ASimul) PPos (PredVP (UsePron i_Pron) (UseV walk_V)))))
LangEng: if it didn't rain now , I would walk
LangMay: sekiranya tidak hujan sekarang , saya akan berjalan
LangMay: sekiranya tidak hujan sekarang , aku akan berjalan
----------------------------------------
-- Imperative
Lang: UttImpSg PPos (ImpVP (ComplSlash (SlashV2a open_V2) (DetCN (DetQuant DefArt NumSg) (UseN door_N))))
LangEng: open the door
LangMay: buka pintu
Lang: UttImpSg PNeg (ImpVP (ComplSlash (SlashV2a open_V2) (DetCN (DetQuant DefArt NumSg) (UseN door_N))))
LangEng: don't open the door
LangMay: jangan buka pintu
Lang: UttImpPol PPos (ImpVP (ComplSlash (SlashV2a open_V2) (DetCN (DetQuant DefArt NumSg) (UseN door_N))))
LangEng: open the door
LangMay: bukakan pintu
----------------------------------------
-- Questions

55
src/zulu/AdjectiveZul.gf Executable file
View File

@@ -0,0 +1,55 @@
concrete AdjectiveZul of Adjective = CatZul ** open ResZul, Prelude in {
lin
PositA adj = adj ;
-- ComparA a np = {
-- s = \\_ => a.s ! AAdj Compar Nom ++ "than" ++ np.s ! npNom ;
-- isPre = False
-- } ;
-- UseComparA a = {
-- s = \\_ => a.s ! AAdj Compar Nom ;
-- isPre = a.isPre
-- } ;
--
-- AdjOrd ord = {
-- s = \\_ => ord.s ! Nom ;
-- isPre = True
-- } ;
--
-- CAdvAP ad ap np = {
-- s = \\a => ad.s ! Pos ++ ap.s ! a ++ ad.p ++ np.s ! npNom ;
-- isPre = False
-- } ;
--
-- ComplA2 a np = {
-- s = \\_ => a.s ! AAdj Posit Nom ++ a.c2 ++ np.s ! NPAcc ;
-- isPre = False
-- } ;
--
-- ReflA2 a = {
-- s = \\ag => a.s ! AAdj Posit Nom ++ a.c2 ++ reflPron ! ag ;
-- isPre = False
-- } ;
--
-- SentAP ap sc = {
-- s = \\a => ap.s ! a ++ sc.s ;
-- isPre = False
-- } ;
AdAP ada ap = {
s = \\a => ap.s!a ++ ada.s ;
b = ap.b ;
empty = ap.empty ;
t = AdjType
} ;
-- UseA2 a = {
-- s = \\_ => a.s ! AAdj Posit Nom ;
-- isPre = True
-- } ;
--
-- AdvAP ap adv = {s = \\a => ap.s ! a ++ adv.s ; isPre = False} ;
}

27
src/zulu/AdverbZul.gf Executable file
View File

@@ -0,0 +1,27 @@
concrete AdverbZul of Adverb = CatZul ** open ResZul, Prelude in {
lin
PositAdvAdj a = {
s = "ka" ++BIND++ a.s!AF1 ;
reqLocS = False
} ;
-- ComparAdvAdj cadv a np = {
-- s = cadv.s ! Pos ++ a.s ! AAdv ++ cadv.p ++ np.s ! npNom
-- } ;
-- ComparAdvAdjS cadv a s = {
-- s = cadv.s ! Pos ++ a.s ! AAdv ++ cadv.p ++ s.s
-- } ;
--
-- PrepNP prep np = {s = preOrPost prep.isPre prep.s (np.s ! NPAcc)} ;
--
-- AdAdv = cc2 ;
-- PositAdAAdj a = {s = a.s ! AAdv} ;
-- SubjS subj s = {
-- s = subj.s ++ s.subjs ;
-- reqLocS = False
-- } ;
-- AdnCAdv cadv = {s = cadv.s ! Pos ++ cadv.p} ;
}

143
src/zulu/BackwardZul.gf Executable file
View File

@@ -0,0 +1,143 @@
concrete BackwardZul of Backward = CatZul ** open ResZul,Prelude,ParamX in {
flags optimize=all_subs ;
lin
-- A repository of obsolete constructs, needed for backward compatibility.
-- They create spurious ambiguities if used in combination with Lang.
-- from Verb 19/4/2008
ComplV2 v2 np = {
s = table {
MainCl => \\a,p,t,l => let
vform = (VFIndic MainCl p t) ;
tp = tensePref vform v2.r v2.syl ; -- [] / zo- / zuku-
oc = objConc np.agr v2.r v2.syl ; -- [] / m -
longform = case np.heavy of {
True => False ;
False => True
} ;
r = v2.s!(rform (VFIndic MainCl p t) longform) ; -- bona / boni
obj = np.s!NFull -- [] / inkomo
in case np.proDrop of {
True => tp ++ oc ++ r ++ obj ;
False => tp ++ r ++ obj
} ;
RelCl => \\a,p,t,l => let
vform = (VFIndic RelCl p t) ;
rc = relConc vform a v2.r ; -- o- / onga-
tp = tensePref vform v2.r v2.syl ; -- [] / zo- / zuku-
oc = objConc np.agr v2.r v2.syl ; -- [] / m -
longform = case np.heavy of {
True => False ;
False => True
} ;
r = v2.s!(rform vform longform) ; -- bona / boni
obj = np.s!NFull -- [] / inkomo
in case np.proDrop of {
True => rc ++ tp ++ oc ++ r ++ obj ;
False => rc ++ tp ++ r ++ obj
}
} ;
iadv, advs, comp = [] ;
ap_comp = \\_ => [] ;
hasComp = np.heavy ;
r = v2.r ;
syl = v2.syl ;
vptype = VNPCompl
} ;
-- ComplV3 v3 np1 np2 = v3 ** {
-- -- s = v3.s ;
-- oc = case np1.proDrop of {
-- True => objConc np1.agr v3.r v3.syl ;
-- False => []
-- } ;
-- comp = case np1.proDrop of {
-- True => case v3.voice of {
-- Active => np2.s ! NFull ++ np2.desc ;
-- Passive => (cop_pref np2.agr) ++BIND++ np2.s ! NFull ++ np2.desc
-- } ;
-- False => case v3.voice of {
-- Active => np1.s ! NFull ++ np1.desc ++ np2.s ! NFull ++ np2.desc ;
-- Passive => (cop_pref np1.agr) ++BIND++ np1.s ! NFull ++ np1.desc ++ np2.s ! NFull ++ np2.desc
-- }
-- } ;
-- iadv = [] ;
-- advs = [] ;
-- hasComp = True ;
-- -- r = v3.r ;
-- -- syl = v3.syl ;
-- asp = Null ;
-- asp_pref = \\_ => [] ;
-- vptype = VNPCompl ;
-- comp_agr = np1.agr ; -- this could be anything...
-- ap_comp = \\_ => [] ;
-- ap_bool = False ;
-- aux_root = [] ;
-- hasAux = False
-- } ;
-- ComplV2V v np vp =
-- insertObj (\\a => infVP v.isAux vp False Simul CPos a)
-- (insertObj (\\_ => v.c2 ++ np.s ! Acc) (predV v)) ;
-- ComplV2S v np s =
-- insertObj (\\_ => conjThat ++ s.s)
-- (insertObj (\\_ => v.c2 ++ np.s ! Acc) (predV v)) ;
-- ComplV2Q v np q =
-- insertObj (\\_ => q.s ! QIndir)
-- (insertObj (\\_ => v.c2 ++ np.s ! Acc) (predV v)) ;
-- ComplV2A v np ap =
-- insertObj (\\_ => v.c2 ++ np.s ! Acc ++ ap.s ! np.a) (predV v) ;
--
-- ReflV2 v = insertObj (\\a => v.c2 ++ reflPron ! a) (predV v) ;
--
-- -- from Sentence 19/4/2008
--
-- SlashV2 np v2 =
-- mkClause (np.s ! Nom) np.a (predV v2) ** {c2 = v2.c2} ;
--
-- SlashVVV2 np vv v2 =
-- mkClause (np.s ! Nom) np.a
-- (insertObj (\\a => infVP vv.isAux (predV v2) False Simul CPos a) (predVV vv)) **
-- {c2 = v2.c2} ;
--
-- -- from Noun 19/4/2008
--
-- NumInt n = {s = n.s ; n = Pl} ;
-- OrdInt n = {s = n.s ++ "th"} ; --- DEPRECATED
--
-- DetSg quant ord = {
-- s = quant.s ! Sg ++ ord.s ;
-- n = Sg
-- } ;
--
-- DetPl quant num ord = {
-- s = quant.s ! num.n ++ num.s ++ ord.s ;
-- n = num.n
-- } ;
--
-- NoNum = {s = []; n = Pl } ;
--
-- DefArt = {s = \\_ => artDef} ;
--
-- IndefArt = {
-- s = table {
-- Sg => artIndef ;
-- Pl => []
-- }
-- } ;
--
-- MassDet = {s = \\_ => []} ;
--
--
--
-- -- from Structural 19/4/2008
--
-- that_NP = regNP "that" Sg ;
-- these_NP = regNP "these" Pl ;
-- this_NP = regNP "this" Sg ;
-- those_NP = regNP "those" Pl ;
}

16
src/zulu/CatExtZul.gf Executable file
View File

@@ -0,0 +1,16 @@
concrete CatExtZul of CatExt = open ResZul,Prelude,ParamX in {
lincat
Loc = { s : CType => Agr => Polarity => BasicTense => Str } ;
LocN = { s : Str } ;
QuantStem = { s : Agr => Str } ;
RelStem = { s : Str } ;
VAux = { s : Str ; at : AuxType } ;
ConjN = { s : Str } ;
IAdj = { s : AForm => Str } ;
-- INAdv = { s : Str ; postIAdv : Bool } ;
Postdet = { s : Agr => Str } ;
SubCl = { s : Polarity => BasicTense => Str } ;
}

168
src/zulu/CatZul.gf Executable file
View File

@@ -0,0 +1,168 @@
concrete CatZul of Cat = CommonX - [Temp,Tense,Adv,IAdv] **
open ResZul, Prelude, ParamX in {
flags optimize=all_subs ;
lincat
-- for now, no anteriority
Temp = { s : Str ; t : BasicTense } ;
-- Tensed/Untensed
S = { s : Str } ;
QS = { s : Str ; qword_pre : Str ; qword_post : Str } ;
RS = { s : Agr => Str } ;
-- SSlash = {s : Str ; c2 : Str} ;
-- Sentence
Cl = {
s : Polarity => BasicTense => Str
} ;
-- ClSlash = {
-- s : ResZul.Tense => Anteriority => CPolarity => Order => Str ;
-- c2 : Str
-- } ;
Imp = { s : Polarity => Str } ;
-- Question
QCl = {
s : Polarity => BasicTense => Str ;
-- potqcl : Polarity => Str ;
qword_pre : Str ;
qword_post : Str
} ;
-- IP = {s : NPCase => Str ; n : Number} ;
IComp = { s : Str ; postIComp : Bool } ; -- possibly needs parameter for comp type
-- IDet = {s : Str ; n : Number} ;
-- IQuant = {s : Number => Str} ;
-- Relative
RCl = { s : Agr => Polarity => BasicTense => Str } ;
RP = { s : Str } ;
-- Verb
VP = {
s : CType => Agr => Polarity => BasicTense => Bool => Str ; -- TODO: mood
-- oc : Str ;
comp : Str ;
iadv : Str ;
advs : Str ;
hasComp : Bool ;
r : RInit ;
syl : Syl ;
-- asp : Aspect ;
-- asp_pref : VForm => Str ;
vptype : VPType ;
-- comp_agr : Agr ;
-- ap_comp : AForm => Str -- ;
-- aux_root : Str ;
-- hasAux : Bool
} ;
-- VPSlash = {
-- s : RForm => Str ;
-- oc : Str ;
-- comp : Str ;
-- hasComp : Bool ;
-- r : RInit ;
-- syl : Syl ;
-- asp : Aspect ;
-- asp_pref : VForm => Str ;
-- vptype : VPType ;
-- comp_agr : Agr ;
-- ap_comp : AForm => Str ;
-- aux_root : Str ;
-- hasAux : Bool
-- } ;
-- Comp = {
-- s : AForm => Str ;
-- r : RInit ;
-- agr : Agr ;
-- asp : Aspect ;
-- asp_pref : VForm => Str ;
-- comptype : VPType
-- } ;
-- Adjective
AP = { s : AForm => Str ; empty : Str ; t : AType } ;
-- Noun
CN = {
s : Number => NForm => Str ;
-- mod : Number => Str ;
c : ClassGender ;
empty : Str ;
emph : Bool
} ;
NP = {
empty : Str ;
s : NForm => Str ;
agr : Agr ;
i : RInit ;
proDrop : Bool ; -- used when NP is object
isPron : Bool ; -- used to choose correct between Full/Reduced
heavy : Bool -- has object/adv/qword
} ;
-- Pronoun
Pron = { s : NForm => Str ; agr : Agr ; empty : Str ; proDrop : Bool } ;
-- DAP
Det = { s : Str ; n : Number } ;
Predet = { s : Agr => Str ; hasDem : Bool } ;
-- Ord = { s : Case => Str } ;
Num = { s: Str ; n : Number } ;
-- Card = {s,sp : Bool => Case => Str ; n : Number} ;
-- ACard = {s : Case => Str ; n : Number} ;
Quant = { s : Bool => Agr => Str ; dist : Distance } ;
-- Numeral
-- Numeral = {s : Bool => CardOrd => Case => Str ; n : Number} ;
-- Digits = {s : CardOrd => Case => Str ; n : Number ; tail : DTail} ;
-- Structural
Conj = { s : RInit => Str ; fix : Bool } ;
Subj = {s : Str} ;
-- Adv = { s : Str ; asp : Aspect ; reqLocS : Bool } ;
-- Prep = {s : Str; isPre : Bool} ;
-- CAdv = {s : Polarity => Str; p : Str} ;
-- Open lexical classes, e.g. Lexicon
V,V2,VA,VS,V3 = {
s : RForm => Str ;
r : RInit ;
syl : Syl ;
voice : Voice
} ;
-- VQ = Verb ;
-- V2Q, V2S = Verb ** {c2 : Str} ;
-- V2A,V3 = Verb ** {c2, c3 : Str} ;
-- V = {s : VVForm => Str ; p : Str ; typ : VVType} ;
-- V2V = Verb ** {c2,c3 : Str ; typ : VVType} ;
A = { s : AForm => Str ; empty : Str ; t : AType } ;
-- A2 = {s : AForm => Str ; c2 : Str ; isPre : Bool} ;
N, N2, N3, PN = {
s : Number => NForm => Str ;
c : ClassGender ;
-- sem : SemanticType ;
empty : Str
} ;
-- N2 = {s : Number => Case => Str ; g : Gender} ** {c2 : Str} ;
-- N3 = {s : Number => Case => Str ; g : Gender} ** {c2,c3 : Str} ;
Adv = { s : Str ; reqLocS : Bool } ;
IAdv = { s : Str ; postIAdv : Bool } ;
}

85
src/zulu/ChunkFunctor.gf Executable file
View File

@@ -0,0 +1,85 @@
incomplete concrete ChunkFunctor of Chunk = Cat, Symbol [Symb] ** { --, Extensions [VPS,VPI] **
open
Syntax, Extensions,
Prelude in {
lincat
Chunks = {s : Str} ;
Chunk = {s : Str};
VC = V ;
lin
OneChunk c = c ;
PlusChunk c cs = cc2 c cs ;
ChunkPhr c = ss ("*" ++ c.s) | c ;
lin
AP_Chunk ap = mkUtt ap ;
AdA_Chunk ada = ada ;
Adv_Chunk adv = adv ;
AdV_Chunk adv = adv ;
AdN_Chunk adn = adn ;
S_Chunk s = mkUtt s ;
SSlash_Chunk s = mkUtt <lin S s : S> ;
QS_Chunk qs = mkUtt qs ;
CN_Pl_Chunk cn = mkUtt (Syntax.mkNP aPl_Det cn) ;
CN_Sg_Chunk cn = mkUtt cn ;
---- CN_Pl_Gen_Chunk cn = ss (cn.s ! Pl ! Gen) ;
---- CN_Sg_Gen_Chunk cn = ss (cn.s ! Sg ! Gen) ;
Conj_Chunk conj = ss conj.s2 ; ----
Det_Chunk det = mkUtt (Syntax.mkNP det) ;
IAdv_Chunk iadv = iadv ;
IP_Chunk ip = mkUtt ip ;
NP_Nom_Chunk np = mkUtt np ;
---- NP_Acc_Chunk np = ss (np.s ! NPAcc) ;
---- NP_Gen_Chunk np = ss (np.s ! NCase Gen) | ss (np.s ! NPNomPoss) ;
Numeral_Nom_Chunk num = mkUtt (Syntax.mkNP (Syntax.mkDet num)) ;
---- Numeral_Gen_Chunk num = ss (num.s ! NCard ! Gen) ;
---- Ord_Nom_Chunk ord = ss (ord.s ! Nom) ;
---- Ord_Gen_Chunk ord = ss (ord.s ! Gen) ;
Predet_Chunk predet = mkUtt (Syntax.mkNP predet emptyNP) ;
Prep_Chunk prep = mkAdv prep emptyNP ; ----
---- RP_Nom_Chunk rp = ss (rp.s ! RC Neutr (NCase Nom)) ;
---- RP_Acc_Chunk rp = ss (rp.s ! RPrep Masc) ; ----
---- RP_Gen_Chunk rp = ss (rp.s ! RC Neutr (NCase Gen)) ;
Subj_Chunk subj = subj ;
--- PConj_Chunk pconj = pconj ;
VPS_Chunk vps = mkUtt (E.PredVPS emptyNP vps) ;
-- VPI_Chunk : VPI -> Chunk ;
V2_V,
VA_V,
VQ_V,
VS_V,
---- VV_V,
V3_V,
V2A_V,
V2Q_V,
V2S_V,
V2V_V
= \v -> <lin V v : V> ;
UseVC t p vc = E.MkVPS t p (mkVP vc) ;
Symb_Chunk s = lin Utt s ;
fullstop_Chunk = sbSS "." ;
exclmark_Chunk = sbSS "!" ;
questmark_Chunk = sbSS "?" ;
comma_Chunk = sbSS "," ;
colon_Chunk = sbSS ":" ;
semicolon_Chunk = sbSS ";" ;
quote_Chunk = variants {sbSS "\"" ; ss ("\"" ++ SOFT_BIND) } ;
lpar_Chunk = ss ("(" ++ SOFT_BIND) ;
rpar_Chunk = sbSS ")" ;
dash_Chunk = sbSS "-" ;
oper
emptyNP : NP = Syntax.mkNP (P.mkPN []) ;
sbSS : Str -> SS = \s -> ss (SOFT_BIND ++ s) ;
}

307
src/zulu/ChunkZul.gf Executable file
View File

@@ -0,0 +1,307 @@
concrete ChunkZul of Chunk = CatZul, SymbolZul [Symb] **
-- ChunkFunctor - [Det_Chunk]
-- with (Syntax = SyntaxZul) ** --, (Extensions = ExtensionsZul) **
open
-- SyntaxZul, Prelude, (E = ExtensionsZul),
Prelude, ResZul, ParamX,
(R = ResZul), (P = ParadigmsZul) in {
lincat
Chunks = {s : Str} ;
Chunk = {s : Str};
Chunk_CN = {s: Str} ;
VC = V ;
lin
OneChunk c = c ;
PlusChunk c cs = cc2 c cs ;
CN_Chunker c = c ;
ChunkPhr c = ss ("*" ++ c.s) | c ;
AP_Chunk ap = { s = ap_vars ap } ;
-- AdA_Chunk : AdA -> Chunk ;
Adv_Chunk adv = { s = adv_vars adv.s } ;
-- AdV_Chunk : AdV -> Chunk ;
-- AdN_Chunk : AdN -> Chunk ;
S_Chunk s = { s = variants { s.s!Princ ; s.s!Part ; s.subjs ; s.pots!Princ ; s.pots!Part } } ;
-- SSlash_Chunk : SSlash -> Chunk ;
QS_Chunk s = { s = s.qword_pre ++ s.s ++ s.qword_post } ;
-- CN_Pl_Chunk : CN -> Chunk ;
CN_Sg_Chunk cn = {
s = cn.s!Sg!Full ++ cn.mod!Sg
} ;
CN_Pl_Chunk cn = {
s = cn.s!Pl!Full ++ cn.mod!Pl
} ;
-- CN_Pl_Gen_Chunk : CN -> Chunk ;
-- CN_Sg_Gen_Chunk : CN -> Chunk ;
-- Conj_Chunk : Conj -> Chunk ;
-- Det_Chunk : Det -> Chunk ; -- needed if article form is different from NP form, e.g. English a/an
-- IAdv_Chunk : IAdv -> Chunk ;
-- IP_Chunk : IP -> Chunk ;
NP_Nom_Chunk np = {
s = case np.isPron of {
False => variants {
np.predet_pre ++ np.dem ++ np.s!Full ++ np.mod ++ np.predet_post ;
np.predet_pre ++ np.dem ++ np.s!Reduced ++ np.mod ++ np.predet_post -- ; -- [anginoni] nkomo
-- np.predet_pre ++ np.dem ++ np.s!Reduced ++ np.mod ++ np.predet_post ;
-- np.predet_pre ++ dem_pron!Dem2!np.agr ++ np.s!Reduced ++ np.mod ++ np.predet_post ;
-- np.predet_pre ++ dem_pron!Dem3!np.agr ++ np.s!Reduced ++ np.mod ++ np.predet_post ;
-- np.predet_pre ++ np.dem ++ np.s!Full ++ np.mod ++ np.predet_post ; -- meant to catch pronouns
-- np.predet_pre ++ dem_pron!Dem2!np.agr ++ np.s!Full ++ np.mod ++ np.predet_post ; -- meant to catch pronouns
-- np.predet_pre ++ dem_pron!Dem3!np.agr ++ np.s!Full ++ np.mod ++ np.predet_post ; -- meant to catch pronouns
-- np.predet_pre ++ np.dem ++ np.s!Loc ++ np.mod ++ np.predet_post
} ;
True => case np.proDrop of {
False => np.predet_pre ++ np.dem ++ np.s!Full ++ np.mod ++ np.predet_post ;
True => np.predet_pre ++ np.dem ++ np.s!Reduced ++ np.mod ++ np.predet_post
}
}
} ;
-- NP_Acc_Chunk : NP -> Chunk ;
NP_Gen_Chunk np = {
s = poss_concord_agr!agr_vars!np.i ++BIND++ np.s!Poss ++ np.dem ++ np.mod ++ np.predet_pre ++ np.predet_post
} ;
-- Numeral_Nom_Chunk : Numeral -> Chunk ;
-- Numeral_Gen_Chunk : Numeral -> Chunk ;
-- Ord_Nom_Chunk : Ord -> Chunk ;
-- Ord_Gen_Chunk : Ord -> Chunk ;
-- Predet_Chunk : Predet -> Chunk ;
-- Prep_Chunk : Prep -> Chunk ;
-- RP_Nom_Chunk : RP -> Chunk ;
-- RP_Gen_Chunk : RP -> Chunk ;
-- RP_Acc_Chunk : RP -> Chunk ;
-- Subj_Chunk : Subj -> Chunk ;
-- IComp_Chunk icomp = { } ;
-- --- PConj_Chunk : PConj -> Chunk ;
-- N_Sg_Chunk n = { s = variants { n.s!Sg!Full ; n.s!Sg!Reduced } } ;
-- N_Pl_Chunk n = { s = variants { n.s!Pl!Full ; n.s!Pl!Reduced } } ;
N_Sg_Chunk n = { s = n.s!Sg!Full } ;
N_Pl_Chunk n = { s = n.s!Pl!Full } ;
--
-- VPS_Chunk : VPS -> Chunk ;
-- VPI_Chunk : VPI -> Chunk ;
--
-- -- verbs lifted to one cat
--
-- V2_V : V2 -> VC ;
-- VA_V : VA -> VC ;
-- VQ_V : VQ -> VC ;
-- VS_V : VS -> VC ;
-- VV_V : VV -> VC ;
--
-- V3_V : V3 -> VC ;
-- V2A_V : V2A -> VC ;
-- V2Q_V : V2Q -> VC ;
-- V2S_V : V2S -> VC ;
-- V2V_V : V2V -> VC ;
--
-- UseVC : Temp -> Pol -> VC -> VPS ;
--
-- -- for unknown words that are not names
--
Symb_Chunk symb = { s = symb.s } ;
--
-- -- syncategorematic chunks
-- refl_SgP1_Chunk,
-- refl_SgP2_Chunk,
-- refl_SgP3_Chunk,
-- refl_PlP1_Chunk,
-- refl_PlP2_Chunk,
-- refl_PlP3_Chunk : Chunk ;
-- neg_Chunk : Chunk ;
-- copula_Chunk : Chunk ;
-- copula_neg_Chunk : Chunk ;
-- copula_inf_Chunk : Chunk ;
-- past_copula_Chunk : Chunk ;
-- past_copula_neg_Chunk : Chunk ;
-- future_Chunk : Chunk ;
-- future_neg_Chunk : Chunk ;
-- cond_Chunk : Chunk ;
-- cond_neg_Chunk : Chunk ;
-- perfect_Chunk : Chunk ;
-- perfect_neg_Chunk : Chunk ;
-- past_perfect_Chunk : Chunk ;
-- past_perfect_neg_Chunk : Chunk ;
-- fullstop_Chunk = sbSS "." ;
-- exclmark_Chunk = sbSS "!" ;
-- questmark_Chunk = sbSS "?" ;
-- comma_Chunk = sbSS "," ;
-- colon_Chunk = sbSS ":" ;
-- semicolon_Chunk = sbSS ";" ;
-- quote_Chunk = variants {sbSS "\"" ; ss ("\"" ++ SOFT_BIND) } ;
-- lpar_Chunk = ss ("(" ++ SOFT_BIND) ;
-- rpar_Chunk = sbSS ")" ;
dash_Chunk = sbSS "-" ;
oper
-- emptyNP = lin NP {
-- empty = [] ;
-- s = table {
-- Full => [] ; Reduced => []
-- } ;
-- loc = [] ;
-- desc = [] ;
-- agr = agr_vars ;
-- isPron = True ;
-- reqLocS = False
-- } ;
sbSS : Str -> SS = \s -> ss (SOFT_BIND ++ s) ;
adv_vars : Str -> Str = \s -> variants {
s ;
rel_adv_vars s ;
poss_adv_vars s
} ;
rel_adv_vars : Str -> Str = \s -> variants {
relConc!(Third C1_2 Sg)!RelC ++BIND++ s ;
relConc!(Third C1_2 Pl)!RelC ++BIND++ s ;
relConc!(Third C1a_2a Sg)!RelC ++BIND++ s ;
relConc!(Third C1a_2a Pl)!RelC ++BIND++ s ;
relConc!(Third C3_4 Sg)!RelC ++BIND++ s ;
relConc!(Third C3_4 Pl)!RelC ++BIND++ s ;
relConc!(Third C5_6 Sg)!RelC ++BIND++ s ;
relConc!(Third C5_6 Pl)!RelC ++BIND++ s ;
relConc!(Third C7_8 Sg)!RelC ++BIND++ s ;
relConc!(Third C7_8 Pl)!RelC ++BIND++ s ;
relConc!(Third C9_10 Sg)!RelC ++BIND++ s ;
relConc!(Third C9_10 Pl)!RelC ++BIND++ s ;
relConc!(Third C11_10 Sg)!RelC ++BIND++ s ;
relConc!(Third C11_10 Pl)!RelC ++BIND++ s ;
relConc!(Third C9_6 Sg)!RelC ++BIND++ s ;
relConc!(Third C9_6 Pl)!RelC ++BIND++ s ;
relConc!(Third C14 Sg)!RelC ++BIND++ s ;
relConc!(Third C15 Sg)!RelC ++BIND++ s ;
relConc!(Third C17 Sg)!RelC ++BIND++ s ;
relConc!(First Sg)!RelC ++BIND++ s ;
relConc!(First Pl)!RelC ++BIND++ s ;
relConc!(Second Sg)!RelC ++BIND++ s ;
relConc!(Second Pl)!RelC ++BIND++ s
} ;
poss_adv_vars : Str -> Str = \s -> variants {
poss_conc_adv (Third C1_2 Sg) s ;
poss_conc_adv (Third C1_2 Pl) s ;
poss_conc_adv (Third C1a_2a Sg) s ;
poss_conc_adv (Third C1a_2a Pl) s ;
poss_conc_adv (Third C3_4 Sg) s ;
poss_conc_adv (Third C3_4 Pl) s ;
poss_conc_adv (Third C5_6 Sg) s ;
poss_conc_adv (Third C5_6 Pl) s ;
poss_conc_adv (Third C7_8 Sg) s ;
poss_conc_adv (Third C7_8 Pl) s ;
poss_conc_adv (Third C9_10 Sg) s ;
poss_conc_adv (Third C9_10 Pl) s ;
poss_conc_adv (Third C11_10 Sg) s ;
poss_conc_adv (Third C9_6 Sg) s ;
poss_conc_adv (Third C11_10 Pl) s ;
poss_conc_adv (Third C9_6 Pl) s ;
poss_conc_adv (Third C14 Sg) s ;
poss_conc_adv (Third C15 Sg) s ;
poss_conc_adv (Third C17 Sg) s ;
poss_conc_adv (First Sg) s ;
poss_conc_adv (First Pl) s ;
poss_conc_adv (Second Sg) s ;
poss_conc_adv (Second Pl) s
} ;
poss_conc_adv : Agr -> Str -> Str = \a,s -> case a of {
Third c n => (poss_concord!c!n!RC) ++BIND++ "s" ++BIND++ s ;
First n => (poss_concord!C1_2!n!RC) ++BIND++ "s" ++BIND++ s ;
Second n => (poss_concord!C1_2!n!RC) ++BIND++ "s" ++BIND++ s
} ;
agr_vars : Agr = variants {
Third C1_2 Sg ;
Third C1_2 Pl ;
Third C1a_2a Sg ;
Third C1a_2a Pl ;
Third C3_4 Sg ;
Third C3_4 Pl ;
Third C5_6 Sg ;
Third C5_6 Pl ;
Third C7_8 Sg ;
Third C7_8 Pl ;
Third C9_10 Sg ;
Third C9_10 Pl ;
Third C11_10 Sg ;
Third C11_10 Pl ;
Third C9_6 Sg ;
Third C9_6 Pl ;
Third C14 Sg ;
Third C15 Sg ;
Third C17 Sg ;
First Sg ;
First Pl ;
Second Sg ;
Second Pl
} ;
ap_vars : AP -> Str = \ap -> variants {
ap_form Pos (Third C1_2 Sg) ap ;
ap_form Pos (Third C1_2 Pl) ap ;
ap_form Pos (Third C1a_2a Sg) ap ;
ap_form Pos (Third C1a_2a Pl) ap ;
ap_form Pos (Third C3_4 Sg) ap ;
ap_form Pos (Third C3_4 Pl) ap ;
ap_form Pos (Third C5_6 Sg) ap ;
ap_form Pos (Third C5_6 Pl) ap ;
ap_form Pos (Third C7_8 Sg) ap ;
ap_form Pos (Third C7_8 Pl) ap ;
ap_form Pos (Third C9_10 Sg) ap ;
ap_form Pos (Third C9_10 Pl) ap ;
ap_form Pos (Third C11_10 Sg) ap ;
ap_form Pos (Third C11_10 Pl) ap ;
ap_form Pos (Third C9_6 Sg) ap ;
ap_form Pos (Third C9_6 Pl) ap ;
ap_form Pos (Third C14 Sg) ap ;
ap_form Pos (Third C15 Sg) ap ;
ap_form Pos (Third C17 Sg) ap ;
ap_form Pos (First Sg) ap ;
ap_form Pos (First Pl) ap ;
ap_form Pos (Second Sg) ap ;
ap_form Pos (Second Pl) ap ;
ap_form Neg (Third C1_2 Sg) ap ;
ap_form Neg (Third C1_2 Pl) ap ;
ap_form Neg (Third C1a_2a Sg) ap ;
ap_form Neg (Third C1a_2a Pl) ap ;
ap_form Neg (Third C3_4 Sg) ap ;
ap_form Neg (Third C3_4 Pl) ap ;
ap_form Neg (Third C5_6 Sg) ap ;
ap_form Neg (Third C5_6 Pl) ap ;
ap_form Neg (Third C7_8 Sg) ap ;
ap_form Neg (Third C7_8 Pl) ap ;
ap_form Neg (Third C9_10 Sg) ap ;
ap_form Neg (Third C9_10 Pl) ap ;
ap_form Neg (Third C11_10 Sg) ap ;
ap_form Neg (Third C11_10 Pl) ap ;
ap_form Neg (Third C9_6 Sg) ap ;
ap_form Neg (Third C9_6 Pl) ap ;
ap_form Neg (Third C14 Sg) ap ;
ap_form Neg (Third C15 Sg) ap ;
ap_form Neg (Third C17 Sg) ap ;
ap_form Neg (First Sg) ap ;
ap_form Neg (First Pl) ap ;
ap_form Neg (Second Sg) ap ;
ap_form Neg (Second Pl) ap
} ;
ap_form : Polarity -> Agr -> AP -> Str = \pol,agr,ap ->
let
agr = agr_vars ;
-- adjf = case ap.b of {
-- True => (aformN agr) ;
-- -- True => AF2 ;
-- False => AF1
-- }
adjf = variants { AF1 ; AF2 ; AF3 } ;
in
relAdjAgrLookup!pol!agr ++BIND++ ap.s!adjf ;
}

17
src/zulu/CompatibilityZul.gf Executable file
View File

@@ -0,0 +1,17 @@
--# -path=.:../abstract:../common:../prelude
concrete CompatibilityZul of Compatibility = CatZul ** open Prelude, ResZul in {
-- from Noun 19/4/2008
-- lin
-- NumInt n = {s,sp = \\_ => addGenitiveS n.s ; n = Pl ; hasCard = True} ;
-- OrdInt n = {s = \\c => n.s ++ (regGenitiveS "th")!c } ;
--
-- oper
-- -- Note: this results in a space before 's, but there's
-- -- not mauch we can do about that.
-- addGenitiveS : Str -> Case => Str = \s ->
-- table { Gen => s ++ "'s"; _ => s } ;
}

119
src/zulu/ConjunctionZul.gf Executable file
View File

@@ -0,0 +1,119 @@
concrete ConjunctionZul of Conjunction =
CatZul ** open ResZul, Coordination, Prelude in {
flags optimize=all_subs ;
lin
-- should deal correctly with futhi, not with na-
-- ConjS conj ss = {
-- s = \\dm => ss.s1!dm ++ conj.s!RC ++ ss.s2!dm ;
-- subjs = ss.subjs1 ++ conj.s!RC ++ ss.subjs2 ;
-- pots = \\dm => ss.pots1!dm ++ conj.s!RC ++ ss.pots2!dm
-- } ;
--
-- ConjAdv = conjunctDistrSS ;
-- ConjAdV = conjunctDistrSS ;
-- ConjAdv conj advs = ;
-- ConjNP conj nps =
-- let
-- np2_loose = nps.s2!Full ;
-- np2_fixed = nps.s2!Reduced
-- in {
-- empty = [] ;
-- s = \\f =>
-- nps.s1!f ++ np1.desc
-- ++
-- (link_conj
-- (conj.s!(nominit!np2.agr))
-- (np2_loose)
-- (np2_fixed)
-- conj.fix) ++
-- np2.desc ;
-- loc = np1.loc ++
-- np1.desc ++
-- (link_conj
-- (conj.s!(locinit!np2.agr))
-- np2.loc
-- np2.loc
-- conj.fix) ++
-- np2.desc ;
-- desc = [] ;
-- agr = np2.agr ;
-- isPron = False ;
-- reqLocS = np1.reqLocS
-- } ;
-- ConjAP conj ss = conjunctDistrTable Agr conj ss ** {
-- isPre = ss.isPre
-- } ;
--
-- ConjRS conj ss = conjunctDistrTable Agr conj ss ** {
-- c = ss.c
-- } ;
--
-- ConjIAdv = conjunctDistrSS ;
--
-- ConjCN co ns = conjunctDistrTable2 Number Case co ns ** {g = Neutr} ; --- gender?
--
-- ConjDet c xs = let cxs = (conjunctDistrSS c xs).s in {s = cxs ; sp = \\_,_,_ => cxs ++ "one" ; hasNum = False ; n = xs.n} ;
--
-- -- These fun's are generated from the list cat's.
--
-- BaseS = twoSS ;
-- ConsS = consrSS comma ;
-- BaseAdv x y = twoSS ** { reqLocS = x.reqLocS } ;
-- ConsAdv x y = consrSS comma x y ** { reqLocS = x.reqLocS } ;
-- BaseAdV = twoSS ;
-- ConsAdV = consrSS comma ;
BaseNP x y = twoTable NForm x y ** {
agr = conjAgr x.agr y.agr ;
empty = x.empty ++ y.empty ;
loc = x.loc
} ;
ConsNP xs x = consrTable NPCase comma xs x ** {a = conjAgr xs.a x.a} ;
-- BaseAP x y = twoTable Agr x y ** {isPre = andB x.isPre y.isPre} ;
-- ConsAP xs x = consrTable Agr comma xs x ** {isPre = andB xs.isPre x.isPre} ;
-- BaseRS x y = twoTable Agr x y ** {c = y.c} ;
-- ConsRS xs x = consrTable Agr comma xs x ** {c = xs.c} ;
-- BaseIAdv = twoSS ;
-- ConsIAdv = consrSS comma ;
-- BaseCN = twoTable2 Number Case ;
-- ConsCN = consrTable2 Number Case comma ;
-- BaseDAP x y = twoSS x y ** {n = y.n} ; --- the last number decides: one big and two small cars
-- ConsDAP x xs = consrSS comma x xs ** {n = xs.n} ;
lincat
[S] = {
s1 : DMood => Str ;
subjs1 : Str ;
pots1 : DMood => Str ;
s2 : DMood => Str ;
subjs2 : Str ;
pots2 : DMood => Str
} ;
-- [Adv] = {s1,s2 : Str} ;
-- [AdV] = {s1,s2 : Str} ;
-- [IAdv] = {s1,s2 : Str} ;
-- [NP] = {s1,s2 : NPCase => Str ; a : Agr} ;
-- [AP] = {s1,s2 : Agr => Str ; isPre : Bool} ;
-- [RS] = {s1,s2 : Agr => Str ; c : NPCase} ;
-- [CN] = {s1,s2 : Number => Case => Str} ;
-- [DAP] = {s1,s2 : Str ; n : Number} ;
oper
conjAgr : Agr -> Agr = \a1,a2 -> case <a1,a2> of {
<First _,First _> => First Pl ;
<First _,Second _> => First Pl ;
<First _,Third _ _> => First Pl ;
<Second _,First _> => First Pl ;
<Second _,Second _> => Second Pl ;
<Second _,Third _ _> => Second Pl ;
<Third _ _,First _> => First Pl ;
<Third _ _,Second _> => Second Pl ;
<Third c1 _,Third c2 _> => Third c1 Pl
} ;
}

222
src/zulu/ConstructionZul.gf Executable file
View File

@@ -0,0 +1,222 @@
--# -path=.:../abstract
concrete ConstructionZul of Construction = CatZul **
open SyntaxZul, SymbolicZul, ParadigmsZul, (L = LexiconZul), (E = ExtendZul), (G = GrammarZul), (R = ResZul), (Sy = SyntaxZul), (S = StructuralZul), Prelude in {
-- lin
-- hungry_VP = mkVP (mkA "hungry") ;
-- thirsty_VP = mkVP (mkA "thirsty") ;
-- tired_VP = mkVP (mkA "tired") ;
-- scared_VP = mkVP (mkA "scared") ;
-- ill_VP = mkVP (mkA "ill") ;
-- ready_VP = mkVP (mkA "ready") ;
--
-- has_age_VP card = mkVP (mkAP (lin AdA (mkUtt (mkNP <lin Card card : Card> L.year_N))) L.old_A) ;
--
-- have_name_Cl x y = mkCl (mkNP (E.GenNP x) L.name_N) (lin NP y) ;
-- married_Cl x y = mkCl (lin NP x) L.married_A2 (lin NP y) | mkCl (mkNP and_Conj (lin NP x) (lin NP y)) (mkA "married") ;
--
-- what_name_QCl x = mkQCl (mkIComp whatSg_IP) (mkNP (E.GenNP x) L.name_N) ;
-- how_old_QCl x = mkQCl (E.ICompAP (mkAP L.old_A)) (lin NP x) ;
-- how_far_QCl x = mkQCl (E.IAdvAdv (ss "far")) (lin NP x) ;
--
-- -- some more things
-- weather_adjCl ap = mkCl (mkVP (lin AP ap)) ;
--
-- is_right_VP = mkVP (ParadigmsZul.mkA "right") ;
-- is_wrong_VP = mkVP (ParadigmsZul.mkA "wrong") ;
--
-- 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 a = mkAP (lin AdA (mkUtt (mkNP <lin Card card : Card> (lin CN cn)))) (lin A a) ;
-- n_unit_CN card unit cn = mkCN (invarA ((mkUtt card).s ++ (mkUtt unit).s)) cn ;
--
-- bottle_of_CN np = mkCN (lin N2 (mkN2 "bottle")) (lin NP np) ;
-- cup_of_CN np = mkCN (lin N2 (mkN2 "cup")) (lin NP np) ;
-- glass_of_CN np = mkCN (lin N2 (mkN2 "glass")) (lin NP np) ;
--
-- few_X_short_of_Y np x y =
-- let
-- xs : Str = x.s ! R.Pl ! R.Nom ;
-- a_y : Str = (mkNP a_Det y).s ! R.NCase R.Nom ;
-- in
-- mkS (mkCl np (mkAdv ("a few" ++ xs ++ "short of" ++ a_y))) ;
-- {-
-- -- spatial deixis and motion verbs
--
-- where_go_QCl np = mkQCl where_IAdv (mkCl np (mkVP L.go_V)) ;
-- where_come_from_QCl np = mkQCl from_where_IAdv (mkCl np (mkVP L.go_V)) ;
--
-- go_here_VP = mkVP (mkVP L.go_V) S.here_Adv ;
-- come_here_VP = mkVP (mkVP L.come_V) S.here_Adv ;
-- come_from_here_VP = mkVP (mkVP L.come_V) (mkAdv "from here") ;
--
-- go_there_VP = mkVP (mkVP L.go_V) S.there_Adv ;
-- come_there_VP = mkVP (mkVP L.come_V) S.there_Adv ;
-- come_from_there_VP = mkVP (mkVP L.come_V) (mkAdv "from there") ;
--
-- --TODO "where did X come from" instead of "from where did X come"
-- oper from_where_IAdv : IAdv = lin IAdv (ss "from where") ;
--
-- -}
--
--
-- lincat
-- Timeunit = N ;
-- Hour = {s : Str ; am : Bool} ;
-- Weekday = N ;
-- Monthday = NP ;
-- Month = N ;
-- Year = NP ;
--
-- lin
-- timeunitAdv n time =
-- let n_card : Card = n ;
-- n_hours_NP : NP = mkNP n_card time ;
-- in Sy.mkAdv for_Prep n_hours_NP | mkAdv (n_hours_NP.s ! R.npNom) ;
--
-- timeunitRange l u time = {s = l.s ! True ! R.Nom ++ to_Prep.s ++ u.s ! True ! R.Nom ++ time.s ! R.Pl ! R.Nom} ;
--
-- oneHour = mkHour "1" True ;
-- twoHour = mkHour "2" True ;
-- threeHour = mkHour "3" True ;
-- fourHour = mkHour "4" True ;
-- fiveHour = mkHour "5" True ;
-- sixHour = mkHour "6" True ;
-- sevenHour = mkHour "7" True ;
-- eightHour = mkHour "8" True ;
-- nineHour = mkHour "9" True ;
-- tenHour = mkHour "10" True ;
-- elevenHour = mkHour "11" True ;
-- twelveHour = mkHour "12" False ;
-- thirteenHour = mkHour "1" False ;
-- fourteenHour = mkHour "2" False ;
-- fifteenHour = mkHour "3" False ;
-- sixteenHour = mkHour "4" False ;
-- seventeenHour = mkHour "5" False ;
-- eighteenHour = mkHour "6" False ;
-- nineteenHour = mkHour "7" False ;
-- twentyHour = mkHour "8" False ;
-- twentyOneHour = mkHour "9" False ;
-- twentyTwoHour = mkHour "10" False ;
-- twentyThreeHour = mkHour "11" False ;
-- twentyFourHour = mkHour "12" True ;
--
-- timeHour h = Sy.mkAdv at_Prep (symb (h.s ++ ampm ! h.am)) ;
-- timeHourMinute h m = let
-- min = m.s ! True ! R.Nom
-- in
-- Sy.mkAdv at_Prep (symb (h.s ++ min ++ ampm ! h.am)) ;
--
-- oper
-- mkHour : Str -> Bool -> {s : Str ; am : Bool} ;
-- mkHour n am = Sy.mkUtt (Sy.mkCard n) ** {am = am} ;
--
-- at_Prep : Prep ;
-- at_Prep = mkPrep "at" ;
--
-- ampm : Bool => Str ;
-- ampm = table {True => "a.m." ; False => "p.m."} ;
--
-- lin
-- weekdayPunctualAdv w = SyntaxZul.mkAdv on_Prep (mkNP w) ; -- on Sunday
-- weekdayHabitualAdv w = SyntaxZul.mkAdv on_Prep (mkNP aPl_Det w) ; -- on Sundays
-- weekdayNextAdv w = SyntaxZul.mkAdv (mkPrep "next") (mkNP w) ; -- next Sunday
-- weekdayLastAdv w = SyntaxZul.mkAdv (mkPrep "last") (mkNP w) ; -- last Sunday
--
-- monthAdv m = SyntaxZul.mkAdv in_Prep (mkNP m) ;
-- yearAdv y = SyntaxZul.mkAdv in_Prep y ;
-- dayMonthAdv d m = ParadigmsZul.mkAdv ("on" ++ d.s ! R.NPAcc ++ m.s ! R.Sg ! R.Nom) ; -- on 17 May
-- monthYearAdv m y = SyntaxZul.mkAdv in_Prep (mkNP (mkCN m y)) ; -- in May 2012
-- dayMonthYearAdv d m y = ParadigmsZul.mkAdv ("on" ++ d.s ! R.NPAcc ++ m.s ! R.Sg ! R.Nom ++ y.s ! R.NPAcc) ; -- on 17 May 2013
--
-- intYear = symb ;
-- intMonthday = symb ;
--
-- lincat Language = N ;
--
-- lin InLanguage l = SyntaxZul.mkAdv in_Prep (mkNP l) ;
--
-- lin
-- weekdayN w = w ;
-- monthN m = m ;
--
-- weekdayPN w = mkPN w ;
-- monthPN m = mkPN m ;
--
-- languageCN l = mkCN l ;
-- languageNP l = mkNP l ;
--
--
-- oper mkLanguage : Str -> N = \s -> mkN s ;
--
-- ----------------------------------------------
-- ---- lexicon of special names
--
-- lin second_Timeunit = mkN "second" ;
-- lin minute_Timeunit = mkN "minute" ;
-- lin hour_Timeunit = mkN "hour" ;
-- lin day_Timeunit = mkN "day" ;
-- lin week_Timeunit = mkN "week" ;
-- lin month_Timeunit = mkN "month" ;
-- lin year_Timeunit = mkN "year" ;
--
-- lin monday_Weekday = mkN "Monday" ;
-- lin tuesday_Weekday = mkN "Tuesday" ;
-- lin wednesday_Weekday = mkN "Wednesday" ;
-- lin thursday_Weekday = mkN "Thursday" ;
-- lin friday_Weekday = mkN "Friday" ;
-- lin saturday_Weekday = mkN "Saturday" ;
-- lin sunday_Weekday = mkN "Sunday" ;
--
-- lin january_Month = mkN "January" ;
-- lin february_Month = mkN "February" ;
-- lin march_Month = mkN "March" ;
-- lin april_Month = mkN "April" ;
-- lin may_Month = mkN "May" ;
-- lin june_Month = mkN "June" ;
-- lin july_Month = mkN "July" ;
-- lin august_Month = mkN "August" ;
-- lin september_Month = mkN "September" ;
-- lin october_Month = mkN "October" ;
-- lin november_Month = mkN "November" ;
-- lin december_Month = mkN "December" ;
--
-- lin afrikaans_Language = mkLanguage "Afrikaans" ;
-- lin amharic_Language = mkLanguage "Amharic" ;
-- lin arabic_Language = mkLanguage "Arabic" ;
-- lin bulgarian_Language = mkLanguage "Bulgarian" ;
-- lin catalan_Language = mkLanguage "Catalan" ;
-- lin chinese_Language = mkLanguage "Chinese" ;
-- lin danish_Language = mkLanguage "Danish" ;
-- lin dutch_Language = mkLanguage "Dutch" ;
-- lin english_Language = mkLanguage "English" ;
-- lin estonian_Language = mkLanguage "Estonian" ;
-- lin finnish_Language = mkLanguage "Finnish" ;
-- lin french_Language = mkLanguage "French" ;
-- lin german_Language = mkLanguage "German" ;
-- lin greek_Language = mkLanguage "Greek" ;
-- lin hebrew_Language = mkLanguage "Hebrew" ;
-- lin hindi_Language = mkLanguage "Hindi" ;
-- lin japanese_Language = mkLanguage "Japanese" ;
-- lin italian_Language = mkLanguage "Italian" ;
-- lin latin_Language = mkLanguage "Latin" ;
-- lin latvian_Language = mkLanguage "Latvian" ;
-- lin maltese_Language = mkLanguage "Maltese" ;
-- lin nepali_Language = mkLanguage "Nepali" ;
-- lin norwegian_Language = mkLanguage "Norwegian" ;
-- lin persian_Language = mkLanguage "Persian" ;
-- lin polish_Language = mkLanguage "Polish" ;
-- lin punjabi_Language = mkLanguage "Punjabi" ;
-- lin romanian_Language = mkLanguage "Romanian" ;
-- lin russian_Language = mkLanguage "Russian" ;
-- lin sindhi_Language = mkLanguage "Sindhi" ;
-- lin spanish_Language = mkLanguage "Spanish" ;
-- lin swahili_Language = mkLanguage "Swahili" ;
-- lin swedish_Language = mkLanguage "Swedish" ;
-- lin thai_Language = mkLanguage "Thai" ;
-- lin turkish_Language = mkLanguage "Turkish" ;
-- lin urdu_Language = mkLanguage "Urdu" ;
}

190
src/zulu/DocumentationZul.gf Executable file
View File

@@ -0,0 +1,190 @@
--# -path=.:../abstract:../common
concrete DocumentationZul of Documentation = CatZul ** open
ResZul,
HTML in {
lincat
Inflection = {t : Str; s1,s2 : Str} ;
Definition = {s : Str} ;
Document = {s : Str} ;
Tag = {s : Str} ;
-- lin
-- InflectionN, InflectionN2, InflectionN3 = \noun -> {
-- t = "n" ;
-- s1 = heading1 ("Noun" ++ case noun.g of {
-- Neutr => "";
-- Masc => "(masc)";
-- Fem => "(fem)"
-- }) ;
-- s2 = frameTable (
-- tr (th "" ++ th "nom" ++ th "gen") ++
-- tr (th "sg" ++ td (noun.s ! Sg ! Nom) ++ td (noun.s ! Sg ! Gen)) ++
-- tr (th "pl" ++ td (noun.s ! Pl ! Nom) ++ td (noun.s ! Pl ! Gen))
-- )
-- } ;
--
-- InflectionA, InflectionA2 = \adj -> {
-- t = "a" ;
-- s1 = heading1 "Adjective" ;
-- s2 = frameTable (
-- tr (th "" ++ th "nom" ++ th "gen") ++
-- tr (th "posit" ++ td (adj.s ! AAdj Posit Nom) ++ td (adj.s ! AAdj Posit Gen)) ++
-- tr (th "compar" ++ td (adj.s ! AAdj Compar Nom) ++ td (adj.s ! AAdj Compar Gen)) ++
-- tr (th "superl" ++ td (adj.s ! AAdj Superl Nom) ++ td (adj.s ! AAdj Superl Gen))
-- ) ++
-- heading1 "Adverb" ++
-- paragraph (adj.s ! AAdv)
-- } ;
--
-- InflectionAdv = \adv -> {
-- t = "adv" ;
-- s1= heading1 "Adverb" ;
-- s2= paragraph (adv.s) ;
-- s3= ""
-- } ;
--
-- InflectionPrep = \prep -> {
-- t = "prep" ;
-- s1= heading1 "Preposition" ;
-- s2= paragraph (prep.s) ;
-- s3= ""
-- } ;
--
-- InflectionV v = {
-- t = "v" ;
-- s1= heading1 "Verb" ++
-- paragraph (pp "subject" ++ v.s ! VInf ++ v.p) ;
-- s2= inflVerb v
-- } ;
--
-- InflectionV2 v = {
-- t = "v" ;
-- s1= heading1 "Verb" ++
-- paragraph (pp "subject" ++
-- v.s ! VInf ++ v.p ++ v.c2 ++
-- pp "object") ;
-- s2= inflVerb v
-- } ;
--
-- InflectionV3 v = {
-- t = "v" ;
-- s1= heading1 "Verb" ++
-- paragraph (pp "subject" ++
-- v.s ! VInf ++ v.p ++
-- v.c2 ++ pp "arg1" ++
-- v.c3 ++ pp "arg2") ;
-- s2= inflVerb v
-- } ;
--
-- InflectionV2V v = {
-- t = "v" ;
-- s1= heading1 "Verb" ++
-- paragraph (pp "subject" ++
-- v.s ! VInf ++ v.p ++
-- v.c2 ++ pp "object" ++
-- v.c3 ++ case v.typ of {
-- VVAux => pp "verb" ;
-- VVInf => "to" ++ pp "verb" ;
-- VVPresPart => pp "verb+ing"
-- }) ;
-- s2= inflVerb v
-- } ;
--
-- InflectionV2S v = {
-- t = "v" ;
-- s1= heading1 "Verb" ++
-- paragraph (pp "subject" ++
-- v.s ! VInf ++ v.p ++
-- v.c2 ++ pp "object" ++
-- "that" ++ pp "sentence") ;
-- s2= inflVerb v
-- } ;
--
-- InflectionV2Q v = {
-- t = "v" ;
-- s1= heading1 "Verb" ++
-- paragraph (pp "subject" ++
-- v.s ! VInf ++ v.p ++
-- pp "question") ;
-- s2= inflVerb v
-- } ;
--
-- InflectionV2A v = {
-- t = "v" ;
-- s1= heading1 "Verb" ++
-- paragraph (pp "subject" ++
-- v.s ! VInf ++ v.p ++
-- v.c2 ++ pp "object" ++
-- pp "adjective") ;
-- s2= inflVerb v
-- } ;
--
-- InflectionVV v = {
-- t = "v" ;
-- s1= heading1 "Verb" ++
-- paragraph (pp "subject" ++
-- v.s ! VVF VInf ++ v.p ++
-- case v.typ of {
-- VVAux => pp "verb" ;
-- VVInf => "to" ++ pp "verb" ;
-- VVPresPart => pp "verb+ing"
-- }) ;
-- s2= frameTable (
-- tr (th "infitive" ++ td (v.s ! VVF VInf)) ++
-- tr (th "present" ++ td (v.s ! VVF VPres ++ "&#160;" ++ v.s ! VVPresNeg)) ++
-- tr (th "past" ++ td (v.s ! VVF VPast ++ "&#160;" ++ v.s ! VVPastNeg)) ++ --# notpresent
-- tr (th "past part." ++ td (v.s ! VVF VPPart)) ++
-- tr (th "present part." ++ td (v.s ! VVF VPresPart))
-- )
-- } ;
--
-- InflectionVS v = {
-- t = "v" ;
-- s1= heading1 "Verb" ++
-- paragraph (pp "subject" ++
-- v.s ! VInf ++ v.p ++
-- "that" ++ pp "sentence") ;
-- s2= inflVerb v
-- } ;
--
-- InflectionVQ v = {
-- t = "v" ;
-- s1= heading1 "Verb" ++
-- paragraph (pp "subject" ++
-- v.s ! VInf ++ v.p ++
-- pp "question") ;
-- s2= inflVerb v
-- } ;
--
-- InflectionVA v = {
-- t = "v" ;
-- s1= heading1 "Verb" ++
-- paragraph (pp "subject" ++
-- v.s ! VInf ++ v.p ++
-- pp "adjective") ;
-- s2= inflVerb v
-- } ;
--
-- oper
-- inflVerb : Verb -> Str = \verb ->
-- frameTable (
-- tr (th "infitive" ++ td (verb.s ! VInf)) ++
-- tr (th "present" ++ td (verb.s ! VPres)) ++
-- tr (th "past" ++ td (verb.s ! VPast)) ++ --# notpresent
-- tr (th "past part." ++ td (verb.s ! VPPart)) ++
-- tr (th "present part." ++ td (verb.s ! VPresPart))
-- ) ;
--
-- pp : Str -> Str = \s -> "&lt;"+s+"&gt;";
--
-- lin
-- NoDefinition t = {s=t.s};
-- MkDefinition t d = {s="<p><b>Definition:</b>"++t.s++d.s++"</p>"};
-- MkDefinitionEx t d e = {s="<p><b>Definition:</b>"++t.s++d.s++"</p><p><b>Example:</b>"++e.s++"</p>"};
--
-- lin
-- MkDocument d i e = {s = i.s1 ++ d.s ++ i.s2 ++ paragraph e.s} ;
-- MkTag i = {s = i.t} ;
}

367
src/zulu/ExtendZul.gf Executable file
View File

@@ -0,0 +1,367 @@
--# -path=.:../common:../abstract
concrete ExtendZul of Extend =
CatZul ** ExtendFunctor -
[
VPS, ListVPS, VPI, ListVPI, VPS2, ListVPS2, VPI2, ListVPI2, RNP, RNPList,
AdAdV, AdjAsCN, AdjAsNP, ApposNP, AdvIsNP,
BaseVPS, ConsVPS, BaseVPI, ConsVPI, BaseVPS2, ConsVPS2, BaseVPI2, ConsVPI2,
MkVPS, ConjVPS, PredVPS, MkVPI, ConjVPI, ComplVPIVV,
MkVPS2, ConjVPS2, ComplVPS2, MkVPI2, ConjVPI2, ComplVPI2,
Base_nr_RNP, Base_rn_RNP, Base_rr_RNP, ByVP, CompBareCN,
CompIQuant, CompQS, CompS, CompVP, ComplBareVS, ComplGenVV, ComplSlashPartLast, ComplVPSVV, CompoundAP,
CompoundN, ConjRNP, ConjVPS, ConsVPS, Cons_nr_RNP, Cons_rr_RNP, DetNPMasc, DetNPFem, EmbedPresPart, EmptyRelSlash,
ExistsNP, ExistCN, ExistMassCN, ExistPluralCN,
FocusAP, FocusAdV, FocusAdv, FocusObj, GenIP, GenModIP, GenModNP, GenNP, GenRP,
GerundAdv, GerundCN, GerundNP, IAdvAdv, ICompAP, InOrderToVP, MkVPS, NominalizeVPSlashNP,
PassAgentVPSlash, PassVPSlash, ProgrVPSlash, PastPartAP, PastPartAgentAP, PositAdVAdj, PredVPS, PredVPSVV, PredetRNP, PrepCN,
EmbedSSlash, PredIAdvVP, PresPartAP, PurposeVP, ReflPoss, ReflPron, ReflRNP, SlashBareV2S, SlashV2V, StrandQuestSlash, StrandRelSlash,
UncontractedNeg, UttAccIP, UttAccNP, UttAdV, UttDatIP, UttDatNP, UttVPShort, WithoutVP, BaseVPS2, ConsVPS2, ConjVPS2, ComplVPS2, MkVPS2
]
with
(Grammar = GrammarZul) **
open
GrammarZul,
ResZul,
Coordination,
Prelude,
-- MorphoZul,
ParadigmsZul in {
lin
ProDrop pron = {
s = pron.s ;
agr = pron.agr ;
empty = pron.empty ;
proDrop = True
} ;
-- GenNP np = {s = \\_,_ => np.s ! npGen ; sp = \\_,_,_,_ => np.s ! npGen ; isDef = True} ;
-- GenIP ip = {s = \\_ => ip.s ! NCase Gen} ;
-- GenRP nu cn = {
-- s = \\c => "whose" ++ nu.s ! False ! Nom ++
-- case c of {
-- RC _ (NCase Gen) => cn.s ! nu.n ! Gen ;
-- _ => cn.s ! nu.n ! Nom
-- } ;
-- a = RAg (agrP3 nu.n)
-- } ;
--
-- GenModNP num np cn = DetCN (DetQuant (GenNP (lin NP np)) num) cn ;
-- GenModIP num ip cn = IdetCN (IdetQuant (GenIP (lin IP ip)) num) cn ;
--
-- StrandQuestSlash ip slash =
-- {s = \\t,a,b,q =>
-- (mkQuestion (ss (ip.s ! NPAcc)) slash).s ! t ! a ! b ! q ++ slash.c2
-- };
-- StrandRelSlash rp slash = {
-- s = \\t,a,p,ag =>
-- rp.s ! RC (fromAgr ag).g NPAcc ++ slash.s ! t ! a ! p ! oDir ++ slash.c2 ;
-- c = NPAcc
-- } ;
-- EmptyRelSlash slash = {
-- s = \\t,a,p,_ => slash.s ! t ! a ! p ! oDir ++ slash.c2 ;
-- c = NPAcc
-- } ;
--
-- DetNPMasc det = {
-- s = det.sp ! Masc ! False ;
-- a = agrgP3 det.n Masc
-- } ;
--
-- DetNPFem det = {
-- s = det.sp ! Fem ! False ;
-- a = agrgP3 det.n Fem
-- } ;
--
-- lincat
-- VPS = {s : Agr => Str} ;
-- [VPS] = {s1,s2 : Agr => Str} ;
-- VPI = {s : VVType => Agr => Str} ;
-- [VPI] = {s1,s2 : VVType => Agr => Str} ;
--
-- lin
-- BaseVPS = twoTable Agr ;
-- ConsVPS = consrTable Agr comma ;
--
-- BaseVPI = twoTable2 VVType Agr ;
-- ConsVPI = consrTable2 VVType Agr comma ;
--
-- MkVPS t p vp = mkVPS (lin Temp t) (lin Pol p) (lin VP vp) ;
-- ConjVPS c xs = conjunctDistrTable Agr c xs ;
-- PredVPS np vps = {s = np.s ! npNom ++ vps.s ! np.a} ;
--
--
-- MkVPI vp = mkVPI (lin VP vp) ;
-- ConjVPI c xs = conjunctDistrTable2 VVType Agr c xs ;
-- ComplVPIVV vv vpi = insertObj (\\a => vpi.s ! vv.typ ! a) (predVV vv) ;
--
--
-- -------- two-place verb conjunction
--
-- lincat
-- VPS2 = {s : Agr => Str ; c2 : Str} ;
-- [VPS2] = {s1,s2 : Agr => Str ; c2 : Str} ;
-- VPI2 = {s : VVType => Agr => Str ; c2 : Str} ;
-- [VPI2] = {s1,s2 : VVType => Agr => Str ; c2 : Str} ;
--
-- lin
-- MkVPS2 t p vpsl = mkVPS (lin Temp t) (lin Pol p) (lin VP vpsl) ** {c2 = vpsl.c2} ;
-- MkVPI2 vpsl = mkVPI (lin VP vpsl) ** {c2 = vpsl.c2} ;
--
-- BaseVPS2 x y = twoTable Agr x y ** {c2 = y.c2} ; ---- just remembering the prep of the latter verb
-- ConsVPS2 x xs = consrTable Agr comma x xs ** {c2 = xs.c2} ;
--
-- BaseVPI2 x y = twoTable2 VVType Agr x y ** {c2 = y.c2} ; ---- just remembering the prep of the latter verb
-- ConsVPI2 x xs = consrTable2 VVType Agr comma x xs ** {c2 = xs.c2} ;
--
--
-- ConjVPS2 c xs = conjunctDistrTable Agr c xs ** {c2 = xs.c2} ;
-- ConjVPI2 c xs = conjunctDistrTable2 VVType Agr c xs ** {c2 = xs.c2} ;
--
--
-- ComplVPS2 vps2 np = {
-- s = \\a => vps2.s ! a ++ vps2.c2 ++ np.s ! NPAcc
-- } ;
-- ComplVPI2 vpi2 np = {
-- s = \\t,a => vpi2.s ! t ! a ++ vpi2.c2 ++ np.s ! NPAcc
-- } ;
--
-- oper
-- mkVPS : Temp -> Pol -> VP -> VPS = \t,p,vp -> lin VPS {
-- s = \\a =>
-- let
-- verb = vp.s ! t.t ! t.a ! p.p ! oDir ! a ;
-- verbf = verb.aux ++ verb.adv ++ verb.fin ++ verb.inf ;
-- in t.s ++ p.s ++ vp.ad ! a ++ verbf ++ vp.p ++ vp.s2 ! a ++ vp.ext
-- } ;
--
-- mkVPI : VP -> VPI = \vp -> lin VPI {
-- s = table {
-- VVAux => \\a => vp.ad ! a ++ vp.inf ++ vp.p ++ vp.s2 ! a ;
-- VVInf => \\a => "to" ++ vp.ad ! a ++ vp.inf ++ vp.p ++ vp.s2 ! a ;
-- VVPresPart => \\a => vp.ad ! a ++ vp.prp ++ vp.p ++ vp.s2 ! a
-- }
-- } ;
--
-- -----
--
-- lin
-- ICompAP ap = {s = "how" ++ ap.s ! agrP3 Sg} ; ---- IComp should have agr!
--
-- IAdvAdv adv = {s = "how" ++ adv.s} ;
--
-- PresPartAP vp = {
-- s = \\a => vp.ad ! a ++ vp.prp ++ vp.p ++ vp.s2 ! a ++ vp.ext ;
-- isPre = vp.isSimple -- depends on whether there are complements
-- } ;
--
-- EmbedPresPart vp = {s = infVP VVPresPart vp False Simul CPos (agrP3 Sg)} ;
--
-- PastPartAP vp = {
-- s = \\a => vp.ad ! a ++ vp.ptp ++ vp.p ++ vp.c2 ++ vp.s2 ! a ++ vp.ext ;
-- isPre = vp.isSimple -- depends on whether there are complements
-- } ;
-- PastPartAgentAP vp np = {
-- s = \\a => vp.ad ! a ++ vp.ptp ++ vp.p ++ vp.c2 ++ vp.s2 ! a ++ "by" ++ np.s ! NPAcc ++ vp.ext ;
-- isPre = False
-- } ;
--
-- GerundCN vp = {
-- s = \\n,c => vp.ad ! AgP3Sg Neutr ++ vp.prp ++
-- case <n,c> of {
-- <Sg,Nom> => "" ;
-- <Sg,Gen> => Predef.BIND ++ "'s" ;
-- <Pl,Nom> => Predef.BIND ++ "s" ;
-- <Pl,Gen> => Predef.BIND ++ "s'"
-- } ++
-- vp.p ++ vp.s2 ! AgP3Sg Neutr ++ vp.ext ;
-- g = Neutr
-- } ;
--
-- GerundNP vp =
-- let a = AgP3Sg Neutr ---- agr
-- in
-- {s = \\_ => vp.ad ! a ++ vp.prp ++ vp.p ++ vp.s2 ! a ++ vp.ext ; a = a} ;
--
-- GerundAdv vp =
-- let a = AgP3Sg Neutr
-- in
-- {s = vp.ad ! a ++ vp.prp ++ vp.p ++ vp.s2 ! a ++ vp.ext} ;
--
-- WithoutVP vp = {s = "without" ++ (GerundAdv (lin VP vp)).s} ;
--
-- InOrderToVP vp = {s = ("in order" | []) ++ infVP VVInf vp False Simul CPos (AgP3Sg Neutr)} ;
--
-- PurposeVP vp = {s = infVP VVInf vp False Simul CPos (agrP3 Sg)} ; --- agr
--
-- ByVP vp = {s = "by" ++ (GerundAdv (lin VP vp)).s} ;
--
-- PredIAdvVP iadv vp = {s = \\t,a,p,q => iadv.s ++ infVP VVInf vp False Simul CPos (agrP3 Sg)} ;
--
-- EmbedSSlash s = {s = "what" ++ s.s ++ s.c2} ;
--
-- NominalizeVPSlashNP vpslash np =
-- let vp : ResZul.VP = insertObjPre (\\_ => vpslash.c2 ++ np.s ! NPAcc) vpslash ;
-- a = AgP3Sg Neutr
-- in
-- lin NP {s = \\_ => vp.ad ! a ++ vp.prp ++ vp.s2 ! a ; a = a} ;
--
--
-- oper passVPSlash : VPSlash -> Str -> ResZul.VP =
-- \vps,ag ->
-- let
-- be = predAux auxBe ;
-- ppt = vps.ptp
-- in {
-- s = be.s ;
-- p = [] ;
-- prp = be.prp ;
-- ptp = be.ptp ;
-- inf = be.inf ;
-- ad = \\_ => [] ;
-- s2 = \\a => vps.ad ! a ++ ppt ++ vps.p ++ vps.s2 ! a ++ ag ++ vps.c2 ; ---- place of agent
-- isSimple = False ;
-- ext = vps.ext
-- } ;
--
-- lin
-- PassVPSlash vps = passVPSlash (lin VPS vps) [] ;
-- PassAgentVPSlash vps np = passVPSlash (lin VPS vps) ("by" ++ np.s ! NPAcc) ;
-- ProgrVPSlash vp = insertObjc (\\a => vp.ad ! a ++ vp.prp ++ vp.p ++ vp.s2 ! a)
-- (predAux auxBe ** {c2 = vp.c2; gapInMiddle = vp.gapInMiddle; missingAdv = vp.missingAdv});
--
-- --- AR 7/3/2013
-- ComplSlashPartLast vps np = case vps.gapInMiddle of {
-- _ => insertObjPartLast (\\_ => vps.c2 ++ np.s ! NPAcc) vps ---
-- } ;
--
-- --- AR 22/5/2013
-- ExistsNP np =
-- mkClause "there" (agrP3 (fromAgr np.a).n)
-- (insertObj (\\_ => np.s ! NPAcc) (predV (regV "exist"))) ;
--
-- ExistCN cn =
-- let
-- pos = ExistNP (DetCN (DetQuant IndefArt NumSg) cn) ;
-- neg = ExistNP (DetCN (DetQuant no_Quant NumSg) cn) ;
-- in posNegClause pos neg ;
-- ExistMassCN cn =
-- let
-- pos = ExistNP (MassNP cn) ;
-- neg = ExistNP (DetCN (DetQuant no_Quant NumSg) cn) ;
-- in posNegClause pos neg ;
-- ExistPluralCN cn =
-- let
-- pos = ExistNP (DetCN (DetQuant IndefArt NumPl) cn) ;
-- neg = ExistNP (DetCN (DetQuant no_Quant NumPl) cn) ;
-- in posNegClause pos neg ;
--
--
-- ComplBareVS v s = insertExtra s.s (predV v) ;
-- SlashBareV2S v s = insertExtrac s.s (predVc v) ;
--
-- CompoundN noun cn = {
-- s = variants {\\n,c => noun.s ! Sg ! Nom ++ cn.s ! n ! c ;
-- \\n,c => noun.s ! Sg ! Nom ++ BIND++"-"++BIND ++ cn.s ! n ! c} ;
-- g = cn.g
-- } ;
--
-- CompoundAP noun adj = {
-- s = variants {\\_ => noun.s ! Sg ! Nom ++ adj.s ! AAdj Posit Nom ;
-- \\_ => noun.s ! Sg ! Nom ++ BIND++"-"++BIND ++ adj.s ! AAdj Posit Nom} ;
-- isPre = True
-- } ;
--
-- FrontExtPredVP np vp = {
-- s = \\t,a,b,o =>
-- let
-- subj = np.s ! npNom ;
-- agr = np.a ;
-- verb = vp.s ! t ! a ! b ! o ! agr ;
-- compl = vp.s2 ! agr
-- in
-- case o of {
-- ODir _ => vp.ext ++ frontComma ++ subj ++ verb.aux ++ verb.adv ++ vp.ad ! agr ++ verb.fin ++ verb.inf ++ vp.p ++ compl ;
-- OQuest => verb.aux ++ subj ++ verb.adv ++ vp.ad ! agr ++ verb.fin ++ verb.inf ++ vp.p ++ compl ++ vp.ext
-- }
-- } ;
--
-- InvFrontExtPredVP np vp = {
-- s = \\t,a,b,o =>
-- let
-- subj = np.s ! npNom ;
-- agr = np.a ;
-- verb = vp.s ! t ! a ! b ! o ! agr ;
-- compl = vp.s2 ! agr
-- in
-- case o of {
-- ODir _ => vp.ext ++ verb.aux ++ verb.adv ++ vp.ad ! agr ++ verb.fin ++ subj ++ verb.inf ++ vp.p ++ compl ;
-- OQuest => verb.aux ++ subj ++ verb.adv ++ vp.ad ! agr ++ verb.fin ++ verb.inf ++ vp.p ++ compl ++ vp.ext
-- }
-- } ;
--
--
--
-- lin
-- AdAdV = cc2 ;
--
-- AdjAsCN ap = let cn = mkNoun "one" "one's" "ones" "ones'" ** {g = Neutr}
-- in {
-- s = \\n,c => preOrPost ap.isPre (ap.s ! agrgP3 n cn.g) (cn.s ! n ! c) ;
-- g = cn.g
-- } ;
-- AdjAsNP ap = {
-- s = \\c => ap.s ! agrgP3 Sg nonhuman ; ---- genitive case?
-- a = agrgP3 Sg nonhuman
-- } ;
--
-- PositAdVAdj a = {s = a.s ! AAdv} ;
--
-- lincat
-- RNP = {s : Agr => Str} ;
-- RNPList = {s1,s2 : Agr => Str} ;
--
-- lin
-- ReflRNP vps rnp = insertObjPre (\\a => vps.c2 ++ rnp.s ! a) vps ;
-- ReflPron = {s = reflPron} ;
-- ReflPoss num cn = {s = \\a => possPron ! a ++ num.s ! True ! Nom ++ cn.s ! num.n ! Nom} ;
-- PredetRNP predet rnp = {s = \\a => predet.s ++ rnp.s ! a} ;
--
-- ConjRNP conj rpns = conjunctDistrTable Agr conj rpns ;
--
-- Base_rr_RNP x y = twoTable Agr x y ;
-- Base_nr_RNP x y = twoTable Agr {s = \\a => x.s ! NPAcc} y ;
-- Base_rn_RNP x y = twoTable Agr x {s = \\a => y.s ! NPAcc} ;
-- Cons_rr_RNP x xs = consrTable Agr comma x xs ;
-- Cons_nr_RNP x xs = consrTable Agr comma {s = \\a => x.s ! NPAcc} xs ;
--
-- lin
-- ApposNP np1 np2 = {s = \\c => np1.s ! c ++ comma ++ np2.s ! c; a = np1.a} ;
--
-- AdvIsNP adv np = PredVP {s = \\_ => adv.s ; a = np.a} (UseComp (CompNP np)) ;
--
-- ---- TODO: RNPList construction
--
-- lin
-- ComplGenVV v a p vp = insertObj (\\agr => a.s ++ p.s ++
-- infVP v.typ vp False a.a p.p agr)
-- (predVV v) ;
--
-- CompS s = {s = \\_ => "that" ++ s.s} ;
-- CompQS qs = {s = \\_ => qs.s ! QIndir} ;
-- CompVP ant p vp = {s = \\a => ant.s ++ p.s ++
-- infVP VVInf vp False ant.a p.p a} ;
--
-- -- quite specific for English anyway
--
-- UncontractedNeg = {s = [] ; p = CNeg False} ;
-- UttVPShort vp = {s = infVP VVAux vp False Simul CPos (agrP3 Sg)} ;
}

679
src/zulu/ExtraExtZul.gf Executable file
View File

@@ -0,0 +1,679 @@
concrete ExtraExtZul of ExtraExt =
CatZul [NP,VP,CN,V,Temp,S,Cl,Adv,Pron,QCl,QS,A,RS,IAdv,IComp,Pol,Det,Quant,N,PN,Conj],
CatExtZul
** open ResZul,Prelude,ParamX in {
lin
-- use with caution
ProDrop pron = {
s = table {
NFull => case pron.proDrop of {
True => "*" ++ pron.s!NFull ;
False => pron.empty
} ;
nform => "*" ++ pron.s!nform
} ;
agr = pron.agr ;
empty = pron.empty ;
proDrop = True
} ;
lin
-- PotQS pol qcl = {
-- s = pol.s ++ qcl.potqcl!pol.p!Princ ;
-- qword_pre = qcl.qword_pre ;
-- qword_post = qcl.qword_post
-- } ;
-- SubjunctS s = { s = s.subjs } ;
-- AssocCop np = {
-- s = \\_ => [] ;
-- oc = [] ;
-- comp = np.s!Reduced ;
-- iadv = [] ;
-- advs = [] ;
-- hasComp = True ;
-- r = case np.proDrop of {
-- True => RC ;
-- False => initNP np.isPron np.agr
-- } ;
-- syl = SylMult ;
-- asp = Null ;
-- asp_pref = \\_ => [] ;
-- vptype = CopAssoc ;
-- comp_agr = np.agr ;
-- ap_comp = \\_ => [] ;
-- aux_root = [] ;
-- hasAux = False
-- } ;
--
-- EqCop np = {
-- s = \\_ => [] ;
-- oc = [] ;
-- comp = np.s!Full ;
-- iadv = [] ;
-- advs = [] ;
-- hasComp = True ;
-- r = case np.isPron of {
-- True => RC ;
-- False => initNP np.isPron np.agr
-- } ;
-- syl = SylMult ;
-- asp = Null ;
-- asp_pref = \\_ => [] ;
-- vptype = CopEq ;
-- comp_agr = np.agr ;
-- ap_comp = \\_ => [] ;
-- aux_root = [] ;
-- hasAux = False
-- } ;
-- UsePNPl pn = let
-- agr = Third pn.c Pl
-- in {
-- empty,predet_pre,predet_post = pn.empty ;
-- s = pn.s!Pl ;
-- mod = pn.empty ;
-- dem = pn.empty ;
-- agr = agr ;
-- i = nominit!agr ;
-- proDrop = False ;
-- isPron = False ;
-- -- reqLocS = True ;
-- qdef = Article Spec ;
-- } ;
-- PNAsCN pn = pn ** { mod = \\_ => [] } ;
-- DemPron quant pron = let
-- d = case quant.qdef of {
-- Article _ => Dem1 ;
-- Demonstrative d => d
-- }
-- in {
-- empty,predet_pre,dem,predet_post = pron.empty ;
-- -- dem = case quant.qdef of {
-- -- Article _ => dem_pron!Dem1!pron.agr ;
-- -- Demonstrative d => dem_pron!d!pron.agr
-- -- } ;
-- -- s = \\nform => quant.s ++ pron.s!nform ;
-- s = table {
-- Full => quant.s ++ dem_pron!d!pron.agr ++ pron.empty ;
-- Reduced => quant.s ++ dem_pron!d!pron.agr ++ pron.empty ;
-- Poss => quant.s ++ dem_pron!d!pron.agr ++ pron.empty ;
-- Loc => quant.s ++ dem_pron!d!pron.agr ++ pron.empty
-- } ;
-- mod = pron.empty ;
-- agr = pron.agr ;
-- i = RC ;
-- proDrop = False ;
-- isPron = True ;
-- -- reqLocS = True ;
-- qdef = case quant.qdef of {
-- Article _ => Demonstrative Dem1 ;
-- Demonstrative d => Demonstrative d
-- }
-- } ;
-- EmphCN cn = {
-- s = \\num,nform => pron_stem!(Third cn.c num) ++BIND++ "na" ++ cn.s!num!nform ;
-- mod = cn.mod ;
-- c = cn.c ;
-- empty = cn.empty
-- } ;
--
-- ContrastCN cn = {
-- s = cn.s ;
-- mod = \\num => pron_stem!(Third cn.c num) ++BIND++ "na" ++ cn.mod!num ;
-- c = cn.c ;
-- empty = cn.empty
-- } ;
-- ApposCNCN cn1 cn2 = {
-- s = cn1.s ;
-- mod = \\n => cn1.mod!n ++ cn2.s!n!Full ++ cn2.mod!n ;
-- c = cn1.c ;
-- empty = cn1.empty ++ cn2.empty
-- } ;
-- ApposNPN np n = let
-- num = case np.agr of {
-- First n => n ;
-- Second n => n ;
-- Third c n => n
-- } ;
-- in {
-- empty = np.empty ;
-- s = np.s;
-- mod = np.mod ++ np.predet_post ++ n.s!num!Full ;
-- dem = np.dem ;
-- predet_pre = np.predet_pre ;
-- predet_post = np.empty ;
-- agr = Third n.c num ;
-- i = np.i ;
-- proDrop = np.proDrop ;
-- isPron = np.isPron ;
-- -- reqLocS = np.reqLocS ;
-- qdef = np.qdef ;
-- } ;
PossLocNP locn np = {
empty = np.empty ;
s = \\n,nform => locn.s ;
mod = \\num => poss_concord!(C17)!Sg!np.i ++BIND++ (poss_NP np) ;
c = C17 ;
emph = False
} ;
InstrNPAdv np =
let
pref = instrPref!(initNP np.isPron np.agr)
in {
s = pref ++BIND++ (np.s!NReduced) ;
-- asp = Null ;
reqLocS = False
} ;
InstrAdvNPAdv adv np =
let
pref = instrPref!(initNP np.isPron np.agr)
in {
s = adv.s ++ pref ++BIND++ (np.s!NReduced) ;
-- asp = adv.asp ;
reqLocS = False
} ;
LocNPAdv np = {
s = np.s!NLoc ;
-- asp = Null ;
reqLocS = case np.isPron of {
False => True ;
True => False -- ki-
} ;
} ;
LocAdvNPAdv adv np = {
s = adv.s ++ (np.s!NLoc) ;
-- asp = adv.asp ;
reqLocS = False
} ;
-- locative kwa
KwaNPAdv np = {
-- s = "kwa" ++BIND++ (np.s!Reduced) ;
s = (poss_concord_agr!(Third C17 Sg)!np.i) ++BIND++ (np.s!NReduced) ;
-- asp = Null ;
reqLocS = False
} ;
-- -- NOTE: this seems to be a specific construction. Not yet found in Poulos+Msimang
-- KwaAdvNPAdv adv np =
-- let
-- c = case np.agr of {
-- (First _ | Second _) => C1_2 ; -- people class as default
-- Third c _ => c
-- } ;
-- n = case np.agr of {
-- (First Sg | Second Sg | Third _ Sg) => Sg ;
-- (First Pl | Second Pl | Third _ Pl) => Pl
-- }
-- in
-- {
-- s = adv.s ++ poss_concord!C15!Sg!(initNP np.isPron np.agr) ++BIND++ np.s!Reduced ++ np.mod ++ np.predet_pre ++ np.predet_post ;
-- -- asp = adv.asp ;
-- reqLocS = False
-- } ;
-- locative ku
KuNPAdv np = {
s = case np.isPron of {
True => "ki" ;
False => case (initNP np.isPron np.agr) of {
-- RI => "ki" ;
RO => "ko" ;
RA => "kw" ;
_ => "ku"
}
}
++BIND++ (np.s!NReduced) ;
-- asp = Null ;
reqLocS = False
} ;
KuAdvNPAdv adv np = {
s = adv.s ++
case np.proDrop of {
True => "ki" ;
False => case (initNP np.isPron np.agr) of {
RI => "ki" ;
RO => "ko" ;
RA => "kw" ;
_ => "ku"
}
}
++BIND++ (np.s!NReduced) ;
-- asp = Null ;
reqLocS = False
} ;
NaNPAdv np = {
s = withPref ! (initNP np.isPron np.agr) ++BIND++ (np.s!NReduced) ;
-- asp = Null ;
reqLocS = False
} ;
RelAdv adv = {
s = \\a => relConcLookup!a!RC ++BIND++ adv.s
} ;
-- ProgVP vp = {
-- s = vp.s ;
-- perfSuff = vp.perfSuff ;
-- oc = vp.oc ;
-- comp = vp.comp ;
-- hasComp = vp.hasComp ;
-- r = vp.r ;
-- syl = vp.syl ;
-- asp = Prog ;
-- vptype = vp.vptype ;
-- comp_agr = vp.comp_agr ;
-- ap_comp = vp.ap_comp ;
-- ap_bool = vp.ap_bool ;
-- aux_root = vp.aux_root ;
-- hasAux = vp.hasAux
-- } ;
-- QuantRS quant = {
-- s = \\a => relConcLookup!a!RC ++BIND++ quantConc!a ++BIND++ quant.s
-- } ;
--
-- RelRS rel = {
-- s = \\a => relConcLookup!a!RC ++BIND++ rel.s
-- } ;
-- QuantCN quant cn = {
-- empty = cn.empty ;
-- s = \\num,nform =>
-- let
-- agr = Third cn.c num
-- in
-- case quant.isPost of {
-- True => cn.s ! num ! nform ++ quantConc!agr ++BIND++ quant.s ;
-- False => quantConc!agr ++BIND++ quant.s ++ cn.s ! num ! nform
-- } ;
-- c = cn.c
-- } ;
-- let
-- cn_agr = Third cn.c quant.n
-- in
-- {
-- empty = cn.empty ;
-- s = \\p => case quant.isPost of {
-- True => cn.s ! quant.n ! p ++ quantConc!cn_agr ++BIND++ quant.s ;
-- False => quantConc!cn_agr ++BIND++ quant.s ++ cn.s ! quant.n ! p
-- } ;
-- loc = quantConc!cn_agr ++BIND++ quant.s ++ cn.loc ! quant.n ;
-- desc = cn.desc ! quant.n ;
-- det = cn.empty ;
-- poss = poss_concord!cn.c!quant.n!(initNP False cn_agr) ++ cn.s ! quant.n ! Reduced ;
-- agr = cn_agr ;
-- proDrop = False ;
-- isPron = False ;
-- reqLocS = False ;
-- qdef = Article Def
-- } ;
NumAdjCN cn a = {
s = \\num,nform => cn.s!num!nform ++ "na" ++BIND++ a.s!AF2 ;
-- loc = cn.loc ;
-- desc = \\num =>
-- let
-- agr = Third cn.c num ;
-- in
-- cn.desc ! num ++ "na" ++BIND++ a.s!AF2 ;
c = cn.c ;
empty = cn.empty ++ a.empty
} ;
only_QuantStem = {
s = table {
Third C1_2 Sg => "yedwa" ;
Third C1_2 Pl => "bodwa" ;
Third C1a_2a Sg => "yedwa" ;
Third C1a_2a Pl => "bodwa" ;
Third C3_4 Sg => "wodwa" ;
Third C3_4 Pl => "yodwa" ;
Third C5_6 Sg => "lodwa" ;
Third C5_6 Pl => "odwa" ;
Third C7_8 Sg => "sodwa" ;
Third C7_8 Pl => "zodwa" ;
Third C9_10 Sg => "yodwa" ;
Third C9_10 Pl => "zodwa" ;
Third C11_10 Sg => "lodwa" ;
Third C11_10 Pl => "zodwa" ;
Third C9_6 Sg => "yodwa" ;
Third C9_6 Pl => "odwa" ;
Third C14 _ => "bodwa" ;
Third C15 _ => "kodwa" ;
Third C17 _ => "kodwa" ;
First Sg => "ngedwa" ;
First Pl => "sodwa" ;
Second Sg => "wedwa" ;
Second Pl => "nodwa"
}
} ;
all_QuantStem = {
s = table {
Third C1_2 Sg => "wonke" ;
Third C1_2 Pl => "bonke" ;
Third C1a_2a Sg => "wonke" ;
Third C1a_2a Pl => "bonke" ;
Third C3_4 Sg => "wonke" ;
Third C3_4 Pl => "yonke" ;
Third C5_6 Sg => "lonke" ;
Third C5_6 Pl => "onke" ;
Third C7_8 Sg => "sonke" ;
Third C7_8 Pl => "zonke" ;
Third C9_10 Sg => "yonke" ;
Third C9_10 Pl => "zonke" ;
Third C11_10 Sg => "lonke" ;
Third C11_10 Pl => "zonke" ;
Third C9_6 Sg => "yonke" ;
Third C9_6 Pl => "onke" ;
Third C14 _ => "bonke" ;
Third C15 _ => "konke" ;
Third C17 _ => "konke" ;
First Sg => "ngenke" ;
First Pl => "sonke" ;
Second Sg => "wenke" ;
Second Pl => "nonke"
}
} ;
-- all_pre_Predet = { s = "nke" ; isPost = False } ;
painful_RelStem = { s = "buhlungu" } ;
-- TPerfPast = { s = [] ; t = Relative PerfTense PastTense } ;
-- TPresPres = { s = [] ; t = PresTense } ;
-- TPastPres = { s = [] ; t = Relative PastTense PresTense } ;
-- TPastPerf = { s = [] ; t = Relative PastTense PerfTense } ;
PredNP np = cl_with_np_predicate np ;
-- IAdvQS np iadv = {
-- s = case np.proDrop of {
-- True => np.empty ;
-- False => np.s ! Full ++ np.desc
-- } ;
-- qword_pre = case iadv.postIAdv of {
-- False => let
-- vform = VFIndic Princ Pos PresTense Null
-- in
-- (subjConc vform np.agr False) ++ iadv.s ;
-- True => []
-- } ;
-- qword_post = case iadv.postIAdv of {
-- True => let
-- vform = VFIndic Princ Pos PresTense Null
-- in
-- (subjConc vform np.agr False) ++ iadv.s ;
-- False => []
-- } ;
-- } ;
AdvQCl adv qcl = {
s = \\p,t,m => qcl.s!p!t!m ++ adv.s ;
potqcl = \\p,m => qcl.potqcl!p!m ++ adv.s ;
qword_pre = qcl.qword_pre ;
qword_post = qcl.qword_post
} ;
ComplVAux vaux vp = {
s = vp.s ;
perfSuff = vp.perfSuff ;
suff = vp.suff ;
oc = vp.oc ;
comp = vp.comp ;
iadv = vp.iadv ;
advs = vp.advs ;
hasComp = vp.hasComp ;
r = vp.r ;
syl = vp.syl ;
asp = vp.asp ;
asp_pref = vp.asp_pref ;
vptype = vp.vptype ;
comp_agr = vp.comp_agr ;
ap_comp = vp.ap_comp ;
aux_root = vaux.s ;
hasAux = True
} ;
-- UseLocNP np = {
-- s = [] ;
-- perfSuff = [] ;
-- oc = [] ;
-- comp = "s" ++BIND++ np.loc ++ np.desc ;
-- hasComp = True ;
-- r = nominit!np.agr ;
-- syl = SylMult ;
-- asp = Null ;
-- vptype = CopIdent ;
-- comp_agr = np.agr ;
-- ap_comp = \\_ => [] ;
-- ap_bool = False ;
-- aux_root = [] ;
-- hasAux = False
-- } ;
ConjNAdv conj s = {
s = conj.s ++ s.s;
-- asp = Null ;
reqLocS = False
} ;
where_ConjN = { s = "lapho" } ;
-- IAdvVP vp iadv = {
-- s = vp.s ;
-- -- perfSuff = vp.perfSuff ;
-- -- suff = vp.suff ;
-- -- oc = vp.oc ;
-- iadv = vp.iadv ++ iadv.s ;
-- comp = vp.comp ;
-- advs = vp.advs ;
-- hasComp = True ;
-- r = vp.r ;
-- -- syl = vp.syl ;
-- -- asp = vp.asp ;
-- -- asp_pref = vp.asp_pref ;
-- vptype = vp.vptype -- ;
-- -- comp_agr = vp.comp_agr ;
-- -- ap_comp = vp.ap_comp ;
-- -- aux_root = vp.aux_root ;
-- -- hasAux = vp.hasAux
-- } ;
it3_Pron = mkPron (Third C3_4 Sg) ;
they4_Pron = mkPron (Third C3_4 Pl) ;
it5_Pron = mkPron (Third C5_6 Sg) ;
they6_Pron = mkPron (Third C5_6 Pl) ;
it7_Pron = mkPron (Third C7_8 Sg) ;
they8_Pron = mkPron (Third C7_8 Pl) ;
it9_Pron = mkPron (Third C9_10 Sg) ;
they10_Pron = mkPron (Third C9_10 Pl) ;
it11_Pron = mkPron (Third C11_10 Sg) ;
it14_Pron = mkPron (Third C14 Sg) ;
it15_Pron = mkPron (Third C15 Sg) ;
it17_Pron = mkPron (Third C17 Sg) ;
yonder_Quant = {
s = \\b,a => dem_pron!Dem3!a ;
dist = Dem3
} ;
at_which_IAdv np = {
s = "nga" ++BIND++ atwhichPhiPref!np.agr ++BIND++ "phi" ++ (np.s!NFull) ;
postIAdv = False
} ;
what_IAdv = {s = BIND++"ni" ; postIAdv = True } ;
how_many_IAdj = regAdj "ngaki" ;
-- IAdjIAdv np iadj = {
-- s = (np.s!Loc) ++ adjConcLookup!np.agr ++BIND++ iadj.s!(aformN np.agr) ;
-- postIAdv = False
-- } ;
how_IComp = { s = "njani" ; postIComp = False } ; -- -njani
where_IComp = { s = "phi" ; postIComp = True } ; -- -phi
how_much_IComp = { s = "ngakanani" ; postIComp = False } ; -- -ngakanani
how2_IAdv = {s = "anjani" ; postIAdv = False } ;
how8much2_IAdv = {s = "angakanani" ; postIAdv = False } ;
phakathi_LocN = { s = "phakathi" ; empty = [] } ;
phansi_LocN = { s = "phansi" ; empty = [] } ;
phesheya_LocN = { s = "phesheya" ; empty = [] } ;
phandle_LocN = { s = "phandle" ; empty = [] } ;
phambili_LocN = { s = "phambili" ; empty = [] } ;
phambi_LocN = { s = "phambi" ; empty = [] } ;
phakade_LocN = { s = "phakade" ; empty = [] } ;
phezulu_LocN = { s = "phezulu" ; empty = [] } ;
lapha_Loc = {
s = table {
MainCl => \\a,p,t => let
vform = VFIndic MainCl p t ;
pcp = ap_cop_pref vform a RelType ; -- u-
cop_base = "lapha"
in
case vform of {
VFIndic _ Neg PresTense => (kho_cop vform a) ++ cop_base;
VFIndic _ _ _ => pcp ++ cop_base
} ;
RelCl => \\a,p,t => let
vform = VFIndic RelCl p t ;
rcp = (relConcCop vform a RC) ; -- o- / onge-
pcp = ap_cop_pref vform a RelType ; -- [] / zoba
cop_base = "lapha" -- lapha
in
case vform of {
VFIndic _ Neg PresTense => (kho_cop vform a) ++ cop_base;
VFIndic _ _ _ => rcp ++ pcp ++ cop_base
}
}
} ;
khona_Loc = {
s = \\c,a,p,t => kho_cop (VFIndic c p t) a ;
} ;
kakhulu_Adv = { s = "kakhulu" ; reqLocS = False } ;
AdvQS adv qs = { s = adv.s ++ qs.s ; qword_pre = [] ; qword_post = [] } ;
ExtConjNP np1 conj np2 = {
s = \\nform => np1.s!nform ++ (link_conj conj np2.i) ++ np2.s!NReduced ;
agr = compAgr np1.agr np2.agr ;
i = np1.i ;
proDrop = andB np1.proDrop np2.proDrop ;
isPron = np1.isPron ;
heavy = orB np1.heavy np2.heavy ;
empty = np1.empty ++ np2.empty
} ;
with_Conj = {
s = withPref ;
fix = True
} ;
-- Deverb15 v =
-- let
-- agr = Third C15 Sg ;
-- in
-- {
-- s = \\_ => table {
-- Full => case v.r of {
-- RC => "uku"++BIND++(v.s!R_a) ;
-- (RA|RE) => "ukw"++BIND++(v.s!R_a) ;
-- _ => "uk"++BIND++(v.s!R_a)
-- } ;
-- Reduced => case v.r of {
-- RC => "ku"++BIND++(v.s!R_a) ;
-- (RA|RE) => "kw"++BIND++(v.s!R_a) ;
-- _ => "k"++BIND++(v.s!R_a)
-- } ;
-- Poss => case v.r of {
-- RC => "ku"++BIND++(v.s!R_a) ;
-- (RA|RE) => "kw"++BIND++(v.s!R_a) ;
-- _ => "k"++BIND++(v.s!R_a)
-- } ;
-- Loc => case v.r of {
-- RC => "eku"++BIND++(v.s!R_e)++BIND++"ni" ;
-- (RA|RE) => "ekw"++BIND++(v.s!R_e)++BIND++"ni" ;
-- _ => "ek"++BIND++(v.s!R_e)++BIND++"ni"
-- }
-- } ;
-- c = C15 ;
-- empty = []
-- } ;
oper
-- qcl_np_iadv : NP -> IAdv -> {s : Polarity => ZTense => DMood => Str ; potqcl : Polarity => DMood => Str ; qword_pre : Str ; qword_post : Str } = \np,iadv -> {
-- s = \\p,t,dm =>
-- let
-- subj = case np.proDrop of {
-- True => np.empty ;
-- False => np.s ! Full ++ np.desc
-- } ;
-- aux_tense = case t of {
-- Absolute bt => bt ;
-- Relative b1 b2 => b1
-- } ;
-- main_tense = case t of {
-- Absolute bt => bt ;
-- Relative b1 b2 => b2
-- } ;
-- vform_aux = VFIndic dm p aux_tense Null ;
-- vform_main = VFIndic dm p main_tense Null ;
-- aux = case t of {
-- Absolute bt => [] ;
-- Relative _ _ => relSubjConc aux_tense np.agr -- (subjConcLookup!np.agr!SC) ++BIND++ "b" ++BIND++ (vtermSuff vform_aux False)
-- } ;
-- in
-- subj ++
-- aux ++
-- (subjConc vform_main np.agr False) ++
-- iadv.s ;
-- potqcl = \\p,dm =>
-- let
-- subj = case np.proDrop of {
-- True => np.empty ;
-- False => np.s ! Full ++ np.desc
-- } ;
-- vform_main = VFPot dm p Null ;
-- in
-- subj ++
-- -- aux ++
-- (subjConc vform_main np.agr False) ++
-- (potPref vform_main) ++
-- iadv.s ;
-- qword_pre = [] ;
-- qword_post = []
-- } ;
cl_with_np_predicate : NP -> { s : Polarity => BasicTense => Str } = \np -> {
-- advs = [] ;
s = \\p,t =>
let
vform_main = VFIndic MainCl p t ;
--pcp = pre_cop_pref vform_main np.agr ;
cp = id_cop_pref np.agr ;
cb = np.s!NFull
in
cp ++BIND++
cb
} ;
}

22
src/zulu/GrammarZul.gf Executable file
View File

@@ -0,0 +1,22 @@
--# -path=.:../abstract:../common:prelude
concrete GrammarZul of Grammar =
NounZul,
VerbZul,
AdjectiveZul,
AdverbZul,
NumeralZul,
SentenceZul,
QuestionZul,
RelativeZul,
ConjunctionZul,
PhraseZul,
TextX - [Temp,Adv,IAdv],
StructuralZul,
IdiomZul,
TenseX [PPos,PNeg] -- - [Temp,Adv]
** open ResZul, Prelude in {
flags startcat = Phr ; unlexer = text ; lexer = text ;
} ;

62
src/zulu/IdiomZul.gf Executable file
View File

@@ -0,0 +1,62 @@
concrete IdiomZul of Idiom = CatZul ** open Prelude, ResZul,ParamX in {
flags optimize=all_subs ;
-- lin
-- ImpersCl vp = mkClause "it" (agrP3 Sg) vp ;
-- GenericCl vp = mkClause "one" (agrP3 Sg) vp ;
--
-- CleftNP np rs = mkClause "it" (agrP3 Sg)
-- (insertObj (\\_ => rs.s ! np.a)
-- (insertObj (\\_ => np.s ! rs.c) (predAux auxBe))) ;
--
-- CleftAdv ad s = mkClause "it" (agrP3 Sg)
-- (insertObj (\\_ => conjThat ++ s.s)
-- (insertObj (\\_ => ad.s) (predAux auxBe))) ;
--
-- ExistNP np =
-- mkClause "there" (agrP3 (fromAgr np.a).n)
-- (insertObj (\\_ => np.s ! NPAcc) (predAux auxBe)) ;
--
-- ExistIP ip =
-- mkQuestion (ss (ip.s ! npNom))
-- (mkClause "there" (agrP3 ip.n) (predAux auxBe)) ;
--
-- ExistNPAdv np adv =
-- mkClause "there" (agrP3 (fromAgr np.a).n)
-- (insertObj (\\_ => np.s ! NPAcc ++ adv.s) (predAux auxBe)) ;
--
-- ExistIPAdv ip adv =
-- mkQuestion (ss (ip.s ! npNom))
-- (mkClause "there" (agrP3 ip.n) (insertObj (\\_ => adv.s) (predAux auxBe))) ;
-- ProgrVP vp = {
-- s = vp.s ;
-- perfSuff = vp.perfSuff ;
-- oc = vp.oc ;
-- comp = vp.comp ;
-- hasComp = vp.hasComp ;
-- r = vp.r ;
-- syl = vp.syl ;
-- asp = Prog ;
-- asp_pref = \\vform => vp.asp_pref!vform ++ (progPref vform) ;
-- vptype = vp.vptype ;
-- comp_agr = vp.comp_agr ;
-- ap_comp = vp.ap_comp ;
-- ap_bool = vp.ap_bool ;
-- aux_root = vp.aux_root ;
-- hasAux = vp.hasAux
-- } ;
-- ImpPl1 vp = {s = "let's" ++ infVP VVAux vp False Simul CPos (AgP1 Pl)} ;
--
-- ImpP3 np vp = {s = "let" ++ np.s ! NPAcc ++ infVP VVAux vp False Simul CPos np.a} ;
--
-- SelfAdvVP vp = insertObj reflPron vp ;
-- SelfAdVVP vp = insertAdVAgr reflPron vp ;
-- SelfNP np = {
-- s = \\c => np.s ! c ++ reflPron ! np.a ;
-- a = np.a
-- } ;
}

13
src/zulu/LangZul.gf Executable file
View File

@@ -0,0 +1,13 @@
--# -path=.:../abstract:../common:../api:../prelude
concrete LangZul of Lang =
GrammarZul,
LexiconZul
-- ,ConstructionZul
-- ,DocumentationZul --# notpresent
-- ,MarkupZul - [stringMark]
** {
} ;

379
src/zulu/LexiconZul.gf Executable file
View File

@@ -0,0 +1,379 @@
--# -path=.:prelude
concrete LexiconZul of Lexicon = CatZul **
open ParadigmsZul, Prelude in {
flags
optimize=values ;
-- lin
-- airplane_N = regN "airplane" ;
-- alas_Interj = ss "alas" ;
-- answer_V2S = mkV2S (mkV "answer" "answered") toP ;
-- apartment_N = regN "apartment" ;
-- apple_N = regN "apple" ;
-- art_N = regN "art" ;
-- ask_V2Q = mkV2Q (regV "ask") noPrep ;
-- baby_N = regN "baby" ;
-- bad_A = mkADeg "bad" "worse" "worst" "badly" ;
-- bank_N = regN "bank" ;
-- beautiful_A = compoundADeg (regA "beautiful") ;
-- become_VA = mkVA (irregV "become" "became" "become") ;
-- beer_N = regN "beer" ;
-- beg_V2V = mkV2V (regDuplV "beg") noPrep toP ;
-- -- prevent_V2V = ingV2V (mkV "prevent") noPrep (mkPrep "from") ;
-- -- make_V2V = mkV2V make_V noPrep noPrep ;
-- big_A = duplADeg "big" ;
-- bike_N = regN "bike" ;
-- bird_N = regN "bird" ;
-- black_A = regADeg "black" ;
-- blue_A = regADeg "blue" ;
-- boat_N = regN "boat" ;
-- book_N = regN "book" ;
-- boot_N = regN "boot" ;
-- boss_N = mkN human (regN "boss") ;
-- boy_N = mkN masculine (regN "boy") ;
-- bread_N = regN "bread" ;
-- break_V2 = dirV2 (irregV "break" "broke" "broken") ;
-- broad_A = regADeg "broad" ;
-- brother_N2 = mkN2 (mkN masculine (mkN "brother")) (mkPrep "of") ;
-- brown_A = regADeg "brown" ;
-- butter_N = regN "butter" ;
-- buy_V2 = dirV2 (irregV "buy" "bought" "bought") ;
-- camera_N = regN "camera" ;
-- cap_N = regN "cap" ;
-- car_N = regN "car" ;
-- carpet_N = regN "carpet" ;
-- cat_N = regN "cat" ;
-- ceiling_N = regN "ceiling" ;
-- chair_N = regN "chair" ;
-- cheese_N = regN "cheese" ;
-- child_N = mk2N "child" "children" ;
-- church_N = regN "church" ;
-- city_N = regN "city" ;
-- clean_A = regADeg "clean" ;
-- clever_A = mkA "clever" "cleverer" ;
-- close_V2 = dirV2 (regV "close") ;
-- coat_N = regN "coat" ;
-- cold_A = regADeg "cold" ;
-- come_V = (irregV "come" "came" "come") ;
-- computer_N = regN "computer" ;
-- country_N = regN "country" ;
-- cousin_N = mkN human (regN "cousin") ;
-- cow_N = regN "cow" ;
-- die_V = (regV "die") ;
-- dirty_A = regADeg "dirty" ;
-- distance_N3 = mkN3 (regN "distance") fromP toP ;
-- doctor_N = mkN human (regN "doctor") ;
-- dog_N = regN "dog" ;
-- door_N = regN "door" ;
-- drink_V2 = dirV2 (irregV "drink" "drank" "drunk") ;
-- easy_A2V = mkA2V (regA "easy") forP ;
-- eat_V2 = dirV2 (irregV "eat" "ate" "eaten") ;
-- empty_A = regADeg "empty" ;
-- enemy_N = regN "enemy" ;
-- factory_N = regN "factory" ;
-- father_N2 = mkN2 (mkN masculine (mkN "father")) (mkPrep "of") ;
-- fear_VS = mkVS (regV "fear") ;
-- find_V2 = dirV2 (irregV "find" "found" "found") ;
-- fish_N = mk2N "fish" "fish" ;
-- floor_N = regN "floor" ;
-- forget_V2 = dirV2 (irregDuplV "forget" "forgot" "forgotten") ;
-- fridge_N = regN "fridge" ;
-- friend_N = mkN human (regN "friend") ;
-- fruit_N = mkN "fruit" "fruit" ; --- was: fruit, fruits before 7/12/2012
-- fun_AV = mkAV (regA "fun") ;
-- garden_N = regN "garden" ;
-- girl_N = mkN feminine (regN "girl") ;
-- glove_N = regN "glove" ;
-- gold_N = regN "gold" ;
-- good_A = mkADeg "good" "better" "best" "well" ;
-- go_V = mk5V "go" "goes" "went" "gone" "going" ;
-- green_A = regADeg "green" ;
-- harbour_N = regN "harbour" ;
-- hate_V2 = dirV2 (regV "hate") ;
-- hat_N = regN "hat" ;
-- hear_V2 = dirV2 (irregV "hear" "heard" "heard") ;
-- hill_N = regN "hill" ;
-- hope_VS = mkVS (regV "hope") ;
-- horse_N = regN "horse" ;
-- hot_A = duplADeg "hot" ;
-- house_N = regN "house" ;
-- important_A = compoundADeg (regA "important") ;
-- industry_N = regN "industry" ;
-- iron_N = regN "iron" ;
-- king_N = mkN masculine (regN "king") ;
-- know_V2 = dirV2 (irregV "know" "knew" "known") ;
-- know_VQ = mkVQ (irregV "know" "knew" "known") ;
-- know_VS = mkVS (irregV "know" "knew" "known") ;
-- lake_N = regN "lake" ;
-- lamp_N = regN "lamp" ;
-- learn_V2 = dirV2 (regV "learn") ;
-- leather_N = regN "leather" ;
-- leave_V2 = dirV2 (irregV "leave" "left" "left") ;
-- like_V2 = dirV2 (regV "like") ;
-- listen_V2 = prepV2 (mkV "listen" "listened") toP ;
-- live_V = (regV "live") ;
-- long_A = regADeg "long" ;
-- lose_V2 = dirV2 (irregV "lose" "lost" "lost") ;
-- love_N = regN "love" ;
-- love_V2 = dirV2 (regV "love") ;
-- man_N = mkN masculine (mk2N "man" "men") ;
-- married_A2 = mkA2 (regA "married") toP ;
-- meat_N = regN "meat" ;
-- milk_N = regN "milk" ;
-- moon_N = regN "moon" ;
-- mother_N2 = mkN2 (mkN feminine (mkN "mother")) (mkPrep "of") ;
-- mountain_N = regN "mountain" ;
-- music_N = regN "music" ;
-- narrow_A = regADeg "narrow" ;
-- new_A = regADeg "new" ;
-- newspaper_N = regN "newspaper" ;
-- oil_N = regN "oil" ;
-- old_A = regADeg "old" ;
-- open_V2 = dirV2 (mkV "open" "opens" "opened" "opened" "opening") ;
-- paint_V2A = mkV2A (regV "paint") ;
-- paper_N = regN "paper" ;
-- paris_PN = mkPN (mkN nonhuman (mkN "Paris")) ;
-- peace_N = regN "peace" ;
-- pen_N = regN "pen" ;
-- planet_N = regN "planet" ;
-- plastic_N = regN "plastic" ;
-- play_V2 = dirV2 (regV "play") ;
-- policeman_N = mkN masculine (mkN "policeman" "policemen") ;
-- priest_N = mkN human (regN "priest") ;
-- probable_AS = mkAS (regA "probable") ;
-- queen_N = mkN feminine (regN "queen") ;
-- radio_N = regN "radio" ;
-- rain_V0 = mkV0 (regV "rain") ;
-- read_V2 = dirV2 (irregV "read" "read" "read") ;
-- red_A = duplADeg "red" ;
-- religion_N = regN "religion" ;
-- restaurant_N = regN "restaurant" ;
-- river_N = regN "river" ;
-- rock_N = regN "rock" ;
-- roof_N = regN "roof" ;
-- rubber_N = regN "rubber" ;
-- run_V = (irregDuplV "run" "ran" "run") ;
-- say_VS = mkVS (irregV "say" "said" "said") ;
-- school_N = regN "school" ;
-- science_N = regN "science" ;
-- sea_N = regN "sea" ;
-- seek_V2 = dirV2 (irregV "seek" "sought" "sought") ;
-- see_V2 = dirV2 (irregV "see" "saw" "seen") ;
-- sell_V3 = dirV3 (irregV "sell" "sold" "sold") toP ;
-- send_V3 = dirV3 (irregV "send" "sent" "sent") toP ;
-- sheep_N = mk2N "sheep" "sheep" ;
-- ship_N = regN "ship" ;
-- shirt_N = regN "shirt" ;
-- shoe_N = regN "shoe" ;
-- shop_N = regN "shop" ;
-- short_A = regADeg "short" ;
-- silver_N = regN "silver" ;
-- sister_N = mkN feminine (mkN "sister") ;
-- sleep_V = (irregV "sleep" "slept" "slept") ;
-- small_A = regADeg "small" ;
-- snake_N = regN "snake" ;
-- sock_N = regN "sock" ;
-- speak_V2 = dirV2 (irregV "speak" "spoke" "spoken") ;
-- star_N = regN "star" ;
-- steel_N = regN "steel" ;
-- stone_N = regN "stone" ;
-- stove_N = regN "stove" ;
-- student_N = mkN human (regN "student") ;
-- stupid_A = mkA "stupid" ;
-- sun_N = regN "sun" ;
-- switch8off_V2 = dirV2 (partV (regV "switch") "off") ;
-- switch8on_V2 = dirV2 (partV (regV "switch") "on") ;
-- table_N = regN "table" ;
-- talk_V3 = mkV3 (regV "talk") toP aboutP ;
-- teacher_N = mkN human (regN "teacher") ;
-- teach_V2 = dirV2 (irregV "teach" "taught" "taught") ;
-- television_N = regN "television" ;
-- thick_A = regADeg "thick" ;
-- thin_A = duplADeg "thin" ;
-- train_N = regN "train" ;
-- travel_V = (regDuplV "travel") ;
-- tree_N = regN "tree" ;
-- ---- trousers_N = regN "trousers" ;
-- ugly_A = mkA "ugly" ;
-- understand_V2 = dirV2 (irregV "understand" "understood" "understood") ;
-- university_N = regN "university" ;
-- village_N = regN "village" ;
-- wait_V2 = prepV2 (regV "wait") forP ;
-- walk_V = (regV "walk") ;
-- warm_A = regADeg "warm" ;
-- war_N = regN "war" ;
-- watch_V2 = dirV2 (regV "watch") ;
-- water_N = regN "water" ;
-- white_A = mkA "white" ;
-- window_N = regN "window" ;
-- wine_N = regN "wine" ;
-- win_V2 = dirV2 (irregDuplV "win" "won" "won") ;
-- woman_N = mkN feminine (mk2N "woman" "women") ;
-- wonder_VQ = mkVQ (mkV "wonder" "wondered") ;
-- wood_N = regN "wood" ;
-- write_V2 = dirV2 (irregV "write" "wrote" "written") ;
-- yellow_A = mkA "yellow" ;
-- young_A = regADeg "young" ;
--
-- do_V2 = dirV2 (mk5V "do" "does" "did" "done" "doing") ;
-- now_Adv = mkAdv "now" ;
-- already_Adv = mkAdv "already" ;
-- song_N = regN "song" ;
-- add_V3 = dirV3 (regV "add") toP ;
-- number_N = regN "number" ;
-- put_V2 = prepV2 (irregDuplV "put" "put" "put") noPrep ;
-- stop_V = regDuplV "stop" ;
-- jump_V = regV "jump" ;
--
-- left_Ord = mkOrd "left" ;
-- right_Ord = mkOrd "right" ;
-- far_Adv = mkAdv "far" ;
-- correct_A = (regA "correct") ;
-- dry_A = regA "dry" ;
-- dull_A = regA "dull" ;
-- full_A = regA "full" ;
-- heavy_A = regA "heavy" ;
-- near_A = regA "near" ;
-- rotten_A = (regA "rotten") ;
-- round_A = regA "round" ;
-- sharp_A = regA "sharp" ;
-- smooth_A = regA "smooth" ;
-- straight_A = regA "straight" ;
-- wet_A = regA "wet" ; ----
-- wide_A = regA "wide" ;
-- animal_N = regN "animal" ;
-- ashes_N = regN "ash" ; -- FIXME: plural only?
-- back_N = regN "back" ;
-- bark_N = regN "bark" ;
-- belly_N = regN "belly" ;
-- blood_N = regN "blood" ;
-- bone_N = regN "bone" ;
-- breast_N = regN "breast" ;
-- cloud_N = regN "cloud" ;
-- day_N = regN "day" ;
-- dust_N = regN "dust" ;
-- ear_N = regN "ear" ;
-- earth_N = regN "earth" ;
-- egg_N = regN "egg" ;
-- eye_N = regN "eye" ;
-- fat_N = regN "fat" ;
-- feather_N = regN "feather" ;
-- fingernail_N = regN "fingernail" ;
-- fire_N = regN "fire" ;
-- flower_N = regN "flower" ;
-- fog_N = regN "fog" ;
-- foot_N = mk2N "foot" "feet" ;
-- forest_N = regN "forest" ;
-- grass_N = regN "grass" ;
-- guts_N = regN "gut" ; -- FIXME: no singular
-- hair_N = regN "hair" ;
-- hand_N = regN "hand" ;
-- head_N = regN "head" ;
-- heart_N = regN "heart" ;
-- horn_N = regN "horn" ;
-- husband_N = mkN masculine (regN "husband") ;
-- ice_N = regN "ice" ;
-- knee_N = regN "knee" ;
-- leaf_N = mk2N "leaf" "leaves" ;
-- leg_N = regN "leg" ;
-- liver_N = regN "liver" ;
-- louse_N = mk2N "louse" "lice" ;
-- mouth_N = regN "mouth" ;
-- name_N = regN "name" ;
-- neck_N = regN "neck" ;
-- night_N = regN "night" ;
-- nose_N = regN "nose" ;
-- person_N = mkN human (regN "person") ;
-- rain_N = regN "rain" ;
-- road_N = regN "road" ;
-- root_N = regN "root" ;
-- rope_N = regN "rope" ;
-- salt_N = regN "salt" ;
-- sand_N = regN "sand" ;
-- seed_N = regN "seed" ;
-- skin_N = regN "skin" ;
-- sky_N = regN "sky" ;
-- smoke_N = regN "smoke" ;
-- snow_N = regN "snow" ;
-- stick_N = regN "stick" ;
-- tail_N = regN "tail" ;
-- tongue_N = regN "tongue" ;
-- tooth_N = mk2N "tooth" "teeth" ;
-- wife_N = mkN feminine (mk2N "wife" "wives") ;
-- wind_N = regN "wind" ;
-- wing_N = regN "wing" ;
-- worm_N = regN "worm" ;
-- year_N = regN "year" ;
-- blow_V = IrregEng.blow_V ;
-- breathe_V = dirV2 (regV "breathe") ;
-- burn_V = IrregEng.burn_V ;
-- dig_V = IrregEng.dig_V ;
-- fall_V = IrregEng.fall_V ;
-- float_V = regV "float" ;
-- flow_V = regV "flow" ;
-- fly_V = IrregEng.fly_V ;
-- freeze_V = IrregEng.freeze_V ;
-- give_V3 = mkV3 give_V noPrep noPrep ;
-- laugh_V = regV "laugh" ;
-- lie_V = IrregEng.lie_V ;
-- play_V = regV "play" ;
-- sew_V = IrregEng.sew_V ;
-- sing_V = IrregEng.sing_V ;
-- sit_V = IrregEng.sit_V ;
-- smell_V = regV "smell" ;
-- spit_V = IrregEng.spit_V ;
-- stand_V = IrregEng.stand_V ;
-- swell_V = IrregEng.swell_V ;
-- swim_V = IrregEng.swim_V ;
-- think_V = IrregEng.think_V ;
-- turn_V = regV "turn" ;
-- vomit_V = mkV "vomit" "vomited" ;
--
-- bite_V2 = dirV2 IrregEng.bite_V ;
-- count_V2 = dirV2 (regV "count") ;
-- cut_V2 = dirV2 IrregEng.cut_V ;
-- fear_V2 = dirV2 (regV "fear") ;
-- fight_V2 = dirV2 fight_V ;
-- hit_V2 = dirV2 hit_V ;
-- hold_V2 = dirV2 hold_V ;
-- hunt_V2 = dirV2 (regV "hunt") ;
-- kill_V2 = dirV2 (regV "kill") ;
-- pull_V2 = dirV2 (regV "pull") ;
-- push_V2 = dirV2 (regV "push") ;
-- rub_V2 = dirV2 (regDuplV "rub") ;
-- scratch_V2 = dirV2 (regV "scratch") ;
-- split_V2 = dirV2 split_V ;
-- squeeze_V2 = dirV2 (regV "squeeze") ;
-- stab_V2 = dirV2 (regDuplV "stab") ;
-- suck_V2 = dirV2 (regV "suck") ;
-- throw_V2 = dirV2 throw_V ;
-- tie_V2 = dirV2 (regV "tie") ;
-- wash_V2 = dirV2 (regV "wash") ;
-- wipe_V2 = dirV2 (regV "wipe") ;
--
-- -- other_A = regA "other" ;
--
-- grammar_N = regN "grammar" ;
-- language_N = regN "language" ;
-- rule_N = regN "rule" ;
--
-- -- added 4/6/2007
-- john_PN = mkPN (mkN masculine (mkN "John")) ;
-- question_N = regN "question" ;
-- ready_A = regA "ready" ;
-- reason_N = regN "reason" ;
-- today_Adv = mkAdv "today" ;
-- uncertain_A = regA "uncertain" ;
--
-- oper
-- aboutP = mkPrep "about" ;
-- atP = mkPrep "at" ;
-- forP = mkPrep "for" ;
-- fromP = mkPrep "from" ;
-- inP = mkPrep "in" ;
-- onP = mkPrep "on" ;
-- toP = mkPrep "to" ;
} ;

15
src/zulu/MarkupZul.gf Executable file
View File

@@ -0,0 +1,15 @@
--# -path=.:../abstract:../common
concrete MarkupZul of Markup = CatZul, MarkHTMLX ** {
lin
MarkupCN m cn = {s = \\n,c => appMark m (cn.s ! n ! c) ; g = cn.g} ;
MarkupNP m np = {s = \\c => appMark m (np.s ! c) ; a = np.a} ;
MarkupAP m ap = {s = \\a => appMark m (ap.s ! a) ; isPre = ap.isPre} ;
MarkupAdv m adv = {s = appMark m adv.s} ;
MarkupS m s = {s = appMark m s.s} ;
MarkupUtt m utt = {s = appMark m utt.s} ;
MarkupPhr m phr = {s = appMark m phr.s} ;
MarkupText m txt = {s = appMark m txt.s} ;
}

218
src/zulu/NounExtZul.gf Normal file
View File

@@ -0,0 +1,218 @@
concrete NounExtZul of NounExt = CatZul,CatExtZul ** open ResZul, Prelude, ParamX in {
lin
-- Quant is used for demonstratives, and QuantStem for all/only
PronPostdetNP pron postdet = {
empty = pron.empty ;
s = \\nform => pron.s!nform ++ postdet.s!pron.agr ;
agr = pron.agr ;
i = RC ;
proDrop = pron.proDrop ;
isPron = True ;
heavy = True
} ;
QuantPostdet q = {
s = \\a => q.s!a
} ;
DemPostdet q = {
s = \\a => q.s!True!a
} ;
QuantDemPostdet q d = {
s = \\a => q.s!a ++ d.s!True!a
} ;
DemQuantPostdet d q = {
s = \\a => d.s!True!a ++ q.s!a
} ;
DetNum n = n ; -- ** { spec = Spec } ;
-- NonspecDet n = n ** { spec = Nonspec } ;
PostdetCN cn postdet det = let
agr = Third cn.c det.n
in {
empty = cn.empty ;
-- s = \\nform => cn.s!det.n!nform ++ cn.mod!det.n ++ postdet.s!agr ;
s = \\nform => cn.s!det.n!nform ++ postdet.s!agr ++ det.s ;
agr = agr ;
i = nominit!agr ;
proDrop = False ;
isPron = False ;
heavy = True
} ;
RelN rs n = {
empty = n.empty ;
s = \\num,nform => rs.s!(Third n.c num) ++ n.s!num!nform ;
-- mod = \\_ => [] ;
c = n.c ;
emph = False
} ;
-- TODO : check mod
ApposCN cn n = {
s = \\num,nform => cn.s!num!nform ++ n.s!num!nform ;
-- mod = \\num => n.s!num!Full ++ cn.mod!num ;
c = cn.c ; -- takes agr of cn
empty = cn.empty ;
emph = cn.emph
} ;
-- TODO : check mod
ApposN cn n = {
s = \\num,nform => cn.s!num!nform ++ n.s!num!nform ;
-- mod = \\num => n.s!num!Full ++ cn.mod!num ;
c = n.c ; -- takes agr of n
empty = cn.empty ;
emph = cn.emph
} ;
PredetN predet n = {
s = case predet.hasDem of {
True => \\num => table {
NFull | NReduced | NPoss => predet.s!(Third n.c num) ++ n.s!num!NReduced ;
NLoc => "ku" ++BIND++ predet.s!(Third n.c num) ++ n.s!num!NReduced
} ;
False => \\num,nform => predet.s!(Third n.c num) ++ n.s!num!nform
} ;
-- mod = \\_ => [] ;
c = n.c ;
empty = n.empty ;
emph = False
};
QuantPredet q = {
s = \\a => q.s!a ;
hasDem = False
} ;
DemPredet q = {
s = \\a => q.s!False!a ;
hasDem = True
} ;
QuantDemPredet q d = {
s = \\a => q.s!a ++ d.s!False!a ;
hasDem = True
} ;
EmphCN cn = {
s = \\num => table {
NFull => pron_stem!(Third cn.c num) ++BIND++ "na" ++ cn.s!num!NFull ;
NReduced => pron_stem!(Third cn.c num) ++ cn.s!num!NFull ;
NPoss => poss_pron_stem!(Third cn.c num) ++ cn.s!num!NFull ;
NLoc => "ku" ++BIND++ pron_stem!(Third cn.c num) ++ cn.s!num!NFull
} ;
-- mod = cn.mod ;
c = cn.c ;
empty = cn.empty ;
emph = True
} ;
ContrastCN cn = {
s = \\num,nform => cn.s!num!nform ++ pron_stem!(Third cn.c num) ++BIND++ "na" ;
-- mod = \\num => pron_stem!(Third cn.c num) ++BIND++ "na" ++ cn.mod!num ;
c = cn.c ;
empty = cn.empty ;
emph = cn.emph ;
emph = cn.emph
} ;
UsePNPl pn = let
agr = Third pn.c Pl
in {
empty = pn.empty ;
s = pn.s!Pl ;
agr = agr ;
i = nominit!agr ;
proDrop = False ;
isPron = False ;
heavy = True
} ;
Deverb15 v =
let
agr = Third C15 Sg ;
in
{
s = \\_ => table {
NFull => case v.r of {
RC => "uku"++BIND++(v.s!R_a) ;
(RA|RE) => "ukw"++BIND++(v.s!R_a) ;
_ => "uk"++BIND++(v.s!R_a)
} ;
NReduced => case v.r of {
RC => "ku"++BIND++(v.s!R_a) ;
(RA|RE) => "kw"++BIND++(v.s!R_a) ;
_ => "k"++BIND++(v.s!R_a)
} ;
NPoss => case v.r of {
RC => "ku"++BIND++(v.s!R_a) ;
(RA|RE) => "kw"++BIND++(v.s!R_a) ;
_ => "k"++BIND++(v.s!R_a)
} ;
NLoc => case v.r of {
RC => "eku"++BIND++(v.s!R_e)++BIND++"ni" ;
(RA|RE) => "ekw"++BIND++(v.s!R_e)++BIND++"ni" ;
_ => "ek"++BIND++(v.s!R_e)++BIND++"ni"
}
} ;
c = C15 ;
empty = []
} ;
LocNP np = {
s = table {
MainCl => \\a,p,t => let
vform = VFIndic MainCl p t ;
pcp = ap_cop_pref vform a RelType ; -- u- / uzoba / akazukuba
cop_base = loc_n_cop_base np vform
in
case vform of {
VFIndic _ Neg PresTense => (kho_cop vform a) ++ cop_base;
VFIndic _ _ _ => pcp ++ cop_base
} ;
RelCl => \\a,p,t => let
vform = VFIndic RelCl p t ;
rcp = (relConcCop vform a RC) ; -- o- / onge-
pcp = ap_cop_pref vform a RelType ; -- u- / uzoba / akazukuba
cop_base = loc_n_cop_base np vform
in
case vform of {
VFIndic _ Neg PresTense => (kho_cop vform a) ++ cop_base;
VFIndic _ _ _ => rcp ++ pcp ++ cop_base
}
} ;
} ;
LocNLoc locn = {
s = table {
MainCl => \\a,p,t => let
vform = VFIndic MainCl p t ;
pcp = ap_cop_pref vform a RelType ; -- u- / uzoba / akazukuba
cop_base = locn.s
in
case vform of {
VFIndic _ Neg PresTense => (kho_cop vform a) ++ cop_base;
VFIndic _ _ _ => pcp ++ cop_base
} ;
RelCl => \\a,p,t => let
vform = VFIndic RelCl p t ;
rcp = (relConcCop vform a RC) ; -- o- / onge-
pcp = ap_cop_pref vform a RelType ; -- u- / uzoba / akazukuba
cop_base = locn.s
in
case vform of {
VFIndic _ Neg PresTense => (kho_cop vform a) ++ cop_base;
VFIndic _ _ _ => rcp ++ pcp ++ cop_base
}
} ;
} ;
}

102
src/zulu/NounZul.gf Executable file
View File

@@ -0,0 +1,102 @@
concrete NounZul of Noun = CatZul ** open ResZul, Prelude, ParamX in {
flags optimize=all_subs ;
lin
-- TODO: check refactor
DetCN det cn = let
agr = Third cn.c det.n ;
in {
empty = cn.empty ;
s = \\nform => det.s ++ cn.s ! det.n ! nform ;
agr = agr ;
i = case cn.emph of {
False => nominit!agr ;
True => RC
} ;
proDrop = False ;
isPron = False ;
heavy = True
-- reqLocS = True ; -- TODO: change if a Det is ever added that has a non-empty string
-- qdef = det.qdef ;
} ;
-- TODO: check refactor
UsePN pn = let
agr = Third pn.c Sg ;
in {
empty = pn.empty ;
s = pn.s!Sg ;
agr = agr ;
i = nominit!agr ;
proDrop = False ;
isPron = False ;
heavy = True
} ;
-- TODO: check refactor
UsePron pron = {
empty = pron.empty ;
-- s = case pron.proDrop of {
-- False => pron.s ;
-- True => table {
-- NFull => pron.empty ;
-- NReduced => pron.s!NReduced ;
-- NPoss => pron.s!NPoss ;
-- NLoc => pron.s!NLoc
-- }
-- } ;
s = pron.s ;
agr = pron.agr ;
i = RC ;
proDrop = pron.proDrop ;
isPron = True ;
heavy = case pron.proDrop of {
True => False ;
False => True
}
} ;
-- PredetNP, PPartNP, AdvNP, ExtAdvNP : not implemented
-- TODO: refactor
RelNP np rs = {
empty = np.empty ;
s = \\nform => np.s!nform ++ rs.s!np.agr ;
agr = np.agr ;
i = np.i ;
proDrop = False ; -- probably right?
isPron = np.isPron ;
heavy = True
} ;
-- DetNP, DetQuant, DetQuantOrd : not implemented
NumSg = { s = [] ; n = Sg } ;
NumPl = { s = [] ; n = Pl } ;
-- NumCard, NumNumeral, AdNum, OrdNumeral, OrdSuperl, OrdNumeralSuperl : not implemented
-- NumDigits, OrdDigits : not yet implemented
-- DefArt, IndefArt, MassNP, PossPron : not implemented
-- TODO: check refactor (no change?)
UseN n = n ** { emph = False } ;
-- ComplN2, ComplN3, UseN2, Use2N3, Use3N3 : not implemented
-- AdjCN, RelCN, AdvCN, SentCN, ApposCN : not implemented
-- flashing of the lights / ukukhanya kwezibani
-- TODO: check refactor (no change?)
PossNP cn np = {
empty = cn.empty ;
s = \\num,nform => cn.s!num!nform ++ poss_concord!cn.c!num!np.i ++BIND++ np.s!NPoss;
-- mod = \\num => cn.mod!num ++ poss_concord!cn.c!num!np.i ++BIND++ (poss_NP np) ;
c = cn.c ;
emph = cn.emph
} ;
-- PartNP, CountNP, AdjDAP, DetDAP : not implemented
}

95
src/zulu/NumeralZul.gf Executable file
View File

@@ -0,0 +1,95 @@
concrete NumeralZul of Numeral = CatZul [Numeral,Digits] ** open Prelude, ResZul in {
-- lincat
-- Digit = {s : DForm => CardOrd => Case => Str} ;
-- Sub10 = {s : DForm => CardOrd => Case => Str ; n : Number} ;
-- Sub100 = {s : CardOrd => Case => Str ; n : Number} ;
-- Sub1000 = {s : Bool => CardOrd => Case => Str ; n : Number} ;
-- Sub1000000 = {s : Bool => CardOrd => Case => Str ; n : Number} ;
--
-- lin num x = x ;
-- lin n2 = let two = mkNum "two" "twelve" "twenty" "second" in
-- {s = \\f,o => case <f,o> of {
-- <teen,NOrd> => regGenitiveS "twelfth" ;
-- _ => two.s ! f ! o
-- }
-- } ;
--
-- lin n3 = mkNum "three" "thirteen" "thirty" "third" ;
-- lin n4 = mkNum "four" "fourteen" "forty" "fourth" ;
-- lin n5 = mkNum "five" "fifteen" "fifty" "fifth" ;
-- lin n6 = regNum "six" ;
-- lin n7 = regNum "seven" ;
-- lin n8 = mkNum "eight" "eighteen" "eighty" "eighth" ;
-- lin n9 = mkNum "nine" "nineteen" "ninety" "ninth" ;
--
-- lin pot01 = mkNum "one" "eleven" "ten" "first" ** {n = Sg} ;
-- lin pot0 d = d ** {n = Pl} ;
-- lin pot110 = regCardOrd "ten" ** {n = Pl} ;
-- lin pot111 = regCardOrd "eleven" ** {n = Pl} ;
-- lin pot1to19 d = {s = d.s ! teen} ** {n = Pl} ;
-- lin pot0as1 n = {s = n.s ! unit} ** {n = n.n} ;
-- lin pot1 d = {s = d.s ! ten} ** {n = Pl} ;
-- lin pot1plus d e = {
-- s = \\o,c => d.s ! ten ! NCard ! Nom ++ BIND ++ "-" ++ BIND ++ e.s ! unit ! o ! c ; n = Pl} ;
-- lin pot1as2 n = {s = \\_ => n.s; n=n.n} ;
-- lin pot2 d = {s = \\_,o,c => d.s ! unit ! NCard ! Nom ++ mkCard o "hundred" ! c} ** {n = Pl} ;
-- lin pot2plus d e = {
-- s = \\_,o,c => d.s ! unit ! NCard ! Nom ++ "hundred" ++ "and" ++ e.s ! o ! c ; n = Pl} ;
-- lin pot2as3 n = n ;
-- lin pot3 n = {
-- s = \\d,o,c => n.s ! d ! NCard ! Nom ++ mkCard o "thousand" ! c ; n = Pl} ;
-- lin pot3plus n m = {
-- s = \\d,o,c => n.s ! d ! NCard ! Nom ++ "thousand" ++ m.s ! False ! o ! c; n = Pl} ;
--
-- -- numerals as sequences of digits
--
-- lincat
-- Dig = TDigit ;
--
-- lin
-- IDig d = d ** {tail = T1} ;
--
-- IIDig d i = {
-- s = \\o,c => d.s ! NCard ! Nom ++ commaIf i.tail ++ i.s ! o ! c ;
-- n = Pl ;
-- tail = inc i.tail
-- } ;
--
-- D_0 = mkDig "0" ;
-- D_1 = mk3Dig "1" "1st" Sg ;
-- D_2 = mk2Dig "2" "2nd" ;
-- D_3 = mk2Dig "3" "3rd" ;
-- D_4 = mkDig "4" ;
-- D_5 = mkDig "5" ;
-- D_6 = mkDig "6" ;
-- D_7 = mkDig "7" ;
-- D_8 = mkDig "8" ;
-- D_9 = mkDig "9" ;
--
-- oper
-- commaIf : DTail -> Str = \t -> case t of {
-- T3 => BIND ++ "," ++ BIND ;
-- _ => BIND
-- } ;
--
-- inc : DTail -> DTail = \t -> case t of {
-- T1 => T2 ;
-- T2 => T3 ;
-- T3 => T1
-- } ;
--
-- mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ;
-- mkDig : Str -> TDigit = \c -> mk2Dig c (c + "th") ;
--
-- mk3Dig : Str -> Str -> Number -> TDigit = \c,o,n -> {
-- s = table {NCard => regGenitiveS c ; NOrd => regGenitiveS o} ;
-- n = n
-- } ;
--
-- TDigit = {
-- n : Number ;
-- s : CardOrd => Case => Str
-- } ;
}

1
src/zulu/OverloadZul.gf Executable file
View File

@@ -0,0 +1 @@
resource OverloadZul = Overload with (Grammar = GrammarZul) ;

99
src/zulu/PChunkZul.gf Normal file
View File

@@ -0,0 +1,99 @@
concrete PChunkZul of PChunk = CatZul, CatExtZul, SymbolZul [Symb] **
open
Prelude, ResZul, ParamX,
(R = ResZul), (P = ParadigmsZul) in {
lincat
Chunks = {s : Str} ;
Chunk = {s : Str};
Chunk_AP, Chunk_Adv, Chunk_S, Chunk_RS, Chunk_QS, Chunk_CN, Chunk_NP, Chunk_N, Chunk_Symb = {s: Str} ;
VC = V ;
lin
OneChunk c = c ;
PlusChunk c cs = cc2 c cs ;
ChunkPhr c = ss ("*" ++ c.s) | c ;
Adv_Chunker c = c ;
S_Chunker c = c ;
RS_Chunker c = c ;
QS_Chunker c = c ;
CN_Chunker c = c ;
NP_Chunker c = c ;
N_Chunker c = c ;
Predet_Chunker c = c ;
Postdet_Chunker c = c ;
Symb_Chunker c = c ;
Adv_Chunk a = { s = a.s } ;
S_Chunk s = { s = s.s } ;
RS_Chunk rs = { s = rs.s!agr_vars } ;
QS_Chunk s = { s = s.qword_pre ++ s.s ++ s.qword_post } ;
CN_Sg_Chunk cn = {
s = cn.s!Sg!NFull
} ;
CN_Pl_Chunk cn = {
s = cn.s!Pl!NFull
} ;
NP_Nom_Chunk np = {
s = variants {
np.s!NFull ;
np.s!NReduced
}
} ;
NP_Gen_Chunk np = {
s = poss_concord_agr!agr_vars!np.i ++BIND++ np.s!NPoss
} ;
Predet_Chunk predet = {
s = predet.s!agr_vars
} ;
Postdet_Chunk postdet = {
s = postdet.s!agr_vars
} ;
-- for unknown words that are not names
Symb_Chunk symb = { s = symb.s } ;
fullstop_Chunk = sbSS "." ;
exclmark_Chunk = sbSS "!" ;
questmark_Chunk = sbSS "?" ;
comma_Chunk = sbSS "," ;
colon_Chunk = sbSS ":" ;
semicolon_Chunk = sbSS ";" ;
quote_Chunk = variants {sbSS "\"" ; ss ("\"" ++ SOFT_BIND) } ;
lpar_Chunk = ss ("(" ++ SOFT_BIND) ;
rpar_Chunk = sbSS ")" ;
dash_Chunk = sbSS "-" ;
oper
sbSS : Str -> SS = \s -> ss (SOFT_BIND ++ s) ;
agr_vars : Agr = variants {
Third C1_2 Sg ;
Third C1_2 Pl ;
Third C1a_2a Sg ;
Third C1a_2a Pl ;
Third C3_4 Sg ;
Third C3_4 Pl ;
Third C5_6 Sg ;
Third C5_6 Pl ;
Third C7_8 Sg ;
Third C7_8 Pl ;
Third C9_10 Sg ;
Third C9_10 Pl ;
Third C11_10 Sg ;
Third C11_10 Pl ;
Third C9_6 Sg ;
Third C9_6 Pl ;
Third C14 Sg ;
Third C15 Sg ;
Third C17 Sg ;
First Sg ;
First Pl ;
Second Sg ;
Second Pl
} ;
}

180
src/zulu/ParadigmsZul.gf Executable file
View File

@@ -0,0 +1,180 @@
--# -path=.:../abstract:../../prelude:../common
--1 English Lexical Paradigms
--
-- Aarne Ranta 2003--2005
--
-- This is an API for the user of the resource grammar
-- for adding lexical items. It gives functions for forming
-- expressions of open categories: nouns, adjectives, verbs.
--
-- Closed categories (determiners, pronouns, conjunctions) are
-- accessed through the resource syntax API, $Structural.gf$.
--
-- The main difference with $MorphoZul.gf$ is that the types
-- referred to are compiled resource grammar types. We have moreover
-- had the design principle of always having existing forms, rather
-- than stems, as string arguments of the paradigms.
--
-- The structure of functions for each word class $C$ is the following:
-- first we give a handful of patterns that aim to cover all
-- regular cases. Then we give a worst-case function $mkC$, which serves as an
-- escape to construct the most irregular words of type $C$.
-- However, this function should only seldom be needed: we have a
-- separate module [``IrregZul`` ../../english/IrregZul.gf],
-- which covers irregular verbss.
resource ParadigmsZul = open
(Predef=Predef),
Prelude,
-- MorphoZul,
ResZul,
CatZul,
CatExtZul,
ParamX
in {
--2 Parameters
--
-- -- To abstract over gender names, we define the following identifiers.
--
-- oper
-- Gender : Type ;
--
-- human : Gender ;
-- nonhuman : Gender ;
-- masculine : Gender ; --%
-- feminine : Gender ; --%
--
-- -- To abstract over number names, we define the following.
--
-- Number : Type ;
--
-- singular : Number ;
-- plural : Number ;
--
-- -- To abstract over case names, we define the following.
--
-- Case : Type ; --%
--
-- nominative : Case ; --%
-- genitive : Case ; --%
--
-- -- Prepositions are used in many-argument functions for rection.
-- -- The resource category $Prep$ is used.
--
-- -- The number of a noun phrase can be extracted with the following
-- -- function.
--
-- npNumber : NP -> Number ; -- exctract the number of a noun phrase
--
--
-- --2 Nouns
oper
mkN = overload {
mkN : (ngane : Str) -> ClassGender -> N = \n,c -> lin N (regNoun n c) ; -- "thing" nouns
mkN : (nyaka,onyakeni,eminyakeni : Str) -> ClassGender -> N = \n,ls,lp,c -> lin N (semiRegNoun n ls lp c) ;
mkN : (iso,amehlo,esweni,emehlweni : Str) -> ClassGender -> N = \ns,np,ls,lp,c -> lin N (mkNoun ns np ls lp c) ;
} ;
mkPN = overload {
mkPN : (John : Str) -> ClassGender -> N = \n,c -> lin N (regNoun n c) ; -- "thing" nouns
mkPN : (nyaka,onyakeni,eminyakeni : Str) -> ClassGender -> N = \n,ls,lp,c -> lin N (semiRegNoun n ls lp c) ;
mkPN : (iso,amehlo,esweni,emehlweni : Str) -> ClassGender -> N = \ns,np,ls,lp,c -> lin N (mkNoun ns np ls lp c) ;
} ;
mkKwaPN = overload {
mkKwaPN : (Zulu : Str) -> ClassGender -> PN = \n,c -> lin PN (kwaProperName n c) ;
} ;
mkAdA = overload {
mkAdA : (kakhulu : Str ) -> AdA = \a -> lin AdA (ss a) ;
} ;
mkA = overload {
mkA : (kahle : Str) -> A = \a -> lin A (regAdj a) ; -- regular adjective
} ;
mkRelA = overload {
mkRelA : (mnandi : Str) -> A = \a -> lin A (relAdj a) ; -- relative stem "adjective"
} ;
-- mkEnumA = overload {
-- mkEnumA : (mbe : Str) -> A = \a -> lin A (enumAdj a) ; -- relative stem "adjective"
-- } ;
mkV = overload {
mkV : (hamb : Str) -> V = \hamb -> lin V (regVerb hamb) ;
mkV : (th,thi : Str) -> V = \th,thi -> lin V (th_Verb th thi) ;
mkV : (guqubal,guqubala,guqubele : Str) -> V = \guqubal,guqubala,guqubele -> lin V (three_Verb guqubal guqubala guqubele) ;
mkV : (guqubal,guqubala,guqubele,guqubele_2 : Str) -> V = \guqubal,guqubala,guqubele,guqubele_2 -> lin V (four_Verb guqubal guqubala guqubele guqubele_2) ;
} ;
passV = overload {
passV: Str -> V = \fakw -> lin V (passiveVerb fakw) ;
} ;
passV2 = overload {
passV2: Str -> V2 = \fakw -> lin V2 (passiveVerb fakw) ;
} ;
mkV2 = overload {
mkV2 : (hamb : Str) -> V2 = \hamb -> lin V2 (regVerb hamb) ;
mkV2 : (th,thi : Str) -> V2 = \th,thi -> lin V2 (th_Verb th thi) ;
mkV2 : (guqubal,guqubala,guqubele : Str) -> V2 = \guqubal,guqubala,guqubele -> lin V2 (three_Verb guqubal guqubala guqubele) ;
mkV2 : (guqubal,guqubala,guqubele,guqubele_2 : Str) -> V2 = \guqubal,guqubala,guqubele,guqubele_2 -> lin V2 (four_Verb guqubal guqubala guqubele guqubele_2) ;
} ;
mkV3 = overload {
mkV3 : (phuz : Str) -> V3 = \phuz -> lin V3 (regVerb phuz) ;
-- mkV2 : (phathw : Str) -> Voice -> V2 = \phathw,voice -> lin V2 (passiveVerb phathw voice) ;
} ;
mkVA = overload {
mkVA : (b : Str) -> VA = \b -> lin VA (regVerb b) ;
} ;
mkVS = overload {
mkVS : (cel : Str) -> VS = \cel -> lin VS (regVerb cel) ;
} ;
mkVAux = overload {
mkVAux : (hlale : Str) -> VAux = \hlale -> lin VAux {
s = hlale ;
at = PartAux
}
} ;
-- yourPl_Det = overload {
-- yourPl_Det : Det = lin Det { s = "jou" ; n = Pl ; p = TPos } ;
-- } ;
--
-- mkSgDet = overload {
-- mkSgDet : Str -> Det = \s -> lin Det { s = s ; n = Sg ; p = TPos } ;
-- } ;
-- mkPlDet = overload {
-- mkPlDet : Str -> Det = \s -> lin Det { s = s ; n = Pl ; qdef = Article Def } ;
-- } ;
-- -- mkVS = overload {
-- -- mkVS : V -> VS = \weet -> lin VS { v = weet ; c = "dat" } ;
-- -- } ;
-- --
-- -- mkVQ = overload {
-- -- mkVQ : V -> VS = \wonder -> lin VS { v = wonder ; c = "of" } ;
-- -- } ;
mkAdv = overload {
mkAdv : Str -> Adv = \adv -> lin Adv (regAdv adv) ;
-- mkAdv : Str -> Aspect -> Adv = \adv,asp -> lin Adv (aspAdv adv asp) ;
} ;
mkIAdv = overload {
mkIAdv : Str -> Bool -> IAdv = \adv,b -> lin IAdv { s = "ingabe" ; postIAdv = b } ;
-- mkAdv : Str -> Aspect -> Adv = \adv,asp -> lin Adv (aspAdv adv asp) ;
} ;
-- mkPredet = overload {
-- mkPredet : Str -> Predet = \predet -> lin Predet { s = predet ; p = TPos } ;
-- } ;
} ;

28
src/zulu/PhraseZul.gf Executable file
View File

@@ -0,0 +1,28 @@
concrete PhraseZul of Phrase = CatZul ** open Prelude, ResZul in {
lin
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
--
UttS sent = { s = sent.s } ;
UttQS sent = { s = sent.qword_pre ++ sent.s ++ sent.qword_post } ;
UttImpSg pol imp = { s = pol.s ++ imp.s!pol.p } ;
-- UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p ! ImpF Pl False} ;
-- UttImpPol pol imp = {s = pol.s ++ imp.s ! pol.p ! ImpF Sg True} ;
-- UttIP ip = {s = ip.s ! npNom} ; --- Acc also
-- UttIAdv iadv = iadv ;
-- UttNP np = {s = np.s ! npNom} ;
-- UttVP vp = {s = infVP VVInf vp False Simul CPos (agrP3 Sg)} ;
-- UttAdv adv = adv ;
-- UttCN n = {s = n.s ! Sg ! Nom} ;
-- UttCard n = {s = n.s ! False ! Nom} ;
-- UttAP ap = {s = ap.s ! agrP3 Sg} ;
-- UttInterj i = i ;
NoPConj = {s = []} ;
-- PConjConj conj = {s = conj.s2} ; ---
NoVoc = {s = []} ;
-- VocNP np = {s = frontComma ++ np.s ! npNom} ;
}

110
src/zulu/QuestionZul.gf Executable file
View File

@@ -0,0 +1,110 @@
concrete QuestionZul of Question = CatZul ** open ResZul, Prelude, ParamX in {
flags optimize=all_subs ;
lin
QuestCl cl = {
s = \\p,t => cl.s!p!t ;
-- potqcl = cl.potcl ;
qword_pre = [] ;
qword_post = variants { "na" ; [] } ;
} ; -- guessing this will work...
-- QuestVP qp vp =
-- let cl = mkClause (qp.s ! npNom) (agrP3 qp.n) vp
-- in {s = \\t,a,b,_ => cl.s ! t ! a ! b ! oDir} ; ----
--
-- QuestSlash ip slash =
-- {s = \\t,a,b,q =>
-- (mkQuestion (ss (ip.s ! NPAcc)) slash).s ! t ! a ! b ! q ++ slash.c2
-- } ;
-- --- changed AR 5/6/2016: uses stranding; pied-piping in ExtraZul
QuestIAdv iadv cl = qcl_iadv cl iadv ;
QuestIComp icomp np = {
s = \\p,t =>
let
vform = VFIndic MainCl p t ;
pre_icomp = case icomp.postIComp of {
False => (icomp_pref vform np.agr) ++ icomp.s ;
True => []
} ;
post_icomp = case icomp.postIComp of {
True => (icomp_pref vform np.agr) ++ icomp.s ;
False => []
}
in
pre_icomp ++ (np.s!NFull) ++ post_icomp ;
qword_pre = [] ;
qword_post = []
} ;
-- mkQuestion icomp (mkClause (np.s ! npNom) np.a (predAux auxBe)) ;
-- PrepIP p ip = {s = p.s ++ ip.s ! NPAcc} ;
--
-- AdvIP ip adv = {
-- s = \\c => ip.s ! c ++ adv.s ;
-- n = ip.n
-- } ;
--
-- IdetCN idet cn = {
-- s = \\c => idet.s ++ cn.s ! idet.n ! npcase2case c ;
-- n = idet.n
-- } ;
--
-- IdetIP idet = {
-- s = \\c => idet.s ;
-- n = idet.n
-- } ;
--
-- IdetQuant idet num = {
-- s = idet.s ! num.n ++ num.s ! False ! Nom ;
-- n = num.n
-- } ;
--
-- AdvIAdv i a = ss (i.s ++ a.s) ;
--
-- CompIAdv a = a ;
-- CompIP p = ss (p.s ! npNom) ;
--
-- lincat
-- QVP = ResZul.VP ;
-- lin
-- ComplSlashIP vp np = insertObjPre (\\_ => vp.c2 ++ np.s ! NPAcc) vp ;
-- AdvQVP vp adv = insertObj (\\_ => adv.s) vp ;
-- AddAdvQVP vp adv = insertObj (\\_ => adv.s) vp ;
--
-- QuestQVP qp vp =
-- let cl = mkClause (qp.s ! npNom) (agrP3 qp.n) vp
-- in {s = \\t,a,b,_ => cl.s ! t ! a ! b ! oDir} ; ----
oper
-- qcl_iadv : Cl -> CatZul.IAdv -> {s : Polarity => ZTense => DMood => Str ; potqcl : Polarity => DMood => Str ; qword_pre : Str ; qword_post : Str } = \cl,iadv -> {
-- s = case iadv.postIAdv of {
-- False => \\p,t,m => cl.s!p!t!m ++ iadv.s ++ cl.advs ;
-- True => \\p,t,m => cl.s!p!t!m ++ cl.advs
-- } ;
-- potqcl = cl.potcl ;
-- qword_pre = case iadv.postIAdv of {
-- False => [] ;
-- True => iadv.s
-- } ;
-- qword_post = []
-- } ;
qcl_iadv : Cl -> CatZul.IAdv -> {s : Polarity => BasicTense => Str ; qword_pre : Str ; qword_post : Str } = \cl,iadv -> {
s = \\p,t => cl.s!p!t ;
qword_pre = case iadv.postIAdv of {
True => [] ;
False => iadv.s
} ;
qword_post = case iadv.postIAdv of {
False => [] ;
True => iadv.s
} ;
} ;
}

30
src/zulu/README.md Executable file
View File

@@ -0,0 +1,30 @@
# GF Zulu Resource Grammar
### Authors
- Laurette Marais (lmarais@csir.co.za)
- Laurette Pretorius (laurette.pretorius@gmail.org)
in collaboration with Lionel Posthumus
This work has been made possible by the [South African Centre for Digital Language Resource (SADiLaR)](https://www.sadilar.org).
## Introduction
This resource grammar provides an implementation of the Zulu language by making use of the common abstract syntax and a custom extension. The goal is to strike a balance between adhering as closely as possible to the common abstract syntax, while providing as much transparency and efficiency as possible. One important aim is to enable parsing, which is not possible for large, inefficient grammars. The most common, and most challenging, syntax categories and functions have so far been implemented.
## Usage
The file structure has been adapted slightly to accommodate the custom extension, as well as to provide the ability to compile the base grammar with different lexica.
| Compilable module | Lexicon | Description |
| ----------------- | ------- | ----------- |
| MonoLexLangZul.gf | MonoLexZul.gf | The base RG with a large lexicon containing Zulu roots and stems, using Zulu function names, eg. `hamb_V` |
| MultiLexLangZul.gf | MultiLexZul.gf | The base RG with a lexicon of common Zulu roots and stems, using English function names, eg. `walk_V` |
| MonoLexChunkZul.gf | MonoLexZul.gf | A chunk parsing enabled version of the RG with a large lexicon containing Zulu roots and stems, using Zulu function names, eg. `hamb_V` |
| MultiLexChunkZul.gf | MultiLexZul.gf | A chunk parsing enabled version of the RG with a lexicon of common Zulu roots and stems, using English function names, eg. `walk_V` |
| DevLexLangZul.gf | DevLexZul.gf | The base RG with a small development lexicon containing Zulu roots and stems, using Zulu function names, eg. `hamb_V` |
Compiler directives setting up the appropriate paths have been added, so these modules should be compilable as is:
`path/to/gf-rgl$ gf --make src/zulu/grammars/MonoLexLangZul.gf`
## Supporting resources
Various supporting resources can be found at https://github.com/LauretteM/gf-zulu-resources

147
src/zulu/RelativeZul.gf Executable file
View File

@@ -0,0 +1,147 @@
concrete RelativeZul of Relative = CatZul ** open ResZul,Prelude,ParamX in {
flags optimize=all_subs ;
lin
-- RelCl cl = {
-- s = \\t,a,p,_ => "such" ++ "that" ++ cl.s ! t ! a ! p ! oDir ;
-- c = npNom
-- } ;
RelVP rp vp = case vp.vptype of {
CopIdent => rcl_with_id_cop_predicate rp vp ;
CopAssoc => rcl_with_ass_cop_predicate rp vp ;
CopEq => rcl_with_eq_cop_predicate rp vp ;
CopDescr => rcl_with_descr_predicate rp vp ;
_ => rcl_with_verb_predicate rp vp
} ;
-- -- Pied piping: "that we are looking at". Pied piping and empty
-- -- relative are defined in $ExtraZul.gf$ ("at which we are looking",
-- -- "we are looking at").
--
-- RelSlash rp slash = {
-- s = \\t,a,p,ag =>
-- rp.s ! RC (fromAgr ag).g NPAcc ++ slash.s ! t ! a ! p ! oDir ++ slash.c2 ;
-- c = NPAcc
-- } ;
--
-- FunRP p np rp = {
-- s = \\c => np.s ! NPAcc ++ p.s ++ rp.s ! RPrep (fromAgr np.a).g ;
-- a = RAg np.a
-- } ;
IdRP = { s = [] } ;
oper
rcl_with_verb_predicate : RP -> VP -> { s : Agr => Polarity => BasicTense => Str } = \rp,vp -> {
s = \\a,p,t =>
let
vform = VFIndic RelCl p t ;
vow = case <vp.r,p,t> of {
<RC,Pos,PresTense> => False ;
<_,Pos,PresTense> => True ;
<RC,_,PastTense> => False ;
<_,_,PastTense> => True ;
<_,_,_> => False
} ;
reqLF = case vp.hasComp of {
True => False ;
False => True
} ;
relsuf = case vp.hasComp of {
True => [] ;
False => relSuf vform
} ;
rcform = RelC ; -- case vform_main of {
-- VFIndic Part Pos PastTense _ => RelCA ;
-- VFIndic _ _ _ _ => RelC ;
-- VFPot _ _ _ => RelC ;
-- VFSubj _ => RelC
-- } ;
in
-- naively only took out the subject
rp.s
-- ++ (negPref vform_main)
-- -- ++ (exclSePref vform_main)
-- ++ relConc!a!rcform ++BIND
-- -- ++ (negPref2 vform_main)
-- -- ++ (exclKaPref vform)
-- ++ (tensePref vform)
-- ++ vp.oc
-- ++ vp.s!(rform vform_main reqLF)
++ vp.s!RelCl!a!p!t!reqLF
-- ++ relsuf
++ vp.iadv
++ vp.comp
++ vp.advs
} ;
rcl_with_id_cop_predicate : RP -> VP -> { s : Agr => Polarity => BasicTense => Str } = \rp,vp -> {
s = \\a,p,t =>
let
vform_main = VFIndic RelCl p t ;
pcp = relConcLookup!a!vp.r ++BIND ;
-- cp = id_cop_pref vp.comp_agr ;
cb = vp.comp ;
in
-- naively removed subject
rp.s ++
-- pcp ++
vp.s!RelCl!a!p!t!False ++
vp.iadv ++
vp.advs
} ;
rcl_with_ass_cop_predicate : RP -> VP -> { s : Agr => Polarity => BasicTense => Str } = \rp,vp -> {
s = \\a,p,t =>
let
vform_main = VFIndic RelCl p t ;
pcp = relConcLookup!a!vp.r ++BIND;
-- cp = (assoc_cop_pref vp.comp_agr) ;
-- cb = (withPref ! vp.r) ++ BIND ++ vp.comp ;
-- asp = case vp.asp of {
-- Prog => progPref vform_main ;
-- _ => []
-- } ;
in
-- naively removed subject
rp.s ++
-- pcp ++
vp.s!RelCl!a!p!t!False ++
vp.iadv ++
vp.advs
} ;
rcl_with_eq_cop_predicate : RP -> VP -> { s : Agr => Polarity => BasicTense => Str } = \rp,vp -> {
s = \\a,p,t =>
let
vform_main = VFIndic RelCl p t ;
pcp = relConcLookup!a!vp.r ++BIND;
-- cb = (eqPref ! vp.r) ++ BIND ++ vp.comp ;
in
-- naively removed subject
rp.s ++
pcp ++
vp.s!RelCl!a!p!t!False ++
vp.iadv ++
vp.advs
} ;
rcl_with_descr_predicate : RP -> VP -> { s : Agr => Polarity => BasicTense => Str } = \rp,vp -> {
s = \\a,p,t =>
let
vform_main = VFIndic RelCl p t ;
pcp = pre_cop_pref vform_main a ;
-- adjf = aformN a ;
-- adjpref = relAdjAgrLookup!p!a ++BIND ;
-- comp = vp.ap_comp!adjf ++ vp.comp
in
rp.s ++
-- adjpref ++
vp.s!RelCl!a!p!t!False
++ vp.iadv ++ vp.advs
} ;
}

1937
src/zulu/ResZul.gf Executable file

File diff suppressed because it is too large Load Diff

256
src/zulu/SentenceZul.gf Executable file
View File

@@ -0,0 +1,256 @@
concrete SentenceZul of Sentence = CatZul ** open Prelude,ResZul,ParamX in {
flags optimize=all_subs ;
lin
PredVP np vp = case vp.vptype of {
CopIdent => comp_pred np vp ;
CopAssoc => comp_pred np vp ;
CopDescr => comp_pred np vp ;
CopLoc => comp_pred np vp ;
CopEq => cl_with_eq_cop_predicate np vp ;
-- VACompl => cl_with_ap_comp_predicate np vp ;
AdvComp => cl_with_adv_comp_predicate np vp ;
(NoComp | VNPCompl) =>
let
longform_suffix = case vp.hasComp of {
True => False ;
False => True
}
in {
s = \\p,t => np.s!NFull ++ (verb_prefix vp p t np.agr) ++ vp.s!MainCl!np.agr!p!t!longform_suffix ++ vp.comp ++ vp.iadv ++ vp.advs ;
} ;
_ => cl_with_verb_predicate np vp
} ;
-- PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp ;
ImpVP vp = let
np = {
empty = [] ;
s = table {NFull|NReduced|NPoss|NLoc => []} ;
-- loc = [] ;
-- desc = [] ;
-- det = [] ;
agr = Second Sg ;
i = nominit!(Second Sg) ;
proDrop = True ;
isPron = True ;
heavy = False
-- reqLocS = True ;
-- qdef = Article Spec
} ;
impTense = PresTense
in case vp.vptype of {
VNPCompl => {
s = table {
Pos => vp.s!MainCl!np.agr!Pos!impTense!False ++ vp.comp ++ vp.iadv ++ vp.advs ;
Neg => "unga" ++ vp.s!MainCl!np.agr!Neg!impTense!False ++ vp.comp ++ vp.iadv ++ vp.advs
}
} ;
CopIdent => {s = \\pol => (comp_pred np vp).s!pol!impTense } ;
CopAssoc => {s = \\pol => (comp_pred np vp).s!pol!impTense } ;
CopDescr => {s = \\pol => (comp_pred np vp).s!pol!impTense } ;
CopEq => {s = \\pol => (cl_with_eq_cop_predicate np vp).s!pol!impTense } ;
-- VACompl => {s = \\pol => (cl_with_ap_comp_predicate np vp).s!pol!impTense!Princ } ;
AdvComp => {s = \\pol => (cl_with_adv_comp_predicate np vp).s!pol!impTense } ;
_ => {s = \\pol => (imp_verb_predicate np vp).s!pol!impTense }
} ;
-- SlashVP np vp =
-- mkClause (np.s ! npNom) np.a vp ** {c2 = vp.c2} ;
--
-- AdvSlash slash adv = {
-- s = \\t,a,b,o => slash.s ! t ! a ! b ! o ++ adv.s ;
-- c2 = slash.c2
-- } ;
--
-- SlashPrep cl prep = cl ** {c2 = prep.s} ;
--
-- SlashVS np vs slash =
-- mkClause (np.s ! npNom) np.a
-- (insertObj (\\_ => conjThat ++ slash.s) (predV vs)) **
-- {c2 = slash.c2} ;
--
-- EmbedS s = {s = conjThat ++ s.s} ;
-- EmbedQS qs = {s = qs.s ! QIndir} ;
-- EmbedVP vp = {s = infVP VVInf vp False Simul CPos (agrP3 Sg)} ;
UseCl t p cl = {
s = t.s ++ p.s ++ cl.s ! p.p ! t.t
} ;
UseQCl t p cl = {
s = t.s ++ p.s ++ cl.s ! p.p ! t.t ;
-- potqs = t.s ++ p.s ++ cl.potqcl ! p.p ! Princ ;
qword_pre = cl.qword_pre ;
qword_post = cl.qword_post
} ;
UseRCl temp pol rcl = {
s = \\a => temp.s ++ pol.s ++ rcl.s!a!pol.p!temp.t ;
} ;
-- UseSlash t p cl = {
-- s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! ctr p.p ! oDir ;
-- c2 = cl.c2
-- } ;
--
-- AdvS a s = {s = a.s ++ s.s} ;
-- ExtAdvS a s = {s = a.s ++ frontComma ++ s.s} ;
--
-- SSubjS a s b = {s = a.s ++ frontComma ++ s.s ++ b.s} ;
--
-- RelS s r = {s = s.s ++ frontComma ++ r.s ! agrP3 Sg} ;
--
-- oper
-- ctr : CPolarity -> CPolarity = \x -> x ;
-- --- ctr = contrNeg True ; -- contracted negations
oper
comp_pred : NP -> VP -> { s : Polarity => BasicTense => Str } = \np,vp -> {
s = \\p,t =>
let
subj = np.s!NFull
in
subj ++
vp.s!MainCl!np.agr!p!t!False
++ vp.comp ++ vp.iadv ++ vp.advs
} ;
imp_verb_predicate : NP -> VP -> { s : Polarity => BasicTense => Str } = \np,vp -> {
s = \\p,t =>
let
subj = np.s!NFull ;
vform_main = VFIndic MainCl p t ;
in
impPref p
++ vp.s!MainCl!np.agr!p!t!False
++ vp.iadv
++ vp.comp
++ vp.advs
} ;
-- imp_verb_prefix : VP -> Polarity -> BasicTense -> Agr -> Str = \vp,p,t,agr ->
-- let
-- -- vow = case <vp.hasComp,vp.r,p,t> of {
-- vow = case <vp.hasComp,p,t,vp.r> of {
-- <False,Pos,PresTense,RC> => False ; -- force the compiler to understand the table
-- <False,Pos,PresTense,_> => False ; -- long form ya
--
-- <_,_,PresTense,RC> => False ;
-- <_,_,PresTense,_> => True ;
-- -- <_,Pos,PerfTense,RC> => False ;
-- -- <_,Pos,PerfTense,_> => True ;
-- <_,_,PastTense,RC> => False ;
-- <_,_,PastTense,_> => True ;
-- <_,_,RemPastTense,RC> => False ;
-- <_,_,RemPastTense,_> => True ;
-- <_,_,_,_> => False
-- } ;
-- vform = VFIndic MainCl p t
-- in
-- (negPref vform)
-- -- ++ (exclSePref vform_main)
-- ++ (subjConc vform agr vow)
-- -- ++ (negPref2 vform_main)
-- -- ++ (tensePref vform)
-- ;
cl_with_verb_predicate : NP -> VP -> { s : Polarity => BasicTense => Str } = \np,vp -> {
s = \\p,t =>
let
subj = np.s!NFull ;
vform_main = VFIndic MainCl p t ;
longform_suffix = case vp.hasComp of {
True => False ;
False => True
}
in
subj
++ (verb_prefix vp p t np.agr)
++ vp.s!MainCl!np.agr!p!t!longform_suffix
++ vp.iadv
++ vp.comp
++ vp.advs
} ;
verb_prefix : VP -> Polarity -> BasicTense -> Agr -> Str = \vp,p,t,agr ->
let
lfya = case <vp.hasComp,p,t,vp.r> of {
<False,Pos,PresTense,RC> => "ya" ++BIND ;
<False,Pos,PresTense,_> => "y" ++BIND ;
<_,_,_> => []
} ;
-- vow = case <vp.hasComp,vp.r,p,t> of {
vow = case <vp.hasComp,p,t,vp.r> of {
<False,Pos,PresTense,RC> => False ; -- force the compiler to understand the table
<False,Pos,PresTense,_> => False ; -- long form ya
<_,_,PresTense,RC> => False ;
<_,_,PresTense,_> => True ;
-- <_,Pos,PerfTense,RC> => False ;
-- <_,Pos,PerfTense,_> => True ;
<_,_,PastTense,RC> => False ;
<_,_,PastTense,_> => True ;
<_,_,RemPastTense,RC> => False ;
<_,_,RemPastTense,_> => True ;
<_,_,_,_> => False
} ;
vform = VFIndic MainCl p t
in
(negPref vform)
-- ++ (exclSePref vform_main)
++ (subjConc vform agr vow)
-- ++ (negPref2 vform_main)
++ lfya
-- ++ (tensePref vform)
;
-- TODO: aspect
cl_with_eq_cop_predicate : NP -> VP -> { s : Polarity => BasicTense => Str } = \np,vp -> {
s = \\p,t =>
let
vform_main = VFIndic MainCl p t ;
subj = np.s!NFull ;
pcp = pre_cop_pref vform_main np.agr ;
-- cb = (eqPref ! vp.r) ++ BIND ++ vp.comp ;
in
subj ++
-- pcp ++
vp.s!MainCl!np.agr!p!t!False
++ vp.comp ++ vp.iadv ++ vp.advs
} ;
cl_with_adv_comp_predicate : NP -> VP -> { s : Polarity => BasicTense => Str } = \np,vp -> {
s = \\p,t =>
let
subj = np.s!NFull ;
vform_main = VFIndic MainCl p t ;
vow = case <vp.r,p,t> of {
<RC,Pos,PresTense> => False ;
<_,Pos,PresTense> => True ;
<_,_,_> => False
} ;
lfya = case <vp.hasComp,p,t> of {
<False,Pos,PresTense> => "ya" ++BIND ;
<_,_,_> => []
} ;
reqLF = case vp.hasComp of {
True => False ;
False => True
}
in
subj ++
-- ++ (negPref vform_main)
-- -- ++ (exclSePref vform_main)
-- ++ (subjConc vform_main np.agr vow)
-- -- ++ (negPref2 vform_main)
-- ++ lfya
-- -- ++ (tensePref vform_main)
-- ++ vp.comp
vp.s!MainCl!np.agr!p!t!False
++ vp.comp ++ vp.iadv ++ vp.advs
} ;
}

169
src/zulu/StructuralZul.gf Executable file
View File

@@ -0,0 +1,169 @@
concrete StructuralZul of Structural = CatZul **
open
-- MorphoZul,
ResZul, ParadigmsZul, Prelude, ParamX in {
flags optimize=all ;
lin
-- AdA
-- almost_AdA = mkAdA "almost" ;
-- so_AdA = mkAdA "so" ;
-- too_AdA = mkAdA "too" ;
very_AdA = mkAdA "kakhulu" ;
-- AdN
-- almost_AdN = mkAdN "almost" ;
-- at_least_AdN = mkAdN "at least" ;
-- at_most_AdN = mkAdN "at most" ;
-- Adv
-- everywhere_Adv = mkAdv "everywhere" ;
-- here_Adv = mkAdv "here" ;
-- here7to_Adv = mkAdv ["to here"] ;
-- here7from_Adv = mkAdv ["from here"] ;
-- quite_Adv = mkAdv "quite" ;
-- somewhere_Adv = mkAdv "somewhere" ;
-- there_Adv = mkAdv "there" ;
-- there7to_Adv = mkAdv "there" ;
-- there7from_Adv = mkAdv ["from there"] ;
-- AdV
-- always_AdV = mkAdV "always" ;
-- CAdv
-- less_CAdv = mkCAdv "less" "no less" "than" ;
-- more_CAdv = mkCAdv "more" "no more" "than" ;
-- as_CAdv = mkCAdv "as" "not as" "as" ;
-- Conj
and_Conj = { s = \\_ => "futhi" ; fix = False } ;
-- both7and_DConj = mkConj "both" "and";
-- either7or_DConj = mkConj "either" "or" singular ;
-- or_Conj = mkConj "or" singular ;
-- if_then_Conj = mkConj "if" "then" singular ;
-- Det
-- every_Det = mkDeterminerSpec singular "every" "everyone" "everything" False ;
-- few_Det = mkDeterminer plural "few" ;
-- many_Det = mkDeterminer plural "many" ;
-- much_Det = mkDeterminer singular "much" ;
-- someSg_Det = mkDeterminer singular "some" ;
-- somePl_Det = mkDeterminer plural "some" ;
-- IAdv
how_IAdv = {s = "kanjani" ; postIAdv = False } ;
how8much_IAdv = {s = "kangakanani" ; postIAdv = False } ;
-- when_IAdv = ss "when" ;
-- where_IAdv = ss "where" ;
-- why_IAdv = ss "why" ;
-- IDet
-- how8many_IDet = mkDeterminer plural ["how many"] ;
-- whichPl_IDet = mkDeterminer plural ["which"] ;
-- whichSg_IDet = mkDeterminer singular ["which"] ;
-- IP
-- whatPl_IP = mkIP "what" "what" "what's" plural ;
-- whatSg_IP = mkIP "what" "what" "what's" singular ;
-- whoPl_IP = mkIP "who" "whom" "whose" plural ;
-- whoSg_IP = mkIP "who" "whom" "whose" singular ;
-- IQuant
-- which_IQuant = {s = \\_ => "which"} ;
-- NP
-- everybody_NP = regNP "everybody" singular ;
-- everything_NP = regNP "everything" singular ;
-- somebody_NP = regNP "somebody" singular ;
-- something_NP = regNP "something" singular ;
-- nobody_NP = regNP "nobody" singular ;
-- nothing_NP = regNP "nothing" singular ;
-- PConj
-- but_PConj = ss "but" ;
-- otherwise_PConj = ss "otherwise" ;
-- therefore_PConj = ss "therefore" ;
-- Predet
-- all_Predet = { s = "nke" ; isPost = True } ;
-- most_Predet = ss "most" ;
-- only_Predet = { s = "dwa" ; isPost = True } ;
-- not_Predet = { s : Str ; n : Number ; isPost : Bool }
-- Prep
-- above_Prep = mkPrep "above" ;
-- after_Prep = mkPrep "after" ;
-- before_Prep = mkPrep "before" ;
-- behind_Prep = mkPrep "behind" ;
-- between_Prep = mkPrep "between" ;
-- by8agent_Prep = mkPrep "by" ;
-- by8means_Prep = mkPrep "by" ;
-- during_Prep = mkPrep "during" ;
-- for_Prep = mkPrep "for" ;
-- from_Prep = mkPrep "from" ;
-- in8front_Prep = mkPrep ["in front of"] ;
-- in_Prep = mkPrep "in" ;
-- on_Prep = mkPrep "on" ;
-- part_Prep = mkPrep "of" ;
-- possess_Prep = mkPrep "of" ;
-- through_Prep = mkPrep "through" ;
-- to_Prep = mkPrep "to" ;
-- under_Prep = mkPrep "under" ;
-- without_Prep = mkPrep "without" ;
-- with_Prep = mkPrep "with" ;
-- except_Prep = mkPrep "except" ;
-- Pron
i_Pron = mkPron (First Sg) ;
we_Pron = mkPron (First Pl) ;
youSg_Pron = mkPron (Second Sg) ;
youPl_Pron = mkPron (Second Pl) ;
he_Pron = mkPron (Third C1_2 Sg) ;
it_Pron = mkPron (Third C3_4 Sg) ;
she_Pron = mkPron (Third C1_2 Sg) ;
they_Pron = mkPron (Third C1_2 Pl) ;
-- youPol_Pron = mkPron "you" "you" "your" "yours" singular P2 human ;
-- Quant (we use this category for demonstratives only)
that_Quant = {
s = \\b,a => dem_pron!Dem2!a ;
dist = Dem2
} ;
-- this_Quant = { s = [] ; dist = Dem1 } ;
this_Quant = {
s = \\b,a => case b of {
False => dem_pron!Dem1!a ;
True => dem_pron!Dem1!a ++ dem_pron_na!a
} ;
dist = Dem1
} ;
-- no_Quant = mkQuant "no" "no" "none" "none" ;
-- Subj
-- although_Subj = ss "although" ;
-- because_Subj = ss "because" ;
-- if_Subj = ss "if" ;
-- when_Subj = ss "when" ;
-- that_Subj = ss "that" ;
-- Utt
-- no_Utt = ss "no" ;
-- yes_Utt = ss "yes" ;
language_title_Utt = ss "Zulu" ;
-- Voc
-- please_Voc = ss "please" ;
-- V2
-- have_V2 = dirV2 (mk5V "have" "has" "had" "had" "having") ;
-- VV
-- can8know_VV
-- can_VV
-- must_VV
}

45
src/zulu/SymbolZul.gf Executable file
View File

@@ -0,0 +1,45 @@
--# -path=.:../abstract:../common:../prelude
concrete SymbolZul of Symbol = CatZul ** open Prelude, ResZul in {
-- lin
-- SymbPN i = {s = addGenitiveS i.s ; g = Neutr} ;
-- IntPN i = {s = addGenitiveS i.s ; g = Neutr} ;
-- FloatPN i = {s = addGenitiveS i.s ; g = Neutr} ;
-- NumPN i = {s = i.s ! False ; g = Neutr} ;
-- CNIntNP cn i = {
-- s = \\c => cn.s ! Sg ! Nom ++ (addGenitiveS i.s) ! npcase2case c ;
-- a = agrgP3 Sg cn.g
-- } ;
-- CNSymbNP det cn xs = {
-- s = \\c => det.s ++ cn.s ! det.n ! Nom ++ (addGenitiveS xs.s) ! npcase2case c ;
-- a = agrgP3 det.n cn.g
-- } ;
-- CNNumNP cn i = {
-- s = \\c => cn.s ! Sg ! Nom ++ i.s ! False ! npcase2case c ;
-- a = agrgP3 Sg cn.g
-- } ;
--
-- SymbS sy = sy ;
--
-- SymbNum sy = { s,sp = \\_ => addGenitiveS sy.s ; n = Pl ; hasCard = True } ;
-- SymbOrd sy = { s = \\c => sy.s ++ (regGenitiveS "th")!c} ;
--
lincat
Symb = { s : Str } ;
-- [Symb] = SS ;
lin
MkSymb s = s ;
-- BaseSymb = infixSS "and" ;
-- ConsSymb = infixSS frontComma ;
--
-- oper
-- -- Note: this results in a space before 's, but there's
-- -- not mauch we can do about that.
-- addGenitiveS : Str -> Case => Str = \s ->
-- table { Gen => s ++ BIND ++ "'s"; _ => s } ;
}

9
src/zulu/TempExtZul.gf Executable file
View File

@@ -0,0 +1,9 @@
concrete TempExtZul of TempExt = CatZul ** open ResZul in {
lin
TPresTemp = { s = [] ; t = PresTense } ;
TPastTemp = { s = [] ; t = PastTense } ;
TFutTemp = { s = [] ; t = FutTense } ;
TRemFutTemp = { s = [] ; t = RemFutTense } ;
TRemPastTemp = { s = [] ; t = RemPastTense } ;
}

106
src/zulu/TerminologyZul.gf Executable file
View File

@@ -0,0 +1,106 @@
--# -path=.:../abstract:../common
concrete TerminologyZul of Terminology = CatZul ** open
ResZul,
ParadigmsZul,
(G = GrammarZul),
(S = SyntaxZul),
(L = LexiconZul),
Prelude
in {
-- lincat
-- Category = G.N ;
-- ParameterType = G.N ;
-- Parameter = G.N ;
-- Modifier = G.A ;
--
-- lin
-- noun_Category = mkN "noun" ;
-- adjective_Category = mkN "adjective" ;
-- verb_Category = mkN "verb" ;
-- adverb_Category = mkN "adverb" ;
-- preposition_Category = mkN "preposition" ;
-- numeral_Category = mkN "numeral" ;
-- pronoun_Category = mkN "pronoun" ;
-- determiner_Category = mkN "determiner" ;
-- article_Category = mkN "article" ;
--
-- gender_ParameterType = mkN "Gender" ;
-- finite_form_ParameterType = mkN "finite form" ;
-- nominal_form_ParameterType = mkN "nominal form" ;
--
-- singular_Parameter = mkN "singular" ;
-- plural_Parameter = mkN "plural" ;
--
-- masculine_Parameter = mkN "masculine" ;
-- feminine_Parameter = mkN "feminine" ;
-- neuter_Parameter = mkN "neuter" ;
-- uter_Parameter = mkN "uter" ;
--
-- nominative_Parameter = mkN "nominative" ;
-- genitive_Parameter = mkN "genitive" ;
-- dative_Parameter = mkN "dative" ;
-- accusative_Parameter = mkN "accusative" ;
--
-- partitive_Parameter = mkN "partitive" ;
-- translative_Parameter = mkN "translative" ;
-- essive_Parameter = mkN "essive" ;
-- inessive_Parameter = mkN "inessive" ;
-- elative_Parameter = mkN "elative" ;
-- illative_Parameter = mkN "illative" ;
-- adessive_Parameter = mkN "adessive" ;
-- ablative_Parameter = mkN "ablative" ;
-- allative_Parameter = mkN "allative" ;
-- abessive_Parameter = mkN "abessive" ;
-- comitative_Parameter = mkN "comitative" ;
-- instructive_Parameter = mkN "instructive" ;
--
-- active_Parameter = mkN "active" ;
-- passive_Parameter = mkN "passive" ;
-- middle_Parameter = mkN "middle" ;
--
-- imperative_Parameter = mkN "imperative" ;
-- indicative_Parameter = mkN "indicative" ;
-- conjunctive_Parameter = mkN "conjunctive" ;
-- infinitive_Parameter = mkN "infinitive" ;
--
-- definite_Parameter = mkN "definite" ;
-- indefinite_Parameter = mkN "indefinite" ;
--
-- present_Parameter = mkN "present" ;
-- past_Parameter = mkN "past" ;
-- future_Parameter = mkN "future" ;
-- conditional_Parameter = mkN "conditional" ;
-- potential_Parameter = mkN "potential" ;
-- perfect_Parameter = mkN "perfect" ;
-- imperfect_Parameter = mkN "imperfect" ;
-- supine_Parameter = mkN "supine" ;
-- agent_Parameter = mkN "agent" ;
-- simple_past_Parameter = mkN "simple past" ;
--
-- participle_Parameter = mkN "participle" ;
-- aux_verb_Parameter = mkN "auxiliary" ;
-- gerund_Parameter = mkN "Gerund" ;
--
-- positive_Parameter = mkN "positive" ;
-- comparative_Parameter = mkN "comparative" ;
-- superlative_Parameter = mkN "superlative" ;
-- predicative_Parameter = mkN "predicative" ;
-- negative_Parameter = mkN "negative" ;
--
-- short_Parameter = mkN "short" ; --- adjective
-- long_Parameter = mkN "long" ;
--
-- strong_Parameter = mkN "strong" ; --- adjective
-- weak_Parameter = mkN "weak" ;
--
-- nounHeading n = ss (n.s ! Sg ! Nom) ;
-- nounPluralHeading n = ss (n.s ! Pl ! Nom) ;
--
-- exampleGr_N = mkN "example" ;
-- formGr_N = mkN "form" ;
}

152
src/zulu/VerbExtZul.gf Normal file
View File

@@ -0,0 +1,152 @@
concrete VerbExtZul of VerbExt = CatZul,CatExtZul ** open ResZul, Prelude, ParamX in {
lin
CopAP ap = {
s = case ap.t of {
AdjType => table {
MainCl => \\a,p,t,l => let
vform = VFIndic MainCl p t ;
pcp = ap_cop_pref vform a AdjType ; -- u- / uzoba / ube- / waye- / wayenge-
adjpref = adjPref a vform ; -- m-
cop_base = ap.s!(aformN a) -- khulu
in
pcp ++ adjpref ++ cop_base ;
RelCl => \\a,p,t,l => let
vform = VFIndic RelCl p t ;
rcp = shortRelConc!a ; -- o-
pcp = ap_cop_pref vform a AdjType ; -- [] / -nge- / zoba / -be- / -benge- -waye- / -wayenge-
adjpref = adjPref a vform ; -- m-
cop_base = ap.s!(aformN a) -- khulu
in
rcp ++ pcp ++ adjpref ++ cop_base
} ;
RelType => table {
MainCl => \\a,p,t,l => let
vform = VFIndic MainCl p t ;
pcp = ap_cop_pref vform a RelType ; -- u-
cop_base = ap.s!AF1 -- qotho
in
pcp ++ cop_base ;
RelCl => \\a,p,t,l => let
vform = VFIndic RelCl p t ;
rcp = (relConcCop vform a RC) ; -- o-
pcp = ap_cop_pref vform a RelType ; -- [] / -nge- / zoba / -benge-
cop_base = ap.s!AF1 -- qotho
in
rcp ++ pcp ++ cop_base
}
} ;
comp, iadv, advs = [] ;
hasComp = True ;
r = RC ; -- should not be used
syl = SylMult ;
vptype = CopDescr
} ;
CopNP np = {
s = table {
MainCl => \\a,p,t,l => let
vform = VFIndic MainCl p t ;
pcp = (id_pre_cop_pref vform a) ; -- u- / uzoba / akazukuba
cp = (id_cop_pref np.agr) ; -- ng-
cop_base = np.s!NFull -- umfundi
in
pcp ++ cp ++ cop_base ;
RelCl => \\a,p,t,l => let
vform = VFIndic RelCl p t ;
rcp = (relConcCop vform a RC) ; -- o-
pcp = (id_pre_cop_pref vform a) ; -- [] / zoba / zukuba
cp = (id_cop_pref np.agr) ; -- ng-
cop_base = np.s!NFull -- umfundi
in
rcp ++ pcp ++ cp ++ cop_base
} ;
comp, iadv, advs = [] ;
hasComp = np.heavy ;
r = RC ; -- should not be used
syl = SylMult ;
vptype = CopIdent
} ;
CopNPAssoc np = {
s = table {
MainCl => \\a,p,t,l => let
vform = VFIndic MainCl p t ;
pcp = (assoc_pre_cop_pref vform a) ; -- u- / uzoba
cp = (assoc_cop_pref p np.agr) ; -- ne-
cop_base = np.s!NReduced -- moto
in
pcp ++ cp ++ cop_base ;
RelCl => \\a,p,t,l => let
vform = VFIndic RelCl p t ;
rcp = (relConcCop vform a RC) ; -- o-
pcp = (assoc_pre_cop_pref vform a) ; -- [] / zoba
cp = (assoc_cop_pref p np.agr) ; -- ne
cop_base = np.s!NReduced -- moto
in
rcp ++ pcp ++ cp ++ cop_base
} ;
comp, iadv, advs = [] ;
hasComp = np.heavy ;
r = RC ; -- should not be used
syl = SylMult ;
vptype = CopAssoc
} ;
ComplV2Nonspec v2 np = {
s = table {
MainCl => \\a,p,t,l => let
vform = VFIndic MainCl p t ;
tp = tensePref vform v2.r v2.syl ;
oc = objConc np.agr v2.r v2.syl ;
longform = case np.heavy of {
True => False ;
False => True
} ;
r = v2.s!(rform (VFIndic MainCl p t) longform) ;
obj = case p of {
Pos => np.s!NFull ;
Neg => np.s!NReduced
} ;
in case np.proDrop of {
True => tp ++ oc ++ r ++ obj ;
False => tp ++ r ++ obj
} ;
RelCl => \\a,p,t,l => let
vform = (VFIndic RelCl p t) ;
rc = relConc vform a v2.r ;
tp = tensePref vform v2.r v2.syl ;
oc = objConc np.agr v2.r v2.syl ;
longform = case np.heavy of {
True => False ;
False => True
} ;
r = v2.s!(rform vform longform) ;
obj = case p of {
Pos => np.s!NFull ;
Neg => np.s!NReduced
} ;
in case np.proDrop of {
True => rc ++ tp ++ oc ++ r ++ obj ;
False => rc ++ tp ++ r ++ obj
}
} ;
iadv, advs, comp = [] ;
ap_comp = \\_ => [] ;
hasComp = np.heavy ;
r = v2.r ;
syl = v2.syl ;
vptype = VNPCompl
} ;
CopLoc loc = {
s = \\c,a,p,t,l => loc.s!c!a!p!t ;
comp,advs,iadv = [] ;
hasComp = True ;
r = RC ;
syl = SylMult ;
vptype = CopLoc
} ;
}

Some files were not shown because too many files have changed in this diff Show More