Merge pull request #253 from inariksit/somali

Somali
This commit is contained in:
Inari Listenmaa
2019-07-01 12:09:35 +02:00
committed by GitHub
5 changed files with 104 additions and 95 deletions

View File

@@ -116,7 +116,7 @@ oper
-- mkSubj : Str -> Bool -> Subj = \s,b -> -- mkSubj : Str -> Bool -> Subj = \s,b ->
-- lin Subj { } ; -- lin Subj { } ;
mkAdv : Str -> Adv = \s -> lin Adv {s = s ; c2 = noPrep ; np = emptyNP} ; mkAdv : Str -> Adv = \s -> lin Adv {s = s ; c2=noPrep ; np = emptyNP} ;
mkAdV : Str -> AdV = \s -> lin AdV {s = s} ; mkAdV : Str -> AdV = \s -> lin AdV {s = s} ;
@@ -146,11 +146,11 @@ oper
fem = Fem ; fem = Fem ;
Preposition = ResSom.Preposition ; Preposition = ResSom.Preposition ;
ka = ResSom.ka ; ka = ResSom.Ka ;
ku = ResSom.ku ; ku = ResSom.Ku ;
la = ResSom.la ; la = ResSom.La ;
u = ResSom.u ; u = ResSom.U ;
noPrep = ResSom.noPrep ; noPrep = ResSom.NoPrep ;
------------------------ ------------------------
mkN = overload { mkN = overload {

View File

@@ -156,28 +156,34 @@ param
-- Prepositions -- Prepositions
param param
Preposition = u | ku | ka | la | noPrep | passive ; Preposition = U | Ku | Ka | La | NoPrep ;
PrepCombination = ugu | uga | ula | kaga | kula | kala PrepositionPlus = P Preposition | Passive ; -- Hack: RGL only supports V2s as passive, so I can reuse V2's preposition slot for passives as well, and save >200 parameters. (Don't ask.)
| Single Preposition ; PrepCombination = Ugu | Uga | Ula | Kaga | Kula | Kala
| Single PrepositionPlus ;
oper oper
combine : Preposition -> Preposition -> PrepCombination = \p1,p2 -> combine : PrepositionPlus -> Preposition -> PrepCombination = \p1,p2 ->
let oneWay : Preposition => Preposition => PrepCombination = let oneWay : PrepositionPlus => Preposition => PrepCombination =
\\x,y => case <x,y> of { \\x,y => case <x,y> of {
<u,u|ku> => ugu ; <Passive,NoPrep> => Single Passive ;
<u,ka> => uga ; <Passive,p> => Single (P p) ; -- TODO check if this ever happens
<u,la> => ula ; <P z,_> => case <z,y> of {
<ku|ka, <U,U|Ku> => Ugu ;
ku|ka> => kaga ; <U,Ka> => Uga ;
<ku,la> => kula ; <U,La> => Ula ;
<ka,la> => kala ; <Ku|Ka,
<noPrep,p> => Single p ; Ku|Ka> => Kaga ;
<p,noPrep> => Single p ; <Ku,La> => Kula ;
<p,_> => Single p } -- for trying both ways <Ka,La> => Kala ;
in case oneWay ! p2 ! p1 of { <NoPrep,p> => Single (P p) ;
<p,NoPrep> => Single x ;
<p,_> => Single x }} -- for trying both ways
in case oneWay ! P p2 ! (pp2prep p1) of {
Single _ => oneWay ! p1 ! p2 ; Single _ => oneWay ! p1 ! p2 ;
x => x } ; z => z } ;
pp2prep : PrepositionPlus -> Preposition = \pp ->
case pp of {P p => p ; Passive => NoPrep} ;
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- Verbs -- Verbs

View File

@@ -191,7 +191,7 @@ oper
} ; } ;
Pl1 Excl => { Pl1 Excl => {
s = table {Nom => "aan" ; Abs => "na"} ; s = table {Nom => "aan" ; Abs => "na"} ;
a = Pl1 Incl ; isPron = True ; sp ="annaga" ; a = Pl1 Excl ; isPron = True ; sp ="annaga" ;
poss = {s = quantTable "eenn" ; short = quantTable "een" ; sp = gnTable "eenn" "eenn" "uweenn"} poss = {s = quantTable "eenn" ; short = quantTable "een" ; sp = gnTable "eenn" "eenn" "uweenn"}
} ; } ;
Pl1 Incl => { Pl1 Incl => {
@@ -322,55 +322,52 @@ oper
_ => ku _ => ku
} }
} ; } ;
prep : Preposition -> (Prep ** {c2 : Preposition}) = \p -> prepTable ! p ** {c2 = p} ; prep : Preposition -> (Prep ** {c2 : Preposition}) = \p -> prepTable ! P p ** {c2 = p} ;
prepTable : Preposition => Prep = table { prepTable : PrepositionPlus => Prep = table {
ku => mkPrep "ku" "igu" "kugu" "nagu" "idinku" "lagu" ; P Ku => mkPrep "ku" "igu" "kugu" "nagu" "idinku" "lagu" ;
ka => mkPrep "ka" "iga" "kaa" "naga" "idinka" "laga" ; P Ka => mkPrep "ka" "iga" "kaa" "naga" "idinka" "laga" ;
la => mkPrep "la" "ila" "kula" "nala" "idinla" "lala" ; P La => mkPrep "la" "ila" "kula" "nala" "idinla" "lala" ;
u => mkPrep "u" "ii" "kuu" "noo" "idiin" "loo" ; P U => mkPrep "u" "ii" "kuu" "noo" "idiin" "loo" ;
noPrep => mkPrep [] "i" "ku" "na" "idin" "la" ; P NoPrep => mkPrep [] "i" "ku" "na" "idin" "la" ;
-- impersonal subject clitic combining with object clitics. -- impersonal subject clitic combining with object clitics.
passive => mkPrep "la" "la i" "lagu" "nala" "laydin" "la" Passive => mkPrep "la" "la i" "lagu" "nala" "laydin" "la"
} ; } ;
prepCombTable : Agreement => PrepCombination => Str = table { prepCombTable : Agreement => PrepCombination => Str = table {
Sg1 => table { ugu => "iigu" ; uga => "iiga" ; Sg1 => table { Ugu => "iigu" ; Uga => "iiga" ;
ula => "iila" ; kaga => "igaga" ; Ula => "iila" ; Kaga => "igaga" ;
kula => "igula" ; kala => "igala" ; Kula => "igula" ; Kala => "igala" ;
Single p => (prepTable ! p).s ! Sg1 } ; Single p => (prepTable ! p).s ! Sg1 } ;
Sg2 => table { ugu => "kuugu" ; uga => "kaaga" ; Sg2 => table { Ugu => "kuugu" ; Uga => "kaaga" ;
ula => "kuula" ; kaga => "kaaga" ; Ula => "kuula" ; Kaga => "kaaga" ;
kula => "kugula" ; kala => "kaala" ; Kula => "kugula" ; Kala => "kaala" ;
Single p => (prepTable ! p).s ! Sg2 } ; Single p => (prepTable ! p).s ! Sg2 } ;
Pl1 Excl => Pl1 Excl =>
table { ugu => "noogu" ; uga => "nooga" ; table { Ugu => "noogu" ; Uga => "nooga" ;
ula => "noola" ; kaga => "nagaga" ; Ula => "noola" ; Kaga => "nagaga" ;
kula => "nagula" ; kala => "nagala" ; Kula => "nagula" ; Kala => "nagala" ;
Single p => (prepTable ! p).s ! Pl1 Excl } ; Single p => (prepTable ! p).s ! Pl1 Excl } ;
Pl1 Incl => Pl1 Incl =>
table { ugu => "inoogu" ; uga => "inooga" ; table { Ugu => "inoogu" ; Uga => "inooga" ;
ula => "inoola" ; kaga => "inagaga" ; Ula => "inoola" ; Kaga => "inagaga" ;
kula => "inagula" ; kala => "inagala" ; Kula => "inagula" ; Kala => "inagala" ;
Single p => (prepTable ! p).s ! Pl1 Incl } ; Single p => (prepTable ! p).s ! Pl1 Incl } ;
Pl2 => table { Ugu => "idiinku" ; Uga => "idiinka" ;
Pl2 => table { ugu => "idiinku" ; uga => "idiinka" ; Ula => "idiinla" ; Kaga => "idinkaga" ;
ula => "idiinla" ; kaga => "idinkaga" ; Kula => "idinkula" ; Kala => "idinkala" ;
kula => "idinkula" ; kala => "idinkala" ;
Single p => (prepTable ! p).s ! Pl2 } ; Single p => (prepTable ! p).s ! Pl2 } ;
Impers => Impers =>
table { ugu => "loogu" ; uga => "looga" ; table { Ugu => "loogu" ; Uga => "looga" ;
ula => "loola" ; kaga => "lagaga" ; Ula => "loola" ; Kaga => "lagaga" ;
kula => "lagula" ; kala => "lagala" ; Kula => "lagula" ; Kala => "lagala" ;
Single p => (prepTable ! p).s ! Impers } ; Single p => (prepTable ! p).s ! Impers } ;
a => table { ugu => "ugu" ; uga => "uga" ; a => table { Ugu => "ugu" ; Uga => "uga" ;
ula => "ula" ; kaga => "kaga" ; Ula => "ula" ; Kaga => "kaga" ;
kula => "kula" ; kala => "kala" ; Kula => "kula" ; Kala => "kala" ;
Single p => (prepTable ! p).s ! a } Single p => (prepTable ! p).s ! a }
} ; } ;
-- TODO: Negationen má `inte' skrivs samman med en föregående preposition.
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- Adjectives -- Adjectives
@@ -620,7 +617,8 @@ oper
VerbPhrase : Type = Verb ** Complement ** { VerbPhrase : Type = Verb ** Complement ** {
adv : Str ; adv : Str ;
c2, c3 : Preposition ; -- can combine together and with object pronoun(s?) c2 : PrepositionPlus ; -- hack to allow passives
c3 : Preposition ; -- can combine together and with object pronoun(s?)
obj2 : {s : Str ; a : AgreementPlus} ; obj2 : {s : Str ; a : AgreementPlus} ;
secObj : Str ; -- if two overt pronoun objects secObj : Str ; -- if two overt pronoun objects
} ; } ;
@@ -631,17 +629,18 @@ oper
comp = \\_ => <[],[]> ; comp = \\_ => <[],[]> ;
pred = NoPred ; pred = NoPred ;
adv = [] ; adv = [] ;
c2,c3 = noPrep ; c2 = P NoPrep ;
c3 = NoPrep ;
obj2 = {s = [] ; a = Unassigned} ; obj2 = {s = [] ; a = Unassigned} ;
secObj = [] secObj = []
} ; } ;
useVc : Verb2 -> VPSlash = \v2 -> useV v2 ** { useVc : Verb2 -> VPSlash = \v2 -> useV v2 ** {
c2 = v2.c2 c2 = P v2.c2
} ; } ;
passV2 : Verb2 -> VerbPhrase = \v2 -> useV v2 ** { passV2 : Verb2 -> VerbPhrase = \v2 -> useV v2 ** {
c2 = passive ; c2 = Passive ;
c3 = v2.c2 ; c3 = v2.c2 ;
} ; } ;
@@ -649,8 +648,8 @@ oper
comp = \\agr => let cmp = vps.comp ! agr in 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. {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. -- 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. p2 = cmp.p2 ++ compl np.a vps} -- object combines with the preposition of the verb.
} ; -- secObj in case there was a ditransitive verb. } ;
compl : AgreementPlus -> VerbPhrase -> Str = \a,vp -> compl : AgreementPlus -> VerbPhrase -> Str = \a,vp ->
let agr = case a of {IsPron x => x ; _ => Pl3} ; let agr = case a of {IsPron x => x ; _ => Pl3} ;
@@ -687,12 +686,12 @@ oper
insertAdv : VerbPhrase -> Adverb -> VerbPhrase = \vp,adv -> insertAdv : VerbPhrase -> Adverb -> VerbPhrase = \vp,adv ->
case adv.c2 of { case adv.c2 of {
noPrep => vp ** {adv = adv.s} ; -- The adverb is not formed with PrepNP NoPrep => vp ** {adv = adv.s} ; -- The adverb is not formed with PrepNP
prep => case <vp.c2,vp.obj2.a,vp.c3> of { prep => case <vp.c2,vp.obj2.a,vp.c3> of {
<noPrep,Unassigned,_> => insertComp <vp ** {c2 = adv.c2}:VerbPhrase> adv.np ; -- should cover for obligatory argument that is not introduced with a preposition <P NoPrep,Unassigned,_> => insertComp (vp ** {c2 = P adv.c2}) adv.np ; -- should cover for obligatory argument that is not introduced with a preposition
<_,_, noPrep> => insertComp (vp ** {c3 = adv.c2}) adv.np ; <_ ,_ ,NoPrep> => insertComp (vp ** {c3 = adv.c2}) adv.np ;
-- if complement slots are full, put preposition just as a string. TODO check word order. -- if complement slots are full, put preposition just as a string. TODO check word order.
_ => vp ** {adv = (prepTable ! adv.c2).s ! adv.np.a ++ adv.np.s ! Abs} _ => vp ** {adv = (prepTable ! P adv.c2).s ! adv.np.a ++ adv.np.s ! Abs}
} }
} ; } ;
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@@ -709,11 +708,11 @@ oper
<Pres,Simul> => {fin = presV vp ; inf = [] } ; <Pres,Simul> => {fin = presV vp ; inf = [] } ;
<Pres,Anter> => {fin = presV copula ; inf = vp.s ! VInf } ; ---- just guessing <Pres,Anter> => {fin = presV copula ; inf = vp.s ! VInf } ; ---- just guessing
<Past,Simul> => {fin = pastV vp ; inf = [] } ; <Past,Simul> => {fin = pastV vp ; inf = [] } ;
<Past,Anter> => {fin = pastV (aux "jir" vp) ; inf = []} ; <Past,Anter> => {fin = pastV (cSug "jir") ; inf = vp.s ! VInf} ;
<Fut,Simul> => {fin = presV (aux "doon" vp) ; inf = []} ; <Fut,Simul> => {fin = presV (cSug "doon") ; inf = vp.s ! VInf} ;
<Fut,Anter> => {fin = pastV (aux "doon" vp) ; inf = []} ; <Fut,Anter> => {fin = pastV (cSug "doon") ; inf = vp.s ! VInf} ;
<_,Simul> => {fin = presV vp ; inf = []} ; -- TODO conditional <Cond,Simul> => {fin = presV have_V ; inf = vp.s ! VInf} ; -- TODO check
<_,Anter> => {fin = pastV vp ; inf = []} -- TODO conditional <Cond,Anter> => {fin = pastV have_V ; inf = vp.s ! VInf} -- TODO check
} }
where { where {
pastV : Verb -> Str = \v -> pastV : Verb -> Str = \v ->
@@ -721,9 +720,6 @@ oper
Pos => v.s ! VPast Simple agr } ; Pos => v.s ! VPast Simple agr } ;
presV : Verb -> Str = \v -> v.s ! VPres Simple agr p ; presV : Verb -> Str = \v -> v.s ! VPres Simple agr p ;
aux : Str -> Verb -> Verb = \jir,v ->
let jir : Verb = cSug jir in {s = \\vf => v.s ! VInf ++ jir.s ! vf}
} ; } ;
stmarker : Agreement => Polarity => Str = \\a,b => stmarker : Agreement => Polarity => Str = \\a,b =>

View File

@@ -10,34 +10,41 @@ lin
-- : NP -> VP -> Cl -- : NP -> VP -> Cl
PredVP np vps = PredVP np vps =
let vp = case vps.c2 of { let vp = case vps.c2 of {
passive => complSlash (insertComp vps np) ; Passive => complSlash (insertComp vps np) ;
_ => complSlash vps } ; _ => complSlash vps } ;
subj = case vps.c2 of {passive => impersNP ; _ => np} ; subj = case vps.c2 of {Passive => impersNP ; _ => np} ;
in { s = \\isQ,t,a,p => in { s = \\isQ,t,a,p =>
let predRaw : {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 { pred : {fin : Str ; inf : Str} = case <isQ,p,vp.pred> of {
NoCopula => {fin,inf = []} ; <False,Pos,NoCopula> => {fin,inf = []} ;
_ => predRaw _ => predRaw
} ; } ;
subjnoun : Str = if_then_Str np.isPron [] (subj.s ! Nom) ; subjnoun : Str = if_then_Str np.isPron [] (subj.s ! Nom) ;
subjpron : 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 ; obj : {p1,p2 : Str} =
stm : Str = let o : {p1,p2 : Str} = vp.comp ! subj.a ;
case <isQ,p,vp.pred,subj.a> of { in case p of {
<True,_,_,_> => "ma" ; Pos => o ;
<_,Pos,Copula|NoCopula,Sg3 _|Impers> => "waa" ; Neg => {p2 = [] ; p1 = o.p1 ++ o.p2 ++ BIND} -- object pronoun, prepositions and negation all contract
-- _ => stmarker ! np.a ! b } -- marker+pronoun contract } ;
_ => case <np.isPron,p> of { stm : Str = case <isQ,p,vp.pred,subj.a> of {
<True,Pos> => "waa" ++ subjpron ; -- to force some string from NP to show in the tree <False,Pos,Copula|NoCopula,Sg3 _|Impers> => "waa" ;
<True,Neg> => "ma" ++ subjpron ; <True ,Pos,_ ,_ > => "ma" ;
<False> => stmarkerNoContr ! subj.a ! p }} ; _ => case <np.isPron,p> of {
<True,Pos> => "waa" ++ subjpron ; -- to force some string from NP to show in the tree
<True,Neg> => "ma" ++ subjpron ;
<False> => stmarkerNoContr ! subj.a ! p
}
} ;
in subjnoun -- subject if it's a noun in subjnoun -- subject if it's a noun
++ obj.p1 -- object if it's a noun ++ obj.p1 -- object if it's a noun
++ stm -- sentence type marker + possible subj. pronoun ++ stm -- sentence type marker + possible subj. pronoun
++ vp.adv ---- TODO word order ++ vp.adv ---- TODO word order
++ obj.p2 -- object if it's a pronoun ++ obj.p2 -- object if it's a pronoun
++ vp.secObj -- "second object"
++ pred.inf -- potential infinitive/participle
++ pred.fin -- the verb inflected ++ pred.fin -- the verb inflected
++ pred.inf -- potential participle
} ; } ;
{- {-
-- : SC -> VP -> Cl ; -- that she goes is good -- : SC -> VP -> Cl ; -- that she goes is good

View File

@@ -12,7 +12,7 @@ lin
PassV2 = ResSom.passV2 ; PassV2 = ResSom.passV2 ;
{- {-
-- : VV -> VP -> VP ; -- : VV -> VP -> VP ;
ComplVV vv vp = ; ComplVV vv vp = ; -- TODO Sayeed p. 169
-- : VS -> S -> VP ; -- : VS -> S -> VP ;
ComplVS vs s = ; ComplVS vs s = ;
@@ -96,7 +96,7 @@ lin
-- : VP -> Prep -> VPSlash ; -- live in (it) -- : VP -> Prep -> VPSlash ; -- live in (it)
-- NB. We need possibly a MissingArg kind of solution here too -- NB. We need possibly a MissingArg kind of solution here too
-- VPSlashPrep vp prep = vp ** -- VPSlashPrep vp prep = vp **
-- { c2 = case vp.c2 of { noPrep => prep.prep ; -- { c2 = case vp.c2 of { NoPrep => prep.prep ;
-- x => x }} ; -- x => x }} ;
@@ -133,7 +133,7 @@ lin
CompAdv adv = { CompAdv adv = {
comp = \\a => comp = \\a =>
<if_then_Str adv.np.isPron [] (adv.np.s ! Abs) <if_then_Str adv.np.isPron [] (adv.np.s ! Abs)
, adv.s ++ prepCombTable ! adv.np.a ! Single adv.c2> ; , adv.s ++ prepCombTable ! adv.np.a ! Single (P adv.c2)> ;
pred = Copula ; pred = Copula ;
} ; } ;