1
0
forked from GitHub/gf-core

NDTransChi compiles

This commit is contained in:
aarne
2014-03-09 22:15:50 +00:00
parent b4c0077955
commit c8309a33d8
16 changed files with 139 additions and 74 deletions

View File

@@ -18,6 +18,9 @@ fun
AdV_Chunk : AdV -> Chunk ;
AdN_Chunk : AdN -> Chunk ;
Cl_Chunk : PrCl_none -> Chunk ;
Cl_np_Chunk : PrCl_np -> Chunk ;
QCl_Chunk : PrQCl_none -> Chunk ;
QCl_np_Chunk : PrQCl_np -> Chunk ;
CN_Pl_Chunk : CN -> Chunk ;
CN_Sg_Chunk : CN -> Chunk ;
CN_Pl_Gen_Chunk : CN -> Chunk ;

View File

@@ -1,8 +1,8 @@
concrete ChunkChi of Chunk =
RGLBaseChi - [Pol,Tense],
RGLBaseChi - [Pol,Tense,Ant],
NDPredChi
** open (PI=PredInstanceChi), CommonScand, ResChi, Prelude in {
** open (PI=PredInstanceChi), ResChi, Prelude in {
lincat
Chunks = {s : Str} ;
@@ -17,32 +17,33 @@ lin
lin
AP_Chunk ap = ss (ap.s ! (Strong (GSg Utr))) ; ---- other agr
AP_Chunk ap = ap ;
AdA_Chunk ada = ada ;
Adv_Chunk adv = adv ;
AdV_Chunk adv = adv ;
AdN_Chunk adn = adn ;
Cl_Chunk cl = ss (PI.declCl cl) ;
CN_Pl_Chunk cn = ss (cn.s ! Pl ! DIndef ! Nom) ;
CN_Sg_Chunk cn = ss (cn.s ! Sg ! DIndef ! Nom) ;
CN_Pl_Gen_Chunk cn = ss (cn.s ! Pl ! DIndef ! Gen) ;
CN_Sg_Gen_Chunk cn = ss (cn.s ! Sg ! DIndef ! Gen) ;
Conj_Chunk conj = ss conj.s2 ;
Cl_Chunk, Cl_np_Chunk = \cl -> ss (PI.declCl cl) ;
QCl_Chunk, QCl_np_Chunk = \cl -> ss (PI.questCl cl) ;
CN_Pl_Chunk cn = cn ;
CN_Sg_Chunk cn = cn ;
CN_Pl_Gen_Chunk cn = ss (cn.s ++ de_s) ;
CN_Sg_Gen_Chunk cn = ss (cn.s ++ de_s) ;
Conj_Chunk conj = ss (conj.s ! CSent).s2 ;
IAdv_Chunk iadv = iadv ;
IP_Chunk ip = ss (ip.s ! NPNom) ;
NP_Nom_Chunk np = ss (np.s ! NPNom) ;
NP_Acc_Chunk np = ss (np.s ! NPAcc) ;
NP_Gen_Chunk np = ss (np.s ! NPPoss (GSg Utr) Nom) ;
Numeral_Nom_Chunk num = ss (num.s ! NCard Utr) ;
Numeral_Gen_Chunk num = ss (num.s ! NCard Utr) ;
IP_Chunk ip = ip ;
NP_Nom_Chunk np = np ;
NP_Acc_Chunk np = np ;
NP_Gen_Chunk np = ss (np.s ++ de_s) ;
Numeral_Nom_Chunk num = ss (num.s ++ ge_s) ;
Numeral_Gen_Chunk num = ss (num.s ++ ge_s ++ de_s) ;
Ord_Nom_Chunk ord = ord ;
Ord_Gen_Chunk ord = ord ;
Predet_Chunk predet = ss (predet.s ! Utr ! Sg) ;
Prep_Chunk prep = prep ;
RP_Nom_Chunk rp = ss (rp.s ! Utr ! Sg ! RNom) ;
RP_Acc_Chunk rp = ss (rp.s ! Utr ! Sg ! RNom) ;
RP_Gen_Chunk rp = ss (rp.s ! Utr ! Sg ! RGen) ;
Subj_Chunk subj = subj ;
Predet_Chunk predet = predet ;
Prep_Chunk prep = ss (prep.prepPre ++ prep.prepPost) ;
RP_Nom_Chunk rp = rp ;
RP_Acc_Chunk rp = rp ;
RP_Gen_Chunk rp = ss (rp.s ++ de_s) ;
Subj_Chunk subj = ss (subj.prePart ++ subj.sufPart) ;
VP_none_Chunk,
VP_np_Chunk,
@@ -57,11 +58,10 @@ lin
VP_np_v_Chunk
= \vp ->
let verb = vp.v ! PI.UUnit
in
allAgrSS (\a ->
verb.p1 ++ verb.p2 ++ vp.adV ++ verb.p3 ++ vp.part ++
vp.adj ! a ++ vp.c1 ++ vp.obj1.p1 ! a ++ vp.c2 ++ vp.obj2.p1 ! a ++ vp.adv ++ vp.ext
) ;
in ss (
verb.p1 ++ vp.adV ++ vp.adv ++ verb.p2 ++ verb.p3 ++ vp.part ++
vp.adj ! PI.UUnit ++ vp.obj1.p1 ! PI.UUnit ++ vp.obj2.p1 ! PI.UUnit ++ vp.ext
) ;
VP_none_inf_Chunk,
VP_np_inf_Chunk,
@@ -74,7 +74,7 @@ lin
VP_np_a_inf_Chunk,
VP_np_q_inf_Chunk,
VP_np_v_inf_Chunk
= \vp -> allAgrSS (\a -> PI.infVP PI.UUnit a vp) ;
= \vp -> ss (PI.infVP PI.UUnit PI.UUnit vp) ;
V_none_prespart_Chunk,
V_np_prespart_Chunk,
@@ -104,33 +104,25 @@ lin
copula_inf_Chunk = ss "att vara" | ss "vara" ;
refl_SgP1_Chunk = ss "mig själv" ;
refl_SgP2_Chunk = ss "dig själv" ;
refl_SgP3_Chunk = ss "sig själv" ;
refl_PlP1_Chunk = ss "oss själva" ;
refl_PlP2_Chunk = ss "er själva" ;
refl_PlP3_Chunk = ss "sig själva" ;
neg_Chunk = ss "inte" ;
copula_Chunk = ss "är" ;
copula_neg_Chunk = ss "är inte" ;
past_copula_Chunk = ss "var" ;
past_copula_neg_Chunk = ss "var inte" ;
future_Chunk = ss "ska" | ss "skall" ;
future_neg_Chunk = ss "ska inte" | ss "skall inte" ;
cond_Chunk = ss "skulle" ;
cond_neg_Chunk = ss "skulle inte" ;
perfect_Chunk = ss "har" ;
perfect_neg_Chunk = ss "har inte" ;
past_perfect_Chunk = ss "hade" ;
past_perfect_neg_Chunk = ss "hade inte" ;
refl_SgP1_Chunk = ss reflPron ;
refl_SgP2_Chunk = ss reflPron ;
refl_SgP3_Chunk = ss reflPron ;
refl_PlP1_Chunk = ss reflPron ;
refl_PlP2_Chunk = ss reflPron ;
refl_PlP3_Chunk = ss reflPron ;
neg_Chunk = ss neg_s ;
copula_Chunk = ss copula_s ;
copula_neg_Chunk = ss (neg_s ++ copula_s) ;
past_copula_Chunk = ss "" ;
past_copula_neg_Chunk = ss (neg_s ++ copula_s ++ "了") ;
future_Chunk = ss copula_s ; ----
future_neg_Chunk = ss (neg_s ++ copula_s) ;
cond_Chunk = ss copula_s ; ----
cond_neg_Chunk = ss (neg_s ++ copula_s) ;
perfect_Chunk = ss "" ;
perfect_neg_Chunk = ss (neg_s ++ copula_s ++ "了") ;
past_perfect_Chunk = ss "" ;
past_perfect_neg_Chunk = ss (neg_s ++ copula_s ++ "了") ;
oper
allAgrSS : (Agr -> Str) -> SS = \f ->
ss (f PI.defaultAgr) ;
---- | ss (f (AgP3Sg Fem)) | ss (f (AgP3Sg Neutr)) |
---- ss (f (AgP1 Sg)) | ss (f (AgP1 Pl)) | ss (f (AgP2 Sg)) | ss (f (AgP2 Pl)) |
---- ss (f (AgP3Pl)) ;
}

View File

@@ -22,7 +22,8 @@ lin
Adv_Chunk adv = adv ;
AdV_Chunk adv = adv ;
AdN_Chunk adn = adn ;
Cl_Chunk cl = ss (PI.declCl cl) ;
Cl_Chunk, Cl_np_Chunk = \cl -> ss (PI.declCl cl) ;
QCl_Chunk, QCl_np_Chunk = \cl -> ss (PI.questCl cl) ;
CN_Pl_Chunk cn = ss (cn.s ! Pl ! Nom) ;
CN_Sg_Chunk cn = ss (cn.s ! Sg ! Nom) ;
CN_Pl_Gen_Chunk cn = ss (cn.s ! Pl ! Gen) ;

View File

@@ -24,7 +24,8 @@ lin
Adv_Chunk adv = adv ;
AdV_Chunk adv = adv ;
AdN_Chunk adn = adn ;
Cl_Chunk cl = ss (PI.declCl cl) ;
Cl_Chunk, Cl_np_Chunk = \cl -> ss (PI.declCl cl) ;
QCl_Chunk, QCl_np_Chunk = \cl -> ss (PI.questCl cl) ;
CN_Pl_Chunk cn = ss (cn.s ! NCase Pl Nom) ;
CN_Sg_Chunk cn = ss (cn.s ! NCase Sg Nom) ;
CN_Pl_Gen_Chunk cn = ss (cn.s ! NCase Pl Gen) ;

View File

@@ -22,7 +22,8 @@ lin
Adv_Chunk adv = adv ;
AdV_Chunk adv = adv ;
AdN_Chunk adn = adn ;
Cl_Chunk cl = ss (PI.declCl cl) ;
Cl_Chunk, Cl_np_Chunk = \cl -> ss (PI.declCl cl) ;
QCl_Chunk, QCl_np_Chunk = \cl -> ss (PI.questCl cl) ;
CN_Pl_Chunk cn = ss (cn.s ! Pl ! DIndef ! Nom) ;
CN_Sg_Chunk cn = ss (cn.s ! Sg ! DIndef ! Nom) ;
CN_Pl_Gen_Chunk cn = ss (cn.s ! Pl ! DIndef ! Gen) ;

View File

@@ -32,11 +32,11 @@ lin
LiftCN cn = {s = \\n => cn.s ; c1,c2 = noComplCase ; obj1 = \\_ => []} ;
LiftN2 cn = {s = \\n => cn.s ; c1 = cn.c2 ; c2 = noComplCase ; obj1 = \\_ => []} ;
---- AppAPCN ap cn =
AppAPCN ap cn = {s = ap.s ! UUnit ++ cn.s ; c = cn.c} ; ----
LiftAdv a = a ** {isAdV = False ; c1 = noComplCase} ;
LiftAdV a = a ** {isAdV = True ; c1 = noComplCase} ;
LiftPrep p = {s = [] ; isAdV = False ; c1 = p} ;
LiftAdv a = {advType = a.advType ; prepPre = a.s ; prepPost = []} ;
LiftAdV a = {advType = ATTime ; prepPre = a.s ; prepPost = []} ; ---- the first adv place
LiftPrep p = p ;
}

