(Som) Shaving off parameters here and there

This commit is contained in:
Inari Listenmaa
2019-07-20 18:35:19 +03:00
parent 2efd8435ae
commit 89b52b89f9
8 changed files with 177 additions and 147 deletions

View File

@@ -11,7 +11,7 @@ lin
-- ComparAdvAdjS : CAdv -> A -> S -> Adv ; -- more warmly than he runs -- ComparAdvAdjS : CAdv -> A -> S -> Adv ; -- more warmly than he runs
-- : Prep -> NP -> Adv ; -- : Prep -> NP -> Adv ;
PrepNP prep np = prep ** {s = [] ; np = np} ; PrepNP prep np = prep ** {s = [] ; np = nplite np} ;
-- Adverbs can be modified by 'adadjectives', just like adjectives. -- Adverbs can be modified by 'adadjectives', just like adjectives.

View File

@@ -187,7 +187,7 @@ lin house_N = mkN "guri" ;
-- lin industry_N = mkN "" ; -- lin industry_N = mkN "" ;
-- lin iron_N = mkN "" ; -- lin iron_N = mkN "" ;
-- lin john_PN = mkPN "Jon" ; -- lin john_PN = mkPN "Jon" ;
-- lin jump_V = mkV "" ; lin jump_V = mkV "bood" ;
-- lin kill_V2 = mkV2 "" ; -- lin kill_V2 = mkV2 "" ;
-- lin king_N = mkN "" ; -- lin king_N = mkN "" ;
-- lin knee_N = mkN "" ; -- lin knee_N = mkN "" ;

View File

