change type of np and add helper function to construct string from split category

This commit is contained in:
Herbert Lange
2019-06-28 16:21:30 +02:00
parent de44443068
commit e2ba2023e1
13 changed files with 63 additions and 58 deletions
+12 -23
View File
@@ -6,7 +6,7 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
-- DetCN : Det -> CN -> NP ; -- the man
DetCN det cn =
{
s = \\c => cn.s ! det.n ! c ;
s = \\_,c => cn.s ! det.n ! c ;
n = det.n ; g = cn.g ; p = P3 ;
adv = cn.adv ;
preap = cn.preap ;
@@ -27,19 +27,15 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
-- UsePron : Pron -> NP ; -- he
UsePron p =
{
g = p.pers.g ;
n = p.pers.n ;
p.pers **
{
p = p.p ;
s = \\c => case c of {
Nom => p.pers.s ! PronDrop ! PronNonRefl ; -- Drop pronoun in nominative case
_ => p.pers.s ! PronNonDrop ! PronNonRefl -- but don't drop it otherwise
} ! c ;
s = \\pd,c => p.pers.s ! pd ! PronNonRefl ! c;
adv = "" ;
preap, postap = { s = \\_ => "" } ;
det = { s,sp = \\_,_ => "" ; n = p.pers.n } ;
} ;
-- PredetNP : Predet -> NP -> NP ; -- only the man
PredetNP predet np =
np ** {
@@ -48,7 +44,7 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
-- PPartNP : NP -> V2 -> NP ; -- the man seen
-- PPartNP np v2 = {
-- s = \\c => np.s ! c ++ v2.s ! VPPart ;
-- s = \\c => (combineNounPhrase np) ! PronNonDrop ! c ++ v2.s ! VPPart ;
-- a = np.a
-- } ;
--
@@ -56,7 +52,7 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
-- AdvNP : NP -> Adv -> NP ; -- Paris today
AdvNP np adv = np ** { adv = np.adv ++ (adv.s ! Posit) } ;
-- {
-- s = \\c => np.s ! c ;
-- s = \\pd,c => combineNounPhrase np ! pd ! c ;
-- g = np.g ; n = np.n; p = np.p ;
-- adv = cc2 np.adv adv ;
-- preap = np.preap ;
@@ -72,7 +68,7 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
-- DetNP : Det -> NP ; -- these five
DetNP det = {
s = det.s ! Neutr ;
s = \\_ => det.s ! Neutr ;
g = Neutr ;
n = det.n ;
p = P3 ;
@@ -127,15 +123,11 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
} ;
MassNP cn =
{
s = cn.s ! Sg ;
cn ** {
s = \\_ => cn.s ! Sg ;
-- s = case cn.massable of { True => cn.s ! Sg ; False => \\_ => nonExist } ;
g = cn.g ;
n = Sg ;
p = P3 ;
adv = cn.adv ;
preap = cn.preap ;
postap = cn.postap ;
det = { s,sp = \\_,_ => "" ; n = Sg } ;
};
@@ -181,11 +173,8 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in {
--
-- ApposCN : CN -> NP -> CN
ApposCN cn np =
cn **
{
s = \\n,c => cn.s ! n ! c ++ np.det.s ! np.g ! c ++ np.preap.s ! (Ag np.g n c) ++ np.s ! c ++ np.postap .s ! (Ag np.g n c) ++ np.det.sp ! np.g ! c ;
g = cn.g ;
preap = cn.preap ;
postap = cn.postap ;
adv = cn.adv
s = \\n,c => cn.s ! n ! c ++ (combineNounPhrase np) ! PronNonDrop ! c ;
} ; -- massable = cn.massable } ;
}