polarity handling for Fin, e.g. "kukaan ei nuku" as equivalent to "nobody sleeps"

This commit is contained in:
aarne
2012-05-27 15:03:50 +00:00
parent 336e32a9df
commit 590c1c55fd
11 changed files with 93 additions and 58 deletions

View File

@@ -49,7 +49,7 @@ concrete CatFin of Cat = CommonX ** open ResFin, Prelude in {
CN = {s : NForm => Str} ;
Pron = {s : NPForm => Str ; a : Agr} ;
NP = {s : NPForm => Str ; a : Agr ; isPron : Bool} ;
NP = {s : NPForm => Str ; a : Agr ; isPron : Bool ; isNeg : Bool} ;
Det = {
s1 : Case => Str ; -- minun kolme
s2 : Str ; -- -ni
@@ -57,12 +57,13 @@ concrete CatFin of Cat = CommonX ** open ResFin, Prelude in {
n : Number ; -- Pl (agreement feature for verb)
isNum : Bool ; -- True (a numeral is present)
isPoss : Bool ; -- True (a possessive suffix is present)
isDef : Bool -- True (verb agrees in Pl, Nom is not Part)
isDef : Bool ; -- True (verb agrees in Pl, Nom is not Part)
isNeg : Bool -- False (only True for "mikään", "kukaan")
} ;
---- QuantSg, QuantPl = {s1 : Case => Str ; s2 : Str ; isPoss, isDef : Bool} ;
Ord = {s : NForm => Str} ;
Predet = {s : Number => NPForm => Str} ;
Quant = {s1,sp : Number => Case => Str ; s2 : Str ; isPoss : Bool ; isDef : Bool} ;
Quant = {s1,sp : Number => Case => Str ; s2 : Str ; isPoss : Bool ; isDef : Bool ; isNeg : Bool} ;
Card = {s : Number => Case => Str ; n : Number} ;
Num = {s : Number => Case => Str ; isNum : Bool ; n : Number} ;

View File

@@ -11,7 +11,7 @@ concrete ConjunctionFin of Conjunction =
ConjNP conj ss = conjunctDistrTable NPForm conj ss ** {
a = conjAgr (Ag conj.n P3) ss.a ; -- P3 is the maximum
isPron = False
isPron = False ; isNeg = ss.isNeg
} ;
ConjAP conj ss = conjunctDistrTable2 Bool NForm conj ss ;
@@ -28,8 +28,8 @@ concrete ConjunctionFin of Conjunction =
ConsS = consrSS comma ;
BaseAdv = twoSS ;
ConsAdv = consrSS comma ;
BaseNP x y = twoTable NPForm x y ** {a = conjAgr x.a y.a} ;
ConsNP xs x = consrTable NPForm comma xs x ** {a = conjAgr xs.a x.a} ;
BaseNP x y = twoTable NPForm x y ** {a = conjAgr x.a y.a ; isNeg = orB x.isNeg y.isNeg} ;
ConsNP xs x = consrTable NPForm comma xs x ** {a = conjAgr xs.a x.a ; isNeg = orB xs.isNeg x.isNeg} ;
BaseAP x y = twoTable2 Bool NForm x y ;
ConsAP xs x = consrTable2 Bool NForm comma xs x ;
BaseRS x y = twoTable Agr x y ** {c = y.c} ;
@@ -40,7 +40,7 @@ concrete ConjunctionFin of Conjunction =
lincat
[S] = {s1,s2 : Str} ;
[Adv] = {s1,s2 : Str} ;
[NP] = {s1,s2 : NPForm => Str ; a : Agr} ;
[NP] = {s1,s2 : NPForm => Str ; a : Agr ; isNeg : Bool} ;
[AP] = {s1,s2 : Bool => NForm => Str} ;
[RS] = {s1,s2 : Agr => Str ; c : NPForm} ;
[CN] = {s1,s2 : NForm => Str} ;

View File

@@ -9,8 +9,9 @@ concrete ExtraFin of ExtraFinAbs = CatFin **
s2 = [] ;
isNum = False ;
isPoss = False ;
isDef = True --- "Jussin kolme autoa ovat" ; thus "...on" is missing
} ;
isDef = True ; --- "Jussin kolme autoa ovat" ; thus "...on" is missing
isNeg = False
} ;
GenCN n1 n2 = {s = \\nf => n1.s ! NPCase Gen ++ n2.s ! nf} ;
@@ -118,7 +119,7 @@ concrete ExtraFin of ExtraFinAbs = CatFin **
c => acn.s ! c
} ;
a = acn.a ;
isPron = False
isPron = False ; isNeg = False
} ;
vai_Conj = {s1 = [] ; s2 = "vai" ; n = Sg} ;
@@ -153,7 +154,8 @@ concrete ExtraFin of ExtraFinAbs = CatFin **
s2 = BIND ++ possSuffix p.a ;
isNum = False ;
isPoss = True ;
isDef = True --- "minun kolme autoani ovat" ; thus "...on" is missing
isDef = True ; --- "minun kolme autoani ovat" ; thus "...on" is missing
isNeg = False
} ;
lincat

