1
0
forked from GitHub/gf-rgl

(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.
-- : 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

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

View File

@@ -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,18 +87,10 @@ concrete QuestionSom of Question = CatSom ** open
-- pronouns.
-- : IAdv -> IComp ;
CompIAdv iadv = { -- where (is it)
aComp = \\_ => [] ;
nComp = iadv.s ;
stm = Waa NoCopula ;
} ;
CompIAdv iadv = iadv ; -- where (is it)
-- : IP -> IComp ;
CompIP ip = { -- who (is it)
aComp = \\_ => [] ;
nComp = ip.s ! Abs ;
stm = Waa NoCopula ;
} ;
CompIP ip = {s = ip.s ! Abs} ; -- who (is it)
{-
-- More $IP$, $IDet$, and $IAdv$ are defined in $Structural$.
@@ -117,6 +109,13 @@ concrete QuestionSom of Question = CatSom ** open
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 ;

View File

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

View File

@@ -137,6 +137,7 @@ lin
CompAP ap = {
aComp = \\a => ap.s ! AF (getNum a) Abs ;
nComp = [] ;
compar = ap.compar ;
stm = Waa Copula ;
} ;
@@ -145,6 +146,7 @@ lin
-- 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 ;
} ;
@@ -152,6 +154,7 @@ lin
CompNP np = {
aComp = \\a => [] ;
nComp = np.s ! Abs ;
compar = [] ;
stm = Waa NoCopula ;
} ;
@@ -159,6 +162,7 @@ lin
CompAdv 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,16 @@ 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