View File

@@ -3,5 +3,7 @@ all: translator
translator:
gf -s -make -literal=Symb -probs=NDPredTrans.probs -name=TransEngSwe NDTransEng.gf NDTransSwe.gf
bigtranslator:
gf -s -make -literal=Symb -probs=NDPredTrans.probs -name=TransEngFinSwe NDTransEng.gf NDTransSwe.gf NDTransFin.gf +RTS -K200M
gf -s -make -literal=Symb -probs=NDPredTrans.probs -name=TransEngChiFinSwe NDTransEng.gf NDTransSwe.gf NDTransChi.gf NDTransFin.gf +RTS -K200M
midtranslator:
gf -s -make -literal=Symb -probs=NDPredTrans.probs -name=TransEngChiSwe NDTransEng.gf NDTransSwe.gf NDTransChi.gf +RTS -K200M

View File

@@ -1,5 +1,10 @@
concrete NDPredChi of Pred =
concrete NDPredChi of NDPred =
CatChi [NP,Utt,IP,IAdv,IComp,Conj,RS,RP,Subj] **
NDPredFunctor with
NDPredFunctor
with
(PredInterface = PredInstanceChi),
(Pred = PredChi) ;
(Pred = PredChi) ** open PredChi in {
lincat Ant = PredChi.Ant ;
}

