mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-17 08:49:31 -06:00
nondependent versions of Pred grammars, implemented by a functor over the dependent version so that no new concrete syntax code is needed. This is at the moment the grammar of choice for translation: NDTransEng is several times faster than TransEng and even faster than the old TranslateEng. The next step is to make sure that all coverage is preserved; some new coverage is already there.
This commit is contained in:
239
lib/src/experimental/NDPred.gf
Normal file
239
lib/src/experimental/NDPred.gf
Normal file
@@ -0,0 +1,239 @@
|
||||
abstract NDPred = Cat [Ant,NP,Utt,IP,IAdv,Conj] ** {
|
||||
|
||||
cat
|
||||
--< Arg ;
|
||||
|
||||
--< PrV Arg ;
|
||||
PrV_none ; PrV_np ; PrV_v ; PrV_s ; PrV_q ; PrV_a ; PrV_n ;
|
||||
PrV_np_np ; PrV_np_v ; PrV_np_s ; PrV_np_q ; PrV_np_a ; PrV_np_n ;
|
||||
|
||||
--< PrVP Arg ;
|
||||
PrVP_none ; PrVP_np ; PrVP_v ; PrVP_s ; PrVP_q ; PrVP_a ; PrVP_n ;
|
||||
PrVP_np_np ; PrVP_np_v ; PrVP_np_s ; PrVP_np_q ; PrVP_np_a ; PrVP_np_n ;
|
||||
|
||||
--< VPC Arg ; -- conjunction of VP
|
||||
VPC_none ;
|
||||
VPC_np ;
|
||||
|
||||
Tense ;
|
||||
Pol ;
|
||||
|
||||
--< PrCl Arg ;
|
||||
PrCl_none ;
|
||||
PrCl_np ;
|
||||
|
||||
--< ClC Arg ; -- conjunction of Cl
|
||||
ClC_none ;
|
||||
ClC_np ;
|
||||
|
||||
--< PrQCl Arg ;
|
||||
PrQCl_none ;
|
||||
PrQCl_np ;
|
||||
|
||||
--< PrAdv Arg ;
|
||||
PrAdv_none ;
|
||||
PrAdv_np ;
|
||||
|
||||
PrS ;
|
||||
|
||||
--< PrAP Arg ;
|
||||
PrAP_none ;
|
||||
PrAP_np ;
|
||||
|
||||
--< PrCN Arg ; -- the country he became the president of
|
||||
PrCN_none ;
|
||||
PrCN_np ;
|
||||
|
||||
fun
|
||||
--< aNone, aS, aV, aQ, aA, aN : Arg ;
|
||||
--< aNP : Arg -> Arg ;
|
||||
|
||||
TPres, TPast, TFut, TCond : Tense ;
|
||||
PPos, PNeg : Pol ;
|
||||
ASimul, AAnter : Ant ;
|
||||
|
||||
--< UseV : (a : Arg) -> Ant -> Tense -> Pol -> PrV a -> PrVP a ;
|
||||
UseV_none : Ant -> Tense -> Pol -> PrV_none -> PrVP_none ;
|
||||
UseV_np : Ant -> Tense -> Pol -> PrV_np -> PrVP_np ;
|
||||
UseV_v : Ant -> Tense -> Pol -> PrV_v -> PrVP_v ;
|
||||
UseV_s : Ant -> Tense -> Pol -> PrV_s -> PrVP_s ;
|
||||
UseV_a : Ant -> Tense -> Pol -> PrV_a -> PrVP_a ;
|
||||
UseV_q : Ant -> Tense -> Pol -> PrV_q -> PrVP_q ;
|
||||
UseV_n : Ant -> Tense -> Pol -> PrV_v -> PrVP_n ;
|
||||
UseV_np_np : Ant -> Tense -> Pol -> PrV_np_np -> PrVP_np_np ;
|
||||
UseV_np_v : Ant -> Tense -> Pol -> PrV_np_v -> PrVP_np_v ;
|
||||
UseV_np_s : Ant -> Tense -> Pol -> PrV_np_s -> PrVP_np_s ;
|
||||
UseV_np_a : Ant -> Tense -> Pol -> PrV_np_a -> PrVP_np_a ;
|
||||
UseV_np_q : Ant -> Tense -> Pol -> PrV_np_q -> PrVP_np_q ;
|
||||
UseV_np_n : Ant -> Tense -> Pol -> PrV_np_n -> PrVP_np_n ;
|
||||
|
||||
--< PassUseV : (a : Arg) -> Ant -> Tense -> Pol -> PrV (aNP a) -> PrVP a ;
|
||||
PassUseV_none : Ant -> Tense -> Pol -> PrV_np -> PrVP_none ;
|
||||
PassUseV_np : Ant -> Tense -> Pol -> PrV_np_np -> PrVP_np ;
|
||||
PassUseV_v : Ant -> Tense -> Pol -> PrV_np_v -> PrVP_v ;
|
||||
PassUseV_s : Ant -> Tense -> Pol -> PrV_np_s -> PrVP_s ;
|
||||
PassUseV_a : Ant -> Tense -> Pol -> PrV_np_a -> PrVP_a ;
|
||||
PassUseV_q : Ant -> Tense -> Pol -> PrV_np_q -> PrVP_q ;
|
||||
PassUseV_n : Ant -> Tense -> Pol -> PrV_np_n -> PrVP_n ;
|
||||
|
||||
--< AgentPassUseV : (a : Arg) -> Ant -> Tense -> Pol -> PrV (aNP a) -> NP -> PrVP a ;
|
||||
AgentPassUseV_none : Ant -> Tense -> Pol -> PrV_np -> NP -> PrVP_none ;
|
||||
AgentPassUseV_np : Ant -> Tense -> Pol -> PrV_np_np -> NP -> PrVP_np ;
|
||||
AgentPassUseV_v : Ant -> Tense -> Pol -> PrV_np_v -> NP -> PrVP_v ;
|
||||
AgentPassUseV_s : Ant -> Tense -> Pol -> PrV_np_s -> NP -> PrVP_s ;
|
||||
AgentPassUseV_a : Ant -> Tense -> Pol -> PrV_np_a -> NP -> PrVP_a ;
|
||||
AgentPassUseV_q : Ant -> Tense -> Pol -> PrV_np_q -> NP -> PrVP_q ;
|
||||
AgentPassUseV_n : Ant -> Tense -> Pol -> PrV_np_n -> NP -> PrVP_n ;
|
||||
|
||||
--< ComplV2 : (a : Arg) -> PrVP (aNP a) -> NP -> PrVP a ; -- she loves him
|
||||
ComplV2_none : PrVP_np -> NP -> PrVP_none ;
|
||||
|
||||
--< ComplVS : (a : Arg) -> PrVP aS -> PrCl a -> PrVP a ; -- she says that I am here
|
||||
ComplVS_none : PrVP_s -> PrCl_none -> PrVP_none ;
|
||||
ComplVS_np : PrVP_s -> PrCl_np -> PrVP_np ;
|
||||
|
||||
--< ComplVV : (a : Arg) -> PrVP aV -> PrVP a -> PrVP a ; -- she wants to sleep
|
||||
ComplVV_none : PrVP_v -> PrVP_none -> PrVP_none ;
|
||||
ComplVV_np : PrVP_v -> PrVP_np -> PrVP_np ;
|
||||
|
||||
--< ComplVQ : (a : Arg) -> PrVP aQ -> PrQCl a -> PrVP a ; -- she wonders who is here
|
||||
ComplVQ_none : PrVP_q -> PrQCl_none -> PrVP_none ;
|
||||
|
||||
--< ComplVA : (a : Arg) -> PrVP aA -> PrAP a -> PrVP a ; -- she becomes old
|
||||
ComplVA_none : PrVP_a -> PrAP_none -> PrVP_none ;
|
||||
|
||||
--< ComplVN : (a : Arg) -> PrVP aN -> PrCN a -> PrVP a ; -- she becomes a professor
|
||||
ComplVN_none : PrVP_n -> PrCN_none -> PrVP_none ;
|
||||
|
||||
--< SlashV3 : (a : Arg) -> PrVP (aNP (aNP a)) -> NP -> PrVP (aNP a) ; -- she shows X to him
|
||||
SlashV3_none : PrVP_np_np -> NP -> PrVP_np ;
|
||||
|
||||
--< SlashV2S : (a : Arg) -> PrVP (aNP aS) -> PrCl a -> PrVP (aNP a) ; -- she tells X that I am here
|
||||
SlashV2S_none : PrVP_np_s -> PrCl_none -> PrVP_np ;
|
||||
|
||||
--< SlashV2V : (a : Arg) -> PrVP (aNP aV) -> PrVP a -> PrVP (aNP a) ; -- she forces X to sleep
|
||||
SlashV2V_none : PrVP_np_v -> PrVP_none -> PrVP_np ;
|
||||
SlashV2V_np : PrVP_np_v -> PrVP_np -> PrVP_np_np ;
|
||||
|
||||
--< SlashV2A : (a : Arg) -> PrVP (aNP aA) -> PrAP a -> PrVP (aNP a) ; -- she makes X crazy
|
||||
SlashV2A_none : PrVP_np_a -> PrAP_none -> PrVP_np ;
|
||||
|
||||
--< SlashV2N : (a : Arg) -> PrVP (aNP aN) -> PrCN a -> PrVP (aNP a) ; -- she makes X a professor
|
||||
SlashV2N_none : PrVP_np_n -> PrCN_none -> PrVP_np ;
|
||||
|
||||
--< SlashV2Q : (a : Arg) -> PrVP (aNP aA) -> PrQCl a -> PrVP (aNP a) ; -- she asks X who is here
|
||||
SlashV2Q_none : PrVP_np_q -> PrQCl_none -> PrVP_np ;
|
||||
|
||||
--< UseAP : (a : Arg) -> Ant -> Tense -> Pol -> PrAP a -> PrVP a ; -- she is married to X
|
||||
UseAP_none : Ant -> Tense -> Pol -> PrAP_none -> PrVP_none ;
|
||||
UseAP_np : Ant -> Tense -> Pol -> PrAP_np -> PrVP_np ;
|
||||
|
||||
--< UseAdv : (a : Arg) -> Ant -> Tense -> Pol -> PrAdv a -> PrVP a ; -- she is in X
|
||||
UseAdv_none : Ant -> Tense -> Pol -> PrAdv_none -> PrVP_none ;
|
||||
UseAdv_np : Ant -> Tense -> Pol -> PrAdv_np -> PrVP_np ;
|
||||
|
||||
--< UseCN : (a : Arg) -> Ant -> Tense -> Pol -> PrCN a -> PrVP a ; -- she is a member of X
|
||||
UseCN_none : Ant -> Tense -> Pol -> PrCN_none -> PrVP_none ;
|
||||
UseCN_np : Ant -> Tense -> Pol -> PrCN_np -> PrVP_np ;
|
||||
|
||||
--< UseNP : Ant -> Tense -> Pol -> NP -> PrVP aNone ; -- she is the person
|
||||
UseNP_none : Ant -> Tense -> Pol -> NP -> PrVP_none ;
|
||||
|
||||
--< PredVP : (a : Arg) -> NP -> PrVP a -> PrCl a ;
|
||||
PredVP_none : NP -> PrVP_none -> PrCl_none ;
|
||||
PredVP_np : NP -> PrVP_np -> PrCl_np ;
|
||||
|
||||
--< SlashClNP : (a : Arg) -> PrCl (aNP a) -> NP -> PrCl a ; -- slash consumption: hon tittar på + oss
|
||||
SlashClNP_none : PrCl_np -> NP -> PrCl_none ;
|
||||
|
||||
--< ReflVP : (a : Arg) -> PrVP (aNP a) -> PrVP a ; -- refl on first position (direct object)
|
||||
ReflVP_none : PrVP_np -> PrVP_none ;
|
||||
ReflVP_np : PrVP_np_np -> PrVP_np ;
|
||||
ReflVP_v : PrVP_np_v -> PrVP_v ;
|
||||
ReflVP_s : PrVP_np_s -> PrVP_s ;
|
||||
ReflVP_q : PrVP_np_q -> PrVP_q ;
|
||||
ReflVP_a : PrVP_np_a -> PrVP_a ;
|
||||
ReflVP_n : PrVP_np_n -> PrVP_n ;
|
||||
|
||||
--< ReflVP2 : (a : Arg) -> PrVP (aNP (aNP a)) -> PrVP (aNP a) ; -- refl on second position (indirect object)
|
||||
ReflVP2_np : PrVP_np_np -> PrVP_np ;
|
||||
|
||||
--< QuestVP : (a : Arg) -> IP -> PrVP a -> PrQCl a ;
|
||||
QuestVP_none : IP -> PrVP_none -> PrQCl_none ;
|
||||
|
||||
--< QuestSlash : (a : Arg) -> IP -> PrQCl (aNP a) -> PrQCl a ;
|
||||
QuestSlash_none : IP -> PrQCl_np -> PrQCl_none ;
|
||||
|
||||
--< QuestCl : (a : Arg) -> PrCl a -> PrQCl a ;
|
||||
QuestCl_none : PrCl_none -> PrQCl_none ;
|
||||
QuestCl_np : PrCl_np -> PrQCl_np ;
|
||||
|
||||
--< QuestIAdv : (a : Arg) -> IAdv -> PrCl a -> PrQCl a ;
|
||||
QuestIAdv_none : IAdv -> PrCl_none -> PrQCl_none ;
|
||||
|
||||
--< UseCl : PrCl aNone -> PrS ;
|
||||
UseCl_none : PrCl_none -> PrS ;
|
||||
|
||||
--< UseQCl : PrQCl aNone -> PrS ;
|
||||
UseQCl_none : PrQCl_none -> PrS ;
|
||||
|
||||
--< UseAdvCl : PrAdv aNone -> PrCl aNone -> PrS ; -- lift adv to front
|
||||
UseAdvCl_none : PrAdv_none -> PrCl_none -> PrS ;
|
||||
|
||||
UttS : PrS -> Utt ;
|
||||
|
||||
--< AdvCl : (a : Arg) -> PrAdv a -> PrCl aNone -> PrCl a ;
|
||||
AdvCl_none : PrAdv_none -> PrCl_none -> PrCl_none ;
|
||||
AdvCl_np : PrAdv_np -> PrCl_none -> PrCl_np ;
|
||||
|
||||
--< AdvQCl : (a : Arg) -> PrAdv a -> PrQCl aNone -> PrQCl a ;
|
||||
AdvQCl_none : PrAdv_none -> PrQCl_none -> PrQCl_none ;
|
||||
AdvQCl_np : PrAdv_np -> PrQCl_none -> PrQCl_np ;
|
||||
|
||||
|
||||
-- participles as adjectives
|
||||
|
||||
--< PresPartAP : (a : Arg) -> PrV a -> PrAP a ;
|
||||
PresPartAP_none : PrV_none -> PrAP_none ;
|
||||
PresPartAP_np : PrV_np -> PrAP_np ;
|
||||
|
||||
--< PastPartAP : (a : Arg) -> PrV (aNP a) -> PrAP a ;
|
||||
PastPartAP_none : PrV_np -> PrAP_none ;
|
||||
|
||||
--< AgentPastPartAP : (a : Arg) -> PrV (aNP a) -> NP -> PrAP a ;
|
||||
AgentPastPartAP_none : PrV_np -> NP -> PrAP_none ;
|
||||
|
||||
-- PrVP coordination
|
||||
|
||||
--< StartVPC : (a : Arg) -> Conj -> PrVP a -> PrVP a -> VPC a ;
|
||||
StartVPC_none : Conj -> PrVP_none -> PrVP_none -> VPC_none ;
|
||||
StartVPC_np : Conj -> PrVP_np -> PrVP_np -> VPC_np ;
|
||||
---- ...
|
||||
|
||||
--< ContVPC : (a : Arg) -> PrVP a -> VPC a -> VPC a ;
|
||||
ContVPC_none : PrVP_none -> VPC_none -> VPC_none ;
|
||||
ContVPC_np : PrVP_np -> VPC_np -> VPC_np ;
|
||||
---- ...
|
||||
|
||||
--< UseVPC : (a : Arg) -> VPC a -> PrVP a ;
|
||||
UseVPC_none : VPC_none -> PrVP_none ;
|
||||
UseVPC_np : VPC_np -> PrVP_np ;
|
||||
|
||||
-- clause coordination, including "she loves and we look at (her)"
|
||||
|
||||
--< StartClC : (a : Arg) -> Conj -> PrCl a -> PrCl a -> ClC a ;
|
||||
StartClC_none : Conj -> PrCl_none -> PrCl_none -> ClC_none ;
|
||||
StartClC_np : Conj -> PrCl_np -> PrCl_np -> ClC_np ;
|
||||
|
||||
--< ContClC : (a : Arg) -> PrCl a -> ClC a -> ClC a ;
|
||||
ContClC_none : PrCl_none -> ClC_none -> ClC_none ;
|
||||
ContClC_np : PrCl_np -> ClC_np -> ClC_np ;
|
||||
|
||||
--< UseClC : (a : Arg) -> ClC a -> PrCl a ;
|
||||
UseClC_none : ClC_none -> PrCl_none ;
|
||||
UseClC_np : ClC_np -> PrCl_np ;
|
||||
|
||||
--< ComplAdv : (a : Arg) -> PrAdv (aNP a) -> NP -> PrAdv a ; -- typically: formation of preposition phrase
|
||||
ComplAdv_none : PrAdv_np -> NP -> PrAdv_none ;
|
||||
|
||||
}
|
||||
5
lib/src/experimental/NDPredEng.gf
Normal file
5
lib/src/experimental/NDPredEng.gf
Normal file
@@ -0,0 +1,5 @@
|
||||
concrete NDPredEng of Pred =
|
||||
CatEng [Ant,NP,Utt,IP,IAdv,Conj] **
|
||||
NDPredFunctor with
|
||||
(PredInterface = PredInstanceEng),
|
||||
(Pred = PredEng) ;
|
||||
186
lib/src/experimental/NDPredFunctor.gf
Normal file
186
lib/src/experimental/NDPredFunctor.gf
Normal file
@@ -0,0 +1,186 @@
|
||||
incomplete concrete NDPredFunctor of NDPred =
|
||||
Cat [Ant,NP,Utt,IP,IAdv,Conj] **
|
||||
open
|
||||
PredInterface,
|
||||
Pred,
|
||||
ParamX,
|
||||
Prelude
|
||||
in {
|
||||
|
||||
------------------------------------
|
||||
-- lincats
|
||||
-------------------------------------
|
||||
|
||||
lincat
|
||||
Tense = Pred.Tense ;
|
||||
Pol = Pred.Pol ;
|
||||
|
||||
PrV_none, PrV_np, PrV_v, PrV_s, PrV_q, PrV_a, PrV_n,
|
||||
PrV_np_np, PrV_np_v, PrV_np_s, PrV_np_q, PrV_np_a, PrV_np_n = Pred.PrV ;
|
||||
|
||||
PrVP_none, PrVP_np, PrVP_v, PrVP_s, PrVP_q, PrVP_a, PrVP_n,
|
||||
PrVP_np_np, PrVP_np_v, PrVP_np_s, PrVP_np_q, PrVP_np_a, PrVP_np_n = Pred.PrVP ;
|
||||
|
||||
PrCl_none, PrCl_np = Pred.PrCl ;
|
||||
|
||||
PrQCl_none, PrQCl_np = Pred.PrQCl ;
|
||||
|
||||
VPC_none, VPC_np = Pred.VPC ;
|
||||
|
||||
ClC_none, ClC_np = Pred.ClC ;
|
||||
|
||||
PrAdv_none, PrAdv_np = Pred.PrAdv ;
|
||||
|
||||
PrS = Pred.PrS ;
|
||||
|
||||
PrAP_none, PrAP_np = Pred.PrAP ;
|
||||
|
||||
PrCN_none, PrCN_np = Pred.PrCN ;
|
||||
|
||||
-- reference linearizations for chunking
|
||||
---- should be by functor as well
|
||||
|
||||
linref
|
||||
PrVP_none, PrVP_np, PrVP_v, PrVP_s, PrVP_q, PrVP_a, PrVP_n,
|
||||
PrVP_np_np, PrVP_np_v, PrVP_np_s, PrVP_np_q, PrVP_np_a, PrVP_np_n
|
||||
= \vp ->
|
||||
let
|
||||
agr = defaultAgr ;
|
||||
vagr = agr2vagr agr ;
|
||||
verb = vp.v ! vagr ;
|
||||
in
|
||||
verb.p1 ++ verb.p2 ++ vp.adV ++ verb.p3 ++ vp.part ++
|
||||
vp.adj ! agr ++ vp.obj1.p1 ! agr ++ vp.obj2.p1 ! agr ++ vp.adv ++ vp.ext ;
|
||||
|
||||
PrCl_none, PrCl_np = \cl -> declCl cl ;
|
||||
PrQCl_none, PrQCl_np = \qcl -> questCl qcl ;
|
||||
PrAdv_none, PrAdv_np = \adv -> adv.c1 ++ adv.s ;
|
||||
PrAP_none, PrAP_np = \ap -> ap.s ! defaultAgr ++ ap.obj1 ! defaultAgr ;
|
||||
PrCN_none, PrCN_np = \cn -> cn.s ! Sg ++ cn.obj1 ! defaultAgr ;
|
||||
|
||||
----------------------------
|
||||
--- linearization rules ----
|
||||
----------------------------
|
||||
|
||||
lin
|
||||
|
||||
-- standard general
|
||||
|
||||
TPres = Pred.TPres ;
|
||||
TPast = Pred.TPast ;
|
||||
TFut = Pred.TFut ;
|
||||
TCond = Pred.TCond ;
|
||||
ASimul = Pred.ASimul ;
|
||||
AAnter = Pred.AAnter ;
|
||||
PPos = Pred.PPos ;
|
||||
PNeg = Pred.PNeg ;
|
||||
|
||||
UseV_none, UseV_np, UseV_v, UseV_s, UseV_q, UseV_a, UseV_n, UseV_np_np, UseV_np_v, UseV_np_s, UseV_np_q, UseV_np_a, UseV_np_n
|
||||
= Pred.UseV Pred.aNone ;
|
||||
PassUseV_none, PassUseV_np, PassUseV_v, PassUseV_s, PassUseV_q, PassUseV_a, PassUseV_n
|
||||
= Pred.PassUseV Pred.aNone ;
|
||||
AgentPassUseV_none, AgentPassUseV_np, AgentPassUseV_v, AgentPassUseV_s, AgentPassUseV_q, AgentPassUseV_a, AgentPassUseV_n
|
||||
= Pred.AgentPassUseV Pred.aNone ;
|
||||
|
||||
UseAP_none, UseAP_np
|
||||
= Pred.UseAP Pred.aNone ;
|
||||
UseCN_none, UseCN_np
|
||||
= Pred.UseCN Pred.aNone ;
|
||||
UseAdv_none, UseAdv_np
|
||||
= Pred.UseAdv Pred.aNone ;
|
||||
UseNP_none
|
||||
= Pred.UseNP ;
|
||||
|
||||
ComplV2_none
|
||||
= Pred.ComplV2 Pred.aNone ;
|
||||
ComplVV_none, ComplVV_np
|
||||
= Pred.ComplVV Pred.aNone ;
|
||||
ComplVS_none, ComplVS_np
|
||||
= Pred.ComplVS Pred.aNone ;
|
||||
ComplVA_none
|
||||
= Pred.ComplVA Pred.aNone ;
|
||||
ComplVQ_none
|
||||
= Pred.ComplVQ Pred.aNone ;
|
||||
ComplVN_none
|
||||
= Pred.ComplVN Pred.aNone ;
|
||||
|
||||
SlashV3_none
|
||||
= Pred.SlashV3 Pred.aNone ;
|
||||
SlashV2V_none, SlashV2V_np
|
||||
= Pred.SlashV2V Pred.aNone ;
|
||||
SlashV2S_none
|
||||
= Pred.SlashV2S Pred.aNone ;
|
||||
SlashV2Q_none
|
||||
= Pred.SlashV2Q Pred.aNone ;
|
||||
SlashV2A_none
|
||||
= Pred.SlashV2A Pred.aNone ;
|
||||
SlashV2N_none
|
||||
= Pred.SlashV2N Pred.aNone ;
|
||||
|
||||
ReflVP_none, ReflVP_np, ReflVP_v, ReflVP_s, ReflVP_q, ReflVP_a, ReflVP_n
|
||||
= Pred.ReflVP Pred.aNone ;
|
||||
ReflVP2_np
|
||||
= Pred.ReflVP2 Pred.aNone ;
|
||||
|
||||
|
||||
PredVP_none, PredVP_np
|
||||
= Pred.PredVP Pred.aNone ;
|
||||
|
||||
SlashClNP_none
|
||||
= Pred.SlashClNP Pred.aNone ;
|
||||
|
||||
QuestCl_none, QuestCl_np
|
||||
= Pred.QuestCl Pred.aNone ;
|
||||
|
||||
QuestIAdv_none
|
||||
= Pred.QuestIAdv Pred.aNone ;
|
||||
|
||||
QuestVP_none
|
||||
= Pred.QuestVP Pred.aNone ;
|
||||
|
||||
QuestSlash_none
|
||||
= Pred.QuestSlash Pred.aNone ;
|
||||
|
||||
UseCl_none
|
||||
= Pred.UseCl ;
|
||||
UseQCl_none
|
||||
= Pred.UseQCl ;
|
||||
|
||||
UseAdvCl_none
|
||||
= Pred.UseAdvCl ;
|
||||
|
||||
UttS
|
||||
= Pred.UttS ;
|
||||
|
||||
AdvCl_none, AdvCl_np
|
||||
= Pred.AdvCl Pred.aNone ;
|
||||
AdvQCl_none, AdvQCl_np
|
||||
= Pred.AdvQCl Pred.aNone ;
|
||||
|
||||
PresPartAP_none, PresPartAP_np
|
||||
= Pred.PresPartAP Pred.aNone ;
|
||||
|
||||
PastPartAP_none
|
||||
= Pred.PastPartAP Pred.aNone ;
|
||||
|
||||
AgentPastPartAP_none
|
||||
= Pred.AgentPastPartAP Pred.aNone ;
|
||||
|
||||
StartVPC_none, StartVPC_np
|
||||
= Pred.StartVPC Pred.aNone ;
|
||||
ContVPC_none, ContVPC_np
|
||||
= Pred.ContVPC Pred.aNone ;
|
||||
UseVPC_none, UseVPC_np
|
||||
= Pred.UseVPC Pred.aNone ;
|
||||
|
||||
StartClC_none, StartClC_np
|
||||
= Pred.StartClC Pred.aNone ;
|
||||
ContClC_none, ContClC_np
|
||||
= Pred.ContClC Pred.aNone ;
|
||||
UseClC_none, UseClC_np
|
||||
= Pred.UseClC Pred.aNone ;
|
||||
|
||||
ComplAdv_none
|
||||
= Pred.ComplAdv Pred.aNone ;
|
||||
|
||||
}
|
||||
5
lib/src/experimental/NDPredSwe.gf
Normal file
5
lib/src/experimental/NDPredSwe.gf
Normal file
@@ -0,0 +1,5 @@
|
||||
concrete NDPredSwe of Pred =
|
||||
CatSwe [Ant,NP,Utt,IP,IAdv,Conj] **
|
||||
NDPredFunctor with
|
||||
(PredInterface = PredInstanceSwe),
|
||||
(Pred = PredSwe) ;
|
||||
38
lib/src/experimental/NDTrans.gf
Normal file
38
lib/src/experimental/NDTrans.gf
Normal file
@@ -0,0 +1,38 @@
|
||||
--# -path=.:../translator
|
||||
|
||||
abstract NDTrans =
|
||||
RGLBase - [Pol,Tense]
|
||||
,NDPred
|
||||
,Dictionary - [Pol,Tense]
|
||||
|
||||
** {
|
||||
flags
|
||||
startcat=Phr;
|
||||
heuristic_search_factor=0.60;
|
||||
meta_prob=1.0e-5;
|
||||
meta_token_prob=1.1965149246222233e-9;
|
||||
|
||||
fun
|
||||
LiftV : V -> PrV_none ;
|
||||
LiftV2 : V2 -> PrV_np ;
|
||||
LiftVS : VS -> PrV_s ;
|
||||
LiftVQ : VQ -> PrV_q ;
|
||||
LiftVV : VV -> PrV_v ;
|
||||
LiftVA : VA -> PrV_a ;
|
||||
LiftVN : VA -> PrV_n ; ----
|
||||
|
||||
LiftV3 : V3 -> PrV_np_np ;
|
||||
LiftV2S : V2S -> PrV_np_s ;
|
||||
LiftV2Q : V2Q -> PrV_np_q ;
|
||||
LiftV2V : V2V -> PrV_np_v ;
|
||||
LiftV2A : V2A -> PrV_np_a ;
|
||||
LiftV2N : V2A -> PrV_np_n ; ----
|
||||
|
||||
LiftAP : AP -> PrAP_none ;
|
||||
LiftCN : CN -> PrCN_none ;
|
||||
|
||||
LiftAdv : Adv -> PrAdv_none ;
|
||||
LiftAdV : Adv -> PrAdv_none ;
|
||||
LiftPrep : Prep -> PrAdv_np ;
|
||||
|
||||
}
|
||||
41
lib/src/experimental/NDTransEng.gf
Normal file
41
lib/src/experimental/NDTransEng.gf
Normal file
@@ -0,0 +1,41 @@
|
||||
--# -path=.:../translator
|
||||
|
||||
concrete NDTransEng of NDTrans =
|
||||
RGLBaseEng - [Pol,Tense]
|
||||
,NDPredEng
|
||||
,DictionaryEng - [Pol,Tense]
|
||||
|
||||
** open ResEng, PredInstanceEng, Prelude, (Pr = PredEng) in {
|
||||
|
||||
flags
|
||||
literal=Symb ;
|
||||
|
||||
oper
|
||||
liftV : ResEng.Verb -> Pr.PrV = \v -> lin PrV {s = v.s ; p = v.p ; c1,c2 = [] ; isSubjectControl = False ; vtype = VTAct ; vvtype = VVInf} ;
|
||||
|
||||
lin
|
||||
LiftV v = liftV v ;
|
||||
LiftV2 v = liftV v ** {c1 = v.c2} ;
|
||||
LiftVS v = liftV v ;
|
||||
LiftVQ v = liftV v ;
|
||||
LiftVA v = liftV v ; ---- c1?
|
||||
LiftVN v = liftV v ; ---- c1?
|
||||
LiftVV v = lin PrV {s = \\f => v.s ! VVF f ; p = v.p ; c1,c2 = [] ; isSubjectControl = False ; vtype = VTAct ; vvtype = VVInf} ; ---- c1? ---- VVF
|
||||
|
||||
LiftV3 v = liftV v ** {c1 = v.c2 ; c2 = v.c3} ;
|
||||
LiftV2S v = liftV v ** {c1 = v.c2} ;
|
||||
LiftV2Q v = liftV v ** {c1 = v.c2} ;
|
||||
LiftV2V v = liftV v ** {c1 = v.c2 ; c2 = v.c3 ; isSubjectControl = False ; vvtype = v.typ} ; ---- subj control should be defined in V2V
|
||||
LiftV2A v = liftV v ** {c1 = v.c2} ;
|
||||
LiftV2N v = liftV v ** {c1 = v.c2} ;
|
||||
|
||||
|
||||
LiftAP ap = ap ** {c1,c2 = [] ; obj1 = \\_ => []} ; --- isPre
|
||||
LiftCN cn = lin PrCN {s = \\n => cn.s ! n ! Nom ; c1,c2 = [] ; obj1 = \\_ => []} ;
|
||||
|
||||
LiftAdv a = a ** {isAdV = False ; c1 = []} ;
|
||||
LiftAdV a = a ** {isAdV = True ; c1 = []} ;
|
||||
LiftPrep p = lin PrAdv {s = [] ; isAdV = False ; c1 = p.s} ;
|
||||
|
||||
|
||||
}
|
||||
42
lib/src/experimental/NDTransSwe.gf
Normal file
42
lib/src/experimental/NDTransSwe.gf
Normal file
@@ -0,0 +1,42 @@
|
||||
--# -path=.:../translator
|
||||
|
||||
concrete NDTransSwe of NDTrans =
|
||||
RGLBaseSwe - [Pol,Tense]
|
||||
,NDPredSwe
|
||||
,DictionarySwe - [Pol,Tense]
|
||||
|
||||
** open CommonScand, ResSwe, PredInstanceSwe, (Pr=PredSwe), Prelude in {
|
||||
|
||||
flags
|
||||
literal=Symb ;
|
||||
|
||||
oper
|
||||
vliftV : Verb -> PrV = \v -> lin PrV (PredInstanceSwe.liftV v) ;
|
||||
PrV = Pr.PrV ;
|
||||
|
||||
lin
|
||||
LiftV v = vliftV v ;
|
||||
LiftV2 v = <vliftV <v : Verb> : PrV> ** {c1 = v.c2.s} ;
|
||||
LiftVS v = vliftV v ;
|
||||
LiftVQ v = vliftV v ;
|
||||
LiftVA v = vliftV v ; ---- c1?
|
||||
LiftVN v = vliftV v ; ---- c1?
|
||||
LiftVV v = <vliftV <v : Verb> : PrV> ** {c1 = v.c2.s} ;
|
||||
|
||||
LiftV3 v = <vliftV <v : Verb> : PrV> ** {c1 = v.c2.s ; c2 = v.c3.s} ;
|
||||
|
||||
LiftV2S v = <vliftV <v : Verb> : PrV> ** {c1 = v.c2.s} ;
|
||||
LiftV2Q v = <vliftV <v : Verb> : PrV> ** {c1 = v.c2.s} ;
|
||||
LiftV2V v = <vliftV <v : Verb> : PrV> ** {c1 = v.c2.s ; c2 = v.c3.s} ;
|
||||
LiftV2A v = <vliftV <v : Verb> : PrV> ** {c1 = v.c2.s} ;
|
||||
LiftV2N v = <vliftV <v : Verb> : PrV> ** {c1 = v.c2.s} ;
|
||||
|
||||
LiftAP ap = lin PrAP {s = \\a => ap.s ! agr2aformpos a ; c1,c2 = [] ; obj1 = \\_ => []} ; --- isPre
|
||||
LiftCN cn = lin PrCN {s = \\n => cn.s ! n ! DIndef ! Nom ; c1,c2 = [] ; obj1 = \\_ => []} ;
|
||||
|
||||
LiftAdv a = lin PrAdv (a ** {isAdV = False ; c1 = []}) ;
|
||||
LiftAdV a = lin PrAdv (a ** {isAdV = True ; c1 = []}) ;
|
||||
LiftPrep p = lin PrAdv ({s = [] ; isAdV = False ; c1 = p.s}) ;
|
||||
|
||||
}
|
||||
|
||||
@@ -314,6 +314,23 @@ lin
|
||||
c2 = [] ; ---- w.c2 ?
|
||||
} ;
|
||||
|
||||
ContVPC x v w = { ---- some loss of quality seems inevitable
|
||||
v = \\a =>
|
||||
let
|
||||
vv = v.v ! a ;
|
||||
wv = w.v ! a ;
|
||||
vpa = vagr2agr a ;
|
||||
in
|
||||
vv.p1 ++ v.adV ++ vv.p2 ++ vv.p3 ++ v.adj ! vpa ++
|
||||
v.c1 ++ v.obj1.p1 ! vpa ++ v.c2 ++ v.obj2.p1 ! vpa ++ v.adv ++ v.ext ---- appComplCase
|
||||
++ "," ++
|
||||
wv ;
|
||||
inf = \\a =>
|
||||
infVP v.vvtype a v ++ "," ++ w.inf ! a ;
|
||||
c1 = [] ; ---- w.c1 ? --- the full story is to unify v and w...
|
||||
c2 = [] ; ---- w.c2 ?
|
||||
} ;
|
||||
|
||||
UseVPC x vpc = { ---- big loss of quality (overgeneration) seems inevitable
|
||||
v = \\a => <[], [], vpc.v ! a> ;
|
||||
inf = \\_ => vpc.inf ! defaultAgr ; ---- agreement
|
||||
@@ -330,7 +347,12 @@ lin
|
||||
} ;
|
||||
|
||||
StartClC x c a b = {
|
||||
s = declCl (lin Cl a) ++ c.s2 ++ declCl (lin Cl b) ;
|
||||
s = declCl a ++ c.s2 ++ declCl b ;
|
||||
c3 = b.c3 ; ----
|
||||
} ;
|
||||
|
||||
ContClC x a b = {
|
||||
s = declCl a ++ "," ++ b.s ;
|
||||
c3 = b.c3 ; ----
|
||||
} ;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user