(Fin) Fix order of postmodifiers and possessive suffixes

"lasinsa viiniä", not "lasi viiniänsa"
This commit is contained in:
Inari Listenmaa
2020-08-23 11:03:15 +02:00
parent eb6244bc85
commit 32606cfa59
4 changed files with 67 additions and 37 deletions

View File

@@ -48,7 +48,7 @@ concrete CatFin of Cat = CommonX ** open ResFin, StemFin, Prelude in {
-- The $Bool$ tells if a possessive suffix is attached, which affects the case.
CN = {s : NForm => Str ; h : Harmony} ;
CN = {s : NForm => Str ; h : Harmony ; postmod : Number => Str} ;
Pron = {s : NPForm => Str ; a : Agr ; hasPoss : Bool ; poss : Str} ;
NP = {s : NPForm => Str ; a : Agr ; isPron : Bool ; isNeg : Bool} ;
DAP, Det = {

View File

@@ -1,5 +1,5 @@
concrete ConjunctionFin of Conjunction =
CatFin ** open ResFin, Coordination, Prelude in {
concrete ConjunctionFin of Conjunction =
CatFin ** open ResFin, Coordination, Prelude, (N=NounFin) in {
flags optimize=all_subs ;
@@ -24,7 +24,7 @@ concrete ConjunctionFin of Conjunction =
ConjCN conj ss =
let s = (conjunctDistrTable NForm conj ss).s
in {s = s ; h = Back } ; ---- harmony?
in {s = s ; h = Back ; postmod = \\_ => []} ; ---- harmony?
-- These fun's are generated from the list cat's.
@@ -40,8 +40,15 @@ concrete ConjunctionFin of Conjunction =
ConsAP xs x = consrTable2 Bool NForm comma xs x ;
BaseRS x y = twoTable Agr x y ** {c = y.c} ;
ConsRS xs x = consrTable Agr comma xs x ** {c = xs.c} ;
BaseCN x y = twoTable NForm x y ;
ConsCN xs x = consrTable NForm comma xs x ;
BaseCN x y = twoTable NForm (mergeCN x) (mergeCN y) ; -- put postmod in s field
ConsCN x xs = consrTable NForm comma (mergeCN x) xs;
oper
LinCN : Type = {s : NForm => Str ; h : Harmony ; postmod : Number => Str} ;
-- RS, SC and Adv are in separate fields, to prevent "lasi viiniänsa" for "lasinsa viiniä".
-- But for coordination, we just give up and attach the postmod.
-- Really, if you want to have "lasinsa viiniä ja kuppinsa teetä", just use ConjNP instead.
mergeCN : LinCN -> LinCN = \cn -> cn ** {
s = \\nf => cn.s ! nf ++ cn.postmod ! N.numN nf } ;
lincat
[S] = {s1,s2 : Str} ;

View File

@@ -20,8 +20,11 @@ concrete ExtraFin of ExtraFinAbs = CatFin **
GenIP ip = {s = \\_,_ => ip.s ! NPCase Gen} ;
GenCN n1 n2 = {s = \\nf => n1.s ! NPCase Gen ++ n2.s ! nf ;
h = n2.h } ;
GenCN n1 n2 = {
s = \\nf => n1.s ! NPCase Gen ++ n2.s ! nf ;
postmod = \\_ => [] ;
h = n2.h
} ;
GenRP num cn = {
s = \\n,c => let k = npform2case num.n c in relPron ! n ! Gen ++ cn.s ! NCase num.n k ;
@@ -287,9 +290,10 @@ concrete ExtraFin of ExtraFinAbs = CatFin **
AdjAsCN ap = {
s = \\nf => ap.s ! True ! (n2nform nf) ;
h = Back ; ---- TODO should be ap.h, which does not exist
} ;
s = \\nf => ap.s ! True ! (n2nform nf) ;
postmod = \\_ => [] ;
h = Back ; ---- TODO should be ap.h, which does not exist
} ;
lincat
RNP = {s : Agr => NPForm => Str ; isPron : Bool} ;

View File

@@ -29,11 +29,14 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, StemFin, Prelude in
_ => <k, NCase n k> -- kytkin, kytkimen,...
}
in {
s = \\c => let
k = ncase c ;
in
det.s1 ! k.p1 ++ cn.s ! k.p2 ++ det.s2 ! cn.h ;
a = agrP3 (case <det.isDef, det.isNum> of {
s = \\c => let
k = ncase c ;
in
det.s1 ! k.p1 ++ -- minun
cn.s ! k.p2 ++ -- kytkime
det.s2 ! cn.h ++ -- ni
cn.postmod ! numN k.p2 ; -- jonka/jotka myin
a = agrP3 (case <det.isDef, det.isNum> of {
<False,True> => Sg ; -- kolme kytkintä on
_ => det.n
}) ;
@@ -179,14 +182,16 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, StemFin, Prelude in
ncase : Case -> NForm = \c -> NCase n c ;
in {
s = \\c => let k = npform2case n c in
cn.s ! ncase k ;
cn.s ! ncase k ++ cn.postmod ! n ;
a = agrP3 Sg ;
isPron = False ; isNeg = False
} ;
UseN n = snoun2nounSep n ;
UseN n = snoun2nounSep n ** {
postmod = \\_ => []
} ;
UseN2 n = snoun2nounSep n ;
UseN2 = UseN ;
Use2N3 f = {
s = f.s ;
@@ -201,12 +206,21 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, StemFin, Prelude in
isPre = f.isPre2
} ;
ComplN2 f x = {
s = \\nf =>
case f.isPre of {
True => (snoun2nounSep f).s ! nf ;
False => compl ++ (snoun2nounSep f).s ! nf } ;
postmod = case f.isPre of {
True => \\_ => compl ;
False => \\_ => []
} ;
h = f.h }
where {compl : Str = appCompl True Pos f.c2 x} ;
--- If a possessive suffix is added here it goes after the complements...
ComplN2 f x = {
s = \\nf => preOrPost f.isPre ((snoun2nounSep f).s ! nf) (appCompl True Pos f.c2 x) ;
h = f.h } ;
ComplN3 f x = {
s = \\nf => preOrPost f.isPre (f.s ! nf) (appCompl True Pos f.c2 x) ;
c2 = f.c3 ;
@@ -214,14 +228,15 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, StemFin, Prelude in
isPre = f.isPre2
} ;
AdjCN ap cn = {
AdjCN ap cn = cn ** {
s = case ap.hasPrefix of {
True => \\nf => ap.p ++ BIND ++ cn.s ! nf ;
False => \\nf => ap.s ! True ! (n2nform nf) ++ cn.s ! nf } ;
h = cn.h } ;
RelCN cn rs = {s = \\nf => cn.s ! nf ++ BIND ++ "," ++ rs.s ! agrP3 (numN nf) ;
h = cn.h } ;
RelCN cn rs = cn ** {
postmod = \\num => cn.postmod ! num ++ BIND ++ "," ++ rs.s ! agrP3 num ;
} ;
RelNP np rs = {
s = \\c => np.s ! c ++ BIND ++ "," ++ rs.s ! np.a ;
@@ -230,22 +245,26 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, StemFin, Prelude in
isNeg = np.isNeg
} ;
AdvCN cn ad = {s = \\nf => cn.s ! nf ++ ad.s ;
h = cn.h} ;
AdvCN cn ad = cn ** {
postmod = \\num => cn.postmod ! num ++ ad.s ;
} ;
SentCN cn sc = {s = \\nf=> cn.s ! nf ++ sc.s;
h = cn.h } ;
SentCN cn sc = cn **{
postmod = \\num => cn.postmod ! num ++ sc.s ;
} ;
ApposCN cn np = {s = \\nf=> cn.s ! nf ++ np.s ! NPSep ;
h = cn.h } ; --- luvun x
ApposCN cn np = cn ** { -- luvun x
postmod = \\num => cn.postmod ! num ++ np.s ! NPSep ;
} ;
PossNP cn np = {s = \\nf => np.s ! NPCase Gen ++ cn.s ! nf ;
h = cn.h
} ;
PossNP cn np = cn ** {
s = \\nf => np.s ! NPCase Gen ++ cn.s ! nf ;
h = cn.h
} ;
PartNP cn np = {s = \\nf => cn.s ! nf ++ np.s ! NPCase Part ;
h = cn.h ---- gives "lasin viiniänsa" ; should be "lasinsa viiniä"
} ;
PartNP cn np = cn ** {
postmod = \\num => np.s ! NPCase Part ++ cn.postmod ! num ;
} ;
CountNP det np =