1
0
forked from GitHub/gf-rgl
This commit is contained in:
Inari Listenmaa
2020-02-07 11:01:36 +01:00
65 changed files with 49185 additions and 48318 deletions

View File

@@ -4,3 +4,6 @@ gt MkDocument (NoDefinition "") (InflectionN ?) "" | l | wf -file="example-table
gt MkDocument (NoDefinition "") (InflectionA ?) "" | l | wf -append -file="example-tables.html"
gt MkDocument (NoDefinition "") (InflectionV ?) "" | l | wf -append -file="example-tables.html"
gt MkDocument (NoDefinition "") (InflectionV2 ?) "" | l | wf -append -file="example-tables.html"
gt MkDocument (NoDefinition "") (InflectionV3 ?) "" | l | wf -append -file="example-tables.html"
gt MkDocument (NoDefinition "") (InflectionVV ?) "" | l | wf -append -file="example-tables.html"
gt MkDocument (NoDefinition "") (InflectionV2V ?) "" | l | wf -append -file="example-tables.html"

View File

@@ -46,7 +46,7 @@ abstract functions and their Universal Dependency labels
- Paper "The GF Resource Grammar Library" by A. Ranta
(//Linguistic Issues in Language Technology//, 2 (2), 2009). An overview of
the library with linguistic motivations.
[PDF https://journals.linguisticsociety.org/elanguage/lilt/article/download/214/214-501-1-PB.pdf]
[PDF http://journals.linguisticsociety.org/elanguage/lilt/article/download/214/214-501-1-PB.pdf]
- Paper "Grammars as Software Libraries" by A. Ranta
(In Y. Bertot, G. Huet, J-J. Lévy, and G. Plotkin (eds.),
//From Semantics to Computer Science//, Cambridge University Press,

View File

@@ -45,6 +45,13 @@ abstract Extend = Cat ** {
MkVPS : Temp -> Pol -> VP -> VPS ; -- hasn't slept
ConjVPS : Conj -> [VPS] -> VPS ; -- has walked and won't sleep
PredVPS : NP -> VPS -> S ; -- she [has walked and won't sleep]
SQuestVPS : NP -> VPS -> QS ; -- has she walked
QuestVPS : IP -> VPS -> QS ; -- who has walked
-- existentials that work in the absence of Cl
ExistS : Temp -> Pol -> NP -> S ; -- there was a party
ExistNPQS : Temp -> Pol -> NP -> QS ; -- was there a party
ExistIPQS : Temp -> Pol -> IP -> QS ; -- what was there
MkVPI : VP -> VPI ; -- to sleep (TODO: Ant and Pol)
ConjVPI : Conj -> [VPI] -> VPI ; -- to sleep and to walk

View File

@@ -1180,6 +1180,8 @@ incomplete resource Constructors = open Grammar in { --%
= \a,p -> TUseQCl TPres a p ; --%
mkQS : (Tense) -> (Ant) -> (Pol) -> QCl -> QS -- who wouldn't have slept
= TUseQCl ; --%
mkQS : Temp -> Pol -> QCl -> QS -- who wouldn't have slept --%
= UseQCl ; --%
-- Since 'yes-no' question clauses can be built from clauses (see below),
-- we give a shortcut

View File

@@ -422,7 +422,7 @@ oper
in {s = mkNoun (v0+"ĺę")
(v0+"éöč")
(v0+"ĺęŕ")
(v0+"î")
(v0+"éî")
g ;
rel = \\_ => base ; relPost = False ;
g = g ;

View File

@@ -117,6 +117,14 @@ lin
UttDatIP ip = UttAccIP (lin IP ip) ; -- whom (dative) ; DEFAULT who
UttVPShort = UttVP ; -- have fun, as opposed to "to have fun" ; DEFAULT UttVP
SQuestVPS = variants {} ; -- : NP -> VPS -> QS ; -- has she walked
QuestVPS = variants {} ; -- : IP -> VPS -> QS ; -- who has walked
-- these will probably not need language-specific implementations
ExistS t p np = UseCl t p (ExistNP np) ;
ExistNPQS t p np = UseQCl t p (QuestCl (ExistNP np)) ;
ExistIPQS t p np = UseQCl t p (ExistIP np) ;
oper
quoted : Str -> Str = \s -> "\"" ++ s ++ "\"" ; ---- TODO bind ; move to Prelude?

View File

@@ -1,7 +1,7 @@
UseV,ComplVV,ComplVS,ComplVQ,ComplVA,SlashV2a,SlashV2V,SlashV2A,SlashV2S,Slash2V3,Slash3V3,UseComp,ProgrVP,PassV2 {"not","don't","doesn't","didn't","haven't","hasn't","hadn't","wouldn't","won't","isn't","aren't","wasn't","weren't"} PART neg head
UseV,ComplVV,ComplVS,ComplVQ,ComplVA,SlashV2a,SlashV2V,SlashV2A,SlashV2S,Slash2V3,Slash3V3,UseComp,ProgrVP,PassV2 {"has","had","have","will","would","do","does","did"} AUX aux head
UseV,ComplVV,ComplVS,ComplVQ,ComplVA,SlashV2a,SlashV2V,SlashV2A,SlashV2S,Slash2V3,Slash3V3,UseComp,CompAdv,CompNP,CompAP,CompCN,ProgrVP,PassV2 {"not","don't","doesn't","didn't","haven't","hasn't","hadn't","wouldn't","won't","isn't","aren't","wasn't","weren't"} PART neg head
UseV,ComplVV,ComplVS,ComplVQ,ComplVA,SlashV2a,SlashV2V,SlashV2A,SlashV2S,Slash2V3,Slash3V3,UseComp,CompAdv,CompNP,CompAP,CompCN,ProgrVP,PassV2 {"has","had","have","will","would","do","does","did"} AUX aux head
UseV,UseComp {"to"} PART mark head
UseComp,ProgrVP,QuestIComp {"is","are","am","was","were","been","be"} VERB cop head
UseComp,CompAdv,CompAP,CompNP,CompCN,ProgrVP,QuestIComp {"is","are","am","was","were","been","be"} VERB cop head
CompCN {"a","an"} DET det head
PassV2 {"is","are","am","was","were""been","be"} VERB auxpass head
ComplVV {"to"} PART mark xcomp

View File

@@ -21,7 +21,7 @@
-- a few arguments. In Finnish, one argument is enough in 80-90% of
-- cases in average.
resource ParadigmsFin = open
resource ParadigmsFin = Kotus ** open
(Predef=Predef),
Prelude,
MorphoFin,

View File

@@ -106,44 +106,44 @@ oper
_ => grand + "e"
}
in
mkAdj grand (grand + "s") grande (grande + "ment") ;
mkAdj grand grande (grand + "s") (grande + "ment") ;
-- Masculine form used for adverbial; also covers "carré".
adjJoli : Str -> Adj = \joli ->
mkAdj joli (joli + "s") (joli + "e") (joli + "ment") ;
mkAdj joli (joli + "e") (joli + "s") (joli + "ment") ;
adjHeureux : Str -> Adj = \heureux ->
let {heureu = Predef.tk 1 heureux} in
mkAdj heureux heureux (heureu+"se") (heureu+"sement") ;
mkAdj heureux (heureu+"se") heureux (heureu+"sement") ;
adjBanal : Str -> Adj = \banal ->
let {bana = Predef.tk 1 banal} in
mkAdj banal (bana + "ux") (banal+"e") (banal+"ement") ;
mkAdj banal (banal + "e") (bana+"ux") (banal+"ement") ;
adjJeune : Str -> Adj = \jeune ->
mkAdj jeune (jeune+"s") jeune (jeune+"ment") ;
mkAdj jeune jeune (jeune+"s") (jeune+"ment") ;
adjIndien : Str -> Adj = \indien ->
mkAdj indien (indien+"s") (indien+"ne") (indien+"nement") ;
mkAdj indien (indien+"ne") (indien+"s") (indien+"nement") ;
adjTel : Str -> Adj = \tel ->
mkAdj tel (tel+"s") (tel+"le") (tel+"lement") ;
mkAdj tel (tel+"le") (tel+"s") (tel+"lement") ;
adjFrancais : Str -> Adj = \francais ->
mkAdj francais francais (francais+"e") (francais+"ement") ;
mkAdj francais (francais+"e") francais (francais+"ement") ;
adjCher : Str -> Adj = \cher ->
let {ch = Predef.tk 2 cher} in
mkAdj cher (cher + "s") (ch + "ère") (ch + "èrement") ;
mkAdj cher (ch + "ère") (cher + "s") (ch + "èrement") ;
adjPublic : Str -> Adj = \public ->
let publique = init public + "que" in
mkAdj public (public+"s") (publique) (publique+"ment") ;
mkAdj public publique (public+"s") (publique+"ment") ;
adjVif : Str -> Adj = \vif ->
let vive = init vif + "ve" in
mkAdj vif (vif+"s") (vive) (vive+"ment") ;
mkAdj vif vive (vif+"s") (vive+"ment") ;
mkAdjReg : Str -> Adj = \creux ->
case Predef.dp 3 creux of {

View File

@@ -8,12 +8,12 @@ concrete AdjectiveLat of Adjective = CatLat ** open ResLat, Prelude in {
-- ComparA : A -> NP -> AP ; -- warmer than I
ComparA a np = {
s = \\ag => a.s ! Compar ! ag ++ "quam" ++ (combineNounPhrase np) ! PronNonDrop ! Nom ;
s = \\ag => a.s ! Compar ! ag ++ "quam" ++ (combineNounPhrase np) ! PronNonDrop ! APostN ! DPreN ! Nom ;
} ;
-- ComplA2 : A2 -> NP -> AP ; -- married to her
ComplA2 a np = {
s = \\ag => a.s ! Posit ! ag ++ a.c.s ++ (combineNounPhrase np) ! PronNonDrop ! a.c.c ;
s = \\ag => a.s ! Posit ! ag ++ a.c.s ++ (combineNounPhrase np) ! PronNonDrop ! APostN ! DPreN ! a.c.c ;
} ;
-- ReflA2 : A2 -> AP -- married to myself
@@ -31,7 +31,7 @@ concrete AdjectiveLat of Adjective = CatLat ** open ResLat, Prelude in {
-- CAdvAP : CAdv -> AP -> NP -> AP ; -- as cool as John
CAdvAP cadv ap np =
{ s = \\ag => cadv.s ++ ap.s ! ag ++ cadv.p ++ (combineNounPhrase np) ! PronNonDrop ! Nom } ;
{ s = \\ag => cadv.s ++ ap.s ! ag ++ cadv.p ++ (combineNounPhrase np) ! PronNonDrop ! APostN ! DPreN ! Nom } ;
-- The superlative use is covered in $Ord$.

View File

@@ -8,16 +8,16 @@ concrete AdverbLat of Adverb = CatLat ** open ResLat, Prelude, ParadigmsLat in
-- PrepNP : Prep -> NP -> Adv ; -- in the house
PrepNP prep np =
mkAdv (prep.s ++ np.adv ++ (combineNounPhrase np) ! PronNonDrop ! prep.c ) ;
mkAdv (prep.s ++ (combineNounPhrase np) ! PronNonDrop ! APostN ! DPreN ! prep.c ) ;
-- ComparAdvAdj : CAdv -> A -> NP -> Adv ; -- more warmly than John
ComparAdvAdj cadv a np =
mkAdv (cadv.s ++ a.adv.s ! Compar ++ cadv.p ++ (combineNounPhrase np) ! PronNonDrop ! Nom) ;
mkAdv (cadv.s ++ a.adv.s ! Compar ++ cadv.p ++ (combineNounPhrase np) ! PronNonDrop ! APostN ! DPreN ! Nom) ;
-- ComparAdvAdjS : CAdv -> A -> S -> Adv ; -- more warmly than he runs
ComparAdvAdjS cadv a s =
mkAdv (cadv.s ++ a.adv.s ! Compar ++ cadv.p ++ combineSentence s ! SPreS ! PreV ! CPreV ! SOV ) ;
mkAdv (cadv.s ++ a.adv.s ! Compar ++ cadv.p ++ defaultSentence s ! SOV ) ;
-- AdAdv : AdA -> Adv -> Adv ; -- very quickly
AdAdv ada adv = mkAdv (ada.s ++ (adv.s ! Posit) ) ;
@@ -29,7 +29,7 @@ concrete AdverbLat of Adverb = CatLat ** open ResLat, Prelude, ParadigmsLat in
-- Subordinate clauses can function as adverbs.
-- SubjS : Subj -> S -> Adv ; -- when she sleeps
SubjS subj s = mkAdv (subj.s ++ combineSentence s ! SPreS ! PreV ! CPreV ! SOV ) ;
SubjS subj s = mkAdv (subj.s ++ defaultSentence s ! SOV ) ;
-- AdnCAdv : CAdv -> AdN ; -- less (than five)
AdnCAdv cadv = {s = cadv.s ++ cadv.p} ;

View File

@@ -8,6 +8,7 @@ concrete CatLat of Cat = CommonX-[Adv] ** open ResLat, ParamX, Prelude in {
--
S = Sentence ;
QS = {s : QForm => Str} ;
RS = { s : Gender => Number => Str } ; -- Sentence ;
-- RS = {s : Agr => Str ; c : Case} ; -- c for it clefts
-- SSlash = {s : Str ; c2 : Str} ;
--
@@ -28,11 +29,11 @@ concrete CatLat of Cat = CommonX-[Adv] ** open ResLat, ParamX, Prelude in {
--
---- Relative
--
-- RCl = {
RCl = { s : Gender => Number => Clause };
-- s : ResLat.Tense => Anteriority => CPolarity => Agr => Str ;
-- c : Case
-- } ;
-- RP = {s : RCase => Str ; a : RAgr} ;
RP = {s : Agr => Str } ;
--
---- Verb
--
@@ -87,9 +88,9 @@ concrete CatLat of Cat = CommonX-[Adv] ** open ResLat, ParamX, Prelude in {
A2 = Adjective ** { c : Prep} ;
linref
NP = \np -> combineNounPhrase np ! PronNonDrop ! Nom ;
NP = \np -> combineNounPhrase np ! PronNonDrop ! APreN ! DPostN ! Nom ;
VP = \vp -> vp.adv ++ vp.inf ! VInfActPres ++ vp.obj ++ vp.compl ! Ag Masc Sg Nom ;
S = \s -> combineSentence s ! SPreO ! PreO ! CPreV ! SOV ;
S = \s -> defaultSentence s ! SOV ;
V, VS, VQ, VA, VV = \v -> v.act ! (VAct VSim (VPres VInd) Sg P1) ;
V2, V2A, V2Q, V2S = \v -> v.act ! (VAct VSim (VPres VInd) Sg P1) ;
Pron = \p -> p.pers.s ! PronNonDrop ! PronNonRefl ! Nom ;

View File

@@ -11,14 +11,16 @@ concrete ConjunctionLat of Conjunction =
ConjS conj ss = {
-- s = \\apos => coord conj.c { init = (ss.s ! conj.c).init ! SPreS ! apos ! CPreV ! SOV ;
-- last = (ss.s ! conj.c).last ! SPreS ! apos ! CPreV ! SOV} ;
s = \\apos => conj.s1 ++ (ss.s ! conj.c).init ! SPreS ! apos ! CPreV ! SOV ++ conj.s2 ++
(ss.s ! conj.c).last ! SPreS ! apos ! CPreV ! SOV ++ conj.s3 ;
s = \\apos => conj.s1 ++ (ss.s ! conj.c).init ! SAPreS ! apos ! DPreN ! VReg ! CPreV ! SOV ++ conj.s2 ++
(ss.s ! conj.c).last ! SAPreS ! apos ! DPreN ! VReg ! CPreV ! SOV ++ conj.s3 ;
o = \\_ => [] ;
v = \\_,_ => [] ;
v = \\_ => [] ;
neg = \\_ => [] ;
compl = [] ;
p = ss.p ;
sadv = [] ;
t = ss.t
t = ss.t ;
det = { s, sp = \\_ => [] } ;
} ;
-- ConjAdv : Conj -> ListAdv -> Adv ; -- here or there
@@ -34,14 +36,13 @@ concrete ConjunctionLat of Conjunction =
-- } ;
-- c => (conjunctDistrTable Case conj (nps.l ! Et)).s
-- } ;
s = \\pd,ca => conj.s1 ++ (nps.s ! conj.c).init ! pd ! ca ++ conj.s2 ++ (nps.s ! conj.c).last ! pd ! ca ++ conj.s3 ;
s = \\pd,ca => conj.s1 ++ (nps.s ! conj.c).init ! pd ! APreN ! DPreN ! ca ++ conj.s2 ++ (nps.s ! conj.c).last ! pd ! APreN ! DPreN ! ca ++ conj.s3;
n = case conj.c of { Et => Pl ; _ => nps.n } ;
g = nps.g ;
p = nps.p ;
adv = nps.adv ;
preap = nps.preap ;
postap = nps.postap ;
det = nps.det
adv = "" ;
preap , postap = { s = \\_ => "" };
det = { s , sp = \\_ => ""} ;
} ;
-- ConjAP : Conj -> ListAP -> AP ;
@@ -61,8 +62,12 @@ concrete ConjunctionLat of Conjunction =
-- isPre = ss.isPre
-- } ;
---}
--
---- These fun's are generated from the list cat's.
--
-- ConjRS : Conj -> ListRS -> RS
ConjRS conj rss = { s = \\g,n => conj.s1 ++ (rss.s ! conj.c).init ! g ! n ++ conj.s2 ++ (rss.s ! conj.c).last ! g ! n++ conj.s3 };
---- These fun's are generated from the list cat's.
--
-- BaseS : S -> S -> ListS
@@ -77,7 +82,7 @@ concrete ConjunctionLat of Conjunction =
-- ConsS x xs = { l = \\_ => consrSS bindComma (ss (x.s ! PreS)) (xs.l ! Comma) };
ConsS s ss = {
s = \\co =>
{ init = \\s,a,c,o => coord co { init = (ss.s ! co).init ! s ! a ! c ! o ; last = (ss.s ! co).last ! s ! a ! c ! o } ;
{ init = \\s,a,d,v,c,o => coord co { init = (ss.s ! co).init ! s ! a ! d ! v ! c ! o ; last = (ss.s ! co).last ! s ! a ! d ! v ! c ! o } ;
last = combineSentence s } ;
p = s.p ;
t = s.t
@@ -99,29 +104,21 @@ concrete ConjunctionLat of Conjunction =
-- -- BaseNP : NP -> NP -> ListNP ; -- John, Mary
BaseNP x y = {
-- s = \\c => twoTable Case x y ;
s = \\c => { init = x.s ; last = y.s } ;
g = Masc ; -- Just guessing (but maybe sexist bullshit)
s = \\c => { init = combineNounPhrase x ; last = combineNounPhrase y } ;
g = Neutr ; -- Trying to avoid trouble by choosing a gender
n = matchNumber x.n y.n ;
p = P3 ;
adv = x.adv ++ y.adv ;
preap = lin AP { s = \\a => x.preap.s ! a ++ y.preap.s ! a } ;
postap = lin AP { s = \\a => x.postap.s ! a ++ y.postap.s ! a } ;
isBase = True ;
det = lin Det { s = \\g,c => x.det.s ! g ! c ++ y.det.s ! g ! c ; sp = \\g,c => x.det.sp ! g ! c ++ y.det.sp ! g ! c ; n = matchNumber x.det.n y.det.n } ;
} ;
-- -- ConsNP : NP -> ListNP -> ListNP ; -- John, Mary, Bill
ConsNP x xs = {
-- s = \\_ => consrTable Case bindComma x ( xs.s ! Comma );
s = \\co => { init = \\pd,ca => coord co { init = (xs.s ! co).init ! pd ! ca ; last = (xs.s ! co).last ! pd ! ca} ; last = x.s } ;
s = \\co => { init = \\pd,ap,dp,ca => coord co { init = (xs.s ! co).init ! pd ! ap ! dp ! ca ; last = (xs.s ! co).last ! pd ! ap ! dp ! ca} ; last = combineNounPhrase x } ;
n = matchNumber x.n xs.n ;
g = xs.g ;
p = xs.p ;
adv = x.adv ++ xs.adv ;
preap = lin AP { s = \\a => x.preap.s ! a ++ xs.preap.s ! a } ;
postap = lin AP { s = \\a => x.postap.s ! a ++ xs.postap.s ! a } ;
isBase = False ;
det = lin Det { s = \\g,c => x.det.s ! g ! c ++ xs.det.s ! g ! c ; sp = \\g,c => x.det.sp ! g ! c ++ xs.det.sp ! g ! c ; n = matchNumber x.det.n xs.det.n } ; -- try to combine the determiners, probably not what we want
} ;
-- -- BaseAP : AP -> AP -> ListAP
@@ -130,13 +127,21 @@ concrete ConjunctionLat of Conjunction =
-- -- ConsAP : AP -> ListAP -> ListAP
-- ConsAP x xs =
-- { l = \\_ => consrTable Agr and_Conj.s2 x (xs.l ! Comma ) } ;
-- BaseRS : RS -> RS -> ListRS ;
BaseRS rs1 rs2 = { s = \\co => { init = rs1.s ; last = rs2.s }} ;
-- ConsRS : RS -> List RS -> ListRS ;
ConsRS rs rss = { s = \\co => { init = rs.s ; last = \\g,n => coord co { init = (rss.s ! co).init ! g ! n ; last = (rss.s ! co).last ! g ! n } } } ;
--
lincat
[S] = { s : Coordinator => {init,last : SAdvPos => AdvPos => ComplPos => Order => Str} ; p : Pol ; t : Tense } ; -- TO FIX
[S] = { s : Coordinator => {init,last : SAdvPos => AdvPos => DetPos => VPos => ComplPos => Order => Str} ; p : Pol ; t : Tense } ; -- TO FIX
[Adv] = { s: Coordinator => {init,last : Str}} ;
[NP] = { s : Coordinator => {init,last : PronDropForm => Case => Str} ; g : Gender ; n : Number ; p : Person ; adv : Str ; preap : AP ; postap : AP ; isBase : Bool ; det : Det } ;
[NP] = { s : Coordinator => {init,last : PronDropForm => AdvPos => DetPos => Case => Str} ; g : Gender ; n : Number ; p : Person ; isBase : Bool } ;
[AP] = {s : Coordinator => {init,last : Agr => Str } } ;
[RS] = { s : Coordinator => { init, last : Gender => Number => Str }} ;
oper
-- Generates a new number value given two number values.
-- Pl if any of the two is Pl

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,262 @@
concrete ExtendLat of Extend = CatLat ** ExtendFunctor-[VPS,ComplDirectVQ,ComplDirectVS,CompIQuant,EmptyRelSlash,ExistsNP,ExistCN,ExistMassCN,ExistPluralCN,GenModNP,PredAPVP,PredIAdvVP,SlashBareV2S,StrandQuestSlash,StrandRelSlash] with (Grammar=GrammarLat) ** open MissingLat in {
lincat
VPS = Comp ;
--1 Extensions of core RGL syntax (the Grammar module)
-- This module defines syntax rules that are not yet implemented in all
-- languages, and perhaps never implementable either. But all rules are given
-- a default implementation in common/ExtendFunctor.gf so that they can be included
-- in the library API. The default implementations are meant to be overridden in each
-- xxxxx/ExtendXxx.gf when the work proceeds.
--
-- This module is aimed to replace the original Extra.gf, which is kept alive just
-- for backwardcommon compatibility. It will also replace translator/Extensions.gf
-- and thus eliminate the often duplicated work in those two modules.
--
-- (c) Aarne Ranta 2017-08-20 under LGPL and BSD
concrete ExtendLat of Extend = CatLat ** open ResLat in {
lin
-- ComplDirectVS : VS -> Utt -> VP ; -- say: "today"
ComplDirectVS vs utt = AdvVP (UseV <lin V vs : V>) (lin Adv {s = \\_ => ":" ++ quoted utt.s}) ; -- DEFAULT complement added as Adv in quotes
-- ComplDirectVQ : VQ -> Utt -> VP ; -- ask: "when"
ComplDirectVQ vq utt = AdvVP (UseV <lin V vq : V>) (lin Adv {s = \\_ => ":" ++ quoted utt.s}) ; -- DEFAULT complement added as Adv in quotes
} ;
-- GenNP : NP -> Quant ; -- this man's
GenNP np = { s = \\_ => combineNounPhrase np ! PronNonDrop ! APostN ! DPreN ! Gen ; sp = \\_ => ""} ;
-- GenIP : IP -> IQuant ; -- whose
-- GenRP : Num -> CN -> RP ; -- whose car
-- -- In case the first two are not available, the following applications should in any case be.
-- GenModNP : Num -> NP -> CN -> NP ; -- this man's car(s)
-- GenModIP : Num -> IP -> CN -> IP ; -- whose car(s)
-- CompBareCN : CN -> Comp ; -- (is) teacher
-- StrandQuestSlash : IP -> ClSlash -> QCl ; -- whom does John live with
-- StrandRelSlash : RP -> ClSlash -> RCl ; -- that he lives in
-- EmptyRelSlash : ClSlash -> RCl ; -- he lives in
-- -- $VP$ conjunction, separate categories for finite and infinitive forms (VPS and VPI, respectively)
-- -- covering both in the same category leads to spurious VPI parses because VPS depends on many more tenses
-- cat
-- VPS ; -- finite VP's with tense and polarity
-- [VPS] {2} ;
-- VPI ;
-- [VPI] {2} ; -- infinitive VP's (TODO: with anteriority and polarity)
-- fun
-- MkVPS : Temp -> Pol -> VP -> VPS ; -- hasn't slept
-- ConjVPS : Conj -> [VPS] -> VPS ; -- has walked and won't sleep
-- PredVPS : NP -> VPS -> S ; -- she [has walked and won't sleep]
-- MkVPI : VP -> VPI ; -- to sleep (TODO: Ant and Pol)
-- ConjVPI : Conj -> [VPI] -> VPI ; -- to sleep and to walk
-- ComplVPIVV : VV -> VPI -> VP ; -- must sleep and walk
-- -- the same for VPSlash, taking a complement with shared V2 verbs
-- cat
-- 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
-- fun
-- 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
-- MkVPI2 : VPSlash -> VPI2 ; -- to love
-- ConjVPI2 : Conj -> [VPI2] -> VPI2 ; -- to love and hate
-- ComplVPI2 : VPI2 -> NP -> VPI ; -- to love and hate that person
-- fun
-- ProDrop : Pron -> Pron ; -- unstressed subject pronoun becomes empty: "am tired"
-- ICompAP : AP -> IComp ; -- "how old"
-- IAdvAdv : Adv -> IAdv ; -- "how often"
-- CompIQuant : IQuant -> IComp ; -- which (is it) [agreement to NP]
-- PrepCN : Prep -> CN -> Adv ; -- by accident [Prep + CN without article]
-- -- fronted/focal constructions, only for main clauses
-- fun
-- FocusObj : NP -> SSlash -> Utt ; -- her I love
-- FocusAdv : Adv -> S -> Utt ; -- today I will sleep
-- FocusAdV : AdV -> S -> Utt ; -- never will I sleep
-- FocusAP : AP -> NP -> Utt ; -- green was the tree
-- -- participle constructions
-- PresPartAP : VP -> AP ; -- (the man) looking at Mary
-- EmbedPresPart : VP -> SC ; -- looking at Mary (is fun)
-- PastPartAP : VPSlash -> AP ; -- lost (opportunity) ; (opportunity) lost in space
PastPartAP vp = { s = \\ag => vp.part ! VPassPerf ! ag ++ vp.adv ++ vp.c.s} ; -- TODO
-- PastPartAgentAP : VPSlash -> NP -> AP ; -- (opportunity) lost by the company
-- -- this is a generalization of Verb.PassV2 and should replace it in the future.
-- PassVPSlash : VPSlash -> VP ; -- be forced to sleep
PassVPSlash vp = vp ** {
s = \\a => case a of { VAct _ t n p => vp.pass ! VPass t n p } ;
} ;
-- -- the form with an agent may result in a different linearization
-- -- from an adverbial modification by an agent phrase.
-- PassAgentVPSlash : VPSlash -> NP -> VP ; -- be begged by her to go
-- -- publishing of the document
-- NominalizeVPSlashNP : VPSlash -> NP -> NP ;
-- -- counterpart to ProgrVP, for VPSlash
-- ProgrVPSlash : VPSlash -> VPSlash;
-- -- existential for mathematics
-- ExistsNP : NP -> Cl ; -- there exists a number / there exist numbers
-- -- existentials with a/no variation
-- ExistCN : CN -> Cl ; -- there is a car / there is no car
-- ExistMassCN : CN -> Cl ; -- there is beer / there is no beer
-- ExistPluralCN : CN -> Cl ; -- there are trees / there are no trees
-- -- generalisation of existential, with adverb as a parameter
-- AdvIsNP : Adv -> NP -> Cl ; -- here is the tree / here are the trees
-- AdvIsNPAP : Adv -> NP -> AP -> Cl ; -- here are the instructions documented
-- -- infinitive for purpose AR 21/8/2013
-- PurposeVP : VP -> Adv ; -- to become happy
-- -- object S without "that"
-- ComplBareVS : VS -> S -> VP ; -- say she runs
-- SlashBareV2S : V2S -> S -> VPSlash ; -- answer (to him) it is good
-- ComplDirectVS : VS -> Utt -> VP ; -- say: "today"
-- ComplDirectVQ : VQ -> Utt -> VP ; -- ask: "when"
-- -- front the extraposed part
-- FrontComplDirectVS : NP -> VS -> Utt -> Cl ; -- "I am here", she said
-- FrontComplDirectVQ : NP -> VQ -> Utt -> Cl ; -- "where", she asked
-- -- proper structure of "it is AP to VP"
-- PredAPVP : AP -> VP -> Cl ; -- it is good to walk
-- -- to use an AP as CN or NP without CN
-- AdjAsCN : AP -> CN ; -- a green one ; en grön (Swe)
-- AdjAsNP : AP -> NP ; -- green (is good)
AdjAsNP ap = {
s = \\_,c => ap.s ! (Ag Neutr Sg c) ;
adv = "" ;
det = { s, sp = \\_ => "" } ;
g = Neutr ;
n = Sg ;
p = P3 ;
postap = { s = \\_ => "" } ;
preap = { s = \\_ => "" } ;
} ;
-- -- infinitive complement for IAdv
-- PredIAdvVP : IAdv -> VP -> QCl ; -- how to walk?
-- -- alternative to EmbedQS. For English, EmbedQS happens to work,
-- -- because "what" introduces question and relative. The default linearization
-- -- could be e.g. "the thing we did (was fun)".
-- EmbedSSlash : SSlash -> SC ; -- what we did (was fun)
-- -- reflexive noun phrases: a generalization of Verb.ReflVP, which covers just reflexive pronouns
-- -- This is necessary in languages like Swedish, which have special reflexive possessives.
-- -- However, it is also needed in application grammars that want to treat "brush one's teeth" as a one-place predicate.
-- cat
-- RNP ; -- reflexive noun phrase, e.g. "my family and myself"
-- RNPList ; -- list of reflexives to be coordinated, e.g. "my family, myself, everyone"
-- -- Notice that it is enough for one NP in RNPList to be RNP.
-- fun
-- ReflRNP : VPSlash -> RNP -> VP ; -- love my family and myself
-- ReflPron : RNP ; -- myself
-- ReflPoss : Num -> CN -> RNP ; -- my car(s)
-- PredetRNP : Predet -> RNP -> RNP ; -- all my brothers
-- ConjRNP : Conj -> RNPList -> RNP ; -- my family, John and myself
-- Base_rr_RNP : RNP -> RNP -> RNPList ; -- my family, myself
-- Base_nr_RNP : NP -> RNP -> RNPList ; -- John, myself
-- Base_rn_RNP : RNP -> NP -> RNPList ; -- myself, John
-- Cons_rr_RNP : RNP -> RNPList -> RNPList ; -- my family, myself, John
-- Cons_nr_RNP : NP -> RNPList -> RNPList ; -- John, my family, myself
-- ---- Cons_rn_RNP : RNP -> ListNP -> RNPList ; -- myself, John, Mary
-- --- from Extensions
-- ComplGenVV : VV -> Ant -> Pol -> VP -> VP ; -- want not to have slept
-- ---- SlashV2V : V2V -> Ant -> Pol -> VPS -> VPSlash ; -- force (her) not to have slept
-- CompoundN : N -> N -> N ; -- control system / controls system / control-system
-- CompoundAP : N -> A -> AP ; -- language independent / language-independent
-- GerundCN : VP -> CN ; -- publishing of the document (can get a determiner)
-- GerundNP : VP -> NP ; -- publishing the document (by nature definite)
-- GerundAdv : VP -> Adv ; -- publishing the document (prepositionless adverb)
-- WithoutVP : VP -> Adv ; -- without publishing the document
-- ByVP : VP -> Adv ; -- by publishing the document
-- InOrderToVP : VP -> Adv ; -- (in order) to publish the document
-- ApposNP : NP -> NP -> NP ; -- Mr Macron, the president of France,
-- AdAdV : AdA -> AdV -> AdV ; -- almost always
-- UttAdV : AdV -> Utt ; -- always(!)
-- PositAdVAdj : A -> AdV ; -- (that she) positively (sleeps)
-- CompS : S -> Comp ; -- (the fact is) that she sleeps
-- CompQS : QS -> Comp ; -- (the question is) who sleeps
-- CompVP : Ant -> Pol -> VP -> Comp ; -- (she is) to go
-- -- very language-specific things
-- -- Eng
-- UncontractedNeg : Pol ; -- do not, etc, as opposed to don't
-- UttVPShort : VP -> Utt ; -- have fun, as opposed to "to have fun"
-- ComplSlashPartLast : VPSlash -> NP -> VP ; -- set it apart, as opposed to "set apart it"
-- -- Romance
-- DetNPMasc : Det -> NP ;
-- DetNPFem : Det -> NP ;
-- UseComp_estar : Comp -> VP ; -- (Cat, Spa, Por) "está cheio" instead of "é cheio"
-- SubjRelNP : NP -> RS -> NP ; -- Force RS in subjunctive: lo que les *resulte* mejor
-- iFem_Pron : Pron ; -- I (Fem)
-- youFem_Pron : Pron ; -- you (Fem)
-- weFem_Pron : Pron ; -- we (Fem)
-- youPlFem_Pron : Pron ; -- you plural (Fem)
-- theyFem_Pron : Pron ; -- they (Fem)
-- youPolFem_Pron : Pron ; -- you polite (Fem)
-- youPolPl_Pron : Pron ; -- you polite plural (Masc)
-- youPolPlFem_Pron : Pron ; -- you polite plural (Fem)
-- -- German
-- UttAccNP : NP -> Utt ; -- him (accusative)
-- UttDatNP : NP -> Utt ; -- him (dative)
-- UttAccIP : IP -> Utt ; -- whom (accusative)
-- UttDatIP : IP -> Utt ; -- whom (dative)
}

View File

@@ -1,9 +1,10 @@
concrete ExtraLat of ExtraLatAbs =
CatLat, ConjunctionLat **
open ResLat, ParadigmsLat, Coordination, Prelude in {
lincat CS = Str ;
open ResLat, ParadigmsLat, RelativeLat, NounLat, Prelude in {
lincat CS = SAdvPos => AdvPos => DetPos => VPos => ComplPos => Order => Str ;
TestRS = { s : Gender => Number => SAdvPos => AdvPos => DetPos => VPos => ComplPos => Order => Str } ;
lin
useS s = combineSentence s ! SPreO ! PreO ! CPreV ! SOV ;
useS s = combineSentence s ;
-- PastPartAP : VPSlash -> AP ; -- lost (opportunity) ; (opportunity) lost in space
-- PastPartAP vp = { s = vp.part ! VPassPerf } ;
@@ -50,4 +51,83 @@ concrete ExtraLat of ExtraLatAbs =
Abl_Prep = mkPrep "" Abl ;
inAbl_Prep = mkPrep "in" Abl ;
onAbl_Prep = mkPrep "in" Abl ; -- L...
-- UttS_SVO : S -> Utt
UttS_SVO s = { s = defaultSentence s ! SVO };
-- UttS_VInS : S -> Utt
UttS_VInS s = { s = combineSentence s ! SAPreS ! APreV ! DPostN ! VInS ! CPostV ! SVO } ;
TestRCl t p cl = {
s = \\g,n => combineSentence (combineClause (cl.s ! g ! n) (lin Tense t) t.a (lin Pol p) VQFalse) ;
} ;
-- UseRCl_OSV : Temp -> Pol -> RCl -> RS ;
UseRCl_OSV t p cl = {
s = \\g,n => combineSentence (combineClause (cl.s ! g ! n) (lin Tense t) t.a (lin Pol p) VQFalse) ! SAPreO ! APreV ! DPreN ! VReg ! CPostV ! OSV ;
} ;
-- UseRCl_OVS : Temp -> Pol -> RCl -> RS ;
UseRCl_OVS t p cl = {
s = \\g,n => combineSentence (combineClause (cl.s ! g ! n) (lin Tense t) t.a (lin Pol p) VQFalse) ! SAPreO ! APreV ! DPreN ! VReg ! CPostV ! OVS ; -- SAPreO APreV DPreN VReg CPostV OVS
} ;
-- UseRCl_SOV : Temp -> Pol -> RCl -> RS ;
UseRCl_SOV t p cl = {
s = \\g,n => combineSentence (combineClause (cl.s ! g ! n) (lin Tense t) t.a (lin Pol p) VQFalse) ! SAPreS ! APreV ! DPreN ! VReg ! CPostV ! SOV ;
} ;
-- UseRCl_SVO : Temp -> Pol -> RCl -> RS ;
UseRCl_SVO t p cl = {
s = \\g,n => combineSentence (combineClause (cl.s ! g ! n) (lin Tense t) t.a (lin Pol p) VQFalse) ! SAPreS ! APreV ! DPreN ! VReg ! CPostV ! SVO ;
} ;
-- PrepNP_DPostN : Prep -> NP -> Adv ; -- in the house
PrepNP_DPostN prep np =
mkAdv (prep.s ++ (combineNounPhrase np) ! PronNonDrop ! APostN ! DPostN ! prep.c ) ;
-- ApposCN_DPostN : CN -> NP -> CN
ApposCN_DPostN cn np =
cn **
{
s = \\n,c => cn.s ! n ! c ++ (combineNounPhrase np) ! PronNonDrop ! APostN ! DPostN ! c ;
} ; -- massable = cn.massable } ;
-- CompNP_DPostN : NP -> Comp ; -- (be) the man
CompNP np = {s = \\_ =>
(combineNounPhrase np) ! PronNonDrop ! DPostN ! Nom
} ;
-- DetNP_Fem : Det -> NP ; -- these five
DetNP_Fem det = {
s = \\_ => det.s ! Fem ;
g = Fem ;
n = det.n ;
p = P3 ;
adv = "" ;
preap, postap = { s = \\_ => "" } ;
det = { s,sp = \\_ => "" ; n = det.n } ;
} ;
-- AdjAsNP_Fem : AP -> NP ; -- green (is good)
AdjAsNP_Fem ap = {
s = \\_,c => ap.s ! (Ag Fem Sg c) ;
adv = "" ;
det = { s, sp = \\_ => "" } ;
g = Fem ;
n = Sg ;
p = P3 ;
postap = { s = \\_ => "" } ;
preap = { s = \\_ => "" } ;
} ;
-- PredVP_VP_Ellipsis : NP -> VP -> Cl
PredVP_VP_Ellipsis np =
mkClause np emptyVP ;
-- SlashVP_VP_Ellipsis : NP -> VPSlash -> ClSlash ; -- (whom) he sees
SlashVP_VP_Ellipsis np =
mkClause np emptyVP ;
-- FunRP_RP_Ellipsis : Prep -> NP -> RP ;
FunRP_RP_Ellipsis p np = FunRP p np (lin RP { s = \\_ => "" }) ;
RelNP_NP_Ellipsis rs = RelNP emptyNP rs ;
comma_Conj = mkConj "" "," "" Pl Comma ;
}

View File

@@ -1,7 +1,8 @@
abstract ExtraLatAbs =
Extra, Conjunction
Conjunction
** {
cat CS ;
cat CS ;
TestRS ;
fun
useS : S -> CS ;
-- do not drop pronouns
@@ -29,4 +30,27 @@ abstract ExtraLatAbs =
-- Preposition with alternate case
inAbl_Prep : Prep ;
onAbl_Prep : Prep ;
-- Add other word orders
UttS_SVO : S -> Utt ;
UttS_VInS : S -> Utt ;
TestRCl : Temp -> Pol -> RCl -> TestRS ;
UseRCl_OSV : Temp -> Pol -> RCl -> RS ;
UseRCl_OVS : Temp -> Pol -> RCl -> RS ;
UseRCl_SOV : Temp -> Pol -> RCl -> RS ;
UseRCl_SVO : Temp -> Pol -> RCl -> RS ;
PrepNP_DPostN : Prep -> NP -> Adv ;
ApposCN_DPostN : CN -> NP -> CN ;
-- More genders
DetNP_Fem : Det -> NP ;
AdjAsNP_Fem : AP -> NP ;
-- Ellipsis
PredVP_VP_Ellipsis : NP -> Cl ;
SlashVP_VP_Ellipsis : NP -> ClSlash ;
FunRP_RP_Ellipsis : Prep -> NP -> RP ;
RelNP_NP_Ellipsis : RS -> NP ;
comma_Conj : Conj ;
}

View File

@@ -8,7 +8,7 @@ concrete GrammarLat of Grammar =
NumeralLat,
SentenceLat,
QuestionLat,
-- RelativeLat,
RelativeLat,
ConjunctionLat,
PhraseLat,
TextX-[Adv],

View File

@@ -2,142 +2,78 @@ resource MissingLat = open GrammarLat, Prelude in {
-- temporary definitions to enable the compilation of RGL API
oper AdNum : AdN -> Card -> Card = notYet "AdNum" ;
oper AddAdvQVP : QVP -> IAdv -> QVP = notYet "AddAdvQVP" ;
oper AdjDAP : DAP -> AP -> DAP = notYet "AdjDAP" ;
oper AdvCN : CN -> Adv -> CN = notYet "AdvCN" ;
oper AdvIAdv : IAdv -> Adv -> IAdv = notYet "AdvIAdv" ;
oper AdvIP : IP -> Adv -> IP = notYet "AdvIP" ;
oper AdvQVP : VP -> IAdv -> QVP = notYet "AdvQVP" ;
oper AdvSlash : ClSlash -> Adv -> ClSlash = notYet "AdvSlash" ;
oper BaseAP : AP -> AP -> ListAP = notYet "BaseAP" ;
oper BaseRS : RS -> RS -> ListRS = notYet "BaseRS" ;
oper BaseAdV : AdV -> AdV -> ListAdV = notYet "BaseAdV" ;
oper BaseCN : CN -> CN -> ListCN = notYet "BaseCN" ;
oper BaseDAP : DAP -> DAP -> ListDAP = notYet "BaseDAP" ;
oper BaseIAdv : IAdv -> IAdv -> ListIAdv = notYet "BaseIAdv" ;
oper CleftAdv : Adv -> S -> Cl = notYet "CleftAdv" ;
oper CleftNP : NP -> RS -> Cl = notYet "CleftNP" ;
oper CompIP : IP -> IComp = notYet "CompIP" ;
oper ComplN2 : N2 -> NP -> CN = notYet "ComplN2" ;
oper ComplN3 : N3 -> NP -> N2 = notYet "ComplN3" ;
oper ConjAdv : Conj -> ListAdv -> Adv = notYet "ConjAdv" ;
oper ComplSlashIP : VPSlash -> IP -> QVP = notYet "ComplSlashIP" ;
oper ConjAP : Conj -> ListAP -> AP = notYet "ConjAP" ;
oper ConjRS : Conj -> ListRS -> RS = notYet "ConjRS" ;
oper ConjAdV : Conj -> ListAdV -> AdV = notYet "ConjAdV" ;
oper ConjAdv : Conj -> ListAdv -> Adv = notYet "ConjAdv" ;
oper ConjCN : Conj -> ListCN -> CN = notYet "ConjCN" ;
oper ConjDet : Conj -> ListDAP -> Det = notYet "ConjDet" ;
oper ConjIAdv : Conj -> ListIAdv -> IAdv = notYet "ConjIAdv" ;
-- Error: No type found for ConjNPque
oper ConsAP : AP -> ListAP -> ListAP = notYet "ConsAP" ;
oper ConsRS : RS -> ListRS -> ListRS = notYet "ConsRS" ;
oper ConsAdV : AdV -> ListAdV -> ListAdV = notYet "ConsAdV" ;
oper ConsCN : CN -> ListCN -> ListCN = notYet "ConsCN" ;
oper ConsDAP : DAP -> ListDAP -> ListDAP = notYet "ConsDAP" ;
oper ConsIAdv : IAdv -> ListIAdv -> ListIAdv = notYet "ConsIAdv" ;
oper DetDAP : Det -> DAP = notYet "DetDAP" ;
oper DetQuantOrd : Quant -> Num -> Ord -> Det = notYet "DetQuantOrd" ;
oper EmbedQS : QS -> SC = notYet "EmbedQS" ;
oper EmbedS : S -> SC = notYet "EmbedS" ;
oper EmbedVP : VP -> SC = notYet "EmbedVP" ;
oper ExistIP : IP -> QCl = notYet "ExistIP" ;
oper ExistNP : NP -> Cl = notYet "ExistNP" ;
oper FunRP : Prep -> NP -> RP -> RP = notYet "FunRP" ;
oper ExtAdvS : Adv -> S -> S = notYet "ExtAdvS" ;
oper ExtAdvVP : VP -> Adv -> VP = notYet "ExtAdvVP" ;
oper GenericCl : VP -> Cl = notYet "GenericCl" ;
oper IdetCN : IDet -> CN -> IP = notYet "IdetCN" ;
oper IdetIP : IDet -> IP = notYet "IdetIP" ;
oper IdetQuant : IQuant -> Num -> IDet = notYet "IdetQuant" ;
oper IdRP : RP = notYet "IdRP" ;
oper ImpersCl : VP -> Cl = notYet "ImpersCl" ;
oper ImpPl1 : VP -> Utt = notYet "ImpPl1" ;
oper ImpVP : VP -> Imp = notYet "ImpVP" ;
oper ImpersCl : VP -> Cl = notYet "ImpersCl" ;
oper NumDigits : Digits -> Card = notYet "NumDigits" ;
oper NumNumeral : Numeral -> Card = notYet "NumNumeral" ;
oper OrdDigits : Digits -> Ord = notYet "OrdDigits" ;
oper OrdNumeral : Numeral -> Ord = notYet "OrdNumeral" ;
oper OrdNumeralSuperl : Numeral -> A -> Ord = notYet "OrdNumeralSuperl" ;
oper OrdSuperl : A -> Ord = notYet "OrdSuperl" ;
oper PossPron : Pron -> Quant = notYet "PossPron" ;
oper PPartNP : NP -> V2 -> NP = notYet "PPartNP" ;
oper PartNP : CN -> NP -> CN = notYet "PartNP" ;
oper PossNP : CN -> NP -> CN = notYet "PossNP" ;
oper PredSCVP : SC -> VP -> Cl = notYet "PredSCVP" ;
oper PrepIP : Prep -> IP -> IAdv = notYet "PrepIP" ;
oper ProgrVP : VP -> VP = notYet "ProgrVP" ;
oper QuestCl : Cl -> QCl = notYet "QuestCl" ;
oper QuestIAdv : IAdv -> Cl -> QCl = notYet "QuestIAdv" ;
oper QuestIComp : IComp -> NP -> QCl = notYet "QuestIComp" ;
oper QuestSlash : IP -> ClSlash -> QCl = notYet "QuestSlash" ;
oper QuestVP : IP -> VP -> QCl = notYet "QuestVP" ;
oper ReflVP : VPSlash -> VP = notYet "ReflVP" ;
oper RelCl : Cl -> RCl = notYet "RelCl" ;
oper RelCN : CN -> RS -> CN = notYet "RelCN" ;
oper RelSlash : RP -> ClSlash -> RCl = notYet "RelSlash" ;
oper RelVP : RP -> VP -> RCl = notYet "RelVP" ;
oper SentCN : CN -> SC -> CN = notYet "SentCN" ;
oper SlashV2S : V2S -> S -> VPSlash = notYet "SlashV2S" ;
oper SlashV2V : V2V -> VP -> VPSlash = notYet "SlashV2V" ;
oper SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash = notYet "SlashV2VNP" ;
oper SlashVS : NP -> VS -> SSlash -> ClSlash = notYet "SlashVS" ;
oper SlashVV : VV -> VPSlash -> VPSlash = notYet "SlashVV" ;
oper Use2N3 : N3 -> N2 = notYet "Use2N3" ;
oper UseQCl : Temp -> Pol -> QCl -> QS = notYet "UseQCl" ;
oper UseRCl : Temp -> Pol -> RCl -> RS = notYet "UseRCl" ;
oper UseSlash : Temp -> Pol -> ClSlash -> SSlash = notYet "UseSlash" ;
oper AddAdvQVP : QVP -> IAdv -> QVP = notYet "AddAdvQVP" ;
oper AdjDAP : DAP -> AP -> DAP = notYet "AdjDAP" ;
oper AdNum : AdN -> Card -> Card = notYet "AdNum" ;
oper AdvCN : CN -> Adv -> CN = notYet "AdvCN" ;
oper AdvIAdv : IAdv -> Adv -> IAdv = notYet "AdvIAdv" ;
oper AdvIP : IP -> Adv -> IP = notYet "AdvIP" ;
oper AdvQVP : VP -> IAdv -> QVP = notYet "AdvQVP" ;
oper AdvSlash : ClSlash -> Adv -> ClSlash = notYet "AdvSlash" ;
oper BaseAdV : AdV -> AdV -> ListAdV = notYet "BaseAdV" ;
oper BaseAP : AP -> AP -> ListAP = notYet "BaseAP" ;
oper BaseCN : CN -> CN -> ListCN = notYet "BaseCN" ;
oper BaseDAP : DAP -> DAP -> ListDAP = notYet "BaseDAP" ;
oper BaseIAdv : IAdv -> IAdv -> ListIAdv = notYet "BaseIAdv" ;
oper BaseRS : RS -> RS -> ListRS = notYet "BaseRS" ;
oper CompIP : IP -> IComp = notYet "CompIP" ;
oper ComplN2 : N2 -> NP -> CN = notYet "ComplN2" ;
oper ComplN3 : N3 -> NP -> N2 = notYet "ComplN3" ;
oper ComplSlashIP : VPSlash -> IP -> QVP = notYet "ComplSlashIP" ;
oper ConjAdv : Conj -> ListAdv -> Adv = notYet "ConjAdv" ;
oper ConjAdV : Conj -> ListAdV -> AdV = notYet "ConjAdV" ;
oper ConjAP : Conj -> ListAP -> AP = notYet "ConjAP" ;
oper ConjCN : Conj -> ListCN -> CN = notYet "ConjCN" ;
oper ConjDet : Conj -> ListDAP -> Det = notYet "ConjDet" ;
oper ConjIAdv : Conj -> ListIAdv -> IAdv = notYet "ConjIAdv" ;
oper ConjRS : Conj -> ListRS -> RS = notYet "ConjRS" ;
oper ConsAdV : AdV -> ListAdV -> ListAdV = notYet "ConsAdV" ;
oper ConsAP : AP -> ListAP -> ListAP = notYet "ConsAP" ;
oper ConsCN : CN -> ListCN -> ListCN = notYet "ConsCN" ;
oper ConsDAP : DAP -> ListDAP -> ListDAP = notYet "ConsDAP" ;
oper ConsIAdv : IAdv -> ListIAdv -> ListIAdv = notYet "ConsIAdv" ;
oper ConsRS : RS -> ListRS -> ListRS = notYet "ConsRS" ;
oper CountNP : Det -> NP -> NP = notYet "CountNP" ;
oper DetDAP : Det -> DAP = notYet "DetDAP" ;
oper DetQuantOrd : Quant -> Num -> Ord -> Det = notYet "DetQuantOrd" ;
oper EmbedQS : QS -> SC = notYet "EmbedQS" ;
oper EmbedS : S -> SC = notYet "EmbedS" ;
oper EmbedVP : VP -> SC = notYet "EmbedVP" ;
oper ExtAdvS : Adv -> S -> S = notYet "ExtAdvS" ;
oper ExtAdvVP : VP -> Adv -> VP = notYet "ExtAdvVP" ;
oper IdetCN : IDet -> CN -> IP = notYet "IdetCN" ;
oper IdetIP : IDet -> IP = notYet "IdetIP" ;
oper IdetQuant : IQuant -> Num -> IDet = notYet "IdetQuant" ;
oper ImpVP : VP -> Imp = notYet "ImpVP" ;
oper NumDigits : Digits -> Card = notYet "NumDigits" ;
oper NumNumeral : Numeral -> Card = notYet "NumNumeral" ;
oper OrdDigits : Digits -> Ord = notYet "OrdDigits" ;
oper OrdNumeral : Numeral -> Ord = notYet "OrdNumeral" ;
oper OrdNumeralSuperl : Numeral -> A -> Ord = notYet "OrdNumeralSuperl" ;
oper OrdSuperl : A -> Ord = notYet "OrdSuperl" ;
oper PartNP : CN -> NP -> CN = notYet "PartNP" ;
oper PossNP : CN -> NP -> CN = notYet "PossNP" ;
oper PossPron : Pron -> Quant = notYet "PossPron" ;
oper PPartNP : NP -> V2 -> NP = notYet "PPartNP" ;
oper PredSCVP : SC -> VP -> Cl = notYet "PredSCVP" ;
oper PrepIP : Prep -> IP -> IAdv = notYet "PrepIP" ;
oper QuestCl : Cl -> QCl = notYet "QuestCl" ;
oper QuestIAdv : IAdv -> Cl -> QCl = notYet "QuestIAdv" ;
oper QuestIComp : IComp -> NP -> QCl = notYet "QuestIComp" ;
oper QuestQVP : IP -> QVP -> QCl = notYet "QuestQVP" ;
oper QuestSlash : IP -> ClSlash -> QCl = notYet "QuestSlash" ;
oper QuestVP : IP -> VP -> QCl = notYet "QuestVP" ;
oper ReflVP : VPSlash -> VP = notYet "ReflVP" ;
oper RelCN : CN -> RS -> CN = notYet "RelCN" ;
oper RelCl : Cl -> RCl = notYet "RelCl" ;
oper RelS : S -> RS -> S = notYet "RelS" ;
oper SSubjS : S -> Subj -> S -> S = notYet "SSubjS" ;
oper SentCN : CN -> SC -> CN = notYet "SentCN" ;
oper SlashV2S : V2S -> S -> VPSlash = notYet "SlashV2S" ;
oper SlashV2V : V2V -> VP -> VPSlash = notYet "SlashV2V" ;
oper SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash = notYet "SlashV2VNP" ;
oper SlashVS : NP -> VS -> SSlash -> ClSlash = notYet "SlashVS" ;
oper SlashVV : VV -> VPSlash -> VPSlash = notYet "SlashVV" ;
oper SSubjS : S -> Subj -> S -> S = notYet "SSubjS" ;
oper Use2N3 : N3 -> N2 = notYet "Use2N3" ;
oper Use3N3 : N3 -> N2 = notYet "Use3N3" ;
oper UseQCl : Temp -> Pol -> QCl -> QS = notYet "UseQCl" ;
oper UseRCl : Temp -> Pol -> RCl -> RS = notYet "UseRCl" ;
-- Error: No type found for UsePronNonDrop
oper UseSlash : Temp -> Pol -> ClSlash -> SSlash = notYet "UseSlash" ;
oper VPSlashPrep : VP -> Prep -> VPSlash = notYet "VPSlashPrep" ;

View File

@@ -11,7 +11,7 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
adv = cn.adv ;
preap = cn.preap ;
postap = cn.postap ;
det = det
det = { s = det.s ! cn.g ; sp = det.sp ! cn.g } ;
} ;
-- UsePN : PN -> NP ; -- John
@@ -22,7 +22,7 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
p = P3 ;
adv = "" ;
preap, postap = { s = \\_ => "" } ;
det = { s,sp = \\_,_ => "" ; n = Sg }
det = { s,sp = \\_ => "" ; n = Sg }
} ;
-- UsePron : Pron -> NP ; -- he
@@ -33,13 +33,13 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
s = \\pd,c => p.pers.s ! pd ! PronNonRefl ! c;
adv = "" ;
preap, postap = { s = \\_ => "" } ;
det = { s,sp = \\_,_ => "" ; n = p.pers.n } ;
det = { s,sp = \\_ => "" ; n = p.pers.n } ;
} ;
-- PredetNP : Predet -> NP -> NP ; -- only the man
PredetNP predet np =
np ** {
det = np.det ** { s = \\g,c => predet.s ++ np.det.s ! g ! c }
det = { s = \\c => predet.s ++ np.det.s ! c ; sp = np.det.sp }
} ;
-- PPartNP : NP -> V2 -> NP ; -- the man seen
@@ -64,7 +64,7 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
ExtAdvNP = AdvNP ;
-- RelNP : NP -> RS -> NP ; -- Paris, which is here
RelNP np rs = np ** { adv = rs.s ++ np.adv } ;
RelNP np rs = np ** { adv = bindComma ++ rs.s ! np.g ! np.n ++ np.adv } ;
-- DetNP : Det -> NP ; -- these five
DetNP det = {
@@ -74,7 +74,7 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
p = P3 ;
adv = "" ;
preap, postap = { s = \\_ => "" } ;
det = { s,sp = \\_,_ => "" ; n = det.n } ;
det = { s,sp = \\_ => "" ; n = det.n } ;
} ;
--
-- DetQuantOrd quant num ord = {
@@ -85,13 +85,13 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
--
DetQuant quant num = {
s = \\g,c => quant.s ! Ag g num.n c ++ num.s ! g ! c ;
sp = \\g,c => quant.sp ! Ag g num.n c ++ num.s ! g ! c ;
sp = \\g,c => quant.sp ! Ag g num.n c ;
n = num.n
} ;
-- PossPron p = {
PossPron p = { s = \\a => p.poss.s ! PronNonRefl ! a ; sp = \\_ => "" } ;
-- s = \\_,_ => p.s ! Gen ;
-- sp = \\_,_ => p.sp
-- } ;
@@ -105,8 +105,10 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
-- OrdDigits n = {s = n.s ! NOrd} ;
--
lin
-- NumNumeral numeral = numeral.s ;
-- OrdNumeral numeral = numeral.ord ;
-- NumNumeral : Numeral -> Card ; -- fifty-one
NumNumeral numeral = { s = numeral.s ; n = numeral.n } ;
-- OrdNumeral : Numeral -> Ord ; -- fifty-first
OrdNumeral numeral = { s = numeral.ord } ;
--
-- AdNum adn num = {s = adn.s ++ num.s ; n = num.n} ;
--
@@ -128,7 +130,7 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
-- s = case cn.massable of { True => cn.s ! Sg ; False => \\_ => nonExist } ;
n = Sg ;
p = P3 ;
det = { s,sp = \\_,_ => "" ; n = Sg } ;
det = { s,sp = \\_ => "" ; n = Sg } ;
};
UseN n = -- N -> CN
@@ -175,6 +177,11 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
ApposCN cn np =
cn **
{
s = \\n,c => cn.s ! n ! c ++ (combineNounPhrase np) ! PronNonDrop ! c ;
s = \\n,c => cn.s ! n ! c ++ (combineNounPhrase np) ! PronNonDrop ! APostN ! DPreN ! c ;
} ; -- massable = cn.massable } ;
}
-- CountNP : Det -> NP -> NP ; -- three of them, some of the boys
CountNP det np = np ** {
det = { s = \\c => det.s ! np.g ! c ++ np.det.s ! c ; sp = \\c => det.sp ! np.g ! c ++ np.det.sp ! c } ;
};
}

View File

@@ -18,111 +18,136 @@ concrete NumeralLat of Numeral = CatLat, ParamX[Number] ** open ParadigmsLat, Pr
n9 = lin Digit ( mkDigit "novem" "undeviginti" "nonaginta" "nongenti" "nonus" "centum" No9 ) ;
-- 1
pot01 = { s = n1.s ! one ; d = n1.s ; n = singular ; below8 = n1.below8 } ;
pot01 = {
s = n1.s ! one ;
d = { num, ord = n1.s } ;
n = singular ;
below8 = n1.below8 ;
ord = n1.ord ! one
} ;
-- d * 1
pot0 d = {
s = d.s ! one ;
d = table {
thousand => \\g,c => d.s ! one ! g ! c ++ d.s ! thousand ! g ! c ;
u => \\g,c => d.s ! u ! g ! c
} ;
d = { num,ord = table {
thousand => \\g,c => d.s ! one ! g ! c ++ d.s ! thousand ! g ! c ;
u => \\g,c => d.s ! u ! g ! c
}
};
n = plural ;
below8 = d.below8
below8 = d.below8 ;
ord = d.ord ! one ;
} ;
-- 10
pot110 = {
s = n1.s ! ten ;
d = table {
thousand => \\g,c => n1.s ! ten ! g ! c ++ n1.s ! thousand ! g ! c ;
u => \\g,c => n1.s ! u ! g ! c
} ;
d = { num, ord = table {
thousand => \\g,c => n1.s ! ten ! g ! c ++ n1.s ! thousand ! g ! c ;
u => \\g,c => n1.s ! u ! g ! c
}
};
n = singular ;
below8 = Yes
below8 = Yes ;
ord = n1.ord ! ten
} ;
-- 11
pot111 = pot1to19 n1 ;
-- 10 + d
pot1to19 d = {
s = d.s ! eleven ;
d = table {
thousand => \\g,c => d.s ! eleven ! g ! c ++ n1.s ! thousand ! g ! c ;
u => \\g,c => d.s ! u ! g ! c
} ;
d = { num, ord = table {
thousand => \\g,c => d.s ! eleven ! g ! c ++ n1.s ! thousand ! g ! c ;
u => \\g,c => d.s ! u ! g ! c
}
};
n = plural ;
below8 = Ign
below8 = Ign ;
ord = n1.ord ! eleven
} ;
-- coercion of 1..9
pot0as1 n = n ;
-- d * 10
pot1 d = {
s = d.s ! ten ;
d = table {
thousand => \\g,c => d.s ! ten ! g ! c ++ n1.s ! thousand ! g ! c ;
u => \\g,c => d.s ! u ! g ! c
} ;
d = { num, ord = table {
thousand => \\g,c => d.s ! ten ! g ! c ++ n1.s ! thousand ! g ! c ;
u => \\g,c => d.s ! u ! g ! c
}
};
n = plural ;
below8 = Yes
below8 = Yes ;
ord = d.ord ! ten
} ;
-- d * 10 + n
pot1plus d n =
let
newS : Gender => Case => Str = \\g,c => case n.below8 of {
No8 => "duo" ++ Prelude.BIND ++ "-" ++ Prelude.BIND ++ "de" ++ Prelude.BIND ++ "-" ++ Prelude.BIND ++ d.tenNext ;
No9 => "un" ++ Prelude.BIND ++ "-" ++ Prelude.BIND ++ "de" ++ Prelude.BIND ++ "-" ++ Prelude.BIND ++ d.tenNext ;
No8 => "duo" ++ Prelude.BIND ++ "de" ++ Prelude.BIND ++ d.tenNext ;
No9 => "un" ++ Prelude.BIND ++ "de" ++ Prelude.BIND ++ d.tenNext ;
_ => d.s ! ten ! g ! c ++ n.s ! g ! c
} in
{
s = newS ;
d = table {
thousand => \\g,c => newS ! g ! c ++ n1.s ! thousand ! g ! c ;
u => \\g,c => n.d ! u ! g ! c
} ;
d = { num, ord = table {
thousand => \\g,c => newS ! g ! c ++ n1.s ! thousand ! g ! c ;
u => \\g,c => n.d.num ! u ! g ! c
}
};
below8 = Ign ;
n = plural
n = plural ;
ord = \\_,_,_ => nonExist -- TODO
} ;
-- coercion of 1..99
pot1as2 n = n ;
-- m * 100
pot2 n = {
s = n.d ! hundred ;
d = table {
thousand => \\g,c => n.d ! hundred ! g ! c ++ n1.s ! thousand ! g ! c ;
u => \\g,c => n.d ! u ! g ! c
} ;
s = n.d.num ! hundred ;
d = { num, ord = table {
thousand => \\g,c => n.d.num ! hundred ! g ! c ++ n1.s ! thousand ! g ! c ;
u => \\g,c => n.d.num ! u ! g ! c
}
};
n = plural ;
below8 = Yes} ;
below8 = Yes ;
ord = \\_,_,_ => nonExist -- TODO
} ;
-- d * 100 + n
pot2plus d n =
let
newS : Gender => Case => Str = \\g,c => d.d ! hundred ! g ! c ++ "et" ++ n.s ! g ! c
newS : Gender => Case => Str = \\g,c => d.d.num ! hundred ! g ! c ++ "et" ++ n.s ! g ! c
in
{
s = newS ;
d = table {
thousand => \\g,c => newS ! g ! c ++ n1.s ! thousand ! g ! c ;
u => \\g,c => n.d ! u ! g ! c
} ;
d = { num, ord = table {
thousand => \\g,c => newS ! g ! c ++ n1.s ! thousand ! g ! c ;
u => \\g,c => n.d.num ! u ! g ! c
}
};
below8 = Ign ;
n = plural
n = plural;
ord = \\_,_,_ => nonExist -- TODO
} ;
-- coercion of 1..999
pot2as3 n = n ;
-- m * 1000
pot3 n = {
s = \\g,c => n.s ! g ! c ++ n.d ! thousand ! g ! c ;
d = table { thousand => \\g,c => n.s ! g ! c ++ n.d ! thousand ! g ! c ;
u => \\g,c => n.d ! u ! g ! c
s = \\g,c => n.s ! g ! c ++ n.d.num ! thousand ! g ! c ;
d = { num,ord = table {
thousand => \\g,c => n.s ! g ! c ++ n.d.num ! thousand ! g ! c ;
u => \\g,c => n.d.num ! u ! g ! c
}
} ;
below8 = Ign ;
n = plural
n = plural ;
ord = \\_,_,_ => nonExist -- TODO
} ;
-- d * 1000 + n
pot3plus d n = {
s = \\g,c => d.d ! thousand ! g ! c ++ "et" ++ n.s ! g ! c ;
d = n.d ;
s = \\g,c => d.d.num ! thousand ! g ! c ++ "et" ++ n.s ! g ! c ;
d = n.d ; -- ???
below8 = Ign ;
n = plural
n = plural ;
ord = \\_,_,_ => nonExist -- TODO
} ;
oper
@@ -146,14 +171,15 @@ concrete NumeralLat of Numeral = CatLat, ParamX[Number] ** open ParadigmsLat, Pr
hundred_thousand => \\_,_ => nonExist
} ;
-- n = case ones of { "unus" => singular ; _ => plural } ;
-- ord =
-- \\_,_ => [] ;
-- -- table { one => (mkA ord1).s ! Posit;
-- -- ten => (mkA ord10).s ! Posit ;
-- -- hundred => (mkA ord100).s ! Posit ;
-- -- thousand => \\_,_ => nonExist ;
-- -- ten_thousand => \\_ => nonExist ;
-- -- hundred_thousand => \\_ => nonExist } ;
ord =
table { one => ordFlex ord1 ;
eleven => \\_,_,_ => nonExist ;
ten => ordFlex ord10 ;
hundred => ordFlex ord100 ;
thousand => \\_,_,_ => nonExist ;
ten_thousand => \\_,_,_ => nonExist ;
hundred_thousand => \\_,_,_ => nonExist
} ;
tenNext = tenNext ;
below8 = b8
} ;

View File

@@ -3,7 +3,7 @@ concrete PhraseLat of Phrase = CatLat ** open Prelude, ResLat in {
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
--
-- UttS : S -> Utt
UttS s = { s = combineSentence s ! SPreS ! PreS ! CPreV ! SOV };
UttS s = { s = defaultSentence s ! SOV };
-- UttQS : QS -> Utt
UttQS qs = {s = qs.s ! QDir } ;
@@ -18,7 +18,7 @@ concrete PhraseLat of Phrase = CatLat ** open Prelude, ResLat in {
-- UttIAdv : IAdv -> Utt
UttIAdv iadv = iadv ;
-- UttNP : NP -> Utt
UttNP np = {s = np.adv ++ (combineNounPhrase np) ! PronNonDrop ! Nom} ;
UttNP np = {s = np.adv ++ (combineNounPhrase np) ! PronNonDrop ! APostN ! DPreN ! Nom} ;
-- UttVP : VP -> Utt
UttVP vp = ss (vp.inf ! VInfActPres) ;
@@ -36,6 +36,6 @@ concrete PhraseLat of Phrase = CatLat ** open Prelude, ResLat in {
PConjConj conj = {s = conj.s2} ; ---
--
NoVoc = {s = []} ;
VocNP np = {s = "," ++ (combineNounPhrase np) ! PronNonDrop ! ResLat.Voc} ; ---- what is the compiler error here? AR 1/2/2014 -- answer: clash with the type name Voc 3/2
VocNP np = {s = bindComma ++ (combineNounPhrase np) ! PronNonDrop ! APostN ! DPreN ! ResLat.Voc} ; ---- what is the compiler error here? AR 1/2/2014 -- answer: clash with the type name Voc 3/2
--
}

View File

@@ -5,7 +5,7 @@ concrete QuestionLat of Question = CatLat ** open ResLat, IrregLat, Prelude in {
lin
-- QuestCl : Cl -> QCl ; -- does John walk
QuestCl cl = cl ** {
v = \\t,a,_,ap,cp => cl.v ! t ! a ! VQTrue ! ap ! cp ;
v = \\t,a,_,ap => cl.v ! t ! a ! VQTrue ! ap ;
q = ""
} ;
@@ -17,7 +17,9 @@ concrete QuestionLat of Question = CatLat ** open ResLat, IrregLat, Prelude in {
neg = \\_,_ => "" ;
o = \\_ => vp.obj ;
q = ip.s ! Nom ;
v = \\t,a,_,ap,cp => vp.s ! VAct (anteriorityToVAnter a) (tenseToVTense t) ip.n P3 ! VQFalse
v = \\t,a,_,ap => vp.s ! VAct (anteriorityToVAnter a) (tenseToVTense t) ip.n P3 ! VQFalse ;
compl = vp.compl ! Ag Masc ip.n Nom ; -- default gender masculine
det = { s, sp = \\_ => [] ; n = ip.n } ;
} ;
-- let qcl = mkQuestion { s = ip.s ! Nom } ( mkClause emptyNP vp )
-- in {s = \\t,a,b,qd => qcl.s ! t ! a ! b ! qd} ;
@@ -37,9 +39,11 @@ concrete QuestionLat of Question = CatLat ** open ResLat, IrregLat, Prelude in {
s = \\_ => "" ;
adv = "" ;
neg = \\_,_ => "" ;
o = \\_ => combineNounPhrase np ! PronNonDrop ! Nom ; -- Should probably not go into the object field
o = \\_ => combineNounPhrase np ! PronNonDrop ! APostN ! DPreN ! Nom ; -- Should probably not go into the object field
q = icomp.s ;
v = \\t,a,_,ap,cp => esseAux.act ! VAct (anteriorityToVAnter a) (tenseToVTense t) np.n P3 ;
v = \\t,a,_,ap => esseAux.act ! VAct (anteriorityToVAnter a) (tenseToVTense t) np.n P3 ;
det = { s , sp = \\_=> [] ; n = Sg } ; -- default number singilar
compl = "" ;
} ;
--
--

View File

@@ -2,14 +2,14 @@ concrete RelativeLat of Relative = CatLat ** open ResLat in {
--
-- flags optimize=all_subs ;
--
-- lin
lin
--
-- RelCl cl = {
-- s = \\t,a,p,_ => "such" ++ "that" ++ cl.s ! t ! a ! p ! ODir ;
-- c = Nom
-- } ;
--
-- RelVP rp vp = {
RelVP rp vp = { s = \\g,n => mkClause (emptyNP ** { s = \\_,c => rp.s ! (Ag g n c) ; g = g ; n = n } ) vp };
-- s = \\t,ant,b,ag =>
-- let
-- agr = case rp.a of {
@@ -25,19 +25,43 @@ concrete RelativeLat of Relative = CatLat ** open ResLat in {
---- Pied piping: "at which we are looking". Stranding and empty
---- relative are defined in $ExtraLat.gf$ ("that we are looking at",
---- "we are looking at").
--
-- RelSlash rp slash = {
--
-- RelSlash : RP -> ClSlash -> RCl ;
RelSlash rp slash = { s = \\g,n => slash ** { adv = rp.s ! Ag g n Gen } } ; -- abuse adverbs again
-- s = \\t,a,p,agr =>
-- slash.c2 ++ rp.s ! RPrep (fromAgr agr).g ++ slash.s ! t ! a ! p ! ODir ;
-- c = Acc
-- } ;
--
-- FunRP p np rp = {
-- s = \\c => (combineNounPhrase np) ! PronNonDrop ! Acc ++ p.s ++ rp.s ! RPrep (fromAgr np.a).g ;
-- a = RAg np.a
-- } ;
FunRP p np rp = {
s = \\a => case a of { Ag g n c => rp.s ! a ++ p.s ++ (combineNounPhrase np) ! PronNonDrop ! APostN ! DPreN ! Acc };
-- s = \\c => (combineNounPhrase np) ! PronNonDrop ! Acc ++ p.s ++ rp.s ! RPrep (fromAgr np.a).g ;
-- a = RAg np.a
} ;
--
-- IdRP =
IdRP = {
s = table {
Ag Masc Sg (Nom | Voc) => "qui" ;
Ag Fem Sg (Nom | Voc) => "quae" ;
Ag Neutr Sg (Nom | Voc) => "quod" ;
Ag _ Sg Gen => "cuius" ;
Ag _ Sg Dat => "cui" ;
Ag Masc Sg Acc => "quem" ;
Ag Fem Sg Acc => "quam" ;
Ag Neutr Sg Acc => "quod" ;
Ag (Masc | Neutr) Sg Abl => "quo" ;
Ag Fem Sg Abl => "qua" ;
Ag Masc Pl (Nom | Voc) => "qui" ;
Ag (Fem | Neutr) Pl (Nom | Voc) => "quae" ;
Ag (Masc | Neutr) Pl Gen => "quorum" ;
Ag Fem Pl Gen => "quarum" ;
Ag _ Pl Dat => "quibus" ;
Ag Masc Pl Acc => "quos" ;
Ag Fem Pl Acc => "quas" ;
Ag Neutr Pl Acc => "quae" ;
Ag _ Pl Abl => "cui"
}
}
;
-- let varr : Str -> Str = \x -> variants {x ; "that"} --- for bwc
-- in {
-- s = table {

View File

@@ -22,13 +22,22 @@ param
adv : Str ;
preap : {s : Agr => Str } ;
postap : {s : Agr => Str } ;
det : Determiner
det : { s, sp : Case => Str } ;
} ;
param
-- Parameters to determine word order
-- top level order, e.g. subject verb object
Order = SVO | VSO | VOS | OSV | OVS | SOV ;
AdvPos = PreS | PreV | PreO | PreNeg | InV | InS ; -- | InO
-- determiner position in a noun phrase, e.g. before or after noun
DetPos = DPreN | DPostN ;
-- verb position, eithe regular or interleaved in the subject
VPos = VReg | VInS ;
-- (verb-modifying) adverb position
AdvPos = APreS | APreV | APreO | APreNeg | AInV | AInS | APreN | APostN ; -- | InO
-- verb complement position in relation to verb
ComplPos = CPreV | CPostV ;
SAdvPos = SPreS | SPreV | SPreO | SPreNeg ;
-- sentence adverb position
SAdvPos = SAPreS | SAPreV | SAPreO | SAPreNeg ;
param
Agr = Ag Gender Number Case ; -- Agreement for NP et al.
oper
@@ -141,15 +150,20 @@ param
p = P3;
adv = "" ;
preap, postap = { s = \\_ => "" } ;
det = { s = \\_,_ => "" ; sp = \\_,_ => "" ; n = n} ;
det = { s,sp = \\_ => "" ; n = n} ;
} ;
dummyNP : Str -> NounPhrase = \s -> regNP s s s s s s Masc Sg ;
emptyNP : NounPhrase = { s = \\_,_ => ""; g = Masc; n = Sg; p = P1 ; adv = "" ; preap, postap = { s = \\_ => "" } ; det = { s = \\_,_ => "" ; sp = \\_,_ => "" ; n = Sg } ;};
emptyNP : NounPhrase = { s = \\_,_ => ""; g = Masc; n = Sg; p = P3 ; adv = "" ; preap, postap = { s = \\_ => "" } ; det = { s , sp = \\_ => "" ; n = Sg } ;};
combineNounPhrase : NounPhrase -> PronDropForm => Case => Str = \np ->
\\pd,c => np.det.s ! np.g ! c ++ np.adv ++ np.preap.s ! (Ag np.g np.n c) ++ np.s ! pd ! c ++ np.postap.s ! (Ag np.g np.n c) ++ np.det.sp ! np.g ! c ;
combineNounPhrase : NounPhrase -> PronDropForm => AdvPos => DetPos => Case => Str = \np ->
let detpren : DetPos -> { s , sp : Case => Str} = \dp -> case dp of { DPreN => np.det ; _ => { s, sp = \\_ => [] } } ;
detpostn : DetPos -> { s , sp : Case => Str} = \dp -> case dp of { DPostN => np.det ; _ => { s, sp = \\_ => [] } } ;
apren : AdvPos -> Str = \ap -> case ap of { APreN => np.adv ; _ => [] } ;
apostn : AdvPos -> Str = \ap -> case ap of { APostN => np.adv ; _ => [] } ;
in
\\pd,ap,dp,c => apren ap ++ (detpren dp).s ! c ++ np.preap.s ! (Ag np.g np.n c) ++ np.s ! pd ! c ++ np.postap.s ! (Ag np.g np.n c) ++ (detpren dp).sp ! c ++ (detpostn dp).s ! c ++ apostn ap ;
-- also used for adjectives and so on
-- adjectives
@@ -264,7 +278,8 @@ param
oper
VerbPhrase : Type = {
s : VActForm => VQForm => Str ;
part : VPartForm =>Agr => Str ;
pass : VPassForm => VQForm => Str ;
part : VPartForm => Agr => Str ;
inf : VInfForm => Str ;
imp : VImpForm => Str ;
obj : Str ;
@@ -274,6 +289,17 @@ param
ObjectVerbPhrase : Type = VerbPhrase ** {c : Preposition} ;
emptyVP : VerbPhrase = {
s = \\_,_ => "" ;
pass = \\_,_ => "" ;
part = \\_,_ => "" ;
inf = \\_ => "" ;
imp = \\_ => "" ;
obj = "";
compl = \\_ => "" ;
adv = ""
} ;
Verb : Type = {
act : VActForm => Str ;
pass : VPassForm => Str ;
@@ -351,6 +377,7 @@ param
VAct VSim (VPres VInd) Sg P1 => -- Present Indicative
( case pres_ind_base of {
_ + "a" => ( init pres_ind_base ) ;
-- | _ + "ui" => ( init pres_ind_base ) ;
_ => pres_ind_base
}
) + "o" ; --actPresEnding Sg P1 ;
@@ -1235,6 +1262,7 @@ oper
predV : Verb -> VerbPhrase = \v -> {
s = \\a,q => v.act ! a ++ case q of { VQTrue => Prelude.BIND ++ "ne"; VQFalse => "" };
pass = \\p,q => v.pass ! p ++ case q of { VQTrue => Prelude.BIND ++ "ne"; VQFalse => "" };
part = v.part;
imp = v.imp ;
inf = v.inf ;
@@ -1253,20 +1281,22 @@ oper
insertObj : NounPhrase -> Preposition -> VerbPhrase -> VerbPhrase = \np,prep,vp -> {
s = vp.s ;
pass = vp.pass ;
part = vp.part ;
imp = vp.imp ;
inf = vp.inf ;
obj = np.det.s ! np.g ! prep.c ++ np.preap.s ! (Ag np.g np.n prep.c) ++ (appPrep prep (np.s ! PronNonDrop)) ++ np.postap.s ! (Ag np.g np.n prep.c) ++ np.det.sp ! np.g ! prep.c ++ vp.obj ;
obj = np.det.s ! prep.c ++ np.preap.s ! (Ag np.g np.n prep.c) ++ (appPrep prep (np.s ! PronNonDrop)) ++ np.postap.s ! (Ag np.g np.n prep.c) ++ np.det.sp ! prep.c ++ vp.obj ;
compl = vp.compl ;
adv = vp.adv ++ np.adv
} ;
insertObjc: NounPhrase -> VPSlash -> VPSlash = \np,vp -> {
s = vp.s ;
pass = vp.pass ;
part = vp.part ;
imp = vp.imp ;
inf = vp.inf ;
obj = np.det.s ! np.g ! vp.c.c ++ np.preap.s ! (Ag np.g np.n vp.c.c) ++ (appPrep vp.c (np.s ! PronNonDrop)) ++ np.postap.s ! (Ag np.g np.n vp.c.c) ++ np.det.sp ! np.g ! vp.c.c ++ vp.obj ;
obj = np.det.s ! vp.c.c ++ np.preap.s ! (Ag np.g np.n vp.c.c) ++ (appPrep vp.c (np.s ! PronNonDrop)) ++ np.postap.s ! (Ag np.g np.n vp.c.c) ++ np.det.sp ! vp.c.c ++ vp.obj ;
compl = vp.compl ;
c = vp.c ;
adv = vp.adv ++ np.adv
@@ -1274,6 +1304,7 @@ oper
insertAdj : (Agr => Str) -> VerbPhrase -> VerbPhrase = \adj,vp -> {
s = vp.s ;
pass = vp.pass ;
part = vp.part ;
imp = vp.imp ;
inf = vp.inf ;
@@ -1284,6 +1315,7 @@ oper
insertAdv : Adverb -> VerbPhrase -> VerbPhrase = \a,vp -> {
s = vp.s ;
pass = vp.pass ;
part = vp.part ;
imp = vp.imp ;
inf = vp.inf ;
@@ -1296,13 +1328,22 @@ oper
Sentence =
{
s,o,neg : AdvPos => Str ; -- Subject, verbphrase, object and negation particle plus potential adverb
v : AdvPos => ComplPos => Str ;
v : AdvPos => Str ;
t : C.Tense ; -- tense marker
p : C.Pol ; -- polarity marker
sadv : Str -- sentence adverb¡
sadv : Str ; -- sentence adverb¡
det : { s , sp : Case => Str } ;
compl : Str -- verb complement
} ;
Clause = {s,o : AdvPos => Str ; v : Tense => Anteriority => VQForm => AdvPos => ComplPos => Str ; neg : Polarity => AdvPos => Str ; adv : Str } ;
Clause =
{s : AdvPos => Str ;
o : AdvPos => Str ;
v : Tense => Anteriority => VQForm => AdvPos => Str ;
det : { s , sp : Case => Str } ;
compl : Str ;
neg : Polarity => AdvPos => Str ;
adv : Str } ;
QClause = {s : C.Tense => Anteriority => C.Pol => QForm => Str} ;
mkClause : NounPhrase -> VerbPhrase -> Clause = \np,vp ->
@@ -1313,39 +1354,35 @@ oper
compl = vp.compl ! Ag np.g np.n Nom ;
-- helper functions to either place the adverb in the designated position
-- or an empty string instead
pres : AdvPos -> Str = \ap -> case ap of { PreS => adv ; _ => [] } ;
prev : AdvPos -> Str = \ap -> case ap of { PreV => adv ; _ => [] } ;
preo : AdvPos -> Str = \ap -> case ap of { PreO => adv ; _ => [] } ;
preneg : AdvPos -> Str = \ap -> case ap of { PreNeg => adv ; _ => [] } ;
ins : AdvPos -> Str = \ap -> case ap of { InS => adv ; _ => [] } ;
inv : AdvPos -> Str = \ap -> case ap of { InV => adv ; _ => [] } ;
cprev : ComplPos -> Str = \cp -> case cp of { CPreV => compl ; _ => [] } ;
cpostv : ComplPos -> Str = \cp -> case cp of { CPostV => compl ; _ => [] }
pres : AdvPos -> Str = \ap -> case ap of { APreS => adv ; _ => [] } ;
prev : AdvPos -> Str = \ap -> case ap of { APreV => adv ; _ => [] } ;
preo : AdvPos -> Str = \ap -> case ap of { APreO => adv ; _ => [] } ;
preneg : AdvPos -> Str = \ap -> case ap of { APreNeg => adv ; _ => [] } ;
ins : AdvPos -> Str = \ap -> case ap of { AInS => adv ; _ => [] } ;
inv : AdvPos -> Str = \ap -> case ap of { AInV => adv ; _ => [] } ;
in
{
-- subject part of the clause:
-- advpos is the adverb position in the clause
s = \\advpos =>
pres advpos ++ -- adverbs can be placed in the beginning of the clause
np.det.s ! np.g ! Nom ++ -- the determiner, if any
np.preap.s ! (Ag np.g np.n Nom) ++ -- adjectives which come before the subject noun, agreeing with it
ins advpos ++ -- adverbs can be placed within the subject noun phrase
np.s ! PronDrop ! Nom ++ -- the noun of the subject noun phrase in nominative
np.postap .s ! (Ag np.g np.n Nom) ++ -- adjectives which come after the subject noun, agreeing with it
np.det.sp ! np.g ! Nom ; -- second part of split determiners
np.postap .s ! (Ag np.g np.n Nom) ; -- adjectives which come after the subject noun, agreeing with it
-- verb part of the clause:
-- tense and anter(ority) for the verb tense
-- vqf is the VQForm parameter which defines if the ordinary verbform or the quistion form with suffix "-ne" will be used
-- advposis the adverb position in the clause
-- comppos is the position of the verb complement
v = \\tense,anter,vqf,advpos,complpos =>
v = \\tense,anter,vqf,advpos =>
prev advpos ++ -- adverbs can be placed in the before the verb phrase
cprev complpos ++ -- verb phrase complement, e.g. predicative expression, agreeing with the subject, can go before the verb
inv advpos ++ -- adverbs can be placed within the verb phrase
-- verb form with conversion between different forms of tense and aspect
vp.s ! VAct ( anteriorityToVAnter anter ) ( tenseToVTense tense ) np.n np.p ! vqf ++
cpostv complpos ; -- complement can also go after the verb
vp.s ! VAct ( anteriorityToVAnter anter ) ( tenseToVTense tense ) np.n np.p ! vqf ; -- ++
det = np.det ;
-- verb complement
compl = compl ;
-- object part of the clause
o = \\advpos => preo advpos ++ vp.obj ;
-- optional negation particle, adverbs can be placed before the negation
@@ -1354,41 +1391,79 @@ oper
} ;
combineClause : Clause -> C.Tense -> Anteriority -> C.Pol -> VQForm -> Sentence = \cl,tense,anter,pol,vqf ->
{ s = cl.s ;
o = cl.o ;
v = cl.v ! tense.t ! anter ! vqf ;
cl **
{
v = \\advpos => cl.v ! tense.t ! anter ! vqf ! advpos ;
neg = cl.neg ! pol.p ;
sadv = "" ;
sadv = cl.adv ;
t = tense ;
p = pol
p = pol ;
} ;
combineSentence : Sentence -> ( SAdvPos => AdvPos => ComplPos => Order => Str ) = \s ->
combineSentence : Sentence -> ( SAdvPos => AdvPos => DetPos => VPos => ComplPos => Order => Str ) = \s ->
let
pres : SAdvPos -> Str = \ap -> case ap of { SPreS => s.sadv ; _ => [] } ;
prev : SAdvPos -> Str = \ap -> case ap of { SPreV => s.sadv ; _ => [] } ;
preo : SAdvPos -> Str = \ap -> case ap of { SPreO => s.sadv ; _ => [] } ;
preneg : SAdvPos -> Str = \ap -> case ap of { SPreNeg => s.sadv ; _ => [] }
advpres : SAdvPos -> Str = \ap -> case ap of { SAPreS => s.sadv ; _ => [] } ;
advprev : SAdvPos -> Str = \ap -> case ap of { SAPreV => s.sadv ; _ => [] } ;
advpreo : SAdvPos -> Str = \ap -> case ap of { SAPreO => s.sadv ; _ => [] } ;
advpreneg : SAdvPos -> Str = \ap -> case ap of { SAPreNeg => s.sadv ; _ => [] } ;
detpren : DetPos -> { s, sp : Case => Str } = \dp -> case dp of { DPreN => s.det; _ => { s,sp = \\_ => [] } } ;
detpostn : DetPos -> { s, sp : Case => Str } = \dp -> case dp of { DPostN => s.det ; _ => { s , sp = \\_ => [] } } ;
verbins : VPos -> ResLat.AdvPos => Str = \vp -> case vp of { VInS => s.v ; _ => \\_ => [] } ;
verbreg : VPos -> ResLat.AdvPos => Str = \vp -> case vp of { VReg => s.v ; _ => \\_ => [] } ;
complprev : ComplPos -> Str = \cp -> case cp of { CPreV => s.compl ; _ => [] } ;
complpostv : ComplPos -> Str = \cp -> case cp of { CPostV => s.compl ; _ => [] }
in
-- sap is the position of the sentence adverbial
-- ap is the position of the adverb
-- cp is the position of the verb complement
\\sap,ap,cp,order => case order of {
SVO => s.t.s ++ s.p.s ++ pres sap ++ s.s ! ap ++ preneg sap ++ s.neg ! ap ++ prev sap ++ s.v ! ap ! cp ++ preo sap ++ s.o ! ap;
VSO => s.t.s ++ s.p.s ++ preneg sap ++ s.neg ! ap ++ prev sap ++ s.v ! ap ! cp ++ pres sap ++ s.s ! ap ++ preo sap ++ s.o ! ap;
VOS => s.t.s ++ s.p.s ++ preneg sap ++ s.neg ! ap ++ prev sap ++ s.v ! ap ! cp ++ preo sap ++ s.o ! ap ++ pres sap ++ s.s ! ap ;
OSV => s.t.s ++ s.p.s ++ preo sap ++ s.o ! ap ++ pres sap ++ s.s ! ap ++ preneg sap ++ s.neg ! ap ++ prev sap ++ s.v ! ap ! cp;
OVS => s.t.s ++ s.p.s ++ preo sap ++ s.o ! ap ++ preneg sap ++ s.neg ! ap ++ prev sap ++ s.v ! ap ! cp ++ pres sap ++ s.s ! ap ;
SOV => s.t.s ++ s.p.s ++ pres sap ++ s.s ! ap ++ preo sap ++ s.o ! ap ++ preneg sap ++ s.neg ! ap ++ prev sap ++ s.v ! ap ! cp
-- sadvpos is the position of the sentence adverbial
-- advpos is the position of the adverb
-- detpos is the position of the determiner (relative to the noun)
-- vpos is the position of the main verb (either regular or interleaved)
-- complosp is the position of the verb complement
\\sadvpos,advpos,detpos,verbpos,complpos,order => case order of {
SVO =>
s.t.s ++ s.p.s ++
advpres sadvpos ++ (detpren detpos).s ! Nom ++ s.s ! advpos ++ (verbins verbpos) ! advpos ++ (detpostn detpos).s ! Nom ++ (detpren detpos).sp ! Nom ++
advpreneg sadvpos ++ s.neg ! advpos ++
advprev sadvpos ++ (complprev complpos) ++ (verbreg verbpos) ! advpos ++ (complpostv complpos) ++
advpreo sadvpos ++ s.o ! advpos;
VSO =>
s.t.s ++ s.p.s ++
advpreneg sadvpos ++ s.neg ! advpos ++
advprev sadvpos ++ (complprev complpos) ++ (verbreg verbpos) ! advpos ++ (complpostv complpos) ++
advpres sadvpos ++ (detpren detpos).s ! Nom ++ s.s ! advpos ++ (verbins verbpos) ! advpos ++ (detpostn detpos).s ! Nom ++ (detpren detpos).sp ! Nom ++
advpreo sadvpos ++ s.o ! advpos;
VOS =>
s.t.s ++ s.p.s ++
advpreneg sadvpos ++ s.neg ! advpos ++
advprev sadvpos ++ (complprev complpos) ++ (verbreg verbpos) ! advpos ++ (complpostv complpos) ++
advpreo sadvpos ++ s.o ! advpos ++
advpres sadvpos ++ (detpren detpos).s ! Nom ++ s.s ! advpos ++ (verbins verbpos) ! advpos ++ (detpostn detpos).s ! Nom ++ (detpren detpos).sp ! Nom ;
OSV =>
s.t.s ++ s.p.s ++
advpreo sadvpos ++ s.o ! advpos ++
advpres sadvpos ++ (detpren detpos).s ! Nom ++ s.s ! advpos ++ (verbins verbpos) ! advpos ++ (detpostn detpos).s ! Nom ++ (detpren detpos).sp ! Nom++
advpreneg sadvpos ++ s.neg ! advpos ++
advprev sadvpos ++ (complprev complpos) ++ (verbreg verbpos) ! advpos ++ (complpostv complpos) ;
OVS =>
s.t.s ++ s.p.s ++
advpreo sadvpos ++ s.o ! advpos ++
advpreneg sadvpos ++ s.neg ! advpos ++
advprev sadvpos ++ (complprev complpos) ++ (verbreg verbpos) ! advpos ++ (complpostv complpos) ++
advpres sadvpos ++ (detpren detpos).s ! Nom ++ s.s ! advpos ++ (verbins verbpos) ! advpos ++ (detpostn detpos).s ! Nom ++ (detpren detpos).sp ! Nom ;
SOV =>
s.t.s ++ s.p.s ++
advpres sadvpos ++ (detpren detpos).s ! Nom ++ s.s ! advpos ++ (verbins verbpos) ! advpos ++ (detpostn detpos).s ! Nom ++ (detpren detpos).sp ! Nom ++
advpreo sadvpos ++ s.o ! advpos ++
advpreneg sadvpos ++ s.neg ! advpos ++
advprev sadvpos ++ (complprev complpos) ++ (verbreg verbpos) ! advpos ++ (complpostv complpos)
} ;
defaultSentence : Sentence -> Order => Str = \s -> combineSentence s ! SAPreS ! APreV ! DPreN ! VReg ! CPreV ;
-- questions
mkQuestion : SS -> Clause -> QClause = \ss,cl -> {
s = \\tense,anter,pol,form => case form of {
QDir => ss.s ++ (combineSentence (combineClause cl tense anter pol VQFalse)) ! SPreS ! PreS ! CPreV ! OVS ;
QIndir => ss.s ++ (combineSentence (combineClause cl tense anter pol VQFalse)) ! SPreO ! PreO ! CPreV ! OSV
QDir => ss.s ++ (defaultSentence (combineClause cl tense anter pol VQFalse)) ! OVS ;
QIndir => ss.s ++ (combineSentence (combineClause cl tense anter pol VQFalse)) ! SAPreO ! APreO ! DPreN ! VReg ! CPreV ! OSV
}
};
@@ -1472,8 +1547,8 @@ oper
Below8 = Yes | No8 | No9 | Ign ;
oper
-- Numerals are by default cardinal numbers but have a field for ordinal numbers
TDigit : Type = { s : Unit => Gender => Case => Str ; tenNext : Str ; below8 : Below8 } ; -- ord : Unit => Agr => Str } ;
TNumeral : Type = { s : Gender => Case => Str ; d : Unit => Gender => Case => Str ; n : Number ; below8 : Below8 } ; -- ord : Unit => Agr => Str } ;
TDigit : Type = { s : Unit => Gender => Case => Str ; tenNext : Str ; below8 : Below8 ; ord : Unit => Gender => Number => Case => Str } ;
TNumeral : Type = { s : Gender => Case => Str ; d : { num, ord : Unit => Gender => Case => Str } ; n : Number ; below8 : Below8 ; ord : Gender => Number => Case => Str } ;
-- Inflection for cardinal numbers
cardFlex : Str -> Gender => Case => Str =
@@ -1496,21 +1571,21 @@ oper
} ;
_ => \\_,_ => c
} ;
-- ordFlex : Gender => Number => Case => Str =
-- case o of {
-- stem + "us" => table {
-- Masc => table Number [ table Case [ stem + "us" ; stem + "um" ; stem + "i" ; stem + "o" ; stem + "o" ; stem + "e" ] ;
-- table Case [ stem + "i" ; stem + "os" ; stem + "orum" ; stem + "is" ; stem + "is" ; stem + "i" ] ;
-- ];
-- Fem => table Number [ table Case [ stem + "a" ; stem + "am" ; stem + "ae" ; stem + "ae" ; stem + "a" ; stem + "a" ] ;
-- table Case [ stem + "ae" ; stem + "as" ; stem + "arum" ; stem + "is" ; stem + "is" ; stem + "ae" ] ;
-- ] ;
-- Neutr => table Number [ table Case [ stem + "um" ; stem + "um" ; stem + "i" ; stem + "o" ; stem + "o" ; stem + "um" ] ;
-- table Case [ stem + "a" ; stem + "a" ; stem + "orum" ; stem + "is" ; stem + "is" ; stem + "a" ] ;
-- ]
-- } ;
-- _ => error "unsupported ordinal form"
-- }
ordFlex : Str -> Gender => Number => Case => Str =
\o -> case o of {
stem + "us" => table {
Masc => table Number [ table Case [ stem + "us" ; stem + "um" ; stem + "i" ; stem + "o" ; stem + "o" ; stem + "e" ] ;
table Case [ stem + "i" ; stem + "os" ; stem + "orum" ; stem + "is" ; stem + "is" ; stem + "i" ] ;
];
Fem => table Number [ table Case [ stem + "a" ; stem + "am" ; stem + "ae" ; stem + "ae" ; stem + "a" ; stem + "a" ] ;
table Case [ stem + "ae" ; stem + "as" ; stem + "arum" ; stem + "is" ; stem + "is" ; stem + "ae" ] ;
] ;
Neutr => table Number [ table Case [ stem + "um" ; stem + "um" ; stem + "i" ; stem + "o" ; stem + "o" ; stem + "um" ] ;
table Case [ stem + "a" ; stem + "a" ; stem + "orum" ; stem + "is" ; stem + "is" ; stem + "a" ] ;
]
} ;
_ => error "unsupported ordinal form"
} ;
-- in
-- { s = cardFlex ; n = case c of { "unus" => Sg ; _ => Pl } ; ord = ordFlex } ;

View File

@@ -52,29 +52,31 @@ concrete SentenceLat of Sentence = CatLat ** open Prelude, ResLat in {
{
s = let qs = combineClause cl t t.a p VQTrue in
\\q => case q of {
QDir => cl.q ++ combineSentence qs ! SPreS ! PreV ! CPostV ! SVO ; -- t.s ++ p.s ++ cl.q ++ cl.s ! PreV ++ cl.v ! t.t ! t.a ! VQTrue ! PreV ! CPostV ++ cl.o ! PreV ;
QIndir => cl.q ++ combineSentence qs ! SPreS ! PreV ! CPostV ! SOV -- t.s ++ p.s ++ cl.q ++ cl.s ! PreV ++ cl.o ! PreV ++ cl.v ! t.t ! t.a ! VQTrue ! PreV ! CPostV
QDir => cl.q ++ defaultSentence qs ! SVO ; -- t.s ++ p.s ++ cl.q ++ cl.s ! PreV ++ cl.v ! t.t ! t.a ! VQTrue ! PreV ! CPostV ++ cl.o ! PreV ;
QIndir => cl.q ++ defaultSentence qs ! SOV -- t.s ++ p.s ++ cl.q ++ cl.s ! PreV ++ cl.o ! PreV ++ cl.v ! t.t ! t.a ! VQTrue ! PreV ! CPostV
}
} ;
-- UseRCl t p cl = {
-- UseRCl : Temp -> Pol -> RCl -> RS ;
UseRCl t p cl = {
s = \\g,n => defaultSentence (combineClause (cl.s ! g ! n) (lin Tense t) t.a (lin Pol p) VQFalse) ! SOV ;
-- s = \\r => t.s ++ p.s ++ cl.s ! t.t ! t.a ! ctr p.p ! r ;
-- c = cl.c
-- } ;
} ;
-- UseSlash t p cl = {
-- s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! ctr p.p ! ODir ;
-- c2 = cl.c2
-- } ;
--
-- AdvS : Adv -> S -> S
AdvS adv s = { s = s.s ; o = s.o ; v = s.v ; neg = s.neg ; t = s.t ; p = s.p ; sadv = adv.s ! Posit ++ s.sadv } ;
AdvS adv s = -- { s = s.s ; o = s.o ; v = s.v ; neg = s.neg ; t = s.t ; p = s.p ; sadv = adv.s ! Posit ++ s.sadv } ;
s ** { sadv = adv.s ! Posit ++ s.sadv } ;
-- This covers subjunctive clauses, but they can also be added to the end.
-- SSubjS : S -> Subj -> S -> S ; -- I go home if she comes
-- TO FIX
-- SSubjS s1 subj s2 = { s = \\_ => subj.s ++ s2.s ! PreS ++ s1.s ! PreS ; sadv = lin Adv (mkAdverb []) } ;
-- RelS s r = {s = s.s ++ "," ++ r.s ! agrP3 Sg} ;
-- RelS s r = {s = s.s ! APreV ++ "," ++ r.s } ;
--
-- oper
-- ctr = contrNeg True ; -- contracted negations

View File

@@ -2,51 +2,58 @@
concrete SymbolLat of Symbol = CatLat ** open Prelude, ResLat, ParadigmsLat, TenseX in {
lin
SymbPN i = {s = \\c => i.s ; g = Neutr ; n = Sg } ; --- c
IntPN i = {s = \\c => i.s ; g = Neutr ; n = Sg } ; --- c
FloatPN i = {s = \\c => i.s ; g = Neutr ; n = Sg } ; --- c
NumPN i = {s = \\c => i.s ! Neutr ! c; g = Neutr ; n = Pl } ; --- c
CNIntNP cn i = {
s = \\_,c => (cn.s ! Sg ! Nom ++ i.s) ;
g = cn.g ;
n = Sg ;
adv = [] ;
det = { s = \\_,_ => [] ; n = Sg ; sp = \\_,_ => [] } ;
p = P3 ;
postap = { s = \\_ => [] } ;
preap = { s = \\_ => [] } ;
} ;
CNSymbNP det cn xs = {
s = \\_,c => (cn.s ! Sg ! Nom ++ xs.s ) ;
g = cn.g ;
n = det.n ;
adv = [] ;
det = det ;
p = P3 ;
postap = { s = \\_ => [] } ;
preap = { s = \\_ => [] } ;
} ;
lin
-- SymbPN : Symb -> PN ;
SymbPN i = {s = \\c => i.s ; g = Neutr ; n = Sg } ; --- c
-- IntPN : Int -> PN ;
IntPN i = {s = \\c => i.s ; g = Neutr ; n = Sg } ; --- c
-- FloatPN : Float -> PN ;
FloatPN i = {s = \\c => i.s ; g = Neutr ; n = Sg } ; --- c
-- NumPN : Num -> PN ;
NumPN i = {s = \\c => i.s ! Neutr ! c; g = Neutr ; n = Pl } ; --- c
-- CNIntNP : CN -> Int -> NP ;
CNIntNP cn i = {
s = \\_,c => (cn.s ! Sg ! Nom ++ i.s) ;
g = cn.g ;
n = Sg ;
adv = [] ;
det = { s , sp = \\_ => [] ; n = Sg } ;
p = P3 ;
preap , postap = { s = \\_ => [] } ;
} ;
--CNSymbNP : CN -> Symb -> NP ;
CNSymbNP det cn xs = {
s = \\_,c => (cn.s ! Sg ! Nom ++ xs.s ) ;
g = cn.g ;
n = det.n ;
adv = [] ;
det = { s = det.s ! cn.g ; sp = det.sp ! cn.g } ;
p = P3 ;
preap , postap = { s = \\_ => [] } ;
} ;
-- s = \\c => det.s ++ cn.s ! det.n ! c ++ xs.s ;
-- a = agrgP3 det.n cn.g
-- } ;
-- } ;
CNNumNP cn i = {
s = \\_,c => (cn.s ! Sg ! Nom ++ i.s ! cn.g ! Nom ) ;
g = cn.g ;
n = Sg ;
adv = [] ;
det = { s = \\_,_ => [] ; n = Sg ; sp = \\_,_ => [] } ;
p = P3 ;
postap = { s = \\_ => [] } ;
preap = { s = \\_ => [] } ;
} ;
-- } ;
-- CNNumNP : CN -> Num -> NP ;
CNNumNP cn i = {
s = \\_,c => (cn.s ! Sg ! Nom ++ i.s ! cn.g ! Nom ) ;
g = cn.g ;
n = Sg ;
adv = [] ;
det = { s , sp = \\_ => [] ; n = Sg };
p = P3 ;
preap , postap = { s = \\_ => [] } ;
} ;
--
-- SymbS : Symb -> S ;
SymbS sy = { s = \\_ => sy.s ; o , neg = \\_ => "" ; p = PPos ; sadv = "" ; t = TPres ; v = \\_ => "" ; compl = "" ; det = { s , sp = \\_ => [] ; n = Sg } } ;
SymbS sy = { s = \\_ => sy.s ; neg = \\_ => "" ; o = \\_ => "" ; p = PPos ; sadv = "" ; t = TPres ; v = \\_,_ => "" } ;
--
SymbNum sy = {s = \\_,_ => sy.s ; n = Pl } ;
SymbOrd sy = { s = \\g,n,c => sy.s } ; -- does not inflect properly
-- SymbNum : Symb -> Num
SymbNum sy = {s = \\_,_ => sy.s ; n = Pl } ;
-- SymbOrd : Symb -> Ord
SymbOrd sy = { s = \\g,n,c => sy.s } ; -- does not inflect properly
lincat
Symb, [Symb] = SS ;

View File

@@ -19,15 +19,17 @@ concrete VerbLat of Verb = CatLat ** open (S=StructuralLat),ResLat,IrregLat,Extr
-- ComplVS : VS -> S -> VP ; -- say that she runs
ComplVS vs s = -- insertObj ( dummyNP (S.that_Subj.s ++ s.s ! PreS)) Nom_Prep (predV v) ;
vs ** {
s = \\af,qf => vs.act ! af ;
compl = \\ag => combineSentence s ! SPreS ! PreV ! CPostV ! SOV ; -- s.s ! QIndir ;
s = \\a,q => vs.act ! a ++ case q of { VQTrue => Prelude.BIND ++ "ne"; VQFalse => "" };
pass = \\p,q => vs.pass ! p ++ case q of { VQTrue => Prelude.BIND ++ "ne"; VQFalse => "" };
compl = \\ag => defaultSentence s ! SOV ; -- s.s ! QIndir ;
adv = [] ;
obj = []
} ;
-- ComplVQ : VQ -> QS -> VP ; -- wonder who runs
ComplVQ vq qs = -- insertObj (dummyNP (q.s ! QIndir)) Nom_Prep (predV v) ;
vq ** {
s = \\af,qf => vq.act ! af ;
s = \\a,q => vq.act ! a ++ case q of { VQTrue => Prelude.BIND ++ "ne"; VQFalse => "" };
pass = \\p,q => vq.pass ! p ++ case q of { VQTrue => Prelude.BIND ++ "ne"; VQFalse => "" };
compl = \\ag => qs.s ! QIndir ;
adv = [] ;
obj = []
@@ -115,7 +117,7 @@ concrete VerbLat of Verb = CatLat ** open (S=StructuralLat),ResLat,IrregLat,Extr
-- CompNP : NP -> Comp ; -- (be) the man
CompNP np = {s = \\_ =>
(combineNounPhrase np) ! PronNonDrop ! Nom
(combineNounPhrase np) ! PronNonDrop ! APostN ! DPreN ! Nom ;
} ;
-- CompAdv : Adv -> Comp ; -- (be) here

View File

@@ -1,10 +1,11 @@
import PGF
import System.Environment
import Data.List
import Data.Maybe
main =
do
args <- getArgs -- first one should be pgf file and second one should be the file containing the errors/warnings about missing things
pgf <- PGF.readPGF (args !! 0) -- "tmp/Lang.pgf"
ms <- readFile (args !! 1) {- "tmp/MissingLat.tmp" -} >>= return . map (last . words) . lines
let ts = [PGF.showType [] t | m <- ms, Just t <- [PGF.functionType pgf (PGF.mkCId m)]]
putStrLn $ unlines ["oper " ++ f ++ " : " ++ t ++ " = notYet \"" ++ f ++ "\" ;" | (f,t) <- zip ms ts]
ms <- readFile (args !! 1) {- "tmp/MissingLat.tmp" -} >>= return . nub . sort . map (last . words) . lines
let ts = [maybe ("-- Error: No type found for " ++ m) (\t -> "oper " ++ m ++ " : " ++ PGF.showType [] t ++ " = notYet \"" ++ m ++ "\" ;") $ PGF.functionType pgf (PGF.mkCId m) | m <- ms ]
putStrLn $ unlines ts -- ["oper " ++ f ++ " : " ++ t ++ " = notYet \"" ++ f ++ "\" ;" | (f,t) <- zip ms ts]

View File

@@ -2,6 +2,7 @@
echo "Create tmp dir"
mkdir tmp/
echo "Remove old file"
rm -Rfv tmp/*
echo "resource MissingLat = {} " > MissingLat.gf
echo "Look for missing functions"
# gf -src -i .. -batch TryLat.gf 2>&1 | grep "Warning: no linearization of" | sort -u > tmp/MissingLat.tmp

View File

@@ -65,6 +65,8 @@ lincat
perf :Str;
root : Str;
--morphs : Res.VFormMini => Res.VerbMorphPos =>Str;
isPresBlank :Bool;
isPerfBlank : Bool;
compl : Str; -- after verb: complement, adverbs
isCompApStem : Bool;
whichRel: Res.RForm
@@ -78,6 +80,8 @@ lincat
pres: Str;
perf:Str;
--morphs : Res.VFormMini => Res.VerbMorphPos =>Str; --; compl : Str -- after verb: complement, adverbs
isPresBlank : Bool;
isPerfBlank : Bool;
ap:Str;
isRegular:Bool;
adv:Str;

View File

@@ -1,4 +1,4 @@
abstract DictEngAbs = Cat ** {
abstract DictCggAbs = Cat ** {
{- --beginning of comment

View File

@@ -0,0 +1,5 @@
abstract ExtraCatAbs = Cat **{
cat
TenseExtra;
TempExtra;
}

16
src/rukiga/ExtraCggAbs.gf Normal file
View File

@@ -0,0 +1,16 @@
abstract ExtraCggAbs = Cat **{
-- there is a default linearization for abstract
-- categories Tense and Temp
-- these in TenseX
--
cat
AllTenses;
--TempExtra;
fun
UseClExtra : TempExtra -> Pol -> Cl -> S ; -- she had not slept
UseQClExtra : TempExtra -> Pol -> QCl -> QS ; -- who had not slept
UseRClExtra : TempExtra -> Pol -> RCl -> RS ; -- that had not slept
UseSlashExtra : TempExtra -> Pol -> ClSlash -> SSlash ; -- (that) she had not seen
}

View File

@@ -0,0 +1,14 @@
concrete ExtraCggAbsCgg of ExtraCggAbs = CatCgg
open (R=ResCgg), (P=ParamX) in {
lincat
AllTenses = {s : Str ; t : P.Tense; tExtra : R.TensesExtra } ;
TempExtra = {s : Str ; t : R.TensesExtra } ;
--TempExtraWithAspects = {s : Str ; t : P.Tense ; a : R.AspectsExtra } ;
fun
UseClExtra : TempTempExtra -> Pol -> Cl -> S ; -- she had not slept
UseQClExtra : TempTempExtra -> Pol -> QCl -> QS ; -- who had not slept
UseRClExtra : TempTempExtra -> Pol -> RCl -> RS ; -- that had not slept
UseSlashExtra : TempTempExtra -> Pol -> ClSlash -> SSlash ; -- (that) she had not seen
}

View File

@@ -145,7 +145,7 @@ lin
--today_Adv = mkAdv "erizooba" AgrNo;
father_N2 = mkN2 (mkN "tata" MU_BA) (lin Prep (mkPrep [] [] True)) ;
father_N2 = mkN2 (mkN "tata" ZERO_BAA) (lin Prep (mkPrep [] [] True)) ;
distance_N3 = mkN3 (mkN "orugyendo" ZERO_BU) (lin Prep (mkPrep "kurunga" "" False)) (lin Prep (mkPrep "mpáka" "" False)); --could orugyendo work in its place?

View File

@@ -7,6 +7,7 @@ concrete QuestionCgg of Question = CatCgg ** open ResCgg, Prelude in {
lin
--QuestCl : Cl -> QCl ; -- does John walk
QuestCl cl = cl ** {posibleSubAgr = mkSubjCliticTable};
--QuestVP : IP -> VP -> QCl ; -- who walks
@@ -17,6 +18,8 @@ concrete QuestionCgg of Question = CatCgg ** open ResCgg, Prelude in {
root = vp.s;
pres = vp.pres;
perf = vp.perf;
isPresBlank = vp.isPresBlank;
isPerfBlank = vp.isPerfBlank;
--morphs = vp.morphs;
{-
inf : Str;
@@ -45,6 +48,8 @@ concrete QuestionCgg of Question = CatCgg ** open ResCgg, Prelude in {
root = clSlash.s;
pres = clSlash.pres;
perf = clSlash.perf;
isPresBlank = clSlash.isPresBlank;
isPerfBlank = clSlash.isPerfBlank;
--morphs = clSlash.morphs;
{-
inf : Str;
@@ -66,6 +71,8 @@ concrete QuestionCgg of Question = CatCgg ** open ResCgg, Prelude in {
pres = cl.pres;
perf = cl.perf;
--morphs = cl.morphs;
isPresBlank = cl.isPresBlank;
isPerfBlank = cl.isPerfBlank;
{-
inf : Str;
pres : Str;
@@ -90,6 +97,8 @@ concrete QuestionCgg of Question = CatCgg ** open ResCgg, Prelude in {
pres = be_Copula.pres;
perf = be_Copula.perf;
--morphs = be_Copula.morphs;
isPresBlank = be_Copula.isPresBlank;
isPerfBlank = be_Copula.isPerfBlank;
{-
inf : Str;
pres : Str;
@@ -108,6 +117,8 @@ concrete QuestionCgg of Question = CatCgg ** open ResCgg, Prelude in {
pres = be_Copula.pres;
perf = be_Copula.perf;
--morphs = be_Copula.morphs;
isPresBlank = be_Copula.isPresBlank;
isPerfBlank = be_Copula.isPerfBlank;
{-
inf : Str;
pres : Str;
@@ -126,6 +137,8 @@ concrete QuestionCgg of Question = CatCgg ** open ResCgg, Prelude in {
pres = be_Copula.pres;
perf = be_Copula.perf;
--morphs = be_Copula.morphs;
isPresBlank = be_Copula.isPresBlank;
isPerfBlank = be_Copula.isPerfBlank;
{-
inf : Str;
pres : Str;

View File

@@ -32,6 +32,8 @@ lin
perf =cl.perf;
root = cl.root;
--morphs = cl.morphs;
isPresBlank = cl.isPresBlank;
isPerfBlank = cl.isPerfBlank;
compl =cl.compl;
isCompApStem = False;
whichRel = Such_That;
@@ -52,6 +54,8 @@ lin
perf =vp.perf;
root = vp.s;
--morphs = vp.morphs;
isPresBlank = vp.isPresBlank;
isPerfBlank = vp.isPerfBlank;
compl =vp.comp;
isCompApStem = vp.isCompApStem;
whichRel = RF RSubj;
@@ -76,9 +80,11 @@ lin
rp = rp.s;
--rObjVariant2 = rp.rObjVariant2;
pres = clSlash.pres;
perf = clSlash.perf;
perf = clSlash.perf;
root = clSlash.root;
--morphs = clSlash.morphs;
isPresBlank = clSlash.isPresBlank;
isPerfBlank = clSlash.isPerfBlank;
compl = comp;
isCompApStem = isCompApStem;
whichRel = RF RObj;

View File

@@ -62,6 +62,13 @@ param
-- may not need it
NounCat = ComNoun | PropNoun; --prepositions agree with nouns to form adverbial Phrases
PrepForm = Form1 | Form2; -- omu and omuri, aha, ahari
-- for Extra Tenses not implemented
-- would be better if I had alliases
TensesExtra = RemotePast | ImmediatePast | RemoteFuture;
-- for Extra Aspects not implemented
-- would be better if I had alliases
Aspect = Performative | Perfect | Resultative | Retrospective | Habitual | Progressive | Persitive;
{-
Complete = Nouns with IV,
Incomplete = Nouns without IV: important for use with pre-determiners
@@ -100,6 +107,8 @@ oper
s = rad;
pres = end1;
perf = end2;
isPresBlank = False;
isPerfBlank = False;
--morphs = mkVerbMorphs;
isRegular = False;
};
@@ -109,6 +118,8 @@ oper
pres = "a";
perf = "ire";
--morphs = mkVerbMorphs;
isPresBlank = False;
isPerfBlank = False;
isRegular = True;
};
@@ -1105,6 +1116,8 @@ mkSubjPrefix : Agreement -> Str =\a ->case a of {
pres:Str;
perf:Str;
--morphs: VFormMini => VerbMorphPos=> Str;
isPresBlank : Bool;
isPerfBlank : Bool;
isRegular:Bool
};
@@ -1139,7 +1152,9 @@ mkSubjPrefix : Agreement -> Str =\a ->case a of {
s:Str;
pres:Str;
perf:Str;
--morphs: VMorphs ;
--morphs: VMorphs ;
isPresBlank : Bool;
isPerfBlank : Bool;
isRegular:Bool;
comp:Str ;
comp2:Str;
@@ -1177,13 +1192,17 @@ mkSubjPrefix : Agreement -> Str =\a ->case a of {
s = "ri" ;
pres=[];
perf=[];
--morphs= mkVerbMorphs;
--morphs= mkVerbMorphs;
isPresBlank = True;
isPerfBlank = True;
isRegular=False
};
mkBecome : Verb ={
s = "b" ;
pres="a";
perf="ire";
perf="ire";
isPresBlank = False;
isPerfBlank = False;
--morphs= mkVerbMorphs;
isRegular=False
};
@@ -1339,7 +1358,9 @@ mkSubjPrefix : Agreement -> Str =\a ->case a of {
s:Str;
pres:Str;
perf:Str;
--morphs: VMorphs;
--morphs: VMorphs;
isPresBlank : Bool;
isPerfBlank : Bool;
comp: Str;
comp2:Str;
ap:Str;
@@ -1362,6 +1383,8 @@ mkSubjPrefix : Agreement -> Str =\a ->case a of {
root : Str;
pres: Str;
perf: Str;
isPresBlank : Bool;
isPerfBlank : Bool;
--morphs : VFormMini => VerbMorphPos =>Str;
{-
inf : Str;
@@ -1371,9 +1394,12 @@ mkSubjPrefix : Agreement -> Str =\a ->case a of {
pastPart : Str; -- subject
--root : Str ; -- dep. on Pol,Temp, e.g. "does","sleep"
-}
compl : Str -- after verb: complement, adverbs
compl : Str -- after verb: complement, adverbs
} ;
Comp : Type = {s:Str};
param
CompSource = NounP | ADverb | AdjP | CommonNoun;
oper
Comp : Type = {s:Str; source : CompSource };
--Conjunctions

View File

@@ -24,54 +24,110 @@ lin
compl = cl.compl
in
case <temp.t,temp.a, pol.p> of {
<Pres,Simul, Pos> => {s = subj ++ clitic ++ --Predef.BIND ++
root ++ Predef.BIND ++ presRestOfVerb ++ compl};
<Pres,Simul, Pos> => case cl.isPresBlank of {
True => {s = subj ++ clitic ++ root ++ compl};
False => {s = subj ++ clitic ++ root ++ Predef.BIND ++ compl}
};
{-Note: when I use pol.s instead of ti, the word alignment instead becomes worse-}
<Pres,Simul, Neg> => {s = subj ++ "ti" ++ Predef.BIND ++ clitic ++ --Predef.BIND ++
root ++ presRestOfVerb ++ compl};
<Pres,Anter, Pos> => {s = subj ++ clitic ++ --Predef.BIND ++
vMorphs!VFPresAnt!TAMarker ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl};
<Pres,Anter, Neg> =>{s = subj ++ "ti" ++ Predef.BIND ++ clitic ++ --Predef.BIND ++
vMorphs!VFPresAnt!TAMarker ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl};
<Pres,Simul, Neg> => case cl.isPresBlank of {
True => {s = subj ++ "ti" ++ Predef.BIND ++ clitic ++ root ++ compl};
False => {s = subj ++ "ti" ++ Predef.BIND ++ clitic ++
root ++ Predef.BIND ++ presRestOfVerb ++ compl}
};
<Pres,Anter, Pos> => case cl.isPerfBlank of {
True => {s = subj ++ clitic ++ root ++ compl};
False => {s = subj ++ clitic ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl}
};
<Pres,Anter, Neg> => case cl.isPerfBlank of {
True => {s = subj ++ clitic ++ root ++ compl};
False => {s = subj ++ "ti" ++ Predef.BIND ++ clitic ++
root ++ Predef.BIND ++ pastRestOfVerb ++ compl}
};
<Past,Simul, Pos> => {s = subj ++ clitic ++ --Predef.BIND ++
root ++ Predef.BIND ++ pastRestOfVerb ++ compl};
<Past,Simul, Pos> => case cl.isPerfBlank of {
True => {s = subj ++ clitic ++ "ka" ++ Predef.BIND ++ root ++ compl};
False => {s = subj ++ clitic ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl}
};
{-Note: when I use pol.s instead of ti, the word alignment instead becomes worse-}
<Past,Simul, Neg> => {s = subj ++ "ti" ++ Predef.BIND ++ clitic ++ --Predef.BIND ++
root ++ pastRestOfVerb ++ compl};
<Past,Anter, Pos> => {s = subj ++ clitic ++ "bire" ++ clitic ++ --Predef.BIND ++
vMorphs!VFPastAnt!TAMarker ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl};
<Past,Anter, Neg> =>{s = subj ++ clitic ++ "bire" ++ clitic ++ "ta"--Predef.BIND ++ ant!TAMarker
++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl};
<Past,Simul, Neg> => case cl.isPerfBlank of {
True => {s = subj ++ "ti" ++ Predef.BIND ++ clitic ++ root ++ compl};
False => {s = subj ++ "ti" ++ Predef.BIND ++ clitic ++
root ++ pastRestOfVerb ++ compl}
};
<Fut,Simul, Pos> => {s = subj ++ "ni" ++ Predef.BIND ++clitic ++ "za ku" ++ Predef.BIND ++ --choice of za over ija
root ++ Predef.BIND ++ presRestOfVerb ++ compl};
<Past,Anter, Pos> => case cl.isPerfBlank of {
True => {s = subj ++ clitic ++ "kaba" ++Predef.BIND ++ clitic ++
root ++ compl};
False => {s = subj ++ clitic ++ "kaba" ++ clitic ++ "a" ++ Predef.BIND ++
root ++ Predef.BIND ++ pastRestOfVerb ++ compl}
};
<Past,Anter, Neg> =>case cl.isPerfBlank of {
True => {s = subj ++ clitic ++ "ka" ++Predef.BIND ++ clitic ++
root ++ compl};
False => {s = subj ++ clitic ++ "kaba" ++ clitic ++ "taa" ++ Predef.BIND ++
root ++ Predef.BIND ++ pastRestOfVerb ++ compl}
};
<Fut,Simul, Pos> => case cl.isPresBlank of {
True => {s = subj ++ "ni" ++ Predef.BIND ++clitic ++ "za ku" ++ Predef.BIND ++ --choice of za over ija
root ++ compl};
False => {s = subj ++ "ni" ++ Predef.BIND ++clitic ++ "za ku" ++ Predef.BIND ++ --choice of za over ija
root ++ Predef.BIND ++ presRestOfVerb ++ compl}
};
{-Note: when I use pol.s instead of ti, the word alignment instead becomes worse-}
<Fut,Simul, Neg> => {s = subj ++ "ti" ++ Predef.BIND ++ clitic ++ "kuza ku" ++ Predef.BIND ++
root ++ presRestOfVerb ++ compl};
<Fut,Anter, Pos> => {s = subj ++ "ni" ++ Predef.BIND ++clitic ++ "za kuba" ++ Predef.BIND ++ --choice of za over ija
root ++ Predef.BIND ++ pastRestOfVerb ++ compl};
<Fut,Anter, Neg> =>{s = subj ++ "ni" ++ Predef.BIND ++ clitic ++ "za kuba" ++ clitic ++ "taka" ++ Predef.BIND ++
root ++ pastRestOfVerb ++ compl};
<Cond,Simul, Pos> => {s = subj ++ clitic ++ "kaa" ++Predef.BIND ++
root ++ Predef.BIND ++ presRestOfVerb ++ compl};
<Fut,Simul, Neg> => case cl.isPresBlank of {
True => {s = subj ++ "ti" ++ Predef.BIND ++ clitic ++ "kuza ku" ++ Predef.BIND ++
root ++ compl};
False => {s = subj ++ "ti" ++ Predef.BIND ++ clitic ++ "kuza ku" ++ Predef.BIND ++
root ++ BIND ++ presRestOfVerb ++ compl}
};
<Fut,Anter, Pos> => case cl.isPerfBlank of {
True => {s = subj ++ "ni" ++ Predef.BIND ++clitic ++ "za kuba" ++ Predef.BIND ++ clitic ++ --choice of za over ija
root ++ Predef.BIND ++ "ire" ++ compl};
False => {s = subj ++ "ni" ++ Predef.BIND ++clitic ++ "za kuba" ++ Predef.BIND ++ clitic ++ --choice of za over ija
root ++ Predef.BIND ++ pastRestOfVerb ++ compl}
};
<Fut,Anter, Neg> => case cl.isPerfBlank of {
True => {s = subj ++ "ni" ++ Predef.BIND ++ clitic ++ "za kuba" ++ clitic ++ Predef.BIND ++
root ++ "ire" ++ compl};
False => {s = subj ++ "ni" ++ Predef.BIND ++ clitic ++ "za kuba" ++ clitic ++ "taka" ++ Predef.BIND ++
root ++ pastRestOfVerb ++ compl}
};
<Cond,Simul, Pos> => case cl.isPresBlank of {
True => {s = subj ++ clitic ++ "kaa" ++Predef.BIND ++ root ++ compl};
False => {s = subj ++ clitic ++ "kaa" ++Predef.BIND ++
root ++ Predef.BIND ++ presRestOfVerb ++ compl}
};
{-Note: when I use pol.s instead of ti, the word alignment instead becomes worse-}
<Cond,Simul, Neg> => {s = subj ++ "ti" ++ Predef.BIND ++ clitic ++ "kaa" ++ Predef.BIND ++
root ++ presRestOfVerb ++ compl};
<Cond,Anter, Pos> => {s = subj ++ clitic ++ "kaa"--Predef.BIND ++
++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl};
<Cond,Anter, Neg> =>{s = subj ++ "ti" ++ Predef.BIND ++ clitic ++ "kaa" ++Predef.BIND
<Cond,Simul, Neg> =>case cl.isPresBlank of {
True => {s = subj ++ "ti" ++ Predef.BIND ++ clitic ++ "kaa" ++ Predef.BIND ++
root ++ "ire" ++ compl};
False => {s = subj ++ "ti" ++ Predef.BIND ++ clitic ++ "kaa" ++ Predef.BIND ++
root ++ presRestOfVerb ++ compl}
};
<Cond,Anter, Pos> => case cl.isPerfBlank of {
True => {s = subj ++ clitic ++ "kaa" ++ root ++ compl};
False => {s = subj ++ clitic ++ "kaa" ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl}
};
<Cond,Anter, Neg> =>case cl.isPerfBlank of {
True => {s = subj ++ "ti" ++ Predef.BIND ++ clitic ++ "kaa" ++Predef.BIND
++ root ++ Predef.BIND ++ "ire" ++ compl};
False => {s = subj ++ "ti" ++ Predef.BIND ++ clitic ++ "kaa" ++Predef.BIND
++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl}
}
}; --: Temp -> Pol -> QCl -> QS ; -- has John walked
-- These are the 2 x 4 x 4 = 16 forms generated by different
-- combinations of tense, polarity, and
-- anteriority, which are defined in [``Common`` Common.html].
UseQCl = UseCl; -- : Temp -> Pol -> Cl -> S ; -- John has not walked
QuestCl qcl = qcl; --: Cl -> QCl ; -- does John (not) walk
--UseRCl : Temp -> Pol -> RCl -> RS ; -- that had not slept
UseRCl temp pol rcl = let
@@ -231,6 +287,8 @@ lin
perf = vp.perf;
root = vp.s;
--morphs = vp.morphs;
isPresBlank = vp.isPresBlank;
isPerfBlank = vp.isPerfBlank;
{-
inf = mkVerbInrf vp.root;
pres = mkVerbPres vp.root;
@@ -248,6 +306,8 @@ lin
perf = vp.perf;
root = vp.s;
--morphs = vp.morphs;
isPresBlank = vp.isPresBlank;
isPerfBlank = vp.isPerfBlank;
{-
inf = mkVerbInrf vp.root;
pres = mkVerbPres vp.root;
@@ -256,7 +316,7 @@ lin
pastPart = mkVerbPastPart vp.root; -- subject
-}
--root = vp.root ;
compl = mkSubjClitic np.agr ++ Predef.BIND ++ vp.comp --mkSubjClitic np.agr ++ Predef.BIND ++ vp.comp
compl = mkSubjClitic np.agr ++ vp.comp --mkSubjClitic np.agr ++ Predef.BIND ++ vp.comp
}
};--: NP -> VP -> Cl ; -- John walks / John does not walk
@@ -309,6 +369,8 @@ lin
pres = vpslash.pres;
perf = vpslash.perf;
--morphs = vpslash.morphs;
isPresBlank = vpslash.isPresBlank;
isPerfBlank = vpslash.isPerfBlank;
ap = vpslash.ap;
isRegular = vpslash.isRegular;
adv = vpslash.adv;

View File

@@ -0,0 +1,33 @@
concrete SentenceCggAbsCgg of SentenceCggAbs = CatCgg
open (R=ResCgg) in {
lincat
ExtTense = {s : Str ; t : R.TensesExtra } ;
TempExtra = {s : Str ; t : R.TensesExtra a : R.Aspects} ;
Aspect = {s : Str ; a : R.AspectsExtra } ;
lin
--TAspect -> ExtTense ->Ant -> TempExtra ;
TAspect extT a ={s = extT.s ++ a.s; t = exT.t; a = a.a};
--TRPast : ExtTense ; -- bakagyenda [Remote past]
TRPast = {s = [] ; t = R.Remotepast };
--TIPast : ExtTense ; -- baagyenda [Immediate Past or Memorial ]
TIPast = {s =[] ; t = R.ImmediatePast};
--TRFut : ExtTense ; -- I sleep/slept [simultaneous, not compound]
TRFut = {s = [] ; t = R.RemoteFut};
--APerformative : Aspect ; -- I slept [past, "imperfect"] --# notpresent
APerformative = {s = []; a = R.Performative };
APerfect = {s = []; a = R.Perfect }; -- I will sleep [future] --# notpresent
ARes = {s = []; a = R.Resultative }; -- I would sleep [conditional] --# notpresent
ARetr = {s = []; a = R.Retrospective }; -- I have slept/had slept [anterior, "compound", "perfect"] --# notpresent
AHab = {s = []; a = R.Habitual };
AProg = {s = []; a = R.Progrssive };
APer = {s = []; a = R.Persitive };
UseClExtra : TempExtra -> Pol -> Cl -> S ; -- she had not slept
--UseQClExtra : TempExtra -> Pol -> QCl -> QS ; -- who had not slept
--UseRClExtra : TempExtra -> Pol -> RCl -> RS ; -- that had not slept
--UseSlashExtra : TempExtra -> Pol -> ClSlash -> SSlash ; -- (that) she had not seen
}

View File

@@ -0,0 +1,3 @@
abstract SentenceCggExtra = Cat **{
}

View File

@@ -0,0 +1,25 @@
abstract SentenceCggExtraAbs = Cat **{
cat
ExtTense;
TempExtra;
Aspect;
fun
TAspect -> ExtTense ->Ant -> TempExtra ;
TRPast : ExtTense ; -- bakagyenda [Remote past]
TIPast : ExtTense ; -- baagyenda [Immediate Past or Memorial ]
TRFut : ExtTense ; -- I sleep/slept [simultaneous, not compound]
APerformative : Aspect ; -- I slept [past, "imperfect"] --# notpresent
APerfect : Aspect ; -- I will sleep [future] --# notpresent
ARes : Aspect ; -- I would sleep [conditional] --# notpresent
ARetr : Aspect ; -- I have slept/had slept [anterior, "compound", "perfect"] --# notpresent
AHab : Aspect ;
AProg : Aspect ;
APer : Aspect ;
UseClExtra : TempExtra -> Pol -> Cl -> S ; -- she had not slept
UseQClExtra : TempExtra -> Pol -> QCl -> QS ; -- who had not slept
UseRClExtra : TempExtra -> Pol -> RCl -> RS ; -- that had not slept
UseSlashExtra : TempExtra -> Pol -> ClSlash -> SSlash ; -- (that) she had not seen
}

View File

@@ -97,7 +97,8 @@ lin
n = Sg
};
have_V2 ={s= "ine"; pres=[]; perf =[]; morphs = mkVerbMorphs; comp = []; isRegular=False}; --: V2 ;
have_V2 ={s= "ine"; pres=[]; perf =[]; isPresBlank = False;
isPerfBlank = False; morphs = mkVerbMorphs; comp = []; isRegular=False}; --: V2 ;
{-
All Predeterminers are given here.
@@ -203,12 +204,16 @@ lin
doesAgree = True
};--: Det ;
want_VV = {s = "yend"; pres="da"; perf = "zire"; morphs=mkVerbMorphs; isRegular=True; inf=[]; whenUsed = VVBoth};
can8know_VV = {s = "baas"; pres="a"; perf = "ize"; morphs=mkVerbMorphs; isRegular=True; inf=[]; whenUsed = VVBoth};--: VV ; -- can (capacity)
can_VV = {s = "baas"; pres="a"; perf = "ize"; morphs=mkVerbMorphs; isRegular=True; inf=[]; whenUsed = VVBoth};--: VV ; -- can (possibility)
want_VV = {s = "yend"; pres="da"; perf = "zire"; isPresBlank = False;
isPerfBlank = False; morphs=mkVerbMorphs; isRegular=True; inf=[]; whenUsed = VVBoth};
can8know_VV = {s = "baas"; pres="a"; perf = "ize"; isPresBlank = False;
isPerfBlank = False; morphs=mkVerbMorphs; isRegular=True; inf=[]; whenUsed = VVBoth};--: VV ; -- can (capacity)
can_VV = {s = "baas"; pres="a"; perf = "ize"; isPresBlank = False;
isPerfBlank = False; morphs=mkVerbMorphs; isRegular=True; inf=[]; whenUsed = VVBoth};--: VV ; -- can (possibility)
-- must_VV used especially in the perfective mood: see dictionary entry shemerera on Pg 501 of Mpairwe
-- must has no passive form
must_VV = {s = "shemere"; pres="ra"; perf = "ire"; morphs=mkVerbMorphs; isRegular=False; inf=[]; whenUsed = VVPerf}; --VV
must_VV = {s = "shemere"; pres="ra"; perf = "ire"; isPresBlank = False;
isPerfBlank = False; morphs=mkVerbMorphs; isRegular=False; inf=[]; whenUsed = VVPerf}; --VV
--somebody_NP = {}; --: NP ;
--something_NP : NP ;
--somewhere_Adv : Adv ;

View File

@@ -8,7 +8,9 @@ lin
s = v.s ;
pres =v.pres;
perf = v.perf;
--morphs = v.morphs;
--morphs = v.morphs;
isPresBlank = v.isPresBlank;
isPerfBlank = v.isPerfBlank;
comp =[];
comp2 = [];
ap =[];
@@ -23,14 +25,35 @@ lin
-- UseComp : Comp -> VP ; -- be warm means complement of a copula especially adjectival Phrase
--AdjectivalPhrase : Type = {s : Str ; post : Str; isPre : Bool; isProper : Bool; isPrep: Bool};
UseComp comp = let auxBe = mkBecome
in
{
s = auxBe.s ++ BIND ++auxBe.pres++ comp.s; --Assuming there is no AP which is prepositional
UseComp comp =
--let auxBe = mkBecome
--in
case comp.source of{
AdjP => {
s = mkBecome.s ++ BIND ++ mkBecome.pres; --Assuming there is no AP which is prepositional
pres =[];
perf = [];
isPresBlank = True;
isPerfBlank = True;
--morphs=\\form,morphs=>[];
comp = comp.s;
comp2 = [];
ap = [];
isCompApStem = True;
agr = AgrNo;
isRegular = False;
adv = [];
containsAdv =False;
adV =[];
containsAdV = False
};
_ => {
s = mkBecome.s ++ BIND ++mkBecome.pres++ comp.s; --Assuming there is no AP which is prepositional
pres =[];
perf = [];
--morphs=\\form,morphs=>[];
isPresBlank = True;
isPerfBlank = True;
comp = [];
comp2 = [];
ap = [];
@@ -41,27 +64,32 @@ lin
containsAdv =False;
adV =[];
containsAdV = False
}; --its not generating any sentence
}
}; --its not generating any sentence
-- CompAP : AP -> Comp; -- (be) small
CompAP ap = {s=ap.s! AgP3 Sg KI_BI}; -- used a hack.
CompAP ap = {s=ap.s! AgP3 Sg KI_BI; source = AdjP}; -- used a hack.
-- CompNP : NP -> Comp ; -- (be) the man
CompNP np = {s= np.s ! Acc}; --{s =[] ; post =np.s; isPre = False; isProper = Bool; isPrep: Bool};
CompNP np = {s= np.s ! Acc; source = NounP}; --{s =[] ; post =np.s; isPre = False; isProper = Bool; isPrep: Bool};
-- CompAdv : Adv -> Comp ; -- (be) here
CompAdv adv =adv;
CompAdv adv ={ s= adv.s; source = ADverb};
{-
This has been a hack to simply pick the sigular and complete noun.
-}
--CompCN : CN -> Comp ; -- (be) a man/men
CompCN cn = {s =cn.s ! Sg ! Complete} ; -- (be) a man/men
CompCN cn = {s =cn.s ! Sg ! Complete; source = CommonNoun} ; -- (be) a man/men
-- SlashV2a : V2 -> VPSlash ; -- love (it)
SlashV2a v2 ={
s =v2.s;
pres =v2.pres;
perf = v2.perf;
--morphs = v2.morphs;
isPresBlank = v2.isPresBlank;
isPerfBlank = v2.isPerfBlank;
comp = [];
comp2 =[];
ap =[];
@@ -76,7 +104,9 @@ lin
s =v3.s;
pres =v3.pres;
perf = v3.perf;
--morphs = v3.morphs;
--morphs = v3.morphs;
isPresBlank = v3.isPresBlank;
isPerfBlank = v3.isPerfBlank;
comp = np.s ! Acc;
comp2 =[];
ap =[];
@@ -93,6 +123,8 @@ lin
pres =v3.pres;
perf = v3.perf;
--morphs = v3.morphs;
isPresBlank = v3.isPresBlank;
isPerfBlank = v3.isPerfBlank;
comp = np.s ! Acc;
comp2 = np.s ! Acc; -- what is the meaning of this function?
ap = [];
@@ -107,8 +139,13 @@ lin
s =vv.s;
pres =vv.pres;
perf = vv.perf;
--morphs = vv.morphs;
comp = vpslash.s ++ BIND ++ vpslash.pres;
--morphs = vv.morphs;
isPresBlank = vv.isPresBlank;
isPerfBlank = vv.isPerfBlank;
comp = case vv.isPresBlank of {
False => vpslash.s ++ BIND ++ vpslash.pres;
_ => vpslash.s
};
comp2 = [];
ap = [];
isRegular = vv.isRegular;
@@ -127,7 +164,9 @@ lin
s =vpslash.s;
pres =vpslash.pres;
perf = vpslash.perf;
--morphs = vpslash.morphs;
--morphs = vpslash.morphs;
isPresBlank = vpslash.isPresBlank;
isPerfBlank = vpslash.isPerfBlank;
comp = vpslash.comp ++ np.s ! Acc;
comp2 =vpslash.comp2; --should be empty
ap = [];
@@ -146,7 +185,9 @@ lin
s=vp.s;
pres =vp.pres;
perf = vp.perf;
--morphs = vp.morphs;
--morphs = vp.morphs;
isPresBlank = vp.isPresBlank;
isPerfBlank = vp.isPerfBlank;
comp = adv.s;
comp2 = [];
ap =[];
@@ -164,9 +205,11 @@ lin
s=vp.s;
pres =vp.pres;
perf = vp.perf;
--morphs = vp.morphs;
--morphs = vp.morphs;
isPresBlank = vp.isPresBlank;
isPerfBlank = vp.isPerfBlank;
comp = vp.comp;
comp2 =vp.comp;
comp2 =vp.comp2;
ap = [];
isCompApStem = False;
agr = AgrNo;
@@ -187,7 +230,9 @@ lin
s =vpslash.s;
pres =vpslash.pres;
perf = vpslash.perf;
--morphs = vpslash.morphs;
--morphs = vpslash.morphs;
isPresBlank = vpslash.isPresBlank;
isPerfBlank = vpslash.isPerfBlank;
comp = vpslash.comp;
comp2 = vpslash.comp2;
ap = [];
@@ -207,7 +252,9 @@ lin
s =vpslash.s;
pres =vpslash.pres;
perf = vpslash.perf;
--morphs = vpslash.morphs;
--morphs = vpslash.morphs;
isPresBlank = vpslash.isPresBlank;
isPerfBlank = vpslash.isPerfBlank;
comp = vpslash.comp;
comp2 = vpslash.comp2;
ap = [];
@@ -231,7 +278,9 @@ lin
s= vv.s ++ BIND ++ vv.perf ++ vpPres;
pres = [];--vv.pres;
perf= []; -- vv.perf;
--morphs = vv.morphs;
--morphs = vv.morphs;
isPresBlank = True;
isPerfBlank = True;
comp=vp.comp ;
comp2 = vp.comp2;
ap = [];
@@ -246,7 +295,9 @@ lin
s= vv.s ++ BIND ++ vv.pres ++ vpPres;
pres = [];--vv.pres;
perf= [];--vv.perf;
--morphs = vv.morphs;
--morphs = vv.morphs;
isPresBlank = True;
isPerfBlank = True;
comp=vp.comp ;
comp2 = vp.comp2;
ap = [];
@@ -265,7 +316,9 @@ lin
s= vs.s;
pres =vs.pres;
perf=vs.perf;
--morphs = vs.morphs;
--morphs = vs.morphs;
isPresBlank = vs.isPresBlank;
isPerfBlank = vs.isPerfBlank;
comp=s.s ;
comp2 = [];
ap = [];
@@ -286,7 +339,9 @@ lin
s= vq.s;
pres =vq.pres;
perf=vq.perf;
--morphs = vq.morphs;
--morphs = vq.morphs;
isPresBlank = vq.isPresBlank;
isPerfBlank = vq.isPerfBlank;
comp=qs.s ;
comp2 = [];
ap = [];
@@ -312,7 +367,9 @@ lin
s= va.s;
pres =va.pres;
perf=va.perf;
--morphs = va.morphs;
--morphs = va.morphs;
isPresBlank = va.isPresBlank;
isPerfBlank = va.isPerfBlank;
comp=[] ;
comp2 = [];
ap = ap.s! AgP3 Sg KI_BI;
@@ -327,7 +384,7 @@ lin
-- Copula alone
--UseCopula : VP ; -- be
UseCopula = mkBecome ** {
UseCopula = be_Copula ** {
comp=[];
comp2 = [];
ap = [];

View File

@@ -8,12 +8,15 @@ concrete AdjectiveSom of Adjective = CatSom ** open ResSom, Prelude in {
-- elliptic-relational.
-- : A -> AP ;
PositA a = a ;
PositA a = a ** {
compar = [] ;
} ;
-- : A -> NP -> AP ;
-- ComparA a np = a ** {
-- s = \\agr => np.s ! Abs ++ "ka" ++ a.s ! AF Compar ;
-- } ;
ComparA a np = a ** {
s = \\af => "ka" ++ a.s ! af ;
compar = np.s ! Abs
} ;
-- : A2 -> NP -> AP ; -- married to her
-- ComplA2 a2 np = a2 ** { } ;
@@ -25,7 +28,10 @@ concrete AdjectiveSom of Adjective = CatSom ** open ResSom, Prelude in {
UseA2 = PositA ;
-- : A -> AP ; -- warmer
--UseComparA a = a ** {} ;
UseComparA a = a ** {
s = \\af => "ka" ++ a.s ! af ;
compar = []
} ;
-- : CAdv -> AP -> NP -> AP ; -- as cool as John
@@ -34,13 +40,17 @@ concrete AdjectiveSom of Adjective = CatSom ** open ResSom, Prelude in {
-- The superlative use is covered in $Ord$.
-- : Ord -> AP ; -- warmest
-- AdjOrd ord = ord ** {} ;
AdjOrd ord = ord ** {
compar = []
} ;
-- Sentence and question complements defined for all adjectival
-- phrases, although the semantics is only clear for some adjectives.
-- : AP -> SC -> AP ; -- good that she is here
-- SentAP ap sc = ap ** { } ;
SentAP ap sc = ap ** {
s = \\af => ap.s ! af ++ sc.s -- TODO check
} ;
-- An adjectival phrase can be modified by an *adadjective*, such as "very".

View File

@@ -23,7 +23,7 @@ concrete CatSom of Cat = CommonX - [Adv,IAdv] ** open ResSom, Prelude in {
-- Constructed in QuestionSom.
QCl = ResSom.QClause ;
IComp = ResSom.Complement ; -- interrogative complement of copula e.g. "where"
IComp = SS ; -- interrogative complement of copula e.g. "where"
IDet = ResSom.Determiner ; -- interrogative determiner e.g. "how many"
IQuant = ResSom.Quant ; -- interrogative quantifier e.g. "which"
IP = ResSom.NounPhrase ** {contractSTM : Bool} ; -- like NP but may contract with STM
@@ -66,7 +66,10 @@ concrete CatSom of Cat = CommonX - [Adv,IAdv] ** open ResSom, Prelude in {
Predet = {s : Str ; da : DefArticle ; isPoss : Bool} ;
Quant = ResSom.Quant ;
Num = ResSom.Num ;
Ord = {s : Str ; n : Number} ;
Ord = {
s : AForm => Str ; -- Ord can came from AP and become AP again
n : Number -- Ord can come from Num, which has inherent number
} ;
DAP = ResSom.Determiner ;

View File

@@ -1,17 +1,17 @@
--# -path=.:../common:../abstract
concrete ExtendSom of Extend = CatSom
-- ** ExtendFunctor -- Add this back when all relevant functions are implemented
-- with (Grammar=GrammarSom)
** open Prelude, ResSom in {
** ExtendFunctor - [GenModNP, FocusObj, ComplDirectVS, ComplDirectVQ]
with (Grammar=GrammarSom)
** open Prelude, ResSom, NounSom in {
lin
-- : Num -> NP -> CN -> NP ; -- this man's car(s)
GenModNP num np cn = DetCN (DetQuant IndefArt num) (genModCN cn np) ;
-- : NP -> SSlash -> Utt ; -- her I love -- Saeed p. 189-
FocusObj np sslash = -- FIXME: preposition disappears in negative sentences
let ss = sslash.s ! False ;
ssSub = sslash.s ! True ; -- the negative particle is the same as subordinate, but verb forms come from main clause
obj = objpron np ! Abs ;
in {s = ssSub.beforeSTM ++ "waxa" ++ ssSub.stm ++ ss.afterSTM ++ obj} ;
FocusObj np sslash = {s = sslash.s ! False ++ objpron np ! Abs} ;
-- FocusAdv : Adv -> S -> Utt ; -- today I will sleep
-- FocusAdV : AdV -> S -> Utt ; -- never will I sleep

View File

@@ -1,27 +1,26 @@
--1 Idiom: Idiomatic Expressions
concrete IdiomSom of Idiom = CatSom ** open Prelude, ResSom, VerbSom in {
concrete IdiomSom of Idiom = CatSom ** open Prelude, ResSom, VerbSom, NounSom, StructuralSom in {
-- This module defines constructions that are formed in fixed ways,
-- often different even in closely related languages.
lin
-- : VP -> Cl ; -- it is hot
--ImpersCl = ;
-- : VP -> Cl ; -- one sleeps
GenericCl vp = predVP impersNP (passVP vp) ;
-- ImpersCl : VP -> Cl ; -- it is hot
-- GenericCl : VP -> Cl ; -- one sleeps
ImpersCl,
GenericCl = \vp -> predVP impersNP (passVP vp) ;
{-
CleftNP : NP -> RS -> Cl ; -- it is I who did it
CleftAdv : Adv -> S -> Cl ; -- it is here she slept
-}
-- : NP -> Cl ; -- there is a house
-- ExistNP np =
-- let vp = UseComp (CompNP np)
-- in ;
ExistNP np =
let vp = UseComp (CompNP np)
in predVP impersNP vp ;
{- ExistIP : IP -> QCl ; -- which houses are there

View File

@@ -9,7 +9,7 @@ lin add_V3 = mkV3 "dar" ku NoPrep ;
-- lin alas_Interj = mkInterj "" ;
-- lin already_Adv = mkA "" ;
lin animal_N = mkN "xayawaan" ;
-- lin answer_V2S = mkV2 "" ;
lin answer_V2S = mkV2S "jawaab" ku ;
-- lin apartment_N = mkN "" ;
-- lin apple_N = mkN "" ;
-- lin art_N = mkN "" ;
@@ -252,7 +252,7 @@ lin name_N = mkN "magac" ;
--
-- lin oil_N = mkN "" ;
-- lin old_A = mkA "" ;
-- lin open_V2 = mkV2 "" ;
lin open_V2 = mkV2 "fur" ;
lin paint_V2A = mkV2A "rinjiyee" ;
-- lin paper_N = mkN "" ;
-- lin paris_PN = mkPN "Paris" ;

View File

@@ -21,43 +21,28 @@ oper AdvSlash : ClSlash -> Adv -> ClSlash = notYet "AdvSlash" ;
oper ApposCN : CN -> NP -> CN = notYet "ApposCN" ;
oper BaseAP : AP -> AP -> ListAP = notYet "BaseAP" ;
oper BaseAdV : AdV -> AdV -> ListAdV = notYet "BaseAdV" ;
oper BaseAdv : Adv -> Adv -> ListAdv = notYet "BaseAdv" ;
oper BaseCN : CN -> CN -> ListCN = notYet "BaseCN" ;
oper BaseIAdv : IAdv -> IAdv -> ListIAdv = notYet "BaseIAdv" ;
oper BaseNP : NP -> NP -> ListNP = notYet "BaseNP" ;
oper BaseRS : RS -> RS -> ListRS = notYet "BaseRS" ;
oper BaseS : S -> S -> ListS = notYet "BaseS" ;
oper CAdvAP : CAdv -> AP -> NP -> AP = notYet "CAdvAP" ;
oper CleftAdv : Adv -> S -> Cl = notYet "CleftAdv" ;
oper CleftNP : NP -> RS -> Cl = notYet "CleftNP" ;
oper CompAdv : Adv -> Comp = notYet "CompAdv" ;
oper CompIAdv : IAdv -> IComp = notYet "CompIAdv" ;
oper CompIP : IP -> IComp = notYet "CompIP" ;
oper ComparA : A -> NP -> AP = notYet "ComparA" ;
oper ComparAdvAdj : CAdv -> A -> NP -> Adv = notYet "ComparAdvAdj" ;
oper ComparAdvAdjS : CAdv -> A -> S -> Adv = notYet "ComparAdvAdjS" ;
oper ComplA2 : A2 -> NP -> AP = notYet "ComplA2" ;
oper ComplN3 : N3 -> NP -> N2 = notYet "ComplN3" ;
oper ComplSlashIP : VPSlash -> IP -> QVP = notYet "ComplSlashIP" ;
oper ComplVA : VA -> AP -> VP = notYet "ComplVA" ;
oper ComplVQ : VQ -> QS -> VP = notYet "ComplVQ" ;
oper ComplVS : VS -> S -> VP = notYet "ComplVS" ;
oper ConjAP : Conj -> ListAP -> AP = notYet "ConjAP" ;
oper ConjAdV : Conj -> ListAdV -> AdV = notYet "ConjAdV" ;
oper ConjAdv : Conj -> ListAdv -> Adv = notYet "ConjAdv" ;
oper ConjCN : Conj -> ListCN -> CN = notYet "ConjCN" ;
oper ConjDet : Conj -> ListDAP -> Det = notYet "ConjDet" ;
oper ConjIAdv : Conj -> ListIAdv -> IAdv = notYet "ConjIAdv" ;
oper ConjNP : Conj -> ListNP -> NP = notYet "ConjNP" ;
oper ConjRS : Conj -> ListRS -> RS = notYet "ConjRS" ;
oper ConjS : Conj -> ListS -> S = notYet "ConjS" ;
oper ConsAP : AP -> ListAP -> ListAP = notYet "ConsAP" ;
oper ConsAdV : AdV -> ListAdV -> ListAdV = notYet "ConsAdV" ;
oper ConsAdv : Adv -> ListAdv -> ListAdv = notYet "ConsAdv" ;
oper ConsCN : CN -> ListCN -> ListCN = notYet "ConsCN" ;
oper ConsIAdv : IAdv -> ListIAdv -> ListIAdv = notYet "ConsIAdv" ;
oper ConsNP : NP -> ListNP -> ListNP = notYet "ConsNP" ;
oper ConsRS : RS -> ListRS -> ListRS = notYet "ConsRS" ;
oper ConsS : S -> ListS -> ListS = notYet "ConsS" ;
oper CountNP : Det -> NP -> NP = notYet "CountNP" ;
oper DefArt : Quant = notYet "DefArt" ;
@@ -68,23 +53,16 @@ oper DetNP : Det -> NP = notYet "DetNP" ;
oper DetQuant : Quant -> Num -> Det = notYet "DetQuant" ;
oper DetQuantOrd : Quant -> Num -> Ord -> Det = notYet "DetQuantOrd" ;
oper EmbedQS : QS -> SC = notYet "EmbedQS" ;
oper EmbedS : S -> SC = notYet "EmbedS" ;
oper EmbedVP : VP -> SC = notYet "EmbedVP" ;
oper ExistIP : IP -> QCl = notYet "ExistIP" ;
oper ExistIPAdv : IP -> Adv -> QCl = notYet "ExistIPAdv" ;
oper ExistNP : NP -> Cl = notYet "ExistNP" ;
oper ExistNPAdv : NP -> Adv -> Cl = notYet "ExistNPAdv" ;
oper ExtAdvS : Adv -> S -> S = notYet "ExtAdvS" ;
oper ExtAdvVP : VP -> Adv -> VP = notYet "ExtAdvVP" ;
oper FunRP : Prep -> NP -> RP -> RP = notYet "FunRP" ;
oper GenericCl : VP -> Cl = notYet "GenericCl" ;
oper IdRP : RP = notYet "IdRP" ;
oper IdetIP : IDet -> IP = notYet "IdetIP" ;
oper IdetQuant : IQuant -> Num -> IDet = notYet "IdetQuant" ;
oper ImpP3 : NP -> VP -> Utt = notYet "ImpP3" ;
oper ImpPl1 : VP -> Utt = notYet "ImpPl1" ;
oper ImpVP : VP -> Imp = notYet "ImpVP" ;
oper ImpersCl : VP -> Cl = notYet "ImpersCl" ;
oper NumCard : Card -> Num = notYet "NumCard" ;
oper NumDigits : Digits -> Card = notYet "NumDigits" ;
oper NumNumeral : Numeral -> Card = notYet "NumNumeral" ;
@@ -102,21 +80,10 @@ oper PossPron : Pron -> Quant = notYet "PossPron" ;
oper PredSCVP : SC -> VP -> Cl = notYet "PredSCVP" ;
oper PredetNP : Predet -> NP -> NP = notYet "PredetNP" ;
oper PrepIP : Prep -> IP -> IAdv = notYet "PrepIP" ;
oper ProgrVP : VP -> VP = notYet "ProgrVP" ;
oper QuestCl : Cl -> QCl = notYet "QuestCl" ;
oper QuestIAdv : IAdv -> Cl -> QCl = notYet "QuestIAdv" ;
oper QuestIComp : IComp -> NP -> QCl = notYet "QuestIComp" ;
oper QuestQVP : IP -> QVP -> QCl = notYet "QuestQVP" ;
oper QuestSlash : IP -> ClSlash -> QCl = notYet "QuestSlash" ;
oper QuestVP : IP -> VP -> QCl = notYet "QuestVP" ;
oper ReflA2 : A2 -> AP = notYet "ReflA2" ;
oper RelCN : CN -> RS -> CN = notYet "RelCN" ;
oper RelCl : Cl -> RCl = notYet "RelCl" ;
oper RelNP : NP -> RS -> NP = notYet "RelNP" ;
oper RelS : S -> RS -> S = notYet "RelS" ;
oper RelSlash : RP -> ClSlash -> RCl = notYet "RelSlash" ;
oper RelVP : RP -> VP -> RCl = notYet "RelVP" ;
oper SSubjS : S -> Subj -> S -> S = notYet "SSubjS" ;
oper SelfAdVVP : VP -> VP = notYet "SelfAdVVP" ;
oper SelfAdvVP : VP -> VP = notYet "SelfAdvVP" ;
oper SelfNP : NP -> NP = notYet "SelfNP" ;
@@ -125,10 +92,8 @@ oper SentCN : CN -> SC -> CN = notYet "SentCN" ;
oper SlashPrep : Cl -> Prep -> ClSlash = notYet "SlashPrep" ;
oper SlashV2A : V2A -> AP -> VPSlash = notYet "SlashV2A" ;
oper SlashV2Q : V2Q -> QS -> VPSlash = notYet "SlashV2Q" ;
oper SlashV2S : V2S -> S -> VPSlash = notYet "SlashV2S" ;
oper SlashV2V : V2V -> VP -> VPSlash = notYet "SlashV2V" ;
oper SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash = notYet "SlashV2VNP" ;
oper SlashVP : NP -> VPSlash -> ClSlash = notYet "SlashVP" ;
oper SlashVS : NP -> VS -> SSlash -> ClSlash = notYet "SlashVS" ;
oper SlashVV : VV -> VPSlash -> VPSlash = notYet "SlashVV" ;
oper SubjS : Subj -> S -> Adv = notYet "SubjS" ;

View File

@@ -13,15 +13,15 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in {
a = getAgr det.n (gender cn) } where {
sTable : Case => Str = \\c =>
let nfc : {nf : NForm ; c : Case} =
case <det.isNum,c,cn.hasMod,det.st,det.n> of {
case <det.numtype,c,cn.modtype,det.st,det.n> of {
-- Numbers
<True,_,_,_,_> => {nf=Numerative ; c=c} ;
<Basic|Compound,_,_,_,_> => {nf=Numerative ; c=c} ;
-- special form for fem. nouns
<_,Nom,False,Indefinite,Sg> => {nf=NomSg ; c=c} ;
<_,Nom,NoMod|OtherMod,Indefinite,Sg> => {nf=NomSg ; c=c} ;
-- If cn has modifier, Nom ending attaches to the modifier
<_,Nom,True,_,_> => {nf=Def det.n ; c=Abs} ;
<_,Nom,AMod,_,_> => {nf=Def det.n ; c=Abs} ;
-- a Det with st=Indefinite uses Indef forms
<_,_,_,Indefinite,n> => {nf=Indef n ; c=c} ;
@@ -30,13 +30,24 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in {
_ => {nf=Def det.n ; c=c}
} ;
art = gda2da cn.gda ! det.n ;
num = case det.isNum of {True => Sg ; _ => det.n} ;
num = case isNum det.numtype of {True => Sg ; _ => det.n} ;
dt : {pref,s : Str} =
case <nfc.nf,cn.isPoss,andB det.isPoss cn.shortPoss> of {
<Numerative,_,_> => {s = [] ; pref = det.s ! art ! nfc.c} ; -- determiner comes before CN
<_, True,_> => {pref = [] ; s = det.sp ! gender cn ! nfc.c} ; -- CN has undergone ComplN2 and is already quantified
<_,_, True> => {pref = [] ; s = BIND ++ det.shortPoss ! art} ;
_ => {pref = [] ; s = det.s ! art ! nfc.c}
-- Det is a cardinal number. The number is the head of the NP,
-- and CN becomes its modifier. If CN has modifiers of its own,
-- we insert the conjunction "oo" between the number and the CN.
<Numerative,_,_> =>
let oo = case det.numtype of {Compound => "oo" ; _ => []}
in {s = [] ; pref = det.s ! art ! nfc.c ++ oo} ;
-- CN has undergone ComplN2 and is already quantified
<_,True,_> => {pref = [] ; s = det.sp ! gender cn ! nfc.c} ;
-- CN is e.g. a kinship term and takes short possessive
<_,_,True> => {pref = [] ; s = BIND ++ det.shortPoss ! art} ;
-- Default case
_ => {pref = [] ; s = det.s ! art ! nfc.c}
} ;
in dt.pref -- if det is numeral
++ cn.s ! nfc.nf
@@ -56,15 +67,15 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in {
UsePron pron = pron ** {st = Definite} ;
-- : Predet -> NP -> NP ; -- only the man
PredetNP predet np =
PredetNP predet np =
let qnt = PossPron (pronTable ! np.a) ;
det = qnt.shortPoss ! predet.da ;
predetS : Str = case predet.isPoss of {
True => glue predet.s det ;
False => predet.s
False => predet.s
} ;
in np ** {
s = \\c =>
s = \\c =>
case <np.isPron,predet.isPoss> of {
<True,True> => np.empty ++ predetS ;
_ => np.s ! c ++ predetS} ;
@@ -120,30 +131,26 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in {
-- : Quant -> Num -> Det ;
DetQuant quant num = let indep = Hal in quant ** {
s = \\da,c =>
case num.isNum of {
case isNum num.numtype of {
True => num.s ! indep ++ quant.s ! num.da ! c ++ num.thousand ;
False => num.s ! indep ++ quant.s ! da ! c ++ num.thousand } ;
sp = \\g,c => case <num.n,g> of { -- TODO check what happens when num.isNum
sp = \\g,c => case <num.n,g> of {
<Sg,Masc> => num.s ! indep ++ quant.sp ! SgMasc ! c ++ num.thousand ;
<Sg,Fem> => num.s ! indep ++ quant.sp ! SgFem ! c ++ num.thousand ;
-- Independent form uses plural morpheme, not gender-flipped allomorph
<Pl,_> => num.s ! indep ++ quant.sp ! PlInv ! c ++ num.thousand } ;
isNum = num.isNum ;
numtype = num.numtype ;
n = num.n ;
shortPoss = \\da => quant.shortPoss ! da ++ num.s ! indep
} ;
-- d = case <num.isNum,quant.st> of {
-- <True,_> => Numerative ;
-- <False,Definite> => Def num.n quant.v ;
-- <False,Indefinite> => Indef num.n } ;
-- : Quant -> Num -> Ord -> Det ; -- these five best
DetQuantOrd quant num ord =
let theseFive = DetQuant quant num in theseFive ** {
s = \\g,c => theseFive.s ! g ! c ++ ord.s ;
sp = \\g,c => theseFive.sp ! g ! c ++ ord.s ;
shortPoss = \\da => theseFive.shortPoss ! da ++ ord.s
s = \\g,c => theseFive.s ! g ! c ++ ord.s ! AF num.n c ;
sp = \\g,c => theseFive.sp ! g ! c ++ ord.s ! AF num.n c ;
shortPoss = \\da => theseFive.shortPoss ! da ++ ord.s ! AF num.n Abs
} ;
-- Whether the resulting determiner is singular or plural depends on the
@@ -157,7 +164,11 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in {
NumPl = baseNum ** {n = Pl} ;
-- : Card -> Num ;
NumCard card = card ** {isNum = True} ;
NumCard card = card ** {
numtype = case card.hasThousand of {
True => Compound ;
False => Basic }
} ;
-- : Digits -> Card ;
-- NumDigits dig = { s = dig.s ! NCard ; n = dig.n } ;
@@ -173,17 +184,20 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in {
OrdDigits digs = digs ** { s = digs.s ! NOrd } ;
-}
-- : Numeral -> Ord ;
OrdNumeral num = num ** {s = num.ord} ;
OrdNumeral num = num ** {
s = \\_ => num.ord
} ;
{-
-- : A -> Ord ;
OrdSuperl a = { } ;
OrdSuperl a = {
s = \\af => "ugu" ++ a.s ! af ;
n = Sg -- ?? is this meaningful?
} ;
-- One can combine a numeral and a superlative.
-- : Numeral -> A -> Ord ; -- third largest
OrdNumeralSuperl num a = num ** { } ;
-}
-- OrdNumeralSuperl num a = num ** { } ;
-- : Quant
DefArt = defQuant "a" "kan" "tan" "kuwan" False ;
@@ -212,21 +226,7 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in {
UseN,UseN2 = ResSom.useN ;
-- : N2 -> NP -> CN ; -- Sahra hooyadeed
ComplN2 n2 np = let cn = useN n2 in cn ** {s = \\nf =>
let num = case nf of {
Def n => n ;
Indef n => n ;
_ => Sg } ;
art = gda2da cn.gda ! num ;
qnt = PossPron (pronTable ! np.a) ;
det = case cn.shortPoss of {
True => qnt.shortPoss ! art ;
_ => qnt.s ! sg n2.gda ! Abs } ;
noun = case np.isPron of {
True => (pronTable ! np.a).sp ! Abs ; -- long subject pronoun
False => np.s ! Abs }
in noun ++ cn.s ! Def num ++ BIND ++ det ;
isPoss = True} ;
ComplN2 n2 np = genModCN (useN n2) np ;
{-
-- : N3 -> NP -> N2 ; -- distance from this city (to Paris)
@@ -242,22 +242,28 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in {
Use3N3 n3 = lin N2 n3 ;
-- : AP -> CN -> CN
AdjCN ap cn = cn ** {
s = table { NomSg => cn.s ! Indef Sg ; -- When an adjective is added, noun loses case marker.
x => cn.s ! x } ;
s = table { -- Add oo after Numerative only if this is CN's first modifier.
Numerative => cn.s ! Numerative
++ andConj Indefinite (notMod cn.modtype) ;
NomSg => cn.s ! Indef Sg ; -- Add adj -> noun loses case marker
nf => cn.s ! nf } ;
mod = \\st,n,c =>
cn.mod ! st ! n ! Abs -- If there was something before, it is now in Abs
++ andConj st cn.hasMod -- If the sentence is already modified, any new modifier needs to be introduced with conjunction
++ andConj st cn.modtype -- If the sentence is already modified, any new modifier needs to be introduced with conjunction
++ ap.s ! AF n c ;
hasMod = True
modtype = AMod
} ;
-- : CN -> RS -> CN ;
RelCN cn rs = cn ** {
s = table {
Numerative => cn.s ! Numerative ++ andConj Indefinite (notMod cn.modtype) ;
nf => cn.s ! nf } ;
mod = \\st,n,c => --what to do with subject case if there's both adj and RS?
cn.mod ! st ! n ! Abs
++ andConj st cn.hasMod
++ andConj st cn.modtype
++ rs.s ! st ! gennum cn Sg ! c ; -- gennum cn Sg, because plural form is only for 1st person plural
hasMod = True ;
modtype = AMod
} ;
{-
@@ -286,11 +292,23 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in {
PossNP cn np = cn ** { -- guriga Axmed, not Axmed gurigiisa
mod = \\st,n,c => cn.mod ! st ! n ! c ++ objpron np ! Abs
} ;
{-
-- : CN -> NP -> CN ; -- glass of wine / two kilos of red apples
PartNP cn np = cn ** { } ;
PartNP cn np = cn ** {
s = table {
Numerative => cn.s ! Numerative ++ andConj Indefinite (notMod cn.modtype) ;
nf => cn.s ! nf } ;
mod = \\st,n,c =>
cn.mod ! st ! n ! c
++ andConj st cn.modtype -- If the sentence is already modified, any new modifier needs to be introduced with conjunction
++ objpron np ! Abs
++ "ah" ;
modtype = case cn.modtype of {
AMod => AMod ;
_ => OtherMod }
} ;
{-
-- This is different from the partitive, as shown by many languages.
@@ -308,10 +326,28 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in {
-}
oper
andConj : State -> Bool -> Str = \st,hasMod ->
case <st,hasMod> of {
<Indefinite,True> => "oo" ;
<Definite,True> => "ee" ;
_ => []
andConj : State -> ModType -> Str = \st,mod ->
case <st,mod> of {
<Indefinite,AMod|OtherMod> => "oo" ;
<Definite,AMod|OtherMod> => "ee" ;
_ => []
} ;
genModCN : CN -> NP -> CN = \cn,np -> cn ** {
s = \\nf =>
let num = case nf of {
Def n => n ;
Indef n => n ;
_ => Sg } ;
art = gda2da cn.gda ! num ;
qnt = PossPron (pronTable ! np.a) ;
det = case cn.shortPoss of {
True => qnt.shortPoss ! art ;
_ => qnt.s ! sg cn.gda ! Abs } ;
noun = case np.isPron of {
True => (pronTable ! np.a).sp ! Abs ; -- long subject pronoun
False => np.s ! Abs }
in noun ++ cn.s ! Def num ++ BIND ++ det ;
isPoss = True} ;
}

View File

@@ -40,6 +40,7 @@ lincat
Sub10, Sub100, Sub1000, Sub1000000 = {
s : DForm => Str ;
thousand : Str ; -- TODO figure out if this really works so
hasThousand : Bool ;
ord : Str ;
da : DefArticle ;
n : Number
@@ -64,25 +65,28 @@ lin n7 = mkNum2 "toddoba" "toddobaatan" ;
lin n8 = mkNum2Masc "siddeed" "siddeetan" ;
lin n9 = mkNum2Masc "sagaal" "sagaashan" ;
lin pot01 = n1.unit ** {n = Sg ; thousand = []} ;
lin pot01 = n1.unit ** {n = Sg ; thousand = [] ; hasThousand = False} ;
lin pot0 d = d.unit ** {n = Pl ; thousand = []} ;
lin pot0 d = d.unit ** {n = Pl ; thousand = [] ; hasThousand = False} ;
lin pot110 = n1.ten ** {
s = \\df => n1.ten.s ;
thousand = [] ;
hasThousand = False ;
n = Pl
} ;
lin pot111 = {
s = \\_ => "koob iyo" ++ n1.ten.s ;
ord = "koob iyo" ++ n1.ten.ord ;
thousand = [] ;
hasThousand = False ;
da = M KA ;
n = Pl
} ;
lin pot1to19 d = {
s = \\_ => d.unit.s ! Hal ++ "iyo" ++ n1.ten.s ;
thousand = [] ;
hasThousand = False ;
ord = d.unit.s ! Hal ++ "iyo" ++ n1.ten.ord ;
da = M KA ;
n = Pl
@@ -91,26 +95,31 @@ lin pot0as1 n = n ;
lin pot1 d = d.ten ** {
s = \\df => d.ten.s ;
thousand = [] ;
hasThousand = False ;
n = Pl
} ;
lin pot1plus d e = d.ten ** {
s = \\b => e.s ! b ++ "iyo" ++ d.ten.s ;
ord = e.s ! Hal ++ "iyo" ++ d.ten.ord ;
thousand = [] ;
hasThousand = False ;
n = Pl ;
} ;
lin pot1as2 n = n ;
lin pot2 d = d ** {
thousand = "boqol" ;
hasThousand = True ;
ord = d.s ! Hal ++ "boqlaad"
} ;
lin pot2plus d e = d ** {
thousand = "boqol iyo" ++ e.s ! Hal ;
hasThousand = True ;
ord = d.s ! Hal ++ "boqol iyo" ++ e.ord ;
n = Pl} ;
lin pot2as3 n = n ;
lin pot3 n = n ** {
thousand = n.thousand ++ "kun" ;
hasThousand = True ;
ord = n.s ! Hal ++ "kunaad" ;
n = Pl } ;
@@ -119,9 +128,7 @@ lin pot3plus n m = n ** {
ord = n.ord ++ "kun iyo" ++ m.ord ;
n = Pl} ;
--TODO:
-- two thousand small cats
-- => laba kun oo bisadood oo yar (kun and bisadood are both attributes)
----------------------------------------------------------------------------
lincat Dig = TDigit ;

View File

@@ -95,6 +95,11 @@ oper
mkVV : V -> VVForm -> VV ; -- VV out of an existing V
} ;
mkV2S : overload {
mkV2S : Str -> V2S ; -- Predictable verb, no preposition.
mkV2S : Str -> Preposition -> V2S ; -- Predictable verb, preposition given as second argument.
mkV2S : V -> Preposition -> V2S -- Unpredictable verb, preposition.
} ;
mkVA : Str -> VA
= \s -> lin VA (regV s) ;
@@ -107,8 +112,6 @@ oper
= \s -> lin V2A (regV s ** {c2 = noPrep}) ;
mkV2V : Str -> V2V
= \s -> lin V2V (regV s ** {c2 = noPrep}) ;
mkV2S : Str -> V2S
= \s -> lin V2S (regV s ** {c2 = noPrep}) ;
mkV2Q : Str -> V2Q
= \s -> lin V2Q (regV s ** {c2 = noPrep}) ;
@@ -248,6 +251,15 @@ oper
in lin VV (dummyV ** {vvtype=b ; s = \\_ => "in"})
} ;
mkV2S = overload {
mkV2S : Str -> V2S -- Predictable verb, no preposition.
= \s -> lin V2S (regV s ** {c2 = noPrep}) ;
mkV2S : Str -> Preposition -> V2S -- Predictable verb, preposition given as second argument.
= \s,pr -> lin V2S (regV s ** {c2 = pr}) ;
mkV2S : V -> Preposition -> V2S -- Unpredictable verb, preposition.
= \v,pr -> lin V2S (v ** {c2 = pr})
} ;
possPrep : N -> CatSom.Prep = \dhex -> emptyPrep ** {
hoostiisa = \\agr =>
let qnt = PossPron (pronTable ! agr) ;

View File

@@ -210,12 +210,29 @@ param
CardOrd = NOrd | NCard ;
-- to know whether to put oo in between numeral and CN
NumType = NoNum | Basic | Compound ;
oper
isNum : NumType -> Bool = \nt -> case nt of {
NoNum => False ;
_ => True
} ;
--------------------------------------------------------------------------------
-- Adjectives
param
AForm = AF Number Case ; ---- TODO: past tense
ModType = NoMod | AMod | OtherMod ;
oper
-- to flip ModType
notMod : ModType -> ModType = \mt -> case mt of {
NoMod => OtherMod ;
_ => NoMod
} ;
--------------------------------------------------------------------------------
-- Prepositions
@@ -244,6 +261,15 @@ oper
Single _ => oneWay ! p1 ! p2 ;
z => z } ;
combinePassive : Preposition -> PrepCombination = \p ->
case p of {
U => Loo ;
Ku => Lagu ;
Ka => Laga ;
La => Lala ;
_ => Passive
} ;
isPassive : {c2 : PrepCombination} -> Bool = \vp ->
case vp.c2 of {
Passive | Lagu | Laga | Loo | Lala => True ;

View File

@@ -24,8 +24,8 @@ concrete QuestionSom of Question = CatSom ** open
subj = cls.subj ** { -- keep old subject pronoun,
noun = ip.s ! Nom -- and place IP first.
} ;
obj2 = cls.obj2 ** { -- move old subject noun before object.
s = cls.subj.noun ++ cls.obj2.s
obj = cls.obj ** { -- move old subject noun before object.
s = cls.subj.noun ++ cls.obj.s
} ;
stm = modSTM "baa" baan cls.stm
} ;
@@ -50,7 +50,7 @@ concrete QuestionSom of Question = CatSom ** open
-- : IComp -> NP -> QCl ; -- where is John?
QuestIComp icomp np =
let cls = predVP np (VS.UseComp icomp) ;
let cls = predVP np (VS.UseComp (icomp2comp icomp)) ;
-- cl = cls ** { -- TODO: neg. questions
-- stm : ClType=>Polarity=>Str = \\_,_ => "waa"
-- }
@@ -87,15 +87,10 @@ concrete QuestionSom of Question = CatSom ** open
-- pronouns.
-- : IAdv -> IComp ;
CompIAdv iadv = { -- where (is it)
comp = \\_ => <[], iadv.s> ;
stm = Waa NoCopula ;
} ;
CompIAdv iadv = iadv ; -- where (is it)
-- : IP -> IComp ;
CompIP ip = { -- who (is it)
comp = \\_ => <[], ip.s ! Abs> ;
stm = Waa NoCopula ;
} ;
CompIP ip = {s = ip.s ! Abs} ; -- who (is it)
{-
-- More $IP$, $IDet$, and $IAdv$ are defined in $Structural$.
@@ -112,4 +107,25 @@ concrete QuestionSom of Question = CatSom ** open
QuestQVP : IP -> QVP -> QCl ; -- who buys what where
-}
oper
icomp2comp : SS -> Complement = \icomp -> icomp ** {
aComp = \\_ => [] ;
nComp = icomp.s ;
compar = [] ;
stm = Waa NoCopula
} ;
-- Question clauses: subject pronoun not included, STM is
cl2qcl : ClType -> Bool -> ClSlash -> Clause = \cltyp ->
let hasSubjPron : Bool = False ;
isRel : Bool = False ;
in mkClause cltyp isRel hasSubjPron ;
-- Question clause with wh-word as object: subject pronoun is included
cl2qclslash : Bool -> ClSlash -> Clause =
let hasSubjPron : Bool = True ;
isRel : Bool = False ;
in mkClause PolarQuestion isRel hasSubjPron ;
}

View File

@@ -36,4 +36,28 @@ lin
-- : Prep -> NP -> RP -> RP ; -- the mother of whom
--FunRP prep np rp = {} ;
oper
-- RelVP: subject pronoun is never included
cl2rcl : ClSlash -> Clause =
let hasSubjPron : Bool = False ;
hasSTM : Bool = False ;
isRel : Bool = True ;
in mkClause Subord isRel hasSubjPron hasSTM ;
-- No subject pronoun, no STM, but use verb forms from Statement
cl2rclNom : ClSlash -> Clause = \cls ->
let hasSubjPron : Bool = False ;
hasSTM : Bool = False ;
isRel : Bool = True ;
in mkClause Statement isRel hasSubjPron hasSTM cls ;
-- RelSlash: subject pronoun is included if it's not 3rd person
-- TODO check this rule with more example sentences
cl2relslash : ClSlash -> Clause =
let hasSubjPron : Bool = True ;
hasSTM : Bool = False ;
isRel : Bool = True ;
in mkClause Subord isRel hasSubjPron hasSTM ;
}

View File

@@ -15,7 +15,7 @@ oper
CNoun : Type = Noun ** {
mod : State -- for conjunctions: oo for indef, ee for def
=> Number => Case => Str ;
hasMod : Bool ;
modtype : ModType ;
isPoss : Bool -- to prevent impossible forms in ComplN2 with Ns that have short possessive, e.g. "father"
} ;
@@ -46,12 +46,16 @@ oper
magacya + "da" => magacya ;
wiila + "sha" => wiila ;
_ => wiilal} ;
bisadi : Str = case gender of
{ Fem => case wiil of { _ + #c => wiil+"i" ; _ => wiil} ;
Masc => wiil } ;
bisadood : Str = case gender of
{ Fem => case wiilal of {_ + "o" => wiilal+"od" ; _ => wiil} ;
Masc => wiil }
bisadi : Str = case gender of {
Fem => case wiil of {
_ + #c => wiil+"i" ;
_ => wiil } ;
Masc => wiil } ;
bisadood : Str = case gender of {
Fem => case wiilal of {
_ + "o" => wiilal+"od" ;
_ => wiil } ;
Masc => wiil }
} ;
-------------------------
@@ -155,7 +159,7 @@ oper
False => np.s} ;
useN : Noun -> CNoun ** BaseNP = \n -> n **
{ mod = \\_,_,_ => [] ; hasMod = False ;
{ mod = \\_,_,_ => [] ; modtype = NoMod ;
a = Sg3 (gender n) ; isPron,isPoss = False ;
empty = [] ; st = Indefinite
} ;
@@ -275,7 +279,7 @@ oper
Determiner : Type = BaseQuant ** {
sp : Gender => Case => Str ;
n : Number ;
isNum : Bool ; -- placement in NP + whether to choose Numerative from CN
numtype : NumType ; -- placement in NP + whether to choose Numerative from CN
} ;
Quant : Type = BaseQuant ** {
@@ -285,6 +289,7 @@ oper
BaseNum : Type = {
s : DForm => Str ; -- independent or attribute
thousand : Str ; -- TODO check where possessive suffix goes
hasThousand : Bool ;
da : DefArticle ;
n : Number
} ;
@@ -292,13 +297,14 @@ oper
baseNum : Num = {
s = \\_ => [] ;
thousand = [] ;
hasThousand = False ;
da = M KA ;
n = Sg ;
isNum = False
numtype = NoNum
} ;
Num : Type = BaseNum ** {
isNum : Bool -- whether to choose Numerative as the value of NForm
numtype : NumType -- whether to choose Numerative as the value of NForm
} ;
Numeral : Type = BaseNum ** {
@@ -422,17 +428,9 @@ oper
-- Sequences of adjectives follow the rules for restrictive relatives clauses, i.e. are linked by oo 'and' on an indefinite head NounPhrase and by ee 'and' on a definite NounPhrase (8.1).
-- Komparativ
-- För att uttrycka motsvarigheten till svenskans komparativ placerar man på somaliska helt enkelt prepositionen ká 'från, av, än' framför adjektivet i fråga. Adjektivet får ingen ändelse.
-- Shan waa ay ká yar tahay siddéed. Fem är mindre än åtta.
-- Superlativ
-- Motsvarigheten till svenskans superlativ bildas med prepositionsklustret ugú som till sin betydelse närmast motsvarar svenskans allra, t.ex.
-- ugu horrayntii (det att komma) allra först
Adjective : Type = {s : AForm => Str} ;
Adjective2 : Type = Adjective ** {c2 : Preposition} ;
duplA : Str -> Adjective = \yar ->
let yaryar = duplicate yar
in mkAdj yar yaryar ;
@@ -464,7 +462,7 @@ oper
=> q + a + y + b + sg ; --qayb+qaybsan, fiic+fiican
_ => sg + sg } ;
AdjPhrase : Type = Adjective ;
AdjPhrase : Type = Adjective ** {compar : Str} ;
--------------------------------------------------------------------------------
-- Verbs
@@ -517,8 +515,10 @@ oper
_ + ("i"|"e") => "ey" ;
_ => "ay" } ;
n : Str = case arag of {
_ + #v => "nn" ; -- n duplicates after vowel
_ => "n" } ;
_ + #v => "nn" ; -- n duplicates after vowel
_ + "r" => "r" ; -- Saeed p. 35: agreement marker n (1PL)
_ + "l" => "l" ; -- assimilates to stem final r or.
_ => "n" } ;
an : Str = case qaado of {
_ + "o" => "an" ; -- Allomorph for imperatives
_ => "in" } ;
@@ -726,33 +726,37 @@ oper
-- VP
Complement : Type = {
comp : Agreement => {p1,p2 : Str} ; -- Agreement for AP complements
aComp : Agreement => Str ;
nComp : Str ;
compar : Str ; -- comparative is discontinuous
stm : STM ; -- to choose right sentence type marker
} ;
VerbPhrase : Type = BaseVerb ** Complement ** BaseAdv ** {
c2 : PrepCombination ; -- Prepositions can combine together and with object pronoun.
obj2 : NPLite ; -- {s : Str ; a : PrepAgr}
secObj : Str ; -- if two overt pronoun objects
obj : NPLite ; -- {s : Str ; a : PrepAgr}
obj2 : Str ; -- if two overt pronoun objects
vComp : {subjunc : Str ; -- "waa in" or subjunctive construction: "in" is placed here
inf : Str ; -- auxiliary VV with infinitive argument
subcl : Agreement => Str} -- VV complement if it's a subordinate clause
inf : Str ; -- auxiliary VV with infinitive argument
subcl : Agreement => Str} -- VV complement if it's a subordinate clause
} ;
VPSlash : Type = VerbPhrase ;
useV : Verb -> VerbPhrase = \v -> v ** {
comp = \\_ => <[],[]> ;
stm = case v.isCopula of { -- can change into Waxa in ComplVV
True => Waa Copula ;
False => Waa NoPred
} ;
compar = [] ;
nComp = [] ;
aComp = \\_ => [] ;
vComp = {subjunc, inf = [] ;
subcl = \\_ => []} ;
berri,miscAdv = [] ;
c2 = Single NoPrep ;
obj2 = {s = [] ; a = P3_Prep} ;
secObj = []
obj = {s = [] ; a = P3_Prep} ;
obj2 = []
} ;
useVc : Verb2 -> VPSlash = \v2 -> useV v2 ** {
@@ -767,26 +771,15 @@ oper
passVP : VerbPhrase -> VerbPhrase = \vp -> vp ** {
c2 = case vp.c2 of {
Single NoPrep => Passive ;
Single Ku => Lagu ;
Single Ka => Laga ;
Single U => Loo ;
Single La => Lala ;
Single p => combinePassive p ;
_ => vp.c2 }
} ;
complSlash : VPSlash -> VerbPhrase = \vps -> let np = vps.obj2 in vps ** {
comp = \\agr => let cmp = vps.comp ! agr in
{p1 = np.s ++ cmp.p1 ; -- if object is a noun, it will come before verb in the sentence.
-- if object is a pronoun, np.s is empty.
p2 = cmp.p2 ++ prepCombTable ! np.a ! vps.c2} -- object combines with the preposition of the verb.
} ;
insertRefl : VPSlash -> VPSlash = \vps -> vps ** {
obj2 = vps.obj2 ** {a = Reflexive_Prep} ;
obj = vps.obj ** {a = Reflexive_Prep} ;
-- If old obj2 was something else than P3, it is now shown in secObj
secObj = vps.secObj ++ secondObject ! vps.obj2.a ;
-- If old obj was something else than P3, it is now shown in obj2
obj2 = vps.obj2 ++ secondObject ! vps.obj.a ;
} ;
insertComp : VPSlash -> NounPhrase -> VerbPhrase = \vp,np ->
@@ -804,25 +797,25 @@ oper
-- To generalise insertAdv and insertComp
VPLite : Type = {
c2 : PrepCombination ;
obj2 : NPLite ;
sii,dhex,berri,miscAdv,secObj : Str} ;
obj : NPLite ;
sii,dhex,berri,miscAdv,obj2 : Str} ;
insertCompLite : VPLite -> NPLite -> VPLite = \vp,nplite ->
case vp.obj2.a of {
case vp.obj.a of {
-- If the old object is 3rd person (or nonexistent), we replace its agreement.
-- We keep both old and new string (=noun, if there was one) in obj2.s.
-- We keep both old and new string (=noun, if there was one) in obj.s.
P3_Prep =>
vp ** {obj2 = nplite ** {
s = nplite.s ++ vp.obj2.s}
} ; -- no secObj, because there's ≤1 non-3rd-person pronoun.
vp ** {obj = nplite ** {
s = nplite.s ++ vp.obj.s}
} ; -- no obj2, because there's ≤1 non-3rd-person pronoun.
-- If old object was non-3rd person, we keep its agreement.
-- The new object is put in the secondObject field.
_ =>
vp ** {obj2 = vp.obj2 ** {
s = nplite.s ++ vp.obj2.s
vp ** {obj = vp.obj ** {
s = nplite.s ++ vp.obj.s
} ;
secObj = vp.secObj ++ secondObject ! nplite.a}
obj2 = vp.obj2 ++ secondObject ! nplite.a}
} ;
insertAdvLite : VPLite -> Adverb -> VPLite = \vp,adv ->
@@ -832,6 +825,7 @@ oper
-- if free complement slots, introduce adv.np with insertComp
Single NoPrep => insertCompLite (vp ** {c2 = Single adv.c2}) adv.np ** adv' ;
Single p => insertCompLite (vp ** {c2 = combine p adv.c2}) adv.np ** adv' ;
Passive => insertCompLite (vp ** {c2 = combinePassive adv.c2}) adv.np ** adv' ;
-- if complement slots are full, just insert strings.
_ => vp ** adv''
@@ -856,10 +850,11 @@ oper
ClSlash : Type = BaseAdv ** {
-- Fixed in Cl
subj : {noun, pron : Str ; isP3 : Bool} ; -- noun and subject pronoun if applicable
obj2 : NPLite ;
secObj : Str ;
obj : NPLite ;
obj2 : Str ;
c2 : PrepCombination ; -- NB. QuestIAdv can add more prepositions
comp : {p1,p2 : Str} ;
aComp : Str ;
nComp : Str ;
vComp : {inf,subcl,subjunc : Str} ;
-- Still open
@@ -876,12 +871,12 @@ oper
predVP : NounPhrase -> VerbPhrase -> ClSlash = \np,vps -> vp ** {
subj = {noun = subjnoun ; pron = subjpron ; isP3 = isP3 subj.a} ;
obj = vp.obj ** {s = vp.obj.s ++ vp.compar} ;
pred = \\cltyp,t,a,p =>
let predRaw = vf cltyp t a p subj.a vp ;
in case <cltyp, p, t, vp.stm, subj.a> of {
<Statement, Pos, Pres, Waa NoCopula, Sg3 _|Pl3> -- VP comes from CompNP/CompCN + P3 subject
=> [] ;
<_, _, Pres, Waa (Copula|NoCopula), _> -- Comp* present tense + any subject
=> presCopula ! {agr=subj.a ; pol=p} ;
@@ -889,7 +884,7 @@ oper
} ;
stm = mkStm subj.a vp.stm ;
comp = vp.comp ! subj.a ;
aComp = vp.aComp ! subj.a ;
vComp = vp.vComp ** {
subcl = vp.vComp.subcl ! subj.a
}
@@ -909,50 +904,8 @@ oper
=> np.empty ;
_ => (pronTable ! subj.a).s ! Nom
}
} ;
-- just like complSlash but for Cl
complCl : ClSlash -> ClSlash = \cl -> let np = cl.obj2 in cl ** {
comp = {p1 = np.s ++ cl.comp.p1 ;
p2 = cl.comp.p2 ++ prepCombTable ! np.a ! cl.c2}
} ;
-- RelVP: subject pronoun is never included
cl2rcl : ClSlash -> Clause =
let hasSubjPron : Bool = False ;
hasSTM : Bool = False ;
isRel : Bool = True ;
in mkClause Subord isRel hasSubjPron hasSTM ;
-- No subject pronoun, no STM, but use verb forms from Statement
cl2rclNom : ClSlash -> Clause = \cls ->
let hasSubjPron : Bool = False ;
hasSTM : Bool = False ;
isRel : Bool = True ;
in mkClause Statement isRel hasSubjPron hasSTM cls ;
-- RelSlash: subject pronoun is included if it's not 3rd person
-- TODO check this rule with more example sentences
cl2relslash : ClSlash -> Clause =
let hasSubjPron : Bool = True ;
hasSTM : Bool = False ;
isRel : Bool = True ;
in mkClause Subord isRel hasSubjPron hasSTM ;
-- Question clauses: subject pronoun not included, STM is
cl2qcl : ClType -> Bool -> ClSlash -> Clause = \cltyp ->
let hasSubjPron : Bool = False ;
isRel : Bool = False ;
in mkClause cltyp isRel hasSubjPron ;
-- Question clauses: subject pronoun is included
cl2qclslash : Bool -> ClSlash -> Clause =
let hasSubjPron : Bool = True ;
isRel : Bool = False ;
in mkClause PolarQuestion isRel hasSubjPron ;
-- Sentence: include subject pronoun and STM.
-- When subordinate, include "in".
cl2sentence : Bool -> ClSlash -> Clause = \isSubord,cls -> {
@@ -961,36 +914,52 @@ oper
True => Subord ;
False => Statement } ;
cl : ClSlash = case isSubord of { -- add "in" to the clause if used as subordinate
True => cls ** {vComp = cls.vComp ** {subjunc = "in"}} ;
True => cls ** {
vComp = cls.vComp ** {subjunc = "in"}
} ;
False => cls } ;
sent = mkClause cltyp False True True cl
isRel = False ;
hasSubjPron = True ;
hasSTM = True ;
sent = mkClause cltyp isRel hasSubjPron hasSTM cl
in sent.s ! t ! a ! p
} ;
mkClause : ClType -> (rel,sp,stm : Bool) -> ClSlash -> Clause = \cltyp,isRel,hasSubjPron,hasSTM,incomplCl -> {
mkClause : ClType -> (rel,sp,stm : Bool) -> ClSlash -> Clause =
\cltyp,isRel,hasSubjPron,hasSTM,cl -> {
s = \\t,a,p =>
let -- Put all arguments in their right place
cl : ClSlash = complCl incomplCl ;
--cl : ClSlash = complCl incomplCl ;
prepComb = prepCombTable ! cl.obj.a ! cl.c2 ;
-- Contractions
bind : Str = case <isPassive cl, cl.obj2.a, cl.c2> of {
bind : Str = case <isPassive cl, cl.obj.a, cl.c2> of {
<False,P3_Prep,Single NoPrep> => [] ; -- nothing to attach to the STM
_ => BIND } ; -- something to attach, use BIND
obj : {p1,p2 : Str} = case <cltyp,p> of {
<Statement,Neg> -- object pronoun and prepositions contract with negation
=> {p2 = [] ; p1 = cl.comp.p1 ++ cl.comp.p2 ++ bind} ;
_ => cl.comp } ;
prepCombNeg : Str = case <cltyp,p> of {
<Statement,Neg> => prepComb ++ bind ;
_ => []
} ;
prepCombPos : Str = case <cltyp,p> of {
<Statement,Neg> => [] ;
_ => prepComb
} ;
-- Placement of object noun varies depending on type of clause
statementNounObj = case cltyp of {
Statement => obj.p1 ;
Statement => cl.obj.s ;
_ => [] } ;
statementNounComp = case cltyp of {
Statement => cl.nComp ;
_ => [] } ;
-- for subord and question, NP predicatives and objects behave the same
subordNounObj = case cltyp of {
Subord => obj.p1 ;
Subord => cl.obj.s ++ cl.nComp ;
_ => [] } ;
questionNounObj = case cltyp of {
PolarQuestion|WhQuestion => obj.p1 ;
PolarQuestion|WhQuestion
=> cl.obj.s ++ cl.nComp ;
_ => [] } ;
-- Control whether to include subject pronoun and STM
@@ -1000,22 +969,27 @@ oper
_ => [] } ;
stm : Str = case <hasSTM,p> of {
<True,_> => cl.stm ! cltyp ! p ;
<_,Neg> => cl.stm ! cltyp ! p ; -- negation overrides hasSTM=False
<_,Neg> => cl.stm ! cltyp ! p ; -- negation overrides hasSTM=False. To override the override, set STM to [] in the function that calls this. /IL
_ => [] }
in cl.berri -- AdV
++ cl.subj.noun -- subject if it's a noun
++ statementNounObj -- noun object if it's a statement
++ prepCombNeg -- prepositions and pron. objects in negative statement
++ stm
++ cl.vComp.subjunc -- "waa in" construction /
++ subjpron -- subject pronoun
++ subordNounObj -- noun object if it's subordinate clause: "timir aan /laf/ lahayn" (Saeed p. 210-211)
++ obj.p2 -- object if it's a pronoun
++ cl.aComp -- AP complement, regardless of cltype
++ statementNounComp -- NP complement if it's direct statement
++ prepCombPos -- prepositions + pron. objects in positive sentence
++ cl.sii -- restricted set of particles
++ cl.dhex -- restricted set of nouns/adverbials
++ cl.secObj -- "second object"
++ cl.obj2 -- "second object"
++ cl.vComp.inf -- VV complement, if it's infinitive
++ cl.pred ! cltyp ! t ! a ! p -- the inflecting verb
++ questionNounObj -- noun object if it's a question
@@ -1119,31 +1093,32 @@ oper
++ adv.np.s
++ adv.miscAdv ;
linVP : VForm -> ClType -> VerbPhrase -> Str = \vf,cltyp,vp ->
let pred = vp.s ! vf ;
vp' = complSlash vp ;
pr = prepCombTable ! vp.obj.a ! vp.c2 ;
neg = case <cltyp,isNeg vf> of {
<Subord,True> => "aan" ;
_ => []
} ;
in wordOrder cltyp neg pred (vp'.comp ! pagr2agr vp.obj2.a) vp' ;
in wordOrder cltyp neg pred pr vp ;
wordOrder : ClType -> (neg,pred : Str) -> (obj : {p1,p2 : Str}) -> VerbPhrase -> Str =
\cltyp,neg,pred,obj,vp ->
-- Light version of the word order complexity in mkClause.
wordOrder : ClType -> (neg,pred,prepcomb : Str) -> VerbPhrase -> Str =
\cltyp,neg,pred,pr,vp ->
vp.berri -- AdV
++ case cltyp of {
Subord => [] ;
_ => obj.p1 } -- noun object if it's a statement
_ => vp.obj.s } -- noun object if it's a statement
++ neg
++ vp.vComp.subjunc -- "waa in" construction
++ case cltyp of {
Subord => obj.p1 ; -- noun object if it's subordinate clause
Subord => vp.obj.s ; -- noun object if it's subordinate clause
_ => [] }
++ obj.p2 -- object if it's a pronoun
++ vp.aComp ! pagr2agr vp.obj.a -- AP complement agreeing with object
++ pr -- object if it's a pronoun
++ vp.sii -- restricted set of particles
++ vp.dhex -- restricted set of nouns/adverbials
++ vp.secObj -- "second object"
++ vp.obj2 -- "second object"
++ vp.vComp.inf -- VV complement, if it's infinitive
++ pred -- the verb inflected
++ vp.vComp.subcl ! Sg3 Masc -- VV complement, if it's subordinate clause

View File

@@ -28,7 +28,11 @@ lin
-}
-- : Temp -> Pol -> ClSlash -> SSlash ; -- (that) she had not seen
UseSlash t p cls = {
s = \\isSubord => let cl = cl2sentence isSubord cls in
s = \\isSubord =>
let cls' : ClSlash = cls ** {
stm = modSTM "waxa" "waxa aan" cls.stm -- Saeed p. 195
} ;
cl : Clause = cl2sentence isSubord cls' in
t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p
} ;
@@ -38,19 +42,17 @@ lin
--2 Embedded sentences
{-
-- : S -> SC ;
EmbedS s = { } ;
EmbedS s = {s = s.s ! True} ; -- choose subordinate
-- : QS -> SC ;
EmbedQS qs = { } ;
-- EmbedQS qs = { } ;
-- : VP -> SC ;
EmbedVP vp = { s = linVP vp } ;
EmbedVP vp = {s = infVP vp} ;
--2 Sentences
-}
-- : Temp -> Pol -> Cl -> S ;
UseCl t p cls = {
s = \\isSubord => let cl = cl2sentence isSubord cls in

View File

@@ -68,7 +68,8 @@ lin much_Det = R.indefDet "" sg ;
-}
lin somePl_Det = {
sp = \\_,_ => "qaar" ;
isPoss, isNum = False ;
isPoss = False ;
numtype = NoNum ;
st = Definite ; -- NB. Indefinite means actually only IndefArt.
n = Pl ;
s = \\x,_ => BIND ++ defStems ! x ++ BIND ++ "a qaarkood" ;

View File

@@ -18,8 +18,8 @@ lin
ComplVV vv vp = let vc = vp.vComp in case vv.vvtype of {
Waa_In => vp ** {
vComp = vc ** {subjunc = vv.s ! VInf} ; -- it's always the word "in", and it will be placed before subject pronoun. it's placed in vv.s!VInf so that the VV would contribute with some string. /IL
obj2 = vp.obj2 ** {s = []} ; -- word order hack to avoid more parameters:
miscAdv = vp.miscAdv ++ vp.obj2.s -- dump the object to miscAdv
obj = vp.obj ** {s = []} ; -- word order hack to avoid more parameters:
miscAdv = vp.miscAdv ++ vp.obj.s -- dump the object to miscAdv
} ;
Subjunctive => useV vv ** {
@@ -46,7 +46,7 @@ lin
ComplVS vs s =
let vps = useV vs ;
subord = SubjS {s="in"} s ;
in vps ** {obj2 = {s = subord.berri ; a = P3_Prep}} ;
in vps ** {obj = {s = subord.berri ; a = P3_Prep}} ;
{-
-- : VQ -> QS -> VP ;
@@ -66,20 +66,24 @@ lin
-- : V3 -> NP -> VPSlash ; -- give (it) to her
Slash2V3,
Slash3V3 = \v3 -> insertComp (useVc3 v3) ;
-- : V2S -> S -> VPSlash ; -- answer (to him) that it is good
SlashV2S v2s s =
let vps = useVc v2s ;
subord = SubjS {s="in"} s ;
in vps ** {obj = {s = subord.berri ; a = P3_Prep}} ;
{-
-- : V2V -> VP -> VPSlash ; -- beg (her) to go
SlashV2V v2v vp = ;
-- : V2S -> S -> VPSlash ; -- answer (to him) that it is good
SlashV2S v2s s = ;
-- : V2Q -> QS -> VPSlash ; -- ask (him) who came
SlashV2Q v2q qs = ;
-}
-- : V2A -> AP -> VPSlash ; -- paint (it) red
-- TODO: is "red" plural in "paint them red"?
SlashV2A v2a ap = useVc v2a ** {
comp = \\_ => (CompAP ap).comp ! Sg3 Masc
aComp = \\_ => (CompAP ap).aComp ! Sg3 Masc
} ;
-- : VPSlash -> NP -> VP
@@ -121,10 +125,9 @@ lin
AdVVPSlash adv vps = vps ** { adv = adv.s ++ vps.adv } ;
-}
-- : VP -> Prep -> VPSlash ; -- live in (it)
-- NB. We need possibly a MissingArg kind of solution here too
-- VPSlashPrep vp prep = vp **
-- { c2 = case vp.c2 of { NoPrep => prep.prep ;
-- x => x }} ;
VPSlashPrep vp prep =
let adv = prepNP prep emptyNP
in insertAdv vp adv ;
@@ -133,32 +136,36 @@ lin
-- Adjectival phrases, noun phrases, and adverbs can be used.
-- the house is big
-- the houses are big
-- I am [a house that sleeps here]
-- we are [houses that sleep here]
-- : AP -> Comp ;
CompAP ap = {
comp = \\a => <[], ap.s ! AF (getNum a) Abs> ;
aComp = \\a => ap.s ! AF (getNum a) Abs ;
nComp = [] ;
compar = ap.compar ;
stm = Waa Copula ;
} ;
-- : CN -> Comp ;
CompCN cn = {
comp = \\a => <[], cn2str Sg Abs cn> ;
-- I am [a house that sleeps here] vs. we are [houses that sleep here]
aComp = \\a => cn2str (getNum a) Abs cn ;
nComp = [] ;
compar = [] ;
stm = Waa NoCopula ;
} ;
-- NP -> Comp ;
CompNP np = {
comp = \\a => <[], np.s ! Abs> ;
aComp = \\a => [] ;
nComp = np.s ! Abs ;
compar = [] ;
stm = Waa NoCopula ;
} ;
-- : Adv -> Comp ;
CompAdv adv = {
comp = \\a => <[], linAdv adv> ;
aComp = \\a => linAdv adv ; -- TODO check placement
nComp = [] ;
compar = [] ;
stm = Waa Copula ;
} ;

View File

@@ -1,3 +1,7 @@
------------------
-- Conjunctions --
------------------
-- LangEng: the big black bird
LangSom: shimbir BIND ta madow ee weyn
Lang: PhrUtt NoPConj (UttNP (DetCN (DetQuant DefArt NumSg) (AdjCN (PositA big_A) (AdjCN (PositA black_A) (UseN bird_N))))) NoVoc
@@ -5,3 +9,24 @@ Lang: PhrUtt NoPConj (UttNP (DetCN (DetQuant DefArt NumSg) (AdjCN (PositA big_A)
-- LangEng: a big black bird
LangSom: shimbir madow oo weyn
Lang: PhrUtt NoPConj (UttNP (DetCN (DetQuant IndefArt NumSg) (AdjCN (PositA big_A) (AdjCN (PositA black_A) (UseN bird_N))))) NoVoc
-----------------
-- Comparative --
-----------------
-- Examples from Saeed p. 107
-- LangEng: that cat is bigger
LangSom: bisad BIND daasi waa ka weyn tahay
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant that_Quant NumSg) (UseN cat_N)) (UseComp (CompAP (UseComparA big_A)))))) NoVoc
-- LangEng: that cat is bigger than this cat
LangSom: bisad BIND daasi bisad BIND dan waa ka weyn tahay
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant that_Quant NumSg) (UseN cat_N)) (UseComp (CompAP (ComparA big_A (DetCN (DetQuant this_Quant NumSg) (UseN cat_N)))))))) NoVoc
-- LangEng: that cat is biggest
LangSom: bisad BIND daasi waa ugu weyn tahay
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant that_Quant NumSg) (UseN cat_N)) (UseComp (CompAP (AdjOrd (OrdSuperl big_A))))))) NoVoc
-- LangEng: cat is the biggest animal that I saw
LangSom: bisadi waa xayawaan BIND ka ugu weyn aan arkay
Lang: UseCl (TTAnt TPres ASimul) PPos (PredVP (MassNP (UseN cat_N)) (UseComp (CompNP (DetCN (DetQuantOrd DefArt NumSg (OrdSuperl big_A)) (RelCN (UseN animal_N) (UseRCl (TTAnt TPast ASimul) PPos (RelSlash IdRP (SlashVP (UsePron i_Pron) (SlashV2a see_V2)))))))))

View File

@@ -1,8 +1,11 @@
-------------------------------
-- Numerals with determiners --
-------------------------------
-- LangEng: the two cats
LangSom: laba BIND da bisadood
Lang: PhrUtt NoPConj (UttNP (DetCN (DetQuant DefArt (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2)))))))) (UseN cat_N))) NoVoc
-- LangEng: those three men
LangSom: saddex BIND daas nin
Lang: PhrUtt NoPConj (UttNP (DetCN (DetQuant that_Quant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3)))))))) (UseN man_N))) NoVoc
@@ -25,4 +28,28 @@ Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron he_
-- LangEng: he is my first man
LangSom: waa nin BIND kayg BIND a kowaad
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron he_Pron) (UseComp (CompNP (DetCN (DetQuantOrd (PossPron i_Pron) NumSg (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01)))))) (UseN man_N))))))) NoVoc
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron he_Pron) (UseComp (CompNP (DetCN (DetQuantOrd (PossPron i_Pron) NumSg (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01)))))) (UseN man_N))))))) NoVoc
--------------------------------------
-- Numerals with multiple modifiers --
--------------------------------------
-- LangEng: two cats
LangSom: laba bisadood
Lang: PhrUtt NoPConj (UttNP (DetCN (DetQuant IndefArt (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2)))))))) (UseN cat_N))) NoVoc
-- LangEng: two small cats
LangSom: laba bisadood oo yar
Lang: PhrUtt NoPConj (UttNP (DetCN (DetQuant IndefArt (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2)))))))) (AdjCN (PositA small_A) (UseN cat_N)))) NoVoc
-- LangEng: two small cats that have meat
LangSom: laba bisadood oo yar oo hilib leh
Lang: PhrUtt NoPConj (UttNP (DetCN (DetQuant IndefArt (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2)))))))) (RelCN (AdjCN (PositA small_A) (UseN cat_N)) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (ComplSlash (SlashV2a have_V2) (MassNP (UseN meat_N)))))))) NoVoc
-- LangEng: two thousand cats
LangSom: laba kun oo bisadood
Lang: PhrUtt NoPConj (UttNP (DetCN (DetQuant IndefArt (NumCard (NumNumeral (num (pot3 (pot1as2 (pot0as1 (pot0 n2)))))))) (UseN cat_N))) NoVoc
-- LangEng: two thousand small cats
LangSom: laba kun oo bisadood oo yar
Lang: PhrUtt NoPConj (UttNP (DetCN (DetQuant IndefArt (NumCard (NumNumeral (num (pot3 (pot1as2 (pot0as1 (pot0 n2)))))))) (AdjCN (PositA small_A) (UseN cat_N)))) NoVoc

View File

@@ -66,5 +66,5 @@ Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv why_IAd
-- Maxaa ay ahaa dharka cusub ee Faadumo loo iibiyay? Vad/Vilka var de nya kläder som man köpt åt Fadumo? TODO why is there subject pronoun here?
--LangEng: what was the meat that was eaten
LangSom: TODO
LangSom: maxaa uu ahaa hilib BIND ka la cunay
Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestVP whatSg_IP (UseComp (CompNP (DetCN (DetQuant DefArt NumSg) (RelCN (UseN meat_N) (UseRCl (TTAnt TPast ASimul) PPos (RelVP IdRP (PassV2 eat_V2)))))))))) NoVoc