From 7c039494724326be76084fe12be3d1f7ee06885a Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 11 Sep 2019 17:18:12 +0200 Subject: [PATCH 1/7] (Som) New unit tests about questions --- src/somali/unittest/cl.gftest | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/somali/unittest/cl.gftest b/src/somali/unittest/cl.gftest index 64a59f0d..8859e362 100644 --- a/src/somali/unittest/cl.gftest +++ b/src/somali/unittest/cl.gftest @@ -97,3 +97,14 @@ Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPres ASimul) PPos (QuestVP (IdetCN ( -- LangEng: how does your mother paint the house black LangSom: sidee baa ay hooya BIND daa madow u rinjiyeysaa guri BIND ga Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPres ASimul) PPos (QuestIAdv how_IAdv (PredVP (DetCN (DetQuant (PossPron youSg_Pron) NumSg) (UseN2 mother_N2)) (ComplSlash (SlashV2A paint_V2A (PositA black_A)) (DetCN (DetQuant DefArt NumSg) (UseN house_N))))))) NoVoc + +-- Some examples from Nilsson, adjusted to the GF lexicon +-- Maxaa ay u samaysay sidaas? Varför gjorde hon så? +--LangEng: why did she eat the meat +LangSom: TODO +Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv why_IAdv (PredVP (UsePron she_Pron) (ComplSlash (SlashV2a eat_V2) (DetCN (DetQuant DefArt NumSg) (UseN meat_N))))))) NoVoc + +-- Maxaa ay ahaa dharka cusub ee Faadumo loo iibiyay? Vad/Vilka var de nya kläder som man köpt åt Fadumo? +--LangEng: what was the meat that was eaten +LangSom: TODO +Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestVP whatSg_IP (UseComp (CompNP (DetCN (DetQuant DefArt NumSg) (RelCN (UseN meat_N) (UseRCl (TTAnt TPast ASimul) PPos (RelVP IdRP (PassV2 eat_V2)))))))))) NoVoc From 52aa4c35e08b833bf194a474ce7e77b81a5a4bae Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 12 Sep 2019 16:56:50 +0200 Subject: [PATCH 2/7] (Som) Fixes in question clauses --- src/somali/CatSom.gf | 6 ++--- src/somali/PhraseSom.gf | 4 +-- src/somali/QuestionSom.gf | 20 +++++++++------ src/somali/ResSom.gf | 11 +++++++++ src/somali/StructuralSom.gf | 46 ++++++++++++++++++++--------------- src/somali/unittest/cl.gftest | 10 +++++--- 6 files changed, 61 insertions(+), 36 deletions(-) diff --git a/src/somali/CatSom.gf b/src/somali/CatSom.gf index 338f4b7a..53881637 100644 --- a/src/somali/CatSom.gf +++ b/src/somali/CatSom.gf @@ -23,10 +23,11 @@ concrete CatSom of Cat = CommonX - [Adv,IAdv] ** open ResSom, Prelude in { -- Constructed in QuestionSom. QCl = ResSom.QClause ; - 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" + IP = ResSom.NounPhrase ** {contractSTM : Bool} ; -- like NP but may contract with STM + IAdv = ResSom.IAdv ; --2 Subord clauses and pronouns @@ -116,8 +117,7 @@ concrete CatSom of Cat = CommonX - [Adv,IAdv] ** open ResSom, Prelude in { N3 = ResSom.Noun3 ; PN = ResSom.PNoun ; - Adv, - IAdv = ResSom.Adverb ; -- Preposition of an adverbial can merge with obligatory complements of the verb. + Adv = ResSom.Adverb ; -- Preposition of an adverbial can merge with obligatory complements of the verb. linref -- Cl = linCl ; diff --git a/src/somali/PhraseSom.gf b/src/somali/PhraseSom.gf index dd1e596c..c9c18c39 100644 --- a/src/somali/PhraseSom.gf +++ b/src/somali/PhraseSom.gf @@ -5,6 +5,7 @@ concrete PhraseSom of Phrase = CatSom ** open Prelude, ResSom in { UttS s = {s = s.s ! False} ; UttQS qs = qs ; + UttIAdv iadv = iadv ; UttImpSg pol imp = let ma = case pol.p of { Pos => [] ; Neg => "ma" } @@ -15,8 +16,7 @@ concrete PhraseSom of Phrase = CatSom ** open Prelude, ResSom in { UttIP ip = {s = ip.s ! Abs} ; UttNP np = {s = np.s ! Abs} ; UttVP vp = {s = infVP vp} ; - UttAdv, - UttIAdv = \adv -> {s = linAdv adv} ; + UttAdv adv = {s = linAdv adv} ; UttCN n = {s = linCN n} ; UttCard n = {s = n.s ! Mid} ; UttAP ap = { s = ap.s ! AF Sg Abs } ; diff --git a/src/somali/QuestionSom.gf b/src/somali/QuestionSom.gf index 0cdf0524..bf230a1b 100644 --- a/src/somali/QuestionSom.gf +++ b/src/somali/QuestionSom.gf @@ -1,5 +1,5 @@ concrete QuestionSom of Question = CatSom ** open - Prelude, ResSom, ParadigmsSom, (VS=VerbSom), (NS=NounSom), (AS=AdverbSom) in { + Prelude, ResSom, ParadigmsSom, (VS=VerbSom), (NS=NounSom), (SS=StructuralSom) in { -- A question can be formed from a clause ('yes-no question') or -- with an interrogative. @@ -24,7 +24,7 @@ concrete QuestionSom of Question = CatSom ** open 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 ; + in cl2qclslash (notB ip.contractSTM) clsIPFocus ; -- : IAdv -> Cl -> QCl ; -- why does John walk @@ -34,14 +34,20 @@ concrete QuestionSom of Question = CatSom ** open cl : ClSlash = clRaw ** { stm = \\clt,p => case of { -- IAdv is focused with baa, and subject comes after - <_,Pos> => "baa" ++ sbj.pron ++ sbj.noun; + <_,Pos> => case iadv.contractSTM of { + True => [] ; _ => "baa"} + ++ sbj.pron ++ sbj.noun ; -- TODO how do negative questions work - _ => clRaw.stm ! Question ! p ++ sbj.pron ++ sbj.noun } ; + _ => case iadv.contractSTM of { + True => [] ; _ => clRaw.stm ! Question ! p} + ++ sbj.pron ++ sbj.noun } ; subj = sbj ** {noun, pron = []} -- to force subject after baa } ; - in cl2qcl True cl ; -- TODO: add contractSTM field to IAdv as well + in cl2qcl True cl ; -- True because we handle STM placement in cl.stm -- : IComp -> NP -> QCl ; -- where is John? + -- Saeed p. 212 Ninkii ay raaceen waa ayo? man-the they accompanied DM who + -- 'The man they travelled with is who?' -- QuestIComp icomp np = ; -- Interrogative pronouns can be formed with interrogative @@ -64,9 +70,7 @@ concrete QuestionSom of Question = CatSom ** open -- Interrogative adverbs can be formed prepositionally. -- : Prep -> IP -> IAdv ; -- with whom - PrepIP prep ip = - let ipAbs : Str = ip.s ! Abs - in prepNP (mkPrep prep ipAbs [] []) emptyNP ; + PrepIP prep ip = SS.prepIP prep (ip.s ! Abs) False ; -- They can be modified with other adverbs. diff --git a/src/somali/ResSom.gf b/src/somali/ResSom.gf index ca8f788b..8116924f 100644 --- a/src/somali/ResSom.gf +++ b/src/somali/ResSom.gf @@ -697,6 +697,11 @@ oper np : NPLite ; -- NP from PrepNP can be promoted into a core argument. } ; + IAdv : Type = Adverb ** { + contractSTM : Bool ; + s : Str -- alone, in one-word question, e.g. Waayo? 'Why?' + } ; + prepNP : Prep -> NounPhrase -> Adverb = \prep,np -> prep ** { np = case prep.isPoss of { True => nplite emptyNP ; @@ -939,6 +944,12 @@ oper isRel : Bool = False ; in mkClause Question isRel hasSubjPron ; + -- Question clauses: subject pronoun is included + cl2qclslash : Bool -> ClSlash -> Clause = + let hasSubjPron : Bool = True ; + isRel : Bool = False ; + in mkClause Question isRel hasSubjPron ; + -- Sentence: include subject pronoun and STM. -- When subordinate, include "in". cl2sentence : Bool -> ClSlash -> Clause = \isSubord,cls -> { diff --git a/src/somali/StructuralSom.gf b/src/somali/StructuralSom.gf index c9cadabb..4429e3b4 100644 --- a/src/somali/StructuralSom.gf +++ b/src/somali/StructuralSom.gf @@ -16,14 +16,14 @@ lin as_CAdv = { s = "" ; p = [] } ; lin less_CAdv = { s = "" ; p = [] } ; lin more_CAdv = { s = "" ; p = [] } ; -} -lin how_IAdv = prepNP (mkPrep (mkPrep u) "sidee" [] []) emptyNP ; -{- -lin how8much_IAdv = ss "" ; -lin when_IAdv = ss "" ; -lin where_IAdv = ss "" ; -lin why_IAdv = ss "" ; +lin how_IAdv = mkIAdv u "sidee" False ; -lin always_AdV = ss "" ; +-- lin how8much_IAdv = ss "" ; +-- lin when_IAdv = ss "" ; +-- lin where_IAdv = ss "" ; +lin why_IAdv = let mx = mkIAdv u "maxaa" True in mx ** {s = "waayo"} ; + +{-lin always_AdV = ss "" ; lin everywhere_Adv = ss "" ; lin here7from_Adv = ss "" ; @@ -148,19 +148,11 @@ lin with_Prep = mkPrep la ; we_Pron = pronTable ! Pl1 Incl ; youPl_Pron = pronTable ! Pl2 ; they_Pron = pronTable ! Pl3 ; -{- -lin whatPl_IP = ; -lin whatSg_IP = ; -lin whoPl_IP = ; --} - -lin whoSg_IP = emptyNP ** { - s = table { - Nom => "yaa" ; -- together with STM - Abs => "ayo" } ; -- alone, no STM (used in UttIP) - contractSTM = True ; - } ; +--lin whatPl_IP = ; +lin whatSg_IP = mkIP "maxay" "maxaa" True ; +--lin whoPl_IP = ; +lin whoSg_IP = mkIP "ayo" "yaa" True ; ------- -- Subj @@ -195,4 +187,20 @@ lin want_VV = mkVV (mkV "rabid" "rab" "rab") subjunctive ; {- lin please_Voc = ss "" ; -} +oper + mkIAdv : Preposition -> Str -> Bool -> ResSom.IAdv = \pr -> + let pr' : Prep = ParadigmsSom.mkPrep pr ; + in prepIP pr' ; + + mkIP : (maxay, maxaa : Str) -> Bool -> IP = \maxay,maxaa,b -> emptyNP ** { + s = table { + Nom => maxaa ; -- together with STM + Abs => maxay } ; -- alone, no STM (used in UttIP and IComp) + contractSTM = b ; + } ; + + prepIP : Prep -> Str -> Bool -> ResSom.IAdv = \pr,str,b -> + let adv : Adverb = prepNP (mkPrep pr str [] []) emptyNP ; + in adv ** {contractSTM = b ; s = linAdv adv} ; + } diff --git a/src/somali/unittest/cl.gftest b/src/somali/unittest/cl.gftest index 8859e362..75169102 100644 --- a/src/somali/unittest/cl.gftest +++ b/src/somali/unittest/cl.gftest @@ -83,10 +83,12 @@ 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 +-- subject pronoun 'ay' included, because whom is an object +LangSom: yaa ay 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 +-- subject pronoun not included, because who is a subject 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 @@ -99,12 +101,12 @@ LangSom: sidee baa ay hooya BIND daa madow u rinjiyeysaa guri BIND ga Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPres ASimul) PPos (QuestIAdv how_IAdv (PredVP (DetCN (DetQuant (PossPron youSg_Pron) NumSg) (UseN2 mother_N2)) (ComplSlash (SlashV2A paint_V2A (PositA black_A)) (DetCN (DetQuant DefArt NumSg) (UseN house_N))))))) NoVoc -- Some examples from Nilsson, adjusted to the GF lexicon --- Maxaa ay u samaysay sidaas? Varför gjorde hon så? +-- Maxaa ay u samaysay sidaas? Varför gjorde hon så? --LangEng: why did she eat the meat -LangSom: TODO +LangSom: maxaa ay u cuntay hilib BIND ka Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv why_IAdv (PredVP (UsePron she_Pron) (ComplSlash (SlashV2a eat_V2) (DetCN (DetQuant DefArt NumSg) (UseN meat_N))))))) NoVoc --- Maxaa ay ahaa dharka cusub ee Faadumo loo iibiyay? Vad/Vilka var de nya kläder som man köpt åt Fadumo? +-- Maxaa ay ahaa dharka cusub ee Faadumo loo iibiyay? Vad/Vilka var de nya kläder som man köpt åt Fadumo? TODO why is there subject pronoun here? --LangEng: what was the meat that was eaten LangSom: TODO Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestVP whatSg_IP (UseComp (CompNP (DetCN (DetQuant DefArt NumSg) (RelCN (UseN meat_N) (UseRCl (TTAnt TPast ASimul) PPos (RelVP IdRP (PassV2 eat_V2)))))))))) NoVoc From d52f1633b71cfa8d7054d31ac898e06561051938 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 13 Sep 2019 14:04:28 +0200 Subject: [PATCH 3/7] (Som) Fix bug in QuestSlash, new unit tests + comments. --- src/somali/QuestionSom.gf | 14 +++++++++++--- src/somali/StructuralSom.gf | 2 +- src/somali/unittest/cl.gftest | 29 +++++++++++++++++++++++------ 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/somali/QuestionSom.gf b/src/somali/QuestionSom.gf index bf230a1b..073f1846 100644 --- a/src/somali/QuestionSom.gf +++ b/src/somali/QuestionSom.gf @@ -21,9 +21,17 @@ concrete QuestionSom of Question = CatSom ** open -- : IP -> ClSlash -> QCl ; -- whom does John love 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. - } ; + subj = cls.subj ** { -- place IP first in the sentence, + noun = ip.s ! Nom -- keep old subject pronoun. + } ; + obj2 = cls.obj2 ** { -- move old subject noun before object. + s = cls.subj.noun ++ cls.obj2.s + } ; + stm : ClType=>Polarity=>Str = + \\clt,p => case of { + <_,Pos> => "baa" ; + _ => cls.stm ! clt ! p } + } ; in cl2qclslash (notB ip.contractSTM) clsIPFocus ; diff --git a/src/somali/StructuralSom.gf b/src/somali/StructuralSom.gf index 4429e3b4..56069169 100644 --- a/src/somali/StructuralSom.gf +++ b/src/somali/StructuralSom.gf @@ -20,7 +20,7 @@ lin how_IAdv = mkIAdv u "sidee" False ; -- lin how8much_IAdv = ss "" ; -- lin when_IAdv = ss "" ; --- lin where_IAdv = ss "" ; +lin where_IAdv = mkIAdv noPrep "xaggee" False ; lin why_IAdv = let mx = mkIAdv u "maxaa" True in mx ** {s = "waayo"} ; {-lin always_AdV = ss "" ; diff --git a/src/somali/unittest/cl.gftest b/src/somali/unittest/cl.gftest index 75169102..18c8e24d 100644 --- a/src/somali/unittest/cl.gftest +++ b/src/somali/unittest/cl.gftest @@ -82,20 +82,37 @@ Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (RelNP (UseP -- Question clauses --- to whom did mother give the meat --- subject pronoun 'ay' included, because whom is an object -LangSom: yaa ay 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 --- subject pronoun not included, because who is a subject +-- subject pronoun not included, because who is a subject. STM merged to pron. 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 +-- to whom did mother give the meat +-- subject pronoun 'ay' included, because whom is an object. STM merged. +LangSom: yaa ay 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: which cat teaches him +-- subject pronoun not included, STM not merged. 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 +-- LangEng: which woman did you see +-- subject pronoun included, STM not merged. +LangSom: naag BIND tee baa aad aragtay +Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestSlash (IdetCN (IdetQuant which_IQuant NumSg) (UseN woman_N)) (SlashVP (UsePron youSg_Pron) (SlashV2a see_V2))))) NoVoc + +-- LangEng: where did you go +-- subject pronoun included, because IAdv xaggee 'where' is fronted and aad 'you' is subject. STM not merged. +LangSom: xaggee baa aad tagtay +Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv where_IAdv (PredVP (UsePron youSg_Pron) (UseV go_V))))) NoVoc + +-- LangEng: why did you go +-- subject pronoun included, STM merged. +LangSom: maxaa aad u tagtay +Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv why_IAdv (PredVP (UsePron youSg_Pron) (UseV go_V))))) NoVoc + +--- Longer example, unsure about word order -- TODO check -- LangEng: how does your mother paint the house black LangSom: sidee baa ay hooya BIND daa madow u rinjiyeysaa guri BIND ga Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPres ASimul) PPos (QuestIAdv how_IAdv (PredVP (DetCN (DetQuant (PossPron youSg_Pron) NumSg) (UseN2 mother_N2)) (ComplSlash (SlashV2A paint_V2A (PositA black_A)) (DetCN (DetQuant DefArt NumSg) (UseN house_N))))))) NoVoc From 0ed0c1f19432453f99a5ad4edf7bda8f5bf1228a Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 13 Sep 2019 14:28:33 +0200 Subject: [PATCH 4/7] (Som) Add TODO about negative questions --- src/somali/QuestionSom.gf | 4 ++++ src/somali/unittest/cl.gftest | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/somali/QuestionSom.gf b/src/somali/QuestionSom.gf index 073f1846..410038c8 100644 --- a/src/somali/QuestionSom.gf +++ b/src/somali/QuestionSom.gf @@ -46,6 +46,10 @@ concrete QuestionSom of Question = CatSom ** open True => [] ; _ => "baa"} ++ sbj.pron ++ sbj.noun ; -- TODO how do negative questions work + -- Information questions are not commonly used in negative forms. When they occur they have the same forms as negative declaratives with focus (7.4.1). There is however a strong tendency to use positive forms, for example by subordinating the clause under a verb with an inherently negative meaning: + -- Maxaad u tegi weydey? + -- what+FOC+you for go:INF failed + -- 'Why didn't you go?' (lit. 'Why did you fail to go?') _ => case iadv.contractSTM of { True => [] ; _ => clRaw.stm ! Question ! p} ++ sbj.pron ++ sbj.noun } ; diff --git a/src/somali/unittest/cl.gftest b/src/somali/unittest/cl.gftest index 18c8e24d..6ea33be0 100644 --- a/src/somali/unittest/cl.gftest +++ b/src/somali/unittest/cl.gftest @@ -112,6 +112,11 @@ Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv where_I LangSom: maxaa aad u tagtay Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv why_IAdv (PredVP (UsePron youSg_Pron) (UseV go_V))))) NoVoc +-- Negative question -- TODO not implemented yet properly. Saeed p. 203 +-- LangEng: why didn't you go +LangSom: maxaa aad u tagi weydey +Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PNeg (QuestIAdv why_IAdv (PredVP (UsePron youSg_Pron) (UseV go_V))))) NoVoc + --- Longer example, unsure about word order -- TODO check -- LangEng: how does your mother paint the house black LangSom: sidee baa ay hooya BIND daa madow u rinjiyeysaa guri BIND ga From 319f097ac0e52badc056f0085c8bb2ca7e2f2fe2 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 13 Sep 2019 15:12:13 +0200 Subject: [PATCH 5/7] (Som) Move qcl-tests into new file --- src/somali/unittest/cl.gftest | 53 ------------------------------ src/somali/unittest/qcl.gftest | 60 ++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 53 deletions(-) create mode 100644 src/somali/unittest/qcl.gftest diff --git a/src/somali/unittest/cl.gftest b/src/somali/unittest/cl.gftest index 6ea33be0..0374a01f 100644 --- a/src/somali/unittest/cl.gftest +++ b/src/somali/unittest/cl.gftest @@ -79,56 +79,3 @@ 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: who wants to go --- subject pronoun not included, because who is a subject. STM merged to pron. -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 - --- to whom did mother give the meat --- subject pronoun 'ay' included, because whom is an object. STM merged. -LangSom: yaa ay 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: which cat teaches him --- subject pronoun not included, STM not merged. -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 - --- LangEng: which woman did you see --- subject pronoun included, STM not merged. -LangSom: naag BIND tee baa aad aragtay -Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestSlash (IdetCN (IdetQuant which_IQuant NumSg) (UseN woman_N)) (SlashVP (UsePron youSg_Pron) (SlashV2a see_V2))))) NoVoc - --- LangEng: where did you go --- subject pronoun included, because IAdv xaggee 'where' is fronted and aad 'you' is subject. STM not merged. -LangSom: xaggee baa aad tagtay -Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv where_IAdv (PredVP (UsePron youSg_Pron) (UseV go_V))))) NoVoc - --- LangEng: why did you go --- subject pronoun included, STM merged. -LangSom: maxaa aad u tagtay -Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv why_IAdv (PredVP (UsePron youSg_Pron) (UseV go_V))))) NoVoc - --- Negative question -- TODO not implemented yet properly. Saeed p. 203 --- LangEng: why didn't you go -LangSom: maxaa aad u tagi weydey -Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PNeg (QuestIAdv why_IAdv (PredVP (UsePron youSg_Pron) (UseV go_V))))) NoVoc - ---- Longer example, unsure about word order -- TODO check --- LangEng: how does your mother paint the house black -LangSom: sidee baa ay hooya BIND daa madow u rinjiyeysaa guri BIND ga -Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPres ASimul) PPos (QuestIAdv how_IAdv (PredVP (DetCN (DetQuant (PossPron youSg_Pron) NumSg) (UseN2 mother_N2)) (ComplSlash (SlashV2A paint_V2A (PositA black_A)) (DetCN (DetQuant DefArt NumSg) (UseN house_N))))))) NoVoc - --- Some examples from Nilsson, adjusted to the GF lexicon --- Maxaa ay u samaysay sidaas? Varför gjorde hon så? ---LangEng: why did she eat the meat -LangSom: maxaa ay u cuntay hilib BIND ka -Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv why_IAdv (PredVP (UsePron she_Pron) (ComplSlash (SlashV2a eat_V2) (DetCN (DetQuant DefArt NumSg) (UseN meat_N))))))) NoVoc - --- Maxaa ay ahaa dharka cusub ee Faadumo loo iibiyay? Vad/Vilka var de nya kläder som man köpt åt Fadumo? TODO why is there subject pronoun here? ---LangEng: what was the meat that was eaten -LangSom: TODO -Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestVP whatSg_IP (UseComp (CompNP (DetCN (DetQuant DefArt NumSg) (RelCN (UseN meat_N) (UseRCl (TTAnt TPast ASimul) PPos (RelVP IdRP (PassV2 eat_V2)))))))))) NoVoc diff --git a/src/somali/unittest/qcl.gftest b/src/somali/unittest/qcl.gftest new file mode 100644 index 00000000..0091209b --- /dev/null +++ b/src/somali/unittest/qcl.gftest @@ -0,0 +1,60 @@ + +-- Question clauses + +-- LangEng: who wants to go +-- subject pronoun not included, because who is a subject. STM merged to pron. +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 + +-- to whom did mother give the meat +-- subject pronoun 'ay' included, because whom is an object. STM merged. +LangSom: yaa ay 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: which cat teaches him +-- subject pronoun not included, STM not merged. +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 + +-- LangEng: which woman did you see +-- subject pronoun included, STM not merged. +LangSom: naag BIND tee baa aad aragtay +Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestSlash (IdetCN (IdetQuant which_IQuant NumSg) (UseN woman_N)) (SlashVP (UsePron youSg_Pron) (SlashV2a see_V2))))) NoVoc + +-- LangEng: where did you go +-- subject pronoun included, because IAdv xaggee 'where' is fronted and aad 'you' is subject. STM not merged. +LangSom: xaggee baa aad tagtay +Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv where_IAdv (PredVP (UsePron youSg_Pron) (UseV go_V))))) NoVoc + +-- LangEng: why did you go +-- subject pronoun included, STM merged. +LangSom: maxaa aad u tagtay +Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv why_IAdv (PredVP (UsePron youSg_Pron) (UseV go_V))))) NoVoc + +-- Negative question -- TODO not implemented yet properly. Saeed p. 203 +-- LangEng: why didn't you go +LangSom: maxaa aad u tagi weydey +Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PNeg (QuestIAdv why_IAdv (PredVP (UsePron youSg_Pron) (UseV go_V))))) NoVoc + +-- IComp +-- LangEng: who is the man +-- Saeed p. 212 Ninkii ay raaceen waa ayo? man-the they accompanied DM who +-- 'The man they travelled with is who?' +LangSom: nin BIND ku waa ayo +Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPres ASimul) PPos (QuestIComp (CompIP whoSg_IP) (DetCN (DetQuant DefArt NumSg) (UseN man_N))))) NoVoc + +--- Longer example, unsure about word order -- TODO check +-- LangEng: how does your mother paint the house black +LangSom: sidee baa ay hooya BIND daa madow u rinjiyeysaa guri BIND ga +Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPres ASimul) PPos (QuestIAdv how_IAdv (PredVP (DetCN (DetQuant (PossPron youSg_Pron) NumSg) (UseN2 mother_N2)) (ComplSlash (SlashV2A paint_V2A (PositA black_A)) (DetCN (DetQuant DefArt NumSg) (UseN house_N))))))) NoVoc + +-- Some examples from Nilsson, adjusted to the GF lexicon +-- Maxaa ay u samaysay sidaas? Varför gjorde hon så? +--LangEng: why did she eat the meat +LangSom: maxaa ay u cuntay hilib BIND ka +Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv why_IAdv (PredVP (UsePron she_Pron) (ComplSlash (SlashV2a eat_V2) (DetCN (DetQuant DefArt NumSg) (UseN meat_N))))))) NoVoc + +-- Maxaa ay ahaa dharka cusub ee Faadumo loo iibiyay? Vad/Vilka var de nya kläder som man köpt åt Fadumo? TODO why is there subject pronoun here? +--LangEng: what was the meat that was eaten +LangSom: TODO +Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestVP whatSg_IP (UseComp (CompNP (DetCN (DetQuant DefArt NumSg) (RelCN (UseN meat_N) (UseRCl (TTAnt TPast ASimul) PPos (RelVP IdRP (PassV2 eat_V2)))))))))) NoVoc From d061595a2a6f5143c9b45ec7092a0c09fad18345 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 13 Sep 2019 15:12:50 +0200 Subject: [PATCH 6/7] (Som) Add IComp + related functions --- src/somali/CatSom.gf | 2 +- src/somali/QuestionSom.gf | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/somali/CatSom.gf b/src/somali/CatSom.gf index 53881637..52af918d 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 ; - IComp = SS ; -- interrogative complement of copula e.g. "where" + IComp = ResSom.Complement ; -- 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 diff --git a/src/somali/QuestionSom.gf b/src/somali/QuestionSom.gf index 410038c8..095d3409 100644 --- a/src/somali/QuestionSom.gf +++ b/src/somali/QuestionSom.gf @@ -58,9 +58,12 @@ concrete QuestionSom of Question = CatSom ** open in cl2qcl True cl ; -- True because we handle STM placement in cl.stm -- : IComp -> NP -> QCl ; -- where is John? - -- Saeed p. 212 Ninkii ay raaceen waa ayo? man-the they accompanied DM who - -- 'The man they travelled with is who?' - -- QuestIComp icomp np = ; + QuestIComp icomp np = + let cls = predVP np (VS.UseComp icomp) ; + -- cl = cls ** { -- TODO: neg. questions + -- stm : ClType=>Polarity=>Str = \\_,_ => "waa" + -- } + in cl2sentence False cls ; -- copula is dropped and STM is waa -- Interrogative pronouns can be formed with interrogative -- determiners, with or without a noun. @@ -93,10 +96,15 @@ concrete QuestionSom of Question = CatSom ** open -- pronouns. -- : IAdv -> IComp ; - --CompIAdv iadv = iadv ; -- where (is it) - + CompIAdv iadv = { -- where (is it) + comp = \\_ => <[], iadv.s> ; + stm = Waa NoCopula ; + } ; -- : IP -> IComp ; - --CompIP ip = { s = ip.s ! Abs } ; -- who (is it) + CompIP ip = { -- who (is it) + comp = \\_ => <[], ip.s ! Abs> ; + stm = Waa NoCopula ; + } ; {- -- More $IP$, $IDet$, and $IAdv$ are defined in $Structural$. From a23881f2dc7ecd6fad69326dee8e96b422b5ee71 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 13 Sep 2019 19:13:20 +0200 Subject: [PATCH 7/7] (Som) Minor cleanup + better comments --- src/somali/QuestionSom.gf | 21 +++++++---------- src/somali/ResSom.gf | 47 +++++++++++++++------------------------ 2 files changed, 26 insertions(+), 42 deletions(-) diff --git a/src/somali/QuestionSom.gf b/src/somali/QuestionSom.gf index 095d3409..8bd06455 100644 --- a/src/somali/QuestionSom.gf +++ b/src/somali/QuestionSom.gf @@ -10,27 +10,22 @@ concrete QuestionSom of Question = CatSom ** open -- : IP -> VP -> QCl ; QuestVP ip vp = -- TODO: if we want to contract baa + subj. pronoun, change ResSom.predVP - let clRaw : ClSlash = predVP ip vp ; - cl : ClSlash = clRaw ** { - stm = \\clt,p => case of { - <_,Pos> => "baa" ; - _ => clRaw.stm ! clt ! p } - } + let cls : ClSlash = predVP ip vp ; + cl : ClSlash = cls ** { + stm = modSTM "baa" cls.stm + } ; in cl2qcl (notB ip.contractSTM) cl ; -- : IP -> ClSlash -> QCl ; -- whom does John love QuestSlash ip cls = let clsIPFocus = cls ** { - subj = cls.subj ** { -- place IP first in the sentence, - noun = ip.s ! Nom -- keep old subject pronoun. + subj = cls.subj ** { -- keep old subject pronoun, + noun = ip.s ! Nom -- and place IP first. } ; obj2 = cls.obj2 ** { -- move old subject noun before object. - s = cls.subj.noun ++ cls.obj2.s + s = cls.subj.noun ++ cls.obj2.s } ; - stm : ClType=>Polarity=>Str = - \\clt,p => case of { - <_,Pos> => "baa" ; - _ => cls.stm ! clt ! p } + stm = modSTM "baa" cls.stm } ; in cl2qclslash (notB ip.contractSTM) clsIPFocus ; diff --git a/src/somali/ResSom.gf b/src/somali/ResSom.gf index 8116924f..d1f7032c 100644 --- a/src/somali/ResSom.gf +++ b/src/somali/ResSom.gf @@ -877,15 +877,7 @@ oper _ => predRaw -- Any other verb } ; - stm = \\cltyp,pol => - case of { - => showSTM vp.stm ; - => "ma" ; - => "ma" ; - => "sow" ; - => [] ; - => "aan" - } ; + stm = mkStm vp.stm ; comp = vp.comp ! subj.a ; vComp = vp.vComp ** { subcl = vp.vComp.subcl ! subj.a @@ -1062,28 +1054,25 @@ oper infVP : VerbPhrase -> Str = linVP VInf Statement ; - waaContr : Agreement => Polarity => Str = \\a,b => - let stm = if_then_Pol b "w" "m" - in stm + subjpron ! a ; + STMarker : Type = ClType => Polarity => Str ; - waaNoContr : Agreement => Polarity => {p1,p2 : Str} = \\a,p => - case p of { - Pos => {p1 = "waa" ; p2 = subjpron ! a} ; - Neg => {p1 = "ma" ; p2 = []} } ; - - waxaNoContr : Agreement => Polarity => {p1,p2 : Str} = \\a,p => - case p of { - Pos => {p1 = "waxa" ; p2 = subjpron ! a} ; - Neg => {p1 = "ma" ; p2 = []} } ; -- TODO: find out how to properly negate waxa clauses! - - subjpron : Agreement => Str = table { - Sg1|Pl1 Excl => "aan" ; - Pl1 Incl => "aynu" ; - Sg2|Pl2 => "aad" ; - Sg3 Masc => "uu" ; - Impers => [] ; - _ => "ay" } ; + mkStm : STM -> STMarker = \stm -> + \\cltyp,pol => + case of { + => showSTM stm ; + => "ma" ; + => "ma" ; + => "sow" ; + => [] ; + => "aan" + } ; + modSTM : Str -> STMarker -> STMarker = \str,stm -> + \\cltyp,pol => + case of { + <_,Pos> => str ; + _ => stm ! cltyp ! pol + } ; -------------------------------------------------------------------------------- -- linrefs