View File

@@ -1,4 +1,4 @@
concrete NDPredEng of Pred =
concrete NDPredEng of NDPred =
CatEng [Ant,NP,Utt,IP,IAdv,IComp,Conj,RS,RP,Subj] **
NDPredFunctor with
(PredInterface = PredInstanceEng),

View File

@@ -1,4 +1,4 @@
concrete NDPredFin of Pred =
concrete NDPredFin of NDPred =
CatFin [Ant,NP,Utt,IP,IAdv,IComp,Conj,Subj,RS,RP] **
NDPredFunctor
with

View File

@@ -1,5 +1,5 @@
incomplete concrete NDPredFunctor of NDPred =
Cat [Ant,NP,Utt,IP,IAdv,Conj,RS,RP] **
Cat [Ant,NP,Utt,IP,IAdv,Conj,RS,RP,Subj] **
open
PredInterface,
Pred,

View File

@@ -1,4 +1,4 @@
concrete NDPredSwe of Pred =
concrete NDPredSwe of NDPred =
CatSwe [Ant,NP,Utt,IP,IAdv,IComp,Conj,RS,RP,Subj] **
NDPredFunctor with
(PredInterface = PredInstanceSwe),

View File

@@ -65220,6 +65220,9 @@ AdA_Chunk 9.109495956621799e-4
AdV_Chunk 4.7404486565341235e-3
Adv_Chunk 5.328685581035249e-3
Cl_Chunk 0.12420511332822734
Cl_np_Chunk 0.012420511332822734
QCl_Chunk 0.12420511332822734
QCl_np_Chunk 0.012420511332822734
CN_Pl_Chunk 0.012420511332822734
CN_Sg_Chunk 0.012420511332822734
CN_Pl_Gen_Chunk 0.0012420511332822734

