diff --git a/src/somali/QuestionSom.gf b/src/somali/QuestionSom.gf index f1dd7f17a..5d8966a7f 100644 --- a/src/somali/QuestionSom.gf +++ b/src/somali/QuestionSom.gf @@ -88,12 +88,15 @@ concrete QuestionSom of Question = CatSom ** open -- : IAdv -> IComp ; CompIAdv iadv = { -- where (is it) - comp = \\_ => <[], iadv.s> ; + aComp = \\_ => [] ; + nComp = iadv.s ; stm = Waa NoCopula ; } ; + -- : IP -> IComp ; CompIP ip = { -- who (is it) - comp = \\_ => <[], ip.s ! Abs> ; + aComp = \\_ => [] ; + nComp = ip.s ! Abs ; stm = Waa NoCopula ; } ; @@ -112,4 +115,18 @@ concrete QuestionSom of Question = CatSom ** open QuestQVP : IP -> QVP -> QCl ; -- who buys what where -} +oper + + -- Question clauses: subject pronoun not included, STM is + cl2qcl : ClType -> Bool -> ClSlash -> Clause = \cltyp -> + let hasSubjPron : Bool = False ; + isRel : Bool = False ; + in mkClause cltyp isRel hasSubjPron ; + + -- Question clause with wh-word as object: subject pronoun is included + cl2qclslash : Bool -> ClSlash -> Clause = + let hasSubjPron : Bool = True ; + isRel : Bool = False ; + in mkClause PolarQuestion isRel hasSubjPron ; + } diff --git a/src/somali/RelativeSom.gf b/src/somali/RelativeSom.gf index dd2665eec..49536b23d 100644 --- a/src/somali/RelativeSom.gf +++ b/src/somali/RelativeSom.gf @@ -36,4 +36,28 @@ lin -- : Prep -> NP -> RP -> RP ; -- the mother of whom --FunRP prep np rp = {} ; +oper + + -- RelVP: subject pronoun is never included + cl2rcl : ClSlash -> Clause = + let hasSubjPron : Bool = False ; + hasSTM : Bool = False ; + isRel : Bool = True ; + in mkClause Subord isRel hasSubjPron hasSTM ; + + -- No subject pronoun, no STM, but use verb forms from Statement + cl2rclNom : ClSlash -> Clause = \cls -> + let hasSubjPron : Bool = False ; + hasSTM : Bool = False ; + isRel : Bool = True ; + in mkClause Statement isRel hasSubjPron hasSTM cls ; + + -- RelSlash: subject pronoun is included if it's not 3rd person + -- TODO check this rule with more example sentences + cl2relslash : ClSlash -> Clause = + let hasSubjPron : Bool = True ; + hasSTM : Bool = False ; + isRel : Bool = True ; + in mkClause Subord isRel hasSubjPron hasSTM ; + } diff --git a/src/somali/ResSom.gf b/src/somali/ResSom.gf index 2cf004fcf..a4c5564cf 100644 --- a/src/somali/ResSom.gf +++ b/src/somali/ResSom.gf @@ -726,7 +726,8 @@ oper -- VP Complement : Type = { - comp : Agreement => {p1,p2 : Str} ; -- Agreement for AP complements + aComp : Agreement => Str ; + nComp : Str ; stm : STM ; -- to choose right sentence type marker } ; @@ -735,18 +736,19 @@ oper obj2 : NPLite ; -- {s : Str ; a : PrepAgr} secObj : Str ; -- if two overt pronoun objects vComp : {subjunc : Str ; -- "waa in" or subjunctive construction: "in" is placed here - inf : Str ; -- auxiliary VV with infinitive argument - subcl : Agreement => Str} -- VV complement if it's a subordinate clause + inf : Str ; -- auxiliary VV with infinitive argument + subcl : Agreement => Str} -- VV complement if it's a subordinate clause } ; VPSlash : Type = VerbPhrase ; useV : Verb -> VerbPhrase = \v -> v ** { - comp = \\_ => <[],[]> ; stm = case v.isCopula of { -- can change into Waxa in ComplVV True => Waa Copula ; False => Waa NoPred } ; + nComp = [] ; + aComp = \\_ => [] ; vComp = {subjunc, inf = [] ; subcl = \\_ => []} ; berri,miscAdv = [] ; @@ -775,13 +777,6 @@ oper _ => vp.c2 } } ; - complSlash : VPSlash -> VerbPhrase = \vps -> let np = vps.obj2 in vps ** { - 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 ++ prepCombTable ! np.a ! vps.c2} -- object combines with the preposition of the verb. - } ; - insertRefl : VPSlash -> VPSlash = \vps -> vps ** { obj2 = vps.obj2 ** {a = Reflexive_Prep} ; @@ -859,7 +854,8 @@ oper obj2 : NPLite ; secObj : Str ; c2 : PrepCombination ; -- NB. QuestIAdv can add more prepositions - comp : {p1,p2 : Str} ; + aComp : Str ; + nComp : Str ; vComp : {inf,subcl,subjunc : Str} ; -- Still open @@ -881,7 +877,6 @@ oper in case of { -- VP comes from CompNP/CompCN + P3 subject => [] ; - <_, _, Pres, Waa (Copula|NoCopula), _> -- Comp* present tense + any subject => presCopula ! {agr=subj.a ; pol=p} ; @@ -889,7 +884,7 @@ oper } ; stm = mkStm subj.a vp.stm ; - comp = vp.comp ! subj.a ; + aComp = vp.aComp ! subj.a ; vComp = vp.vComp ** { subcl = vp.vComp.subcl ! subj.a } @@ -909,50 +904,8 @@ oper => np.empty ; _ => (pronTable ! subj.a).s ! Nom } - } ; - -- just like complSlash but for Cl - complCl : ClSlash -> ClSlash = \cl -> let np = cl.obj2 in cl ** { - comp = {p1 = np.s ++ cl.comp.p1 ; - p2 = cl.comp.p2 ++ prepCombTable ! np.a ! cl.c2} - } ; - - - -- RelVP: subject pronoun is never included - cl2rcl : ClSlash -> Clause = - let hasSubjPron : Bool = False ; - hasSTM : Bool = False ; - isRel : Bool = True ; - in mkClause Subord isRel hasSubjPron hasSTM ; - - -- No subject pronoun, no STM, but use verb forms from Statement - cl2rclNom : ClSlash -> Clause = \cls -> - let hasSubjPron : Bool = False ; - hasSTM : Bool = False ; - isRel : Bool = True ; - in mkClause Statement isRel hasSubjPron hasSTM cls ; - - -- RelSlash: subject pronoun is included if it's not 3rd person - -- TODO check this rule with more example sentences - cl2relslash : ClSlash -> Clause = - let hasSubjPron : Bool = True ; - hasSTM : Bool = False ; - isRel : Bool = True ; - in mkClause Subord isRel hasSubjPron hasSTM ; - - -- Question clauses: subject pronoun not included, STM is - cl2qcl : ClType -> Bool -> ClSlash -> Clause = \cltyp -> - let hasSubjPron : Bool = False ; - isRel : Bool = False ; - in mkClause cltyp isRel hasSubjPron ; - - -- Question clauses: subject pronoun is included - cl2qclslash : Bool -> ClSlash -> Clause = - let hasSubjPron : Bool = True ; - isRel : Bool = False ; - in mkClause PolarQuestion isRel hasSubjPron ; - -- Sentence: include subject pronoun and STM. -- When subordinate, include "in". cl2sentence : Bool -> ClSlash -> Clause = \isSubord,cls -> { @@ -961,36 +914,52 @@ oper True => Subord ; False => Statement } ; cl : ClSlash = case isSubord of { -- add "in" to the clause if used as subordinate - True => cls ** {vComp = cls.vComp ** {subjunc = "in"}} ; + True => cls ** { + vComp = cls.vComp ** {subjunc = "in"} + } ; False => cls } ; - sent = mkClause cltyp False True True cl + isRel = False ; + hasSubjPron = True ; + hasSTM = True ; + sent = mkClause cltyp isRel hasSubjPron hasSTM cl in sent.s ! t ! a ! p } ; - - mkClause : ClType -> (rel,sp,stm : Bool) -> ClSlash -> Clause = \cltyp,isRel,hasSubjPron,hasSTM,incomplCl -> { + mkClause : ClType -> (rel,sp,stm : Bool) -> ClSlash -> Clause = + \cltyp,isRel,hasSubjPron,hasSTM,cl -> { s = \\t,a,p => let -- Put all arguments in their right place - cl : ClSlash = complCl incomplCl ; + --cl : ClSlash = complCl incomplCl ; + prepComb = prepCombTable ! cl.obj2.a ! cl.c2 ; -- Contractions bind : Str = case of { => [] ; -- nothing to attach to the STM _ => BIND } ; -- something to attach, use BIND - obj : {p1,p2 : Str} = case of { - -- object pronoun and prepositions contract with negation - => {p2 = [] ; p1 = cl.comp.p1 ++ cl.comp.p2 ++ bind} ; - _ => cl.comp } ; + prepCombNeg : Str = case of { + => prepComb ++ bind ; + _ => [] + } ; + prepCombPos : Str = case of { + => [] ; + _ => prepComb + } ; -- Placement of object noun varies depending on type of clause statementNounObj = case cltyp of { - Statement => obj.p1 ; + Statement => cl.obj2.s ; _ => [] } ; + statementNounComp = case cltyp of { + Statement => cl.nComp ; + _ => [] } ; + + -- for subord and question, NP predicatives and objects behave the same subordNounObj = case cltyp of { - Subord => obj.p1 ; + Subord => cl.obj2.s ++ cl.nComp ; _ => [] } ; questionNounObj = case cltyp of { - PolarQuestion|WhQuestion => obj.p1 ; + PolarQuestion|WhQuestion + => cl.obj2.s ++ cl.nComp ; _ => [] } ; -- Control whether to include subject pronoun and STM @@ -1000,19 +969,24 @@ oper _ => [] } ; stm : Str = case of { => cl.stm ! cltyp ! p ; - <_,Neg> => cl.stm ! cltyp ! p ; -- negation overrides hasSTM=False + <_,Neg> => cl.stm ! cltyp ! p ; -- negation overrides hasSTM=False. To override the override, set STM to [] in the function that calls this. /IL _ => [] } in cl.berri -- AdV ++ cl.subj.noun -- subject if it's a noun ++ statementNounObj -- noun object if it's a statement + ++ prepCombNeg -- prepositions and pron. objects in negative statement ++ stm ++ 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) - ++ obj.p2 -- object if it's a pronoun + ++ cl.aComp -- AP complement, regardless of cltype + ++ statementNounComp -- NP complement if it's direct statement + + ++ prepCombPos -- prepositions + pron. objects in positive sentence + ++ cl.sii -- restricted set of particles ++ cl.dhex -- restricted set of nouns/adverbials ++ cl.secObj -- "second object" @@ -1119,28 +1093,30 @@ oper ++ adv.np.s ++ adv.miscAdv ; - linVP : VForm -> ClType -> VerbPhrase -> Str = \vf,cltyp,vp -> let pred = vp.s ! vf ; - vp' = complSlash vp ; + pr = prepCombTable ! vp.obj2.a ! vp.c2 ; + -- obj = {p1 = np.s ; + -- p2 = vp.aComp ! pagr2agr np.a ++ prepCombTable ! np.a ! vps.c2} ; neg = case of { => "aan" ; _ => [] } ; - in wordOrder cltyp neg pred (vp'.comp ! pagr2agr vp.obj2.a) vp' ; + in wordOrder cltyp neg pred pr vp ; - wordOrder : ClType -> (neg,pred : Str) -> (obj : {p1,p2 : Str}) -> VerbPhrase -> Str = - \cltyp,neg,pred,obj,vp -> + wordOrder : ClType -> (neg,pred,prepcomb : Str) -> VerbPhrase -> Str = + \cltyp,neg,pred,pr,vp -> vp.berri -- AdV ++ case cltyp of { Subord => [] ; - _ => obj.p1 } -- noun object if it's a statement + _ => vp.obj2.s {-obj.p1-} } -- noun object if it's a statement ++ neg ++ vp.vComp.subjunc -- "waa in" construction ++ case cltyp of { - Subord => obj.p1 ; -- noun object if it's subordinate clause + Subord => vp.obj2.s ; -- noun object if it's subordinate clause _ => [] } - ++ obj.p2 -- object if it's a pronoun + ++ vp.aComp ! pagr2agr vp.obj2.a -- AP complement agreeing with object + ++ pr -- object if it's a pronoun ++ vp.sii -- restricted set of particles ++ vp.dhex -- restricted set of nouns/adverbials ++ vp.secObj -- "second object" diff --git a/src/somali/VerbSom.gf b/src/somali/VerbSom.gf index 3208febc2..ab17f11bb 100644 --- a/src/somali/VerbSom.gf +++ b/src/somali/VerbSom.gf @@ -79,7 +79,7 @@ lin -- : 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 + aComp = \\_ => (CompAP ap).aComp ! Sg3 Masc } ; -- : VPSlash -> NP -> VP @@ -133,32 +133,32 @@ lin -- Adjectival phrases, noun phrases, and adverbs can be used. - -- the house is big - -- the houses are big - -- I am [a house that sleeps here] - -- we are [houses that sleep here] - -- : AP -> Comp ; CompAP ap = { - comp = \\a => <[], ap.s ! AF (getNum a) Abs> ; + aComp = \\a => ap.s ! AF (getNum a) Abs ; + nComp = [] ; stm = Waa Copula ; } ; -- : CN -> Comp ; CompCN cn = { - comp = \\a => <[], cn2str Sg Abs cn> ; + -- I am [a house that sleeps here] vs. we are [houses that sleep here] + aComp = \\a => cn2str (getNum a) Abs cn ; + nComp = [] ; stm = Waa NoCopula ; } ; -- NP -> Comp ; CompNP np = { - comp = \\a => <[], np.s ! Abs> ; + aComp = \\a => [] ; + nComp = np.s ! Abs ; stm = Waa NoCopula ; } ; -- : Adv -> Comp ; CompAdv adv = { - comp = \\a => <[], linAdv adv> ; + aComp = \\a => linAdv adv ; -- TODO check placement + nComp = [] ; stm = Waa Copula ; } ; diff --git a/src/somali/unittest/qcl.gftest b/src/somali/unittest/qcl.gftest index 10d16b155..4b2fea73c 100644 --- a/src/somali/unittest/qcl.gftest +++ b/src/somali/unittest/qcl.gftest @@ -66,5 +66,5 @@ Lang: PhrUtt NoPConj (UttQS (UseQCl (TTAnt TPast ASimul) PPos (QuestIAdv why_IAd -- 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 +LangSom: maxaa uu ahaa hilib BIND ka la cunay 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