1
0
forked from GitHub/gf-rgl

(Som) Create PrepAgr param for prepositions combining with pronouns

This commit is contained in:
Inari Listenmaa
2019-07-22 21:51:44 +03:00
parent 2717955d3c
commit a6530e4f1d
5 changed files with 77 additions and 74 deletions

View File

@@ -123,5 +123,5 @@ linref
-- Cl = linCl ; -- Cl = linCl ;
VP = linVP ; VP = linVP ;
CN = linCN ; CN = linCN ;
Prep = \prep -> prep.s ! Pl3 ++ prep.sii ++ prep.dhex ; Prep = \prep -> prep.s ! P3_Prep ++ prep.sii ++ prep.dhex ;
} }

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 = {s = [] ; a = NotPronP3} ; np = {s = [] ; a = P3_Prep} ;
sii,dhex = [] sii,dhex = []
} ; } ;

View File

@@ -136,9 +136,13 @@ param
| Pl3 | Pl3
| Impers ; -- Verb agrees with Sg3, but needed for preposition contraction | Impers ; -- Verb agrees with Sg3, but needed for preposition contraction
AgreementPlus = PrepAgr =
IsPron Agreement -- Any of Sg1 … Pl3 can be a pronoun. Sg1_Prep
| NotPronP3 ; -- Sg3 Gender and Pl3 can be pronouns or not. | Sg2_Prep
| Pl1_Prep Inclusion
| Pl2_Prep
| Impers_Prep
| P3_Prep ;
State = Definite | Indefinite ; State = Definite | Indefinite ;
@@ -152,21 +156,20 @@ oper
getNum : Agreement -> Number = \a -> getNum : Agreement -> Number = \a ->
case a of { Sg1|Sg2|Sg3 _ => Sg ; _ => Pl } ; case a of { Sg1|Sg2|Sg3 _ => Sg ; _ => Pl } ;
agr2agrplus : (isPron : Bool) -> Agreement -> AgreementPlus = \isPron,a -> agr2pagr : Agreement -> PrepAgr = \a -> case a of {
case isPron of {True => IsPron a ; False => NotPronP3} ; Sg1 => Sg1_Prep ;
Sg2 => Sg2_Prep ;
agrplus2agr : AgreementPlus -> Agreement = \a -> Impers => Impers_Prep ;
case a of {IsPron a => a ; _ => Pl3} ; Pl1 i => Pl1_Prep i ;
Pl2 => Pl2_Prep ;
_ => P3_Prep
} ;
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 => True ; _ => False} ;
isP3 : AgreementPlus -> Bool = \agr -> isP3 : PrepAgr -> Bool = \agr ->
case agr of { case agr of {P3_Prep => True ; _ => False} ;
IsPron (Sg3 _ | Pl3 | Impers) => True ;
NotPronP3 => True ;
-- Unassigned => True ; -- meaningful for "does it leave an overt pronoun"
_ => False}
} ; } ;
gender : {gda : GenderDefArt} -> Gender = \n -> gender : {gda : GenderDefArt} -> Gender = \n ->

View File

