(Som) More fine-grained parameter for modifiers in NPs (AP vs. Other)

This commit is contained in:
Inari Listenmaa
2019-09-27 16:44:21 +02:00
parent 3f30e0946e
commit 096115c35f
3 changed files with 42 additions and 20 deletions

View File

@@ -13,15 +13,15 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in {
a = getAgr det.n (gender cn) } where {
sTable : Case => Str = \\c =>
let nfc : {nf : NForm ; c : Case} =
case <det.numtype,c,cn.hasMod,det.st,det.n> of {
case <det.numtype,c,cn.modtype,det.st,det.n> of {
-- Numbers
<Basic|Compound,_,_,_,_> => {nf=Numerative ; c=c} ;
-- special form for fem. nouns
<_,Nom,False,Indefinite,Sg> => {nf=NomSg ; c=c} ;
<_,Nom,NoMod|OtherMod,Indefinite,Sg> => {nf=NomSg ; c=c} ;
-- If cn has modifier, Nom ending attaches to the modifier
<_,Nom,True,_,_> => {nf=Def det.n ; c=Abs} ;
<_,Nom,AMod,_,_> => {nf=Def det.n ; c=Abs} ;
-- a Det with st=Indefinite uses Indef forms
<_,_,_,Indefinite,n> => {nf=Indef n ; c=c} ;
@@ -258,27 +258,28 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in {
AdjCN ap cn = cn ** {
s = table { -- Add oo after Numerative only if this is CN's first modifier.
Numerative => cn.s ! Numerative
++ andConj Indefinite (notB cn.hasMod) ;
++ andConj Indefinite (notMod cn.modtype) ;
NomSg => cn.s ! Indef Sg ; -- Add adj -> noun loses case marker
nf => cn.s ! nf } ;
mod = \\st,n,c =>
cn.mod ! st ! n ! Abs -- If there was something before, it is now in Abs
++ andConj st cn.hasMod -- If the sentence is already modified, any new modifier needs to be introduced with conjunction
++ andConj st cn.modtype -- If the sentence is already modified, any new modifier needs to be introduced with conjunction
++ ap.s ! AF n c ;
hasMod = True
modtype = AMod
} ;
-- : CN -> RS -> CN ;
RelCN cn rs = cn ** {
s = table {
Numerative => cn.s ! Numerative ++ andConj Indefinite (notB cn.hasMod) ;
NomSg => cn.s ! Indef Sg ; -- Add adj -> noun loses case marker
Numerative => cn.s ! Numerative ++ andConj Indefinite (notMod cn.modtype) ;
nf => cn.s ! nf } ;
mod = \\st,n,c => --what to do with subject case if there's both adj and RS?
cn.mod ! st ! n ! Abs
++ andConj st cn.hasMod
++ andConj st cn.modtype
++ rs.s ! st ! gennum cn Sg ! c ; -- gennum cn Sg, because plural form is only for 1st person plural
hasMod = True ;
modtype = case cn.modtype of {
AMod => AMod ;
_ => OtherMod }
} ;
{-
@@ -307,11 +308,23 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in {
PossNP cn np = cn ** { -- guriga Axmed, not Axmed gurigiisa
mod = \\st,n,c => cn.mod ! st ! n ! c ++ objpron np ! Abs
} ;
{-
-- : CN -> NP -> CN ; -- glass of wine / two kilos of red apples
PartNP cn np = cn ** { } ;
PartNP cn np = cn ** {
s = table {
Numerative => cn.s ! Numerative ++ andConj Indefinite (notMod cn.modtype) ;
nf => cn.s ! nf } ;
mod = \\st,n,c =>
cn.mod ! st ! n ! c
++ andConj st cn.modtype -- If the sentence is already modified, any new modifier needs to be introduced with conjunction
++ np.s ! Abs
++ "ah" ;
modtype = case cn.modtype of {
AMod => AMod ;
_ => OtherMod }
} ;
{-
-- This is different from the partitive, as shown by many languages.
@@ -329,10 +342,10 @@ concrete NounSom of Noun = CatSom ** open ResSom, Prelude in {
-}
oper
andConj : State -> Bool -> Str = \st,hasMod ->
case <st,hasMod> of {
<Indefinite,True> => "oo" ;
<Definite,True> => "ee" ;
andConj : State -> ModType -> Str = \st,mod ->
case <st,mod> of {
<Indefinite,AMod|OtherMod> => "oo" ;
<Definite,AMod|OtherMod> => "ee" ;
_ => []
} ;
}

View File

@@ -224,6 +224,15 @@ oper
param
AForm = AF Number Case ; ---- TODO: past tense
ModType = NoMod | AMod | OtherMod ;
oper
-- to flip ModType
notMod : ModType -> ModType = \mt -> case mt of {
NoMod => OtherMod ;
_ => NoMod
} ;
--------------------------------------------------------------------------------
-- Prepositions

View File

@@ -15,7 +15,7 @@ oper
CNoun : Type = Noun ** {
mod : State -- for conjunctions: oo for indef, ee for def
=> Number => Case => Str ;
hasMod : Bool ;
modtype : ModType ;
isPoss : Bool -- to prevent impossible forms in ComplN2 with Ns that have short possessive, e.g. "father"
} ;
@@ -159,7 +159,7 @@ oper
False => np.s} ;
useN : Noun -> CNoun ** BaseNP = \n -> n **
{ mod = \\_,_,_ => [] ; hasMod = False ;
{ mod = \\_,_,_ => [] ; modtype = NoMod ;
a = Sg3 (gender n) ; isPron,isPoss = False ;
empty = [] ; st = Indefinite
} ;