(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. -- 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} ; Pron = {s : NPForm => Str ; a : Agr ; hasPoss : Bool ; poss : Str} ;
NP = {s : NPForm => Str ; a : Agr ; isPron : Bool ; isNeg : Bool} ; NP = {s : NPForm => Str ; a : Agr ; isPron : Bool ; isNeg : Bool} ;
DAP, Det = { DAP, Det = {

View File

@@ -1,5 +1,5 @@
concrete ConjunctionFin of Conjunction = concrete ConjunctionFin of Conjunction =
CatFin ** open ResFin, Coordination, Prelude in { CatFin ** open ResFin, Coordination, Prelude, (N=NounFin) in {
flags optimize=all_subs ; flags optimize=all_subs ;
@@ -24,7 +24,7 @@ concrete ConjunctionFin of Conjunction =
ConjCN conj ss = ConjCN conj ss =
let s = (conjunctDistrTable NForm conj ss).s 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. -- 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 ; ConsAP xs x = consrTable2 Bool NForm comma xs x ;
BaseRS x y = twoTable Agr x y ** {c = y.c} ; BaseRS x y = twoTable Agr x y ** {c = y.c} ;
ConsRS xs x = consrTable Agr comma xs x ** {c = xs.c} ; ConsRS xs x = consrTable Agr comma xs x ** {c = xs.c} ;
BaseCN x y = twoTable NForm x y ; BaseCN x y = twoTable NForm (mergeCN x) (mergeCN y) ; -- put postmod in s field
ConsCN xs x = consrTable NForm comma xs x ; 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 lincat
[S] = {s1,s2 : Str} ; [S] = {s1,s2 : Str} ;

View File

@@ -20,8 +20,11 @@ concrete ExtraFin of ExtraFinAbs = CatFin **
GenIP ip = {s = \\_,_ => ip.s ! NPCase Gen} ; GenIP ip = {s = \\_,_ => ip.s ! NPCase Gen} ;
GenCN n1 n2 = {s = \\nf => n1.s ! NPCase Gen ++ n2.s ! nf ; GenCN n1 n2 = {
h = n2.h } ; s = \\nf => n1.s ! NPCase Gen ++ n2.s ! nf ;
postmod = \\_ => [] ;
h = n2.h
} ;
GenRP num cn = { GenRP num cn = {
s = \\n,c => let k = npform2case num.n c in relPron ! n ! Gen ++ cn.s ! NCase num.n k ; 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 = { AdjAsCN ap = {
s = \\nf => ap.s ! True ! (n2nform nf) ; s = \\nf => ap.s ! True ! (n2nform nf) ;
h = Back ; ---- TODO should be ap.h, which does not exist postmod = \\_ => [] ;
} ; h = Back ; ---- TODO should be ap.h, which does not exist
} ;
lincat lincat
RNP = {s : Agr => NPForm => Str ; isPron : Bool} ; 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,... _ => <k, NCase n k> -- kytkin, kytkimen,...
} }
in { in {
s = \\c => let s = \\c => let
k = ncase c ; k = ncase c ;
in in
det.s1 ! k.p1 ++ cn.s ! k.p2 ++ det.s2 ! cn.h ; det.s1 ! k.p1 ++ -- minun
a = agrP3 (case <det.isDef, det.isNum> of { 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 <False,True> => Sg ; -- kolme kytkintä on
_ => det.n _ => det.n
}) ; }) ;
@@ -179,14 +182,16 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, StemFin, Prelude in
ncase : Case -> NForm = \c -> NCase n c ; ncase : Case -> NForm = \c -> NCase n c ;
in { in {
s = \\c => let k = npform2case 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 ; a = agrP3 Sg ;
isPron = False ; isNeg = False isPron = False ; isNeg = False
} ; } ;
UseN n = snoun2nounSep n ; UseN n = snoun2nounSep n ** {
postmod = \\_ => []
} ;
UseN2 n = snoun2nounSep n ; UseN2 = UseN ;
Use2N3 f = { Use2N3 f = {
s = f.s ; s = f.s ;
@@ -201,12 +206,21 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, StemFin, Prelude in
isPre = f.isPre2 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... --- 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 = { ComplN3 f x = {
s = \\nf => preOrPost f.isPre (f.s ! nf) (appCompl True Pos f.c2 x) ; s = \\nf => preOrPost f.isPre (f.s ! nf) (appCompl True Pos f.c2 x) ;
c2 = f.c3 ; c2 = f.c3 ;
@@ -214,14 +228,15 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, StemFin, Prelude in
isPre = f.isPre2 isPre = f.isPre2
} ; } ;
AdjCN ap cn = { AdjCN ap cn = cn ** {
s = case ap.hasPrefix of { s = case ap.hasPrefix of {
True => \\nf => ap.p ++ BIND ++ cn.s ! nf ; True => \\nf => ap.p ++ BIND ++ cn.s ! nf ;
False => \\nf => ap.s ! True ! (n2nform nf) ++ cn.s ! nf } ; False => \\nf => ap.s ! True ! (n2nform nf) ++ cn.s ! nf } ;
h = cn.h } ; h = cn.h } ;
RelCN cn rs = {s = \\nf => cn.s ! nf ++ BIND ++ "," ++ rs.s ! agrP3 (numN nf) ; RelCN cn rs = cn ** {
h = cn.h } ; postmod = \\num => cn.postmod ! num ++ BIND ++ "," ++ rs.s ! agrP3 num ;
} ;
RelNP np rs = { RelNP np rs = {
s = \\c => np.s ! c ++ BIND ++ "," ++ rs.s ! np.a ; 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 isNeg = np.isNeg
} ; } ;
AdvCN cn ad = {s = \\nf => cn.s ! nf ++ ad.s ; AdvCN cn ad = cn ** {
h = cn.h} ; postmod = \\num => cn.postmod ! num ++ ad.s ;
} ;
SentCN cn sc = {s = \\nf=> cn.s ! nf ++ sc.s; SentCN cn sc = cn **{
h = cn.h } ; postmod = \\num => cn.postmod ! num ++ sc.s ;
} ;
ApposCN cn np = {s = \\nf=> cn.s ! nf ++ np.s ! NPSep ; ApposCN cn np = cn ** { -- luvun x
h = cn.h } ; --- luvun x postmod = \\num => cn.postmod ! num ++ np.s ! NPSep ;
} ;
PossNP cn np = {s = \\nf => np.s ! NPCase Gen ++ cn.s ! nf ; PossNP cn np = cn ** {
h = cn.h s = \\nf => np.s ! NPCase Gen ++ cn.s ! nf ;
} ; h = cn.h
} ;
PartNP cn np = {s = \\nf => cn.s ! nf ++ np.s ! NPCase Part ; PartNP cn np = cn ** {
h = cn.h ---- gives "lasin viiniänsa" ; should be "lasinsa viiniä" postmod = \\num => np.s ! NPCase Part ++ cn.postmod ! num ;
} ; } ;
CountNP det np = CountNP det np =