(Som) WIP: wh-questions

This commit is contained in:
Inari Listenmaa
2019-09-02 17:14:25 +02:00
parent dda17aa104
commit dc33b2869a
6 changed files with 158 additions and 9 deletions

View File

@@ -328,6 +328,9 @@ oper
VPres _ _ Neg => True ; VPres _ _ Neg => True ;
_ => False _ => False
} ; } ;
showSTM : STM -> Str = \stm -> case stm of {
Waxa => "waxa" ; Waa _ => "waa" } ;
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- Clauses -- Clauses

View File

@@ -9,7 +9,14 @@ concrete QuestionSom of Question = CatSom ** open
QuestCl cl = mergeQCl (cl.s ! Question) ; QuestCl cl = mergeQCl (cl.s ! Question) ;
-- : IP -> VP -> QCl ; -- : IP -> VP -> QCl ;
-- QuestVP ip vp = ; QuestVP ip vp = -- TODO: if we want to contract baa + subj. pronoun, change ResSom.predVP
let clRaw : ClLite = predVPlite ip vp ;
cl : ClLite = clRaw ** {
stm = \\clt,p => case <clt,p> of {
<Statement,Pos> => "baa" ;
_ => clRaw.stm ! clt ! p }
}
in wordOrderLite Statement cl ;
-- : IP -> ClSlash -> QCl ; -- whom does John love -- : IP -> ClSlash -> QCl ; -- whom does John love
--QuestSlash ip cls = ; --QuestSlash ip cls = ;
@@ -36,7 +43,7 @@ concrete QuestionSom of Question = CatSom ** open
-- Interrogative quantifiers have number forms and can take number modifiers. -- Interrogative quantifiers have number forms and can take number modifiers.
-- : IQuant -> Num -> IDet ; -- which (five) -- : IQuant -> Num -> IDet ; -- which (five)
--IdetQuant = NS.DetQuant ; IdetQuant = NS.DetQuant ;
-- Interrogative adverbs can be formed prepositionally. -- Interrogative adverbs can be formed prepositionally.
-- : Prep -> IP -> IAdv ; -- with whom -- : Prep -> IP -> IAdv ; -- with whom

View File

