From 67ac5ae5e3ffb06db931546889aa0c8a6fa2646e Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 10 Sep 2019 16:54:19 +0200 Subject: [PATCH] (Som) Add QuestSlash + make it possible for IPs to contract with stm --- src/somali/CatSom.gf | 2 +- src/somali/QuestionSom.gf | 24 ++++++++++++++++-------- src/somali/ResSom.gf | 8 +++++--- src/somali/StructuralSom.gf | 8 +++++++- src/somali/unittest/cl.gftest | 8 ++++++++ 5 files changed, 37 insertions(+), 13 deletions(-) diff --git a/src/somali/CatSom.gf b/src/somali/CatSom.gf index 4a87768a..338f4b7a 100644 --- a/src/somali/CatSom.gf +++ b/src/somali/CatSom.gf @@ -23,7 +23,7 @@ concrete CatSom of Cat = CommonX - [Adv,IAdv] ** open ResSom, Prelude in { -- Constructed in QuestionSom. QCl = ResSom.QClause ; - IP = ResSom.NounPhrase ; + IP = ResSom.NounPhrase ** {contractSTM : Bool} ; 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" diff --git a/src/somali/QuestionSom.gf b/src/somali/QuestionSom.gf index 048b8316..0cdf0524 100644 --- a/src/somali/QuestionSom.gf +++ b/src/somali/QuestionSom.gf @@ -1,12 +1,12 @@ concrete QuestionSom of Question = CatSom ** open - Prelude, ResSom, (VS=VerbSom), (NS=NounSom), (AS=AdverbSom) in { + Prelude, ResSom, ParadigmsSom, (VS=VerbSom), (NS=NounSom), (AS=AdverbSom) in { -- A question can be formed from a clause ('yes-no question') or -- with an interrogative. lin -- : Cl -> QCl ; - QuestCl = cl2qcl ; + QuestCl = cl2qcl True; -- : IP -> VP -> QCl ; QuestVP ip vp = -- TODO: if we want to contract baa + subj. pronoun, change ResSom.predVP @@ -16,10 +16,16 @@ concrete QuestionSom of Question = CatSom ** open <_,Pos> => "baa" ; _ => clRaw.stm ! clt ! p } } - in cl2qcl cl ; + in cl2qcl (notB ip.contractSTM) cl ; -- : IP -> ClSlash -> QCl ; -- whom does John love - --QuestSlash ip cls = ; + QuestSlash ip cls = + let clsIPFocus = cls ** { + subj = cls.subj ** {noun = ip.s ! Nom} ; -- place IP first in the sentence, keep old subject pronoun. + obj2 = cls.obj2 ** {s = cls.subj.noun ++ cls.obj2.s} -- move old subject noun before object. + } ; + in cl2qcl (notB ip.contractSTM) clsIPFocus ; + -- : IAdv -> Cl -> QCl ; -- why does John walk QuestIAdv iadv cls = @@ -33,7 +39,7 @@ concrete QuestionSom of Question = CatSom ** open _ => clRaw.stm ! Question ! p ++ sbj.pron ++ sbj.noun } ; subj = sbj ** {noun, pron = []} -- to force subject after baa } ; - in cl2qcl cl ; + in cl2qcl True cl ; -- TODO: add contractSTM field to IAdv as well -- : IComp -> NP -> QCl ; -- where is John? -- QuestIComp icomp np = ; @@ -42,10 +48,10 @@ concrete QuestionSom of Question = CatSom ** open -- determiners, with or without a noun. -- : IDet -> CN -> IP ; -- which five songs - IdetCN = NS.DetCN ; + IdetCN idet cn = {contractSTM = False} ** NS.DetCN idet cn ; -- : IDet -> IP ; -- which five - IdetIP = NS.DetNP ; + IdetIP idet = {contractSTM = False} ** NS.DetNP idet ; -- They can be modified with adverbs. -- : IP -> Adv -> IP ; -- who in Paris @@ -58,7 +64,9 @@ concrete QuestionSom of Question = CatSom ** open -- Interrogative adverbs can be formed prepositionally. -- : Prep -> IP -> IAdv ; -- with whom - PrepIP = AS.PrepNP ; + PrepIP prep ip = + let ipAbs : Str = ip.s ! Abs + in prepNP (mkPrep prep ipAbs [] []) emptyNP ; -- They can be modified with other adverbs. diff --git a/src/somali/ResSom.gf b/src/somali/ResSom.gf index bf1c1f51..ca8f788b 100644 --- a/src/somali/ResSom.gf +++ b/src/somali/ResSom.gf @@ -776,6 +776,9 @@ oper insertComp : VPSlash -> NounPhrase -> VerbPhrase = \vp,np -> vp ** insertCompLite vp (nplite np) ; + insertCompCl : ClSlash -> NounPhrase -> ClSlash = \cls,np -> + cls ** insertCompLite cls (nplite np) ; + insertAdv : VerbPhrase -> Adverb -> VerbPhrase = \vp,adv -> vp ** insertAdvLite vp adv ; @@ -931,11 +934,10 @@ oper in mkClause Subord isRel hasSubjPron hasSTM ; -- Question clauses: subject pronoun not included, STM is - cl2qcl : ClSlash -> Clause = + cl2qcl : Bool -> ClSlash -> Clause = let hasSubjPron : Bool = False ; - hasSTM : Bool = True ; isRel : Bool = False ; - in mkClause Question isRel hasSubjPron hasSTM ; + in mkClause Question isRel hasSubjPron ; -- Sentence: include subject pronoun and STM. -- When subordinate, include "in". diff --git a/src/somali/StructuralSom.gf b/src/somali/StructuralSom.gf index 6d779b2a..c9cadabb 100644 --- a/src/somali/StructuralSom.gf +++ b/src/somali/StructuralSom.gf @@ -152,10 +152,16 @@ lin with_Prep = mkPrep la ; lin whatPl_IP = ; lin whatSg_IP = ; lin whoPl_IP = ; -lin whoSg_IP = ; -} +lin whoSg_IP = emptyNP ** { + s = table { + Nom => "yaa" ; -- together with STM + Abs => "ayo" } ; -- alone, no STM (used in UttIP) + contractSTM = True ; + } ; + ------- -- Subj diff --git a/src/somali/unittest/cl.gftest b/src/somali/unittest/cl.gftest index 0e294d26..64a59f0d 100644 --- a/src/somali/unittest/cl.gftest +++ b/src/somali/unittest/cl.gftest @@ -82,6 +82,14 @@ Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (RelNP (UseP -- Question clauses +-- to whom did mother give the meat +LangSom: yaa siisey hooyo hilib BIND ka +Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestSlash whoSg_IP (SlashVP (MassNP (UseN2 mother_N2)) (Slash3V3 give_V3 (DetCN (DetQuant DefArt NumSg) (UseN meat_N))))))) NoVoc + +-- LangEng: who wants to go +LangSom: yaa rabaa in uu tago +Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPres ASimul) PPos (QuestVP whoSg_IP (ComplVV want_VV (UseV go_V))))) NoVoc + -- 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