1
0
forked from GitHub/gf-rgl

Merge pull request #89 from inariksit/somali

(Som) Improvements in noun and verb paradigms
This commit is contained in:
Inari Listenmaa
2018-11-29 13:34:07 +01:00
committed by GitHub
4 changed files with 150 additions and 81 deletions

View File

@@ -18,8 +18,8 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in {
case <c,cn.hasMod,det.d> of {
<Nom,True, Indef Sg> => {nf=Indef Sg ; c=Abs} ;
<Nom,False,Indef Sg> => {nf=IndefNom ; c=Nom} ; -- special form for fem. nouns
<Nom,True,Def x A> => {nf=Def x A ; c=Abs} ;
<Nom,False,Def x A> => {nf=Def x U ; c=Nom} ;
<Nom,True,Def x vA> => {nf=Def x vA ; c=Abs} ;
<Nom,False,Def x vA> => {nf=Def x vU ; c=Nom} ;
_ => {nf=det.d ; c=c}
} ;
in cn.s ! nfc.nf

View File

@@ -48,18 +48,27 @@ oper
--2 Adjectives
mkA : (yar : Str) -> CatSom.A ;
mkA : overload {
mkA : (yar : Str) -> A ;
mkA : (sg,pl : Str) -> A
} ;
-- mkA2 : Str -> Prep -> A2 ;
--2 Verbs
-- Smart paradigms
mkV : Str -> V ;
-- Verbs
mkV : overload {
mkV : (imp : Str) -> V ; -- Predictable verb: imperative form as argument
mkV : (imp,sg1,pl2 : Str) -> V ; -- Less predictable verb: imperative, 1st person singular and 2nd person plural
mkV : Str -> V -> V -- Add a prefix to an existing verb, e.g. u baahan+ahay
} ;
copula : V ; -- The copula verb 'ahay'
mkV2 : overload {
mkV2 : (akhri : Str) -> V2 ; -- Regular verbs, no preposition
mkV2 : (_ : Str) -> (_ku : Preposition) -> V2 ; -- Regular verb, prep.
mkV2 : (sug : Str) -> V2 ; -- Predictable verb: imperative form, no preposition
mkV2 : (sug : Str) -> (_ku : Preposition) -> V2 ; -- Regular verb, imperative and preposition
mkV2 : V -> Preposition -> V2 ; -- Already constructed verb with preposition
} ;
@@ -81,11 +90,11 @@ oper
--2 Structural categories
mkPrep = overload {
mkPrep : Str -> Prep = \s ->
mkPrep : Str -> CatSom.Prep = \s ->
lin Prep (ResSom.mkPrep s s s s s s) ;
mkPrep : (x1,_,_,_,_,x6 : Str) -> Prep = \a,b,c,d,e,f ->
mkPrep : (x1,_,_,_,_,x6 : Str) -> CatSom.Prep = \a,b,c,d,e,f ->
lin Prep (ResSom.mkPrep a b c d e f) ;
mkPrep : Preposition -> Prep = \p ->
mkPrep : Preposition -> CatSom.Prep = \p ->
lin Prep (prepTable ! p) ;
} ;
@@ -136,24 +145,33 @@ oper
mkN : Str -> Gender -> N = \s,g -> lin N (mkNg s g) ;
mkN : (_,_ : Str) -> Gender -> N = \s,t,g -> lin N (nMaalin s t g) ;
--mkN : N -> Gender -> N = \n,g -> n ** {g = g }
} ;
} ;
mkPN = overload {
mkPN : Str -> PN = \s -> lin PN (mkPNoun s sgMasc) ;
mkPN : Str -> Agr -> PN = \s,a -> lin PN (mkPNoun s a)
} ;
mkA : (yar : Str) -> CatSom.A = \s -> lin A (mkAdj s) ;
mkA = overload {
mkA : (yar : Str) -> A = \s -> lin A (duplA s) ;
mkA : (sg,pl : Str) -> A = \s,p -> lin A (mkAdj s p)
} ;
mkV : Str -> V = \s -> lin V (regV s) ;
mkV = overload {
mkV : (imp : Str) -> V = \v -> lin V (regV v) ;
mkV : (imp,pl2,sg1 : Str) -> V = \i,p,s -> lin V (mkVerb i p s) ;
mkV : Str -> V -> V = \s,v -> lin V (prefixV s v)
} ;
regV : Str -> Verb = \s -> cSug s ; --case s of {
-- _ + #c + #c + "o" => cJoogso s ;
-- _ + "o" => cQaado s ; ----
-- _ + "i" => cKari s ;
-- _ + "ee" => cYaree s ;
-- _ => cSug s
-- } ;
copula = ResSom.copula ;
regV : Str -> Verb = \s -> case s of {
-- _ + g@#c + s@#c + "o" => cJoogso s ;
_ + "o" => cQaado s ; ----
_ + "i" => cKari s ;
_ + "ee" => cYaree s ;
_ => cSug s
} ;
mkV2 = overload {
mkV2 : Str -> V2 = \s -> lin V2 (regV s ** {c2 = noPrep}) ;

View File

@@ -6,6 +6,7 @@ resource ParamSom = ParamX ** open Prelude in {
oper
--TODO: make patterns actually adjusted to Somali
v : pattern Str = #("a" | "e" | "i" | "o" | "u") ;
vstar : pattern Str = #("a" | "e" | "i" | "o" | "u" | "y" | "w") ; -- semivowels included
vv : pattern Str = #("aa" | "ee" | "ii" | "oo" | "uu") ;
c : pattern Str = #("m"|"n"|"p"|"b"|"t"|"d"|"k"|"g"|"f"|"v"
|"s"|"h"|"l"|"j"|"r"|"z"|"c"|"q"|"y"|"w");
@@ -54,7 +55,7 @@ oper
param
Case = Nom | Abs ;
Gender = Masc | Fem ;
Vowel = A | E | I | O | U ; -- For vowel assimilation
Vowel = vA | vE | vI | vO | vU ; -- For vowel assimilation
Inclusion = Excl | Incl ;
Agreement =
@@ -128,9 +129,8 @@ param
| VPres Agreement Polarity
| VNegPast
| VPast Agreement
| VFut -- agreement comes from auxiliary
| VRel -- "som är/har/…" TODO is this used in other verbs?
| VImp Number ; -- TODO negation
| VImp Number Polarity ; -- TODO negation
oper
if_then_Pol : Polarity -> Str -> Str -> Str = \p,t,f ->

View File

@@ -23,11 +23,11 @@ oper
Masc => wiil } ;
defStems : Str -> Vowel => Str = \s -> case s of {
ilk + "aha" =>
table { A => ilk+"ah" ;
E => ilk+"eh" ;
I => ilk+"ih" ;
O => ilk+"oh" ;
U => ilk+"uh"
table { vA => ilk+"ah" ;
vE => ilk+"eh" ;
vI => ilk+"ih" ;
vO => ilk+"oh" ;
vU => ilk+"uh"
} ;
_ => table { _ => init s }
} ;
@@ -242,24 +242,40 @@ oper
-- Motsvarigheten till svenskans superlativ bildas med prepositionsklustret ugú som till sin betydelse närmast motsvarar svenskans allra, t.ex.
-- ugu horrayntii (det att komma) allra först
Adjective : Type = { s : AForm => Str } ;
Adjective : Type = {s : AForm => Str} ;
Adjective2 : Type = Adjective ** { c2 : Preposition } ;
mkAdj : Str -> Adjective = \yar ->
let yaryar = duplicate yar
in { s = table {
AF Sg Abs => yar ;
AF Pl Abs => yaryar ;
AF Sg Nom => yar + "i" ;
AF Pl Nom => yaryar + "i" }
} ;
duplicate : Str -> Str = \yar -> case yar of {
duplA : Str -> Adjective = \yar ->
let yaryar = duplicate yar
in mkAdj yar yaryar ;
mkAdj : (str,pl : Str) -> Adjective = \sg,pl -> {
s = table {
AF Sg Abs => sg ;
AF Pl Abs => pl ;
AF Sg Nom => sg + "i" ;
AF Pl Nom => pl + "i" }
} ;
duplicate : Str -> Str = \sg -> case sg of {
-- some hard-coded cases; in general, better to
-- use 2-paradigm mkAdj for irregular adjectives.
"dheer" => "dhaadheer" ;
"weyn" => "waaweyn" ; -- TODO eventually handle irregular adjectives elsewhere
y@#c + a@#v + r@#c + _ => y + a + r + yar ;
g@#c + aa@#vv + _ => g + aa + yar ; --TODO: proper patterns
_ => yar + ":plural" } ;
"weyn" => "waaweyn" ;
-- general patterns
a@#v + d@#c + ? + ? -- 4 letters of form CVXX
=> a + d + sg ; -- ad+adag
g@#c + aa@#vv + _
=> g + aa + sg ; -- gaa+gaaban
y@#c + a@#v + r@#c + _
=> y + a + r + sg ; -- yar+yar ; fud+fudud
d@#c + h@#c + uu@#vv + _
=> d + h + uu + sg ; -- dhuu+dhuuban
q@#c + a@#v + y@#vstar + b@#c + _
=> q + a + y + b + sg ; --qayb+qaybsan, fiic+fiican
_ => sg + sg } ;
AdjPhrase : Type = Adjective ;
--------------------------------------------------------------------------------
@@ -272,25 +288,38 @@ oper
-- Saeed page 79:
-- "… the reference form is the imperative singular form
-- since it corresponds to the form of the basic root."
mkVerb : (x1,x2 : Str) -> Verb = \ark,qaat ->
mkVerb : (imperative,sg1,pl2 : Str) -> Verb = \qaado,qaat,ark ->
let stems : {p1 : Str ; p2 : Str} = case ark of {
a + r@#c + k@#c => <ark + "i", a + r + a + voiced k> ;
yar + "ee" => <ark + "n", yar + "ey"> ;
_ => <ark + "n", ark> } ;
a + r@#c + k@#c -- two consonants need a vowel in between
=> <ark + "i", a + r + a + voiced k> ;
_ + #c -- if the pl2 root ends in consonant, infinitive needs a vowel
=> <ark + "i", ark> ;
yar + "ee" -- double e turns into ey
=> <ark + "n", yar + "ey"> ;
_ => <ark + "n", ark> -- no changes, just add n for infinitive
} ;
arki = stems.p1 ;
arag = stems.p2 ;
arkin = case last arki of { "n" => arki ; _ => arki + "n" } ;
t : Str = case arag of {
_ + ("i"|"y") => "s" ;
_ => "t" } ;
arkin = case last arki of { -- The negative past tense ends in n:
"n" => arki ; -- if infinitive ends in n, no change;
_ => arki + "n" } ; -- otherwise add n.
-- Some predictable sound changes
t : Str = case arag of { -- kari+seen, noq+deen, (sug|joogsa|qaada)+teen,
_ + ("i"|"y") => "s" ; -- t changes into s in front of i/y
_ + ("x"|"q"|"c") => "d" ; -- t changes into d in front of x/q/c
_ => "t" } ;
ay : Str = case ark of {
_ + ("i"|"e") => "ey" ;
_ => "ay" } ;
n : Str = case arag of {
_ + #v => "nn" ;
_ + #v => "nn" ; -- n duplicates after vowel
_ => "n" } ;
an : Str = case qaado of {
_ + "o" => "an" ; -- Allomorph for imperatives
_ => "in" } ;
in { s = table {
VPres (Sg1|Sg3 Masc) pol
VPres (Sg1|Sg3 Masc|Impers) pol
=> qaat + if_then_Pol pol "aa" "o" ;
VPres (Sg2|Sg3 Fem) pol
=> arag + t + if_then_Pol pol "aa" "o" ;
@@ -299,19 +328,22 @@ oper
VPres Pl2 pol => arag + t + "aan" ;
VPres Pl3 pol => qaat + "aan" ;
VPast (Sg1|Sg3 Masc)
VPast (Sg1|Sg3 Masc|Impers)
=> qaat + ay ;
VPast (Sg2|Sg3 Fem)
=> arag + t + ay ;
=> arag + t + ay ; -- t, d or s
VPast (Pl1 _) => arag + n + ay ;
VPast Pl2 => arag + t + "een" ; -- kari+seen, (sug|joogsa|qaada)+teen
VPast Pl2 => arag + t + "een" ; -- t, d or s
VPast Pl3 => qaat + "een" ;
VImp Sg => arag ;
VImp Pl => qaat + "a" ; -- TODO: allomorphs, page 86 in Saeed
VInf => arki ;
VNegPast => arkin ;
_ => "TODO" }
VImp Sg Pos => qaado ;
VImp Pl Pos => qaat + "a" ;
VImp Sg Neg => arag + an ;
VImp Pl Neg => qaat + "ina" ;
VInf => arki ;
VRel => arki ; -- TODO does this exist?
VNegPast => arkin }
} ;
-------------------------
@@ -319,17 +351,28 @@ oper
cSug, cKari, cYaree, cJoogso, cQaado : Str -> Verb ;
cSug sug = mkVerb sug sug ; -- TODO: stem/dictionary form of verbs with consonant clusters?
cSug sug =
let cabb : Str = case sug of {
_ + "b" => sug + "b" ; -- TODO: more duplication patterns
_ => sug }
in mkVerb sug cabb sug ;
cKari, cYaree = \kari -> mkVerb kari (kari+"y") ;
cKari, cYaree = \kari -> mkVerb kari (kari+"y") kari ;
cJoogso joogso =
let joogsa = init joogso + "a" ;
in mkVerb joogsa (joogsa + "d") ;
in mkVerb joogso (joogsa + "d") joogsa ;
cQaado qaado =
let qaa = drop 2 qaado
in mkVerb (qaa + "da") (qaa + "t") ;
in mkVerb qaado -- Imperative sg, with the vowel
(qaa + "t") -- Per1 Sg, Per3 Pl and Per3 Sg Masc
(qaa + "da") ; -- Per2 Pl and others
-- Constructs verbs like u baahan+ahay
prefixV : Str -> Verb -> Verb = \s,v -> {
s = \\vf => s + v.s ! vf
} ;
------------------
-- Irregular verbs
@@ -343,6 +386,8 @@ oper
VPres (Pl1 _) pol => if_then_Pol pol "nahay" "ihin" ;
VPres Pl2 pol => if_then_Pol pol "tihiin" "ihidin" ;
VPres Pl3 pol => if_then_Pol pol "yihiin" "aha" ;
VImp Sg pol => if_then_Pol pol "ahaw" "ahaanin" ;
VImp Pl pol => if_then_Pol pol "ahaada" "ahaanina" ;
VPast (Sg1|Sg3 Masc|Impers)
=> "ahaa" ;
@@ -352,26 +397,29 @@ oper
VPast Pl2 => "ahaydeen" ;
VPast Pl3 => "ahaayeen" ;
VNegPast => "ahi" ;
VRel => "ah" ;
_ => "TODO:copula" }
VRel => "ah" ;
VInf => "ahaan" }
} ;
-- I somaliskan används inte något kopulaverb motsvarande svenskans är mellan
-- två substantivfraser som utgör subjekt respektive predikatsfyllnad.
-- Observera också att kopulaverbet vara alltid hamnar efter det adjektiv
-- som utgör predikatsfyllnaden.
have_V : Verb = {
have_V : Verb =
let hold_V = mkVerb "hayso" "haysat" "haysa" in {
s = table {
VPres Sg1 _ => "leeyahay" ;
VPres Sg2 _ => "leedahay" ;
VPres (Sg3 Fem) _ => "leedahay" ;
VPres (Sg3 Masc)_ => "leeyahay" ;
VPres (Pl1 _) _ => "leenahay" ;
VPres Pl2 _ => "leedihiin" ;
VPres Pl3 _ => "leeyihiin" ;
VPast x => "l" + copula.s ! VPast x ;
VRel => "leh" ;
_ => "TODO:have_V" } ;
VPres Sg1 Pos => "leeyahay" ;
VPres Sg2 Pos => "leedahay" ;
VPres (Sg3 Fem) Pos => "leedahay" ;
VPres (Sg3 Masc|Impers) Pos
=> "leeyahay" ;
VPres (Pl1 _) Pos => "leenahay" ;
VPres Pl2 Pos => "leedihiin" ;
VPres Pl3 Pos => "leeyihiin" ;
VPast x => "l" + copula.s ! VPast x ;
VRel => "leh" ;
x => hold_V.s ! x }
} ;
-- Till VERBFRASEN ansluter sig
-- · satstypsmarkörer (waa, ma...),
-- · subjekts-pronomenet la man,
@@ -418,6 +466,9 @@ oper
ClSlash,
Sentence : Type = SS ; ---- TODO
doonaa : Str -> Verb = \inf ->
let doon : Verb = cSug "doon" in {s = \\vf => inf ++ doon.s ! vf} ;
vf : Tense -> Anteriority -> Polarity -> Agreement -> Verb
-> {fin : Str ; inf : Str} = \t,ant,p,agr,vp ->
let pastV : Verb -> Str = \v ->
@@ -429,10 +480,10 @@ oper
<Pres,Anter> => {fin = presV copula ; inf = vp.s ! VInf } ; ---- just guessing
<Past,Simul> => {fin = pastV vp ; inf = [] } ;
<Past,Anter> => {fin = pastV copula ; inf = vp.s ! VInf } ; ---- TODO: habitual aspect
<_Fut,Simul> => {fin = presV copula ; inf = vp.s ! VFut} ;
<_Fut,Anter> => {fin = pastV copula ; inf = vp.s ! VFut}
-- <Cond,Simul> => {fin = ? ; inf = ?} ; -- TODO conditional
-- <Cond,Anter> => {fin = ? ; inf = ?} -- TODO conditional
<Fut,Simul> => {fin = presV (doonaa (vp.s ! VInf)) ; inf = []} ;
<Fut,Anter> => {fin = pastV (doonaa (vp.s ! VInf)) ; inf = []} ;
<_,Simul> => {fin = presV vp ; inf = []} ; -- TODO conditional
<_,Anter> => {fin = pastV vp ; inf = []} -- TODO conditional
} ;
stmarker : Agreement => Polarity => Str = \\a,b =>