@@ -326,6 +326,10 @@ oper
st = Definite ; st = Definite ;
} ; } ;
defIQuant : Str -> Quant = \ee ->
let quantRaw = defQuant ee ("k"+ee) ("t"+ee) ("kuw"+ee) False
in quantRaw ** {s = \\da,c => quantRaw.s ! da ! Abs} ;
gnTable : (m,f,p : Str) -> (GenNum => Str) = \m,f,p -> gnTable : (m,f,p : Str) -> (GenNum => Str) = \m,f,p ->
table {SgMasc => m ; SgFem => f ; _ => p} ; table {SgMasc => m ; SgFem => f ; _ => p} ;
@@ -686,14 +690,13 @@ oper
Complement : Type = { Complement : Type = {
comp : Agreement => {p1,p2 : Str} ; -- Agreement for AP complements comp : Agreement => {p1,p2 : Str} ; -- Agreement for AP complements
stm : STM ; -- to choose right sentence type marker stm : STM ; -- to choose right sentence type marker
-- pred : PredType ; -- to choose right sentence type marker and copula
} ; } ;
VerbPhrase : Type = BaseVerb ** Complement ** BaseAdv ** { VerbPhrase : Type = BaseVerb ** Complement ** BaseAdv ** {
c2 : PrepCombination ; -- Prepositions can combine together and with object pronoun. c2 : PrepCombination ; -- Prepositions can combine together and with object pronoun.
obj2 : NPLite ; -- {s : Str ; a : PrepAgr} obj2 : NPLite ; -- {s : Str ; a : PrepAgr}
secObj : Str ; -- if two overt pronoun objects secObj : Str ; -- if two overt pronoun objects
vComp : {in_ : Str ; -- if it's "waa in" or subjunctive construction, there's "in" in there vComp : {subjunc : Str ; -- if it's "waa in" or subjunctive construction, there's "in" in there
inf : Str ; inf : Str ;
subcl : Agreement => Str} -- VV complement if it's a subordinate clause subcl : Agreement => Str} -- VV complement if it's a subordinate clause
} ; } ;
@@ -706,7 +709,7 @@ oper
True => Waa Copula ; True => Waa Copula ;
False => Waa NoPred False => Waa NoPred
} ; } ;
vComp = {in_, inf = [] ; vComp = {subjunc, inf = [] ;
subcl = \\_ => []} ; subcl = \\_ => []} ;
berri,miscAdv = [] ; berri,miscAdv = [] ;
c2 = Single NoPrep ; c2 = Single NoPrep ;
@@ -793,6 +796,37 @@ oper
} ; } ;
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- Sentences etc. -- Sentences etc.
{- After PredVP, we might still want to add more adverbs (QuestIAdv),
but we're done with verb inflection.
-}
ClLite : Type = BaseAdv ** {
-- Fixed in Cl
subj : {noun, pron : Str} ; -- noun and subject pronoun if applicable
obj2 : NPLite ;
secObj : Str ;
c2 : PrepCombination ; -- NB. QuestIAdv can add more prepositions
comp : {p1,p2 : Str} ;
vComp : {inf,subcl,subjunc : Str} ;
-- Still open
pred : ClType => Tense => Anteriority => Polarity => {fin,inf : Str} ;
stm : ClType => Polarity => Str
{- If formed with PredVP:
Pos,Statement => waxa or waa depending on what STM was
Pos,Question => ma
Neg,Statement => ma
Neg,Question => ma aan or sow (TODO implement this)
Pos,Subord => []
Neg,Subord => aan
Contrast QCl formed with QuestVP:
Pos => baa
Neg => ?? -}
} ;
-- Clause : Type = {s : Tense => Anteriority => Polarity => Str} ;
BaseCl : Type = {beforeSTM, stm, afterSTM : Str} ; -- adverbs, subjects, all that comes before sentence type marker. Eventual Subj attaches to the part after STM. BaseCl : Type = {beforeSTM, stm, afterSTM : Str} ; -- adverbs, subjects, all that comes before sentence type marker. Eventual Subj attaches to the part after STM.
Clause : Type = {s : ClType => Tense => Anteriority => Polarity => BaseCl} ; Clause : Type = {s : ClType => Tense => Anteriority => Polarity => BaseCl} ;
ClSlash : Type = {s : Bool {-is subordinate-} => Tense => Anteriority => Polarity => BaseCl} ; ClSlash : Type = {s : Bool {-is subordinate-} => Tense => Anteriority => Polarity => BaseCl} ;
@@ -813,6 +847,56 @@ oper
++ (bcl ! t ! a ! p).afterSTM ++ (bcl ! t ! a ! p).afterSTM
} ; } ;
predVPlite : NounPhrase -> VerbPhrase -> ClLite = \np,vps -> vp ** {
subj = {noun = subjnoun ; pron = subjpron} ;
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
=> {fin,inf = []} ;
<_, _, Pres, Waa (Copula|NoCopula), _> -- Comp* present tense + any subject
=> {fin = presCopula ! {agr=subj.a ; pol=p} ; inf=[]} ;
_ => predRaw -- Any other verb
} ;
stm = \\cltyp,pol =>
case <cltyp,pol> of {
<Statement,Pos> => showSTM vp.stm ;
<Statement,Neg> => "ma" ;
<Question,Pos> => "ma" ;
<Question,Neg> => "sow" ;
<Subord,Pos> => [] ;
<Subord,Neg> => "aan"
} ;
--c2 = vp.c2 ;
--obj2 = vp.obj2 ;
--secObj = vp.secObj ;
-- sii, dhex, berri, miscAdv = from VP
comp = vp.comp ! subj.a ;
vComp = vp.vComp ** {
subcl = vp.vComp.subcl ! subj.a
}
} where {
vp : VerbPhrase = case isPassive vps of {
True => insertComp vps np ;
_ => vps } ;
subj : NounPhrase = case isPassive vps of {
True => impersNP ;
_ => np } ;
subjnoun : Str = if_then_Str np.isPron np.empty (subj.s ! Nom) ;
subjpron : Str = if_then_Str np.isPron (subj.s ! Nom) np.empty ;
} ;
-- just like complSlash but for ClLite
complCl : ClLite -> ClLite = \cl -> let np = cl.obj2 in cl ** {
comp = {p1 = np.s ++ cl.comp.p1 ;
p2 = cl.comp.p2 ++ prepCombTable ! np.a ! cl.c2}
} ;
predVPSlash : NounPhrase -> VPSlash -> ClSlash = \np,vps -> predVPSlash : NounPhrase -> VPSlash -> ClSlash = \np,vps ->
let cl = predVP np vps in {s = table { let cl = predVP np vps in {s = table {
True => cl.s ! Subord ; True => cl.s ! Subord ;
@@ -853,6 +937,19 @@ oper
p2 = if_then_Pol p subjpron []} ; -- no subjpron in negation p2 = if_then_Pol p subjpron []} ; -- no subjpron in negation
Question => {p1 = "ma" ; p2 = []} ; -- TODO find out how negative questions work Question => {p1 = "ma" ; p2 = []} ; -- TODO find out how negative questions work
{-
The first type of negative question has the QM ma and the negative word áan 'noť.
These questions usually include clitic subject pronouns and the three elements
coalesce as follows: ma - aan 'not' + aan 'I' → miyaanan
he second type of negative question uses a distinct question word sow (show) which
is a marker of speaker uncertainty also found in potential sentences
(though with a distinct verbal inflection). This type of sentence has the negative
word ma 'not'; for example:
Sow Faarax ma ihid?
QM Farah not be:NEG
'Are you not Farah?'
-}
Statement => case <p,vp.stm,subj.a> of { Statement => case <p,vp.stm,subj.a> of {
<Pos,Waa (Copula|NoCopula),Pl3|Sg3 _> -- no subjpron in predicative sentences: <Pos,Waa (Copula|NoCopula),Pl3|Sg3 _> -- no subjpron in predicative sentences:
@@ -886,7 +983,7 @@ oper
stm = stm.p1 ; -- sentence type marker; empty if subordinate and positive stm = stm.p1 ; -- sentence type marker; empty if subordinate and positive
afterSTM = vp.vComp.in_ -- "waa in" construction afterSTM = vp.vComp.subjunc -- "waa in" construction
++ stm.p2 -- possible subj. pronoun ++ stm.p2 -- possible subj. pronoun
++ case cltyp of { ++ case cltyp of {
Subord => obj.p1 ; -- noun object if it's subordinate clause Subord => obj.p1 ; -- noun object if it's subordinate clause
@@ -902,6 +999,42 @@ oper
++ vp.miscAdv } ; ---- NB. Only used if there are several adverbs, or for "waa in" construction. ++ vp.miscAdv } ; ---- NB. Only used if there are several adverbs, or for "waa in" construction.
---- Primary places for adverbs are obj, sii or dhex. ---- Primary places for adverbs are obj, sii or dhex.
wordOrderLite : ClType -> ClLite -> QClause = \cltyp,cllite -> {
s = \\t,a,p =>
let cl = complCl cllite ;
bind : Str = case <isPassive cl, cl.obj2.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 } ;
pred = cl.pred ! cltyp ! t ! a ! p in
cl.berri -- AdV
++ cl.subj.noun -- subject if it's a noun
++ case cltyp of {
Subord => [] ;
_ => obj.p1 } -- noun object if it's a statement
++ cl.stm ! cltyp ! p -- STM
++ cl.vComp.subjunc -- "waa in" construction
++ cl.subj.pron
++ case cltyp of {
Subord => obj.p1 ; -- noun object if it's subordinate clause
_ => [] }
++ obj.p2 -- object if it's a pronoun
++ cl.sii -- restricted set of particles
++ cl.dhex -- restricted set of nouns/adverbials
++ cl.secObj -- "second object"
++ cl.vComp.inf -- VV complement, if it's infinitive
++ pred.inf -- potential infinitive/participle
++ pred.fin -- the verb inflected
++ cl.vComp.subcl -- VV complement, if it's subordinate clause
++ cl.miscAdv ---- NB. Only used if there are several adverbs, or for "waa in" construction.
} ; ---- Primary places for adverbs are obj, sii or dhex.
VFun : Type = Tense -> Anteriority -> Polarity -> Agreement -> BaseVerb VFun : Type = Tense -> Anteriority -> Polarity -> Agreement -> BaseVerb
-> {fin : Str ; inf : Str} ; -> {fin : Str ; inf : Str} ;

View File

@@ -87,9 +87,9 @@ lin someSg_Det = somePl_Det ** {
--lin no_Quant = mkPrep no_Quant --lin no_Quant = mkPrep no_Quant
lin that_Quant = defQuant "aas" "kaas" "taas" "kuwaas" True ; lin that_Quant = defQuant "aas" "kaas" "taas" "kuwaas" True ; -- true = nominative marker is i
lin this_Quant = defQuant "an" "kan" "tan" "kuwan" True ; lin this_Quant = defQuant "an" "kan" "tan" "kuwan" True ;
--lin which_IQuant = defQuant lin which_IQuant = defIQuant "ee" ;
{- {-
----- -----

View File

@@ -17,7 +17,7 @@ lin
-- : VV -> VP -> VP ; -- : VV -> VP -> VP ;
ComplVV vv vp = let vc = vp.vComp in case vv.vvtype of { ComplVV vv vp = let vc = vp.vComp in case vv.vvtype of {
Waa_In => vp ** { Waa_In => vp ** {
vComp = vc ** {in_ = 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 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: obj2 = vp.obj2 ** {s = []} ; -- word order hack to avoid more parameters:
miscAdv = vp.miscAdv ++ vp.obj2.s -- dump the object to miscAdv miscAdv = vp.miscAdv ++ vp.obj2.s -- dump the object to miscAdv
} ; } ;

View File

@@ -79,3 +79,9 @@ Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (RelNP (UseP
--LangEng: he , that sees the men , is this --LangEng: he , that sees the men , is this
LangSom: isagu oo niman BIND ka arkaa waa kan LangSom: isagu oo niman BIND ka arkaa waa kan
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (RelNP (UsePron he_Pron) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (ComplSlash (SlashV2a see_V2) (DetCN (DetQuant DefArt NumPl) (UseN man_N)))))) (UseComp (CompNP (DetNP (DetQuant this_Quant NumSg))))))) NoVoc Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (RelNP (UsePron he_Pron) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (ComplSlash (SlashV2a see_V2) (DetCN (DetQuant DefArt NumPl) (UseN man_N)))))) (UseComp (CompNP (DetNP (DetQuant this_Quant NumSg))))))) NoVoc
-- Question clauses
-- LangEng: which cat teaches him
LangSom: bisad BIND dee baa ku bartaa
Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPres ASimul) PPos (QuestVP (IdetCN (IdetQuant which_IQuant NumSg) (UseN cat_N)) (ComplSlash (SlashV2a teach_V2) (UsePron he_Pron))))) NoVoc