1
0
forked from GitHub/gf-core
This commit is contained in:
ra.monique
2009-12-14 11:58:15 +00:00
parent 7a449030b0
commit bb0bac0310
8 changed files with 112 additions and 71 deletions

View File

@@ -8,7 +8,7 @@ concrete CatRon of Cat =
lincat
lincat
-- Tensed/Untensed
@@ -47,7 +47,7 @@ concrete CatRon of Cat =
-- Noun
CN = {s : Number => Species => ACase => Str; g : NGender; a : Animacy } ;
CN = {s : Number => Species => ACase => Str; g : NGender; a : Animacy ; isComp : Bool} ;
Pron = {s : NCase => Str ;
c1, c2 : Clitics => Str ;
@@ -162,3 +162,4 @@ conjThan : Str = "dec
conjThat : Str = "cã" ;
}

View File

@@ -11,8 +11,8 @@ concrete ConjunctionRon of Conjunction =
ConjNP conj ss = heavyNP (conjunctDistrTable NCase conj ss ** {
a = {g = ss.a.g ; n = conjNumber conj.n ss.a.n ; p = ss.a.p} ;
hasClit = ss.hasClit;
ss = "" ---- fix this !!!!
hasClit = ss.nForm;
ss = ""
}) ;
@@ -35,13 +35,17 @@ concrete ConjunctionRon of Conjunction =
s1 = \\c => (x.s ! c).comp ;
s2 = \\c => (y.s ! c).comp ;
a = conjAgr x.a y.a;
hasClit = andB x.hasClit y.hasClit
nForm = case x.nForm of
{HasClit => y.nForm ;
_ => HasRef False }
} ;
ConsNP x xs = {
s1 = \\c => (x.s ! c).comp ++ comma ++ xs.s1 ! c ; ----e (conjunctCase c) ;
s2 = \\c => xs.s2 ! c ; ----e (conjunctCase c) ;
a = conjAgr x.a xs.a ;
hasClit = andB xs.hasClit x.hasClit
nForm = case x.nForm of
{HasClit => xs.nForm ;
_ => HasRef False}
} ;
BaseAP x y = twoTable AForm x y ** {isPre = andB x.isPre y.isPre} ;
@@ -52,7 +56,7 @@ concrete ConjunctionRon of Conjunction =
lincat
[S] = {s1,s2 : Mood => Str} ;
[Adv] = {s1,s2 : Str} ;
[NP] = {s1,s2 : NCase => Str ; a : Agr; hasClit : Bool} ;
[NP] = {s1,s2 : NCase => Str ; a : Agr; nForm : NForm} ;
[AP] = {s1,s2 : AForm => Str ; isPre : Bool} ;
[RS] = {s1,s2 : Mood => Agr => Str ; c : NCase} ;

View File

