From 99e7e61863121b09e191cec95b75bcd58b4ce132 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 26 Jul 2019 22:20:00 +0300 Subject: [PATCH] (Som) Make Cl, S etc. discontinuous, to add Subj to the right place --- src/somali/AdverbSom.gf | 3 ++- src/somali/PhraseSom.gf | 2 +- src/somali/QuestionSom.gf | 2 +- src/somali/RelativeSom.gf | 6 +++--- src/somali/ResSom.gf | 33 ++++++++++++++++++++------------- src/somali/SentenceSom.gf | 11 ++++++----- 6 files changed, 33 insertions(+), 24 deletions(-) diff --git a/src/somali/AdverbSom.gf b/src/somali/AdverbSom.gf index f57e900d1..28eda66ec 100644 --- a/src/somali/AdverbSom.gf +++ b/src/somali/AdverbSom.gf @@ -24,7 +24,8 @@ lin -- Subordinate clauses can function as adverbs. -- : Subj -> S -> Adv ; - SubjS subj s = mkAdv (subj.s ++ s.s ! True) ; + SubjS subj s = let subs = s.s ! True in + mkAdv (subs.beforeSTM ++ subj.s ++ subs.afterSTM) ; -- Comparison adverbs also work as numeral adverbs. diff --git a/src/somali/PhraseSom.gf b/src/somali/PhraseSom.gf index 8644c3bad..6d1b6983b 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 = {s = s.s ! False} ; + UttS s = let basecl = s.s ! False in {s = basecl.beforeSTM ++ basecl.afterSTM} ; UttQS qs = qs ; UttImpSg pol imp = diff --git a/src/somali/QuestionSom.gf b/src/somali/QuestionSom.gf index 768da0d09..0bacd6456 100644 --- a/src/somali/QuestionSom.gf +++ b/src/somali/QuestionSom.gf @@ -6,7 +6,7 @@ concrete QuestionSom of Question = CatSom ** open lin -- : Cl -> QCl ; - QuestCl cl = {s = cl.s ! Question} ; + QuestCl cl = mergeSTM (cl.s ! Question) ; -- : IP -> VP -> QCl ; -- QuestVP ip vp = ; diff --git a/src/somali/RelativeSom.gf b/src/somali/RelativeSom.gf index 41d7db84b..e0cfecf75 100644 --- a/src/somali/RelativeSom.gf +++ b/src/somali/RelativeSom.gf @@ -22,9 +22,9 @@ books-the men-the bring 'the books which the men bring' RelVP rp vp = RelSlash rp (predVPSlash emptyNP vp) ; -- : RP -> ClSlash -> RCl ; -- whom John loves - RelSlash rp cls = { - s = \\t,a,p => rp.s ++ cls.s ! True ! t ! a ! p - } ; + RelSlash rp cls = + let rcl = mergeSTM (cls.s ! True) + in rcl ** {s = \\t,a,p => rp.s ++ rcl.s ! t ! a ! p} ; -- : RP ; diff --git a/src/somali/ResSom.gf b/src/somali/ResSom.gf index 442a574c3..ef9eaa9de 100644 --- a/src/somali/ResSom.gf +++ b/src/somali/ResSom.gf @@ -749,10 +749,14 @@ oper } ; -------------------------------------------------------------------------------- -- Sentences etc. - Clause : Type = {s : ClType => Tense => Anteriority => Polarity => Str} ; + BaseCl : Type = {beforeSTM, 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} ; QClause : Type = {s : Tense => Anteriority => Polarity => Str} ; - ClSlash : Type = {s : Bool {-is subordinate-} => Tense => Anteriority => Polarity => Str} ; - Sentence : Type = {s : Bool {-is subordinate-} => Str} ; + + mergeSTM : (Tense => Anteriority => Polarity => BaseCl) -> QClause = \b -> + {s = \\t,a,p => (b ! t ! a ! p).beforeSTM ++ (b ! t ! a ! p).afterSTM} ; predVPSlash : NounPhrase -> VPSlash -> ClSlash = \np,vps -> let cl = predVP np vps in {s = table { @@ -775,9 +779,10 @@ oper bind : Str = case of { => [] ; _ => BIND } ; - in case p of { - Pos => o ; - Neg => {p2 = [] ; p1 = o.p1 ++ o.p2 ++ bind} -- object pronoun, prepositions and negation all contract + in case of { + => {p2 = [] ; p1 = o.p1 ++ o.p2 ++ bind} ; + _ => o + -- object pronoun, prepositions and negation all contract } ; stm : Str = case cltyp of { Subord => if_then_Pol p [] "aan" ++ subjpron ; -- if we form a ClSlash, no sentence type marker; negation with aan (Sayeed p. 210) @@ -793,11 +798,12 @@ oper subj = case vps.isPassive of {True => impersNP ; _ => np} } ; - wordOrder : (sn,sp,stm : Str) -> {p1,p2 : Str} -> {fin,inf : Str} -> VerbPhrase -> Str = - \subjnoun,subjpron,stm,obj,pred,vp -> vp.berri -- AdV + wordOrder : (sn,sp,stm : Str) -> {p1,p2 : Str} -> {fin,inf : Str} -> VerbPhrase -> BaseCl = + \subjnoun,subjpron,stm,obj,pred,vp -> { + beforeSTM = vp.berri -- AdV ++ subjnoun -- subject if it's a noun - ++ obj.p1 -- object if it's a noun - ++ stm -- sentence type marker + possible subj. pronoun + ++ obj.p1 ; -- object if it's a noun + afterSTM = stm -- sentence type marker + possible subj. pronoun ++ obj.p2 -- object if it's a pronoun ++ vp.sii -- restricted set of particles ++ vp.dhex -- restricted set of nouns/adverbials @@ -805,7 +811,7 @@ oper ++ vp.vComp -- VV complement ++ pred.inf -- potential infinitive/participle ++ pred.fin -- the verb inflected - ++ vp.miscAdv ; ---- NB. Only used if there are several adverbs. + ++ vp.miscAdv } ; ---- NB. Only used if there are several adverbs. ---- Primary places for adverbs are obj, sii or dhex. VFun : Type = Tense -> Anteriority -> Polarity -> Agreement -> Verb @@ -841,8 +847,9 @@ oper } ; -- TODO other relative forms infVP : VerbPhrase -> Str = \vp -> - let inf = {inf = vp.s ! VInf ; fin=[]} - in wordOrder [] [] [] (vp.comp ! Pl3) inf vp ; + let inf = {inf = vp.s ! VInf ; fin=[]} ; + wo = wordOrder [] [] [] (vp.comp ! Pl3) inf vp ; + in wo.beforeSTM ++ wo.afterSTM ; stmarkerContr : Agreement => Polarity => Str = \\a,b => let stm = if_then_Pol b "w" "m" diff --git a/src/somali/SentenceSom.gf b/src/somali/SentenceSom.gf index ebced1044..adfbafa96 100644 --- a/src/somali/SentenceSom.gf +++ b/src/somali/SentenceSom.gf @@ -27,7 +27,7 @@ lin -} -- : Temp -> Pol -> ClSlash -> SSlash ; -- (that) she had not seen - UseSlash t p cls = {s = \\b => t.s ++ p.s ++ cls.s ! b ! t.t ! t.a ! p.p} ; + --UseSlash t p cls = {s = \\b => t.s ++ p.s ++ cls.s ! b ! t.t ! t.a ! p.p} ; --2 Imperatives -- : VP -> Imp ; @@ -50,8 +50,9 @@ lin -} -- : Temp -> Pol -> Cl -> S ; UseCl t p cl = {s = \\b => - let cltyp = if_then_else ClType b Subord Statement in - t.s ++ p.s ++ cl.s ! cltyp ! t.t ! t.a ! p.p + let cltyp = if_then_else ClType b Subord Statement ; + sent = cl.s ! cltyp ! t.t ! t.a ! p.p in + sent ** {beforeSTM = t.s ++ p.s ++ sent.beforeSTM} ; } ; -- : Temp -> Pol -> QCl -> QS ; @@ -73,7 +74,7 @@ lin oper - advS : Adverb -> S -> S = \a,s -> s ** {s = \\b => - linAdv a ++ s.s ! b} ; + advS : Adverb -> S -> S = \a,s -> s ** {s = \\b => let ss = s.s ! b in + ss ** {beforeSTM = linAdv a ++ ss.beforeSTM}} ; }