From b8a7b4f0bd05df24ed1c4af3faed552f6f64b683 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sun, 28 Jul 2019 12:55:16 +0300 Subject: [PATCH] (Som) WIP relative clauses. Add short relative forms in VForm, split Cl(Slash) etc. even further, to make it possible to not add sentence type marker in RelVP. --- src/somali/AdverbSom.gf | 2 +- src/somali/CatSom.gf | 6 +++--- src/somali/NounSom.gf | 5 +++-- src/somali/ParamSom.gf | 7 ++++++- src/somali/PhraseSom.gf | 4 ++-- src/somali/RelativeSom.gf | 11 +++++++++-- src/somali/ResSom.gf | 29 ++++++++++++++++++----------- src/somali/SentenceSom.gf | 2 +- 8 files changed, 43 insertions(+), 23 deletions(-) diff --git a/src/somali/AdverbSom.gf b/src/somali/AdverbSom.gf index 28eda66e..689e5808 100644 --- a/src/somali/AdverbSom.gf +++ b/src/somali/AdverbSom.gf @@ -25,7 +25,7 @@ lin -- : Subj -> S -> Adv ; SubjS subj s = let subs = s.s ! True in - mkAdv (subs.beforeSTM ++ subj.s ++ subs.afterSTM) ; + mkAdv (subs.beforeSTM ++ subj.s ++ subs.stm ++ subs.afterSTM) ; -- Comparison adverbs also work as numeral adverbs. diff --git a/src/somali/CatSom.gf b/src/somali/CatSom.gf index 1b6f06df..62c671c0 100644 --- a/src/somali/CatSom.gf +++ b/src/somali/CatSom.gf @@ -9,7 +9,7 @@ concrete CatSom of Cat = CommonX - [Adv] ** open ResSom, Prelude in { S = ResSom.Sentence ; QS = SS ; - RS = {s : {-Agreement =>-} Str} ; -- TODO + RS = {s : Gender => Case => Str} ; -- relative sentence. Tense and polarity fixed, -- but agreement may depend on the CN/NP it modifies. @@ -30,7 +30,7 @@ concrete CatSom of Cat = CommonX - [Adv] ** open ResSom, Prelude in { --2 Subord clauses and pronouns - RCl = ResSom.QClause ; + RCl = ResSom.RClause ; RP = SS ; --2 Verb phrases @@ -119,7 +119,7 @@ concrete CatSom of Cat = CommonX - [Adv] ** open ResSom, Prelude in { linref -- Cl = linCl ; - VP = linVP ; + VP = linVP VInf ; CN = linCN ; Prep = \prep -> prep.s ! P3_Prep ++ prep.sii ++ prep.dhex ; } diff --git a/src/somali/NounSom.gf b/src/somali/NounSom.gf index 6b634ffa..df94864c 100644 --- a/src/somali/NounSom.gf +++ b/src/somali/NounSom.gf @@ -70,7 +70,7 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in { -- : NP -> RS -> NP ; -- Paris, which is here RelNP np rs = np ** { - s = \\c => np.s ! c ++ rs.s + s = \\c => np.s ! c ++ rs.s ! npgender np ! c } ; -- Determiners can form noun phrases directly. @@ -230,7 +230,8 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in { -- : CN -> RS -> CN ; RelCN cn rs = cn ** { - mod = \\n,c => cn.mod ! n ! c ++ rs.s + mod = \\n,c => cn.mod ! n ! c ++ rs.s ! gender cn ! c ; + hasMod = True ; } ; {- diff --git a/src/somali/ParamSom.gf b/src/somali/ParamSom.gf index f1d38093..13f0918b 100644 --- a/src/somali/ParamSom.gf +++ b/src/somali/ParamSom.gf @@ -171,8 +171,12 @@ oper case agr of {P3_Prep => True ; _ => False} ; } ; + gender : {gda : GenderDefArt} -> Gender = \n -> case n.gda of {FM _ _ => Fem ; _ => Masc} ; + npgender : {a : Agreement} -> Gender = \n -> + case n.a of {Sg3 Fem => Fem ; _ => Masc} ; + -------------------------------------------------------------------------------- -- Numerals @@ -253,7 +257,8 @@ param | VPres Aspect VAgr Polarity | VNegPast Aspect | VPast Aspect VAgr - | VRel -- "som är/har/…" TODO is this used in other verbs? +-- | VRelShort -- "som är/har/…" TODO is this used in other verbs? + | VRel Gender -- Reduced present general in relative clauses | VImp Number Polarity ; VAgr = diff --git a/src/somali/PhraseSom.gf b/src/somali/PhraseSom.gf index 6d1b6983..5300d63a 100644 --- a/src/somali/PhraseSom.gf +++ b/src/somali/PhraseSom.gf @@ -3,7 +3,7 @@ concrete PhraseSom of Phrase = CatSom ** open Prelude, ResSom in { lin PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ; - UttS s = let basecl = s.s ! False in {s = basecl.beforeSTM ++ basecl.afterSTM} ; + UttS s = let basecl = s.s ! False in {s = linBaseCl basecl} ; UttQS qs = qs ; UttImpSg pol imp = @@ -15,7 +15,7 @@ concrete PhraseSom of Phrase = CatSom ** open Prelude, ResSom in { UttIP ip = { s = ip.s ! Abs} ; UttIAdv iadv = iadv ; UttNP np = { s = np.s ! Abs} ; - UttVP vp = { s = linVP vp } ; + UttVP vp = { s = infVP vp } ; UttAdv adv = {s = linAdv adv} ; UttCN n = {s = linCN n } ; UttCard n = {s = n.s ! Mid} ; diff --git a/src/somali/RelativeSom.gf b/src/somali/RelativeSom.gf index 99c9f13a..ea5fc0e9 100644 --- a/src/somali/RelativeSom.gf +++ b/src/somali/RelativeSom.gf @@ -19,12 +19,19 @@ Reduced present general in relative clauses; as absolutive books-the men-the bring 'the books which the men bring' -} -- : RP -> VP -> RCl ; - RelVP rp vp = RelSlash rp (predVPSlash emptyNP vp) ; + RelVP rp vp = {s = \\g,c,t,a,p => + let cls = predVPSlash impersNP vp ; + rcl = mergeSTM (cls.s ! False) ; -- Other than present tense, just use normal verb forms + in rp.s ++ case of { + => linVP (VRel Fem) vp ; + => linVP (VRel Masc) vp ; + _ => rcl.s ! t ! a ! p } + } ; -- : RP -> ClSlash -> RCl ; -- whom John loves RelSlash rp cls = let rcl = mergeSTM (cls.s ! True) - in rcl ** {s = \\t,a,p => rp.s ++ rcl.s ! t ! a ! p} ; + in rcl ** {s = \\g,c,t,a,p => rp.s ++ rcl.s ! t ! a ! p} ; -- : RP ; diff --git a/src/somali/ResSom.gf b/src/somali/ResSom.gf index ef9eaa9d..9239248f 100644 --- a/src/somali/ResSom.gf +++ b/src/somali/ResSom.gf @@ -540,7 +540,9 @@ oper VImp Pl Neg => qaat + "ina" ; VInf => arki ; - VRel => arki } ; -- TODO does this exist? +-- VRelShort => arki ; -- TODO does this exist? + VRel Masc => qaat + "a" ; + VRel Fem => arag + t + "a" } ; sii, dhex = [] ; } ; @@ -603,7 +605,8 @@ oper VPast _ Pl2_ => "ahaydeen" ; VPast _ Pl3_ => "ahaayeen" ; VNegPast _ => "ahi" ; - VRel => "ah" ; + --VRelShort => "ah" ; + VRel _ => "ah" ; -- TODO find right forms VInf => "ahaan" ; VImp Sg pol => if_then_Pol pol "ahaw" "ahaanin" ; VImp Pl pol => if_then_Pol pol "ahaada" "ahaanina" ; @@ -621,7 +624,8 @@ oper VPres _ Pl2_ Pos => "leedihiin" ; VPres _ Pl3_ Pos => "leeyihiin" ; VPast asp agr => "l" + copula.s ! VPast asp agr ; - VRel => "leh" ; +-- VRelShort => "leh" ; + VRel _ => "leh" ; -- TODO find right forms x => hold_V.s ! x } } ; @@ -749,10 +753,11 @@ oper } ; -------------------------------------------------------------------------------- -- Sentences etc. - BaseCl : Type = {beforeSTM, 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} ; ClSlash : Type = {s : Bool {-is subordinate-} => Tense => Anteriority => Polarity => BaseCl} ; Sentence : Type = {s : Bool {-is subordinate-} => BaseCl} ; + RClause : Type = {s : Gender => Case => Tense => Anteriority => Polarity => Str} ; QClause : Type = {s : Tense => Anteriority => Polarity => Str} ; mergeSTM : (Tense => Anteriority => Polarity => BaseCl) -> QClause = \b -> @@ -803,8 +808,8 @@ oper beforeSTM = vp.berri -- AdV ++ subjnoun -- subject if it's a noun ++ obj.p1 ; -- object if it's a noun - afterSTM = stm -- sentence type marker + possible subj. pronoun - ++ obj.p2 -- object if it's a pronoun + stm = stm ; -- sentence type marker + possible subj. pronoun + afterSTM = obj.p2 -- object if it's a pronoun ++ vp.sii -- restricted set of particles ++ vp.dhex -- restricted set of nouns/adverbials ++ vp.secObj -- "second object" @@ -846,10 +851,7 @@ oper _ => vfStatement t ant p agr vp } ; -- TODO other relative forms - infVP : VerbPhrase -> Str = \vp -> - let inf = {inf = vp.s ! VInf ; fin=[]} ; - wo = wordOrder [] [] [] (vp.comp ! Pl3) inf vp ; - in wo.beforeSTM ++ wo.afterSTM ; + infVP : VerbPhrase -> Str = linVP VInf ; stmarkerContr : Agreement => Polarity => Str = \\a,b => let stm = if_then_Pol b "w" "m" @@ -872,7 +874,11 @@ oper -- linrefs oper - linVP : VerbPhrase -> Str = infVP ; + linVP : VForm -> VerbPhrase -> Str = \vf,vp -> + let inf = {inf = vp.s ! vf ; fin=[]} ; + wo = wordOrder [] [] [] (vp.comp ! Pl3) inf vp ; + in wo.beforeSTM ++ wo.afterSTM ; + linCN : CNoun -> Str = \cn -> cn.s ! NomSg ++ cn.mod ! Sg ! Abs ; linAdv : Adverb -> Str = \adv -> adv.berri @@ -880,5 +886,6 @@ oper ++ (prepTable ! adv.c2).s ! adv.np.a ++ adv.dhex ++ adv.np.s ; + linBaseCl : BaseCl -> Str = \b -> b.beforeSTM ++ b.stm ++ b.afterSTM ; } diff --git a/src/somali/SentenceSom.gf b/src/somali/SentenceSom.gf index adfbafa9..e0ef4c1e 100644 --- a/src/somali/SentenceSom.gf +++ b/src/somali/SentenceSom.gf @@ -59,7 +59,7 @@ lin UseQCl t p cl = {s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p} ; -- : Temp -> Pol -> RCl -> RS ; - UseRCl t p cl = {s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p} ; + UseRCl t p cl = {s = \\g,c => t.s ++ p.s ++ cl.s ! g ! c ! t.t ! t.a ! p.p} ; -- AdvS : Adv -> S -> S ; -- then I will go home -- ExtAdvS : Adv -> S -> S ; -- next week, I will go home