Anna Ehrlemark's additional work on Slv

This commit is contained in:
aarne
2016-11-11 07:45:16 +00:00
parent 467153c737
commit 67c72c0c82
11 changed files with 172 additions and 41 deletions

View File

@@ -5,6 +5,7 @@ concrete AdjectiveSlv of Adjective = CatSlv ** open ResSlv in {
s = \\spec,g,c,n =>
case <spec,g,n,c> of {
<Def,AMasc _, Sg,Nom> => a.s ! APositDefNom ;
<Def,AMasc _, Sg,Acc> => a.s ! APositDefNom ;
<_,AMasc Animate,Sg,Acc> => a.s ! APosit Masc Sg Gen ;
_ => a.s ! APosit (agender2gender g) n c
}
@@ -12,7 +13,8 @@ concrete AdjectiveSlv of Adjective = CatSlv ** open ResSlv in {
UseComparA a = {
s = \\spec,g,c,n =>
case <spec,g,n,c> of {
<Def,AMasc _,Sg,Acc> => a.s ! AComparDefAcc ;
<Def,AMasc _,Sg,Nom> => a.s ! AComparDefNom ;
<Def,AMasc _,Sg,Acc> => a.s ! AComparDefNom ;
_ => a.s ! ACompar (agender2gender g) n c
}
} ;

View File

@@ -37,11 +37,12 @@ lincat
Prep = {s : Str; c : Case} ;
-- Open lexical classes, e.g. Lexicon
V = {s : VForm => Str ; p : Str}; ----AR: +p particle
VS = {s : VForm => Str ; p : Str};
V = {s : VForm => Str ; p : Str ; refl : Str}; ----AR: +p particle
VS = {s : VForm => Str ; p : Str ; refl : Str};
VQ = {s : VForm => Str};
VV = {s : VForm => Str};
V2 = {s : VForm => Str; c2 : Prep ; p : Str}; ----AR: +p particle
V2 = {s : VForm => Str; c2 : Prep ; p : Str ; refl : Str}; ----AR: +p particle
V3 = {s : VForm => Str; c2 : Prep ; c3 : Prep ; p : Str ; refl : Str};
A = {s : AForm => Str};

View File

@@ -39,6 +39,8 @@ lin
weekdayNextAdv w = {s = "naslednjo" ++ w.s ! Acc ! Sg} ; ----AR
weekdayLastAdv w = {s = "prejšnjo" ++ w.s ! Acc ! Sg} ; ----AR
monthAdv w = {s = "w" ++ w.s ! Loc ! Sg} ; ----AR
monthAdv w = {s = "v" ++ w.s ! Loc ! Sg} ; ----AR
--hungry_VP = UseComp (mkComp "lačen") ; --AE
}

View File

@@ -7,7 +7,11 @@ concrete IdiomSlv of Idiom = CatSlv **
mkClause [] np.a False {
s = \\p,vform => ne ! p ++ (mkV "obstajati" "obstaja").s ! vform ;
s2 = \\a => np.s ! Nom ;
isCop = False
isCop = False ;
refl = []
} ;
}
----AR END

View File

@@ -35,6 +35,6 @@ lin
tree_N = mkN "drevo" "drevesa" neuter ;
walk_V = mkV "hoditi" "hodi" ;
woman_N = mkN "ženska" ;
write_V2 = mkV2 (mkV "pisati" "piše" "pisal") ;
write_V2 = mkV2 (mkV "pisati" "piše" "pisal");
} ;

View File

@@ -47,6 +47,7 @@ concrete NounSlv of Noun = CatSlv ** open ResSlv,Prelude in {
} ;
NumSg = {s = \\_,_ => []; n = UseNum Sg} ;
NumDl = {s = \\_,_ => []; n = UseNum Dl} ; --not working?
NumPl = {s = \\_,_ => []; n = UseNum Pl} ;
NumCard n = n ;

View File