View File

@@ -43,7 +43,8 @@ concrete IdiomFin of Idiom = CatFin **
adv = vp.adv ;
ext = vp.ext ;
sc = vp.sc ;
qp = vp.qp
qp = vp.qp ;
isNeg = vp.isNeg
} ;
ProgrVP vp =
@@ -56,7 +57,7 @@ concrete IdiomFin of Idiom = CatFin **
adv = vp.adv ;
ext = vp.ext ;
sc = vp.sc ;
qp = vp.qp
qp = vp.qp ; isNeg = vp.isNeg
} ;
-- This gives "otetaan oluet" instead of "ottakaamme oluet".

View File

@@ -843,13 +843,15 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
n : Number ; -- Pl (agreement feature for verb)
isNum : Bool ; -- True (a numeral is present)
isPoss : Bool ; -- True (a possessive suffix is present)
isDef : Bool -- True (verb agrees in Pl, Nom is not Part)
isDef : Bool ; -- True (verb agrees in Pl, Nom is not Part)
isNeg : Bool
} = \n, noun -> heavyDet {
s1 = \\c => noun.s ! NCase n c ;
s2 = [] ;
n = n ;
isNum, isPoss = False ;
isDef = True --- does this hold for all new dets?
isDef = True ; --- does this hold for all new dets?
isNeg = False
} ;
-- Here we define personal and relative pronouns.

View File

