1
0
forked from GitHub/gf-core

factored out fun's for lifting RGL functions to Pred, and added some

This commit is contained in:
aarne
2014-02-08 19:53:11 +00:00
parent 3c97dc4ed3
commit 2ff1587382
13 changed files with 214 additions and 174 deletions

View File

@@ -0,0 +1,32 @@
abstract Lift =
RGLBase - [Pol,Tense]
,Pred
** {
fun
LiftV : V -> PrV aNone ;
LiftV2 : V2 -> PrV (aNP aNone) ;
LiftVS : VS -> PrV aS ;
LiftVQ : VQ -> PrV aQ ;
LiftVV : VV -> PrV aV ;
LiftVA : VA -> PrV aA ;
LiftVN : VA -> PrV aN ; ----
LiftV3 : V3 -> PrV (aNP (aNP aNone)) ;
LiftV2S : V2S -> PrV (aNP aS) ;
LiftV2Q : V2Q -> PrV (aNP aQ) ;
LiftV2V : V2V -> PrV (aNP aV) ;
LiftV2A : V2A -> PrV (aNP aA) ;
LiftV2N : V2A -> PrV (aNP aN) ; ----
LiftAP : AP -> PrAP aNone ;
LiftA2 : A2 -> PrAP (aNP aNone) ;
LiftCN : CN -> PrCN aNone ;
LiftN2 : N2 -> PrCN (aNP aNone) ;
AppAPCN : PrAP aNone -> CN -> CN ;
LiftAdv : Adv -> PrAdv aNone ;
LiftAdV : AdV -> PrAdv aNone ;
LiftPrep : Prep -> PrAdv (aNP aNone) ;
}

View File

@@ -0,0 +1,41 @@
concrete LiftEng of Lift =
RGLBaseEng - [Pol,Tense]
,PredEng
** 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 = {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 = {s = \\a => ap.s ! a ; c1,c2 = [] ; obj1 = \\_ => []} ; --- isPre
LiftA2 a = {s = \\_ => a.s ! AAdj Posit Nom ; c1 = a.c2 ; c2 = [] ; obj1 = \\_ => []} ; --- isPre
LiftCN cn = {s = \\n => cn.s ! n ! Nom ; c1,c2 = [] ; obj1 = \\_ => []} ;
LiftN2 cn = {s = \\n => cn.s ! n ! Nom ; c1 = cn.c2 ; c2 = [] ; obj1 = \\_ => []} ;
AppAPCN ap cn = {s = \\n,c => cn.s ! n ! c ++ ap.s ! agrgP3 n cn.g ++ ap.obj1 ! agrgP3 n cn.g ; g = cn.g}
| {s = \\n,c => ap.s ! agrgP3 n cn.g ++ ap.obj1 ! agrgP3 n cn.g ++ cn.s ! n ! c ; g = cn.g} ; ---- isPre
LiftAdv a = a ** {isAdV = False ; c1 = []} ;
LiftAdV a = a ** {isAdV = True ; c1 = []} ;
LiftPrep p = {s = [] ; isAdV = False ; c1 = p.s} ;
}

View File

@@ -0,0 +1,56 @@
concrete LiftSwe of Lift =
RGLBaseSwe - [Pol,Tense]
,PredSwe
** open CommonScand, ResSwe, PredInstanceSwe, Prelude in {
--flags literal=Symb ;
oper
liftV = PredInstanceSwe.liftV ;
lin
LiftV v = liftV v ;
LiftV2 v = <liftV <v : Verb> : PrVerb> ** {c1 = v.c2.s} ;
LiftVS v = liftV v ;
LiftVQ v = liftV v ;
LiftVA v = liftV v ; ---- c1?
LiftVN v = liftV v ; ---- c1?
LiftVV v = <liftV <v : Verb> : PrVerb> ** {c1 = v.c2.s} ;
LiftV3 v = <liftV <v : Verb> : PrVerb> ** {c1 = v.c2.s ; c2 = v.c3.s} ;
LiftV2S v = <liftV <v : Verb> : PrVerb> ** {c1 = v.c2.s} ;
LiftV2Q v = <liftV <v : Verb> : PrVerb> ** {c1 = v.c2.s} ;
LiftV2V v = <liftV <v : Verb> : PrVerb> ** {c1 = v.c2.s ; c2 = v.c3.s} ;
LiftV2A v = <liftV <v : Verb> : PrVerb> ** {c1 = v.c2.s} ;
LiftV2N v = <liftV <v : Verb> : PrVerb> ** {c1 = v.c2.s} ;
LiftAP ap = {s = \\a => ap.s ! agr2aformpos a ; c1,c2 = [] ; obj1 = \\_ => []} ; --- isPre
LiftA2 ap = {s = \\a => ap.s ! AF (APosit (agr2aformpos a)) Nom ; c1 = ap.c2.s ; c2 = [] ; obj1 = \\_ => []} ; --- isPre
LiftCN cn = {s = \\n => cn.s ! n ! DIndef ! Nom ; c1,c2 = [] ; obj1 = \\_ => []} ;
LiftN2 cn = {s = \\n => cn.s ! n ! specDet DIndef ! Nom ; c1 = cn.c2.s ; c2 = [] ; obj1 = \\_ => []} ;
AppAPCN ap cn =
{s = \\n,d,c =>
let
agr = {n = n ; g = cn.g ; p = P3}
in (cn.s ! n ! d ! c) ++ (ap.s ! agr ++ ap.obj1 ! agr) ; -- flicka älskad av alla
g = cn.g ;
isMod = True
}
| {s = \\n,d,c =>
let
agr = {n = n ; g = cn.g ; p = P3}
in (ap.obj1 ! agr ++ ap.s ! agr) ++ (cn.s ! n ! d ! c) ; -- av alla älskad flicka
g = cn.g ;
isMod = True
} ;
LiftAdv a = a ** {isAdV = False ; c1 = []} ;
LiftAdV a = a ** {isAdV = True ; c1 = []} ;
LiftPrep p = {s = [] ; isAdV = False ; c1 = p.s} ;
}

