forked from GitHub/gf-rgl
Merge branch 'master' of https://github.com/GrammaticalFramework/GF
This commit is contained in:
190
src/abstract/Extend.gf
Normal file
190
src/abstract/Extend.gf
Normal file
@@ -0,0 +1,190 @@
|
|||||||
|
--1 Extensions of core RGL syntax (the Grammar module)
|
||||||
|
|
||||||
|
-- This module defines syntax rules that are not yet implemented in all
|
||||||
|
-- languages, and perhaps never implementable either. But all rules are given
|
||||||
|
-- a default implementation in common/ExtendFunctor.gf so that they can be included
|
||||||
|
-- in the library API. The default implementations are meant to be overridden in each
|
||||||
|
-- xxxxx/ExtendXxx.gf when the work proceeds.
|
||||||
|
--
|
||||||
|
-- This module is aimed to replace the original Extra.gf, which is kept alive just
|
||||||
|
-- for backwardcommon compatibility. It will also replace translator/Extensions.gf
|
||||||
|
-- and thus eliminate the often duplicated work in those two modules.
|
||||||
|
--
|
||||||
|
-- (c) Aarne Ranta 2017-08-20 under LGPL and BSD
|
||||||
|
|
||||||
|
|
||||||
|
abstract Extend = Cat ** {
|
||||||
|
|
||||||
|
fun
|
||||||
|
GenNP : NP -> Quant ; -- this man's
|
||||||
|
GenIP : IP -> IQuant ; -- whose
|
||||||
|
GenRP : Num -> CN -> RP ; -- whose car
|
||||||
|
|
||||||
|
-- In case the first two are not available, the following applications should in any case be.
|
||||||
|
|
||||||
|
GenModNP : Num -> NP -> CN -> NP ; -- this man's car(s)
|
||||||
|
GenModIP : Num -> IP -> CN -> IP ; -- whose car(s)
|
||||||
|
|
||||||
|
CompBareCN : CN -> Comp ; -- (est) professeur
|
||||||
|
|
||||||
|
StrandQuestSlash : IP -> ClSlash -> QCl ; -- whom does John live with
|
||||||
|
StrandRelSlash : RP -> ClSlash -> RCl ; -- that he lives in
|
||||||
|
EmptyRelSlash : ClSlash -> RCl ; -- he lives in
|
||||||
|
|
||||||
|
|
||||||
|
-- $VP$ conjunction, covering both finite and infinitive forms (formerly VPI and VPS).
|
||||||
|
|
||||||
|
cat
|
||||||
|
VPS ;
|
||||||
|
[VPS] {2} ;
|
||||||
|
|
||||||
|
fun
|
||||||
|
MkVPS : Temp -> Pol -> VP -> VPS ; -- to sleep / hasn't slept
|
||||||
|
ConjVPS : Conj -> [VPS] -> VPS ; -- has walked and won't sleep
|
||||||
|
PredVPS : NP -> VPS -> S ; -- she [has walked and won't sleep]
|
||||||
|
ComplVPSVV : VV -> VPS -> VP ; -- want to sleep and to walk
|
||||||
|
|
||||||
|
-- in case ComplVPSVV is not available:
|
||||||
|
|
||||||
|
PredVPSVV : NP -> VV -> VPS -> VP ; -- she wants to sleep and to walk
|
||||||
|
|
||||||
|
|
||||||
|
fun
|
||||||
|
ProDrop : Pron -> Pron ; -- unstressed subject pronoun becomes []: "(io) sono stanco"
|
||||||
|
|
||||||
|
ICompAP : AP -> IComp ; -- "how old"
|
||||||
|
IAdvAdv : Adv -> IAdv ; -- "how often"
|
||||||
|
|
||||||
|
CompIQuant : IQuant -> IComp ; -- which (is it) [agreement to NP]
|
||||||
|
|
||||||
|
PrepCN : Prep -> CN -> Adv ; -- by accident [Prep + CN without article]
|
||||||
|
|
||||||
|
-- fronted/focal constructions, only for main clauses
|
||||||
|
|
||||||
|
fun
|
||||||
|
FocusObj : NP -> SSlash -> Utt ; -- her I love
|
||||||
|
FocusAdv : Adv -> S -> Utt ; -- today I will sleep
|
||||||
|
FocusAdV : AdV -> S -> Utt ; -- never will I sleep
|
||||||
|
FocusAP : AP -> NP -> Utt ; -- green was the tree
|
||||||
|
|
||||||
|
-- participle constructions
|
||||||
|
PresPartAP : VP -> AP ; -- (the man) looking at Mary
|
||||||
|
EmbedPresPart : VP -> SC ; -- looking at Mary (is fun)
|
||||||
|
|
||||||
|
PastPartAP : VPSlash -> AP ; -- lost (opportunity) ; (opportunity) lost in space
|
||||||
|
PastPartAgentAP : VPSlash -> NP -> AP ; -- (opportunity) lost by the company
|
||||||
|
|
||||||
|
-- this is a generalization of Verb.PassV2 and should replace it in the future.
|
||||||
|
|
||||||
|
PassVPSlash : VPSlash -> VP ; -- be forced to sleep
|
||||||
|
|
||||||
|
-- the form with an agent may result in a different linearization
|
||||||
|
-- from an adverbial modification by an agent phrase.
|
||||||
|
|
||||||
|
PassAgentVPSlash : VPSlash -> NP -> VP ; -- be begged by her to go
|
||||||
|
|
||||||
|
-- publishing of the document
|
||||||
|
|
||||||
|
NominalizeVPSlashNP : VPSlash -> NP -> NP ;
|
||||||
|
|
||||||
|
-- existential for mathematics
|
||||||
|
|
||||||
|
ExistsNP : NP -> Cl ; -- there exists a number / there exist numbers
|
||||||
|
|
||||||
|
-- infinitive for purpose AR 21/8/2013
|
||||||
|
|
||||||
|
PurposeVP : VP -> Adv ; -- to become happy
|
||||||
|
|
||||||
|
-- object S without "that"
|
||||||
|
|
||||||
|
ComplBareVS : VS -> S -> VP ; -- say she runs
|
||||||
|
SlashBareV2S : V2S -> S -> VPSlash ; -- answer (to him) it is good
|
||||||
|
|
||||||
|
-- front the extraposed part
|
||||||
|
|
||||||
|
FrontExtPredVP : NP -> VP -> Cl ; -- I am here, she said
|
||||||
|
InvFrontExtPredVP : NP -> VP -> Cl ; -- I am here, said she
|
||||||
|
|
||||||
|
-- to use an AP as CN or NP without CN
|
||||||
|
|
||||||
|
AdjAsCN : AP -> CN ; -- a green one ; en grön (Swe)
|
||||||
|
AdjAsNP : AP -> NP ; -- green (is good)
|
||||||
|
|
||||||
|
-- reflexive noun phrases: a generalization of Verb.ReflVP, which covers just reflexive pronouns
|
||||||
|
-- This is necessary in languages like Swedish, which have special reflexive possessives.
|
||||||
|
-- However, it is also needed in application grammars that want to treat "brush one's teeth" as a one-place predicate.
|
||||||
|
|
||||||
|
cat
|
||||||
|
RNP ; -- reflexive noun phrase, e.g. "my family and myself"
|
||||||
|
RNPList ; -- list of reflexives to be coordinated, e.g. "my family, myself, everyone"
|
||||||
|
|
||||||
|
-- Notice that it is enough for one NP in RNPList to be RNP.
|
||||||
|
|
||||||
|
fun
|
||||||
|
ReflRNP : VPSlash -> RNP -> VP ; -- love my family and myself
|
||||||
|
|
||||||
|
ReflPron : RNP ; -- myself
|
||||||
|
ReflPoss : Num -> CN -> RNP ; -- my car(s)
|
||||||
|
|
||||||
|
PredetRNP : Predet -> RNP -> RNP ; -- all my brothers
|
||||||
|
|
||||||
|
ConjRNP : Conj -> RNPList -> RNP ; -- my family, John and myself
|
||||||
|
|
||||||
|
Base_rr_RNP : RNP -> RNP -> RNPList ; -- my family, myself
|
||||||
|
Base_nr_RNP : NP -> RNP -> RNPList ; -- John, myself
|
||||||
|
Base_rn_RNP : RNP -> NP -> RNPList ; -- myself, John
|
||||||
|
Cons_rr_RNP : RNP -> RNPList -> RNPList ; -- my family, myself, John
|
||||||
|
Cons_nr_RNP : NP -> RNPList -> RNPList ; -- John, my family, myself
|
||||||
|
---- Cons_rn_RNP : RNP -> ListNP -> RNPList ; -- myself, John, Mary
|
||||||
|
|
||||||
|
|
||||||
|
--- from Extensions
|
||||||
|
|
||||||
|
ComplGenVV : VV -> Ant -> Pol -> VP -> VP ; -- want not to have slept
|
||||||
|
SlashV2V : V2V -> Ant -> Pol -> VPS -> VPSlash ; -- force (her) not to have slept
|
||||||
|
|
||||||
|
CompoundN : N -> N -> N ; -- control system / controls system / control-system
|
||||||
|
CompoundAP : N -> A -> AP ; -- language independent / language-independent
|
||||||
|
|
||||||
|
GerundCN : VP -> CN ; -- publishing of the document (can get a determiner)
|
||||||
|
GerundNP : VP -> NP ; -- publishing the document (by nature definite)
|
||||||
|
GerundAdv : VP -> Adv ; -- publishing the document (prepositionless adverb)
|
||||||
|
|
||||||
|
WithoutVP : VP -> Adv ; -- without publishing the document
|
||||||
|
ByVP : VP -> Adv ; -- by publishing the document
|
||||||
|
InOrderToVP : VP -> Adv ; -- (in order) to publish the document
|
||||||
|
|
||||||
|
ApposNP : NP -> NP -> NP ; -- Mr Macron, the president of France,
|
||||||
|
|
||||||
|
AdAdV : AdA -> AdV -> AdV ; -- almost always
|
||||||
|
UttAdV : AdV -> Utt ; -- always(!)
|
||||||
|
PositAdVAdj : A -> AdV ; -- (that she) positively (sleeps)
|
||||||
|
|
||||||
|
CompS : S -> Comp ; -- (the fact is) that she sleeps
|
||||||
|
CompQS : QS -> Comp ; -- (the question is) who sleeps
|
||||||
|
CompVP : Ant -> Pol -> VP -> Comp ; -- (she is) to go
|
||||||
|
|
||||||
|
-- very language-specific things
|
||||||
|
|
||||||
|
-- Eng
|
||||||
|
UncontractedNeg : Pol ; -- do not, etc, as opposed to don't
|
||||||
|
UttVPShort : VP -> Utt ; -- have fun, as opposed to "to have fun"
|
||||||
|
ComplSlashPartLast : VPSlash -> NP -> VP ;
|
||||||
|
|
||||||
|
-- Romance
|
||||||
|
DetNPFem : Det -> NP ;
|
||||||
|
|
||||||
|
iFem_Pron : Pron ; -- je (suis vieille)
|
||||||
|
youFem_Pron : Pron ; -- tu (es vieille)
|
||||||
|
weFem_Pron : Pron ; -- nous (sommes vieilles)
|
||||||
|
youPlFem_Pron : Pron ; -- vous (êtes vieilles)
|
||||||
|
theyFem_Pron : Pron ; -- elles (sont vieilles)
|
||||||
|
youPolFem_Pron : Pron ; -- vous (êtes vieille)
|
||||||
|
|
||||||
|
-- German
|
||||||
|
UttAccNP : NP -> Utt ; -- mich
|
||||||
|
UttDatNP : NP -> Utt ; -- mir
|
||||||
|
UttAccIP : NP -> Utt ; -- wen
|
||||||
|
UttDatIP : NP -> Utt ; -- wem
|
||||||
|
|
||||||
|
}
|
||||||
93
src/common/ExtendFunctor.gf
Normal file
93
src/common/ExtendFunctor.gf
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
incomplete concrete ExtendFunctor of Extend = Cat ** open Grammar in {
|
||||||
|
|
||||||
|
lincat
|
||||||
|
RNP = Grammar.NP ;
|
||||||
|
RNPList = Grammar.ListNP ;
|
||||||
|
|
||||||
|
lin
|
||||||
|
BaseVPS = variants {} ;
|
||||||
|
ConsVPS = variants {} ;
|
||||||
|
|
||||||
|
|
||||||
|
lin
|
||||||
|
GenNP = variants {} ; -- NP -> Quant ; -- this man's
|
||||||
|
GenIP = variants {} ; -- IP -> IQuant ; -- whose
|
||||||
|
GenRP = variants {} ; -- Num -> CN -> RP ; -- whose car
|
||||||
|
GenModNP num np cn = DetCN (DetQuant DefArt num) (AdvCN cn (PrepNP possess_Prep np)) ; -- this man's car(s) ; DEFAULT the car of this man
|
||||||
|
GenModIP = variants {} ; -- Num -> IP -> CN -> IP ; -- whose car(s)
|
||||||
|
CompBareCN cn = CompCN cn ; -- (est) professeur ; DEFAULT is a teacher
|
||||||
|
StrandQuestSlash = QuestSlash ; -- whom does John live with ; DEFAULT with whom does John live
|
||||||
|
StrandRelSlash = RelSlash ; -- that he lives in ; DEFAULT in which he lives
|
||||||
|
EmptyRelSlash = RelSlash IdRP ; -- he lives in ; DEFAULT in which he lives
|
||||||
|
MkVPS vp = variants {} ; -- Temp -> Pol -> VP -> VPS ; -- to sleep / hasn't slept
|
||||||
|
ConjVPS = variants {} ; -- Conj -> [VPS] -> VPS ; -- has walked and won't sleep
|
||||||
|
PredVPS = variants {} ; -- NP -> VPS -> S ; -- she [has walked and won't sleep]
|
||||||
|
ComplVPSVV = variants {} ; -- VV -> VPS -> VP ; -- want to sleep and to walk
|
||||||
|
PredVPSVV = variants {} ; -- NP -> VV -> VPS -> VP ; -- she wants to sleep and to walk
|
||||||
|
ProDrop pro = pro ; -- am tired ; DEFAULT I am tired
|
||||||
|
ICompAP = variants {} ; -- AP -> IComp ; -- "how old"
|
||||||
|
IAdvAdv = variants {} ; -- Adv -> IAdv ; -- "how often"
|
||||||
|
CompIQuant iquant = CompIP (IdetIP (IdetQuant iquant NumSg)) ; -- which (is it) [agreement to NP] ; DEFAULT which [no agreement]
|
||||||
|
PrepCN prep cn = PrepNP prep (MassNP cn) ; -- Prep -> CN -> Adv ; -- by accident [Prep + CN without article] ; DEFAULT CN as mass term
|
||||||
|
FocusObj = variants {} ; -- NP -> SSlash -> Utt ; -- her I love
|
||||||
|
FocusAdv = variants {} ; -- Adv -> S -> Utt ; -- today I will sleep
|
||||||
|
FocusAdV = variants {} ; -- AdV -> S -> Utt ; -- never will I sleep
|
||||||
|
FocusAP = variants {} ; -- AP -> NP -> Utt ; -- green was the tree
|
||||||
|
ParticipleAP = variants {} ; -- VP -> AP ; -- (the man) looking at Mary
|
||||||
|
EmbedPresPart = variants {} ; -- VP -> SC ; -- looking at Mary (is fun)
|
||||||
|
PassVPSlash = variants {} ; -- VPSlash -> VP ; -- be forced to sleep
|
||||||
|
PassAgentVPSlash = variants {} ; -- VPSlash -> NP -> VP ; -- be begged by her to go
|
||||||
|
PastPartAP = variants {} ; -- VPSlash -> AP ; -- lost (opportunity) ; (opportunity) lost in space
|
||||||
|
PastPartAgentAP = variants {} ; -- VPSlash -> NP -> AP ; -- (opportunity) lost by the company
|
||||||
|
NominalizeVPSlashNP = variants {} ; -- VPSlash -> NP -> NP ;
|
||||||
|
ExistsNP = variants {} ; -- NP -> Cl ; -- there exists a number / there exist numbers
|
||||||
|
PurposeVP = variants {} ; -- VP -> Adv ; -- to become happy
|
||||||
|
ComplBareVS = variants {} ; -- VS -> S -> VP ; -- say she runs
|
||||||
|
SlashBareV2S = variants {} ; -- V2S -> S -> VPSlash ; -- answer (to him) it is good
|
||||||
|
FrontExtPredVP = variants {} ; -- NP -> VP -> Cl ; -- I am here, she said
|
||||||
|
InvFrontExtPredVP = variants {} ; -- NP -> VP -> Cl ; -- I am here, said she
|
||||||
|
AdjAsCN = variants {} ; -- AP -> CN ; -- a green one ; en grön (Swe)
|
||||||
|
AdjAsNP = variants {} ; -- AP -> NP ; -- green (is good)
|
||||||
|
ReflRNP = variants {} ; -- VPSlash -> RNP -> VP ; -- love my family and myself
|
||||||
|
ReflPron = variants {} ; -- RNP ; -- myself
|
||||||
|
ReflPoss = variants {} ; -- Num -> CN -> RNP ; -- my car(s)
|
||||||
|
PredetRNP = variants {} ; -- Predet -> RNP -> RNP ; -- all my brothers
|
||||||
|
ConjRNP = variants {} ; -- Conj -> RNPList -> RNP ; -- my family, John and myself
|
||||||
|
Base_rr_RNP = variants {} ; -- RNP -> RNP -> RNPList ; -- my family, myself
|
||||||
|
Base_nr_RNP = variants {} ; -- NP -> RNP -> RNPList ; -- John, myself
|
||||||
|
Base_rn_RNP = variants {} ; -- RNP -> NP -> RNPList ; -- myself, John
|
||||||
|
Cons_rr_RNP = variants {} ; -- RNP -> RNPList -> RNPList ; -- my family, myself, John
|
||||||
|
Cons_nr_RNP = variants {} ; -- NP -> RNPList -> RNPList ; -- John, my family, myself
|
||||||
|
ComplVV = variants {} ; -- VV -> Ant -> Pol -> VP -> VP ; -- want not to have slept
|
||||||
|
SlashV2V = variants {} ; -- V2V -> Ant -> Pol -> VPS -> VPSlash ; -- force (her) not to have slept
|
||||||
|
CompoundN = variants {} ; -- N -> N -> N ; -- control system / controls system / control-system
|
||||||
|
CompoundAP = variants {} ; -- N -> A -> AP ; -- language independent / language-independent
|
||||||
|
GerundCN = variants {} ; -- VP -> CN ; -- publishing of the document (can get a determiner)
|
||||||
|
GerundNP = variants {} ; -- VP -> NP ; -- publishing the document (by nature definite)
|
||||||
|
GerundAdv = variants {} ; -- VP -> Adv ; -- publishing the document (prepositionless adverb)
|
||||||
|
WithoutVP = variants {} ; -- VP -> Adv ; -- without publishing the document
|
||||||
|
ByVP = variants {} ; -- VP -> Adv ; -- by publishing the document
|
||||||
|
InOrderToVP = variants {} ; -- VP -> Adv ; -- (in order) to publish the document
|
||||||
|
ApposNP = variants {} ; -- NP -> NP -> NP ; -- Mr Macron, the president of France,
|
||||||
|
AdAdV = variants {} ; -- AdA -> AdV -> AdV ; -- almost always
|
||||||
|
UttAdV = variants {} ; -- AdV -> Utt ; -- always(!)
|
||||||
|
PositAdVAdj = variants {} ; -- A -> AdV ; -- (that she) positively (sleeps)
|
||||||
|
CompS = variants {} ; -- S -> Comp ; -- (the fact is) that she sleeps
|
||||||
|
CompQS = variants {} ; -- QS -> Comp ; -- (the question is) who sleeps
|
||||||
|
CompVP = variants {} ; -- Ant -> Pol -> VP -> Comp ; -- (she is) to go
|
||||||
|
|
||||||
|
|
||||||
|
DetNPFem = DetNP ;
|
||||||
|
|
||||||
|
iFem_Pron = i_Pron ;
|
||||||
|
youFem_Pron = youSg_Pron ;
|
||||||
|
weFem_Pron = we_Pron ;
|
||||||
|
youPlFem_Pron = youPl_Pron ;
|
||||||
|
theyFem_Pron = they_Pron ;
|
||||||
|
youPolFem_Pron = youPol_Pron ;
|
||||||
|
UttAccNP = UttNP ;
|
||||||
|
UttDatNP = UttNP ;
|
||||||
|
UttAccIP = UttIP ;
|
||||||
|
UttDatIP = UttIP ;
|
||||||
|
|
||||||
|
}
|
||||||
16
src/dutch/ExtendDut.gf
Normal file
16
src/dutch/ExtendDut.gf
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
--# -path=alltenses:../common:../abstract
|
||||||
|
|
||||||
|
concrete ExtendDut of Extend =
|
||||||
|
CatDut ** ExtendFunctor
|
||||||
|
-- - [] -- put the names of your own definitions here
|
||||||
|
with
|
||||||
|
(Grammar = GrammarDut) **
|
||||||
|
open
|
||||||
|
GrammarDut,
|
||||||
|
ResDut,
|
||||||
|
Coordination,
|
||||||
|
Prelude,
|
||||||
|
ParadigmsDut in {
|
||||||
|
-- put your own definitions here
|
||||||
|
|
||||||
|
}
|
||||||
277
src/english/ExtendEng.gf
Normal file
277
src/english/ExtendEng.gf
Normal file
@@ -0,0 +1,277 @@
|
|||||||
|
--# -path=.:../common:../abstract
|
||||||
|
|
||||||
|
concrete ExtendEng of Extend =
|
||||||
|
CatEng ** ExtendFunctor [ProDrop]
|
||||||
|
with
|
||||||
|
(Grammar = GrammarEng) **
|
||||||
|
|
||||||
|
open
|
||||||
|
GrammarEng,
|
||||||
|
ResEng,
|
||||||
|
Coordination,
|
||||||
|
Prelude,
|
||||||
|
MorphoEng,
|
||||||
|
ParadigmsEng in {
|
||||||
|
|
||||||
|
lin
|
||||||
|
GenNP np = {s = \\_,_ => np.s ! npGen ; sp = \\_,_,_ => np.s ! npGen} ;
|
||||||
|
GenIP ip = {s = \\_ => ip.s ! NCase Gen} ;
|
||||||
|
GenRP nu cn = {
|
||||||
|
s = \\c => "whose" ++ nu.s ! Nom ++
|
||||||
|
case c of {
|
||||||
|
RC _ (NCase Gen) => cn.s ! nu.n ! Gen ;
|
||||||
|
_ => cn.s ! nu.n ! Nom
|
||||||
|
} ;
|
||||||
|
a = RAg (agrP3 nu.n)
|
||||||
|
} ;
|
||||||
|
|
||||||
|
GenModNP num np cn = DetCN (DetQuant (GenNP (lin NP np)) num) cn ;
|
||||||
|
GenModIP num ip cn = IdetCN (IdetQuant (GenIP (lin IP ip)) num) cn ;
|
||||||
|
|
||||||
|
StrandQuestSlash ip slash =
|
||||||
|
{s = \\t,a,b,q =>
|
||||||
|
(mkQuestion (ss (ip.s ! NPAcc)) slash).s ! t ! a ! b ! q ++ slash.c2
|
||||||
|
};
|
||||||
|
StrandRelSlash rp slash = {
|
||||||
|
s = \\t,a,p,ag =>
|
||||||
|
rp.s ! RC (fromAgr ag).g NPAcc ++ slash.s ! t ! a ! p ! oDir ++ slash.c2 ;
|
||||||
|
c = NPAcc
|
||||||
|
} ;
|
||||||
|
EmptyRelSlash slash = {
|
||||||
|
s = \\t,a,p,_ => slash.s ! t ! a ! p ! oDir ++ slash.c2 ;
|
||||||
|
c = NPAcc
|
||||||
|
} ;
|
||||||
|
|
||||||
|
{- -----
|
||||||
|
lincat
|
||||||
|
VPI = {s : VVType => Agr => Str} ;
|
||||||
|
[VPI] = {s1,s2 : VVType => Agr => Str} ;
|
||||||
|
|
||||||
|
lin
|
||||||
|
BaseVPI = twoTable2 VVType Agr ;
|
||||||
|
ConsVPI = consrTable2 VVType Agr comma ;
|
||||||
|
|
||||||
|
MkVPI vp = {
|
||||||
|
s = table {
|
||||||
|
VVAux => \\a => vp.ad ! a ++ vp.inf ++ vp.p ++ vp.s2 ! a;
|
||||||
|
VVInf => \\a => "to" ++ vp.ad ! a ++ vp.inf ++ vp.p ++ vp.s2 ! a;
|
||||||
|
VVPresPart => \\a => vp.ad ! a ++ vp.prp ++ vp.p ++ vp.s2 ! a
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
ConjVPI = conjunctDistrTable2 VVType Agr ;
|
||||||
|
ComplVPIVV vv vpi =
|
||||||
|
insertObj (\\a => vpi.s ! vv.typ ! a) (predVV vv) ;
|
||||||
|
----}
|
||||||
|
|
||||||
|
|
||||||
|
lincat
|
||||||
|
VPS = {s : {s : Agr => Str} ; i : {s : VVType => Agr => Str}} ; --- finite and infinite forms separately
|
||||||
|
[VPS] = {s : {s1,s2 : Agr => Str} ; i : {s1,s2 : VVType => Agr => Str}} ;
|
||||||
|
|
||||||
|
lin
|
||||||
|
BaseVPS x y = {s = twoTable Agr x.s y.s ; i = twoTable2 VVType Agr x.i y.i} ;
|
||||||
|
ConsVPS x xs = {s = consrTable Agr comma x.s xs.s ; i = consrTable2 VVType Agr comma x.i xs.i} ;
|
||||||
|
|
||||||
|
PredVPS np vps = {s = np.s ! npNom ++ vps.s.s ! np.a} ;
|
||||||
|
|
||||||
|
MkVPS t p vp = {
|
||||||
|
s = {s = \\a =>
|
||||||
|
let
|
||||||
|
verb = vp.s ! t.t ! t.a ! p.p ! oDir ! a ;
|
||||||
|
verbf = verb.aux ++ verb.adv ++ verb.fin ++ verb.inf ;
|
||||||
|
in t.s ++ p.s ++ vp.ad ! a ++ verbf ++ vp.p ++ vp.s2 ! a ++ vp.ext
|
||||||
|
} ;
|
||||||
|
i = {s = table {
|
||||||
|
VVAux => \\a => vp.ad ! a ++ vp.inf ++ vp.p ++ vp.s2 ! a;
|
||||||
|
VVInf => \\a => "to" ++ vp.ad ! a ++ vp.inf ++ vp.p ++ vp.s2 ! a;
|
||||||
|
VVPresPart => \\a => vp.ad ! a ++ vp.prp ++ vp.p ++ vp.s2 ! a
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
ConjVPS c xs = {s = conjunctDistrTable Agr c xs.s ; i = conjunctDistrTable2 VVType Agr c xs.i} ;
|
||||||
|
|
||||||
|
ComplVPIVV vv vpi =
|
||||||
|
insertObj (\\a => vpi.i.s ! vv.typ ! a) (predVV vv) ;
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
ICompAP ap = {s = "how" ++ ap.s ! agrP3 Sg} ; ---- IComp should have agr!
|
||||||
|
|
||||||
|
IAdvAdv adv = {s = "how" ++ adv.s} ;
|
||||||
|
|
||||||
|
PresPartAP vp = {
|
||||||
|
s = \\a => vp.ad ! a ++ vp.prp ++ vp.p ++ vp.s2 ! a ++ vp.ext ;
|
||||||
|
isPre = vp.isSimple -- depends on whether there are complements
|
||||||
|
} ;
|
||||||
|
|
||||||
|
EmbedPresPart vp = {s = infVP VVPresPart vp Simul CPos (agrP3 Sg)} ; --- agr
|
||||||
|
|
||||||
|
PastPartAP vp = {
|
||||||
|
s = \\a => vp.ad ! a ++ vp.ptp ++ vp.p ++ vp.c2 ++ vp.s2 ! a ++ vp.ext ;
|
||||||
|
isPre = vp.isSimple -- depends on whether there are complements
|
||||||
|
} ;
|
||||||
|
PastPartAgentAP vp np = {
|
||||||
|
s = \\a => vp.ad ! a ++ vp.ptp ++ vp.p ++ vp.c2 ++ vp.s2 ! a ++ "by" ++ np.s ! NPAcc ++ vp.ext ;
|
||||||
|
isPre = False
|
||||||
|
} ;
|
||||||
|
|
||||||
|
GerundCN vp = {
|
||||||
|
s = \\n,c => vp.ad ! AgP3Sg Neutr ++ vp.prp ++
|
||||||
|
case <n,c> of {
|
||||||
|
<Sg,Nom> => "" ;
|
||||||
|
<Sg,Gen> => Predef.BIND ++ "'s" ;
|
||||||
|
<Pl,Nom> => Predef.BIND ++ "s" ;
|
||||||
|
<Pl,Gen> => Predef.BIND ++ "s'"
|
||||||
|
} ++
|
||||||
|
vp.p ++ vp.s2 ! AgP3Sg Neutr ++ vp.ext ;
|
||||||
|
g = Neutr
|
||||||
|
} ;
|
||||||
|
|
||||||
|
GerundNP vp =
|
||||||
|
let a = AgP3Sg Neutr ---- agr
|
||||||
|
in
|
||||||
|
{s = \\_ => vp.ad ! a ++ vp.prp ++ vp.p ++ vp.s2 ! a ++ vp.ext ; a = a} ;
|
||||||
|
|
||||||
|
GerundAdv vp =
|
||||||
|
let a = AgP3Sg Neutr
|
||||||
|
in
|
||||||
|
{s = vp.ad ! a ++ vp.prp ++ vp.p ++ vp.s2 ! a ++ vp.ext} ;
|
||||||
|
|
||||||
|
WithoutVP vp = {s = "without" ++ (GerundAdv (lin VP vp)).s} ;
|
||||||
|
|
||||||
|
InOrderToVP vp = {s = ("in order" | []) ++ infVP VVInf vp Simul CPos (AgP3Sg Neutr)} ;
|
||||||
|
|
||||||
|
PurposeVP vp = {s = infVP VVInf vp Simul CPos (agrP3 Sg)} ; --- agr
|
||||||
|
|
||||||
|
ByVP vp = {s = "by" ++ (GerundAdv (lin VP vp)).s} ;
|
||||||
|
|
||||||
|
|
||||||
|
NominalizeVPSlashNP vpslash np =
|
||||||
|
let vp : ResEng.VP = insertObjPre (\\_ => vpslash.c2 ++ np.s ! NPAcc) vpslash ;
|
||||||
|
a = AgP3Sg Neutr
|
||||||
|
in
|
||||||
|
lin NP {s = \\_ => vp.ad ! a ++ vp.prp ++ vp.s2 ! a ; a = a} ;
|
||||||
|
|
||||||
|
|
||||||
|
oper passVPSlash : VPSlash -> Str -> ResEng.VP =
|
||||||
|
\vps,ag ->
|
||||||
|
let
|
||||||
|
be = predAux auxBe ;
|
||||||
|
ppt = vps.ptp
|
||||||
|
in {
|
||||||
|
s = be.s ;
|
||||||
|
p = [] ;
|
||||||
|
prp = be.prp ;
|
||||||
|
ptp = be.ptp ;
|
||||||
|
inf = be.inf ;
|
||||||
|
ad = \\_ => [] ;
|
||||||
|
s2 = \\a => vps.ad ! a ++ ppt ++ vps.p ++ ag ++ vps.s2 ! a ++ vps.c2 ; ---- place of agent
|
||||||
|
isSimple = False ;
|
||||||
|
ext = vps.ext
|
||||||
|
} ;
|
||||||
|
|
||||||
|
lin
|
||||||
|
PassVPSlash vps = passVPSlash (lin VPS vps) [] ;
|
||||||
|
PassAgentVPSlash vps np = passVPSlash (lin VPS vps) ("by" ++ np.s ! NPAcc) ;
|
||||||
|
|
||||||
|
--- AR 7/3/2013
|
||||||
|
ComplSlashPartLast vps np = case vps.gapInMiddle of {
|
||||||
|
_ => insertObjPartLast (\\_ => vps.c2 ++ np.s ! NPAcc) vps ---
|
||||||
|
} ;
|
||||||
|
|
||||||
|
--- AR 22/5/2013
|
||||||
|
ExistsNP np =
|
||||||
|
mkClause "there" (agrP3 (fromAgr np.a).n)
|
||||||
|
(insertObj (\\_ => np.s ! NPAcc) (predV (regV "exist"))) ;
|
||||||
|
|
||||||
|
|
||||||
|
ComplBareVS v s = insertExtra s.s (predV v) ;
|
||||||
|
SlashBareV2S v s = insertExtrac s.s (predVc v) ;
|
||||||
|
|
||||||
|
CompoundN noun cn = {
|
||||||
|
s = (\\n,c => noun.s ! Sg ! Nom ++ cn.s ! n ! c) ;
|
||||||
|
g = cn.g
|
||||||
|
} ;
|
||||||
|
|
||||||
|
CompoundAP noun adj = {
|
||||||
|
s = (\\_ => noun.s ! Sg ! Nom ++ adj.s ! AAdj Posit Nom) ;
|
||||||
|
isPre = True
|
||||||
|
} ;
|
||||||
|
|
||||||
|
FrontExtPredVP np vp = {
|
||||||
|
s = \\t,a,b,o =>
|
||||||
|
let
|
||||||
|
subj = np.s ! npNom ;
|
||||||
|
agr = np.a ;
|
||||||
|
verb = vp.s ! t ! a ! b ! o ! agr ;
|
||||||
|
compl = vp.s2 ! agr
|
||||||
|
in
|
||||||
|
case o of {
|
||||||
|
ODir _ => vp.ext ++ frontComma ++ subj ++ verb.aux ++ verb.adv ++ vp.ad ! agr ++ verb.fin ++ verb.inf ++ vp.p ++ compl ;
|
||||||
|
OQuest => verb.aux ++ subj ++ verb.adv ++ vp.ad ! agr ++ verb.fin ++ verb.inf ++ vp.p ++ compl ++ vp.ext
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
InvFrontExtPredVP np vp = {
|
||||||
|
s = \\t,a,b,o =>
|
||||||
|
let
|
||||||
|
subj = np.s ! npNom ;
|
||||||
|
agr = np.a ;
|
||||||
|
verb = vp.s ! t ! a ! b ! o ! agr ;
|
||||||
|
compl = vp.s2 ! agr
|
||||||
|
in
|
||||||
|
case o of {
|
||||||
|
ODir _ => vp.ext ++ verb.aux ++ verb.adv ++ vp.ad ! agr ++ verb.fin ++ subj ++ verb.inf ++ vp.p ++ compl ;
|
||||||
|
OQuest => verb.aux ++ subj ++ verb.adv ++ vp.ad ! agr ++ verb.fin ++ verb.inf ++ vp.p ++ compl ++ vp.ext
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
lin
|
||||||
|
AdjAsCN ap = let cn = mkNoun "one" "one's" "ones" "ones'" ** {g = Neutr}
|
||||||
|
in {
|
||||||
|
s = \\n,c => preOrPost ap.isPre (ap.s ! agrgP3 n cn.g) (cn.s ! n ! c) ;
|
||||||
|
g = cn.g
|
||||||
|
} ;
|
||||||
|
AdjAsNP ap = {
|
||||||
|
s = \\c => ap.s ! agrgP3 Sg nonhuman ; ---- genitive case?
|
||||||
|
a = agrgP3 Sg nonhuman
|
||||||
|
} ;
|
||||||
|
|
||||||
|
lincat
|
||||||
|
RNP = {s : Agr => Str} ;
|
||||||
|
RNPList = {s1,s2 : Agr => Str} ;
|
||||||
|
|
||||||
|
lin
|
||||||
|
ReflRNP vps rnp = insertObjPre (\\a => vps.c2 ++ rnp.s ! a) vps ;
|
||||||
|
ReflPron = {s = reflPron} ;
|
||||||
|
ReflPoss num cn = {s = \\a => possPron ! a ++ num.s ! Nom ++ cn.s ! num.n ! Nom} ;
|
||||||
|
PredetRNP predet rnp = {s = \\a => predet.s ++ rnp.s ! a} ;
|
||||||
|
|
||||||
|
ConjRNP conj rpns = conjunctDistrTable Agr conj rpns ;
|
||||||
|
|
||||||
|
Base_rr_RNP x y = twoTable Agr x y ;
|
||||||
|
Base_nr_RNP x y = twoTable Agr {s = \\a => x.s ! NPAcc} y ;
|
||||||
|
Base_rn_RNP x y = twoTable Agr x {s = \\a => y.s ! NPAcc} ;
|
||||||
|
Cons_rr_RNP x xs = consrTable Agr comma x xs ;
|
||||||
|
Cons_nr_RNP x xs = consrTable Agr comma {s = \\a => x.s ! NPAcc} xs ;
|
||||||
|
|
||||||
|
|
||||||
|
---- TODO: RNPList construction
|
||||||
|
|
||||||
|
ComplGenVV v a p vp = insertObj (\\agr => a.s ++ p.s ++
|
||||||
|
infVP v.typ vp a.a p.p agr)
|
||||||
|
(predVV v) ;
|
||||||
|
|
||||||
|
CompS s = {s = \\_ => "that" ++ s.s} ;
|
||||||
|
CompQS qs = {s = \\_ => qs.s ! QIndir} ;
|
||||||
|
CompVP ant p vp = {s = \\a => ant.s ++ p.s ++
|
||||||
|
infVP VVInf vp ant.a p.p a} ;
|
||||||
|
|
||||||
|
-- quite specific for English anyway
|
||||||
|
|
||||||
|
UncontractedNeg = {s = [] ; p = CNeg False} ;
|
||||||
|
UttVPShort vp = {s = infVP VVAux vp Simul CPos (agrP3 Sg)} ;
|
||||||
|
}
|
||||||
@@ -115,7 +115,7 @@ oper
|
|||||||
AgP1 n => n ;
|
AgP1 n => n ;
|
||||||
AgP2 n => n ;
|
AgP2 n => n ;
|
||||||
AgP3Sg _ => Sg ;
|
AgP3Sg _ => Sg ;
|
||||||
AgP3Pl => Pl
|
AgP3Pl _ => Pl
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
agr2icagr : Agr -> ICAgr = \a -> UUnit ;
|
agr2icagr : Agr -> ICAgr = \a -> UUnit ;
|
||||||
@@ -123,7 +123,7 @@ oper
|
|||||||
-- restoring full Agr
|
-- restoring full Agr
|
||||||
ipagr2agr : IPAgr -> Agr = \n -> case n of {
|
ipagr2agr : IPAgr -> Agr = \n -> case n of {
|
||||||
Sg => AgP3Sg Neutr ; ---- gender
|
Sg => AgP3Sg Neutr ; ---- gender
|
||||||
Pl => AgP3Pl
|
Pl => AgP3Pl Neutr
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
ipagr2vagr : IPAgr -> VAgr = \n -> case n of {
|
ipagr2vagr : IPAgr -> VAgr = \n -> case n of {
|
||||||
@@ -140,7 +140,7 @@ oper
|
|||||||
vagr2agr : VAgr -> Agr = \a -> case a of {
|
vagr2agr : VAgr -> Agr = \a -> case a of {
|
||||||
VASgP1 => AgP1 Sg ;
|
VASgP1 => AgP1 Sg ;
|
||||||
VASgP3 => AgP3Sg Neutr ;
|
VASgP3 => AgP3Sg Neutr ;
|
||||||
VAPl => AgP3Pl
|
VAPl => AgP3Pl Neutr
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
vPastPart : PrVerb -> AAgr -> Str = \v,_ -> v.s ! VVF VPPart ;
|
vPastPart : PrVerb -> AAgr -> Str = \v,_ -> v.s ! VVF VPPart ;
|
||||||
|
|||||||
16
src/spanish/ExtendSpa.gf
Normal file
16
src/spanish/ExtendSpa.gf
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
--# -path=alltenses:../common:../abstract
|
||||||
|
|
||||||
|
concrete ExtendSpa of Extend =
|
||||||
|
CatSpa ** ExtendFunctor
|
||||||
|
-- - [] -- put the names of your own definitions here
|
||||||
|
with
|
||||||
|
(Grammar = GrammarSpa) **
|
||||||
|
open
|
||||||
|
GrammarSpa,
|
||||||
|
ResSpa,
|
||||||
|
Coordination,
|
||||||
|
Prelude,
|
||||||
|
ParadigmsSpa in {
|
||||||
|
-- put your own definitions here
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user