@@ -38,7 +38,7 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, Prelude in {
<False,True> => Sg ; -- kolme kytkintä on
_ => det.n
}) ;
isPron = False
isPron = False ; isNeg = det.isNeg
} ;
DetNP det =
@@ -54,32 +54,35 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, Prelude in {
False => Sg ; -- autoja menee; kolme autoa menee
_ => det.n
}) ;
isPron = False
isPron = False ; isNeg = det.isNeg
} ;
UsePN pn = {
s = \\c => pn.s ! npform2case Sg c ;
a = agrP3 Sg ;
isPron = False
isPron = False ; isNeg = False
} ;
UsePron p = p ** {isPron = True} ;
UsePron p = p ** {isPron = True ; isNeg = False} ;
PredetNP pred np = {
s = \\c => pred.s ! complNumAgr np.a ! c ++ np.s ! c ;
a = np.a ;
isPron = np.isPron -- kaikki minun - ni
isPron = np.isPron ; -- kaikki minun - ni
isNeg = np.isNeg
} ;
PPartNP np v2 = {
s = \\c => np.s ! c ++ v2.s ! PastPartPass (AN (NCase (complNumAgr np.a) Ess)) ;
a = np.a ;
isPron = np.isPron -- minun täällä - ni
isPron = np.isPron ; -- minun täällä - ni
isNeg = np.isNeg
} ;
AdvNP np adv = {
s = \\c => np.s ! c ++ adv.s ;
a = np.a ;
isPron = np.isPron -- minun täällä - ni
isPron = np.isPron ; -- minun täällä - ni
isNeg = np.isNeg
} ;
DetQuantOrd quant num ord = {
@@ -89,7 +92,8 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, Prelude in {
n = num.n ;
isNum = num.isNum ;
isPoss = quant.isPoss ;
isDef = quant.isDef
isDef = quant.isDef ;
isNeg = quant.isNeg
} ;
DetQuant quant num = {
@@ -99,7 +103,7 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, Prelude in {
n = num.n ;
isNum = num.isNum ; -- case num.n of {Sg => False ; _ => True} ;
isPoss = quant.isPoss ;
isDef = quant.isDef
isDef = quant.isDef ; isNeg = quant.isNeg
} ;
PossPron p = {
@@ -107,7 +111,8 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, Prelude in {
s2 = BIND ++ possSuffix p.a ;
isNum = False ;
isPoss = True ;
isDef = True --- "minun kolme autoani ovat" ; thus "...on" is missing
isDef = True ; --- "minun kolme autoani ovat" ; thus "...on" is missing
isNeg = False
} ;
NumSg = {s = \\_,_ => [] ; isNum = False ; n = Sg} ;
@@ -138,7 +143,7 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, Prelude in {
s1 = \\_,_ => [] ;
sp = table {Sg => pronSe.s ; Pl => pronNe.s} ;
s2 = [] ;
isNum,isPoss = False ;
isNum,isPoss,isNeg = False ;
isDef = True -- autot ovat
} ;
@@ -148,7 +153,7 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, Prelude in {
(nhn (mkSubst "ä" "yksi" "yhde" "yhte" "yhtä" "yhteen" "yksi" "yksi"
"yksien" "yksiä" "yksiin")).s ! NCase n c ;
s2 = [] ;
isNum,isPoss,isDef = False -- autoja on
isNum,isPoss,isDef,isNeg = False -- autoja on
} ;
MassNP cn =
@@ -159,7 +164,7 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, Prelude in {
s = \\c => let k = npform2case n c in
cn.s ! ncase k ;
a = agrP3 Sg ;
isPron = False
isPron = False ; isNeg = False
} ;
UseN n = n ;
@@ -198,7 +203,8 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, Prelude in {
RelNP np rs = {
s = \\c => np.s ! c ++ "," ++ rs.s ! np.a ;
a = np.a ;
isPron = np.isPron ---- correct ?
isPron = np.isPron ; ---- correct ?
isNeg = np.isNeg
} ;
AdvCN cn ad = {s = \\nf => cn.s ! nf ++ ad.s} ;

View File

@@ -188,6 +188,7 @@ oper
adv : Polarity => Str ; -- ainakin/ainakaan
ext : Str ;
sc : NPForm ;
isNeg : Bool ; -- True if some complement is negative
qp : Bool -- True = back vowel
} ;
@@ -252,7 +253,8 @@ oper
adv = \\_ => [] ;
ext = [] ;
sc = verb.sc ;
qp = verb.qp
qp = verb.qp ;
isNeg = False
} ;
insertObj : (Bool => Polarity => Agr => Str) -> VP -> VP = \obj,vp -> {
@@ -261,16 +263,18 @@ oper
adv = vp.adv ;
ext = vp.ext ;
sc = vp.sc ;
qp = vp.qp
qp = vp.qp ;
isNeg = vp.isNeg
} ;
insertObjPre : (Bool => Polarity => Agr => Str) -> VP -> VP = \obj,vp -> {
insertObjPre : Bool -> (Bool => Polarity => Agr => Str) -> VP -> VP = \isNeg, obj,vp -> {
s = vp.s ;
s2 = \\fin,b,a => obj ! fin ! b ! a ++ vp.s2 ! fin ! b ! a ;
adv = vp.adv ;
ext = vp.ext ;
sc = vp.sc ;
qp = vp.qp
qp = vp.qp ;
isNeg = orB vp.isNeg isNeg
} ;
insertAdv : (Polarity => Str) -> VP -> VP = \adv,vp -> {
@@ -279,7 +283,8 @@ oper
ext = vp.ext ;
adv = \\b => vp.adv ! b ++ adv ! b ;
sc = vp.sc ;
qp = vp.qp
qp = vp.qp ;
isNeg = vp.isNeg --- missään
} ;
insertExtrapos : Str -> VP -> VP = \obj,vp -> {
@@ -288,7 +293,8 @@ oper
ext = vp.ext ++ obj ;
adv = vp.adv ;
sc = vp.sc ;
qp = vp.qp
qp = vp.qp ;
isNeg = vp.isNeg
} ;
-- For $Sentence$.
@@ -301,6 +307,21 @@ oper
s : Tense => Anteriority => Polarity => {subj,fin,inf,compl,adv,ext : Str ; qp : Bool}
} ;
mkClausePol : Bool -> (Polarity -> Str) -> Agr -> VP -> Clause =
\isNeg,sub,agr,vp -> {
s = \\t,a,b =>
let
pol = case isNeg of {
True => Neg ;
_ => b
} ;
c = (mkClausePlus sub agr vp).s ! t ! a ! pol
in
table {
SDecl => c.subj ++ c.fin ++ c.inf ++ c.compl ++ c.adv ++ c.ext ;
SQuest => c.fin ++ BIND ++ questPart c.qp ++ c.subj ++ c.inf ++ c.compl ++ c.adv ++ c.ext
}
} ;
mkClause : (Polarity -> Str) -> Agr -> VP -> Clause =
\sub,agr,vp -> {
s = \\t,a,b => let c = (mkClausePlus sub agr vp).s ! t ! a ! b in
@@ -696,12 +717,13 @@ oper
n : Number ;
isNum : Bool ;
isPoss : Bool ;
isDef : Bool
isDef : Bool ;
isNeg : Bool
} ;
heavyQuant : PQuant -> PQuant ** {sp : Number => Case => Str} = \d ->
d ** {sp = d.s1} ;
PQuant : Type =
{s1 : Number => Case => Str ; s2 : Str ; isPoss : Bool ; isDef : Bool} ;
{s1 : Number => Case => Str ; s2 : Str ; isPoss : Bool ; isDef : Bool ; isNeg : Bool} ;
}

View File

@@ -4,7 +4,7 @@ concrete SentenceFin of Sentence = CatFin ** open Prelude, ResFin in {
lin
PredVP np vp = mkClause (subjForm np vp.sc) np.a vp ;
PredVP np vp = mkClausePol (orB np.isNeg vp.isNeg) (subjForm np vp.sc) np.a vp ;
PredSCVP sc vp = mkClause (\_ -> sc.s) (agrP3 Sg) vp ;

View File

@@ -79,22 +79,22 @@ concrete StructuralFin of Structural = CatFin **
somebody_NP = {
s = \\c => jokuPron ! Sg ! npform2case Sg c ;
a = agrP3 Sg ;
isPron = False
isPron = False ; isNeg = False
} ;
someSg_Det = heavyDet {
s1 = jokuPron ! Sg ;
s2 = [] ;
isNum,isPoss = False ; isDef = True ; n = Sg
isNum,isPoss = False ; isDef = True ; isNeg = False ; n = Sg
} ;
somePl_Det = heavyDet {
s1 = jokuPron ! Pl ;
s2 = [] ; isNum,isPoss = False ; isDef = True ;
n = Pl
s2 = [] ; isNum,isPoss = False ; isNeg = False ; isDef = True ;
n = Pl ; isNeg = False
} ;
something_NP = {
s = \\c => jokinPron ! Sg ! npform2case Sg c ;
a = agrP3 Sg ;
isPron = False
isPron = False ; isNeg = False ; isNeg = False
} ;
somewhere_Adv = ss "jossain" ;
that_Quant = heavyQuant {
@@ -106,7 +106,7 @@ concrete StructuralFin of Structural = CatFin **
c => (mkPronoun "nuo" "noiden" "noita" "noina" "noihin" Sg P3).s ! NPCase c
}
} ;
s2 = [] ; isNum,isPoss = False ; isDef = True ;
s2 = [] ; isNum,isPoss = False ; isDef = True ; isNeg = False
} ;
that_Subj = ss "että" ;
there_Adv = ss "siellä" ; --- tuolla
@@ -123,7 +123,7 @@ concrete StructuralFin of Structural = CatFin **
c => (mkPronoun "nämä" "näiden" "näitä" "näinä" "näihin" Sg P3).s ! NPCase c
}
} ;
s2 = [] ; isNum,isPoss = False ; isDef = True ;
s2 = [] ; isNum,isPoss = False ; isDef = True ; isNeg = False
} ;
through_Prep = postGenPrep "kautta" ;
too_AdA = ss "liian" ;
@@ -273,7 +273,7 @@ oper
makeNP noun num = {
s = \\c => noun.s ! NCase num (npform2case num c) ;
a = agrP3 num ;
isPron = False ;
isPron, isNeg = False ;
lock_NP = <>
} ;
@@ -281,21 +281,21 @@ lin
not_Predet = {s = \\_,_ => "ei"} ;
no_Quant = heavyQuant {
s1 = \\n,c => mikaanPron ! n ! c ; --- requires negative or question polarity
s2 = [] ; isNum,isPoss = False ; isDef = True ;
s1 = \\n,c => mikaanPron ! n ! c ; -- requires negative or question polarity
s2 = [] ; isNum,isPoss = False ; isDef = True ; isNeg = True
} ;
if_then_Conj = {s1 = "jos" ; s2 = "niin" ; n = Sg} ;
nobody_NP = {
s = \\c => kukaanPron ! Sg ! npform2case Sg c ; --- requires negative or question polarity
s = \\c => kukaanPron ! Sg ! npform2case Sg c ; -- requires negative or question polarity
a = agrP3 Sg ;
isPron = False
isPron = False ; isNeg = True
} ;
nothing_NP = {
s = \\c => mikaanPron ! Sg ! npform2case Sg c ; --- requires negative or question polarity
a = agrP3 Sg ;
isPron = False
isPron = False ; isNeg = True
} ;
at_least_AdN = ss "vähintään" ;

