From 0bbc4c551b6e38b3fc6c0483f0c1bec17f956a85 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 10 Sep 2019 13:13:11 +0200 Subject: [PATCH 1/6] (Som) IAdv + related functions --- src/somali/AdverbSom.gf | 9 +--- src/somali/CatSom.gf | 11 ++--- src/somali/GrammarSom.gf | 4 +- src/somali/PhraseSom.gf | 10 ++--- src/somali/QuestionSom.gf | 19 +++++--- src/somali/ResSom.gf | 87 +++++++++++++++++++++++++------------ src/somali/StructuralSom.gf | 7 +-- 7 files changed, 89 insertions(+), 58 deletions(-) diff --git a/src/somali/AdverbSom.gf b/src/somali/AdverbSom.gf index 95bc1e98..1169ff6f 100644 --- a/src/somali/AdverbSom.gf +++ b/src/somali/AdverbSom.gf @@ -11,14 +11,7 @@ lin -- ComparAdvAdjS : CAdv -> A -> S -> Adv ; -- more warmly than he runs -- : Prep -> NP -> Adv ; - PrepNP prep np = prep ** { - np = case prep.isPoss of { - True => nplite emptyNP ; - False => nplite np } ; - miscAdv = case prep.isPoss of { - True => np.s ! Abs ++ prep.miscAdv ! np.a ; - False => prep.miscAdv ! Sg3 Masc } - } ; + PrepNP = prepNP ; -- Adverbs can be modified by 'adadjectives', just like adjectives. diff --git a/src/somali/CatSom.gf b/src/somali/CatSom.gf index 1afc5038..5c293677 100644 --- a/src/somali/CatSom.gf +++ b/src/somali/CatSom.gf @@ -1,4 +1,4 @@ -concrete CatSom of Cat = CommonX - [Adv] ** open ResSom, Prelude in { +concrete CatSom of Cat = CommonX - [Adv,IAdv] ** open ResSom, Prelude in { flags optimize=all_subs ; @@ -84,11 +84,7 @@ concrete CatSom of Cat = CommonX - [Adv] ** open ResSom, Prelude in { -- Constructed in StructuralSom. Conj = {s2 : State => Str ; s1 : Str ; n : Number } ; Subj = SS ; - Prep = ResSom.Prep ** { - isPoss : Bool ; - c2 : Preposition ; - berri, sii, dhex : Str ; - miscAdv : Agreement => Str } ; + Prep = ResSom.Prep ; @@ -120,7 +116,8 @@ concrete CatSom of Cat = CommonX - [Adv] ** open ResSom, Prelude in { N3 = ResSom.Noun3 ; PN = ResSom.PNoun ; - Adv = ResSom.Adverb ; -- Preposition of an adverbial can merge with obligatory complements of the verb. + Adv, + IAdv = ResSom.Adverb ; -- Preposition of an adverbial can merge with obligatory complements of the verb. linref -- Cl = linCl ; diff --git a/src/somali/GrammarSom.gf b/src/somali/GrammarSom.gf index 1daafc19..1b32f79a 100644 --- a/src/somali/GrammarSom.gf +++ b/src/somali/GrammarSom.gf @@ -9,10 +9,10 @@ concrete GrammarSom of Grammar = RelativeSom, ConjunctionSom, PhraseSom, - TextX - [Adv], + TextX - [Adv,IAdv], StructuralSom, IdiomSom, - TenseX - [Adv] + TenseX - [Adv,IAdv] ** { flags startcat = Phr ; unlexer = text ; lexer = text ; diff --git a/src/somali/PhraseSom.gf b/src/somali/PhraseSom.gf index f8ab38d7..dd1e596c 100644 --- a/src/somali/PhraseSom.gf +++ b/src/somali/PhraseSom.gf @@ -12,11 +12,11 @@ concrete PhraseSom of Phrase = CatSom ** open Prelude, ResSom in { UttImpPl = UttImpSg ; UttImpPol = UttImpSg ; - UttIP ip = { s = ip.s ! Abs} ; - UttIAdv iadv = iadv ; - UttNP np = { s = np.s ! Abs} ; - UttVP vp = { s = infVP vp } ; - UttAdv adv = {s = linAdv adv} ; + UttIP ip = {s = ip.s ! Abs} ; + UttNP np = {s = np.s ! Abs} ; + UttVP vp = {s = infVP vp} ; + UttAdv, + UttIAdv = \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 e367585e..5317fd6d 100644 --- a/src/somali/QuestionSom.gf +++ b/src/somali/QuestionSom.gf @@ -22,7 +22,16 @@ concrete QuestionSom of Question = CatSom ** open --QuestSlash ip cls = ; -- : IAdv -> Cl -> QCl ; -- why does John walk - -- QuestIAdv iadv cl = { } ; + QuestIAdv iadv cls = + let clRaw : ClSlash = insertIAdv iadv cls ; + sbj = clRaw.subj ; + cl : ClSlash = clRaw ** { + stm = \\clt,p => case of { + -- IAdv is focused + <_,Pos> => "baa" ++ sbj.pron ++ sbj.noun; + _ => clRaw.stm ! clt ! p } ; + subj = {noun, pron = [] ; isP3 = True}} + in cl2qcl cl ; -- : IComp -> NP -> QCl ; -- where is John? -- QuestIComp icomp np = ; @@ -47,21 +56,21 @@ concrete QuestionSom of Question = CatSom ** open -- Interrogative adverbs can be formed prepositionally. -- : Prep -> IP -> IAdv ; -- with whom - PrepIP prep ip = let a = AS.PrepNP prep ip in a ** {s = a.berri} ; + PrepIP = AS.PrepNP ; -- They can be modified with other adverbs. -- : IAdv -> Adv -> IAdv ; -- where in Paris - AdvIAdv iadv adv = iadv ** {s = iadv.s ++ adv.berri} ; + -- AdvIAdv iadv adv = iadv ** {s = iadv.s ++ adv.berri} ; -- TODO do we need PrepCombination in IAdv? -- Interrogative complements to copulas can be both adverbs and -- pronouns. -- : IAdv -> IComp ; - CompIAdv iadv = iadv ; -- where (is it) + --CompIAdv iadv = iadv ; -- where (is it) -- : IP -> IComp ; - CompIP ip = { s = ip.s ! Abs } ; -- who (is it) + --CompIP ip = { s = ip.s ! Abs } ; -- who (is it) {- -- More $IP$, $IDet$, and $IAdv$ are defined in $Structural$. diff --git a/src/somali/ResSom.gf b/src/somali/ResSom.gf index 6e96e5a1..20a3e422 100644 --- a/src/somali/ResSom.gf +++ b/src/somali/ResSom.gf @@ -170,6 +170,8 @@ oper impersNP : NounPhrase = pronTable ! Impers ; + indeclNP : Str -> NounPhrase = \s -> emptyNP ** {s = \\c => s} ; + -------------------------------------------------------------------------------- -- Pronouns @@ -182,11 +184,11 @@ oper sp : Case => Str ; } ; - {- Saeed p.115: "This combination of possessive and article [kay-ga, tay-da] + {- Saeed p.115: "This combination of possessive and article [kay-ga, tay-da] is the basic form but possessives occur with the full range of determiners, with associated meanings, for example: - remote article kii/tii: gurigaagii 'your house (remote)' - demonstrative kaas/taas: gurigaagaas 'that house of yours' + remote article kii/tii: gurigaagii 'your house (remote)' + demonstrative kaas/taas: gurigaagaas 'that house of yours' interrogative kee/tee: gurigaagee? 'which house of yours?'" Since RGL abstract syntax doesn't allow combining two Quants, the way to go is @@ -327,7 +329,7 @@ oper } ; defIQuant : Str -> Quant = \ee -> - let quantRaw = defQuant ee ("k"+ee) ("t"+ee) ("kuw"+ee) False + let quantRaw = defQuant ee ("k"+ee) ("t"+ee) ("kuw"+ee) False in quantRaw ** { s = \\da,c => quantRaw.s ! da ! Abs ; sp = \\gn,c => quantRaw.sp ! gn ! Abs } ; @@ -344,9 +346,14 @@ oper -------------------------------------------------------------------------------- -- Prepositions - Prep : Type = {s : PrepAgr => Str} ; + Prep : Type = { + s : PrepAgr => Str ; + c2 : Preposition ; + isPoss : Bool ; + berri, sii, dhex : Str ; + miscAdv : Agreement => Str } ; - mkPrep : (x1,_,_,_,_,x6 : Str) -> Prep = \ku,ii,kuu,noo,idiin,isku -> { + mkPrep : (x1,_,_,_,_,x6 : Str) -> {s : PrepAgr => Str} = \ku,ii,kuu,noo,idiin,isku -> { s = table { P3_Prep => ku ; Sg1_Prep => ii ; @@ -357,9 +364,10 @@ oper Reflexive_Prep => isku } } ; - prep : Preposition -> (Prep ** {c2 : Preposition}) = \p -> prepTable ! p ** {c2 = p} ; + prep : Preposition -> {s : PrepAgr => Str ; c2 : Preposition} = \p -> + prepTable ! p ** {c2 = p} ; - prepTable : Preposition => Prep = table { + prepTable : Preposition => {s : PrepAgr => Str} = table { Ku => mkPrep "ku" "igu" "kugu" "nagu" "idinku" "isku" ; Ka => mkPrep "ka" "iga" "kaa" "naga" "idinka" "iska" ; La => mkPrep "la" "ila" "kula" "nala" "idinla" "isla" ; @@ -557,7 +565,7 @@ oper VNegPast Progressive => progr + "n" ; -- TODO check conjugations 2 and 3 - VNegCond PlInv => arag + n + "een" ; + VNegCond PlInv => arag + n + "een" ; VNegCond SgMasc => qaat + "een" ; -- for most verbs same as VPast Simple Pl3_ VNegCond SgFem => arag + t + "een" ; -- for most verbs same as VPast Simple Pl2_ @@ -636,11 +644,11 @@ oper VPast _ Pl2_ => "ahaydeen" ; VPast _ Pl3_ => "ahaayeen" ; VNegPast _ => "ahi" ; - VNegCond SgMasc => "ahaadeen" ; -- 1SG/3 SG M/3PL - VNegCond SgFem => "ahaateen" ; -- 2SG/3 SG F/2PL + VNegCond SgMasc => "ahaadeen" ; -- 1SG/3 SG M/3PL + VNegCond SgFem => "ahaateen" ; -- 2SG/3 SG F/2PL VNegCond PlInv => "ahaanneen" ; -- 1PL VRel _ => "ah" ; -- All persons: see Nilsson p. 78. TODO check Saeed p. 103 - VRelNeg => "ahayni" ; -- Saeed + VRelNeg => "ahayni" ; -- Saeed VInf => "ahaan" ; VImp Sg pol => if_then_Pol pol "ahaw" "ahaanin" ; VImp Pl pol => if_then_Pol pol "ahaada" "ahaanina" ; @@ -675,7 +683,7 @@ oper } ; ------------------ --- VP +-- Adv BaseAdv : Type = { sii, -- sii, soo, wala, kada go inside VP. @@ -689,6 +697,18 @@ oper np : NPLite ; -- NP from PrepNP can be promoted into a core argument. } ; + prepNP : Prep -> NounPhrase -> Adverb = \prep,np -> prep ** { + np = case prep.isPoss of { + True => nplite emptyNP ; + False => nplite np } ; + miscAdv = case prep.isPoss of { + True => np.s ! Abs ++ prep.miscAdv ! np.a ; + False => prep.miscAdv ! Sg3 Masc } + } ; + +------------------ +-- VP + Complement : Type = { comp : Agreement => {p1,p2 : Str} ; -- Agreement for AP complements stm : STM ; -- to choose right sentence type marker @@ -708,7 +728,7 @@ oper useV : Verb -> VerbPhrase = \v -> v ** { comp = \\_ => <[],[]> ; stm = case v.isCopula of { -- can change into Waxa in ComplVV - True => Waa Copula ; + True => Waa Copula ; False => Waa NoPred } ; vComp = {subjunc, inf = [] ; @@ -754,9 +774,21 @@ oper } ; insertComp : VPSlash -> NounPhrase -> VerbPhrase = \vp,np -> - insertCompLite vp (nplite np) ; + vp ** insertCompLite vp (nplite np) ; - insertCompLite : VPSlash -> NPLite -> VerbPhrase = \vp,nplite -> + insertAdv : VerbPhrase -> Adverb -> VerbPhrase = \vp,adv -> + vp ** insertAdvLite vp adv ; + + insertIAdv : Adverb -> ClSlash -> ClSlash = \adv,cls -> + cls ** insertAdvLite cls adv ; + + -- To generalise insertAdv and insertComp + VPLite : Type = { + c2 : PrepCombination ; + obj2 : NPLite ; + sii,dhex,berri,miscAdv,secObj : Str} ; + + insertCompLite : VPLite -> NPLite -> VPLite = \vp,nplite -> case vp.obj2.a of { -- If the old object is 3rd person (or nonexistent), we replace its agreement. -- We keep both old and new string (=noun, if there was one) in obj2.s. @@ -772,10 +804,9 @@ oper s = vp.obj2.s ++ nplite.s } ; secObj = vp.secObj ++ secondObject ! nplite.a} - } ; - insertAdv : VerbPhrase -> Adverb -> VerbPhrase = \vp,adv -> + insertAdvLite : VPLite -> Adverb -> VPLite = \vp,adv -> case adv.c2 of { NoPrep => vp ** adv'' ; -- the adverb is not formed with PrepNP, e.g. "tomorrow" _ => case vp.c2 of { @@ -801,7 +832,7 @@ oper {- After PredVP, we might still want to add more adverbs (QuestIAdv), - but we're done with verb inflection. + but we're done with verb inflection. -} ClSlash : Type = BaseAdv ** { -- Fixed in Cl @@ -826,7 +857,7 @@ oper predVP : NounPhrase -> VerbPhrase -> ClSlash = \np,vps -> vp ** { subj = {noun = subjnoun ; pron = subjpron ; isP3 = isP3 subj.a} ; - pred = \\cltyp,t,a,p => + 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 @@ -838,7 +869,7 @@ oper _ => predRaw -- Any other verb } ; - stm = \\cltyp,pol => + stm = \\cltyp,pol => case of { => showSTM vp.stm ; => "ma" ; @@ -856,7 +887,7 @@ oper True => insertComp vps np ; _ => vps } ; subj : NounPhrase = case isPassive vps of { - True => impersNP ; + True => impersNP ; _ => np } ; subjnoun : Str = case np.isPron of { True => np.empty ; @@ -878,7 +909,7 @@ oper -- RelVP: subject pronoun is never included - cl2rcl : ClSlash -> Clause = + cl2rcl : ClSlash -> Clause = let hasSubjPron : Bool = False ; hasSTM : Bool = False ; isRel : Bool = True ; @@ -922,7 +953,7 @@ oper mkClause : ClType -> (rel,sp,stm : Bool) -> ClSlash -> Clause = \cltyp,isRel,hasSubjPron,hasSTM,incomplCl -> { - s = \\t,a,p => + s = \\t,a,p => let -- Put all arguments in their right place cl : ClSlash = complCl incomplCl ; @@ -954,14 +985,14 @@ oper stm : Str = case of { => cl.stm ! cltyp ! p ; <_,Neg> => cl.stm ! cltyp ! p ; -- negation overrides hasSTM=False - _ => [] } + _ => [] } in cl.berri -- AdV ++ cl.subj.noun -- subject if it's a noun ++ statementNounObj -- noun object if it's a statement ++ stm - ++ cl.vComp.subjunc -- "waa in" construction / + ++ cl.vComp.subjunc -- "waa in" construction / ++ subjpron -- subject pronoun ++ subordNounObj -- noun object if it's subordinate clause: "timir aan /laf/ lahayn" (Saeed p. 210-211) @@ -1050,7 +1081,7 @@ oper ++ adv.sii ++ (prepTable ! adv.c2).s ! adv.np.a ++ adv.dhex - ++ adv.np.s + ++ adv.np.s ++ adv.miscAdv ; @@ -1082,5 +1113,5 @@ oper ++ pred -- the verb inflected ++ vp.vComp.subcl ! Sg3 Masc -- VV complement, if it's subordinate clause ++ vp.miscAdv ; ---- NB. Only used if there are several adverbs, or for "waa in" construction. - + } diff --git a/src/somali/StructuralSom.gf b/src/somali/StructuralSom.gf index fe7c624c..6d779b2a 100644 --- a/src/somali/StructuralSom.gf +++ b/src/somali/StructuralSom.gf @@ -15,8 +15,9 @@ lin very_AdA = mkAdA "" ; lin as_CAdv = { s = "" ; p = [] } ; lin less_CAdv = { s = "" ; p = [] } ; lin more_CAdv = { s = "" ; p = [] } ; - -lin how_IAdv = ss "" ; +-} +lin how_IAdv = prepNP (mkPrep (mkPrep u) "sidee" [] []) emptyNP ; +{- lin how8much_IAdv = ss "" ; lin when_IAdv = ss "" ; lin where_IAdv = ss "" ; @@ -127,7 +128,7 @@ lin on_Prep = mkPrep ku ; -- lin possess_Prep = mkPrep ; -- lin through_Prep = mkPrep ; -- lin to_Prep = mkPrep ; -lin under_Prep = +lin under_Prep = let hoos : CatSom.Prep = possPrep (nUl "hoos") in hoos ** {c2 = Ku} ; lin with_Prep = mkPrep la ; From 1c367530f0dbe281d5693f5e7f427ec90bbf038b Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 10 Sep 2019 15:12:54 +0200 Subject: [PATCH 2/6] (Som) Lincats for V2* + SlashV2A + new unittest for V2A and QuestIAdv --- src/somali/CatSom.gf | 12 ++++++------ src/somali/LexiconSom.gf | 2 +- src/somali/VerbSom.gf | 11 ++++++----- src/somali/unittest/cl.gftest | 4 ++++ 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/somali/CatSom.gf b/src/somali/CatSom.gf index 5c293677..4a87768a 100644 --- a/src/somali/CatSom.gf +++ b/src/somali/CatSom.gf @@ -93,18 +93,18 @@ concrete CatSom of Cat = CommonX - [Adv,IAdv] ** open ResSom, Prelude in { -- These are constructed in LexiconSom and in -- additional lexicon modules. - V, VS, -- sentence-complement verb e.g. "claim" -- TODO: eventually different lincats VQ, -- question-complement verb e.g. "wonder" VA, -- adjective-complement verb e.g. "look" - V2V, -- verb with NP and V complement e.g. "cause" - V2S, -- verb with NP and S complement e.g. "tell" - V2Q, -- verb with NP and Q complement e.g. "ask" - V2A = ResSom.Verb ; -- verb with NP and AP complement e.g. "paint" + V = ResSom.Verb ; VV = ResSom.VV ; -- verb-phrase-complement verb e.g. "want" + V2A, -- verb with NP and AP complement e.g. "paint" + V2V, -- verb with NP and V complement e.g. "cause" + V2S, -- verb with NP and S complement e.g. "tell" + V2Q, -- verb with NP and Q complement e.g. "ask" V2 = ResSom.Verb2 ; V3 = ResSom.Verb3 ; @@ -123,5 +123,5 @@ linref -- Cl = linCl ; VP = infVP ; CN = linCN ; - Prep = \prep -> prep.s ! P3_Prep ++ prep.sii ++ prep.dhex ++ prep.miscAdv ! Sg3 Masc ; + Prep = \prep -> prep.s ! P3_Prep ++ prep.sii ++ prep.dhex ++ prep.hoostiisa ! Sg3 Masc ; } diff --git a/src/somali/LexiconSom.gf b/src/somali/LexiconSom.gf index 353b6977..8e3bf343 100644 --- a/src/somali/LexiconSom.gf +++ b/src/somali/LexiconSom.gf @@ -253,7 +253,7 @@ lin name_N = mkN "magac" ; -- lin oil_N = mkN "" ; -- lin old_A = mkA "" ; -- lin open_V2 = mkV2 "" ; --- lin paint_V2A = mkV2 "" ; +lin paint_V2A = mkV2 "rinjiyee" ; -- lin paper_N = mkN "" ; -- lin paris_PN = mkPN "Paris" ; -- lin peace_N = mkN "" ; diff --git a/src/somali/VerbSom.gf b/src/somali/VerbSom.gf index 27e87b27..6ccc5cbf 100644 --- a/src/somali/VerbSom.gf +++ b/src/somali/VerbSom.gf @@ -75,12 +75,13 @@ lin -- : V2Q -> QS -> VPSlash ; -- ask (him) who came SlashV2Q v2q qs = ; - - -- : V2A -> AP -> VPSlash ; -- paint (it) red - SlashV2A v2a ap = slashDObj v2a ** - { comp = (CompAP ap).s } ; - -} + -- : V2A -> AP -> VPSlash ; -- paint (it) red + -- TODO: is "red" plural in "paint them red"? + SlashV2A v2a ap = useVc v2a ** { + comp = \\_ => (CompAP ap).comp ! Sg3 Masc + } ; + -- : VPSlash -> NP -> VP ComplSlash = insertComp ; diff --git a/src/somali/unittest/cl.gftest b/src/somali/unittest/cl.gftest index 597aa4c7..0e294d26 100644 --- a/src/somali/unittest/cl.gftest +++ b/src/somali/unittest/cl.gftest @@ -85,3 +85,7 @@ Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (RelNP (UseP -- 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 + +-- 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 d01aec2d649e65d2125721b1ba02dd51afb25671 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 10 Sep 2019 15:11:41 +0200 Subject: [PATCH 3/6] (Som) bugfix in QuestIAdv: add subject also when STM is negative --- src/somali/QuestionSom.gf | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/somali/QuestionSom.gf b/src/somali/QuestionSom.gf index 5317fd6d..048b8316 100644 --- a/src/somali/QuestionSom.gf +++ b/src/somali/QuestionSom.gf @@ -27,10 +27,12 @@ concrete QuestionSom of Question = CatSom ** open sbj = clRaw.subj ; cl : ClSlash = clRaw ** { stm = \\clt,p => case of { - -- IAdv is focused + -- IAdv is focused with baa, and subject comes after <_,Pos> => "baa" ++ sbj.pron ++ sbj.noun; - _ => clRaw.stm ! clt ! p } ; - subj = {noun, pron = [] ; isP3 = True}} + -- TODO how do negative questions work + _ => clRaw.stm ! Question ! p ++ sbj.pron ++ sbj.noun } ; + subj = sbj ** {noun, pron = []} -- to force subject after baa + } ; in cl2qcl cl ; -- : IComp -> NP -> QCl ; -- where is John? From 1ceb12d8b838ed2a2e2abf3e10e634217a796318 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 10 Sep 2019 15:04:50 +0200 Subject: [PATCH 4/6] (Som) Change word order in VP complements, update test accordingly --- src/somali/ResSom.gf | 4 ++-- src/somali/unittest/vp.gftest | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/somali/ResSom.gf b/src/somali/ResSom.gf index 20a3e422..5a557182 100644 --- a/src/somali/ResSom.gf +++ b/src/somali/ResSom.gf @@ -794,14 +794,14 @@ oper -- We keep both old and new string (=noun, if there was one) in obj2.s. P3_Prep => vp ** {obj2 = nplite ** { - s = vp.obj2.s ++ nplite.s} + s = nplite.s ++ vp.obj2.s} } ; -- no secObj, because there's ≤1 non-3rd-person pronoun. -- If old object was non-3rd person, we keep its agreement. -- The new object is put in the secondObject field. _ => vp ** {obj2 = vp.obj2 ** { - s = vp.obj2.s ++ nplite.s + s = nplite.s ++ vp.obj2.s } ; secObj = vp.secObj ++ secondObject ! nplite.a} } ; diff --git a/src/somali/unittest/vp.gftest b/src/somali/unittest/vp.gftest index 4a29b672..58cd6f9b 100644 --- a/src/somali/unittest/vp.gftest +++ b/src/somali/unittest/vp.gftest @@ -56,11 +56,11 @@ LangSom: rooti waa uu is siiyey Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPast ASimul) PPos (PredVP (UsePron he_Pron) (ReflVP (Slash2V3 give_V3 (MassNP (UseN bread_N))))))) NoVoc -- LangEng: one adds salt to the meat -LangSom: hilib BIND ka cusbo waa lagu daraa +LangSom: cusbo hilib BIND ka waa lagu daraa Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (GenericCl (ComplSlash (Slash3V3 add_V3 (DetCN (DetQuant DefArt NumSg) (UseN meat_N))) (MassNP (UseN salt_N)))))) NoVoc -- LangEng: one can add salt to meat -LangSom: hilib cusbo waa lagu dari karaa +LangSom: cusbo hilib waa lagu dari karaa Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (GenericCl (ComplVV can_VV (ComplSlash (Slash3V3 add_V3 (MassNP (UseN meat_N))) (MassNP (UseN salt_N))))))) NoVoc -------------------------------------------------------------------------------- @@ -116,4 +116,3 @@ Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_P -- LangEng: my mother lives under the sea LangSom: hooya BIND day waa ku nool tahay bad BIND da hoos BIND teed BIND a Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant (PossPron i_Pron) NumSg) (UseN2 mother_N2)) (AdvVP (UseV live_V) (PrepNP under_Prep (DetCN (DetQuant DefArt NumSg) (UseN sea_N))))))) NoVoc - From 4f9927d12be407f70873157b1fdabef87e953bc0 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 10 Sep 2019 15:03:59 +0200 Subject: [PATCH 5/6] (Som) minor cleanup/renaming --- src/somali/ParadigmsSom.gf | 4 ++-- src/somali/ResSom.gf | 6 +++--- src/somali/VerbSom.gf | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/somali/ParadigmsSom.gf b/src/somali/ParadigmsSom.gf index 42cefc86..68ae5047 100644 --- a/src/somali/ParadigmsSom.gf +++ b/src/somali/ParadigmsSom.gf @@ -247,7 +247,7 @@ oper } ; possPrep : N -> CatSom.Prep = \dhex -> emptyPrep ** { - miscAdv = \\agr => + hoostiisa = \\agr => let qnt = PossPron (pronTable ! agr) ; num = getNum agr ; art = gda2da dhex.gda ! Sg ; @@ -258,7 +258,7 @@ oper emptyPrep : CatSom.Prep = lin Prep { sii,berri,dhex = [] ; - miscAdv = \\_ => [] ; + hoostiisa = \\_ => [] ; s = \\_ => [] ; c2 = noPrep ; isPoss = False diff --git a/src/somali/ResSom.gf b/src/somali/ResSom.gf index 5a557182..bf1c1f51 100644 --- a/src/somali/ResSom.gf +++ b/src/somali/ResSom.gf @@ -351,7 +351,7 @@ oper c2 : Preposition ; isPoss : Bool ; berri, sii, dhex : Str ; - miscAdv : Agreement => Str } ; + hoostiisa : Agreement => Str } ; mkPrep : (x1,_,_,_,_,x6 : Str) -> {s : PrepAgr => Str} = \ku,ii,kuu,noo,idiin,isku -> { s = table { @@ -702,8 +702,8 @@ oper True => nplite emptyNP ; False => nplite np } ; miscAdv = case prep.isPoss of { - True => np.s ! Abs ++ prep.miscAdv ! np.a ; - False => prep.miscAdv ! Sg3 Masc } + True => np.s ! Abs ++ prep.hoostiisa ! np.a ; + False => prep.hoostiisa ! Sg3 Masc } } ; ------------------ diff --git a/src/somali/VerbSom.gf b/src/somali/VerbSom.gf index 6ccc5cbf..3208febc 100644 --- a/src/somali/VerbSom.gf +++ b/src/somali/VerbSom.gf @@ -18,14 +18,14 @@ lin ComplVV vv vp = let vc = vp.vComp in case vv.vvtype of { Waa_In => vp ** { 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 } ; Subjunctive => useV vv ** { stm = Waxa ; vComp = vc ** { -- The whole previous VP becomes the subordinate clause - subcl = \\agr => + subcl = \\agr => let subj = pronTable ! agr ; cls = predVPslash subj vp ; scl = cl2sentence True cls ; @@ -39,11 +39,11 @@ lin inf = vc.inf ++ vp.s ! VInf } ; stm = Waa NoPred ; - } + } } ; -- : VS -> S -> VP ; - ComplVS vs s = + ComplVS vs s = let vps = useV vs ; subord = SubjS {s="in"} s ; in vps ** {obj2 = {s = subord.berri ; a = P3_Prep}} ; From 67ac5ae5e3ffb06db931546889aa0c8a6fa2646e Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 10 Sep 2019 16:54:19 +0200 Subject: [PATCH 6/6] (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