Merge pull request #281 from inariksit/somali

(Som) More VV types
This commit is contained in:
Inari Listenmaa
2019-08-29 22:50:06 +02:00
committed by GitHub
7 changed files with 118 additions and 65 deletions

View File

@@ -35,6 +35,7 @@ oper
-- TODO: add subjunctive too!
VVForm : Type ; -- Argument to give to mkVV
infinitive : VVForm ; -- Takes its complement in infinitive
subjunctive : VVForm ; -- Takes its complement as a clause in subjunctive
waa_in : VVForm ; -- No explicit verb, just uses "waa in" construction
@@ -92,7 +93,8 @@ oper
mkVV : overload {
mkVV : (kar : Str) -> VV ; -- VV that takes its complement in infinitive.
mkVV : VVForm -> VV ; -- VV such as "waa in"
mkVV : (rab : Str) -> VVForm -> VV ; -- Specify complement type: infinitive or subjunctive.
mkVV : V -> VVForm -> VV ; -- VV out of an existing V
} ;
-- TODO: actual constructors
@@ -172,9 +174,10 @@ oper
u = ResSom.U ;
noPrep = ResSom.NoPrep ;
VVForm = Bool ;
infinitive = False ;
waa_in = True ;
VVForm = ResSom.VVForm ;
infinitive = Infinitive ;
subjunctive = Subjunctive ;
waa_in = Waa_In ;
------------------------
mkN = overload {
@@ -233,10 +236,14 @@ oper
mkVV = overload {
mkVV : (kar : Str) -> VV -- VV that takes its complement in infinitive.
= \kar -> lin VV ({isVS=False} ** mkV kar) ;
= \kar -> lin VV ({vvtype=Infinitive} ** mkV kar) ;
mkVV : (rab : Str) -> VVForm -> VV -- Specify string and complement type:
= \rab,vvf -> lin VV ({vvtype=vvf} ** mkV rab) ;
mkVV : V -> VVForm -> VV
= \v,vvf -> lin VV (v ** {vvtype=vvf}) ;
mkVV : VVForm -> VV -- VV such as "waa in"
= \b -> let dummyV : V = mkV "in"
in lin VV (dummyV ** {isVS=b ; s = \\_ => "in"})
in lin VV (dummyV ** {vvtype=b ; s = \\_ => "in"})
} ;
possPrep : N -> CatSom.Prep = \dhex -> emptyPrep ** {

View File

@@ -300,6 +300,10 @@ param
PredType = NoPred | Copula | NoCopula ;
STM = Waa PredType | Waxa ;
VVForm = Infinitive | Subjunctive | Waa_In ;
oper
if_then_Pol : Polarity -> Str -> Str -> Str = \p,t,f ->
case p of {Pos => t ; Neg => f } ;

View File

@@ -26,7 +26,7 @@ lin
-- : RP -> ClSlash -> RCl ; -- whom John loves
RelSlash rp cls =
let rcl = mergeSTM True (cls.s ! True) -- in subordinate clause, STM is not included but subject pronoun is
let rcl = mergeQCl (cls.s ! True) -- in subordinate clause, STM is not included but subject pronoun is
in rcl ** {s = \\g,c,t,a,p => rp.s ++ rcl.s ! t ! a ! p} ;

View File

@@ -471,7 +471,7 @@ oper
Verb2 : Type = Verb ** {c2 : Preposition} ;
Verb3 : Type = Verb2 ** {c3 : Preposition} ;
VV : Type = Verb ** {isVS : Bool} ;
VV : Type = Verb ** {vvtype : VVForm} ;
-- Saeed page 79:
-- "… the reference form is the imperative singular form
@@ -668,17 +668,6 @@ oper
x => hold_V.s ! x }
} ;
-- Till VERBFRASEN ansluter sig
-- · satstypsmarkörer (waa, ma...),
-- · subjekts-pronomenet la man,
-- · objektspronomenen,
-- · prepositionerna och
-- · riktnings-adverben soó (mot en plats/person), sií (bort frånen plats/person), wadá tillsammans (mot en gemensam punkt), kalá iväg, isär (bort från en gemensam punkt).
-- Riktningsadverben har ibland en mycket konkret betydelse, men många gånger är betydelsen mera abstrakt.
-- Till satsmarkörerna, dvs. både fokusmarkörerna och satstypsmarkörerna ansluter sig
-- subjektspronomenen aan, aad, uu, ay, aynu, men inte la (man).
------------------
-- VP
@@ -696,23 +685,30 @@ oper
Complement : Type = {
comp : Agreement => {p1,p2 : Str} ; -- Agreement for AP complements
pred : PredType ; -- to choose right sentence type marker and copula
stm : STM ; -- to choose right sentence type marker
-- pred : PredType ; -- to choose right sentence type marker and copula
} ;
VerbPhrase : Type = BaseVerb ** Complement ** BaseAdv ** {
c2 : PrepCombination ; -- Prepositions can combine together and with object pronoun.
obj2 : NPLite ; -- {s : Str ; a : PrepAgr}
secObj : Str ; -- if two overt pronoun objects
vComp : {pr,pst : Str} -- VV complement
vComp : {in_ : Str ; -- if it's "waa in" or subjunctive construction, there's "in" in there
inf : Str ;
subcl : Agreement => Str} -- VV complement if it's a subordinate clause
} ;
VPSlash : Type = VerbPhrase ;
useV : Verb -> VerbPhrase = \v -> v ** {
comp = \\_ => <[],[]> ;
pred = case v.isCopula of {True => Copula ; _ => NoPred} ;
vComp = {pr,pst = []} ;
berri,miscAdv,refl = [] ;
stm = case v.isCopula of { -- can change into Waxa in ComplVV
True => Waa Copula ;
False => Waa NoPred
} ;
vComp = {in_, inf = [] ;
subcl = \\_ => []} ;
berri,miscAdv = [] ;
c2 = Single NoPrep ;
obj2 = {s = [] ; a = P3_Prep} ;
secObj = []
@@ -811,7 +807,7 @@ oper
{s = \\t,a,p => (bcl ! t ! a ! p).beforeSTM
++ case <includeSTM,p> of {
<False,Pos> => [] ;
<False,Neg> => "aan" ;
<False,Neg> => "aan" ; -- include negation even if not including STM otherwise.
<True> => (bcl ! t ! a ! p).stm
}
++ (bcl ! t ! a ! p).afterSTM
@@ -826,33 +822,46 @@ oper
predVP : NounPhrase -> VerbPhrase -> Clause = \np,vps -> {
s = \\cltyp,t,a,p =>
let predRaw : {fin : Str ; inf : Str} = vf cltyp t a p subj.a vp ;
pred : {fin : Str ; inf : Str} = case <cltyp,p,t,vp.pred,subj.a> of {
<Statement,Pos,Pres,NoCopula ,Sg3 _|Pl3>
=> {fin,inf = []} ; -- If the VP is formed with CompNP
<_ , _,Pres,NoCopula|Copula, _> -- Comp* present tense
pred : {fin : Str ; inf : Str} = case <cltyp, p, t, vp.stm, subj.a> of {
<Statement, Pos, Pres, Waa NoCopula, Sg3 _|Pl3> -- VP comes from CompNP/CompCN + P3 subject
=> {fin,inf = []} ;
<_, _, Pres, Waa (Copula|NoCopula), _> -- Comp* present tense + any subject
=> {fin = presCopula ! {agr=subj.a ; pol=p} ; inf=[]} ;
_ => predRaw
_ => predRaw -- Any other verb
} ;
subjnoun : Str = if_then_Str np.isPron np.empty (subj.s ! Nom) ;
subjpron : Str = if_then_Str np.isPron (subj.s ! Nom) np.empty ;
obj : {p1,p2 : Str} =
let o : {p1,p2 : Str} = vp.comp ! subj.a ;
bind : Str = case <isPassive vp, vp.obj2.a, vp.c2> of {
<False,P3_Prep,Single NoPrep> => [] ;
_ => BIND } ;
in case <cltyp,p> of {
<Statement,Neg> => {p2 = [] ; p1 = o.p1 ++ o.p2 ++ bind} ;
bind : Str =
case <isPassive vp, vp.obj2.a, vp.c2> of {
<False,P3_Prep,Single NoPrep> => [] ; -- nothing to attach to the STM
_ => BIND } ; -- something to attach, use BIND
in case <cltyp,p> of {
<Statement,Neg> -- object pronoun and prepositions contract with negation
=> {p2 = [] ; p1 = o.p1 ++ o.p2 ++ bind} ;
_ => o
-- object pronoun, prepositions and negation all contract
} ;
stm : {p1,p2 : Str} = case cltyp of {
Subord => {p1 = if_then_Pol p [] "aan" ; -- if we form a ClSlash, no sentence type marker; negation with aan (Saeed p. 210)
p2 = if_then_Pol p subjpron []} ;
p2 = if_then_Pol p subjpron []} ; -- no subjpron in negation
Question => {p1 = "ma" ; p2 = []} ; -- TODO find out how negative questions work
Statement => case <p,vp.pred,subj.a> of {
<Pos,Copula|NoCopula,Pl3|Sg3 _> => {p1 = "waa" ; p2 = []} ;
_ => stmarkerNoContr ! subj.a ! p }} ;
in wordOrder subjnoun stm obj pred vp cltyp ;
Statement => case <p,vp.stm,subj.a> of {
<Pos,Waa (Copula|NoCopula),Pl3|Sg3 _> -- no subjpron in predicative sentences:
=> {p1 = "waa" ; p2 = []} ; -- "Axmed waa macallin" not "*Axmed waa uu macallin"
<_,Waxa,_>
=> waxaNoContr ! subj.a ! p ;
_ => waaNoContr ! subj.a ! p } -- if we want wuu, waad etc. swap to stmarkerContr
} ;
in wordOrder subj.a subjnoun stm obj pred vp cltyp ;
} where {
vp : VerbPhrase = case isPassive vps of {
True => complSlash (insertComp vps np) ;
@@ -862,8 +871,8 @@ oper
_ => np }
} ;
wordOrder : (sn : Str) -> (stm,obj : {p1,p2 : Str}) -> {fin,inf : Str} -> VerbPhrase -> ClType -> BaseCl =
\subjnoun,stm,obj,pred,vp,cltyp -> {
wordOrder : Agreement -> (sn : Str) -> (stm,obj : {p1,p2 : Str}) -> {fin,inf : Str} -> VerbPhrase -> ClType -> BaseCl =
\agr,subjnoun,stm,obj,pred,vp,cltyp -> {
{- Saeed p. 210-211: "The relative clause resembles a main clause in syntax
except that the tendency for verb final order is much stronger. [..] Certain
elements such as subject clitic pronouns, and the negative word aan 'not' are
@@ -874,8 +883,10 @@ oper
++ case cltyp of {
Subord => [] ;
_ => obj.p1 } ; -- noun object if it's a statement
stm = stm.p1 ; -- sentence type marker; empty if subordinate and positive
afterSTM = vp.vComp.pr -- "waa in" construction
afterSTM = vp.vComp.in_ -- "waa in" construction
++ stm.p2 -- possible subj. pronoun
++ case cltyp of {
Subord => obj.p1 ; -- noun object if it's subordinate clause
@@ -884,10 +895,11 @@ oper
++ vp.sii -- restricted set of particles
++ vp.dhex -- restricted set of nouns/adverbials
++ vp.secObj -- "second object"
++ vp.vComp.pst -- VV complement
++ vp.vComp.inf -- VV complement, if it's infinitive
++ pred.inf -- potential infinitive/participle
++ pred.fin -- the verb inflected
++ vp.miscAdv } ; ---- NB. Only used if there are several adverbs.
++ vp.vComp.subcl ! agr -- VV complement, if it's subordinate clause
++ vp.miscAdv } ; ---- NB. Only used if there are several adverbs, or for "waa in" construction.
---- Primary places for adverbs are obj, sii or dhex.
VFun : Type = Tense -> Anteriority -> Polarity -> Agreement -> BaseVerb
@@ -931,15 +943,20 @@ oper
infVP : VerbPhrase -> Str = linVP VInf Statement ;
stmarkerContr : Agreement => Polarity => Str = \\a,b =>
waaContr : Agreement => Polarity => Str = \\a,b =>
let stm = if_then_Pol b "w" "m"
in stm + subjpron ! a ;
stmarkerNoContr : Agreement => Polarity => {p1,p2 : Str} = \\a,p =>
waaNoContr : Agreement => Polarity => {p1,p2 : Str} = \\a,p =>
case p of {
Pos => {p1 = "waa" ; p2 = subjpron ! a} ;
Neg => {p1 = "ma" ; p2 = []} } ;
waxaNoContr : Agreement => Polarity => {p1,p2 : Str} = \\a,p =>
case p of {
Pos => {p1 = "waxa" ; p2 = subjpron ! a} ;
Neg => {p1 = "ma" ; p2 = []} } ; -- TODO: find out how to properly negate waxa clauses!
subjpron : Agreement => Str = table {
Sg1|Pl1 Excl => "aan" ;
Pl1 Incl => "aynu" ;
@@ -959,7 +976,7 @@ oper
<Subord,True> => {p1 = "aan" ; p2 = []} ;
_ => {p1,p2 = []}
} ;
wo = wordOrder [] stm (vp'.comp ! pagr2agr vp.obj2.a) inf vp' cltyp ;
wo = wordOrder (Sg3 Masc) [] stm (vp'.comp ! pagr2agr vp.obj2.a) inf vp' cltyp ;
in wo.beforeSTM ++ wo.stm ++ wo.afterSTM ;
linCN : CNoun -> Str = \cn -> cn.s ! Indef Sg ++ cn.mod ! Indefinite ! Sg ! Abs ;

View File

@@ -180,12 +180,12 @@ lin have_V2 = mkV2 have_V noPrep ; -- TODO: check if {sii = "l" ++ BIND ; isCopu
lin can8know_VV = can_VV ; -- can (capacity)
lin can_VV = mkVV "kar" ; -- can (possibility)
lin must_VV = mkVV waa_in ;
{-lin want_VV = mkV "" ;
lin want_VV = mkVV (mkV "rabid" "rab" "rab") subjunctive ;
------
-- Voc
{-
lin please_Voc = ss "" ;
-}
}

View File

@@ -15,17 +15,30 @@ lin
ReflVP = ResSom.insertRefl ;
-- : VV -> VP -> VP ;
ComplVV vv vp = let vc = vp.vComp in case vv.isVS of {
True => vp ** {
vComp = vc ** {pr = vv.s ! VInf} ;
obj2 = vp.obj2 ** {s = []} ; -- word order hack to avoid more parameters:
miscAdv = vp.miscAdv ++ vp.obj2.s -- dump it all to miscAdv
ComplVV vv vp = let vc = vp.vComp in case vv.vvtype of {
Waa_In => vp ** {
vComp = vc ** {in_ = 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:
miscAdv = vp.miscAdv ++ vp.obj2.s -- dump the object to miscAdv
} ;
False => vp ** {
Subjunctive => useV vv ** {
stm = Waxa ;
vComp = vc ** { -- The whole previous VP becomes the subordinate clause
subcl = \\agr =>
let subj = pronTable ! agr ;
cls = predVPSlash subj vp ;
rcl = mergeRCl (cls.s ! True) ;
in "in" ++ rcl.s ! Pres ! Simul ! Pos
}
} ;
Infinitive => vp ** {
s = vv.s ; -- check Saeed p. 169
vComp = vc ** {pst = vc.pst ++ vp.s ! VInf} ;
pred = NoPred ;
vComp = vc ** {
inf = vc.inf ++ vp.s ! VInf
} ;
stm = Waa NoPred ;
}
} ;
@@ -127,28 +140,28 @@ lin
-- : AP -> Comp ;
CompAP ap = {
comp = \\a => <[], ap.s ! AF (getNum a) Abs> ;
pred = Copula ;
stm = Waa Copula ;
} ;
-- : CN -> Comp ;
CompCN cn = {
comp = \\a => <[], cn2str Sg Abs cn> ;
pred = NoCopula ;
stm = Waa NoCopula ;
} ;
-- NP -> Comp ;
CompNP np = {
comp = \\a => <[], np.s ! Abs> ;
pred = NoCopula ;
stm = Waa NoCopula ;
} ;
-- : Adv -> Comp ;
CompAdv adv = {
comp = \\a => <[], linAdv adv> ;
pred = Copula ;
stm = Waa Copula ;
} ;
-- : VP -- Copula alone;
UseCopula = useV copula ** {pred=Copula} ;
UseCopula = useV copula ;
}

View File

@@ -48,7 +48,7 @@ LangSom: hooyo waa ay ina kaa siisey
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPast ASimul) PPos (PredVP (MassNP (UseN2 mother_N2)) (ComplSlash (Slash3V3 give_V3 (UsePron we_Pron)) (UsePron youSg_Pron))))) NoVoc
-- LangEng: mother didn't give you us
LangSom: hooyo ina BIND ma ay kaa siin
LangSom: hooyo ina BIND ma kaa siin
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPast ASimul) PNeg (PredVP (MassNP (UseN2 mother_N2)) (ComplSlash (Slash3V3 give_V3 (UsePron we_Pron)) (UsePron youSg_Pron))))) NoVoc
-- LangEng: he gave himself bread
@@ -78,6 +78,18 @@ Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron you
LangSom: waa in la arkaa bisad BIND da hooya BIND deed
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (GenericCl (ComplVV must_VV (ComplSlash (SlashV2a see_V2) (MassNP (ComplN2 mother_N2 (DetCN (DetQuant DefArt NumSg) (UseN cat_N))))))))) NoVoc
-- LangEng: I want to read the book
LangSom: waxa aan rabaa in aan buug BIND ga akhriyo
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplVV want_VV (ComplSlash (SlashV2a read_V2) (DetCN (DetQuant DefArt NumSg) (UseN book_N))))))) NoVoc
-- LangEng: I don't want to read the book
LangSom: ma rabo in aan buug BIND ga akhriyo
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PNeg (PredVP (UsePron i_Pron) (ComplVV want_VV (ComplSlash (SlashV2a read_V2) (DetCN (DetQuant DefArt NumSg) (UseN book_N))))))) NoVoc
-- LangEng: you want to see us under the chair
LangSom: waxa aad rabtaa in aad inagu aragto kursi BIND ga hoos BIND tiis BIND a
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron youSg_Pron) (ComplVV want_VV (AdvVP (ComplSlash (SlashV2a see_V2) (UsePron we_Pron)) (PrepNP under_Prep (DetCN (DetQuant DefArt NumSg) (UseN chair_N)))))))) NoVoc
--------------------------------------------------------------------------------
-- Adverbials