This commit is contained in:
aarne
2005-11-29 15:21:45 +00:00
parent 3cd1317bda
commit dd70f6dce3
24 changed files with 323 additions and 23 deletions

View File

@@ -9,6 +9,8 @@ abstract Adjective = Cat ** {
ComplA2 : A2 -> NP -> AP ;
ReflA2 : A2 -> AP ;
SentAP : AP -> S -> AP ;
QuestAP : AP -> QS -> AP ;

View File

@@ -3,32 +3,37 @@ concrete AdjectiveEng of Adjective = CatEng ** open ResEng, Prelude in {
lin
PositA a = {
s = a.s ! AAdj Posit ;
s = \\_ => a.s ! AAdj Posit ;
isPre = True
} ;
ComparA a np = {
s = a.s ! AAdj Compar ++ "than" ++ np.s ! Nom ;
s = \\_ => a.s ! AAdj Compar ++ "than" ++ np.s ! Nom ;
isPre = False
} ;
-- $SuperlA$ belongs to determiner syntax in $Noun$.
ComplA2 a np = {
s = a.s ! AAdj Posit ++ a.c2 ++ np.s ! Acc ;
s = \\_ => a.s ! AAdj Posit ++ a.c2 ++ np.s ! Acc ;
isPre = False
} ;
ReflA2 a = {
s = \\ag => a.s ! AAdj Posit ++ a.c2 ++ reflPron ! ag ;
isPre = False
} ;
SentAP ap s = {
s = ap.s ++ conjThat ++ s.s ;
s = \\a => ap.s ! a ++ conjThat ++ s.s ;
isPre = False
} ;
QuestAP ap qs = {
s = ap.s ++ qs.s ! QIndir ;
s = \\a => ap.s ! a ++ qs.s ! QIndir ;
isPre = False
} ;
AdAP ada ap = {
s = ada.s ++ ap.s ;
s = \\a => ada.s ++ ap.s ! a ;
isPre = ap.isPre
} ;

View File

@@ -0,0 +1,15 @@
abstract Adverb = Cat ** {
fun
PositAdvAdj : A -> Adv ;
ComparAdvAdj : CAdv -> A -> NP -> Adv ;
ComparAdvAdjS : CAdv -> A -> S -> Adv ;
PrepNP : Prep -> NP -> Adv ;
AdAdv : AdA -> Adv -> Adv ;
SubjS : Subj -> S -> Adv ;
}

View File

@@ -0,0 +1,18 @@
concrete AdverbEng of Adverb = CatEng ** open ResEng, Prelude in {
lin
PositAdvAdj a = {s = a.s ! AAdv} ;
ComparAdvAdj cadv a np = {
s = cadv.s ++ a.s ! AAdv ++ "than" ++ np.s ! Nom
} ;
ComparAdvAdjS cadv a s = {
s = cadv.s ++ a.s ! AAdv ++ "than" ++ s.s
} ;
PrepNP prep np = {s = prep.s ++ np.s ! Acc} ;
AdAdv = cc2 ;
SubjS = cc2 ;
}

View File

@@ -1,5 +1,12 @@
abstract Cat = {
cat
Text ;
Phr ;
Utt ;
Imp ;
S ;
QS ;
RS ;
@@ -50,8 +57,22 @@ abstract Cat = {
IAdv ;
IDet ;
RP ;
RP ; -- relative pronoun
Numeral ;
Numeral ; -- cardinal or ordinal, e.g. "five/fifth"
Conj ; -- conjunction, e.g. "and"
DConj ; -- distributed conj. e.g. "both - and"
PConj ; -- phrase-beginning conj.
CAdv ; -- comparative adverb e.g. "more", "less"
Subj ; -- subjunction, e.g. "if", "when"
SeqS ; -- sequence of sentences
SeqVP ; -- sequence of verb phrases
SeqAP ; -- sequence of adjectival phrases
SeqNP ; -- sequence of noun phrases
SeqAdv ; -- sequence of adverbs
Voc ; -- vocative or "please"
}

View File

@@ -1,6 +1,10 @@
concrete CatEng of Cat = open ResEng, Prelude in {
lincat
Text, Phr, Utt = {s : Str} ;
Imp = {s : Polarity => Number => Str} ;
S = {s : Str} ;
QS = {s : QForm => Str} ;
RS = {s : Agr => Str} ;
@@ -20,7 +24,7 @@ concrete CatEng of Cat = open ResEng, Prelude in {
V2, VV = Verb ** {c2 : Str} ;
V3 = Verb ** {c2, c3 : Str} ;
AP = {s : Str ; isPre : Bool} ;
AP = {s : Agr => Str ; isPre : Bool} ;
Comp = {s : Agr => Str} ;
A = {s : AForm => Str} ;
@@ -46,4 +50,14 @@ concrete CatEng of Cat = open ResEng, Prelude in {
Numeral = {s : CardOrd => Str ; n : Number} ;
CAdv = {s : Str} ;
Conj = {s : Str ; n : Number} ;
DConj = {s1,s2 : Str ; n : Number} ;
SeqS = {s1,s2 : Str} ;
SeqAdv = {s1,s2 : Str} ;
SeqNP = {s1,s2 : Case => Str ; a : Agr} ;
SeqAP = {s1,s2 : Agr => Str ; isPre : Bool} ;
}

View File

@@ -0,0 +1,15 @@
abstract Conjunction = Sequence ** {
fun
ConjS : Conj -> SeqS -> S ; -- "John walks and Mary runs"
ConjAP : Conj -> SeqAP -> AP ; -- "even and prime"
ConjNP : Conj -> SeqNP -> NP ; -- "John or Mary"
ConjAdv : Conj -> SeqAdv -> Adv ; -- "quickly or slowly"
DConjS : DConj -> SeqS -> S ; -- "either John walks or Mary runs"
DConjAP : DConj -> SeqAP -> AP ; -- "both even and prime"
DConjNP : DConj -> SeqNP -> NP ; -- "either John or Mary"
DConjAdv : DConj -> SeqAdv -> Adv ; -- "both badly and slowly"
}

View File

@@ -0,0 +1,26 @@
concrete ConjunctionEng of Conjunction =
SequenceEng ** open ResEng, Coordination in {
lin
ConjS conj ss = {s = conjunctX conj ss} ;
DConjS conj ss = {s = conjunctDistrX conj ss} ;
ConjAdv conj ss = {s = conjunctX conj ss} ;
DConjAdv conj ss = {s = conjunctDistrX conj ss} ;
ConjNP conj ss = conjunctTable Case conj ss ** {
a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p}
} ;
DConjNP conj ss = conjunctDistrTable Case conj ss ** {
a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p}
} ;
ConjAP conj ss = conjunctTable Agr conj ss ** {
isPre = ss.isPre
} ;
DConjAP conj ss = conjunctDistrTable Agr conj ss ** {
isPre = ss.isPre
} ;
}

View File

@@ -35,7 +35,20 @@ abstract Lex = Cat ** {
very_AdA : AdA ;
always_AdV : AdV ;
one_Numeral, forty_Numeral : Numeral ;
in_Prep, of_Prep : Prep ;
and_Conj : Conj ;
either7or_DConj : DConj ;
but_PConj : PConj ;
if_Subj, because_Subj : Subj ;
please_Voc : Voc ;
more_CAdv, less_CAdv : CAdv ;
}

View File

@@ -17,6 +17,7 @@ concrete LexEng of Lex = CatEng ** open ResEng, Prelude in {
here_Adv = {s = "here"} ;
very_AdA = {s = "very"} ;
always_AdV = {s = "always"} ;
only_Predet = {s = "only"} ;
all_Predet = {s = "only"} ;
@@ -43,4 +44,17 @@ concrete LexEng of Lex = CatEng ** open ResEng, Prelude in {
in_Prep = {s = "in"} ;
of_Prep = {s = "of"} ;
and_Conj = {s = "and" ; n = Pl} ;
either7or_DConj = {s1 = "either" ; s2 = "or" ; n = Sg} ;
if_Subj = ss "if" ;
because_Subj = ss "because" ;
but_PConj = {s = "but"} ;
please_Voc = {s = "," ++ "please"} ;
more_CAdv = ss "more" ;
less_CAdv = ss "less" ;
}

View File

@@ -32,7 +32,9 @@ concrete NounEng of Noun = CatEng ** open ResEng, Prelude in {
ComplN2 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c} ;
ComplN3 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c ; c2 = f.c3} ;
AdjCN ap cn = {s = \\n,c => preOrPost ap.isPre ap.s (cn.s ! n ! c)} ;
AdjCN ap cn = {
s = \\n,c => preOrPost ap.isPre (ap.s ! (agrP3 n).a) (cn.s ! n ! c)
} ;
RelCN cn rs = {s = \\n,c => cn.s ! n ! c ++ rs.s ! {n = n ; p = P3}} ;
SentCN cn s = {s = \\n,c => cn.s ! n ! c ++ conjThat ++ s.s} ;

View File

@@ -11,4 +11,17 @@ resource ParamX = {
QForm = QDir | QIndir ;
oper
conjNumber : Number -> Number -> Number = \m,n ->
case <m,n> of {
<Sg,Sg> => Sg ;
_ => Pl
} ;
-- For persons, we let the latter argument win ("either you or I am absent"
-- but "either I or you are absent"). This is not quite clear.
conjPerson : Person -> Person -> Person = \_,p ->
p ;
}

View File

@@ -0,0 +1,21 @@
abstract Phrase = Cat, Tense ** {
fun
PhrUtt : PConj -> Utt -> Voc -> Phr ;
UttS : S -> Utt ;
UttQS : QS -> Utt ;
UttImpSg, UttImpPl : Pol -> Imp -> Utt ;
UttIP : IP -> Utt ;
UttIAdv : IAdv -> Utt ;
UttNP : NP -> Utt ;
UttAdv : Adv -> Utt ;
UttVP : VP -> Utt ;
NoPConj : PConj ;
PConjConj : Conj -> PConj ;
NoVoc : Voc ;
VocNP : NP -> Voc ;
}

View File

@@ -0,0 +1,22 @@
concrete PhraseEng of Phrase = CatEng, TenseX ** open ResEng in {
lin
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
UttS s = s ;
UttQS qs = {s = qs.s ! QDir} ;
UttImpSg pol imp = {s = pol.s ++ imp.s ! pol.p ! Sg} ;
UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p ! Pl} ;
UttIP ip = {s = ip.s ! Nom} ; --- Acc also
UttIAdv iadv = iadv ;
UttNP np = {s = np.s ! Acc} ;
UttAdv adv = adv ;
NoPConj = {s = []} ;
PConjConj conj = conj ;
NoVoc = {s = []} ;
VocNP np = {s = "," ++ np.s ! Nom} ;
}

View File

@@ -2,13 +2,14 @@ resource ResEng = ParamX ** open Prelude in {
param
Case = Nom | Acc | Gen ;
Case = Nom | Acc | Gen ;
VForm = VInf | VPres | VPast | VPPart | VPresPart ;
Ord = ODir | OQuest ;
oper
Agr = {n : Number ; p : Person} ;
agrP3 : Number -> {a : Agr} = \n -> {a = {n = n ; p = P3}} ;
@@ -52,6 +53,8 @@ resource ResEng = ParamX ** open Prelude in {
}
} ;
-- For $Verb$.
Verb : Type = {
s : VForm => Str
} ;
@@ -63,7 +66,7 @@ resource ResEng = ParamX ** open Prelude in {
predV : Verb -> VP = \verb -> {
s = \\t,ant,b,ord,agr =>
let
let
inf = verb.s ! VInf ;
fin = presVerb verb agr ;
past = verb.s ! VPast ;
@@ -105,10 +108,10 @@ resource ResEng = ParamX ** open Prelude in {
{fin = x ; inf = y} ;
in
case <t,ant,b,ord> of {
<Pres,Simul,_, _> => vf fin [] ;
<Pres,Simul,_, _> => vf fin [] ;
<Pres,Anter,Pos,_> => vf (have agr) part ;
<Pres,Anter,Neg,_> => vf (havent agr) part ;
<Past,Simul,_, _> => vf fin [] ;
<Past,Simul,_, _> => vf fin [] ;
<Past,Anter,Pos,_> => vf "had" part ;
<Past,Anter,Neg,_> => vf "hadn't" part ;
<Fut, Simul,Pos,_> => vf "will" inf ;
@@ -128,6 +131,11 @@ resource ResEng = ParamX ** open Prelude in {
s2 = \\a => vp.s2 ! a ++ obj ! a
} ;
insertAdV : Str -> VP -> VP = \adv,vp -> {
s = vp.s ;
s2 = vp.s2
} ;
presVerb : {s : VForm => Str} -> Agr -> Str = \verb ->
agrVerb (verb.s ! VPres) (verb.s ! VInf) ;
@@ -148,7 +156,11 @@ resource ResEng = ParamX ** open Prelude in {
Aux = {pres,past : Polarity => Agr => Str ; inf,ppart : Str} ;
auxBe : Aux = {
pres = \\b,a => agrVerb (posneg b "is") (posneg b "are") a ;
pres = \\b,a => case <b,a> of {
<Pos,{n = Sg ; p = P1}> => "am" ;
<Neg,{n = Sg ; p = P1}> => ["am not"] ; --- am not I
_ => agrVerb (posneg b "is") (posneg b "are") a
} ;
past = \\b,a => agrVerb (posneg b "was") (posneg b "were") a ;
inf = "be" ;
ppart = "been"
@@ -161,6 +173,15 @@ resource ResEng = ParamX ** open Prelude in {
conjThat : Str = "that" ;
reflPron : Agr => Str = table {
{n = Sg ; p = P1} => "myself" ;
{n = Sg ; p = P2} => "yourself" ;
{n = Sg ; p = P3} => "itself" ; ----
{n = Pl ; p = P1} => "ourselves" ;
{n = Pl ; p = P2} => "yourselves" ;
{n = Pl ; p = P3} => "themselves"
} ;
-- For $Adjective$.
param
@@ -181,6 +202,15 @@ oper
param
RAgr = RNoAg | RAg {n : Number ; p : Person} ;
-- For $Coord$.
oper
conjAgr : Agr -> Agr -> Agr = \a,b -> {
n = conjNumber a.n b.n ;
p = conjPerson a.p b.p
} ;
-- For $Numeral$.
param

View File

@@ -4,10 +4,10 @@ abstract Sentence = Cat ** {
PredVP : NP -> VP -> Cl ;
SlashV2 : NP -> V2 -> Slash ;
AdvSlash : Slash -> Adv -> Slash ;
ImpVP : VP -> Imp ;
SlashV2 : NP -> V2 -> Slash ;
AdvSlash : Slash -> Adv -> Slash ;
SlashPrep : Cl -> Prep -> Slash ;
}

View File

@@ -9,7 +9,7 @@ concrete SentenceEng of Sentence = CatEng ** open ResEng in {
agr = np.a ;
verb = vp.s ! t ! a ! b ! o ! agr ;
subj = np.s ! Nom ;
compl = vp.s2 ! agr
compl = vp.s2 ! agr
in
case o of {
ODir => subj ++ verb.fin ++ verb.inf ++ compl ;
@@ -17,6 +17,19 @@ concrete SentenceEng of Sentence = CatEng ** open ResEng in {
}
} ;
ImpVP vp = {
s = \\pol,n =>
let
agr = {n = n ; p = P2} ;
verb = infVP vp agr ;
dont = case pol of {
Neg => "don't" ;
_ => []
}
in
dont ++ verb
} ;
SlashV2 np v2 = {
s = \\t,a,b,o =>
let

View File

@@ -0,0 +1,13 @@
abstract Sequence = Cat ** {
fun
TwoS : S -> S -> SeqS ;
AddS : SeqS -> S -> SeqS ;
TwoAdv : Adv -> Adv -> SeqAdv ;
AddAdv : SeqAdv -> Adv -> SeqAdv ;
TwoNP : NP -> NP -> SeqNP ;
AddNP : SeqNP -> NP -> SeqNP ;
TwoAP : AP -> AP -> SeqAP ;
AddAP : SeqAP -> AP -> SeqAP ;
}

View File

@@ -0,0 +1,15 @@
concrete SequenceEng of Sequence =
CatEng ** open ResEng, Coordination, Prelude in {
lin
TwoS = twoSS ;
AddS = consSS comma ;
TwoAdv = twoSS ;
AddAdv = consSS comma ;
TwoNP x y = twoTable Case x y ** {a = conjAgr x.a y.a} ;
AddNP xs x = consTable Case comma xs x ** {a = conjAgr xs.a x.a} ;
TwoAP x y = twoTable Agr x y ** {isPre = andB x.isPre y.isPre} ;
AddAP xs x = consTable Agr comma xs x ** {isPre = andB xs.isPre x.isPre} ;
}

View File

@@ -2,10 +2,13 @@ abstract Test =
Noun,
Verb,
Adjective,
Adverb,
-- Numeral,
Sentence,
Question,
Relative,
Conjunction,
Phrase,
Untensed,
-- Tensed,
Lex

View File

@@ -4,11 +4,18 @@ concrete TestEng of Test =
NounEng,
VerbEng,
AdjectiveEng,
AdverbEng,
-- NumeralEng,
SentenceEng,
QuestionEng,
RelativeEng,
ConjunctionEng,
PhraseEng,
UntensedEng,
-- TensedEng,
LexEng
** {} ;
** {
flags startcat = Phr ;
} ;

View File

@@ -7,8 +7,14 @@ abstract Verb = Cat ** {
ComplVV : VV -> VP -> VP ;
ComplVS : VS -> S -> VP ;
ComplVQ : VQ -> QS -> VP ;
ReflV2 : V2 -> VP ;
PassV2 : V2 -> Comp ; --- overgen (V2 with prep)
UseComp : Comp -> VP ;
AdvVP : VP -> Adv -> VP ;
AdvVP : VP -> Adv -> VP ; -- here
AdVVP : AdV -> VP -> VP ; -- always
UseVV : VV -> V2 ;
UseVQ : VQ -> V2 ;

View File

@@ -5,18 +5,24 @@ concrete VerbEng of Verb = CatEng ** open ResEng in {
lin
UseV = predV ;
ComplV2 v np = insertObj (\\_ => v.c2 ++ np.s ! Acc) (predV v) ;
ComplV2 v np = insertObj (\\_ => v.c2 ++ np.s ! Acc) (predV v) ;
ComplV3 v np np2 =
insertObj (\\_ => v.c2 ++ np.s ! Acc ++ v.c3 ++ np2.s ! Acc) (predV v) ;
ComplVV v vp = insertObj (\\a => v.c2 ++ infVP vp a) (predV v) ;
ComplVS v s = insertObj (\\_ => conjThat ++ s.s) (predV v) ;
ComplVQ v q = insertObj (\\_ => q.s ! QIndir) (predV v) ;
UseComp comp = insertObj comp.s (predAux auxBe) ;
AdvVP vp adv = insertObj (\\_ => adv.s) vp ;
---- AdVVP adv vp = insertAdV adv.s vp ;
ReflV2 v = insertObj (\\a => v.c2 ++ reflPron ! a) (predV v) ;
PassV2 v = {s = \\_ => v.s ! VPPart} ;
UseVV, UseVS, UseVQ = \vv -> {s = vv.s ; c2 = []} ; -- no "to"
CompAP ap = {s = \\_ => ap.s} ;
CompAP ap = ap ;
CompNP np = {s = \\_ => np.s ! Acc} ;
CompAdv a = {s = \\_ => a.s} ;

View File

@@ -0,0 +1,6 @@
Serious problems with resource.
29/11: Can't lin AdV properly (parsing; adverbs "always" relative to auxiliary)
29/11/2005: ResEng.reflPron - not enough agreement features.