From ef13412a668ed72bbefee117ebdc2f1e6e1e8085 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 28 Jun 2019 14:01:40 +0200 Subject: [PATCH] (Som) Add CompCN+NP ; more rules for predicatives --- src/somali/LexiconSom.gf | 2 +- src/somali/ParamSom.gf | 2 ++ src/somali/ResSom.gf | 29 ++++++++++++++--------------- src/somali/SentenceSom.gf | 10 +++++++--- src/somali/VerbSom.gf | 32 ++++++++++++++++++++------------ 5 files changed, 44 insertions(+), 31 deletions(-) diff --git a/src/somali/LexiconSom.gf b/src/somali/LexiconSom.gf index bf06d494..1d7e86df 100644 --- a/src/somali/LexiconSom.gf +++ b/src/somali/LexiconSom.gf @@ -361,7 +361,7 @@ lin speak_V2 = mkV2 "hadlo" ; -- lin tail_N = mkN "" ; -- lin talk_V3 = mkV3 "" ; lin teach_V2 = mkV2 "bar" ku ; --- lin teacher_N = mkN "" ; +lin teacher_N = mkN "macallin" ; -- lin television_N = mkN "" ; -- lin thick_A = mkA "" ; -- lin thin_A = mkA "" ; diff --git a/src/somali/ParamSom.gf b/src/somali/ParamSom.gf index 196dfbcc..a5cd1b11 100644 --- a/src/somali/ParamSom.gf +++ b/src/somali/ParamSom.gf @@ -213,6 +213,8 @@ param | VRel -- "som är/har/…" TODO is this used in other verbs? | VImp Number Polarity ; + PredType = NoPred | Copula | NoCopula ; + oper if_then_Pol : Polarity -> Str -> Str -> Str = \p,t,f -> case p of {Pos => t ; Neg => f } ; diff --git a/src/somali/ResSom.gf b/src/somali/ResSom.gf index d97e5e01..b775cc43 100644 --- a/src/somali/ResSom.gf +++ b/src/somali/ResSom.gf @@ -19,6 +19,9 @@ oper isPoss : Bool -- to prevent impossible forms in ComplN2 with Ns that have short possessive, e.g. "father" } ; + cn2str : Number -> Case -> CNoun -> Str = \n,c,cn -> + cn.s ! Indef n ++ cn.mod ! n ! c ; + PNoun : Type = {s : Str ; a : Agreement} ; mkPNoun : Str -> Agreement -> PNoun = \str,agr -> {s = str ; a = agr} ; @@ -611,11 +614,11 @@ oper c2 : Preposition ; np : NounPhrase} ; -- So that adverbs can also contribute to preposition contraction Complement : Type = { - comp : Agreement => {p1,p2 : Str} -- Agreement for AP complements + comp : Agreement => {p1,p2 : Str} ; -- Agreement for AP complements + pred : PredType ; -- to choose right sentence type marker and copula } ; VerbPhrase : Type = Verb ** Complement ** { - isPred : Bool ; -- to choose right sentence type marker adv : Str ; c2, c3 : Preposition ; -- can combine together and with object pronoun(s?) obj2 : {s : Str ; a : AgreementPlus} ; @@ -626,7 +629,7 @@ oper useV : Verb -> VerbPhrase = \v -> v ** { comp = \\_ => <[],[]> ; - isPred = False ; + pred = NoPred ; adv = [] ; c2,c3 = noPrep ; obj2 = {s = [] ; a = Unassigned} ; @@ -643,15 +646,11 @@ oper } ; complSlash : VPSlash -> VerbPhrase = \vps -> let np = vps.obj2 in vps ** { - comp = \\agr => - case np.a of { - Unassigned => vps.comp ! agr ; - _ => {p1 = np.s ; -- if object is a noun, it will come before verb in the sentence. - -- if object is a pronoun, np.s is empty. - p2 = compl np.a vps ++ vps.secObj} -- object combines with the preposition of the verb. - -- secObj in case there was a ditransitive verb. - } - } ; + comp = \\agr => let cmp = vps.comp ! agr in + {p1 = np.s ++ cmp.p1 ; -- if object is a noun, it will come before verb in the sentence. + -- if object is a pronoun, np.s is empty. + p2 = cmp.p2 ++ compl np.a vps ++ vps.secObj} -- object combines with the preposition of the verb. + } ; -- secObj in case there was a ditransitive verb. compl : AgreementPlus -> VerbPhrase -> Str = \a,vp -> let agr = case a of {IsPron x => x ; _ => Pl3} ; @@ -686,7 +685,7 @@ oper } ; - insertAdv : Adverb -> VerbPhrase -> VerbPhrase = \adv,vp -> + insertAdv : VerbPhrase -> Adverb -> VerbPhrase = \vp,adv -> case adv.c2 of { noPrep => vp ** {adv = adv.s} ; -- The adverb is not formed with PrepNP prep => case of { @@ -746,6 +745,6 @@ oper -- linrefs oper - linVP : VerbPhrase -> Str = \vp -> vp.s ! VInf ; ---- - linCN : CNoun -> Str = \cn -> cn.s ! NomSg ; + linVP : VerbPhrase -> Str = \vp -> let obj = vp.comp ! Sg3 Masc in obj.p1 ++ obj.p2 ++ vp.s ! VInf ; ---- + linCN : CNoun -> Str = \cn -> cn.s ! NomSg ++ cn.mod ! Sg ! Abs ; } diff --git a/src/somali/SentenceSom.gf b/src/somali/SentenceSom.gf index 406d718c..c186e873 100644 --- a/src/somali/SentenceSom.gf +++ b/src/somali/SentenceSom.gf @@ -14,13 +14,17 @@ lin _ => complSlash vps } ; subj = case vps.c2 of {passive => impersNP ; _ => np} ; in { s = \\t,a,p => - let pred : {fin : Str ; inf : Str} = vf t a p subj.a vp ; + let predRaw : {fin : Str ; inf : Str} = vf t a p subj.a vp ; + pred : {fin : Str ; inf : Str} = case vp.pred of { + NoCopula => {fin,inf = []} ; -- if NoCopula, no overt verb + _ => predRaw + } ; subjnoun : Str = if_then_Str np.isPron [] (subj.s ! Nom) ; subjpron : Str = if_then_Str np.isPron (subj.s ! Nom) [] ; obj : {p1,p2 : Str} = vp.comp ! subj.a ; stm : Str = - case of { - => "waa" ; + case of { + => "waa" ; -- _ => stmarker ! np.a ! b } -- marker+pronoun contract _ => case of { => "waa" ++ subjpron ; -- to force some string from NP to show in the tree diff --git a/src/somali/VerbSom.gf b/src/somali/VerbSom.gf index 8ac8e54b..29baad2d 100644 --- a/src/somali/VerbSom.gf +++ b/src/somali/VerbSom.gf @@ -9,7 +9,7 @@ lin UseV = ResSom.useV ; -- : V2 -> VP ; -- be loved - PassV2 = ResSom.passV2 ; + PassV2 = ResSom.passV2 ; {- -- : VV -> VP -> VP ; ComplVV vv vp = ; @@ -74,16 +74,13 @@ lin ReflVP vps = ; -} -- : Comp -> VP ; - UseComp comp = UseCopula ** comp ** { - isPred = True - } ; + UseComp comp = UseCopula ** comp ; -- : VP -> Adv -> VP ; -- sleep here - AdvVP vp adv = insertAdv adv vp ; ---- TODO: how about combining adverbs? - + AdvVP = insertAdv ; -- : VPSlash -> Adv -> VPSlash ; -- use (it) here - AdvVPSlash vps adv = insertAdv adv vps ; + AdvVPSlash = insertAdv ; {- -- : VP -> Adv -> VP ; -- sleep , even though ... @@ -117,18 +114,29 @@ lin -- : AP -> Comp ; CompAP ap = { comp = \\a => <[], ap.s ! AF (getNum a) Abs> ; + pred = Copula ; } ; -{- + -- : CN -> Comp ; - CompCN cn = { } ; + CompCN cn = { + comp = \\a => <[], cn2str Sg Abs cn> ; + pred = NoCopula ; + } ; -- NP -> Comp ; - CompNP np = { } ; + CompNP np = { + comp = \\a => <[], np.s ! Abs> ; + pred = NoCopula ; + } ; -- : Adv -> Comp ; - CompAdv adv = { } ; + CompAdv adv = { + comp = \\a => + ; + pred = Copula ; + } ; --} -- : VP -- Copula alone; UseCopula = useV copula ;