View File

@@ -0,0 +1,35 @@
abstract NDLift =
RGLBase - [Pol,Tense]
,NDPred
** {
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 ;
LiftA2 : A2 -> PrAP_np ;
LiftCN : CN -> PrCN_none ;
LiftN2 : N2 -> PrCN_np ;
AppAPCN : PrAP_none -> CN -> CN ;
LiftAdv : Adv -> PrAdv_none ;
LiftAdV : Adv -> PrAdv_none ;
LiftPrep : Prep -> PrAdv_np ;
}

View File

@@ -0,0 +1,5 @@
concrete NDLiftEng of NDLift =
RGLBaseEng - [Pol,Tense]
,NDPredEng
** NDLiftFunctor with (Lift = LiftEng) ;

View File

@@ -0,0 +1,34 @@
incomplete concrete NDLiftFunctor of NDLift =
RGLBase - [Pol,Tense]
,NDPred
** open Lift in {
lin
LiftV = Lift.LiftV ;
LiftV2 = Lift.LiftV2 ;
LiftVS = Lift.LiftVS ;
LiftVQ = Lift.LiftVQ ;
LiftVV = Lift.LiftVV ;
LiftVA = Lift.LiftVA ;
LiftVN = Lift.LiftVN ;
LiftV3 = Lift.LiftV3 ;
LiftV2S = Lift.LiftV2S ;
LiftV2Q = Lift.LiftV2Q ;
LiftV2V = Lift.LiftV2V ;
LiftV2A = Lift.LiftV2A ;
LiftV2N = Lift.LiftV2N ;
LiftAP = Lift.LiftAP ;
LiftA2 = Lift.LiftA2 ;
LiftCN = Lift.LiftCN ;
LiftN2 = Lift.LiftN2 ;
AppAPCN = Lift.AppAPCN ;
LiftAdv = Lift.LiftAdv ;
LiftAdV = Lift.LiftAdV ;
LiftPrep = Lift.LiftPrep ;
}

View File

@@ -0,0 +1,5 @@
concrete NDLiftSwe of NDLift =
RGLBaseSwe - [Pol,Tense]
,NDPredSwe
** NDLiftFunctor with (Lift = LiftSwe) ;

View File

@@ -1,8 +1,7 @@
--# -path=.:../translator
abstract NDTrans =
RGLBase - [Pol,Tense]
,NDPred
NDLift
,Dictionary - [Pol,Tense]
** {
@@ -12,27 +11,4 @@ flags
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 ;
}

View File

@@ -1,8 +1,7 @@
--# -path=.:../translator
concrete NDTransEng of NDTrans =
RGLBaseEng - [Pol,Tense]
,NDPredEng
NDLiftEng
,DictionaryEng - [Pol,Tense]
** open ResEng, PredInstanceEng, Prelude, (Pr = PredEng) in {
@@ -10,32 +9,4 @@ concrete NDTransEng of NDTrans =
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} ;
}

View File