View File

@@ -50,7 +50,7 @@ concrete VerbFin of Verb = CatFin ** open Prelude, ResFin in {
ap.s ! False ! (NCase Sg (npform2case Sg v.c3.c))) ----agr to obj
(predV v) ** {c2 = v.c2} ;
ComplSlash vp np = insertObjPre (\\fin,b,_ => appCompl fin b vp.c2 np) vp ;
ComplSlash vp np = insertObjPre np.isNeg (\\fin,b,_ => appCompl fin b vp.c2 np) vp ;
UseComp comp =
insertObj (\\_,_ => comp.s) (predV (verbOlla ** {sc = NPCase Nom ; qp = True})) ;
@@ -68,7 +68,7 @@ concrete VerbFin of Verb = CatFin ** open Prelude, ResFin in {
) ** {c2 = vp.c2} ; ---- correct ??
SlashV2VNP v np vp =
insertObjPre
insertObjPre np.isNeg
(\\fin,b,a => appCompl True b v.c2 np ++ ---- fin -> stack overflow
infVP v.sc b a vp v.vi)
(predV v) ** {c2 = vp.c2} ;
@@ -77,7 +77,7 @@ concrete VerbFin of Verb = CatFin ** open Prelude, ResFin in {
AdVVP adv vp = insertAdv (\\_ => adv.s) vp ;
ReflVP v = insertObjPre (\\fin,b,agr => appCompl fin b v.c2 (reflPron agr)) v ;
ReflVP v = insertObjPre False (\\fin,b,agr => appCompl fin b v.c2 (reflPron agr)) v ;
PassV2 v = let vp = predV v in {
s = \\_ => vp.s ! VIPass ;
@@ -85,6 +85,7 @@ concrete VerbFin of Verb = CatFin ** open Prelude, ResFin in {
adv = \\_ => [] ;
ext = [] ;
qp = v.qp ;
isNeg = False ;
sc = v.c2.c -- minut valitaan ; minua rakastetaan ; minulle kuiskataan
} ; ---- talon valitaan: should be marked like inf.

View File

@@ -11,7 +11,7 @@ incomplete concrete ConjunctionRomance of Conjunction =
ConjNP conj ss = heavyNP (conjunctDistrTable Case conj ss ** {
a = conjAgr (Ag Masc conj.n P3) ss.a ;
hasClit = False
hasClit = False ; isNeg = ss.isNeg
}) ;
ConjAP conj ss = conjunctDistrTable AForm conj ss ** {
isPre = ss.isPre
@@ -33,12 +33,12 @@ incomplete concrete ConjunctionRomance of Conjunction =
BaseNP x y = {
s1 = \\c => (x.s ! c).ton ;
s2 = \\c => (y.s ! conjunctCase c).ton ; ----e (conjunctCase c) ;
a = conjAgr x.a y.a
a = conjAgr x.a y.a ; isNeg = orB x.isNeg y.isNeg
} ;
ConsNP x xs = {
s1 = \\c => (x.s ! c).ton ++ comma ++ xs.s1 ! conjunctCase c ; ----e (conjunctCase c) ;
s2 = \\c => xs.s2 ! c ; ----e (conjunctCase c) ;
a = conjAgr x.a xs.a
a = conjAgr x.a xs.a ; isNeg = orB x.isNeg xs.isNeg
} ;
BaseAP x y = twoTable AForm x y ** {isPre = andB x.isPre y.isPre} ;
ConsAP xs x = consrTable AForm comma xs x ** {isPre = andB xs.isPre x.isPre} ;
@@ -53,7 +53,7 @@ incomplete concrete ConjunctionRomance of Conjunction =
[S] = {s1,s2 : Mood => Str} ;
[Adv] = {s1,s2 : Str} ;
[IAdv] = {s1,s2 : Str} ;
[NP] = {s1,s2 : Case => Str ; a : Agr} ;
[NP] = {s1,s2 : Case => Str ; a : Agr ; isNeg : Bool} ;
[AP] = {s1,s2 : AForm => Str ; isPre : Bool} ;
[RS] = {s1,s2 : Mood => Agr => Str ; c : Case} ;
[CN] = {s1,s2 : Number => Str ; g : Gender} ;