extended Extra for Swedish

This commit is contained in:
malin
2011-11-09 19:28:08 +00:00
parent 1ba9ffcff7
commit 413ca48bd5
3 changed files with 325 additions and 26 deletions

View File

@@ -2,19 +2,20 @@ incomplete concrete ExtraScand of ExtraScandAbs = CatScand **
open CommonScand,Coordination,ResScand, ParamX in {
lin
GenNP np = {
s,sp = \\n,_,_,g => np.s ! NPPoss (gennum (ngen2gen g) n) Nom ;
s = \\n,_,_,g => np.s ! NPPoss (gennum (ngen2gen g) n) Nom ;
sp = \\_,_,_,_ => NONEXIST ;
det = DDef Indef
} ;
ComplBareVS v s = insertObj (\\_ => s.s ! Sub) (predV v) ;
StrandRelSlash rp slash = {
s = \\t,a,p,ag =>
s = \\t,a,p,ag,_ =>
rp.s ! ag.g ! ag.n ! RNom ++ slash.s ! t ! a ! p ! Sub ++ slash.c2.s ;
c = NPAcc
} ;
EmptyRelSlash slash = {
s = \\t,a,p,ag =>
s = \\t,a,p,ag,_ =>
slash.s ! t ! a ! p ! Sub ++ slash.c2.s ;
c = NPAcc
} ;
@@ -86,7 +87,7 @@ incomplete concrete ExtraScand of ExtraScandAbs = CatScand **
IAdvAdv adv = {s = hur_IAdv.s ++ adv.s} ;
lincat
Foc = {s : ParamX.Tense => Anteriority => Polarity => Str} ;
Foc = {s : STense => Anteriority => Polarity => Str} ;
lin
FocObj np cls = {
@@ -104,4 +105,5 @@ incomplete concrete ExtraScand of ExtraScandAbs = CatScand **
UseFoc t p foc = {s = t.s ++ p.s ++ foc.s ! t.t ! t.a ! p.p} ;
oper NONEXIST : Str = "#¿@§X?X&%/" ;
}

View File

@@ -1,28 +1,119 @@
concrete ExtraSwe of ExtraSweAbs = ExtraScandSwe ** open CommonScand, ResSwe, ParamX, Prelude in {
--# -path=./gf:.:swedish:prelude:alltenses:abstract:scandinavian:common
concrete ExtraSwe of ExtraSweAbs = ExtraScandSwe - [FocAdv] ,
ParadigmsSwe - [nominative] **
open CommonScand, ResSwe, ParamX, VerbSwe, Prelude, DiffSwe, StructuralSwe, MorphoSwe,
NounSwe, Coordination, AdjectiveSwe, SentenceSwe, RelativeSwe in {
lincat
ReflNP = NP ;
PronAQ = A ; -- 'en sådan'
PronAD = A ; -- 'fler'
AdvFoc = Adv ;
RelVSCl = {s : Agr => RCase => Str};
lin
FocVP vp np = {
s = \\t,a,p =>
let
subj = np.s ! nominative ;
agr = np.a ;
vps = vp.s ! VPFinite t a ;
verb = case <<t,a> : ParamX.Tense * Anteriority> of {
<Pres,Simul> => {fin = "gör" ; inf = vps.inf}
; --# notpresent
<Past,Simul> => {fin = "gjorde" ; inf = vps.inf} ; --# notpresent
_ => vps --# notpresent
} ;
vfin = verb.fin ;
vinf = verb.inf ;
neg = vp.a1 ! p ;
comp = vp.n2 ! agr ++ vp.a2 ++ vp.ext
in
vinf ++ comp ++ vfin ++ subj ++ neg
TFutKommer = {s = []} ** {t = SFutKommer} ; --# notpresent
DetNP_utr = detNP utrum Sg ;
oper detNP : NGender -> Number -> Det -> NP =
\g,num,det -> let
m = True ; ---- is this needed for other than Art?
in lin NP {
s = \\c => det.sp ! m ! g;
a = agrP3 (ngen2gen g) num
} ;
lin
lin
RelVS s rvs = {s = \\o => s.s ! o ++ "," ++ rvs.s ! agrP3 Neutr Sg ! RPrep True} ;
RelSlashVS t p vs np = let vpform = VPFinite t.t t.a ;
cl = PredVP np (predV vs) ;
vilket = IdRP.s ! Neutr ! Sg ! (RPrep True) in
{s = \\ag,rc => t.s ++ p.s ++ vilket ++ cl.s ! t.t ! t.a ! p.p ! Sub } ;
AdvFocVP adv vp = {s = \\vpf => {fin = adv.s ++ (vp.s ! vpf).fin ;
inf = (vp.s ! vpf).inf};
a1 = vp.a1 ; n2 = vp.n2 ; a2 = vp.a2 ; ext = vp.ext ;
en2 = vp.en2 ; ea2 = vp.ea2; eext = vp.eext } ;
PredetAdvF adv = {s = \\_,_ => adv.s ; p = [] ; a = PNoAg} ;
QuantPronAQ x =
let utr = x.s ! AF (APosit (Strong (GSg Utr))) Nom ;
ntr = x.s ! AF (APosit (Strong (GSg Neutr))) Nom ;
pl = x.s ! AF (APosit (Strong GPl)) Nom
in
{s =
table {Sg => \\_,_ => genderForms ("en"++utr)
("ett"++ntr) ;
Pl => \\_,_,_ => pl} ;
sp = table {Sg => \\_,_ => genderForms utr ntr;
Pl => \\_,_,_ => pl};
det = DDef Indef};
CompPronAQ x = CompAP (PositA (lin A x)) ;
DetPronAD x = lin Det {s,sp = \\_,_ => x.s ! AF (APosit (Strong GPl)) Nom ;
n = Pl ; det = DDef Indef} ;
CompPronAD x = CompAP (PositA (lin A x)) ;
ComplVAPronAQ v ap = insertObj (\\a => (PositA ap).s ! agrAdjNP a DIndef) (predV v) ;
ComplVAPronAD v ap = insertObj (\\a => (UseComparA ap).s ! agrAdjNP a DIndef) (predV v) ;
lin
FocVP vp np = {
s = \\t,a,p =>
let
subj = np.s ! CommonScand.nominative ;
agr = np.a ;
vps = vp.s ! VPFinite t a ;
vf = case <<t,a> : STense * Anteriority> of {
<SPres,Simul> => vps.fin;
<SPast,Simul> => vps.fin;
<_ ,Simul> => vps.inf;
<SPres,Anter> => vps.inf;
<SPast,Anter> => vps.inf;
<_ ,Anter> => (vp.s ! VPFinite SPast Anter).inf
};
verb = mkClause subj agr (predV do_V) ;
comp = vp.n2 ! agr ++ vp.a2 ++ vp.ext
in
vf ++ comp ++ (verb.s ! t ! a ! p ! Inv) ++ vp.a1 ! Pos
} ;
oper do_V : V = mkV "göra" "gör" "gör" "gjorde" "gjort" "gjord" ;
lin
FocAP ap np =
{s = \\t,a,p =>
let vp = UseComp ap ;
vps = vp.s ! VPFinite t a;
npAgr = np.a in
vp.n2 ! npAgr ++ vps.fin ++ np.s ! NPNom
++ negation ! p++ vps.inf };
FocVV vv vp np =
{s = \\t,a,p =>
let vps = vp.s ! VPInfinit Simul ;
vvp = UseV vv ;
vvs = vvp.s ! VPFinite t a ;
always = vp.a1 ! Pos ++ vvp.a1 ! Pos ;
already = vp.a2 ++ vvp.a2 in
vps.inf ++ vp.n2 ! np.a ++ vvs.fin ++ np.s ! NPNom
++ vv.c2.s ++ always ++ negation ! p ++ already ++ vvs.inf
};
lin
PrepCN prep cn = {s = prep.s ++ cn.s ! Sg ! DIndef ! Nom } ;
CompoundNomN a b = {
s = \\n,d,c => a.s ! Sg ! Indef ! Nom ++ BIND ++ b.s ! n ! d ! c ;
g = b.g
@@ -38,4 +129,124 @@ lin
g = b.g
} ;
it8utr_Pron = MorphoSwe.regNP "den" "dess" Utr Sg ;
this8denna_Quant =
{s,sp = table {
Sg => \\_,_ => genderForms ["denna"] ["detta"] ;
Pl => \\_,_,_ => ["dessa"]
} ;
det = DDef Indef
}
;
SupCl np vp pol = let sub = np.s ! nominative ;
verb = (vp.s ! VPFinite SPres Anter).inf ;
neg = vp.a1 ! pol.p ++ pol.s ;
compl = vp.n2 ! np.a ++ vp.a2 ++ vp.ext in
{s = \\_ => sub ++ neg ++ verb ++ compl };
PassV2 v2 = predV (depV v2);
PassV2Be v = insertObj
(\\a => v.s ! VI (VPtPret (agrAdjNP a DIndef) Nom))
(predV verbBecome) ;
AdvComp comp adv = {s = \\agr => adv.s ++ comp.s ! agr} ;
PPartAP v2 =
{s = \\aform => v2.s ! VI (VPtPret aform Nom);
isPre = True} ;
ReflCN num cn =
let g = cn.g ;
m = cn.isMod ;
dd = DDef Indef ;
in lin NP {
s = \\c => cn.s ! num.n ! dd ! caseNP c ++ num.s ! g ;
a = agrP3 (ngen2gen g) num.n -- ?
} ;
ReflSlash vp np = let vp_l = lin VPSlash vp ;
np_l = lin NP np ;
obj = vp.n3 ! np.a in
lin VP (insertObjPost (\\a => vp.c2.s ++ reflForm a np.a ++ np.s ! NPNom++obj) vp) ;
oper reflForm : Agr -> Agr -> Str = \aSub,aObj ->
case <aSub.p,aObj.g,aObj.n> of {
<P3,Neutr,Sg> => "sitt" ;
<P3,Utr ,Sg> => "sin" ;
<P3,_ ,Pl> => "sina" ;
_ => reflGenPron aSub.p aSub.n aObj.n aObj.g};
oper reflGenPron : Person -> (subnum,objnum : ParadigmsSwe.Number)
-> NGender -> Str =
\p,subnum,objnum,g -> let pn = getPronoun p subnum
in pn.s ! NPPoss (gennum g objnum) Nom ;
this_NP : Str -> Gender -> Number -> NP =
\denna,g,n -> lin NP {s = table {NPPoss gn c => denna+"s";
_ => denna};
a = agrP3 g n};
getPronoun : Person -> ParadigmsSwe.Number -> Pron =
\p,n -> case <p,n> of {
<P1,Sg> => i_Pron ;
<P2,Sg> => youSg_Pron ;
<P3,Sg> => he_Pron ;
<P1,Pl> => we_Pron ;
<P2,Pl> => youPl_Pron ;
<P3,Pl> => they_Pron } ;
----------------- Predeterminers,Quantifiers,Determiners
lin
bara_AdvFoc = mkAdv "bara" ;
sadana_PronAQ = mkA "sådan" ;
fler_PronAD = mkA "flera" "flera" "flera" "fler" "flest" ;
hela_Predet = {s = \\_,_ => "hela" ; p = [] ; a = PNoAg} ;
samma_Predet = {s = \\_,_ => "samma" ; p = [] ; a = PNoAg} ;
sjaelva_Quant = {s = \\_,_,_,_ => "själva" ;
sp = \\_,_,_,_ => variants {};
det = DDef Def } ;
vardera_Det = {s,sp = \\_,_ => "vardera" ; n = Sg ; det = DDef Indef};
ena_Det = {s = \\_,_ => "ena" ;
sp = \\_ => genderForms ["den ena"] ["det ena"] ;
n = Sg ; det = DDef Def};
baegge_Det = {s,sp = \\_,_ => "bägge" ; n = Pl ; det = DDef Def} ;
baada_Det = {s,sp = \\_,_ => "båda" ; n = Pl ; det = DDef Def} ;
varannan_Det = {s,sp = \\_,_ => "varannan" ; n = Sg ; det = DDef Indef} ;
somliga_Det = {s,sp = \\_,_ => "somliga" ; n = Pl ; det = DDef Indef} ;
dylika_Det = {s,sp = \\_,_ => "dylika" ; n = Pl ; det = DDef Indef} ;
oovriga_Det = {s,sp = \\_,_ => "övriga" ; n = Pl ; det = DDef Indef} ;
samtliga_Det = {s,sp = \\_,_ => "samtliga" ; n = Pl ; det = DDef Indef} ;
aatskilliga_Det = {s,sp = \\_,_ => "åtskilliga" ; n = Pl ; det = DDef Indef} ;
varenda_Det = {s = \\_ => genderForms ["varenda"] ["vartenda"] ;
sp = \\_ => genderForms ["varenda en"] ["vartenda ett"] ;
n = Sg ; det = DDef Indef};
most_Det = {s,sp = \\ismod,_ => let av = case ismod of {True => "av" ; False = ""} in
detForms ["den mesta"] ["det mesta"] ["de flesta"] ;
n = Sg ; det = DDef Indef} ;
noll_Det = {s,sp = \\_,_ => "noll" ; n = Pl ; det = DDef Indef};
}

View File

@@ -1,11 +1,97 @@
--# -path=./gf:.:swedish:prelude:alltenses:abstract:scandinavian:common
-- Structures special for Swedish. These are not implemented in other
-- Scandinavian languages.
abstract ExtraSweAbs = ExtraScandAbs ** {
abstract ExtraSweAbs = ExtraScandAbs -[FocAP] ** {
cat ReflNP ;
PronAD ; -- relational pronouns which can act like adjectives and
-- determiners. 'fler'
PronAQ ; -- relational pronouns which can act like adjectives and
-- quantifiers. 'sådan'
AdvFoc ; -- foucsing adverbs 'bara'. acts as predeterminers, normal
-- adverbs or before finite verb
RelVSCl ;
fun
RelVS : S -> RelVSCl -> S ; -- hon sover, vilket vi vet
RelSlashVS : Temp -> Pol -> VS -> NP -> RelVSCl ; -- vilket vi vet
FocAP : Comp -> NP -> Foc ;
DetNP_utr : Det -> NP ; -- den här
AdvFocVP : AdvFoc -> VP -> VP ; -- (han) bara log
PredetAdvF : AdvFoc -> Predet ; -- bara (barn), inte ens (katten)
DetPronAD : PronAD -> Det ;
QuantPronAQ : PronAQ -> Quant ;
CompPronAQ : PronAQ -> Comp ;
CompPronAD : PronAD -> Comp ;
ComplVAPronAQ : VA -> PronAQ -> VP ; -- de blev sådana
ComplVAPronAD : VA -> PronAD -> VP ; -- de blev fler
CompoundNomN : N -> N -> N ; -- fot+boll
CompoundGenN : N -> N -> N ; -- yrkes+musiker
CompoundAdjN : A -> N -> N ; -- vit+vin
it8utr_Pron : Pron ;
this8denna_Quant : Quant ;
ReflCN : Num -> CN -> ReflNP ;
ReflSlash : VPSlash -> ReflNP -> VP ;
SupCl : NP -> VP -> Pol -> S ; -- när jag sovit
PassV2 : V2 -> VP ; -- äts
PassV2Be : V2 -> VP ; -- bli äten
PPartAP : V2 -> AP ; -- (han är) äten
}
AdvComp : Comp -> Adv -> Comp ; -- jag är redan här
dethaer_NP : NP ;
detdaer_NP : NP ;
dedaer8utr_NP : NP ;
dedaer8neut_NP : NP ;
denhaer_NP : NP ;
dendaer_NP : NP ;
----------------- Predeterminers,Quantifiers,Determiners
bara_AdvFoc : AdvFoc ;
sadana_PronAQ : PronAQ ;
fler_PronAD : PronAD ;
-- overgenerating: alla hela katter. should not be ok.
-- predets should be able to decide definites?
hela_Predet : Predet ; --hela horder/hela katten -- both
sjaelva_Quant : Quant ; -- själva kungen/själva öronen -- def
samma_Predet : Predet ; -- samma katter/samma öra
varenda_Det : Det ;
vardera_Det : Det ;
ena_Det : Det ;
baegge_Det : Det ;
baada_Det : Det ;
varannan_Det : Det ;
somliga_Det : Det ;
dylika_Det : Det ;
oovriga_Det : Det ;
aatskilliga_Det : Det ;
samtliga_Det : Det ;
noll_Det : Det ;
}