forked from GitHub/gf-core
relatives
This commit is contained in:
@@ -2,9 +2,12 @@ abstract Cat = {
|
||||
cat
|
||||
S ;
|
||||
QS ;
|
||||
RS ;
|
||||
|
||||
Cl ;
|
||||
QCl ;
|
||||
RCl ;
|
||||
|
||||
Slash ;
|
||||
|
||||
VP ;
|
||||
@@ -39,6 +42,7 @@ abstract Cat = {
|
||||
Predet ;
|
||||
Quant ;
|
||||
Num ;
|
||||
Ord ;
|
||||
|
||||
Prep ;
|
||||
|
||||
|
||||
@@ -3,11 +3,13 @@ concrete CatEng of Cat = open ResEng, Prelude in {
|
||||
lincat
|
||||
S = {s : Str} ;
|
||||
QS = {s : QForm => Str} ;
|
||||
RS = {s : Agr => Str} ;
|
||||
|
||||
Cl = {s : Tense => Anteriority => Polarity => Ord => Str} ;
|
||||
Slash = {s : Tense => Anteriority => Polarity => Ord => Str} ** {c2 : Str} ;
|
||||
|
||||
QCl = {s : Tense => Anteriority => Polarity => QForm => Str} ;
|
||||
RCl = {s : Tense => Anteriority => Polarity => Agr => Str} ;
|
||||
|
||||
VP = {
|
||||
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} ;
|
||||
|
||||
Adv, AdV, AdA, AdS = {s : Str} ;
|
||||
Prep = {s : Str} ;
|
||||
|
||||
Det, Quant = {s : Str ; n : Number} ;
|
||||
Predet, Num = {s : Str} ;
|
||||
Predet, Num, Ord = {s : Str} ;
|
||||
|
||||
CN,N = {s : Number => Case => Str} ;
|
||||
PN = {s : Case => Str} ;
|
||||
@@ -39,6 +42,8 @@ concrete CatEng of Cat = open ResEng, Prelude in {
|
||||
IDet = {s : Str ; n : Number} ;
|
||||
IAdv = {s : Str} ;
|
||||
|
||||
RP = {s : Case => Str ; a : RAgr} ;
|
||||
|
||||
Numeral = {s : CardOrd => Str ; n : Number} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -18,14 +18,14 @@ abstract Lex = Cat ** {
|
||||
-- structural
|
||||
|
||||
|
||||
only_Predet : Predet ;
|
||||
only_Predet, all_Predet : Predet ;
|
||||
|
||||
this_Quant : Quant ;
|
||||
this_Quant, these_Quant : Quant ;
|
||||
|
||||
|
||||
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 ;
|
||||
|
||||
@@ -34,4 +34,8 @@ abstract Lex = Cat ** {
|
||||
here_Adv : Adv ;
|
||||
|
||||
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"} ;
|
||||
|
||||
only_Predet = {s = "only"} ;
|
||||
all_Predet = {s = "only"} ;
|
||||
this_Quant = {s = "this" ; n = Sg} ;
|
||||
these_Quant = {s = "these" ; n = Pl} ;
|
||||
|
||||
i_Pron = mkNP "I" "me" "my" Sg P1 ;
|
||||
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 ;
|
||||
|
||||
when_IAdv = {s = "when"} ;
|
||||
where_IAdv = {s = "where"} ;
|
||||
why_IAdv = {s = "why"} ;
|
||||
|
||||
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 ;
|
||||
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
|
||||
|
||||
NoNum : Num ;
|
||||
NumInt : Int -> Num ;
|
||||
|
||||
CardNumeral : Numeral -> Num ;
|
||||
OrdNumeral : Numeral -> Num ;
|
||||
NumNumeral : Numeral -> Num ;
|
||||
|
||||
OrdNumeral : Numeral -> Ord ;
|
||||
|
||||
NumSuperl : A -> Num ;
|
||||
NoOrd : Ord ;
|
||||
OrdSuperl : A -> Ord ;
|
||||
|
||||
NoPredet : Predet ;
|
||||
|
||||
@@ -28,6 +33,8 @@ abstract Noun = Cat ** {
|
||||
ComplN3 : N3 -> NP -> N2 ;
|
||||
|
||||
AdjCN : AP -> CN -> CN ;
|
||||
RelCN : CN -> RS -> CN ;
|
||||
|
||||
SentCN : CN -> S -> CN ;
|
||||
QuestCN : CN -> QS -> CN ;
|
||||
|
||||
|
||||
@@ -7,21 +7,21 @@ concrete NounEng of Noun = CatEng ** open ResEng, Prelude in {
|
||||
UsePN pn = pn ** agrP3 Sg ;
|
||||
UsePron p = p ;
|
||||
|
||||
MkDet pred quant num = {
|
||||
s = pred.s ++ quant.s ++ num.s ;
|
||||
MkDet pred quant num ord = {
|
||||
s = pred.s ++ quant.s ++ num.s ++ ord.s ;
|
||||
n = quant.n
|
||||
} ;
|
||||
|
||||
PossPronSg p = {s = p.s ! Gen ; n = Sg} ;
|
||||
PossPronPl p = {s = p.s ! Gen ; n = Pl} ;
|
||||
|
||||
NoNum, NoPredet = {s = []} ;
|
||||
NoPredet, NoNum, NoOrd = {s = []} ;
|
||||
NumInt n = n ;
|
||||
|
||||
CardNumeral numeral = {s = numeral.s ! NCard} ;
|
||||
NumNumeral numeral = {s = numeral.s ! NCard} ;
|
||||
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} ;
|
||||
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} ;
|
||||
|
||||
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} ;
|
||||
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 ;
|
||||
|
||||
PrepIP : Prep -> IP -> IAdv ;
|
||||
FunIP : N2 -> IP -> 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} ;
|
||||
|
||||
---- FunIP : N2 -> IP -> IP ;
|
||||
AdvIP ip adv = {
|
||||
s = \\c => ip.s ! c ++ adv.s ;
|
||||
n = ip.n
|
||||
} ;
|
||||
|
||||
IDetCN idet num cn = {
|
||||
s = \\c => idet.s ++ num.s ++ cn.s ! idet.n ! c ;
|
||||
IDetCN idet num ord cn = {
|
||||
s = \\c => idet.s ++ num.s ++ ord.s ++ cn.s ! idet.n ! c ;
|
||||
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$.
|
||||
|
||||
param
|
||||
|
||||
@@ -7,5 +7,7 @@ abstract Sentence = Cat ** {
|
||||
SlashV2 : NP -> V2 -> 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 ;
|
||||
c2 = slash.c2
|
||||
} ;
|
||||
|
||||
SlashPrep cl prep = cl ** {c2 = prep.s} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,9 +2,10 @@ abstract Test =
|
||||
Noun,
|
||||
Verb,
|
||||
Adjective,
|
||||
Numeral,
|
||||
-- Numeral,
|
||||
Sentence,
|
||||
Question,
|
||||
Relative,
|
||||
Untensed,
|
||||
-- Tensed,
|
||||
Lex
|
||||
|
||||
@@ -4,9 +4,10 @@ concrete TestEng of Test =
|
||||
NounEng,
|
||||
VerbEng,
|
||||
AdjectiveEng,
|
||||
NumeralEng,
|
||||
-- NumeralEng,
|
||||
SentenceEng,
|
||||
QuestionEng,
|
||||
RelativeEng,
|
||||
UntensedEng,
|
||||
-- TensedEng,
|
||||
LexEng
|
||||
|
||||
@@ -3,5 +3,6 @@ abstract Untensed = Cat ** {
|
||||
fun
|
||||
PosCl, NegCl : Cl -> S ;
|
||||
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} ;
|
||||
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