@@ -16,6 +16,13 @@ oper
feminine = AFem;
neuter = ANeut;
singular : Number = Sg ;
dual : Number = Dl ;
plural : Number = Pl ;
definite : Species = Def ;
indefinite : Species = Indef ;
mkN = overload {
mkN : (noun : Str) -> N = smartN ;
mkN : (noun : Str) -> AGender -> N = regNouns ;
@@ -56,6 +63,12 @@ oper
(punc + "e") punc (punc + "am") (punc + "e") (punc + "am") (punc + "ami") -- Plural
feminine ;
iFem : (_ : Str) -> N = \stran ->
worstN stran (stran + "i") (stran + "i") stran (stran + "i") (stran + "jo") -- Singular
(stran + "i") (stran + "i") (stran + "ema") (stran + "i") (stran + "eh") (stran + "ema") -- Dual
(stran + "i") (stran + "i") (stran + "em") (stran + "i") (stran + "eh") (stran + "mi") -- Plural
feminine ;
--This is a smart paradigm for regular nouns.
smartN : (noun: Str) -> N =
@@ -117,6 +130,10 @@ oper
s = \\c => noun.s ! c ! Sg ;
g = noun.g
};
mkPN : N -> Number -> PN = \noun,nr -> lin PN {
s = \\c => noun.s ! c ! nr ;
g = noun.g
};
mkPN : (_,_,_,_,_,_ : Str) -> AGender -> PN =
\nom,gen,dat,acc,loc,instr,g -> lin PN {
s = table {
@@ -135,9 +152,12 @@ oper
mkV : (inf,stem : Str) -> V = regV ;
mkV : (inf,stem,lstem : Str) -> V = irregVa ;
mkV : (inf,stem,lstem,imp : Str) -> V = irregVb ;
mkV : (inf,stem,lstem,femstem,imp : Str) -> V = irregVc ;
mkV : (x1,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,x25 : Str) -> V = worstV ;
} ;
mkReflV : V -> Case -> V = \v,c -> v ** {refl = reflexive ! c} ;
particleV : V -> Str -> V = \v,p -> v ** {p = p} ;
-- Regular verbs are formed from two forms. Infinitive and 3rd person singular presens.
@@ -167,6 +187,14 @@ oper
in
mkAllV gledati gleda gledal lfem glej;
--This one was added as a workaround the special case of "videti" where the feminine stem is equal to the masculine lform.
irregVc : (_,_,_,_,_ : Str) -> V = \videti,vidi,videl,videla,vidimp ->
let
femvidel = init videla
in
mkAllV videti vidi videl femvidel vidimp;
--The final paradigm-generator for all verbforms. Takes the infinitive,thirdpersonsingular in present tense,
--masculine l-form, feminine l-form and the imperative base form.
@@ -213,6 +241,7 @@ oper
VImper2 Pl => imp2pl
} ;
p = [] ; ----AR: +p
refl = [] ;
};
--Imperative forms are formed separetely. Pattern matching performed on thirdpersonsingular verbform.
@@ -232,6 +261,14 @@ oper
mkV2 : V -> Prep -> V2 = \v,p -> lin V2 (v ** {c2 = p}) ;
} ;
mkV3 = overload {
mkV3 : V -> V3 = \v -> lin V2 (v ** {c2 = lin Prep {s=""; c=Acc}; c3 = lin Prep {s=""; c=Acc}}) ;
mkV3 : V -> Case -> Case -> V3 = \v,c2,c3 -> lin V2 (v ** {c2 = lin Prep {s=""; c=c2}; c3 = lin Prep {s=""; c=c3}}) ;
mkV3 : V -> Case -> Prep -> V3 = \v,c2,p3 -> lin V2 (v ** {c2 = lin Prep {s=""; c=c2}; c3 = p3}) ;
mkV3 : V -> Prep -> Case -> V3 = \v,p2,c3 -> lin V2 (v ** {c2 = p2 ; c3 = lin Prep {s=""; c=c3}}) ;
mkV3 : V -> Prep -> Prep -> V3 = \v,p2,p3 -> lin V2 (v ** {c2 = p2 ; c3 = p3}) ;
} ;
mkVS : V -> VS ;
mkVS v = lin VS v ;
@@ -244,7 +281,7 @@ oper
-- Adjectives
mkA = overload {
mkA : (_,_:Str) -> A = regA ;
mkA : (_,_:Str) -> A = regA ;
mkA : (x1,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,x166 : Str) -> A = worstA ;
} ;
@@ -257,8 +294,8 @@ oper
APositDefNom => mkAdjForm star ! Nom ! Masc ! Pl ;
APositIndefAcc => mkAdjForm star ! Nom ! Masc ! Sg ;
APositDefAcc => mkAdjForm star ! Nom ! Masc ! Pl ;
AComparDefAcc => mkAdjForm starejs ! Nom ! Masc ! Sg ;
ASuperlDefAcc => mkAdjForm ("naj" + starejs) ! Nom ! Masc ! Sg
AComparDefNom => mkAdjForm starejs ! Nom ! Masc ! Pl ;
ASuperlDefNom => mkAdjForm ("naj" + starejs) ! Nom ! Masc ! Pl
}
} ;
@@ -506,6 +543,19 @@ oper
mkAdA : Str -> AdA = \s -> lin AdA {s=s} ;
regPron: (x1,_,_,_,_,_,x7:Str) -> Gender -> Number -> Person -> Pron = \nom,acc,gen,dat,loc,inst,poss,g,n,p -> lin Pron {
s = table { Nom => nom;
Acc => acc;
Gen => gen;
Dat => dat;
Loc => loc;
Instr=>inst
} ;
poss = \\g,c,nr => mkAdjForm poss ! c ! g ! nr ;
a = {g=g; n=n; p=p}
};
mkPron : (_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_ : Str) -> Gender -> Number -> Person -> Pron =
\nom,acc,gen,dat,loc,instr,
mSgNom,mSgGen,mSgDat,mSgAcc,mSgLoc,mSgInstr,
@@ -586,6 +636,14 @@ oper
spec = spec
};
adjDet : Str -> Number -> Species -> Det =
\en,nr,sp -> lin Det {
s = \\g,c => mkAdjForm en ! c ! g ! nr ;
spec = sp ;
n = (UseNum nr)
} ;
mkNP : (_,_,_,_,_,_ : Str) -> Gender -> Number -> NP =
\nom,acc,gen,dat,loc,instr,g,n ->
lin NP {s = table {
@@ -606,14 +664,29 @@ oper
mkConj : Str -> Number -> Conj =
\s,n -> lin Conj {s=s; n=n} ;
-- Comp = {s : Agr => Str} ;
mkComp : Str -> Comp =
\str -> lin Comp {
s = \\agr => mkAdjForm str ! Nom ! agr.g ! agr.n
} ;
--Helper function that drops the loose vowel that has to go in many conjugations.
looseVowel : (_:Str) -> Str = \vowel ->
case vowel of {
_ + "sak" => vowel ;
_ + "er" => Predef.tk 2 vowel + "r" ;
_ + "an" => Predef.tk 2 vowel + "n" ;
--_ + "en" => Predef.tk 2 vowel + "n" ; --this is wrong, right?
_ + "čan" => Predef.tk 2 vowel + "n" ;
_ + "ten" => Predef.tk 2 vowel + "n" ;
--_ + "len" => Predef.tk 2 vowel + "n" ;
--_ + "čen" => Predef.tk 2 vowel + "n" ;
--_ + "zen" => Predef.tk 2 vowel + "n" ;
--_ + "ven" => Predef.tk 2 vowel + "n" ;
--_ + "den" => Predef.tk 2 vowel + "n" ;
--_ + "šen" => Predef.tk 2 vowel + "n" ;
_ + "en" => Predef.tk 2 vowel + "n" ; --not yet tested for overgeneration
--_ + "ec" => Predef.tk 2 vowel + "c" ; --not yet tested for overgeneration
_ + "el" => Predef.tk 2 vowel + "l" ;
_ + "ek" => Predef.tk 2 vowel + "k" ;
_ + "ak" => Predef.tk 2 vowel + "k" ;
@@ -622,5 +695,5 @@ oper
} ;
vowel : pattern Str = #("a"|"e"|"i"|"o"|"u") ;
consonant : pattern Str = #("b"|"d"|"g"|"m"|"n"|"p"|"t") ;
consonant : pattern Str = #("b"|"c"|"d"|"f"|"g"|"h"|"j"|"k"|"l"|"m"|"n"|"p"|"r"|"s"|"t"|"v"|"x"|"z") ;
}

View File

@@ -6,7 +6,7 @@ lin
QuestCl cl = {s = \\t,a,p => "ali" ++ cl.s ! t ! a ! p} ;
QuestSlash ip cls = {s = \\t,a,p => cls.c2.s ++ ip.s ! cls.c2.c ++ cls.s ! t ! a ! p} ;
QuestIAdv iadv cl = {s = \\t,a,p => iadv.s ++ cl.s ! t ! a ! p} ;
QuestIComp icomp np = mkClause icomp.s np.a np.isPron {s = copula ; s2 = \\_ => [] ; isCop = True} ;
QuestIComp icomp np = mkClause icomp.s np.a np.isPron {s = copula ; s2 = \\_ => [] ; isCop = True ; refl = []} ;
CompIAdv a = a ;
CompIP p = ss (p.s ! Nom) ;

View File

@@ -28,12 +28,16 @@ param
| APositDefNom
| APositIndefAcc
| APositDefAcc
| AComparDefAcc
| ASuperlDefAcc ;
| AComparDefNom
| ASuperlDefNom ;
oper
Agr = {g : Gender; n : Number; p : Person} ;
Conj = {s : Str; n : Number} ;
mkConj : Str -> Number -> Conj = \str,nr -> { s = str ; n = nr } ;
conjNumber : Number -> Number -> Number = \m,n ->
case m of {
Sg => n ;
@@ -46,7 +50,7 @@ oper
p = b.p
} ;
VP = {s : Polarity => VForm => Str; s2 : Agr => Str; isCop : Bool} ;
VP = {s : Polarity => VForm => Str; s2 : Agr => Str; isCop : Bool ; refl : Str} ;
ne : Polarity => Str =
table {Pos => "" ;
@@ -58,37 +62,40 @@ oper
Neg => "ni"
} ;
predV : Bool -> Bool -> (Polarity => VForm => Str) -> Tense => Polarity => Agr => Str =
\ispron,iscop,v -> table {
Pres => \\p,a => v ! p ! VPres a.n a.p ;
--Added the position of the reflexive particle. Needs testing.
predV : Bool -> Bool -> Str -> (Polarity => VForm => Str) -> Tense => Polarity => Agr => Str =
\ispron,iscop,refl,v -> table {
Pres => \\p,a => v ! p ! VPres a.n a.p ++ refl ;
Past => \\p,a => case <ispron,p> of {
<True,Pos> => v ! Pos ! VPastPart a.g a.n ++ copula ! p ! VPres a.n a.p ;
<_ ,_ > => copula ! p ! VPres a.n a.p ++ v ! Pos ! VPastPart a.g a.n } ;
<True,Pos> => v ! Pos ! VPastPart a.g a.n ++ refl ++ copula ! p ! VPres a.n a.p ;
<_ ,_ > => copula ! p ! VPres a.n a.p ++ refl ++ v ! Pos ! VPastPart a.g a.n } ;
Fut => \\p,a => case <ispron,p> of {
<True,Pos> => case iscop of {
False => v ! Pos ! VPastPart a.g a.n ++ bom_V ! a.n ! a.p ;
False => v ! Pos ! VPastPart a.g a.n ++ refl ++ bom_V ! a.n ! a.p ;
True => bom_V ! a.n ! a.p
} ;
<_ ,_ > => case iscop of {
False => ne ! p ++ bom_V ! a.n ! a.p ++ v ! Pos ! VPastPart a.g a.n ;
False => refl ++ ne ! p ++ bom_V ! a.n ! a.p ++ v ! Pos ! VPastPart a.g a.n ;
True => ne ! p ++ bom_V ! a.n ! a.p
} } ;
Cond => \\p,a => ne ! p ++ "bi" ++ v ! Pos ! VPastPart a.g a.n
Cond => \\p,a => ne ! p ++ "bi" ++ refl ++ v ! Pos ! VPastPart a.g a.n
} ;
copula : Polarity => VForm => Str = \\p =>
table {
VInf => ne ! p ++ "biti";
VSup => ne ! p ++ "bit";
VPastPart Masc Sg => ne ! p ++ "bil";
VPastPart Masc Dl => ne ! p ++ "bila";
VPastPart Masc Pl => ne ! p ++ "bili";
VPastPart Fem Sg => ne ! p ++ "bila";
VPastPart Fem Dl => ne ! p ++ "bili";
VPastPart Fem Pl => ne ! p ++ "bile";
VPastPart Neut Sg => ne ! p ++ "bilo";
VPastPart Neut Dl => ne ! p ++ "bili";
VPastPart Neut Pl => ne ! p ++ "bila";
VPastPart Masc Sg => ni ! p ++ "bil";
VPastPart Masc Dl => ni ! p ++ "bila";
VPastPart Masc Pl => ni ! p ++ "bili";
VPastPart Fem Sg => ni ! p ++ "bila";
VPastPart Fem Dl => ni ! p ++ "bili";
VPastPart Fem Pl => ni ! p ++ "bile";
VPastPart Neut Sg => ni ! p ++ "bilo";
VPastPart Neut Dl => ni ! p ++ "bili";
VPastPart Neut Pl => ni ! p ++ "bila";
VPres Sg P1 => ni ! p + "sem";
VPres Sg P2 => ni ! p + "si";
VPres Sg P3 => case p of {Pos=>"je"; Neg=>"ni"};
@@ -124,18 +131,30 @@ oper
}
} ;
reflexive : Case => Str =
table {
(Acc | Gen) => "se" ;
(Loc | Dat) => "si" ;
Instr => "sabo" ;
_ => "wrong" --we should never get here
} ;
Clause : Type = {
s : Tense => Anteriority => Polarity => Str
} ;
-- Ändra här så att vi kan fixa in det reflexiva pronomenet. Ändra även så att vi har en V2Slash med ett särskilt fält för reflexiv?
mkClause : Str -> Agr -> Bool -> VP -> Clause =
\subj,agr,ispron,vp -> {
s = \\t,a,p =>
case ispron of {
False => subj ++ predV ispron vp.isCop vp.s ! t ! p ! agr ++ vp.s2 ! agr ;
False => subj ++ predV ispron vp.isCop vp.refl vp.s ! t ! p ! agr ++ vp.s2 ! agr ;
True => case vp.isCop of {
False => predV ispron vp.isCop vp.s ! t ! p ! agr ++ vp.s2 ! agr ;
True => vp.s2 ! agr ++ predV ispron vp.isCop vp.s ! t ! p ! agr
False => predV ispron vp.isCop vp.refl vp.s ! t ! p ! agr ++ vp.s2 ! agr ;
True => vp.s2 ! agr ++ predV ispron vp.isCop vp.refl vp.s ! t ! p ! agr
}
}
} ;