@@ -1,5 +1,5 @@
concrete NounRon of Noun =
CatRon ** open ResRon,Prelude in {
CatRon ** open ResRon,Prelude in {
flags optimize=all_subs ;
@@ -9,7 +9,8 @@ concrete NounRon of Noun =
n = det.n;
gg = agrGender cn.g n ;
ag = agrP3 gg n ;
hr = andB (getClit cn.a) det.hasRef ;
hr = orB (andB (getClit cn.a) det.hasRef) (andB det.isDef cn.isComp);
nf = if_then_else NForm hr HasClit (HasRef False);
st= if_then_else Species det.isDef Def Indef;
rs = if_then_else Species det.hasRef Def Indef
in
@@ -21,9 +22,8 @@ concrete NounRon of Noun =
clit = \\cs => if_then_Str hr ((genCliticsCase ag c).s ! cs) [] }
};
a = ag ;
hasClit = hr ;
hasRef = hr ;
isPronoun = False ;
nForm = nf;
isPronoun = False;
indForm = det.s ! gg ! No ++ det.size ++cn.s ! n ! rs ! ANomAcc ++ det.post ! gg ! No
} ;
@@ -38,16 +38,14 @@ concrete NounRon of Noun =
clit = \\cs => if_then_Str hc ((genCliticsCase ag c).s ! cs) [] } ;
a = ag;
hasClit = hc ;
hasRef = hc ;
nForm = if_then_else NForm hc HasClit (HasRef False) ;
isPronoun = False ;
indForm = pn.s ! No
} ;
UsePron p = {s = \\c =>{comp = p.s ! c ;
clit = (genCliticsCase p.a c).s } ;
hasClit = True;
hasRef = True ;
nForm = HasClit;
isPronoun = True ;
a = p.a;
indForm = p.s ! Ac
@@ -59,8 +57,7 @@ concrete NounRon of Noun =
{s = \\c => {comp = pred.s ! aagr (np.a.g) (np.a.n) ! (convCase c) ++ (np.s ! pred.c).comp ;
clit = (np.s ! c).clit };
a = np.a ;
hasClit = np.hasClit ;
hasRef = np.hasRef ;
nForm = np.nForm ;
isPronoun = False ;
indForm = pred.s ! aagr (np.a.g) (np.a.n) ! ANomAcc ++ (np.s ! pred.c).comp
} ;
@@ -70,21 +67,21 @@ concrete NounRon of Noun =
heavyNP {
s = \\c => (np.s ! c).comp ++ v2.s ! PPasse np.a.g np.a.n Indef (convCase c);
a = np.a ;
hasClit = np.hasClit;
hasClit = np.nForm;
ss = (np.s ! No).comp ++ v2.s ! PPasse np.a.g np.a.n Indef ANomAcc
} ;
RelNP np rs = heavyNP {
s = \\c => (np.s ! c).comp ++ rs.s ! Indic ! np.a ;
a = np.a ;
hasClit = np.hasClit ;
hasClit = np.nForm ;
ss = (np.s ! No).comp ++ rs.s ! Indic ! np.a
} ;
AdvNP np adv = heavyNP {
s = \\c => (np.s ! c).comp ++ adv.s ;
a = np.a ;
hasClit = np.hasClit;
hasClit = np.nForm;
ss = (np.s ! No).comp ++adv.s ;
} ;
@@ -141,7 +138,7 @@ in {
in heavyNP {
s = \\c => det.sp ! g ! c ;
a = agrP3 g n ;
hasClit = True ;
hasClit = HasClit ;
ss = det.sp ! g ! No
} ;
@@ -226,15 +223,14 @@ in {
s = \\c => {comp = cn.s ! n ! Indef ! (convCase c);
clit = \\cs => [] } ;
a = agrP3 g n ;
hasClit = False ;
hasRef = False ;
nForm = HasRef False ;
isPronoun = False ;
indForm = cn.s ! n ! Indef ! ANomAcc
} ;
-- This is based on record subtyping.
UseN, UseN2 = \noun -> noun ;
UseN, UseN2 = \noun -> noun ** {isComp = False};
Use2N3 f = f ;
@@ -243,14 +239,16 @@ in {
ComplN2 f x = {
s = \\n,sp,c => f.s ! n ! sp ! c ++ appCompl f.c2 x ;
g = f.g ;
a = f.a
a = f.a ;
isComp = getClit f.a
} ;
ComplN3 f x = {
s = \\n,sp,c => f.s ! n ! sp ! c ++ appCompl f.c2 x ;
g = f.g ;
c2 = f.c3;
a = f.a
a = f.a ;
isComp = getClit f.a
} ;
AdjCN ap cn =
@@ -264,36 +262,38 @@ in {
Indef => \\c => cn.s ! n ! Indef ! c ++ ap.s ! (AF (agrGender g n) n Indef c) }
};
g = g ;
a = cn.a
a = cn.a ;
isComp = getClit cn.a
} ;
RelCN cn rs = {
s = \\n,sp,c => cn.s ! n ! sp ! c ++ rs.s ! Indic ! agrP3 (agrGender cn.g n) n ;
g = cn.g ;
a = cn.a
a = cn.a ;
isComp = False
} ;
SentCN cn sc = let g = cn.g in {
s = \\n,sp,c => cn.s ! n ! sp ! c ++ sc.s ;
g = g ;
a = cn.a
a = cn.a ;
isComp = False
} ;
AdvCN cn sc = let g = cn.g in {
s = \\n,sp,c => cn.s ! n ! sp ! c ++ sc.s ;
g = g;
a = cn.a
a = cn.a ;
isComp = False
} ;
ApposCN cn np = let g = cn.g in {
s = \\n,sp,c => cn.s ! n ! sp ! c ++ (np.s ! No).comp ;
g = g;
a = cn.a
a = cn.a ;
isComp = False
} ;
};
};