View File

@@ -2,18 +2,42 @@ concrete PredChi of Pred =
CatChi [NP,Utt,IP,IAdv,IComp,Conj,RP,RS,Imp,Subj] **
PredFunctor - [UseNP,ComplV2,SlashV3,ContVPC, StartVPC, StartClC,
RelVP, RelSlash, QuestVP, QuestSlash, QuestIComp,PredVP,
SubjUttPreS, SubjUttPreQ, SubjUttPost]
SubjUttPreS, SubjUttPreQ, SubjUttPost,
UseAdv, ComplAdv, UseAdvCl, AdvQCl, AdvCl
]
with
(PredInterface = PredInstanceChi) ** open ResChi, (P = ParadigmsChi), TenseX in {
lincat
Ant = {s : Str ; a : Anteriority} ;
Ant = {s : Str ; a : PredInstanceChi.Anteriority} ;
lin
UseNP a t p np = useCopula a t p ** {
adj = \\a => np.s
} ;
UseAdv x a t p adv =
let verb = case adv.advType of {
ATPlace True => liftV noVerb ;
_ => liftV zai_V
}
in initPrVerbPhraseV a t p verb ** {
adv = adv.prepPre ++ adv.prepPost ;
} ;
ComplAdv x p np = {prepPre = appComplCase p np ; prepPost = [] ; advType = p.advType} ;
UseAdvCl adv cl = {s = adv.prepPre ++ adv.prepPost ++ declInvCl cl} ;
AdvCl, AdvQCl = \x,adv,cl ->
let advs = adv.prepPre ++ adv.prepPost in
case adv.advType of {
ATManner => cl ** {obj1 = deVAdv_s ++ advs ++ cl.obj1} ; -- he sleeps *well*
ATPlace True => cl ** {adv = cl.adv ++ advs} ; -- he today *in the house* sleeps
ATPlace False => cl ** {adv = cl.adv ++ zai_V.s ++ advs} ; -- he today *here* sleeps
ATTime => cl ** {adv = advs ++ cl.adv} -- he *today* here sleeps ---- also: **today** he here sleeps
} ;
ComplV2 x vp np = vp ** {
obj1 : (Agr => Str) * Agr = <\\a => appObjCase np, UUnit>
} ;
@@ -129,4 +153,32 @@ lin
c3 = focobj.p4 ;
} ;
QuestIComp a t p icomp np =
let vagr = UUnit in
initPrClause ** {
v = tenseCopula (a.s ++ t.s ++ p.s) t.t a.a p.p vagr ;
subj = appSubjCase np ;
adV = negAdV p ;
foc = icomp.s ;
focType = FocObj ;
} ;
NomVPNP vp = ss (vp.s ! UUnit ! UUnit) ;----
SubjUttPreS subj cl s = ss (subj.prePart ++ declSubordCl cl ++ subj.sufPart ++ declInvCl s) ;
SubjUttPreQ subj cl q = ss (subj.prePart ++ declSubordCl cl ++ subj.sufPart ++ questCl q) ;
SubjUttPost subj cl utt = ss (utt.s ++ subj.prePart ++ declSubordCl cl ++ subj.sufPart) ;
---- todo
AfterVP,
BeforeVP,
ByVP,
InOrderVP,
WhenVP,
WithoutVP
= variants {} ;
}