@@ -1,8 +1,7 @@
--# -path=.:../translator
concrete NDTransSwe of NDTrans =
RGLBaseSwe - [Pol,Tense]
,NDPredSwe
NDLiftSwe
,DictionarySwe - [Pol,Tense]
** open CommonScand, ResSwe, PredInstanceSwe, (Pr=PredSwe), Prelude in {
@@ -10,33 +9,5 @@ concrete NDTransSwe of NDTrans =
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}) ;
}

View File

@@ -1,8 +1,5 @@
--# -path=.:../translator
abstract Test =
RGLBase - [Pol,Tense,MkSymb]
,Pred
Lift - [MkSymb]
,Lexicon - [Pol,Tense]
,Structural - [Pol,Tense]
@@ -12,28 +9,4 @@ flags
-- heuristic_search_factor=0.60;
-- meta_prob=1.0e-5;
-- meta_token_prob=1.1965149246222233e-9;
fun
LiftV : V -> PrV aNone ;
LiftV2 : V2 -> PrV (aNP aNone) ;
LiftVS : VS -> PrV aS ;
LiftVQ : VQ -> PrV aQ ;
LiftVV : VV -> PrV aV ;
LiftVA : VA -> PrV aA ;
LiftVN : VA -> PrV aN ; ----
LiftV3 : V3 -> PrV (aNP (aNP aNone)) ;
LiftV2S : V2S -> PrV (aNP aS) ;
LiftV2Q : V2Q -> PrV (aNP aQ) ;
LiftV2V : V2V -> PrV (aNP aV) ;
LiftV2A : V2A -> PrV (aNP aA) ;
LiftV2N : V2A -> PrV (aNP aN) ; ----
LiftAP : AP -> PrAP aNone ;
LiftCN : CN -> PrCN aNone ;
LiftAdv : Adv -> PrAdv aNone ;
LiftAdV : AdV -> PrAdv aNone ;
LiftPrep : Prep -> PrAdv (aNP aNone) ;
}

View File

@@ -1,39 +1,9 @@
concrete TestEng of Test =
RGLBaseEng - [Pol,Tense,MkSymb]
,PredEng
LiftEng - [MkSymb]
,LexiconEng - [Pol,Tense]
,StructuralEng - [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 = {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 = {s = \\n => cn.s ! n ! Nom ; c1,c2 = [] ; obj1 = \\_ => []} ;
LiftAdv a = a ** {isAdV = False ; c1 = []} ;
LiftAdV a = a ** {isAdV = True ; c1 = []} ;
LiftPrep p = {s = [] ; isAdV = False ; c1 = p.s} ;
}

View File

@@ -1,8 +1,5 @@
--# -path=.:../translator
concrete TestSwe of Test =
RGLBaseSwe - [Pol,Tense,MkSymb]
,PredSwe
LiftSwe - [MkSymb]
,LexiconSwe - [Pol,Tense]
,StructuralSwe - [Pol,Tense]
@@ -10,32 +7,6 @@ concrete TestSwe of Test =
--flags literal=Symb ;
oper
liftV = PredInstanceSwe.liftV ;
lin
LiftV v = liftV v ;
LiftV2 v = <liftV <v : Verb> : PrVerb> ** {c1 = v.c2.s} ;
LiftVS v = liftV v ;
LiftVQ v = liftV v ;
LiftVA v = liftV v ; ---- c1?
LiftVN v = liftV v ; ---- c1?
LiftVV v = <liftV <v : Verb> : PrVerb> ** {c1 = v.c2.s} ;
LiftV3 v = <liftV <v : Verb> : PrVerb> ** {c1 = v.c2.s ; c2 = v.c3.s} ;
LiftV2S v = <liftV <v : Verb> : PrVerb> ** {c1 = v.c2.s} ;
LiftV2Q v = <liftV <v : Verb> : PrVerb> ** {c1 = v.c2.s} ;
LiftV2V v = <liftV <v : Verb> : PrVerb> ** {c1 = v.c2.s ; c2 = v.c3.s} ;
LiftV2A v = <liftV <v : Verb> : PrVerb> ** {c1 = v.c2.s} ;
LiftV2N v = <liftV <v : Verb> : PrVerb> ** {c1 = v.c2.s} ;
LiftAP ap = {s = \\a => ap.s ! agr2aformpos a ; c1,c2 = [] ; obj1 = \\_ => []} ; --- isPre
LiftCN cn = {s = \\n => cn.s ! n ! DIndef ! Nom ; c1,c2 = [] ; obj1 = \\_ => []} ;
LiftAdv a = a ** {isAdV = False ; c1 = []} ;
LiftAdV a = a ** {isAdV = True ; c1 = []} ;
LiftPrep p = {s = [] ; isAdV = False ; c1 = p.s} ;
}