View File

@@ -465,9 +465,8 @@ mkNPspec : Str -> Str -> Str -> Number -> Gender -> NP =
};
a = ag ;
indForm = cineva ;
hasClit = True;
nForm = HasClit ;
isPronoun = False ;
hasRef = True ;
lock_NP = <>
} ;
@@ -482,9 +481,8 @@ mkNPs : Str -> Str -> Number -> Gender -> Bool -> NP =
};
a = ag ;
indForm = cineva ;
hasClit = False;
isPronoun = False ;
hasRef = b ;
nForm = HasRef b ;
lock_NP = <>
};
@@ -501,8 +499,7 @@ mkNPa : Str -> Str -> Str -> Number -> Gender -> Bool -> NP =
comp = om}
};
a = ag;
hasClit = False;
hasRef = b;
nForm = HasRef b;
isPronoun = False ;
indForm = om ;
lock_NP = <>

View File

@@ -3,7 +3,7 @@ concrete RelativeRon of Relative =
flags optimize=all_subs ;
lin
lin
RelCl cl = {
s = \\ag,t,a,p,m => "astfel" ++ "cã" ++
@@ -40,7 +40,10 @@ concrete RelativeRon of Relative =
s = \\a,c => ss ++ p.s ++ rp.s ! a ! p.c ;
a = {g = np.a.g ; n = np.a.n} ;
hasAgr = True;
hasRef = np.hasRef
hasRef = case np.nForm of
{HasRef False => False ;
_ => True
}
} ;
-- Ac => if_then_Str p.isDir (ss ++ p.s ++ rp.s ! a ! p.c) (ss ++ p.s ++ rp.s ! a ! No)

View File

@@ -74,6 +74,10 @@ param
CardOrd = NCard Gender | NOrd Gender;
-- Parameter indicating the presence of clitic doubling / referential form for noun phrases
NForm = HasClit | HasRef Bool ;
-------------------------------------------------
--------------------2 Verbs ---------------------
-------------------------------------------------
@@ -312,8 +316,7 @@ oper
NounPhrase : Type = {s : NCase => {comp : Str ; clit : Clitics => Str} ;
a : Agr ;
indForm : Str ; --needed for prepositions that demand the indefinite form of a NP
hasClit : Bool ; -- needed to indicate if the NP has clitics or not (and is referenced also)
hasRef : Bool ; -- needed to indicate if the NP is referenced or not - for the use of the preposition for Accusative
nForm : NForm ; -- indicates the presence of clitic doubling and referential form
isPronoun : Bool -- in the case of pronouns, just the clitics are used, and not the comp form
} ;
VerbPhrase :Type = {
@@ -532,14 +535,15 @@ oper
-- various :
heavyNP : {s : NCase => Str ; a : Agr; hasClit : Bool; ss : Str} -> NounPhrase = \np -> {
heavyNP : {s : NCase => Str ; a : Agr; hasClit : NForm; ss : Str} -> NounPhrase = \np -> {
s = \\c => {comp = np.s ! c ;
clit = \\cs => if_then_Str np.hasClit ((genCliticsCase np.a c).s ! cs) [] };
clit = \\cs => case np.hasClit of
{HasClit => (genCliticsCase np.a c).s ! cs ;
_ => [] }};
a = np.a ;
indForm = np.ss ;
hasClit = np.hasClit ;
isPronoun = False;
hasRef = np.hasClit
nForm = np.hasClit;
isPronoun = False
} ;
genForms : Str -> Str -> Gender => Str = \bon,bonne ->
@@ -608,3 +612,4 @@ oper
_ => False};
}

