mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-24 03:52:50 -06:00
relatives
This commit is contained in:
@@ -2,9 +2,12 @@ abstract Cat = {
|
|||||||
cat
|
cat
|
||||||
S ;
|
S ;
|
||||||
QS ;
|
QS ;
|
||||||
|
RS ;
|
||||||
|
|
||||||
Cl ;
|
Cl ;
|
||||||
QCl ;
|
QCl ;
|
||||||
|
RCl ;
|
||||||
|
|
||||||
Slash ;
|
Slash ;
|
||||||
|
|
||||||
VP ;
|
VP ;
|
||||||
@@ -39,6 +42,7 @@ abstract Cat = {
|
|||||||
Predet ;
|
Predet ;
|
||||||
Quant ;
|
Quant ;
|
||||||
Num ;
|
Num ;
|
||||||
|
Ord ;
|
||||||
|
|
||||||
Prep ;
|
Prep ;
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,13 @@ concrete CatEng of Cat = open ResEng, Prelude in {
|
|||||||
lincat
|
lincat
|
||||||
S = {s : Str} ;
|
S = {s : Str} ;
|
||||||
QS = {s : QForm => Str} ;
|
QS = {s : QForm => Str} ;
|
||||||
|
RS = {s : Agr => Str} ;
|
||||||
|
|
||||||
Cl = {s : Tense => Anteriority => Polarity => Ord => Str} ;
|
Cl = {s : Tense => Anteriority => Polarity => Ord => Str} ;
|
||||||
Slash = {s : Tense => Anteriority => Polarity => Ord => Str} ** {c2 : Str} ;
|
Slash = {s : Tense => Anteriority => Polarity => Ord => Str} ** {c2 : Str} ;
|
||||||
|
|
||||||
QCl = {s : Tense => Anteriority => Polarity => QForm => Str} ;
|
QCl = {s : Tense => Anteriority => Polarity => QForm => Str} ;
|
||||||
|
RCl = {s : Tense => Anteriority => Polarity => Agr => Str} ;
|
||||||
|
|
||||||
VP = {
|
VP = {
|
||||||
s : Tense => Anteriority => Polarity => Ord => Agr => {fin, inf : Str} ;
|
s : Tense => Anteriority => Polarity => Ord => Agr => {fin, inf : Str} ;
|
||||||
@@ -25,9 +27,10 @@ concrete CatEng of Cat = open ResEng, Prelude in {
|
|||||||
A2 = {s : AForm => Str ; c2 : Str} ;
|
A2 = {s : AForm => Str ; c2 : Str} ;
|
||||||
|
|
||||||
Adv, AdV, AdA, AdS = {s : Str} ;
|
Adv, AdV, AdA, AdS = {s : Str} ;
|
||||||
|
Prep = {s : Str} ;
|
||||||
|
|
||||||
Det, Quant = {s : Str ; n : Number} ;
|
Det, Quant = {s : Str ; n : Number} ;
|
||||||
Predet, Num = {s : Str} ;
|
Predet, Num, Ord = {s : Str} ;
|
||||||
|
|
||||||
CN,N = {s : Number => Case => Str} ;
|
CN,N = {s : Number => Case => Str} ;
|
||||||
PN = {s : Case => Str} ;
|
PN = {s : Case => Str} ;
|
||||||
@@ -39,6 +42,8 @@ concrete CatEng of Cat = open ResEng, Prelude in {
|
|||||||
IDet = {s : Str ; n : Number} ;
|
IDet = {s : Str ; n : Number} ;
|
||||||
IAdv = {s : Str} ;
|
IAdv = {s : Str} ;
|
||||||
|
|
||||||
|
RP = {s : Case => Str ; a : RAgr} ;
|
||||||
|
|
||||||
Numeral = {s : CardOrd => Str ; n : Number} ;
|
Numeral = {s : CardOrd => Str ; n : Number} ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,14 +18,14 @@ abstract Lex = Cat ** {
|
|||||||
-- structural
|
-- structural
|
||||||
|
|
||||||
|
|
||||||
only_Predet : Predet ;
|
only_Predet, all_Predet : Predet ;
|
||||||
|
|
||||||
this_Quant : Quant ;
|
this_Quant, these_Quant : Quant ;
|
||||||
|
|
||||||
|
|
||||||
i_Pron, he_Pron, we_Pron : Pron ;
|
i_Pron, he_Pron, we_Pron : Pron ;
|
||||||
|
|
||||||
whoSg_IP, whoPl_IP, whatSg_IP, whatPl_IP : IP ;
|
whoSg_IP, whoPl_IP : IP ;
|
||||||
|
|
||||||
when_IAdv, where_IAdv, why_IAdv : IAdv ;
|
when_IAdv, where_IAdv, why_IAdv : IAdv ;
|
||||||
|
|
||||||
@@ -34,4 +34,8 @@ abstract Lex = Cat ** {
|
|||||||
here_Adv : Adv ;
|
here_Adv : Adv ;
|
||||||
|
|
||||||
very_AdA : AdA ;
|
very_AdA : AdA ;
|
||||||
|
|
||||||
|
one_Numeral, forty_Numeral : Numeral ;
|
||||||
|
|
||||||
|
in_Prep, of_Prep : Prep ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,9 @@ concrete LexEng of Lex = CatEng ** open ResEng, Prelude in {
|
|||||||
very_AdA = {s = "very"} ;
|
very_AdA = {s = "very"} ;
|
||||||
|
|
||||||
only_Predet = {s = "only"} ;
|
only_Predet = {s = "only"} ;
|
||||||
|
all_Predet = {s = "only"} ;
|
||||||
this_Quant = {s = "this" ; n = Sg} ;
|
this_Quant = {s = "this" ; n = Sg} ;
|
||||||
|
these_Quant = {s = "these" ; n = Pl} ;
|
||||||
|
|
||||||
i_Pron = mkNP "I" "me" "my" Sg P1 ;
|
i_Pron = mkNP "I" "me" "my" Sg P1 ;
|
||||||
he_Pron = mkNP "he" "him" "his" Sg P3 ;
|
he_Pron = mkNP "he" "him" "his" Sg P3 ;
|
||||||
@@ -29,7 +31,16 @@ concrete LexEng of Lex = CatEng ** open ResEng, Prelude in {
|
|||||||
whoPl_IP = mkIP "who" "whom" "whose" Pl ;
|
whoPl_IP = mkIP "who" "whom" "whose" Pl ;
|
||||||
|
|
||||||
when_IAdv = {s = "when"} ;
|
when_IAdv = {s = "when"} ;
|
||||||
|
where_IAdv = {s = "where"} ;
|
||||||
|
why_IAdv = {s = "why"} ;
|
||||||
|
|
||||||
whichSg_IDet = {s = "which" ; n = Sg} ;
|
whichSg_IDet = {s = "which" ; n = Sg} ;
|
||||||
|
whichPl_IDet = {s = "which" ; n = Pl} ;
|
||||||
|
|
||||||
|
one_Numeral = {s = table {NCard => "one" ; NOrd => "first"} ; n = Sg} ;
|
||||||
|
forty_Numeral = {s = table {NCard => "forty" ; NOrd => "fortieth"} ; n = Pl} ;
|
||||||
|
|
||||||
|
in_Prep = {s = "in"} ;
|
||||||
|
of_Prep = {s = "of"} ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,17 +7,22 @@ abstract Noun = Cat ** {
|
|||||||
UsePN : PN -> NP ;
|
UsePN : PN -> NP ;
|
||||||
UsePron : Pron -> NP ;
|
UsePron : Pron -> NP ;
|
||||||
|
|
||||||
MkDet : Predet -> Quant -> Num -> Det ;
|
-- Determiner structure à la CLE; we further divide $Num$ into cardinal
|
||||||
|
-- and ordinal/superlative. So we get e.g. "my first forty books".
|
||||||
|
|
||||||
|
MkDet : Predet -> Quant -> Num -> Ord -> Det ;
|
||||||
|
|
||||||
PossPronSg, PossPronPl : Pron -> Quant ; --- PossNP not in romance
|
PossPronSg, PossPronPl : Pron -> Quant ; --- PossNP not in romance
|
||||||
|
|
||||||
NoNum : Num ;
|
NoNum : Num ;
|
||||||
NumInt : Int -> Num ;
|
NumInt : Int -> Num ;
|
||||||
|
|
||||||
CardNumeral : Numeral -> Num ;
|
NumNumeral : Numeral -> Num ;
|
||||||
OrdNumeral : Numeral -> Num ;
|
|
||||||
|
OrdNumeral : Numeral -> Ord ;
|
||||||
|
|
||||||
NumSuperl : A -> Num ;
|
NoOrd : Ord ;
|
||||||
|
OrdSuperl : A -> Ord ;
|
||||||
|
|
||||||
NoPredet : Predet ;
|
NoPredet : Predet ;
|
||||||
|
|
||||||
@@ -28,6 +33,8 @@ abstract Noun = Cat ** {
|
|||||||
ComplN3 : N3 -> NP -> N2 ;
|
ComplN3 : N3 -> NP -> N2 ;
|
||||||
|
|
||||||
AdjCN : AP -> CN -> CN ;
|
AdjCN : AP -> CN -> CN ;
|
||||||
|
RelCN : CN -> RS -> CN ;
|
||||||
|
|
||||||
SentCN : CN -> S -> CN ;
|
SentCN : CN -> S -> CN ;
|
||||||
QuestCN : CN -> QS -> CN ;
|
QuestCN : CN -> QS -> CN ;
|
||||||
|
|
||||||
|
|||||||
@@ -7,21 +7,21 @@ concrete NounEng of Noun = CatEng ** open ResEng, Prelude in {
|
|||||||
UsePN pn = pn ** agrP3 Sg ;
|
UsePN pn = pn ** agrP3 Sg ;
|
||||||
UsePron p = p ;
|
UsePron p = p ;
|
||||||
|
|
||||||
MkDet pred quant num = {
|
MkDet pred quant num ord = {
|
||||||
s = pred.s ++ quant.s ++ num.s ;
|
s = pred.s ++ quant.s ++ num.s ++ ord.s ;
|
||||||
n = quant.n
|
n = quant.n
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
PossPronSg p = {s = p.s ! Gen ; n = Sg} ;
|
PossPronSg p = {s = p.s ! Gen ; n = Sg} ;
|
||||||
PossPronPl p = {s = p.s ! Gen ; n = Pl} ;
|
PossPronPl p = {s = p.s ! Gen ; n = Pl} ;
|
||||||
|
|
||||||
NoNum, NoPredet = {s = []} ;
|
NoPredet, NoNum, NoOrd = {s = []} ;
|
||||||
NumInt n = n ;
|
NumInt n = n ;
|
||||||
|
|
||||||
CardNumeral numeral = {s = numeral.s ! NCard} ;
|
NumNumeral numeral = {s = numeral.s ! NCard} ;
|
||||||
OrdNumeral numeral = {s = numeral.s ! NOrd} ;
|
OrdNumeral numeral = {s = numeral.s ! NOrd} ;
|
||||||
|
|
||||||
NumSuperl a = {s = a.s ! AAdj Superl} ;
|
OrdSuperl a = {s = a.s ! AAdj Superl} ;
|
||||||
|
|
||||||
DefSg = {s = "the" ; n = Sg} ;
|
DefSg = {s = "the" ; n = Sg} ;
|
||||||
DefPl = {s = "the" ; n = Pl} ;
|
DefPl = {s = "the" ; n = Pl} ;
|
||||||
@@ -33,6 +33,7 @@ concrete NounEng of Noun = CatEng ** open ResEng, Prelude in {
|
|||||||
ComplN3 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c ; c2 = f.c3} ;
|
ComplN3 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c ; c2 = f.c3} ;
|
||||||
|
|
||||||
AdjCN ap cn = {s = \\n,c => preOrPost ap.isPre ap.s (cn.s ! n ! c)} ;
|
AdjCN ap cn = {s = \\n,c => preOrPost ap.isPre ap.s (cn.s ! n ! c)} ;
|
||||||
|
RelCN cn rs = {s = \\n,c => cn.s ! n ! c ++ rs.s ! {n = n ; p = P3}} ;
|
||||||
|
|
||||||
SentCN cn s = {s = \\n,c => cn.s ! n ! c ++ conjThat ++ s.s} ;
|
SentCN cn s = {s = \\n,c => cn.s ! n ! c ++ conjThat ++ s.s} ;
|
||||||
QuestCN cn qs = {s = \\n,c => cn.s ! n ! c ++ qs.s ! QIndir} ;
|
QuestCN cn qs = {s = \\n,c => cn.s ! n ! c ++ qs.s ! QIndir} ;
|
||||||
|
|||||||
@@ -8,10 +8,9 @@ abstract Question = Cat, Sentence ** {
|
|||||||
QuestIAdv : IAdv -> Cl -> QCl ;
|
QuestIAdv : IAdv -> Cl -> QCl ;
|
||||||
|
|
||||||
PrepIP : Prep -> IP -> IAdv ;
|
PrepIP : Prep -> IP -> IAdv ;
|
||||||
FunIP : N2 -> IP -> IP ;
|
|
||||||
AdvIP : IP -> Adv -> IP ;
|
AdvIP : IP -> Adv -> IP ;
|
||||||
|
|
||||||
IDetCN : IDet -> Num -> CN -> IP ;
|
IDetCN : IDet -> Num -> Ord -> CN -> IP ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,16 +46,14 @@ concrete QuestionEng of Question = CatEng, SentenceEng ** open ResEng in {
|
|||||||
|
|
||||||
PrepIP p ip = {s = p.s ++ ip.s ! Nom} ;
|
PrepIP p ip = {s = p.s ++ ip.s ! Nom} ;
|
||||||
|
|
||||||
---- FunIP : N2 -> IP -> IP ;
|
|
||||||
AdvIP ip adv = {
|
AdvIP ip adv = {
|
||||||
s = \\c => ip.s ! c ++ adv.s ;
|
s = \\c => ip.s ! c ++ adv.s ;
|
||||||
n = ip.n
|
n = ip.n
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
IDetCN idet num cn = {
|
IDetCN idet num ord cn = {
|
||||||
s = \\c => idet.s ++ num.s ++ cn.s ! idet.n ! c ;
|
s = \\c => idet.s ++ num.s ++ ord.s ++ cn.s ! idet.n ! c ;
|
||||||
n = idet.n
|
n = idet.n
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
13
lib/resource-1.0/gf/Relative.gf
Normal file
13
lib/resource-1.0/gf/Relative.gf
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
abstract Relative = Cat, Sentence ** {
|
||||||
|
|
||||||
|
fun
|
||||||
|
|
||||||
|
RelCl : Cl -> RCl ;
|
||||||
|
RelVP : RP -> VP -> RCl ;
|
||||||
|
RelSlash : RP -> Slash -> RCl ;
|
||||||
|
|
||||||
|
FunRP : Prep -> NP -> RP -> RP ;
|
||||||
|
IdRP : RP ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
34
lib/resource-1.0/gf/RelativeEng.gf
Normal file
34
lib/resource-1.0/gf/RelativeEng.gf
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
concrete RelativeEng of Relative = CatEng, SentenceEng ** open ResEng in {
|
||||||
|
|
||||||
|
lin
|
||||||
|
|
||||||
|
RelCl cl = {
|
||||||
|
s = \\t,a,p,_ => "such" ++ "that" ++ cl.s ! t ! a ! p ! ODir
|
||||||
|
} ;
|
||||||
|
|
||||||
|
RelVP rp vp = {
|
||||||
|
s = \\t,ant,b,ag =>
|
||||||
|
let
|
||||||
|
agr = case rp.a of {
|
||||||
|
RNoAg => ag ;
|
||||||
|
RAg a => a
|
||||||
|
} ;
|
||||||
|
verb = vp.s ! t ! ant ! b ! ODir ! agr ;
|
||||||
|
subj = rp.s ! Nom ;
|
||||||
|
compl = vp.s2 ! agr
|
||||||
|
in
|
||||||
|
subj ++ verb.fin ++ verb.inf ++ compl
|
||||||
|
} ;
|
||||||
|
|
||||||
|
RelSlash rp slash = {
|
||||||
|
s = \\t,a,p,_ => slash.c2 ++ rp.s ! Acc ++ slash.s ! t ! a ! p ! ODir
|
||||||
|
} ;
|
||||||
|
|
||||||
|
FunRP p np rp = {
|
||||||
|
s = \\c => np.s ! c ++ p.s ++ rp.s ! Acc ;
|
||||||
|
a = RAg np.a
|
||||||
|
} ;
|
||||||
|
|
||||||
|
IdRP = mkIP "which" "which" "whose" Sg ** {a = RNoAg} ;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -176,6 +176,11 @@ oper
|
|||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
-- For $Relative$.
|
||||||
|
|
||||||
|
param
|
||||||
|
RAgr = RNoAg | RAg {n : Number ; p : Person} ;
|
||||||
|
|
||||||
-- For $Numeral$.
|
-- For $Numeral$.
|
||||||
|
|
||||||
param
|
param
|
||||||
|
|||||||
@@ -7,5 +7,7 @@ abstract Sentence = Cat ** {
|
|||||||
SlashV2 : NP -> V2 -> Slash ;
|
SlashV2 : NP -> V2 -> Slash ;
|
||||||
|
|
||||||
AdvSlash : Slash -> Adv -> Slash ;
|
AdvSlash : Slash -> Adv -> Slash ;
|
||||||
|
|
||||||
|
SlashPrep : Cl -> Prep -> Slash ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,4 +36,7 @@ concrete SentenceEng of Sentence = CatEng ** open ResEng in {
|
|||||||
s = \\t,a,b,o => slash.s ! t ! a ! b ! o ++ adv.s ;
|
s = \\t,a,b,o => slash.s ! t ! a ! b ! o ++ adv.s ;
|
||||||
c2 = slash.c2
|
c2 = slash.c2
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
SlashPrep cl prep = cl ** {c2 = prep.s} ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ abstract Test =
|
|||||||
Noun,
|
Noun,
|
||||||
Verb,
|
Verb,
|
||||||
Adjective,
|
Adjective,
|
||||||
Numeral,
|
-- Numeral,
|
||||||
Sentence,
|
Sentence,
|
||||||
Question,
|
Question,
|
||||||
|
Relative,
|
||||||
Untensed,
|
Untensed,
|
||||||
-- Tensed,
|
-- Tensed,
|
||||||
Lex
|
Lex
|
||||||
|
|||||||
@@ -4,9 +4,10 @@ concrete TestEng of Test =
|
|||||||
NounEng,
|
NounEng,
|
||||||
VerbEng,
|
VerbEng,
|
||||||
AdjectiveEng,
|
AdjectiveEng,
|
||||||
NumeralEng,
|
-- NumeralEng,
|
||||||
SentenceEng,
|
SentenceEng,
|
||||||
QuestionEng,
|
QuestionEng,
|
||||||
|
RelativeEng,
|
||||||
UntensedEng,
|
UntensedEng,
|
||||||
-- TensedEng,
|
-- TensedEng,
|
||||||
LexEng
|
LexEng
|
||||||
|
|||||||
@@ -3,5 +3,6 @@ abstract Untensed = Cat ** {
|
|||||||
fun
|
fun
|
||||||
PosCl, NegCl : Cl -> S ;
|
PosCl, NegCl : Cl -> S ;
|
||||||
PosQCl, NegQCl : QCl -> QS ;
|
PosQCl, NegQCl : QCl -> QS ;
|
||||||
|
PosRCl, NegRCl : RCl -> RS ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,4 +9,7 @@ concrete UntensedEng of Untensed = CatEng ** open ResEng in {
|
|||||||
PosQCl cl = {s = cl.s ! Pres ! Simul ! Pos} ;
|
PosQCl cl = {s = cl.s ! Pres ! Simul ! Pos} ;
|
||||||
NegQCl cl = {s = cl.s ! Pres ! Simul ! Neg} ;
|
NegQCl cl = {s = cl.s ! Pres ! Simul ! Neg} ;
|
||||||
|
|
||||||
|
PosRCl cl = {s = cl.s ! Pres ! Simul ! Pos} ;
|
||||||
|
NegRCl cl = {s = cl.s ! Pres ! Simul ! Neg} ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user