mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-16 16:29:32 -06:00
fixed agreement to deal with Gender in exper/english
This commit is contained in:
@@ -47,7 +47,7 @@ concrete CatEng of Cat = CommonX ** open ResEng, Prelude in {
|
||||
|
||||
-- Noun
|
||||
|
||||
CN = {s : Number => Case => Str} ;
|
||||
CN = {s : Number => Case => Str ; g : Gender} ;
|
||||
NP, Pron = {s : Case => Str ; a : Agr} ;
|
||||
Det = {s : Str ; n : Number} ;
|
||||
Predet, Ord = {s : Str} ;
|
||||
@@ -77,9 +77,9 @@ concrete CatEng of Cat = CommonX ** open ResEng, Prelude in {
|
||||
A = {s : AForm => Str} ;
|
||||
A2 = {s : AForm => Str ; c2 : Str} ;
|
||||
|
||||
N = {s : Number => Case => Str} ;
|
||||
N2 = {s : Number => Case => Str} ** {c2 : Str} ;
|
||||
N3 = {s : Number => Case => Str} ** {c2,c3 : Str} ;
|
||||
PN = {s : Case => Str} ;
|
||||
N = {s : Number => Case => Str ; g : Gender} ;
|
||||
N2 = {s : Number => Case => Str ; g : Gender} ** {c2 : Str} ;
|
||||
N3 = {s : Number => Case => Str ; g : Gender} ** {c2,c3 : Str} ;
|
||||
PN = {s : Case => Str ; g : Gender} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -12,10 +12,10 @@ concrete ConjunctionEng of Conjunction =
|
||||
DConjAdv = conjunctDistrSS ;
|
||||
|
||||
ConjNP conj ss = conjunctTable Case conj ss ** {
|
||||
a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p ; g = ss.a.g}
|
||||
a = conjAgr (agrP3 conj.n) ss.a
|
||||
} ;
|
||||
DConjNP conj ss = conjunctDistrTable Case conj ss ** {
|
||||
a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p ; g = ss.a.g}
|
||||
a = conjAgr (agrP3 conj.n) ss.a
|
||||
} ;
|
||||
|
||||
ConjAP conj ss = conjunctTable Agr conj ss ** {
|
||||
|
||||
@@ -15,7 +15,7 @@ concrete IdiomEng of Idiom = CatEng ** open Prelude, ResEng in {
|
||||
(insertObj (\\_ => ad.s) (predAux auxBe))) ;
|
||||
|
||||
ExistNP np =
|
||||
mkClause "there" (agrP3 np.a.n)
|
||||
mkClause "there" (agrP3 (fromAgr np.a).n)
|
||||
(insertObj (\\_ => np.s ! Acc) (predAux auxBe)) ;
|
||||
|
||||
ExistIP ip =
|
||||
@@ -24,7 +24,7 @@ concrete IdiomEng of Idiom = CatEng ** open Prelude, ResEng in {
|
||||
|
||||
ProgrVP vp = insertObj (\\a => vp.ad ++ vp.prp ++ vp.s2 ! a) (predAux auxBe) ;
|
||||
|
||||
ImpPl1 vp = {s = "let's" ++ infVP True vp {n = Pl ; p = P1 ; g = Neutr}} ;
|
||||
ImpPl1 vp = {s = "let's" ++ infVP True vp (AgP1 Pl)} ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ lin
|
||||
fruit_N = regN "fruit" ;
|
||||
fun_AV = mkAV (regA "fun") ;
|
||||
garden_N = regN "garden" ;
|
||||
girl_N = regN "girl" ;
|
||||
girl_N = mkN feminine (regN "girl") ;
|
||||
glove_N = regN "glove" ;
|
||||
gold_N = regN "gold" ;
|
||||
good_A = mkADeg "good" "better" "best" "well" ;
|
||||
@@ -114,12 +114,12 @@ lin
|
||||
lose_V2 = dirV2 (irregV "lose" "lost" "lost") ;
|
||||
love_N = regN "love" ;
|
||||
love_V2 = dirV2 (regV "love") ;
|
||||
man_N = mk2N "man" "men" ;
|
||||
man_N = mkN masculine (mk2N "man" "men") ;
|
||||
married_A2 = mkA2 (regA "married") toP ;
|
||||
meat_N = regN "meat" ;
|
||||
milk_N = regN "milk" ;
|
||||
moon_N = regN "moon" ;
|
||||
mother_N2 = regN2 "mother" ;
|
||||
mother_N2 = mkN2 (mkN feminine (mkN "mother")) (mkPrep "of") ;
|
||||
mountain_N = regN "mountain" ;
|
||||
music_N = regN "music" ;
|
||||
narrow_A = regADeg "narrow" ;
|
||||
|
||||
@@ -77,7 +77,7 @@ oper
|
||||
mkPronoun : (_,_,_,_ : Str) -> Number -> Person -> Gender -> Pronoun =
|
||||
\I,me,my,mine,n,p,g ->
|
||||
{s = table {Nom => I ; Acc => me ; Gen => my} ;
|
||||
a = {n = n ; p = p ; g = g}
|
||||
a = toAgr n p g
|
||||
} ;
|
||||
|
||||
human : Gender = Masc ; --- doesn't matter
|
||||
|
||||
@@ -5,10 +5,10 @@ concrete NounEng of Noun = CatEng ** open ResEng, Prelude in {
|
||||
lin
|
||||
DetCN det cn = {
|
||||
s = \\c => det.s ++ cn.s ! det.n ! c ;
|
||||
a = agrP3 det.n
|
||||
a = agrgP3 det.n cn.g
|
||||
} ;
|
||||
|
||||
UsePN pn = pn ** {a = agrP3 Sg} ;
|
||||
UsePN pn = pn ** {a = agrgP3 Sg pn.g} ;
|
||||
UsePron p = p ;
|
||||
|
||||
PredetNP pred np = {
|
||||
@@ -97,19 +97,25 @@ concrete NounEng of Noun = CatEng ** open ResEng, Prelude in {
|
||||
UseN2 n = n ;
|
||||
UseN3 n = n ;
|
||||
|
||||
ComplN2 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c} ;
|
||||
ComplN3 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c ; c2 = f.c3} ;
|
||||
ComplN2 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c ; g = f.g} ;
|
||||
ComplN3 f x = {
|
||||
s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c ;
|
||||
g = f.g ;
|
||||
c2 = f.c3
|
||||
} ;
|
||||
|
||||
AdjCN ap cn = {
|
||||
s = \\n,c => preOrPost ap.isPre (ap.s ! agrP3 n) (cn.s ! n ! c)
|
||||
s = \\n,c => preOrPost ap.isPre (ap.s ! agrgP3 n cn.g) (cn.s ! n ! c) ;
|
||||
g = cn.g
|
||||
} ;
|
||||
RelCN cn rs = {
|
||||
s = \\n,c => cn.s ! n ! c ++ rs.s ! agrP3 n ---- g
|
||||
s = \\n,c => cn.s ! n ! c ++ rs.s ! agrgP3 n cn.g ;
|
||||
g = cn.g
|
||||
} ;
|
||||
AdvCN cn ad = {s = \\n,c => cn.s ! n ! c ++ ad.s} ;
|
||||
AdvCN cn ad = {s = \\n,c => cn.s ! n ! c ++ ad.s ; g = cn.g} ;
|
||||
|
||||
SentCN cn sc = {s = \\n,c => cn.s ! n ! c ++ sc.s} ;
|
||||
SentCN cn sc = {s = \\n,c => cn.s ! n ! c ++ sc.s ; g = cn.g} ;
|
||||
|
||||
ApposCN cn np = {s = \\n,c => cn.s ! n ! Nom ++ np.s ! c} ;
|
||||
ApposCN cn np = {s = \\n,c => cn.s ! n ! Nom ++ np.s ! c ; g = cn.g} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ oper
|
||||
human : Gender ;
|
||||
nonhuman : Gender ;
|
||||
masculine : Gender ;
|
||||
feminine : Gender ;
|
||||
|
||||
-- To abstract over number names, we define the following.
|
||||
|
||||
@@ -81,6 +82,10 @@ oper
|
||||
|
||||
mkN : (man,men,man's,men's : Str) -> N ;
|
||||
|
||||
-- Change gender from the default $nonhuman$.
|
||||
|
||||
mkN : Gender -> N -> N ;
|
||||
|
||||
--3 Compound nouns
|
||||
--
|
||||
-- A compound noun is an uninflected string attached to an inflected noun,
|
||||
@@ -346,7 +351,7 @@ oper
|
||||
cnN3 = \n,p,q -> n ** {lock_N3 = <> ; c2 = p.s ; c3 = q.s} ;
|
||||
|
||||
regPN n = regGenPN n human ;
|
||||
regGenPN n g = nameReg n g ** {lock_PN = <>} ;
|
||||
regGenPN n g = nameReg n g ** {g = g ; lock_PN = <>} ;
|
||||
nounPN n = {s = n.s ! singular ; g = n.g ; lock_PN = <>} ;
|
||||
|
||||
mk2A a b = mkAdjective a a a b ** {lock_A = <>} ;
|
||||
|
||||
@@ -16,7 +16,7 @@ concrete RelativeEng of Relative = CatEng ** open ResEng in {
|
||||
RNoAg => ag ;
|
||||
RAg a => a
|
||||
} ;
|
||||
cl = mkClause (rp.s ! RC agr.g Nom) agr vp
|
||||
cl = mkClause (rp.s ! RC (fromAgr agr).g Nom) agr vp
|
||||
in
|
||||
cl.s ! t ! ant ! b ! ODir ;
|
||||
c = Nom
|
||||
@@ -28,12 +28,12 @@ concrete RelativeEng of Relative = CatEng ** open ResEng in {
|
||||
|
||||
RelSlash rp slash = {
|
||||
s = \\t,a,p,agr =>
|
||||
slash.c2 ++ rp.s ! RPrep agr.g ++ slash.s ! t ! a ! p ! ODir ;
|
||||
slash.c2 ++ rp.s ! RPrep (fromAgr agr).g ++ slash.s ! t ! a ! p ! ODir ;
|
||||
c = Acc
|
||||
} ;
|
||||
|
||||
FunRP p np rp = {
|
||||
s = \\c => np.s ! Acc ++ p.s ++ rp.s ! RPrep np.a.g ;
|
||||
s = \\c => np.s ! Acc ++ p.s ++ rp.s ! RPrep (fromAgr np.a).g ;
|
||||
a = RAg np.a
|
||||
} ;
|
||||
|
||||
|
||||
@@ -21,11 +21,11 @@ resource ResEng = ParamX ** open Prelude in {
|
||||
param
|
||||
Case = Nom | Acc | Gen ;
|
||||
|
||||
-- Agreement of $NP$ is a record. $Gender$ is needed for "who"/"which" and
|
||||
-- Agreement of $NP$ has 8 values. $Gender$ is needed for "who"/"which" and
|
||||
-- for "himself"/"herself"/"itself".
|
||||
|
||||
oper
|
||||
Agr = {n : Number ; p : Person ; g : Gender} ;
|
||||
param
|
||||
Agr = AgP1 Number | AgP2 Number | AgP3Sg Gender | AgP3Pl ;
|
||||
|
||||
param
|
||||
Gender = Neutr | Masc | Fem ;
|
||||
@@ -62,7 +62,7 @@ resource ResEng = ParamX ** open Prelude in {
|
||||
|
||||
--2 For $Relative$
|
||||
|
||||
RAgr = RNoAg | RAg {n : Number ; p : Person ; g : Gender} ;
|
||||
RAgr = RNoAg | RAg Agr ;
|
||||
RCase = RPrep Gender | RC Gender Case ;
|
||||
|
||||
--2 For $Numeral$
|
||||
@@ -73,18 +73,34 @@ resource ResEng = ParamX ** open Prelude in {
|
||||
--2 Transformations between parameter types
|
||||
|
||||
oper
|
||||
agrP3 : Number -> Agr = \n ->
|
||||
{n = n ; p = P3 ; g = Neutr} ;
|
||||
toAgr : Number -> Person -> Gender -> Agr = \n,p,g ->
|
||||
case p of {
|
||||
P1 => AgP1 n ;
|
||||
P2 => AgP2 n ;
|
||||
P3 => case n of {
|
||||
Sg => AgP3Sg g ;
|
||||
Pl => AgP3Pl
|
||||
}
|
||||
} ;
|
||||
|
||||
agrgP3 : Number -> Gender -> Agr = \n,g ->
|
||||
{n = n ; p = P3 ; g = g} ;
|
||||
|
||||
conjAgr : Agr -> Agr -> Agr = \a,b -> {
|
||||
n = conjNumber a.n b.n ;
|
||||
p = conjPerson a.p b.p ;
|
||||
g = a.g ----
|
||||
fromAgr : Agr -> {n : Number ; p : Person ; g : Gender} = \a -> case a of {
|
||||
AgP1 n => {n = n ; p = P1 ; g = Masc} ;
|
||||
AgP2 n => {n = n ; p = P2 ; g = Masc} ;
|
||||
AgP3Pl => {n = Pl ; p = P3 ; g = Masc} ;
|
||||
AgP3Sg g => {n = Sg ; p = P3 ; g = g}
|
||||
} ;
|
||||
|
||||
agrP3 : Number -> Agr = \n -> agrgP3 n Neutr ;
|
||||
|
||||
agrgP3 : Number -> Gender -> Agr = \n,g -> toAgr n P3 g ;
|
||||
|
||||
conjAgr : Agr -> Agr -> Agr = \a0,b0 ->
|
||||
let a = fromAgr a0 ; b = fromAgr b0
|
||||
in
|
||||
toAgr
|
||||
(conjNumber a.n b.n)
|
||||
(conjPerson a.p b.p) a.g ;
|
||||
|
||||
-- For $Lex$.
|
||||
|
||||
-- For each lexical category, here are the worst-case constructors.
|
||||
@@ -139,11 +155,7 @@ resource ResEng = ParamX ** open Prelude in {
|
||||
Acc => me ;
|
||||
Gen => my
|
||||
} ;
|
||||
a = {
|
||||
n = n ;
|
||||
p = p ;
|
||||
g = g
|
||||
}
|
||||
a = toAgr n p g ;
|
||||
} ;
|
||||
|
||||
-- These functions cover many cases; full coverage inflectional patterns are
|
||||
@@ -350,8 +362,8 @@ resource ResEng = ParamX ** open Prelude in {
|
||||
|
||||
agrVerb : Str -> Str -> Agr -> Str = \has,have,agr ->
|
||||
case agr of {
|
||||
{n = Sg ; p = P3} => has ;
|
||||
_ => have
|
||||
AgP3Sg _ => has ;
|
||||
_ => have
|
||||
} ;
|
||||
|
||||
have = agrVerb "has" "have" ;
|
||||
@@ -367,13 +379,13 @@ resource ResEng = ParamX ** open Prelude in {
|
||||
|
||||
auxBe : Aux = {
|
||||
pres = \\b,a => case <b,a> of {
|
||||
<Pos,{n = Sg ; p = P1}> => "am" ;
|
||||
<Neg,{n = Sg ; p = P1}> => ["am not"] ; --- am not I
|
||||
<Pos,AgP1 Sg> => "am" ;
|
||||
<Neg,AgP1 Sg> => ["am not"] ; --- am not I
|
||||
_ => agrVerb (posneg b "is") (posneg b "are") a
|
||||
} ;
|
||||
past = \\b,a => case a of { --# notpresent
|
||||
{n = Sg ; p = P1|P3} => (posneg b "was") ; --# notpresent
|
||||
_ => (posneg b "were") --# notpresent
|
||||
past = \\b,a => case a of { --# notpresent
|
||||
AgP1 Sg | AgP3Sg _ => posneg b "was" ; --# notpresent
|
||||
_ => (posneg b "were") --# notpresent
|
||||
} ; --# notpresent
|
||||
inf = "be" ;
|
||||
ppart = "been" ;
|
||||
@@ -388,14 +400,14 @@ resource ResEng = ParamX ** open Prelude in {
|
||||
conjThat : Str = "that" ;
|
||||
|
||||
reflPron : Agr => Str = table {
|
||||
{n = Sg ; p = P1} => "myself" ;
|
||||
{n = Sg ; p = P2} => "yourself" ;
|
||||
{n = Sg ; p = P3 ; g = Masc} => "himself" ;
|
||||
{n = Sg ; p = P3 ; g = Fem} => "herself" ;
|
||||
{n = Sg ; p = P3} => "itself" ;
|
||||
{n = Pl ; p = P1} => "ourselves" ;
|
||||
{n = Pl ; p = P2} => "yourselves" ;
|
||||
{n = Pl ; p = P3} => "themselves"
|
||||
AgP1 Sg => "myself" ;
|
||||
AgP2 Sg => "yourself" ;
|
||||
AgP3Sg Masc => "himself" ;
|
||||
AgP3Sg Fem => "herself" ;
|
||||
AgP3Sg Neutr => "itself" ;
|
||||
AgP1 Pl => "ourselves" ;
|
||||
AgP2 Pl => "yourselves" ;
|
||||
AgP3Pl => "themselves"
|
||||
} ;
|
||||
|
||||
-- For $Sentence$.
|
||||
|
||||
@@ -11,7 +11,7 @@ concrete SentenceEng of Sentence = CatEng ** open Prelude, ResEng in {
|
||||
ImpVP vp = {
|
||||
s = \\pol,n =>
|
||||
let
|
||||
agr = {n = numImp n ; p = P2 ; g = Masc} ;
|
||||
agr = AgP2 (numImp n) ;
|
||||
verb = infVP True vp agr ;
|
||||
dont = case pol of {
|
||||
CNeg True => "don't" ;
|
||||
|
||||
Reference in New Issue
Block a user