From dc33b2869ad61c489b263495a95d90b5bfae30d2 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 2 Sep 2019 17:14:25 +0200 Subject: [PATCH] (Som) WIP: wh-questions --- src/somali/ParamSom.gf | 3 + src/somali/QuestionSom.gf | 11 ++- src/somali/ResSom.gf | 141 +++++++++++++++++++++++++++++++++- src/somali/StructuralSom.gf | 4 +- src/somali/VerbSom.gf | 2 +- src/somali/unittest/cl.gftest | 6 ++ 6 files changed, 158 insertions(+), 9 deletions(-) diff --git a/src/somali/ParamSom.gf b/src/somali/ParamSom.gf index 4ae0ee316..a0807732f 100644 --- a/src/somali/ParamSom.gf +++ b/src/somali/ParamSom.gf @@ -328,6 +328,9 @@ oper VPres _ _ Neg => True ; _ => False } ; + + showSTM : STM -> Str = \stm -> case stm of { + Waxa => "waxa" ; Waa _ => "waa" } ; -------------------------------------------------------------------------------- -- Clauses diff --git a/src/somali/QuestionSom.gf b/src/somali/QuestionSom.gf index 584fd7725..45f2f3b96 100644 --- a/src/somali/QuestionSom.gf +++ b/src/somali/QuestionSom.gf @@ -9,7 +9,14 @@ concrete QuestionSom of Question = CatSom ** open QuestCl cl = mergeQCl (cl.s ! Question) ; -- : 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 of { + => "baa" ; + _ => clRaw.stm ! clt ! p } + } + in wordOrderLite Statement cl ; -- : IP -> ClSlash -> QCl ; -- whom does John love --QuestSlash ip cls = ; @@ -36,7 +43,7 @@ concrete QuestionSom of Question = CatSom ** open -- Interrogative quantifiers have number forms and can take number modifiers. -- : IQuant -> Num -> IDet ; -- which (five) - --IdetQuant = NS.DetQuant ; + IdetQuant = NS.DetQuant ; -- Interrogative adverbs can be formed prepositionally. -- : Prep -> IP -> IAdv ; -- with whom diff --git a/src/somali/ResSom.gf b/src/somali/ResSom.gf index c11f1d310..b8138d021 100644 --- a/src/somali/ResSom.gf +++ b/src/somali/ResSom.gf @@ -326,6 +326,10 @@ oper 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 -> table {SgMasc => m ; SgFem => f ; _ => p} ; @@ -686,14 +690,13 @@ oper Complement : Type = { comp : Agreement => {p1,p2 : Str} ; -- Agreement for AP complements stm : STM ; -- to choose right sentence type marker --- pred : PredType ; -- to choose right sentence type marker and copula } ; 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 - 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 ; subcl : Agreement => Str} -- VV complement if it's a subordinate clause } ; @@ -706,7 +709,7 @@ oper True => Waa Copula ; False => Waa NoPred } ; - vComp = {in_, inf = [] ; + vComp = {subjunc, inf = [] ; subcl = \\_ => []} ; berri,miscAdv = [] ; c2 = Single NoPrep ; @@ -793,6 +796,37 @@ oper } ; -------------------------------------------------------------------------------- -- 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. Clause : Type = {s : ClType => Tense => Anteriority => Polarity => BaseCl} ; ClSlash : Type = {s : Bool {-is subordinate-} => Tense => Anteriority => Polarity => BaseCl} ; @@ -813,6 +847,56 @@ oper ++ (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 of { + -- 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 of { + => showSTM vp.stm ; + => "ma" ; + => "ma" ; + => "sow" ; + => [] ; + => "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 -> let cl = predVP np vps in {s = table { True => cl.s ! Subord ; @@ -853,6 +937,19 @@ oper p2 = if_then_Pol p subjpron []} ; -- no subjpron in negation 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 of { -- no subjpron in predicative sentences: @@ -886,7 +983,7 @@ oper 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 ++ case cltyp of { 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. ---- 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 of { + => [] ; -- nothing to attach to the STM + _ => BIND } ; -- something to attach, use BIND + obj : {p1,p2 : Str} = case of { + -- 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 -> {fin : Str ; inf : Str} ; diff --git a/src/somali/StructuralSom.gf b/src/somali/StructuralSom.gf index ee850c2a4..fe7c624c7 100644 --- a/src/somali/StructuralSom.gf +++ b/src/somali/StructuralSom.gf @@ -87,9 +87,9 @@ lin someSg_Det = somePl_Det ** { --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 which_IQuant = defQuant +lin which_IQuant = defIQuant "ee" ; {- ----- diff --git a/src/somali/VerbSom.gf b/src/somali/VerbSom.gf index 42cccd0ee..43631c24a 100644 --- a/src/somali/VerbSom.gf +++ b/src/somali/VerbSom.gf @@ -17,7 +17,7 @@ lin -- : VV -> VP -> VP ; ComplVV vv vp = let vc = vp.vComp in case vv.vvtype of { 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: miscAdv = vp.miscAdv ++ vp.obj2.s -- dump the object to miscAdv } ; diff --git a/src/somali/unittest/cl.gftest b/src/somali/unittest/cl.gftest index 0374a01f5..597aa4c79 100644 --- a/src/somali/unittest/cl.gftest +++ b/src/somali/unittest/cl.gftest @@ -79,3 +79,9 @@ Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (RelNP (UseP --LangEng: he , that sees the men , is this 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 + +-- 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