(Som) Add comparatives

This commit is contained in:
Inari Listenmaa
2019-09-27 10:32:45 +02:00
parent a399abed83
commit 9b9d6ebdd2
6 changed files with 47 additions and 18 deletions

View File

@@ -8,12 +8,15 @@ concrete AdjectiveSom of Adjective = CatSom ** open ResSom, Prelude in {
-- elliptic-relational. -- elliptic-relational.
-- : A -> AP ; -- : A -> AP ;
PositA a = a ; PositA a = a ** {
compar = [] ;
} ;
-- : A -> NP -> AP ; -- : A -> NP -> AP ;
-- ComparA a np = a ** { ComparA a np = a ** {
-- s = \\agr => np.s ! Abs ++ "ka" ++ a.s ! AF Compar ; s = \\af => "ka" ++ a.s ! af ;
-- } ; compar = np.s ! Abs
} ;
-- : A2 -> NP -> AP ; -- married to her -- : A2 -> NP -> AP ; -- married to her
-- ComplA2 a2 np = a2 ** { } ; -- ComplA2 a2 np = a2 ** { } ;
@@ -25,7 +28,10 @@ concrete AdjectiveSom of Adjective = CatSom ** open ResSom, Prelude in {
UseA2 = PositA ; UseA2 = PositA ;
-- : A -> AP ; -- warmer -- : A -> AP ; -- warmer
--UseComparA a = a ** {} ; UseComparA a = a ** {
s = \\af => "ka" ++ a.s ! af ;
compar = []
} ;
-- : CAdv -> AP -> NP -> AP ; -- as cool as John -- : CAdv -> AP -> NP -> AP ; -- as cool as John

View File

@@ -23,7 +23,7 @@ concrete CatSom of Cat = CommonX - [Adv,IAdv] ** open ResSom, Prelude in {
-- Constructed in QuestionSom. -- Constructed in QuestionSom.
QCl = ResSom.QClause ; 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" IDet = ResSom.Determiner ; -- interrogative determiner e.g. "how many"
IQuant = ResSom.Quant ; -- interrogative quantifier e.g. "which" IQuant = ResSom.Quant ; -- interrogative quantifier e.g. "which"
IP = ResSom.NounPhrase ** {contractSTM : Bool} ; -- like NP but may contract with STM IP = ResSom.NounPhrase ** {contractSTM : Bool} ; -- like NP but may contract with STM

View File

@@ -50,7 +50,7 @@ concrete QuestionSom of Question = CatSom ** open
-- : IComp -> NP -> QCl ; -- where is John? -- : IComp -> NP -> QCl ; -- where is John?
QuestIComp icomp np = QuestIComp icomp np =
let cls = predVP np (VS.UseComp icomp) ; let cls = predVP np (VS.UseComp (icomp2comp icomp)) ;
-- cl = cls ** { -- TODO: neg. questions -- cl = cls ** { -- TODO: neg. questions
-- stm : ClType=>Polarity=>Str = \\_,_ => "waa" -- stm : ClType=>Polarity=>Str = \\_,_ => "waa"
-- } -- }
@@ -87,18 +87,10 @@ concrete QuestionSom of Question = CatSom ** open
-- pronouns. -- pronouns.
-- : IAdv -> IComp ; -- : IAdv -> IComp ;
CompIAdv iadv = { -- where (is it) CompIAdv iadv = iadv ; -- where (is it)
aComp = \\_ => [] ;
nComp = iadv.s ;
stm = Waa NoCopula ;
} ;
-- : IP -> IComp ; -- : IP -> IComp ;
CompIP ip = { -- who (is it) CompIP ip = {s = ip.s ! Abs} ; -- who (is it)
aComp = \\_ => [] ;
nComp = ip.s ! Abs ;
stm = Waa NoCopula ;
} ;
{- {-
-- More $IP$, $IDet$, and $IAdv$ are defined in $Structural$. -- More $IP$, $IDet$, and $IAdv$ are defined in $Structural$.
@@ -117,6 +109,13 @@ concrete QuestionSom of Question = CatSom ** open
oper oper
icomp2comp : SS -> Complement = \icomp -> icomp ** {
aComp = \\_ => [] ;
nComp = icomp.s ;
compar = [] ;
stm = Waa NoCopula
} ;
-- Question clauses: subject pronoun not included, STM is -- Question clauses: subject pronoun not included, STM is
cl2qcl : ClType -> Bool -> ClSlash -> Clause = \cltyp -> cl2qcl : ClType -> Bool -> ClSlash -> Clause = \cltyp ->
let hasSubjPron : Bool = False ; let hasSubjPron : Bool = False ;

View File

@@ -464,7 +464,7 @@ oper
=> q + a + y + b + sg ; --qayb+qaybsan, fiic+fiican => q + a + y + b + sg ; --qayb+qaybsan, fiic+fiican
_ => sg + sg } ; _ => sg + sg } ;
AdjPhrase : Type = Adjective ; AdjPhrase : Type = Adjective ** {compar : Str} ;
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- Verbs -- Verbs
@@ -728,6 +728,7 @@ oper
Complement : Type = { Complement : Type = {
aComp : Agreement => Str ; aComp : Agreement => Str ;
nComp : Str ; nComp : Str ;
compar : Str ; -- comparative is discontinuous
stm : STM ; -- to choose right sentence type marker stm : STM ; -- to choose right sentence type marker
} ; } ;
@@ -747,6 +748,7 @@ oper
True => Waa Copula ; True => Waa Copula ;
False => Waa NoPred False => Waa NoPred
} ; } ;
compar = [] ;
nComp = [] ; nComp = [] ;
aComp = \\_ => [] ; aComp = \\_ => [] ;
vComp = {subjunc, inf = [] ; vComp = {subjunc, inf = [] ;
@@ -872,6 +874,7 @@ oper
predVP : NounPhrase -> VerbPhrase -> ClSlash = \np,vps -> vp ** { predVP : NounPhrase -> VerbPhrase -> ClSlash = \np,vps -> vp ** {
subj = {noun = subjnoun ; pron = subjpron ; isP3 = isP3 subj.a} ; subj = {noun = subjnoun ; pron = subjpron ; isP3 = isP3 subj.a} ;
obj2 = vp.obj2 ** {s = vp.obj2.s ++ vp.compar} ;
pred = \\cltyp,t,a,p => pred = \\cltyp,t,a,p =>
let predRaw = vf cltyp t a p subj.a vp ; let predRaw = vf cltyp t a p subj.a vp ;
in case <cltyp, p, t, vp.stm, subj.a> of { in case <cltyp, p, t, vp.stm, subj.a> of {

View File

@@ -137,6 +137,7 @@ lin
CompAP ap = { CompAP ap = {
aComp = \\a => ap.s ! AF (getNum a) Abs ; aComp = \\a => ap.s ! AF (getNum a) Abs ;
nComp = [] ; nComp = [] ;
compar = ap.compar ;
stm = Waa Copula ; stm = Waa Copula ;
} ; } ;
@@ -145,6 +146,7 @@ lin
-- I am [a house that sleeps here] vs. we are [houses that sleep here] -- I am [a house that sleeps here] vs. we are [houses that sleep here]
aComp = \\a => cn2str (getNum a) Abs cn ; aComp = \\a => cn2str (getNum a) Abs cn ;
nComp = [] ; nComp = [] ;
compar = [] ;
stm = Waa NoCopula ; stm = Waa NoCopula ;
} ; } ;
@@ -152,6 +154,7 @@ lin
CompNP np = { CompNP np = {
aComp = \\a => [] ; aComp = \\a => [] ;
nComp = np.s ! Abs ; nComp = np.s ! Abs ;
compar = [] ;
stm = Waa NoCopula ; stm = Waa NoCopula ;
} ; } ;
@@ -159,6 +162,7 @@ lin
CompAdv adv = { CompAdv adv = {
aComp = \\a => linAdv adv ; -- TODO check placement aComp = \\a => linAdv adv ; -- TODO check placement
nComp = [] ; nComp = [] ;
compar = [] ;
stm = Waa Copula ; stm = Waa Copula ;
} ; } ;

View File

@@ -1,3 +1,7 @@
------------------
-- Conjunctions --
------------------
-- LangEng: the big black bird -- LangEng: the big black bird
LangSom: shimbir BIND ta madow ee weyn 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 Lang: PhrUtt NoPConj (UttNP (DetCN (DetQuant DefArt NumSg) (AdjCN (PositA big_A) (AdjCN (PositA black_A) (UseN bird_N))))) NoVoc
@@ -5,3 +9,16 @@ Lang: PhrUtt NoPConj (UttNP (DetCN (DetQuant DefArt NumSg) (AdjCN (PositA big_A)
-- LangEng: a big black bird -- LangEng: a big black bird
LangSom: shimbir madow oo weyn 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 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