View File

@@ -3,7 +3,7 @@ concrete StructuralSlv of Structural = CatSlv ** open ResSlv, ParadigmsSlv, Prel
lin
although_Subj = {s="čeprav"} ;
and_Conj = mkConj "in" Pl ;
because_Subj = {s="zato ket"} ;
because_Subj = {s="zato ker"} ;
can_VV = {s = \\vform => case vform of {_ => "lahko"} };
have_V2 = mkV2 (mkV "iméti" "imá") ; ----AR

View File

@@ -4,23 +4,52 @@ concrete VerbSlv of Verb = CatSlv ** open ResSlv, ParamX, Prelude in {
UseV v =
{ s = \\p,vform => ne ! p ++ v.s ! vform ;
s2 = \\a => v.p ; ----AR: +p particle
isCop = False
isCop = False ;
refl = v.refl
} ;
SlashV2a v =
{ s = \\p,vform => ne ! p ++ v.s ! vform ;
s2 = \\a => v.p ; ----AR: +p particle
c2 = v.c2 ;
isCop = False
isCop = False ;
refl = v.refl
} ;
--Check these V3-slashes AE
Slash2V3 v np =
{ s = \\p,vform => ne ! p ++ v.s ! vform ;
s2 = \\_ => v.p ++ v.c2.s ++ np.s ! v.c2.c ;
c2 = v.c3 ;
isCop = False ;
refl = v.refl
} ;
Slash3V3 v np =
{ s = \\p,vform => ne ! p ++ v.s ! vform ;
s2 = \\_ => v.p ++ v.c3.s ++ np.s ! v.c3.c ;
c2 = v.c2 ;
isCop = False ;
refl = v.refl
} ;
ComplSlash vp np =
insertObj (\\_ => vp.c2.s ++ np.s ! vp.c2.c) vp;
ReflVP vp = {
s = \\vform => vp.s ! vform ; --? the compiler told me to cut the polarity from this function?
--s = \\p,vform => ne ! p ++ vp.s ! vform ;
s2 = \\a => vp.s2 ! a ;
isCop = False ;
refl = reflexive ! vp.c2.c
} ;
UseComp comp = {
s = copula ;
s2 = comp.s ;
isCop = True
isCop = True ;
refl = []
} ;
AdvVP vp adv = insertObj (\\_ => adv.s) vp ;