@@ -139,14 +139,14 @@ 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 : Type = {s : Str ; a : PrepAgr} ; -- Used in Adv and as an object in VP
nplite : NounPhrase -> NPLite = \np -> nplite : NounPhrase -> NPLite = \np ->
let aplus : AgreementPlus = agr2agrplus np.isPron np.a in let pagr : PrepAgr = agr2pagr np.a in
case <np.isPron,np.a> of { case <np.isPron,isP3 np.a> of {
<False,_> => {s = np.s ! Abs ; a = aplus} ; <False,_> => {s = np.s ! Abs ; a = pagr} ;
-- <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 -- <True,True> => {s = np.empty ++ (pronTable ! np.a).sp ; a = pagr} ; -- uncomment if you want to add long object pronoun for 3rd person object
_ => {s = np.empty ; a = aplus} } ; -- no long object for other pronouns _ => {s = np.empty ; a = pagr} } ; -- no long object for other pronouns
useN : Noun -> CNoun ** BaseNP = \n -> n ** useN : Noun -> CNoun ** BaseNP = \n -> n **
{ mod = \\_,_ => [] ; hasMod = False ; { mod = \\_,_ => [] ; hasMod = False ;
@@ -228,20 +228,20 @@ oper
poss = {s, short = quantTable "ood" ; sp = gnTable "ood" "ood" "uwood"} poss = {s, short = quantTable "ood" ; sp = gnTable "ood" "ood" "uwood"}
} ; } ;
Impers => { Impers => {
s = table {Nom => "la" ; Abs => "??"} ; s = table {Nom => "la" ; Abs => "la"} ;
a = Impers ; isPron = True ; sp = "??" ; a = Impers ; isPron = True ; sp = "" ;
empty = [] ; empty = [] ;
poss = {s, short = quantTable "??" ; sp = gnTable "??" "??" "??"} poss = {s, short = quantTable "??" ; sp = gnTable "??" "??" "??"}
} }
} ; } ;
secondObject : AgreementPlus => Str = table { secondObject : PrepAgr => Str = table {
IsPron Sg1 => "kay" ; Sg1_Prep => "kay" ;
IsPron Sg2 => "kaa" ; Sg2_Prep => "kaa" ;
IsPron (Pl1 Excl) => "kayo" ; Pl1_Prep Excl => "kayo" ;
IsPron (Pl1 Incl) => "keen" ; Pl1_Prep Incl => "keen" ;
IsPron Pl2 => "kiin" ; Pl2_Prep => "kiin" ;
_ => [] _ => []
} ; } ;
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@@ -322,17 +322,17 @@ oper
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- Prepositions -- Prepositions
Prep : Type = {s : Agreement => Str} ; Prep : Type = {s : PrepAgr => Str} ;
mkPrep : (x1,_,_,_,_,x6 : Str) -> Prep = \ku,ii,kuu,noo,idiin,loo -> { mkPrep : (x1,_,_,_,_,x6 : Str) -> Prep = \ku,ii,kuu,noo,idiin,loo -> {
s = table { s = table {
Sg1 => ii ; Sg1_Prep => ii ;
Sg2 => kuu ; Sg2_Prep => kuu ;
Pl2 => idiin ; Pl2_Prep => idiin ;
Pl1 Excl => noo ; Pl1_Prep Excl => noo ;
Pl1 Incl => "i" + noo ; Pl1_Prep Incl => "i" + noo ;
Impers => loo ; Impers_Prep => loo ;
_ => ku P3_Prep => ku
} }
} ; } ;
prep : Preposition -> (Prep ** {c2 : Preposition}) = \p -> prepTable ! P p ** {c2 = p} ; prep : Preposition -> (Prep ** {c2 : Preposition}) = \p -> prepTable ! P p ** {c2 = p} ;
@@ -347,34 +347,34 @@ oper
Passive => mkPrep "la" "la i" "lagu" "nala" "laydin" "la" Passive => mkPrep "la" "la i" "lagu" "nala" "laydin" "la"
} ; } ;
prepCombTable : Agreement => PrepCombination => Str = table { prepCombTable : PrepAgr => PrepCombination => Str = table {
Sg1 => table { Ugu => "iigu" ; Uga => "iiga" ; Sg1_Prep => 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_Prep } ;
Sg2 => table { Ugu => "kuugu" ; Uga => "kaaga" ; Sg2_Prep => 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_Prep } ;
Pl1 Excl => Pl1_Prep 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_Prep Excl } ;
Pl1 Incl => Pl1_Prep 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_Prep Incl } ;
Pl2 => table { Ugu => "idiinku" ; Uga => "idiinka" ; Pl2_Prep => 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_Prep } ;
Impers => Impers_Prep =>
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_Prep } ;
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" ;
@@ -647,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 : NPLite ; -- {s : Str ; a : AgreementPlus} obj2 : NPLite ; -- {s : Str ; a : PrepAgr}
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.
@@ -662,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 = NotPronP3} ; obj2 = {s = [] ; a = P3_Prep} ;
secObj = [] secObj = []
} ; } ;
@@ -684,13 +684,12 @@ oper
p2 = cmp.p2 ++ vps.refl ++ compl np.a vps} -- object combines with the preposition of the verb. p2 = cmp.p2 ++ vps.refl ++ compl np.a vps} -- object combines with the preposition of the verb.
} ; } ;
compl : AgreementPlus -> VerbPhrase -> Str = \a,vp -> compl : PrepAgr -> VerbPhrase -> Str = \agr,vp ->
let agr = case a of {IsPron x => x ; _ => Pl3} ; prepCombTable ! agr ! combine vp.c2 vp.c3 ;
in prepCombTable ! agr ! combine vp.c2 vp.c3 ;
insertRefl : VPSlash -> VPSlash = \vps -> insertRefl : VPSlash -> VPSlash = \vps ->
case <vps.c2,vps.c3> of { case <vps.c2,vps.c3> of {
<P NoPrep,NoPrep> => vps ** {refl = "is"} ; -- not bound <P NoPrep,NoPrep> => vps ** {refl = "is"} ; -- NB. if AdvVP is called after ReflVP, vps.c2 may change.
_ => vps ** {refl = "is" ++ BIND} _ => vps ** {refl = "is" ++ BIND}
} ; } ;
@@ -701,7 +700,7 @@ oper
case vp.obj2.a of { case vp.obj2.a of {
-- If the old object is 3rd person (or nonexistent), we replace its agreement. -- 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) => P3_Prep =>
vp ** {obj2 = nplite ** { vp ** {obj2 = nplite ** {
s = vp.obj2.s ++ nplite.s} s = vp.obj2.s ++ nplite.s}
} ; -- no secObj, because there's ≤1 non-3rd-person pronoun. } ; -- no secObj, because there's ≤1 non-3rd-person pronoun.
@@ -717,21 +716,23 @@ oper
} ; } ;
insertAdv : VerbPhrase -> Adverb -> VerbPhrase = \vp,adv -> insertAdv : VerbPhrase -> Adverb -> VerbPhrase = \vp,adv ->
case <adv.c2, adv.np.a> of { --isP3 adv.np.a, adv.np.isPron> of { case adv.c2 of {
<NoPrep,_> => vp ** adv'' ; -- a) the adverb is not formed with PrepNP, e.g. "tomorrow" NoPrep => vp ** adv'' ; -- the adverb is not formed with PrepNP, e.g. "tomorrow"
<_,NotPronP3> => vp ** adv'' ; -- b) is formed with PrepNP, and has 3rd person obj, which is a noun. _ => case <vp.c2,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,True,_> => insertCompAgrPlus (vp ** {c2 = P adv.c2}) adv.np ** adv' ; <P NoPrep,_> => insertCompAgrPlus (vp ** {c2 = P adv.c2}) adv.np ** adv' ;
<_ ,_ ,NoPrep> => insertCompAgrPlus (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''
} }
} where { } where {
adv' : {sii,dhex,berri : Str} = adv ; -- adv.np done with insertComp adv' : {sii,dhex,berri : Str} = { -- adv.np done with insertComp
sii = vp.sii ++ adv.sii ;
dhex = vp.dhex ++ adv.dhex ;
berri = vp.berri ++ adv.berri } ;
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 ! agrplus2agr adv.np.a ++ adv.dhex ; = adv' ** {dhex = (prepTable ! P adv.c2).s ! adv.np.a ++ adv.dhex ;
miscAdv = adv.np.s} miscAdv = adv.np.s}
} ; } ;
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@@ -843,7 +844,7 @@ oper
linAdv : Adverb -> Str = \adv -> linAdv : Adverb -> Str = \adv ->
adv.berri adv.berri
++ adv.sii ++ adv.sii
++ (prepTable ! P adv.c2).s ! Pl3 --adv.np.a ++ (prepTable ! P adv.c2).s ! adv.np.a
++ adv.dhex ++ adv.dhex
++ adv.np.s ; ++ adv.np.s ;