@@ -7,11 +7,11 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in {
--2 Noun phrases --2 Noun phrases
-- : Det -> CN -> NP -- : Det -> CN -> NP
DetCN det cn = useN cn ** { DetCN det cn = useN cn ** {
s = sTable ; s = sTable ;
a = getAgr det.n (gender cn) } where { a = getAgr det.n (gender cn) } where {
sTable : Case => Str = \\c => sTable : Case => Str = \\c =>
let nfc : {nf : NForm ; c : Case} = let nfc : {nf : NForm ; c : Case} =
case <det.isNum,c,cn.hasMod,det.st,det.n> of { case <det.isNum,c,cn.hasMod,det.st,det.n> of {
-- Numbers -- Numbers
<True,_,_,_,_> => {nf=Numerative ; c=c} ; <True,_,_,_,_> => {nf=Numerative ; c=c} ;
@@ -26,7 +26,7 @@ DetCN det cn = useN cn ** {
<_,Nom,True,_,_> => {nf=Def det.n ; c=Abs} ; <_,Nom,True,_,_> => {nf=Def det.n ; c=Abs} ;
_ => {nf=Def det.n ; c=c} -- TODO check _ => {nf=Def det.n ; c=c} -- TODO check
} ; } ;
art = case det.n of {Sg => cn.sg ; Pl => cn.pl} ; art = gda2da cn.gda ! det.n ;
num = case det.isNum of {True => Sg ; _ => det.n} ; num = case det.isNum of {True => Sg ; _ => det.n} ;
dt : {pref,s : Str} = dt : {pref,s : Str} =
case <nfc.nf,cn.isPoss,andB det.isPoss cn.shortPoss> of { case <nfc.nf,cn.isPoss,andB det.isPoss cn.shortPoss> of {
@@ -159,7 +159,7 @@ DetCN det cn = useN cn ** {
-} -}
-- : Quant -- : Quant
DefArt = defQuant "a" "kan" "tan" "kuwan" NA ; DefArt = defQuant "a" "kan" "tan" "kuwan" False ;
-- : Quant -- : Quant
IndefArt = indefQuant ** {sp = \\gn,c => "1"} ; -- TODO sp forms IndefArt = indefQuant ** {sp = \\gn,c => "1"} ; -- TODO sp forms
@@ -190,11 +190,11 @@ DetCN det cn = useN cn ** {
Def n => n ; Def n => n ;
Indef n => n ; Indef n => n ;
_ => Sg } ; _ => Sg } ;
art = case num of {Sg => cn.sg ; Pl => cn.pl} ; art = gda2da cn.gda ! num ;
qnt = PossPron (pronTable ! np.a) ; qnt = PossPron (pronTable ! np.a) ;
det = case cn.shortPoss of { det = case cn.shortPoss of {
True => qnt.shortPoss ! art ; True => qnt.shortPoss ! art ;
_ => qnt.s ! n2.sg ! Abs } ; _ => qnt.s ! sg n2.gda ! Abs } ;
noun = case np.isPron of { noun = case np.isPron of {
True => (pronTable ! np.a).sp ; -- long subject pronoun True => (pronTable ! np.a).sp ; -- long subject pronoun
False => np.s ! Abs } False => np.s ! Abs }

View File

@@ -123,7 +123,7 @@ oper
mkAdv : Str -> Adv = \s -> lin Adv { mkAdv : Str -> Adv = \s -> lin Adv {
berri = s ; berri = s ;
c2 = noPrep ; c2 = noPrep ;
np = emptyNP ; np = {s = [] ; a = NotPronP3} ;
sii,dhex = [] sii,dhex = []
} ; } ;

View File

@@ -27,16 +27,43 @@ param
-- Allomorphs for the definite article -- Allomorphs for the definite article
DefTA = TA | DA | SHA | DHA ; DefTA = TA | DA | SHA | DHA ;
DefKA = KA | GA | A_ | HA ; DefKA = KA | GA | A_ | HA ;
DefArticle = M DefKA | F DefTA ; DefArticle = F DefTA | M DefKA ;
GenderDefArt = FM DefTA DefKA
| MF DefKA DefTA
| MM DefKA DefKA ;
oper oper
defAllomorph : Str -> DefArticle = \wiilka -> sg : GenderDefArt -> DefArticle = \gda -> gda2da gda ! Sg ;
case wiilka of { pl : GenderDefArt -> DefArticle = \gda -> gda2da gda ! Pl ;
_ + "ta" => F DA ; _ + "sha" => F SHA ;
_ + "da" => F DA ; _ + "dha" => F DHA ; gda2da : GenderDefArt -> Number => DefArticle = \gda ->
_ + "ka" => M KA ; _ + "aha" => M HA ; let da : {sg,pl:DefArticle} = case gda of {
_ + "ga" => M GA ; _ => M A_ } ; FM s p => {sg = F s ; pl = M p} ;
MM s p => {sg = M s ; pl = M p} ;
MF s p => {sg = M s ; pl = F p} } ;
in table {Sg => da.sg ; Pl => da.pl} ;
defAllomorph : (_,_ : Str) -> GenderDefArt = \wiilka,wiilasha ->
case <getGender wiilka, getGender wiilasha> of {
<Masc,Fem> => MF (allomM wiilka) (allomF wiilasha) ;
<Masc,Masc> => MM (allomM wiilka) (allomM wiilasha) ;
_ => FM (allomF wiilka) (allomM wiilasha)
} where {
allomF : Str -> DefTA = \wiilka ->
case wiilka of {
_ + "ta" => DA ; _ + "sha" => SHA ;
_ + "da" => DA ; _ + "dha" => DHA } ;
allomM : Str -> DefKA = \wiilka ->
case wiilka of {
_ + "ka" => KA ; _ + "aha" => HA ;
_ + "ga" => GA ; _ + "a" => A_ } ;
getGender : Str -> Gender = \word ->
case word of {
_ + ("ta"|"sha"|"da"|"dha") => Fem ;
_ + "a" => Masc ;
_ => Predef.error ("defAllomorph: expecting definite form, given" ++ word)}
} ;
-- Use always via quantTable! -- Use always via quantTable!
defStems : DefArticle => Str = table { defStems : DefArticle => Str = table {
@@ -97,7 +124,6 @@ oper
param param
Case = Nom | Abs ; Case = Nom | Abs ;
Gender = Masc | Fem ; Gender = Masc | Fem ;
Vowel = vA | vE | vI | vO | vU | NA ; -- For vowel assimilation
GenNum = SgMasc | SgFem | PlInv ; -- For Quant GenNum = SgMasc | SgFem | PlInv ; -- For Quant
Inclusion = Excl | Incl ; Inclusion = Excl | Incl ;
@@ -111,8 +137,7 @@ param
| Impers ; -- Verb agrees with Sg3, but needed for preposition contraction | Impers ; -- Verb agrees with Sg3, but needed for preposition contraction
AgreementPlus = AgreementPlus =
Unassigned -- Dummy value: shows that the slot for object hasn't been filled. IsPron Agreement -- Any of Sg1 … Pl3 can be a pronoun.
| IsPron Agreement -- Any of Sg1 … Pl3 can be a pronoun.
| NotPronP3 ; -- Sg3 Gender and Pl3 can be pronouns or not. | NotPronP3 ; -- Sg3 Gender and Pl3 can be pronouns or not.
State = Definite | Indefinite ; State = Definite | Indefinite ;
@@ -130,6 +155,9 @@ oper
agr2agrplus : (isPron : Bool) -> Agreement -> AgreementPlus = \isPron,a -> agr2agrplus : (isPron : Bool) -> Agreement -> AgreementPlus = \isPron,a ->
case isPron of {True => IsPron a ; False => NotPronP3} ; case isPron of {True => IsPron a ; False => NotPronP3} ;
agrplus2agr : AgreementPlus -> Agreement = \a ->
case a of {IsPron a => a ; _ => Pl3} ;
isP3 = overload { isP3 = overload {
isP3 : Agreement -> Bool = \agr -> isP3 : Agreement -> Bool = \agr ->
case agr of {Sg3 _ | Pl3 | Impers => True ; _ => False} ; case agr of {Sg3 _ | Pl3 | Impers => True ; _ => False} ;
@@ -137,18 +165,12 @@ oper
case agr of { case agr of {
IsPron (Sg3 _ | Pl3 | Impers) => True ; IsPron (Sg3 _ | Pl3 | Impers) => True ;
NotPronP3 => True ; NotPronP3 => True ;
Unassigned => True ; -- meaningful for "does it leave an overt pronoun" -- Unassigned => True ; -- meaningful for "does it leave an overt pronoun"
_ => False} _ => False}
} ; } ;
-- gn2gennum : Gender -> Number -> GenNum = \g,n -> gender : {gda : GenderDefArt} -> Gender = \n ->
-- case <g,n> of { case n.gda of {FM _ _ => Fem ; _ => Masc} ;
-- <Masc,Sg> => SgMasc ;
-- <Fem,Sg> => SgFem ;
-- _ => PlInv } ;
gender : {sg : DefArticle} -> Gender = \n ->
case n.sg of {M _ => Masc ; F _ => Fem} ;
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- Numerals -- Numerals
@@ -179,7 +201,7 @@ oper
let oneWay : PrepositionPlus => Preposition => PrepCombination = let oneWay : PrepositionPlus => Preposition => PrepCombination =
\\x,y => case <x,y> of { \\x,y => case <x,y> of {
<Passive,NoPrep> => Single Passive ; <Passive,NoPrep> => Single Passive ;
<Passive,p> => Single (P p) ; -- TODO check if this ever happens <Passive,p> => Single (P p) ; -- FIXME p "waa lagu arkay" gives infinitely many trees now, because the passive is ignored here. Is there a combination for passive + personal pronoun + preposition?
<P z,_> => case <z,y> of { <P z,_> => case <z,y> of {
<U,U|Ku> => Ugu ; <U,U|Ku> => Ugu ;
<U,Ka> => Uga ; <U,Ka> => Uga ;
@@ -226,12 +248,19 @@ param
VForm = VForm =
VInf VInf
| VPres Aspect Agreement Polarity | VPres Aspect VAgr Polarity
| VNegPast Aspect | VNegPast Aspect
| VPast Aspect Agreement | VPast Aspect VAgr
| VRel -- "som är/har/…" TODO is this used in other verbs? | VRel -- "som är/har/…" TODO is this used in other verbs?
| VImp Number Polarity ; | VImp Number Polarity ;
VAgr =
Sg1_Sg3Masc
| Sg2_Sg3Fem
| Pl1_
| Pl2_
| Pl3_ ;
PredType = NoPred | Copula | NoCopula ; PredType = NoPred | Copula | NoCopula ;
oper oper
@@ -239,9 +268,14 @@ oper
case p of {Pos => t ; Neg => f } ; case p of {Pos => t ; Neg => f } ;
forceAgr : Agreement -> (VForm=>Str) -> (VForm=>Str) = \agr,tbl -> table { forceAgr : Agreement -> (VForm=>Str) -> (VForm=>Str) = \agr,tbl -> table {
VPres asp _a pol => tbl ! VPres asp agr pol ; VPres asp _a pol => tbl ! VPres asp (agr2vagr agr) pol ;
VPast asp _a => tbl ! VPast asp agr ; VPast asp _a => tbl ! VPast asp (agr2vagr agr) ;
x => tbl ! x x => tbl ! x
} ; } ;
agr2vagr : Agreement -> VAgr = \agr -> case agr of {
Sg1|Sg3 Masc|Impers => Sg1_Sg3Masc ;
Sg2|Sg3 Fem => Sg2_Sg3Fem ;
Pl1 _ => Pl1_ ; Pl2 => Pl2_ ; Pl3 => Pl3_
} ;
} }

View File

@@ -6,8 +6,7 @@ oper
Noun : Type = { Noun : Type = {
s : NForm => Str ; s : NForm => Str ;
sg, gda : GenderDefArt ;
pl : DefArticle ;
shortPoss : Bool ; shortPoss : Bool ;
} ; } ;
Noun2 : Type = Noun ; -- TODO eventually more parameters? Noun2 : Type = Noun ; -- TODO eventually more parameters?
@@ -33,8 +32,7 @@ oper
-- Special forms for feminine nouns -- Special forms for feminine nouns
NomSg => bisadi ; Numerative => bisadood NomSg => bisadi ; Numerative => bisadood
} ; } ;
sg = defAllomorph wiilka ; gda = defAllomorph wiilka wiilasha ;
pl = defAllomorph wiilasha ;
shortPoss = False shortPoss = False
} where { } where {
hooya : Str = case wiilka of { hooya : Str = case wiilka of {
@@ -141,6 +139,15 @@ oper
NounPhrase : Type = BaseNP ** {s : Case => Str} ; NounPhrase : Type = BaseNP ** {s : Case => Str} ;
NPLite : Type = {s : Str ; a : AgreementPlus} ; -- Used in Adv and as an object in VP
nplite : NounPhrase -> NPLite = \np ->
let aplus : AgreementPlus = agr2agrplus np.isPron np.a in
case <np.isPron,np.a> of {
<False,_> => {s = np.s ! Abs ; a = aplus} ;
-- <True,(Sg3 _|Pl3)> => {s = np.empty ++ (pronTable ! np.a).sp ; a = aplus} ; -- uncomment if you want to add long object pronoun for 3rd person object
_ => {s = np.empty ; a = aplus} } ; -- no long object for other pronouns
useN : Noun -> CNoun ** BaseNP = \n -> n ** useN : Noun -> CNoun ** BaseNP = \n -> n **
{ mod = \\_,_ => [] ; hasMod = False ; { mod = \\_,_ => [] ; hasMod = False ;
a = Sg3 (gender n) ; isPron,isPoss = False ; a = Sg3 (gender n) ; isPron,isPoss = False ;
@@ -228,15 +235,13 @@ oper
} }
} ; } ;
-- Second series object pronouns, Sayeed p. 74-75 secondObject : AgreementPlus => Str = table {
-- For two non-3rd person object pronouns, e.g. "They took you away from me" IsPron Sg1 => "kay" ;
secondObject : Agreement => Str = table { IsPron Sg2 => "kaa" ;
Sg1 => "kay" ; IsPron (Pl1 Excl) => "kayo" ;
Sg2 => "kaa" ; IsPron (Pl1 Incl) => "keen" ;
Pl1 Excl => "kayo" ; IsPron Pl2 => "kiin" ;
Pl1 Incl => "keen" ; _ => []
Pl2 => "kiin" ;
_ => []
} ; } ;
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@@ -291,11 +296,11 @@ oper
defQuant = defQuantBind True ; defQuant = defQuantBind True ;
defQuantBind : (bind : Bool) -> (s, kan, tan, kuwan : Str) -> Vowel -> Quant = \b,s,spm,spf,spp,v -> defQuantBind : (bind : Bool) -> (s, kan, tan, kuwan : Str) -> (vowIsI : Bool) -> Quant = \b,s,spm,spf,spp,v ->
let bind : Str -> Str = \x -> case b of {False => x ; True => BIND ++ x} ; let bind : Str -> Str = \x -> case b of {False => x ; True => BIND ++ x} ;
in baseQuant ** { in baseQuant ** {
s = \\allomorph,c => s = \\allomorph,c =>
let nom = case v of {NA => "u" ; _ => s + "i"} let nom = case v of {False => "u" ; _ => s + "i"}
in case c of { in case c of {
Nom => bind (quantTable nom ! allomorph) ; Nom => bind (quantTable nom ! allomorph) ;
_ => bind (quantTable s ! allomorph) } ; _ => bind (quantTable s ! allomorph) } ;
@@ -312,15 +317,11 @@ oper
s = \\da,c => [] ; s = \\da,c => [] ;
sp = \\gn,c => [] ; sp = \\gn,c => [] ;
st = Indefinite ; st = Indefinite ;
-- v = NA ; -- Will be ignored in DetQuant
} ; } ;
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- Prepositions -- Prepositions
-- Prepositionen u dras obligatoriskt samman med föregående pronomen
-- så att /a/ + /u/ > /oo/.
Prep : Type = {s : Agreement => Str} ; Prep : Type = {s : Agreement => Str} ;
mkPrep : (x1,_,_,_,_,x6 : Str) -> Prep = \ku,ii,kuu,noo,idiin,loo -> { mkPrep : (x1,_,_,_,_,x6 : Str) -> Prep = \ku,ii,kuu,noo,idiin,loo -> {
@@ -486,36 +487,36 @@ oper
_ => "in" } ; _ => "in" } ;
in { s = table { in { s = table {
VPres Simple (Sg1|Sg3 Masc|Impers) pol VPres Simple Sg1_Sg3Masc pol
=> qaat + if_then_Pol pol "aa" "o" ; => qaat + if_then_Pol pol "aa" "o" ;
VPres Simple (Sg2|Sg3 Fem) pol VPres Simple Sg2_Sg3Fem pol
=> arag + t + if_then_Pol pol "aa" "o" ; => arag + t + if_then_Pol pol "aa" "o" ;
VPres Simple (Pl1 _) pol => arag + n + if_then_Pol pol "aa" "o" ; VPres Simple Pl1_ pol => arag + n + if_then_Pol pol "aa" "o" ;
VPres Simple Pl2 pol => arag + t + "aan" ; VPres Simple Pl2_ pol => arag + t + "aan" ;
VPres Simple Pl3 pol => qaat + "aan" ; VPres Simple Pl3_ pol => qaat + "aan" ;
VPres Progressive (Sg1|Sg3 Masc|Impers) pol VPres Progressive Sg1_Sg3Masc pol
=> progr + if_then_Pol pol "aa" "o" ; => progr + if_then_Pol pol "aa" "o" ;
VPres Progressive (Sg2|Sg3 Fem) pol VPres Progressive Sg2_Sg3Fem pol
=> progr + if_then_Pol pol "saa" "so" ; => progr + if_then_Pol pol "saa" "so" ;
VPres Progressive (Pl1 _) pol VPres Progressive Pl1_ pol
=> progr + if_then_Pol pol "naa" "no" ; => progr + if_then_Pol pol "naa" "no" ;
VPres Progressive Pl2 pol => progr + "saan" ; VPres Progressive Pl2_ pol => progr + "saan" ;
VPres Progressive Pl3 pol => progr + "aan" ; VPres Progressive Pl3_ pol => progr + "aan" ;
VPast Simple (Sg1|Sg3 Masc|Impers) VPast Simple Sg1_Sg3Masc
=> qaat + ay ; => qaat + ay ;
VPast Simple (Sg2|Sg3 Fem) => arag + t + ay ; -- t, d or s VPast Simple Sg2_Sg3Fem => arag + t + ay ; -- t, d or s
VPast Simple (Pl1 _) => arag + n + ay ; VPast Simple Pl1_ => arag + n + ay ;
VPast Simple Pl2 => arag + t + "een" ; -- t, d or s VPast Simple Pl2_ => arag + t + "een" ; -- t, d or s
VPast Simple Pl3 => qaat + "een" ; VPast Simple Pl3_ => qaat + "een" ;
VPast Progressive (Sg1|Sg3 Masc|Impers) VPast Progressive Sg1_Sg3Masc
=> progr + "ey" ; => progr + "ey" ;
VPast Progressive (Sg2|Sg3 Fem) => progr + "sey" ; VPast Progressive Sg2_Sg3Fem => progr + "sey" ;
VPast Progressive (Pl1 _) => progr + "ney" ; VPast Progressive Pl1_ => progr + "ney" ;
VPast Progressive Pl2 => progr + "seen" ; VPast Progressive Pl2_ => progr + "seen" ;
VPast Progressive Pl3 => progr + "een" ; VPast Progressive Pl3_ => progr + "een" ;
VNegPast Simple => arkin ; VNegPast Simple => arkin ;
VNegPast Progressive => progr + "n" ; VNegPast Progressive => progr + "n" ;
@@ -569,46 +570,44 @@ oper
------------------ ------------------
-- Irregular verbs -- Irregular verbs
presCopula : {agr:Agreement ; pol:Polarity} => Str =
\\a => case <a.agr,a.pol> of {
<Sg1,pol> => if_then_Pol pol "ahay" "ihi" ;
<Sg2,pol> => if_then_Pol pol "tahay" "ihid" ;
<(Sg3 Masc|Impers),pol> => if_then_Pol pol "yahay" "aha" ;
<(Sg3 Fem),pol> => if_then_Pol pol "tahay" "aha" ;
<(Pl1 _),pol> => if_then_Pol pol "nahay" "ihin" ;
<Pl2,pol> => if_then_Pol pol "tihiin" "ihidin" ;
<Pl3,pol> => if_then_Pol pol "yihiin" "aha"
} ;
copula : Verb = { copula : Verb = {
s = table { s = table {
VPres _ Sg1 pol => if_then_Pol pol "ahay" "ihi" ; VPast _ Sg1_Sg3Masc
VPres _ Sg2 pol => if_then_Pol pol "tahay" "ihid" ;
VPres _ (Sg3 Masc|Impers) pol => if_then_Pol pol "yahay" "aha" ;
VPres _ (Sg3 Fem) pol => if_then_Pol pol "tahay" "aha" ;
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" ; => "ahaa" ;
VPast _ (Sg2|Sg3 Fem) VPast _ Sg2_Sg3Fem
=> "ahayd" ; => "ahayd" ;
VPast _ (Pl1 _) => "ahayn" ; VPast _ Pl1_ => "ahayn" ;
VPast _ Pl2 => "ahaydeen" ; VPast _ Pl2_ => "ahaydeen" ;
VPast _ Pl3 => "ahaayeen" ; VPast _ Pl3_ => "ahaayeen" ;
VNegPast _ => "ahi" ; VNegPast _ => "ahi" ;
VRel => "ah" ; VRel => "ah" ;
VInf => "ahaan" } ; VInf => "ahaan" ;
VImp Sg pol => if_then_Pol pol "ahaw" "ahaanin" ;
VImp Pl pol => if_then_Pol pol "ahaada" "ahaanina" ;
VPres _ _ _ => nonExist -- use presCopula instead
} ;
sii, dhex = [] sii, dhex = []
} ; } ;
-- 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 hold_V ** { let hold_V = mkVerb "hayso" "haysat" "haysa" in hold_V ** {
s = table { s = table {
VPres _ Sg1 Pos => "leeyahay" ; VPres _ Sg1_Sg3Masc Pos => "leeyahay" ;
VPres _ Sg2 Pos => "leedahay" ; VPres _ Sg2_Sg3Fem Pos => "leedahay" ;
VPres _ (Sg3 Fem) Pos => "leedahay" ; VPres _ Pl1_ Pos => "leenahay" ;
VPres _ (Sg3 Masc|Impers) Pos VPres _ Pl2_ Pos => "leedihiin" ;
=> "leeyahay" ; VPres _ Pl3_ Pos => "leeyihiin" ;
VPres _ (Pl1 _) Pos => "leenahay" ;
VPres _ Pl2 Pos => "leedihiin" ;
VPres _ Pl3 Pos => "leeyihiin" ;
VPast asp agr => "l" + copula.s ! VPast asp agr ; VPast asp agr => "l" + copula.s ! VPast asp agr ;
VRel => "leh" ; VRel => "leh" ;
x => hold_V.s ! x } x => hold_V.s ! x }
@@ -636,7 +635,7 @@ oper
Adverb : Type = BaseAdv ** { Adverb : Type = BaseAdv ** {
c2 : Preposition ; -- adverbs can contribute to preposition contraction. c2 : Preposition ; -- adverbs can contribute to preposition contraction.
np : NounPhrase -- NP from PrepNP can be promoted into a core argument. np : NPLite ; -- NP from PrepNP can be promoted into a core argument.
} ; } ;
Complement : Type = { Complement : Type = {
@@ -648,7 +647,7 @@ oper
-- Prepositions can combine together and with object pronoun. -- Prepositions can combine together and with object pronoun.
c2 : PrepositionPlus ; -- hack to implement passives more efficiently: c2 : PrepositionPlus ; -- hack to implement passives more efficiently:
c3 : Preposition ; -- if c2 is Passive, the real preposition is in c3. c3 : Preposition ; -- if c2 is Passive, the real preposition is in c3.
obj2 : {s : Str ; a : AgreementPlus} ; obj2 : NPLite ; -- {s : Str ; a : AgreementPlus}
secObj : Str ; -- if two overt pronoun objects secObj : Str ; -- if two overt pronoun objects
vComp : Str ; -- VV complement vComp : Str ; -- VV complement
refl : Str ; -- reflexive is put here, if the verb has an obj2. refl : Str ; -- reflexive is put here, if the verb has an obj2.
@@ -663,7 +662,7 @@ oper
vComp,berri,miscAdv,refl = [] ; vComp,berri,miscAdv,refl = [] ;
c2 = P NoPrep ; c2 = P NoPrep ;
c3 = NoPrep ; c3 = NoPrep ;
obj2 = {s = [] ; a = Unassigned} ; obj2 = {s = [] ; a = NotPronP3} ;
secObj = [] secObj = []
} ; } ;
@@ -696,42 +695,35 @@ oper
} ; } ;
insertComp : VPSlash -> NounPhrase -> VerbPhrase = \vp,np -> insertComp : VPSlash -> NounPhrase -> VerbPhrase = \vp,np ->
let noun : Str = case <np.isPron,np.a> of { insertCompAgrPlus vp (nplite np) ;
<False,_> => np.s ! Abs ;
-- <True,(Sg3 _|Pl3)> => np.empty ++ (pronTable ! np.a).sp ; -- uncomment if you want to add long object pronoun for 3rd person object
_ => np.empty } -- no long object for other pronouns
in case vp.obj2.a of {
Unassigned =>
vp ** {obj2 = {
s = noun ;
a = agr2agrplus np.isPron np.a}
} ;
-- If the old object is 3rd person, we can safely replace its agreement. insertCompAgrPlus : VPSlash -> NPLite -> VerbPhrase = \vp,nplite ->
case vp.obj2.a of {
-- If the old object is 3rd person (or nonexistent), we replace its agreement.
-- We keep both old and new string (=noun, if there was one) in obj2.s. -- We keep both old and new string (=noun, if there was one) in obj2.s.
NotPronP3|IsPron (Sg3 _|Pl3|Impers) => NotPronP3|IsPron (Sg3 _|Pl3|Impers) =>
vp ** {obj2 = { vp ** {obj2 = nplite ** {
s = vp.obj2.s ++ noun ; s = vp.obj2.s ++ nplite.s}
a = agr2agrplus np.isPron np.a} ; -- } ; -- no secObj, because there's ≤1 non-3rd-person pronoun.
} ; -- no secObj, because there's ≤1 non-3rd-person pronoun.
-- If old object was non-3rd person, we keep its agreement. -- If old object was non-3rd person, we keep its agreement.
-- The new object is put in the secondObject field.
_ => _ =>
vp ** {obj2 = vp.obj2 ** { vp ** {obj2 = vp.obj2 ** {
s = vp.obj2.s ++ noun s = vp.obj2.s ++ nplite.s
} ; } ;
secObj = vp.secObj ++ secondObject ! np.a} secObj = vp.secObj ++ secondObject ! nplite.a}
} ; } ;
insertAdv : VerbPhrase -> Adverb -> VerbPhrase = \vp,adv -> insertAdv : VerbPhrase -> Adverb -> VerbPhrase = \vp,adv ->
case <adv.c2, isP3 adv.np.a, adv.np.isPron> of { case <adv.c2, adv.np.a> of { --isP3 adv.np.a, adv.np.isPron> of {
<NoPrep,_,_> => vp ** adv'' ; -- a) the adverb is not formed with PrepNP, e.g. "tomorrow" <NoPrep,_> => vp ** adv'' ; -- a) the adverb is not formed with PrepNP, e.g. "tomorrow"
<_,True,False> => vp ** adv'' ; -- b) is formed with PrepNP, and has 3rd person obj, which is a noun. <_,NotPronP3> => vp ** adv'' ; -- b) is formed with PrepNP, and has 3rd person obj, which is a noun.
_ => case <vp.c2,vp.obj2.a,vp.c3> of { _ => case <vp.c2,isP3 vp.obj2.a,vp.c3> of {
-- if free complement slots, introduce adv.np with insertComp -- if free complement slots, introduce adv.np with insertComp
<P NoPrep,Unassigned,_> => insertComp (vp ** {c2 = P adv.c2}) adv.np ** adv' ; <P NoPrep,True,_> => insertCompAgrPlus (vp ** {c2 = P adv.c2}) adv.np ** adv' ;
<_ ,_ ,NoPrep> => insertComp (vp ** {c3 = adv.c2}) adv.np ** adv' ; <_ ,_ ,NoPrep> => insertCompAgrPlus (vp ** {c3 = adv.c2}) adv.np ** adv' ;
-- if complement slots are full, just insert strings. -- if complement slots are full, just insert strings.
_ => vp ** adv'' _ => vp ** adv''
@@ -739,8 +731,8 @@ oper
} where { } where {
adv' : {sii,dhex,berri : Str} = adv ; -- adv.np done with insertComp adv' : {sii,dhex,berri : Str} = adv ; -- adv.np done with insertComp
adv'' : {sii,dhex,berri,miscAdv : Str} -- adv.np inserted into miscAdv adv'' : {sii,dhex,berri,miscAdv : Str} -- adv.np inserted into miscAdv
= adv ** {dhex = (prepTable ! P adv.c2).s ! adv.np.a ++ adv.dhex ; = adv ** {dhex = (prepTable ! P adv.c2).s ! agrplus2agr adv.np.a ++ adv.dhex ;
miscAdv = adv.np.s ! Abs} -- TODO: check case miscAdv = adv.np.s}
} ; } ;
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- Sentences etc. -- Sentences etc.
@@ -755,10 +747,11 @@ oper
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 <isQ,p,vp.pred> of { pred : {fin : Str ; inf : Str} = case <isQ,p,vp.pred> of {
<False,Pos,NoCopula> => {fin,inf = []} ; <False,Pos,NoCopula> => {fin,inf = []} ;
<_ , _,Copula> => {fin = presCopula ! {agr=subj.a ; pol=p} ; inf=[]} ;
_ => predRaw _ => predRaw
} ; } ;
subjnoun : Str = if_then_Str np.isPron [] (subj.s ! Nom) ; subjnoun : Str = if_then_Str np.isPron np.empty (subj.s ! Nom) ;
subjpron : Str = if_then_Str np.isPron (subj.s ! Nom) [] ; subjpron : Str = if_then_Str np.isPron (subj.s ! Nom) np.empty ;
obj : {p1,p2 : Str} = obj : {p1,p2 : Str} =
let o : {p1,p2 : Str} = vp.comp ! subj.a ; let o : {p1,p2 : Str} = vp.comp ! subj.a ;
bind : Str = case <isP3 vp.obj2.a, vp.c2> of { bind : Str = case <isP3 vp.obj2.a, vp.c2> of {
@@ -804,8 +797,8 @@ oper
-> {fin : Str ; inf : Str} = \t,ant,p,agr,vp -> -> {fin : Str ; inf : Str} = \t,ant,p,agr,vp ->
case <t,ant> of { case <t,ant> of {
<Pres,Simul> => {fin = presV vp ; inf = [] } ; <Pres,Simul> => {fin = presV vp ; inf = [] } ;
<Pres,Anter> => {fin = presV copula ; inf = vp.s ! VInf } ; ---- just guessing
<Past,Simul> => {fin = pastV vp ; inf = [] } ; <Past,Simul> => {fin = pastV vp ; inf = [] } ;
<Pres,Anter> => {fin = presCopula ! agrPol ; inf = vp.s ! VInf } ; ---- just guessing
<Past,Anter> => {fin = pastV (cSug "jir") ; inf = vp.s ! VInf} ; <Past,Anter> => {fin = pastV (cSug "jir") ; inf = vp.s ! VInf} ;
<Fut,Simul> => {fin = presV (cSug "doon") ; inf = vp.s ! VInf} ; <Fut,Simul> => {fin = presV (cSug "doon") ; inf = vp.s ! VInf} ;
<Fut,Anter> => {fin = pastV (cSug "doon") ; inf = vp.s ! VInf} ; <Fut,Anter> => {fin = pastV (cSug "doon") ; inf = vp.s ! VInf} ;
@@ -813,11 +806,12 @@ oper
<Cond,Anter> => {fin = pastV have_V ; inf = vp.s ! VInf} -- TODO check <Cond,Anter> => {fin = pastV have_V ; inf = vp.s ! VInf} -- TODO check
} }
where { where {
agrPol : {agr:Agreement ; pol:Polarity} = {agr=agr; pol=p} ;
pastV : Verb -> Str = \v -> pastV : Verb -> Str = \v ->
case p of { Neg => v.s ! VNegPast Simple ; case p of { Neg => v.s ! VNegPast Simple ;
Pos => v.s ! VPast Simple agr } ; Pos => v.s ! VPast Simple (agr2vagr agr) } ;
presV : Verb -> Str = \v -> v.s ! VPres Simple agr p ; presV : Verb -> Str = \v -> v.s ! VPres Simple (agr2vagr agr) p ;
} ; } ;
infVP : VerbPhrase -> Str = \vp -> infVP : VerbPhrase -> Str = \vp ->
@@ -849,8 +843,8 @@ oper
linAdv : Adverb -> Str = \adv -> linAdv : Adverb -> Str = \adv ->
adv.berri adv.berri
++ adv.sii ++ adv.sii
++ (prepTable ! P adv.c2).s ! adv.np.a ++ (prepTable ! P adv.c2).s ! Pl3 --adv.np.a
++ adv.dhex ++ adv.dhex
++ adv.np.s ! Abs ; ++ adv.np.s ;
} }

View File

@@ -70,8 +70,8 @@ lin someSg_Det = R.indefDet "" sg ;
lin no_Quant = mkPrep no_Quant lin no_Quant = mkPrep no_Quant
-} -}
lin that_Quant = defQuant "aas" "kaas" "taas" "kuwaas" vA ; lin that_Quant = defQuant "aas" "kaas" "taas" "kuwaas" True ;
lin this_Quant = defQuant "an" "kan" "tan" "kuwan" vA ; lin this_Quant = defQuant "an" "kan" "tan" "kuwan" True ;
--lin which_IQuant = defQuant --lin which_IQuant = defQuant
{- {-
@@ -125,7 +125,7 @@ lin with_Prep = mkPrep la ;
youSg_Pron = pronTable ! Sg2 ; youSg_Pron = pronTable ! Sg2 ;
he_Pron = pronTable ! Sg3 Masc ; he_Pron = pronTable ! Sg3 Masc ;
she_Pron = pronTable ! Sg3 Fem ; she_Pron = pronTable ! Sg3 Fem ;
we_Pron = pronTable ! Pl1 Excl ; we_Pron = pronTable ! Pl1 Incl ;
youPl_Pron = pronTable ! Pl2 ; youPl_Pron = pronTable ! Pl2 ;
they_Pron = pronTable ! Pl3 ; they_Pron = pronTable ! Pl3 ;
{- {-

View File

@@ -15,8 +15,10 @@ lin
ReflVP = ResSom.insertRefl ; ReflVP = ResSom.insertRefl ;
-- : VV -> VP -> VP ; -- : VV -> VP -> VP ;
ComplVV vv vp = useV vv ** { -- check Sayeed p. 169 ComplVV vv vp = vp ** { -- check Sayeed p. 169
vComp = infVP vp s = vv.s ;
vComp = vp.vComp ++ vp.s ! VInf ;
pred = NoPred ;
} ; } ;
{- {-
-- : VS -> S -> VP ; -- : VS -> S -> VP ;