extended AP with Ord and compar in 1.5

This commit is contained in:
aarne
2008-10-03 20:42:09 +00:00
parent 27de3c0e7b
commit 24207d40e9
16 changed files with 115 additions and 115 deletions

View File

@@ -7,13 +7,17 @@ abstract Adjective = Cat ** {
-- The principal ways of forming an adjectival phrase are
-- positive, comparative, relational, reflexive-relational, and
-- elliptic-relational.
-- (The superlative use is covered in [Noun Noun.html].$SuperlA$.)
PositA : A -> AP ; -- warm
ComparA : A -> NP -> AP ; -- warmer than I
ComplA2 : A2 -> NP -> AP ; -- married to her
ReflA2 : A2 -> AP ; -- married to itself
UseA2 : A2 -> A ; -- married
UseA2 : A2 -> AP ; -- married
UseComparA : A -> AP ; -- warmer
-- The superlative use is covered in $Ord$.
AdjOrd : Ord -> AP ; -- warmest
-- Sentence and question complements defined for all adjectival
-- phrases, although the semantics is only clear for some adjectives.

View File

@@ -37,11 +37,10 @@ abstract Noun = Cat ** {
--2 Determiners
-- The determiner has a fine-grained structure, in which a 'nucleus'
-- quantifier and two optional parts can be discerned: a cardinal and
-- an ordinal numeral.
-- quantifier and an optional numeral can be discerned.
DetQuant : Quant -> Num -> Det ; -- these five
DetQuantOrd : Quant -> Num -> Ord -> Det ; -- these five best
DetQuant : Quant -> Num -> Det ; -- these five
-- Whether the resulting determiner is singular or plural depends on the
-- cardinal.

View File

@@ -80,12 +80,6 @@ incomplete resource Combinators = open Cat, Structural, Constructors in {
neg : RCl -> RS
};
--2 Text append
-- This is not in ground API, because it would destroy parsing.
appendText : Text -> Text -> Text ;
--.
pred = overload {

View File

@@ -593,7 +593,7 @@ incomplete resource Constructors = open Grammar in {
-- Relational adjectives can be used with a complement or a reflexive
mkAP : A2 -> NP -> AP ; -- 3. married to her
mkAP : A2 -> AP ; -- 4. married to myself
mkAP : A2 -> AP ; -- 4. married
-- Some adjectival phrases can take as complements sentences,
-- questions, or infinitives. Syntactically this is possible for
@@ -613,8 +613,12 @@ incomplete resource Constructors = open Grammar in {
mkAP : Conj -> AP -> AP -> AP ; -- 10. old and big
mkAP : Conj -> ListAP -> AP ; -- 11. old, big, and warm
mkAP : Ord -> AP ; -- 12. oldest
} ;
reflAP : A2 -> AP ; -- married to himself
comparAP : A -> AP ; -- warmer
--3 Adv, adverbial phrases
mkAdv : overload {
@@ -865,7 +869,7 @@ incomplete resource Constructors = open Grammar in {
mkAP : A2 -> NP -> AP -- divisible by 2
= ComplA2 ;
mkAP : A2 -> AP -- divisible by itself
= ReflA2 ;
= UseA2 ;
mkAP : AP -> S -> AP -- great that she won
= \ap,s -> SentAP ap (EmbedS s) ;
mkAP : AP -> QS -> AP -- great that she won
@@ -882,6 +886,9 @@ incomplete resource Constructors = open Grammar in {
= \c,xy -> ConjAP c xy ;
} ;
reflAP = ReflA2 ;
comparAP = UseComparA ;
mkAdv = overload {
mkAdv : A -> Adv -- quickly
= PositAdvAdj ;
@@ -1686,10 +1693,13 @@ incomplete resource Constructors = open Grammar in {
the_Art : Art = DefArt ; -- the
a_Art : Art = IndefArt ; -- a
the_Quant : Quant = DefArt ; -- the
a_Quant : Quant = IndefArt ; -- a
DetArtSg : Art -> CN -> NP = \a -> DetCN (DetQuant a sgNum) ;
DetArtPl : Art -> CN -> NP = \a -> DetCN (DetQuant a plNum) ;
DetArtOrd = DetQuantOrd ;
DetArtOrd : Quant -> Num -> Ord -> Det = DetQuantOrd ;
DetArtCard : Art -> Card -> Det = \a,c -> DetQuant a (NumCard c) ;
TUseCl : Tense -> Ant -> Pol -> Cl -> S = \t,a -> UseCl (TTAnt t a) ;

View File

@@ -10,8 +10,16 @@ concrete AdjectiveEng of Adjective = CatEng ** open ResEng, Prelude in {
s = \\_ => a.s ! AAdj Compar ++ "than" ++ np.s ! Nom ;
isPre = False
} ;
UseComparA a = {
s = \\_ => a.s ! AAdj Compar ;
isPre = True
} ;
AdjOrd ord = {
s = \\_ => ord.s ;
isPre = True
} ;
-- $SuperlA$ belongs to determiner syntax in $Noun$.
ComplA2 a np = {
s = \\_ => a.s ! AAdj Posit ++ a.c2 ++ np.s ! Acc ;
@@ -33,6 +41,9 @@ concrete AdjectiveEng of Adjective = CatEng ** open ResEng, Prelude in {
isPre = ap.isPre
} ;
UseA2 a = a ;
UseA2 a = {
s = \\_ => a.s ! AAdj Posit ;
isPre = True
} ;
}

View File

@@ -31,18 +31,18 @@ concrete NounEng of Noun = CatEng ** open ResEng, Prelude in {
a = np.a
} ;
DetQuantOrd quant num ord = {
s = quant.s ! num.hasCard ! num.n ++ num.s ++ ord.s ;
sp = quant.sp ! num.hasCard ! num.n ++ num.s ++ ord.s ;
n = num.n
} ;
DetQuant quant num = {
s = quant.s ! num.hasCard ! num.n ++ num.s ;
sp = quant.sp ! num.hasCard ! num.n ++ num.s ;
n = num.n
} ;
DetQuantOrd quant num ord = {
s = quant.s ! num.hasCard ! num.n ++ num.s ++ ord.s ;
sp = quant.sp ! num.hasCard ! num.n ++ num.s ++ ord.s ;
n = num.n
} ;
DetNP det = {
s = \\c => det.sp ; ---- case
a = agrP3 det.n

View File

@@ -5,26 +5,33 @@ concrete AdjectiveFin of Adjective = CatFin ** open ResFin, Prelude in {
lin
PositA a = {
s = \\_ => a.s ! Posit
s = \\_,nf => a.s ! Posit ! AN nf
} ;
ComparA a np = {
s = \\isMod,af => case isMod of {
True => np.s ! NPCase Part ++ a.s ! Compar ! af ; -- minua isompi
_ => a.s ! Compar ! af ++ "kuin" ++ np.s ! NPCase Nom -- isompi kuin minä
True => np.s ! NPCase Part ++ a.s ! Compar ! AN af ; -- minua isompi
_ => a.s ! Compar ! AN af ++ "kuin" ++ np.s ! NPCase Nom -- isompi kuin minä
}
} ;
UseComparA a = {
s = \\_,nf => a.s ! Compar ! AN nf ;
} ;
-- $SuperlA$ belongs to determiner syntax in $Noun$.
AdjOrd ord = {
s = \\_ => ord.s
} ;
ComplA2 adj np = {
s = \\isMod,af =>
preOrPost isMod (appCompl True Pos adj.c2 np) (adj.s ! Posit ! af)
preOrPost isMod (appCompl True Pos adj.c2 np) (adj.s ! Posit ! AN af)
} ;
ReflA2 adj = {
s = \\isMod,af =>
preOrPost isMod
(appCompl True Pos adj.c2 (reflPron (agrP3 Sg))) (adj.s ! Posit ! af)
(appCompl True Pos adj.c2 (reflPron (agrP3 Sg))) (adj.s ! Posit ! AN af)
} ;
SentAP ap sc = {
@@ -35,6 +42,8 @@ concrete AdjectiveFin of Adjective = CatFin ** open ResFin, Prelude in {
s = \\b,af => ada.s ++ ap.s ! b ! af
} ;
UseA2 a = a ;
UseA2 a = {
s = \\_,nf => a.s ! Posit ! AN nf
} ;
}

View File

@@ -41,7 +41,7 @@ concrete CatFin of Cat = CommonX ** open ResFin, Prelude in {
-- The $Bool$ tells whether usage is modifying (as opposed to
-- predicative), e.g. "x on suurempi kuin y" vs. "y:tä suurempi luku".
AP = {s : Bool => AForm => Str} ;
AP = {s : Bool => NForm => Str} ;
-- Noun
@@ -59,11 +59,11 @@ concrete CatFin of Cat = CommonX ** open ResFin, Prelude in {
isDef : Bool -- True (verb agrees in Pl, Nom is not Part)
} ;
---- QuantSg, QuantPl = {s1 : Case => Str ; s2 : Str ; isPoss, isDef : Bool} ;
Ord = {s : Number => Case => Str} ;
Ord = {s : NForm => Str} ;
Predet = {s : Number => NPForm => Str} ;
Quant = {s1 : Number => Case => Str ; s2 : Str ; isPoss : Bool ; isDef : Bool} ;
Card = {s : Number => Case => Str ; n : Number} ;
Num = {s : Number => Case => Str ; isNum : Bool ; n : Number} ;
Quant = {s1 : Number => Case => Str ; s2 : Str ; isPoss : Bool ; isDef : Bool} ;
Card = {s : Number => Case => Str ; n : Number} ;
Num = {s : Number => Case => Str ; isNum : Bool ; n : Number} ;
-- Numeral

View File

@@ -14,7 +14,7 @@ concrete ConjunctionFin of Conjunction =
isPron = False
} ;
ConjAP conj ss = conjunctDistrTable2 Bool AForm conj ss ;
ConjAP conj ss = conjunctDistrTable2 Bool NForm conj ss ;
-- These fun's are generated from the list cat's.
@@ -24,13 +24,13 @@ concrete ConjunctionFin of Conjunction =
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} ;
BaseAP x y = twoTable2 Bool AForm x y ;
ConsAP xs x = consrTable2 Bool AForm comma xs x ;
BaseAP x y = twoTable2 Bool NForm x y ;
ConsAP xs x = consrTable2 Bool NForm comma xs x ;
lincat
[S] = {s1,s2 : Str} ;
[Adv] = {s1,s2 : Str} ;
[NP] = {s1,s2 : NPForm => Str ; a : Agr} ;
[AP] = {s1,s2 : Bool => AForm => Str} ;
[AP] = {s1,s2 : Bool => NForm => Str} ;
}

View File

@@ -381,7 +381,7 @@ lin
oper
mkOrd : N -> Ord ;
mkOrd x = {s = \\n,c => x.s ! NCase n c; lock_Ord = <> } ;
mkOrd x = {s = x.s ; lock_Ord = <> } ;
cpartitive = casePrep partitive ;
} ;

View File

@@ -77,7 +77,7 @@ concrete NounFin of Noun = CatFin ** open ResFin, Prelude in {
} ;
DetQuantOrd quant num ord = {
s1 = \\c => quant.s1 ! num.n ! c ++ num.s ! Sg ! c ++ ord.s ! Pl ! c ;
s1 = \\c => quant.s1 ! num.n ! c ++ num.s ! Sg ! c ++ ord.s ! NCase Pl c ;
s2 = quant.s2 ;
n = num.n ;
isNum = num.isNum ;
@@ -94,38 +94,6 @@ concrete NounFin of Noun = CatFin ** open ResFin, Prelude in {
isDef = True
} ;
{-
DetArtSg det cn =
let
n : Number = Sg ;
ncase : Case -> NForm = \c -> NCase n c ;
in {
s = \\c => let k = npform2case n c in
det.s1 ! Sg ! k ++ cn.s ! ncase k ;
a = agrP3 Sg ;
isPron = False
} ;
DetArtPl det cn =
let
n : Number = Pl ;
ncase : Case -> NForm = \c ->
case <n,c,det.isDef> of {
<Pl,Nom,False> => NCase Pl Part ; -- kytkimiä
_ => NCase n c -- kytkin, kytkimen,...
}
in {
s = \\c => let k = npform2case n c in
det.s1 ! Pl ! k ++ cn.s ! ncase k ;
a = agrP3 (case det.isDef of {
False => Sg ; -- autoja menee; kolme autoa menee
_ => Pl
}) ;
isPron = False
} ;
-}
PossPron p = {
s1 = \\_,_ => p.s ! NPCase Gen ;
s2 = BIND ++ possSuffix p.a ;
@@ -143,20 +111,20 @@ concrete NounFin of Noun = CatFin ** open ResFin, Prelude in {
s = \\n,c => numeral.s ! NCard (NCase n c) ;
n = numeral.n
} ;
OrdDigits numeral = {s = \\n,c => numeral.s ! NOrd (NCase n c)} ;
OrdDigits numeral = {s = \\nc => numeral.s ! NOrd nc} ;
NumNumeral numeral = {
s = \\n,c => numeral.s ! NCard (NCase n c) ;
n = numeral.n
} ;
OrdNumeral numeral = {s = \\n,c => numeral.s ! NOrd (NCase n c)} ;
OrdNumeral numeral = {s = \\nc => numeral.s ! NOrd nc} ;
AdNum adn num = {
s = \\n,c => adn.s ++ num.s ! n ! c ;
n = num.n
} ;
OrdSuperl a = {s = \\n,c => a.s ! Superl ! AN (NCase n c)} ;
OrdSuperl a = {s = \\nc => a.s ! Superl ! AN nc} ;
DefArt = {
s1 = \\_,_ => [] ;
@@ -210,7 +178,7 @@ concrete NounFin of Noun = CatFin ** open ResFin, Prelude in {
} ;
AdjCN ap cn = {
s = \\nf => ap.s ! True ! AN (n2nform nf) ++ cn.s ! nf
s = \\nf => ap.s ! True ! (n2nform nf) ++ cn.s ! nf
} ;
RelCN cn rs = {s = \\nf => cn.s ! nf ++ rs.s ! agrP3 (numN nf)} ;

View File

@@ -33,7 +33,7 @@ concrete VerbFin of Verb = CatFin ** open Prelude, ResFin in {
ComplVA v ap =
insertObj
(\\_,b,agr =>
ap.s ! False ! AN (NCase agr.n (npform2case agr.n v.c2.c))) --- v.cs.s ignored
ap.s ! False ! (NCase agr.n (npform2case agr.n v.c2.c))) --- v.cs.s ignored
(predV v) ;
SlashV2S v s =
@@ -46,7 +46,7 @@ concrete VerbFin of Verb = CatFin ** open Prelude, ResFin in {
SlashV2A v ap =
insertObj
(\\fin,b,_ =>
ap.s ! False ! AN (NCase Sg (npform2case Sg v.c3.c))) ----agr to obj
ap.s ! False ! (NCase Sg (npform2case Sg v.c3.c))) ----agr to obj
(predV v) ** {c2 = v.c2} ;
ComplSlash vp np = insertObj (\\fin,b,_ => appCompl fin b vp.c2 np) vp ;
@@ -95,7 +95,7 @@ concrete VerbFin of Verb = CatFin ** open Prelude, ResFin in {
Sg => Nom ; -- minä olen iso
Pl => Part -- me olemme isoja
} --- definiteness of NP ?
in ap.s ! False ! AN (NCase agr.n c)
in ap.s ! False ! (NCase agr.n c)
} ;
CompNP np = {s = \\_ => np.s ! NPCase Nom} ;
CompAdv a = {s = \\_ => a.s} ;

View File

@@ -12,6 +12,14 @@ concrete AdjectiveGer of Adjective = CatGer ** open ResGer, Prelude in {
s = \\af => a.s ! Compar ! af ++ conjThan ++ np.s ! Nom ;
isPre = True
} ;
UseComparA a = {
s = \\af => a.s ! Compar ! af ;
isPre = True
} ;
AdjOrd a = {
s = a.s ;
isPre = True
} ;
-- $SuperlA$ belongs to determiner syntax in $Noun$.
@@ -35,6 +43,9 @@ concrete AdjectiveGer of Adjective = CatGer ** open ResGer, Prelude in {
isPre = ap.isPre
} ;
UseA2 a = a ;
UseA2 a = {
s = a.s ! Posit ;
isPre = True
} ;
}

View File

@@ -11,6 +11,17 @@ incomplete concrete AdjectiveRomance of Adjective =
s = \\af => a.s ! Compar ! af ++ conjThan ++ np.s ! Ton Nom ;
isPre = False
} ;
UseComparA a = {
s = \\af => a.s ! Compar ! af ;
isPre = a.isPre
} ;
AdjOrd ord = {
s = \\af => ord.s ! (case af of {
AF g n => aagr g n ;
_ => aagr Masc Sg ----
}) ;
isPre = False ----
} ;
-- $SuperlA$ belongs to determiner syntax in $Noun$.
@@ -36,6 +47,9 @@ incomplete concrete AdjectiveRomance of Adjective =
isPre = ap.isPre
} ;
UseA2 a = a ** {isPre = False} ;
UseA2 a = {
s = a.s ! Posit ;
isPre = False ---- A2 has no isPre
} ;
}

View File

@@ -93,30 +93,6 @@ incomplete concrete NounRomance of Noun =
OrdSuperl adj = {s = \\a => adj.s ! Superl ! AF a.g a.n} ;
{-
DetArtSg det cn =
let
g = cn.g ;
n = Sg
in {
s = \\c => let cs = npform2case c in
det.s ! False ! n ! g ! cs ++ cn.s ! n ;
a = agrP3 g n ;
hasClit = False
} ;
DetArtPl det cn =
let
g = cn.g ;
n = Pl
in {
s = \\c => let cs = npform2case c in
det.s ! False ! n ! g ! cs ++ cn.s ! n ;
a = agrP3 g n ;
hasClit = False
} ;
-}
DefArt = {
s = \\_,n,g,c => artDef g n c ;
sp = \\n,g,c => artDef g n c ; ---- not for Fre
@@ -138,15 +114,6 @@ incomplete concrete NounRomance of Noun =
hasClit = False
} ;
{---b
MassDet = {
s = \\b,n,g,c => case <b,n> of {
<False,Sg> => partitive g c ;
_ => prepCase genitive ----
}
} ;
-}
-- This is based on record subtyping.
UseN, UseN2 = \noun -> noun ;

View File

@@ -15,8 +15,18 @@ incomplete concrete AdjectiveScand of Adjective =
++ conjThan ++ np.s ! nominative ;
isPre = False
} ;
UseComparA a = {
s = \\ap => case a.isComp of {
True => compMore ++ a.s ! AF (APosit ap) Nom ;
_ => a.s ! AF ACompar Nom
} ;
isPre = False
} ;
-- $SuperlA$ belongs to determiner syntax in $Noun$.
AdjOrd ord = {
s = \\_ => ord.s ;
isPre = True
} ;
ComplA2 a np = {
s = \\ap => a.s ! AF (APosit ap) Nom ++ a.c2.s ++ np.s ! accusative ;
@@ -39,6 +49,9 @@ incomplete concrete AdjectiveScand of Adjective =
isPre = ap.isPre
} ;
UseA2 a = a ;
UseA2 a = {
s = \\ap => a.s ! AF (APosit ap) Nom ;
isPre = True
} ;
}