forked from GitHub/gf-core
English and Swedish resource functions for Query
This commit is contained in:
@@ -29,6 +29,10 @@ abstract Adjective = Cat ** {
|
|||||||
|
|
||||||
AdAP : AdA -> AP -> AP ; -- very warm
|
AdAP : AdA -> AP -> AP ; -- very warm
|
||||||
|
|
||||||
|
-- It can also be postmodified by an adverb, typically a prepositional phrase.
|
||||||
|
|
||||||
|
AdvAP : AP -> Adv -> AP ; -- warm by nature
|
||||||
|
|
||||||
-- The formation of adverbs from adjective (e.g. "quickly") is covered
|
-- The formation of adverbs from adjective (e.g. "quickly") is covered
|
||||||
-- in [Adverb Adverb.html].
|
-- in [Adverb Adverb.html].
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,13 @@ abstract Conjunction = Cat ** {
|
|||||||
--2 Rules
|
--2 Rules
|
||||||
|
|
||||||
fun
|
fun
|
||||||
ConjS : Conj -> [S] -> S ; -- "he walks and she runs"
|
ConjS : Conj -> [S] -> S ; -- "he walks and she runs"
|
||||||
ConjRS : Conj -> [RS] -> RS ; -- "who walks and whose mother runs"
|
ConjRS : Conj -> [RS] -> RS ; -- "who walks and whose mother runs"
|
||||||
ConjAP : Conj -> [AP] -> AP ; -- "cold and warm"
|
ConjAP : Conj -> [AP] -> AP ; -- "cold and warm"
|
||||||
ConjNP : Conj -> [NP] -> NP ; -- "she or we"
|
ConjNP : Conj -> [NP] -> NP ; -- "she or we"
|
||||||
ConjAdv : Conj -> [Adv] -> Adv ; -- "here or there"
|
ConjAdv : Conj -> [Adv] -> Adv ; -- "here or there"
|
||||||
|
ConjIAdv : Conj -> [IAdv] -> IAdv ; -- "where and with whom"
|
||||||
|
ConjCN : Conj -> [CN] -> CN ; -- "man and woman"
|
||||||
|
|
||||||
--2 Categories
|
--2 Categories
|
||||||
|
|
||||||
@@ -33,6 +35,8 @@ abstract Conjunction = Cat ** {
|
|||||||
[Adv]{2} ;
|
[Adv]{2} ;
|
||||||
[NP]{2} ;
|
[NP]{2} ;
|
||||||
[AP]{2} ;
|
[AP]{2} ;
|
||||||
|
[IAdv]{2} ;
|
||||||
|
[CN] {2} ;
|
||||||
|
|
||||||
--2 List constructors
|
--2 List constructors
|
||||||
|
|
||||||
|
|||||||
@@ -63,26 +63,7 @@ abstract Extra = Cat ** {
|
|||||||
|
|
||||||
UseFoc : Temp -> Pol -> Foc -> Utt ;
|
UseFoc : Temp -> Pol -> Foc -> Utt ;
|
||||||
|
|
||||||
cat
|
|
||||||
[CN] {2} ;
|
|
||||||
fun
|
fun
|
||||||
ConjCN : Conj -> [CN] -> CN ; -- (every) man and woman
|
|
||||||
|
|
||||||
PartVP : VP -> AP ; -- looking at Mary
|
PartVP : VP -> AP ; -- looking at Mary
|
||||||
|
|
||||||
cat
|
|
||||||
QVP ; -- buy what where
|
|
||||||
[IAdv] {2} ; -- when and where
|
|
||||||
fun
|
|
||||||
ComplSlashIP : VPSlash -> IP -> QVP ; -- buys what
|
|
||||||
AdvQVP : VP -> IAdv -> QVP ; -- lives where
|
|
||||||
AddAdvQVP : QVP -> IAdv -> QVP ; -- buys what where
|
|
||||||
|
|
||||||
QuestQVP : IP -> QVP -> QCl ; -- who buys what where
|
|
||||||
|
|
||||||
ConjIAdv : Conj -> [IAdv] -> IAdv ; -- when, where and with whom
|
|
||||||
|
|
||||||
AdvAP : AP -> Adv -> AP ; -- hungry as a wolf
|
|
||||||
|
|
||||||
UseCopula : VP ;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,4 +133,4 @@ abstract Noun = Cat ** {
|
|||||||
ApposCN : CN -> NP -> CN ; -- city Paris (, numbers x and y)
|
ApposCN : CN -> NP -> CN ; -- city Paris (, numbers x and y)
|
||||||
|
|
||||||
|
|
||||||
} ;
|
}
|
||||||
|
|||||||
@@ -42,4 +42,14 @@ abstract Question = Cat ** {
|
|||||||
|
|
||||||
-- More $IP$, $IDet$, and $IAdv$ are defined in $Structural$.
|
-- More $IP$, $IDet$, and $IAdv$ are defined in $Structural$.
|
||||||
|
|
||||||
|
-- Wh questions with two or more question words require a new, special category.
|
||||||
|
|
||||||
|
cat
|
||||||
|
QVP ; -- buy what where
|
||||||
|
fun
|
||||||
|
ComplSlashIP : VPSlash -> IP -> QVP ; -- buys what
|
||||||
|
AdvQVP : VP -> IAdv -> QVP ; -- lives where
|
||||||
|
AddAdvQVP : QVP -> IAdv -> QVP ; -- buys what where
|
||||||
|
|
||||||
|
QuestQVP : IP -> QVP -> QCl ; -- who buys what where
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,4 +69,7 @@ abstract Verb = Cat ** {
|
|||||||
CompAdv : Adv -> Comp ; -- (be) here
|
CompAdv : Adv -> Comp ; -- (be) here
|
||||||
CompCN : CN -> Comp ; -- (be) a man/men
|
CompCN : CN -> Comp ; -- (be) a man/men
|
||||||
|
|
||||||
|
-- Copula alone
|
||||||
|
|
||||||
|
UseCopula : VP ; -- be
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,4 +50,6 @@ concrete AdjectiveEng of Adjective = CatEng ** open ResEng, Prelude in {
|
|||||||
isPre = True
|
isPre = True
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
AdvAP ap adv = {s = \\a => ap.s ! a ++ adv.s ; isPre = False} ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ concrete ConjunctionEng of Conjunction =
|
|||||||
c = ss.c
|
c = ss.c
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
ConjIAdv = conjunctDistrSS ;
|
||||||
|
|
||||||
|
ConjCN co ns = conjunctDistrTable2 Number Case co ns ** {g = Neutr} ; --- gender?
|
||||||
|
|
||||||
-- These fun's are generated from the list cat's.
|
-- These fun's are generated from the list cat's.
|
||||||
|
|
||||||
BaseS = twoSS ;
|
BaseS = twoSS ;
|
||||||
@@ -33,12 +37,18 @@ concrete ConjunctionEng of Conjunction =
|
|||||||
ConsAP xs x = consrTable Agr comma xs x ** {isPre = andB xs.isPre x.isPre} ;
|
ConsAP xs x = consrTable Agr comma xs x ** {isPre = andB xs.isPre x.isPre} ;
|
||||||
BaseRS x y = twoTable Agr x y ** {c = y.c} ;
|
BaseRS x y = twoTable Agr x y ** {c = y.c} ;
|
||||||
ConsRS xs x = consrTable Agr comma xs x ** {c = xs.c} ;
|
ConsRS xs x = consrTable Agr comma xs x ** {c = xs.c} ;
|
||||||
|
BaseIAdv = twoSS ;
|
||||||
|
ConsIAdv = consrSS comma ;
|
||||||
|
BaseCN = twoTable2 Number Case ;
|
||||||
|
ConsCN = consrTable2 Number Case comma ;
|
||||||
|
|
||||||
lincat
|
lincat
|
||||||
[S] = {s1,s2 : Str} ;
|
[S] = {s1,s2 : Str} ;
|
||||||
[Adv] = {s1,s2 : Str} ;
|
[Adv] = {s1,s2 : Str} ;
|
||||||
|
[IAdv] = {s1,s2 : Str} ;
|
||||||
[NP] = {s1,s2 : Case => Str ; a : Agr} ;
|
[NP] = {s1,s2 : Case => Str ; a : Agr} ;
|
||||||
[AP] = {s1,s2 : Agr => Str ; isPre : Bool} ;
|
[AP] = {s1,s2 : Agr => Str ; isPre : Bool} ;
|
||||||
[RS] = {s1,s2 : Agr => Str ; c : Case} ;
|
[RS] = {s1,s2 : Agr => Str ; c : Case} ;
|
||||||
|
[CN] = {s1,s2 : Number => Case => Str} ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,8 +60,9 @@ concrete ExtraEng of ExtraEngAbs = CatEng **
|
|||||||
{ s = table {
|
{ s = table {
|
||||||
RC _ Gen => "whose" ;
|
RC _ Gen => "whose" ;
|
||||||
RC _ _ => "that" ;
|
RC _ _ => "that" ;
|
||||||
RPrep Neutr => "which" ;
|
_ => "that" ---- "in that" ?
|
||||||
RPrep _ => "whom"
|
-- RPrep Neutr => "which" ;
|
||||||
|
-- RPrep _ => "whom"
|
||||||
} ;
|
} ;
|
||||||
a = RNoAg
|
a = RNoAg
|
||||||
} ;
|
} ;
|
||||||
@@ -97,38 +98,10 @@ concrete ExtraEng of ExtraEngAbs = CatEng **
|
|||||||
|
|
||||||
IAdvAdv adv = {s = "how" ++ adv.s} ;
|
IAdvAdv adv = {s = "how" ++ adv.s} ;
|
||||||
|
|
||||||
lincat
|
|
||||||
[CN] = {s1,s2 : Number => Case => Str} ;
|
|
||||||
|
|
||||||
lin
|
|
||||||
BaseCN = twoTable2 Number Case ;
|
|
||||||
ConsCN = consrTable2 Number Case comma ;
|
|
||||||
ConjCN co ns = conjunctDistrTable2 Number Case co ns ** {g = Neutr} ; --- gender?
|
|
||||||
|
|
||||||
PartVP vp = {
|
PartVP vp = {
|
||||||
s = \\a => vp.ad ++ vp.prp ++ vp.s2 ! a ;
|
s = \\a => vp.ad ++ vp.prp ++ vp.s2 ! a ;
|
||||||
isPre = False ---- depends on whether there are complements
|
isPre = False ---- depends on whether there are complements
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
lincat
|
|
||||||
QVP = ResEng.VP ;
|
|
||||||
[IAdv] = {s1,s2 : Str} ;
|
|
||||||
lin
|
|
||||||
ComplSlashIP vp np = insertObjPre (\\_ => vp.c2 ++ np.s ! Acc) vp ;
|
|
||||||
AdvQVP vp adv = insertObj (\\_ => adv.s) vp ;
|
|
||||||
AddAdvQVP vp adv = insertObj (\\_ => adv.s) vp ;
|
|
||||||
|
|
||||||
QuestQVP qp vp =
|
|
||||||
let cl = mkClause (qp.s ! Nom) (agrP3 qp.n) vp
|
|
||||||
in {s = \\t,a,b,_ => cl.s ! t ! a ! b ! ODir} ;
|
|
||||||
|
|
||||||
BaseIAdv = twoSS ;
|
|
||||||
ConsIAdv = consrSS comma ;
|
|
||||||
ConjIAdv = conjunctDistrSS ;
|
|
||||||
|
|
||||||
AdvAP ap adv = {s = \\a => ap.s ! a ++ adv.s ; isPre = False} ;
|
|
||||||
|
|
||||||
UseCopula = predAux auxBe ;
|
|
||||||
|
|
||||||
UttVPShort vp = {s = infVP True vp (agrP3 Sg)} ;
|
UttVPShort vp = {s = infVP True vp (agrP3 Sg)} ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,4 +54,16 @@ concrete QuestionEng of Question = CatEng ** open ResEng, Prelude in {
|
|||||||
CompIAdv a = a ;
|
CompIAdv a = a ;
|
||||||
CompIP p = ss (p.s ! Nom) ;
|
CompIP p = ss (p.s ! Nom) ;
|
||||||
|
|
||||||
|
lincat
|
||||||
|
QVP = ResEng.VP ;
|
||||||
|
lin
|
||||||
|
ComplSlashIP vp np = insertObjPre (\\_ => vp.c2 ++ np.s ! Acc) vp ;
|
||||||
|
AdvQVP vp adv = insertObj (\\_ => adv.s) vp ;
|
||||||
|
AddAdvQVP vp adv = insertObj (\\_ => adv.s) vp ;
|
||||||
|
|
||||||
|
QuestQVP qp vp =
|
||||||
|
let cl = mkClause (qp.s ! Nom) (agrP3 qp.n) vp
|
||||||
|
in {s = \\t,a,b,_ => cl.s ! t ! a ! b ! ODir} ;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,4 +52,6 @@ concrete VerbEng of Verb = CatEng ** open ResEng in {
|
|||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
UseCopula = predAux auxBe ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,11 @@ incomplete concrete AdjectiveScand of Adjective =
|
|||||||
isPre = ap.isPre
|
isPre = ap.isPre
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
AdvAP ap adv = {
|
||||||
|
s = \\a => ap.s ! a ++ adv.s ;
|
||||||
|
isPre = ap.isPre
|
||||||
|
} ;
|
||||||
|
|
||||||
UseA2 a = {
|
UseA2 a = {
|
||||||
s = \\ap => a.s ! AF (APosit ap) Nom ;
|
s = \\ap => a.s ! AF (APosit ap) Nom ;
|
||||||
isPre = True
|
isPre = True
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ incomplete concrete CatScand of Cat =
|
|||||||
n3 : Agr => Str ; -- object-control complement
|
n3 : Agr => Str ; -- object-control complement
|
||||||
c2 : Complement
|
c2 : Complement
|
||||||
} ;
|
} ;
|
||||||
Comp = {s : AFormPos => Str} ;
|
Comp = {s : Agr => Str} ;
|
||||||
|
|
||||||
|
|
||||||
-- Adjective
|
-- Adjective
|
||||||
|
|||||||
@@ -21,6 +21,12 @@ incomplete concrete ConjunctionScand of Conjunction =
|
|||||||
c = ss.c
|
c = ss.c
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
ConjIAdv = conjunctDistrSS ;
|
||||||
|
|
||||||
|
ConjCN co ns = conjunctDistrTable3 Number DetSpecies Case co ns **
|
||||||
|
{g = utrum ; isMod = True} ; ----
|
||||||
|
|
||||||
|
|
||||||
-- These fun's are generated from the list cat's.
|
-- These fun's are generated from the list cat's.
|
||||||
|
|
||||||
BaseS = twoTable Order ;
|
BaseS = twoTable Order ;
|
||||||
@@ -33,12 +39,18 @@ incomplete concrete ConjunctionScand of Conjunction =
|
|||||||
ConsAP xs x = consrTable AFormPos comma xs x ** {isPre = andB xs.isPre x.isPre} ;
|
ConsAP xs x = consrTable AFormPos comma xs x ** {isPre = andB xs.isPre x.isPre} ;
|
||||||
BaseRS x y = twoTable Agr x y ** {c = y.c} ;
|
BaseRS x y = twoTable Agr x y ** {c = y.c} ;
|
||||||
ConsRS xs x = consrTable Agr comma xs x ** {c = xs.c} ;
|
ConsRS xs x = consrTable Agr comma xs x ** {c = xs.c} ;
|
||||||
|
BaseIAdv = twoSS ;
|
||||||
|
ConsIAdv = consrSS comma ;
|
||||||
|
BaseCN = twoTable3 Number DetSpecies Case ;
|
||||||
|
ConsCN = consrTable3 Number DetSpecies Case comma ;
|
||||||
|
|
||||||
lincat
|
lincat
|
||||||
[S] = {s1,s2 : Order => Str} ;
|
[S] = {s1,s2 : Order => Str} ;
|
||||||
[Adv] = {s1,s2 : Str} ;
|
[Adv] = {s1,s2 : Str} ;
|
||||||
|
[IAdv] = {s1,s2 : Str} ;
|
||||||
[NP] = {s1,s2 : NPForm => Str ; a : Agr} ;
|
[NP] = {s1,s2 : NPForm => Str ; a : Agr} ;
|
||||||
[AP] = {s1,s2 : AFormPos => Str ; isPre : Bool} ;
|
[AP] = {s1,s2 : AFormPos => Str ; isPre : Bool} ;
|
||||||
[RS] = {s1,s2 : Agr => Str ; c : NPForm} ;
|
[RS] = {s1,s2 : Agr => Str ; c : NPForm} ;
|
||||||
|
[CN] = {s1,s2 : Number => DetSpecies => Case => Str} ; --- g : NGender ; isMod : Bool} ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,4 +98,23 @@ incomplete concrete QuestionScand of Question =
|
|||||||
CompIAdv a = {s = \\_ => a.s} ;
|
CompIAdv a = {s = \\_ => a.s} ;
|
||||||
CompIP ip = {s = \\_ => ip.s ! nominative} ;
|
CompIP ip = {s = \\_ => ip.s ! nominative} ;
|
||||||
|
|
||||||
|
lincat
|
||||||
|
QVP = CommonScand.VP ;
|
||||||
|
lin
|
||||||
|
ComplSlashIP vp np = insertObj (\\_ => vp.c2.s ++ np.s ! accusative) vp ;
|
||||||
|
AdvQVP vp adv = insertObjPost (\\_ => adv.s) vp ;
|
||||||
|
AddAdvQVP vp adv = insertObjPost (\\_ => adv.s) vp ;
|
||||||
|
|
||||||
|
QuestQVP qp vp = {
|
||||||
|
s = \\t,a,b,q =>
|
||||||
|
let
|
||||||
|
somo = case q of {
|
||||||
|
QIndir => <"som",Sub> ;
|
||||||
|
_ => <[], Main>
|
||||||
|
} ;
|
||||||
|
cl = mkClause (qp.s ! nominative ++ somo.p1) {g = qp.g ; n = qp.n ; p = P3} vp
|
||||||
|
in
|
||||||
|
cl.s ! t ! a ! b ! somo.p2
|
||||||
|
} ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,16 +50,15 @@ incomplete concrete VerbScand of Verb = CatScand ** open CommonScand, ResScand i
|
|||||||
** {n3 = vp.n3 ; c2 = v.c2} ;
|
** {n3 = vp.n3 ; c2 = v.c2} ;
|
||||||
|
|
||||||
UseComp comp = insertObj
|
UseComp comp = insertObj
|
||||||
(\\a => comp.s ! agrAdjNP a DIndef) (predV verbBe) ;
|
comp.s (predV verbBe) ;
|
||||||
|
|
||||||
CompAP ap = ap ;
|
CompAP ap = {s = \\a => ap.s ! agrAdjNP a DIndef} ;
|
||||||
CompNP np = {s = \\_ => np.s ! accusative} ;
|
CompNP np = {s = \\_ => np.s ! accusative} ;
|
||||||
CompAdv a = {s = \\_ => a.s} ;
|
CompAdv a = {s = \\_ => a.s} ;
|
||||||
|
|
||||||
AdvVP vp adv = insertAdv adv.s vp ;
|
AdvVP vp adv = insertAdv adv.s vp ;
|
||||||
AdVVP adv vp = insertAdV adv.s vp ;
|
AdVVP adv vp = insertAdV adv.s vp ;
|
||||||
|
|
||||||
|
|
||||||
ReflVP vp = insertObj (\\a => vp.c2.s ++ reflPron a ++ vp.n3 ! a) vp ;
|
ReflVP vp = insertObj (\\a => vp.c2.s ++ reflPron a ++ vp.n3 ! a) vp ;
|
||||||
|
|
||||||
PassV2 v =
|
PassV2 v =
|
||||||
@@ -67,4 +66,12 @@ incomplete concrete VerbScand of Verb = CatScand ** open CommonScand, ResScand i
|
|||||||
(\\a => v.s ! VI (VPtPret (agrAdjNP a DIndef) Nom))
|
(\\a => v.s ! VI (VPtPret (agrAdjNP a DIndef) Nom))
|
||||||
(predV verbBecome) ;
|
(predV verbBecome) ;
|
||||||
|
|
||||||
|
CompCN cn = {s = \\a => case a.n of {
|
||||||
|
Sg => artIndef ! cn.g ++ cn.s ! Sg ! DIndef ! Nom ;
|
||||||
|
Pl => cn.s ! Pl ! DIndef ! Nom
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
UseCopula = predV verbBe ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user