View File

@@ -54,7 +54,6 @@ lin or_Conj = {s1 = "ama" ; s2 = [] ; n = Sg} ; -- mise with interrogatives
{- {-
lin how8many_IDet = R.indefDet "" pl ; lin how8many_IDet = R.indefDet "" pl ;
--TODO: fix predets in NounSom, figure out whether Predet should inflect
lin all_Predet = { s = "" } ; lin all_Predet = { s = "" } ;
lin not_Predet = { s = "" } ; lin not_Predet = { s = "" } ;
lin only_Predet = { s = "" } ; lin only_Predet = { s = "" } ;
@@ -119,9 +118,9 @@ lin with_Prep = mkPrep la ;
-- Pron -- Pron
-- Pronouns are closed class, no constructor in ParadigmsSom. -- Pronouns are closed class, no constructor in ParadigmsSom.
it_Pron = he_Pron ** {s = \\_ => [] ; sp = []} ; it_Pron = he_Pron ** {s = \\_ => [] ; sp = []} ; -- TODO check should there be Sg3 Neutr?
i_Pron = pronTable ! Sg1 ; i_Pron = pronTable ! Sg1 ;
youPol_Pron, -- TODO check youPol_Pron,
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 ;
@@ -152,8 +151,8 @@ lin when_Subj = mkSubj "" False ;
-- Utt -- Utt
lin language_title_Utt = ss "af soomaali" ; lin language_title_Utt = ss "af soomaali" ;
lin no_Utt = ss "ma" ; lin no_Utt = ss "maya" ;
lin yes_Utt = ss "yes" ; lin yes_Utt = ss "haa" ;
------- -------