View File

@@ -171,7 +171,7 @@ lin
} ;
SlashClNP x cl np = cl ** { -- Cl ::= Cl/NP NP
adv = cl.adv ++ appComplCase cl.c3 np ; ---- again, adv just added
obj2 = cl.obj2 ++ appComplCase cl.c3 np ; ---- again, adv just added
c3 = noComplCase ; -- complCase has been consumed
} ;
@@ -263,6 +263,8 @@ lin
UttPrS s = s ;
AdvCl x a cl = case a.isAdV of {
True => cl ** {adV = cl.adV ++ a.s ; adv = cl.adv ; c3 = a.c1} ;
False => cl ** {adv = cl.adv ++ a.s ; adV = cl.adV ; c3 = a.c1}

View File

@@ -1,5 +1,5 @@
instance PredInstanceChi of
PredInterface - [PrVerb,initPrVerb,NounPhrase,appSubjCase,appObjCase] =
PredInterface - [PrVerb,initPrVerb,NounPhrase,appSubjCase,appObjCase,PrAdverb,linrefPrAdv] =
open ResChi, (P = ParadigmsChi), (X = ParamX), (S = SyntaxChi), Prelude in {
@@ -23,6 +23,9 @@ oper
appSubjCase : NounPhrase -> Str = \np -> np.s ;
appObjCase : NounPhrase -> Str = \np -> np.s ;
PrAdverb = Preposition ;
linrefPrAdv : PrAdverb -> Str = \adv -> adv.prepPre ++ adv.prepPost ;
---------------------
-- parameters -------
@@ -129,7 +132,7 @@ oper
-- this part is usually the same in all reconfigurations
restCl : PrClause -> Str = \cl -> cl.v.p3 ++ cl.adj ++ cl.obj1 ++ cl.obj2 ++ cl.ext ; ---- c3
negAdV : {s : Str ; p : Polarity} -> Str = \p -> p.s ++ not_Str p.p ;
negAdV : {s : Str ; p : Polarity} -> Str = \p -> p.s ; ---- not used in negation formation ++ not_Str p.p ;
not_Str = \p -> case p of {Pos => [] ; Neg => neg_s} ;