View File

@@ -1,3 +1,4 @@
--# -path=.:../abstract:../common:../prelude
concrete SymbolRon of Symbol =
CatRon ** open Prelude, ResRon in {

View File

@@ -30,10 +30,16 @@ concrete VerbRon of Verb =
Slash2V3 v np = let s1 = v.c2.s ++(np.s ! (v.c2.c)).comp ;
ss = if_then_Str np.hasRef (v.c2.prepDir ++ s1) s1;
ss = case np.nForm of
{HasRef False => s1 ;
_ => v.c2.prepDir ++ s1 };
sir = if_then_Str np.isPronoun "" ss ;
vcDa = if_then_else VClit np.hasClit (nextClit v.nrClit PDat) v.nrClit;
vcAc = if_then_else VClit np.hasClit (nextClit v.nrClit PAcc) v.nrClit
vcDa = case np.nForm of
{HasClit => nextClit v.nrClit PDat ;
_ => v.nrClit };
vcAc = case np.nForm of
{HasClit => nextClit v.nrClit PAcc ;
_ => v.nrClit }
in
case v.c2.isDir of
{Dir PAcc => (insertObje (\\_ => sir) (clitFromNoun np Ac) RNoAg (isAgrFSg np.a) vcAc (useVerb v)) ** {needAgr = False ; needClit = True ; c2 = v.c3} ;
@@ -42,10 +48,16 @@ concrete VerbRon of Verb =
};
Slash3V3 v np = let s1 = v.c3.s ++ (np.s ! (v.c3.c)).comp ;
ss = if_then_Str np.hasRef (v.c3.prepDir ++ s1) s1 ;
ss = case np.nForm of
{HasRef False => s1 ;
_ => v.c3.prepDir ++ s1} ;
sir = if_then_Str np.isPronoun "" ss ;
vcDa = if_then_else VClit np.hasClit (nextClit v.nrClit PDat) v.nrClit;
vcAc = if_then_else VClit np.hasClit (nextClit v.nrClit PAcc) v.nrClit
vcDa = case np.nForm of
{HasClit => nextClit v.nrClit PDat ;
_ => v.nrClit };
vcAc = case np.nForm of
{HasClit => nextClit v.nrClit PAcc ;
_ => v.nrClit };
in
case v.c3.isDir of
{Dir PAcc => (insertObje (\\_ => sir) (clitFromNoun np Ac) RNoAg (isAgrFSg np.a) vcAc (useVerb v)) ** {needAgr = False ; needClit = True ; c2 = v.c2} ;
@@ -68,14 +80,24 @@ concrete VerbRon of Verb =
-- more usually the adverbial form is used, hence no agreement
SlashV2A v ap =
(insertSimpObj (\\a => ap.s ! (AF Masc Sg Indef ANomAcc)) (useVerb v))
** {needAgr = False ; needClit = True ; c2 = v.c2} ;
(insertSimpObj (\\a => v.c2.s ++ ap.s ! (AF Masc Sg Indef (convCase v.c2.c)))
(useVerb v)) ** {needAgr = False ; needClit = True ; c2 = v.c2} ;
ComplSlash vp np = let s1 = vp.c2.s ++(np.s ! (vp.c2.c)).comp ;
ss = if_then_Str np.hasRef (vp.c2.prepDir ++ s1) s1 ;
ss = case np.nForm of
{ HasRef False => s1 ;
_ => vp.c2.prepDir ++ s1 };
sir = if_then_Str np.isPronoun "" ss ;
vcDa = if_then_else VClit np.hasClit (nextClit vp.nrClit PDat) vp.nrClit;
vcAc = if_then_else VClit np.hasClit (nextClit vp.nrClit PAcc) vp.nrClit;
vcDa = case np.nForm of
{HasClit => nextClit vp.nrClit PDat ;
_ => vp.nrClit
};
--if_then_else VClit np.hasClit (nextClit vp.nrClit PDat) vp.nrClit;
vcAc = case np.nForm of
{HasClit => nextClit vp.nrClit PAcc ;
_ => vp.nrClit
};
--if_then_else VClit np.hasClit (nextClit vp.nrClit PAcc) vp.nrClit;
vpp = case vp.c2.isDir of
{Dir PAcc => insertObje (\\_ => sir) (clitFromNoun np Ac) RNoAg (isAgrFSg np.a) vcAc vp ;
Dir PDat => insertObje (\\_ => sir) RNoAg (clitFromNoun np Da) False vcDa vp;
@@ -121,19 +143,27 @@ concrete VerbRon of Verb =
insertObjc (\\a => "sã" ++ (flattenSimpleClitics vp.nrClit vp.clAcc vp.clDat (vp.isRefl ! a)) ++ conjVP vp a ++ vp.comp ! a ++ vp.ext ! Pos) ((useVerb v) **{c2=vp.c2; needAgr= vp.needAgr ; needClit = False; lock_VPSlash = <>}) ;
SlashV2VNP v np vp = let s1 = v.c2.s ++(np.s ! (v.c2.c)).comp ;
ss = if_then_Str np.hasRef (v.c2.prepDir ++ s1) s1;
ss = case np.nForm of
{HasRef False => s1 ;
_ => v.c2.prepDir ++ s1 };
sir = if_then_Str np.isPronoun "" ss ;
vcDa = if_then_else VClit np.hasClit (nextClit v.nrClit PDat) v.nrClit;
vcAc = if_then_else VClit np.hasClit (nextClit v.nrClit PAcc) v.nrClit ;
vcDa = case np.nForm of
{HasClit => nextClit v.nrClit PDat;
_ => v.nrClit };
vcAc = case np.nForm of
{HasClit => nextClit v.nrClit PAcc;
_ => v.nrClit };
vvp = vp ** {lock_VP = <>};
vcomp = (getConjComp vvp np.a).s
in
case v.c2.isDir of {
Dir PAcc => insertObje (\\a => sir ++ vcomp ! a) (clitFromNoun np Ac) RNoAg (isAgrFSg np.a) vcAc (useVerb v) ;
Dir PDat => insertObje (\\a => sir ++ vcomp ! a) RNoAg (clitFromNoun np Da) False vcDa (useVerb v) ;
_ => insertSimpObjPre (\\a => ss ++ vcomp ! a) (useVerb v)
}
** {needAgr = vp.needAgr ; needClit = False ;c2 = vp.c2} ;
case v.c2.isDir of
{Dir PAcc => (insertObje (\\a => sir ++ vcomp ! a) (clitFromNoun np Ac) RNoAg (isAgrFSg np.a) vcAc (useVerb v)) ** {needAgr = vp.needAgr ; needClit = False ;c2 = vp.c2} ;
Dir PDat => (insertObje (\\a => sir ++ vcomp ! a) RNoAg (clitFromNoun np Da) False vcDa (useVerb v)) ** {needAgr = vp.needAgr ; needClit = False ; c2 = vp.c2};
_ => (insertSimpObjPre (\\a => ss ++ vcomp ! a) (useVerb v)) ** {needAgr = vp.needAgr ; needClit = False ; c2 = vp.c2}
};
UseComp comp = insertSimpObj comp.s copula ;