experimenting with English VP

This commit is contained in:
aarne committed 2005-11-22 22:00:47 +00:00
1 parent a4a31e9e06
commit ecb0613ec5
28 files changed
+253 -8874

No files matched your search

-21
View File
@@ -1,21 +0,0 @@
PositA. AP ::= A ;
ComplA2. AP_post ::= A2 Prep NP ;
ComparA. AP_post ::= "more" A "than" NP ;
AP_post ::= "less" A "than" NP ;
-- superlatives à la CLE
Num ::= "most" A ;
Num_Pl ::= "most" A ;
ComplAV. AP_post ::= AV "to" VP ;
UseA2V. AV ::= A2V Prep NP ;
-- is this much too general?
SentAP. AP_post ::= AP SC ;
AP_post ::= AP_post SC ;
-- replace this by NP ::= S
-- ComplAQ. AP_post ::= AQ "of" QS ;
---- TODO: comparison of AV etc
-14
View File
@@ -1,14 +0,0 @@
PositA. AP ::= A ;
A ::= A2 | AV | A2V ;
-- also solves comparison of AV
ComparA. AP_post ::= "more" A "than" NP ;
AP_post ::= "less" A "than" NP ;
-- superlatives à la CLE
Num ::= "most" A ;
Num_Pl ::= "most" A ;
-18
View File
@@ -1,18 +0,0 @@
-- adverbs
AdjAdv. Adv ::= A "+ly" ;
AdvPP. Adv ::= PP ;
PrepNP. PP ::= Prep NP ;
-- NO AdvCN
AdvVP. VP ::= VP Adv ;
AdvNP. NP ::= NP Adv ;
AdvAP. AP ::= AdA AP ;
AdvAdv. Adv ::= AdA Adv ;
-- different from AdvVP!
VP ::= AdV VP ;
OptAdV ::= | AdV ;
-19
View File
@@ -1,19 +0,0 @@
-- adverbs
AdjAdv. Adv ::= A "+ly" ;
AdvPP. Adv ::= PP ;
PrepNP. PP ::= Prep NP ;
-- NO AdvCN
--AdvVP. VP ::= VP Adv ;
--AdvNP. NP ::= NP Adv ;
AdvAP. AP ::= AdA AP ;
AdvAdv. Adv ::= AdA Adv ;
-- different from AdvVP!
--VP ::= AdV VP ;
OptAdV ::= | AdV ;
File diff suppressed because it is too large. Load diff
-10
View File
@@ -1,10 +0,0 @@
S ::= S Conj S ;
RS ::= RS Conj RS ;
NP ::= NP Conj NP ;
VP ::= VP Conj VP ;
IP ::= IP Conj IP ;
RP ::= RP Conj RP ;
Adv ::= Adv Conj Adv ;
IAdv ::= IAdv Conj IAdv ;
Adv ::= Subj S ;
-1
View File
@@ -1 +0,0 @@
V ::= "ate" | "awake" | "awakes" | "awaking" | "awoke" | "awoken" | "bade" | "bear" | "bearing" | "bears" | "beat" | "beating" | "beats" | "became" | "become" | "becomes" | "becoming" | "began" | "begin" | "begining" | "begins" | "begun" | "bend" | "bending" | "bends" | "bent" | "beset" | "beseting" | "besets" | "bet" | "bets" | "betting" | "bid" | "bidden" | "bidding" | "bids" | "bind" | "binding" | "binds" | "bit" | "bite" | "bites" | "biting" | "bitten" | "bled" | "bleed" | "bleeding" | "bleeds" | "blew" | "blow" | "blowing" | "blown" | "blows" | "bore" | "born" | "bought" | "bound" | "break" | "breaking" | "breaks" | "bred" | "breed" | "breeding" | "breeds" | "bring" | "bringing" | "brings" | "broadcast" | "broadcasting" | "broadcasts" | "broke" | "broken" | "brought" | "build" | "building" | "builds" | "built" | "burn" | "burned" | "burning" | "burns" | "burnt" | "burst" | "bursting" | "bursts" | "buy" | "buying" | "buys" | "came" | "cast" | "casting" | "casts" | "catch" | "catches" | "catching" | "caught" | "choose" | "chooses" | "choosing" | "chose" | "chosen" | "cling" | "clinging" | "clings" | "clung" | "come" | "comes" | "coming" | "cost" | "costing" | "costs" | "creep" | "creeping" | "creeps" | "crept" | "cut" | "cuts" | "cutting" | "deal" | "dealing" | "deals" | "dealt" | "did" | "dig" | "digging" | "digs" | "dive" | "dived" | "dives" | "diving" | "do" | "does" | "doing" | "done" | "dove" | "drank" | "draw" | "drawing" | "drawn" | "draws" | "dream" | "dreamed" | "dreaming" | "dreams" | "dreamt" | "drew" | "drink" | "drinking" | "drinks" | "drive" | "driven" | "drives" | "driving" | "drove" | "drunk" | "dug" | "eat" | "eaten" | "eating" | "eats" | "fall" | "fallen" | "falling" | "falls" | "fed" | "feed" | "feeding" | "feeds" | "feel" | "feeling" | "feels" | "fell" | "felt" | "fight" | "fighting" | "fights" | "find" | "finding" | "finds" | "fit" | "fits" | "fitting" | "fled" | "flee" | "fleeing" | "flees" | "flew" | "flies" | "fling" | "flinging" | "flings" | "flown" | "flung" | "fly" | "flying" | "forbade" | "forbid" | "forbidden" | "forbidding" | "forbids" | "forgave" | "forget" | "forgets" | "forgetting" | "forgive" | "forgiven" | "forgives" | "forgiving" | "forgot" | "forgotten" | "forsake" | "forsaken" | "forsakes" | "forsaking" | "forsook" | "fought" | "found" | "freeze" | "freezes" | "freezing" | "froze" | "frozen" | "gave" | "get" | "gets" | "getting" | "give" | "given" | "gives" | "giving" | "go" | "going" | "gone" | "gos" | "got" | "gotten" | "grew" | "grind" | "grinding" | "grinds" | "ground" | "grow" | "growing" | "grown" | "grows" | "had" | "hang" | "hanging" | "hangs" | "has" | "have" | "having" | "hear" | "heard" | "hearing" | "hears" | "held" | "hid" | "hidden" | "hide" | "hides" | "hiding" | "hit" | "hits" | "hitting" | "hold" | "holding" | "holds" | "hung" | "hurt" | "hurting" | "hurts" | "keep" | "keeping" | "keeps" | "kept" | "kneel" | "kneeling" | "kneels" | "knelt" | "knew" | "knit" | "knits" | "knitting" | "know" | "knowing" | "knows" | "laid" | "lain" | "lay" | "laying" | "lays" | "lead" | "leading" | "leads" | "leap" | "leaped" | "leaping" | "leaps" | "learn" | "learned" | "learning" | "learns" | "learnt" | "leave" | "leaves" | "leaving" | "led" | "left" | "lend" | "lending" | "lends" | "lent" | "lept" | "let" | "lets" | "letting" | "lie" | "lies" | "light" | "lighted" | "lighting" | "lights" | "liing" | "lit" | "lose" | "loses" | "losing" | "lost" | "made" | "make" | "makes" | "making" | "mean" | "meaning" | "means" | "meant" | "meet" | "meeting" | "meets" | "met" | "misspell" | "misspelled" | "misspelling" | "misspells" | "misspelt" | "mistake" | "mistaken" | "mistakes" | "mistaking" | "mistook" | "mow" | "mowed" | "mowing" | "mown" | "mows" | "overcame" | "overcome" | "overcomes" | "overcoming" | "overdid" | "overdo" | "overdoes" | "overdoing" | "overdone" | "overtake" | "overtaken" | "overtakes" | "overtaking" | "overthrew" | "overthrow" | "overthrowing" | "overthrown" | "overthrows" | "overtook" | "paid" | "pay" | "paying" | "pays" | "plead" | "pleading" | "pleads" | "pled" | "prove" | "proved" | "proven" | "proves" | "proving" | "put" | "puts" | "putting" | "quit" | "quits" | "quitting" | "ran" | "rang" | "read" | "reading" | "reads" | "rid" | "ridden" | "ridding" | "ride" | "rides" | "riding" | "rids" | "ring" | "ringing" | "rings" | "rise" | "risen" | "rises" | "rising" | "rode" | "rose" | "run" | "rung" | "running" | "runs" | "said" | "sang" | "sank" | "sat" | "saw" | "sawed" | "sawing" | "sawn" | "saws" | "say" | "saying" | "says" | "see" | "seeing" | "seek" | "seeking" | "seeks" | "seen" | "sees" | "sell" | "selling" | "sells" | "send" | "sending" | "sends" | "sent" | "set" | "sets" | "setting" | "sew" | "sewed" | "sewing" | "sewn" | "sews" | "shake" | "shaken" | "shakes" | "shaking" | "shave" | "shaved" | "shaven" | "shaves" | "shaving" | "shear" | "shearing" | "shears" | "shed" | "shedding" | "sheds" | "shine" | "shines" | "shining" | "shod" | "shoe" | "shoedLine truncated
-42
View File
@@ -1,42 +0,0 @@
-- some open lexicon
N_Pl ::= "sons" ;
N ::= "son" ;
N ::= "wine" ;
N2 ::= "plan" ;
N3 ::= "value" ;
PN ::= "John" ;
A ::= "intelligent" ;
A2 ::= "devoted" ;
AV ::= "tedious" ;
A2V ::= "difficult" ;
-- AS ::= "marvellous" ;
A ::= "marvellous" ;
-- AQ ::= "independent" ;
A2 ::= "independent" ;
V0 ::= "rain" | "rains" | "rained" ;
V ::= "sleeps" | "sleep" | "slept" ;
V2 ::= "loves" | "love" | "loved" ;
V3 ::= "sends" | "send" | "sent" ;
VV ::= "wants" | "want" | "wanted" ;
V2 ::= "says" | "say" | "said" ;
V2 ::= "asks" | "ask" | "asked" ;
Adv ::= "here" | "there" ;
Adv ::= "from" "here" | "from" "there" ;
Adv ::= "today" | "tomorrow" | "yesterday" ;
AdA ::= "very" | "too" | "quite" | "much" "too" ;
AdV ::= "always" | "almost" | "just" ;
AdN ::= "less" "than" | "more" "than" | "almost" | "exactly" | "about" ;
--- does this give too much?
Adv ::= "last" N | "next" N ;
PN ::= "Boston" | "New" "York" | "Baltimore" ;
-72
View File
@@ -1,72 +0,0 @@
NP ::= Det CN ;
NP ::= PN ;
NP ::= Pron ;
NP ::= Predet Quant Num ;
Det ::= Predet Quant OptNum ;
Predet ::= ;
-- examples
-- Predet ::= "only" | "just" ;
-- Quant ::= "this" | "the" | "a" | "every" | "some" ;
-- Num ::= "one" ;
Quant ::= Poss ;
OptNum ::= | Num ;
Num ::= Ordinal ;
-- instead of NMass
Quant ::= ;
---NP ::= DetMass NMass ;
---DetMass ::= Predet Quant ;
---DetMass ::= Predet ;
---NMass ::= "wine" ;
NP ::= Det_Pl CN_Pl ;
NP ::= Predet_Pl Quant_Pl Num_Pl ; -- nonempty det
Det_Pl ::= Predet_Pl Quant_Pl OptNum_Pl ;
Predet_Pl ::= ;
Quant_Pl ::= ;
Quant_Pl ::= Poss ;
Poss ::= NP "'s" ; -- also "my" ;
OptNum_Pl ::= | Num_Pl ;
Num_Pl ::= Ordinal ;
Num_Pl ::= Int ;
Num_Pl ::= Numeral ;
-- less than, exactly, almost,...
Numeral ::= AdN Numeral ;
CN_Pl ::= N_Pl ;
CN ::= N ;
-- prepositions cannot be expressed generally here
-- NB relational nouns explain why complements are closer than adjuncts
-- But let us make the resource simpler by excluding them
-- CN ::= N2 Prep NP ;
-- N2 ::= N3 Prep NP ;
-- elliptical constructions
-- with exclusion of rel nouns, they just help reuse the old lexicon
N2 ::= N3 ;
N ::= N2 ;
-- these need other modules to produce anything
CN ::= AP CN ;
CN ::= CN AP_post ;
CN ::= CN "that" S ;
CN_Pl ::= AP CN_Pl ;
CN_Pl ::= CN_Pl AP_post ;
-77
View File
@@ -1,77 +0,0 @@
-- overgenerating from NumeralsEng
Ordinal ::= DigitO | Numeral DigitO ;
-- usable in Sg
Num ::= "one" ;
pot2as3. Sub1000000 ::= Sub1000 ;
pot3. Sub1000000 ::= Sub1000 "thousand" ;
pot3plus. Sub1000000 ::= Sub1000 "thousand" Sub1000 ;
pot1as2. Sub1000 ::= Sub100 ;
pot2. Sub1000 ::= Sub10 "hundred" ;
pot2plus. Sub1000 ::= Sub10 "hundred" "and" Sub100 ;
pot0as1. Sub100 ::= Sub10 ;
pot1. Sub100 ::= Digit ;
pot110. Sub100 ::= "ten" ;
pot111. Sub100 ::= "eleven" ;
pot1plus. Sub100 ::= Digit "-" Sub10 ;
pot1to19. Sub100 ::= Digit ;
pot0. Sub10 ::= Digit ;
pot01. Sub10 ::= "one" ;
num. Numeral ::= Sub1000000 ;
n2a. Digit ::= "twelve" ;
n2b. Digit ::= "twenty" ;
n2c. Digit ::= "two" ;
n3a. Digit ::= "thirteen" ;
n3b. Digit ::= "thirty" ;
n3c. Digit ::= "three" ;
n4a. Digit ::= "forty" ;
n4b. Digit ::= "four" ;
n4c. Digit ::= "fourteen" ;
n5a. Digit ::= "fifteen" ;
n5b. Digit ::= "fifty" ;
n5c. Digit ::= "five" ;
n6a. Digit ::= "six" ;
n6b. Digit ::= "sixteen" ;
n6c. Digit ::= "sixty" ;
n7a. Digit ::= "seven" ;
n7b. Digit ::= "seventeen" ;
n7c. Digit ::= "seventy" ;
n8a. Digit ::= "eight" ;
n8b. Digit ::= "eighteen" ;
n8c. Digit ::= "eighty" ;
n9a. Digit ::= "nine" ;
n9b. Digit ::= "nineteen" ;
n9c. Digit ::= "ninety" ;
n1d. DigitO ::= "first" ;
n1e. DigitO ::= "elevent" ;
n1f. DigitO ::= "tenth" ;
n1g. DigitO ::= "hundredth" ;
n1h. DigitO ::= "thousandth" ;
n2d. DigitO ::= "second" ;
n2e. DigitO ::= "twelfth" ;
n2f. DigitO ::= "twentieth" ;
n3d. DigitO ::= "thirteenth" ;
n3e. DigitO ::= "third" ;
n3f. DigitO ::= "thirtieth" ;
n4d. DigitO ::= "fourth" ;
n4e. DigitO ::= "fourteenth" ;
n4f. DigitO ::= "fortieth" ;
n5d. DigitO ::= "fifteenth" ;
n5e. DigitO ::= "fifth" ;
n5f. DigitO ::= "fiftieth" ;
n6d. DigitO ::= "sixth" ;
n6e. DigitO ::= "sixteenth" ;
n6f. DigitO ::= "sixtieth" ;
n7d. DigitO ::= "seventh" ;
n7e. DigitO ::= "seventeenth" ;
n7f. DigitO ::= "seventieth" ;
n8d. DigitO ::= "eighth" ;
n8e. DigitO ::= "eighteenth" ;
n8f. DigitO ::= "eightieth" ;
n9d. DigitO ::= "nineth" ;
n9e. DigitO ::= "nineteenth" ;
n9f. DigitO ::= "ninetieth" ;
-3
View File
@@ -1,3 +0,0 @@
-- to recognize passives and present participles; overgen now
Comp ::= VP ;
-12
View File
@@ -1,12 +0,0 @@
Phr ::= PConj S ;
Phr ::= PConj IP ;
Phr ::= PConj IAdv ;
Phr ::= PConj Imp Please ;
Phr ::= PConj QS Please ;
Phr ::= PConj NP Please ;
Phr ::= PConj Adv Please ;
Phr ::= PConj "to" VP Please ;
Please ::= | "please" ;
-2
View File
@@ -1,2 +0,0 @@
-- include Noun.cf Adj.cf Verb.cf Sent.cf Adverb.cf Phrase.cf Numeral.cf Structural.cf Lex.cf Biglex.cf Coord.cf Tense.cf Irreg.cf Participle.cf
-2
View File
@@ -1,2 +0,0 @@
-- include Noun.cf Adjf.cf Verbf.cf Sentf.cf Adverbf.cf Phrase.cf Numeral.cf Structural.cf Lex.cf Biglex.cf Coord.cf
-73
View File
@@ -1,73 +0,0 @@
--- just one tense considered; no agreement forced
S ::= NP VP ;
S ::= NP Mod VP ;
S ::= Adv "," S ;
-- sentences used as subjects and objects
NP ::= SC ;
SC ::= "that" S ;
SC ::= "to" VP ;
SC ::= QS ;
-- this is not needed in gf
SC ::= "whether" S | "if" S ;
-- existentials
S ::= "there" Cop NP ;
QS ::= Cop "there" NP ;
-- slash category instead of gaps
Slash ::= NP OptAdV V2 ;
Slash ::= NP OptAdV VV "to" V2 ;
Slash ::= NP Cop OptAdV A2 Prep ;
Slash ::= S Prep ;
Slash ::= Slash Adv ; -- who does my son love here
-- questions
QS ::= Mod NP VP ;
-- this will be eliminated via richer lintypes
QS ::= Cop NP Comp ;
IntVP. QS ::= IP VP ;
QS ::= IP Mod VP ;
IntSlash. QS ::= IP Mod QSlash ;
QSlash ::= Slash | QS Prep ;
-- general: QuestAdv : IAdv -> Cl -> QCl ;
QS ::= IAdv Mod NP VP ;
QS ::= IAdv Cop NP ;
IAdv ::= Prep IP ;
-- relatives
RelVP. RS ::= RP VP ;
RS ::= RP Mod VP ;
RelSlash. RS ::= RP Slash ;
RS ::= Slash ;
-- CLE syntax of relatives
NP ::= NP RS ;
FunIP. IP ::= NP Prep IP ; --N2
IP ::= IDet OptNum CN ;
IP ::= IDet OptNum_Pl CN_Pl ;
IP ::= IP PP ;
FunRP. RP ::= NP Prep RP ; -- ?
RP ::= "whose" OptNum CN ;
RP ::= "whose" OptNum_Pl CN_Pl ;
-- imperative
PosImpVP. Imp ::= VP ;
NegImpVP. Imp ::= "don't" VP ;
-70
View File
@@ -1,70 +0,0 @@
-- flat structure for S and VP; use instead of Sent.cf
--- just one tense considered; no agreement forced
S ::= NP VP ;
S ::= NP Mod VP ;
S ::= Adv "," S ;
-- sentences used as subjects and objects
NP ::= SC ;
SC ::= "that" S ;
SC ::= "to" VP ;
SC ::= QS ;
-- this is not needed in gf
SC ::= "whether" S | "if" S ;
-- existentials
S ::= "there" Cop NP ;
QS ::= Cop "there" NP ;
-- slash category instead of gaps
Slash ::= S Prep ;
Slash ::= Slash Adv ; -- who does my son love here
-- questions
QS ::= Mod NP VP ;
-- this will be eliminated via richer lintypes
QS ::= Cop NP Comp ;
IntVP. QS ::= IP VP ;
QS ::= IP Mod VP ;
IntSlash. QS ::= IP Mod Slash ;
-- general: QuestAdv : IAdv -> Cl -> QCl ;
QS ::= IAdv Mod NP VP ;
QS ::= IAdv Cop NP ;
IAdv ::= Prep IP ;
-- relatives
RelVP. RS ::= RP VP ;
RS ::= RP Mod VP ;
RelSlash. RS ::= RP Slash ;
RS ::= Slash ;
-- CLE syntax of relatives
NP ::= NP RS ;
FunIP. IP ::= "the" N2 Prep IP ;
IP ::= IDet OptNum CN ;
IP ::= IDet OptNum_Pl CN_Pl ;
IP ::= IP PP ;
FunRP. RP ::= "the" N2 Prep RP ; -- ?
RP ::= "whose" OptNum CN ;
RP ::= "whose" OptNum_Pl CN_Pl ;
-- imperative
PosImpVP. Imp ::= VP ;
NegImpVP. Imp ::= "don't" VP ;
-39
View File
@@ -1,39 +0,0 @@
-- structural words
Predet ::= "only" | "just" ;
Quant ::= "this" | "that" | "the" | "a" | "an" | "every" | "some" ;
Predet_Pl ::= "all" | "only" | "just" | "most" "of" ;
Quant_Pl ::= "these" | "those" | "the" | "many" | "some" ;
Pron ::= "I" | "you" | "he" | "she" | "we" | "they" | "it" ;
Pron ::= "me" | "him" | "her" | "us" | "them" ;
Poss ::= "my" | "your" | "his" | "her" | "our" | "their" | "its" ;
Prep ::= "about" | "at" | "by" | "for" | "from" | "in" | "of" | "on" | "to" | "with" ;
Prep ::= "after" | "before" | "despite" | "during" ;
IAdv ::= "why" | "where" | "when" | "how" ;
IP ::= "who" | "whom" | "what" ;
IDet ::= "which" | "how" "many" | "whose" ;
RP ::= "which" | "who" | "that" | "whom" ;
PConj ::= | "and" | "but" | "therefore" ;
NP ::= "this" | "that" | "those" | "these" ;
Conj ::= "and" | "or" ;
Subj ::= "if" | "when" | "although" | "though" ;
Subj ::= "before" | "after" | "while" | "because" ;
-- these may be eliminated in gf
Cop ::= "is" | "are" | "isn't" | "aren't" | "be" | "am" | "am" "not" ;
Do ::= "do" | "does" | "doesn't" | "don't" ;
Mod ::= "can" | "can't" | "would" | "wouldn't" | "will" | "won't" ;
-25
View File
@@ -1,25 +0,0 @@
-- PredV0. S ::= "it" V0 ;
V ::= V0 ;
UseV. VP ::= V ;
ComplV2. VP ::= V2 NP ;
VP ::= VP SC ;
-- ComplV3. VP ::= V3 NP NP ;
V2 ::= V3 ; -- via pp's
-- ComplVV. VP ::= VV "to" VP ;
V2 ::= VV ; -- I want (a house | to swim)
VP ::= Cop Comp ;
Comp ::= AP | NP | Adv ;
Comp ::= AP_post ; -- not needed in gf
Mod ::= Do ;
-- partial saturation
V ::= V2 ;
-15
View File
@@ -1,15 +0,0 @@
-- flat structure for verbs; use instead of Verb.cf ?
V ::= V0 | V2 | V3 | VV ;
UseV. VP ::= OptAdV V ;
VP ::= Cop OptAdV Comp ;
VP ::= VP NP ;
VP ::= VP Adv ;
Comp ::= AP | NP | Adv ;
Comp ::= AP_post ; -- not needed in gf
Mod ::= Do ;
+13
View File
@@ -0,0 +1,13 @@
abstract Cat = {
cat
S ;
Cl ;
VP ;
NP ;
AP ;
Comp ;
V ;
V2 ;
VV ;
Adv ;
}
+16
View File
@@ -0,0 +1,16 @@
concrete CatEng of Cat = open ResEng in {
lincat
S = {s : Str} ;
Cl = {s : Tense => Anteriority => Ord => Pol => Str} ;
VP = {
s : Tense => Anteriority => Ord => Pol => Agr => {fin, inf : Str} ;
s2 : Agr => Str
} ;
NP = {s : Case => Str ; a : Agr} ;
AP = {s : Str} ;
Comp = {s : Agr => Str} ;
V = Verb ; -- = {s : VForm => Str} ;
V2 = Verb ** {s2 : Str} ;
VV = Verb ** {s2 : Str} ;
Adv = {s : Str} ;
}
+17
View File
@@ -0,0 +1,17 @@
abstract Fun = Cat ** {
fun
Pred : NP -> VP -> Cl ;
UseV : V -> VP ;
ComplV2 : V2 -> NP -> VP ;
ComplVV : VV -> VP -> VP ;
UseComp : Comp -> VP ;
AdvVP : VP -> Adv -> VP ;
UseVV : VV -> V2 ;
CompAP : AP -> Comp ;
CompNP : NP -> Comp ;
CompAdv : Adv -> Comp ;
}
+32
View File
@@ -0,0 +1,32 @@
concrete FunEng of Fun = CatEng ** open ResEng in {
flags optimize=all_subs ;
lin
Pred np vp = {
s = \\t,a,o,b =>
let
agr = np.a ;
verb = vp.s ! t ! a ! o ! b ! agr ;
subj = np.s ! Nom ;
compl = vp.s2 ! agr
in
case o of {
ODir => subj ++ verb.fin ++ verb.inf ++ compl ;
OQuest => verb.fin ++ subj ++ verb.inf ++ compl
}
} ;
UseV = predV ;
ComplV2 v np = insertObj (\\_ => v.s2 ++ np.s ! Acc) (predV v) ;
ComplVV v vp = insertObj (\\a => v.s2 ++ infVP vp a) (predV v) ;
UseComp comp = insertObj comp.s (predAux auxBe) ;
AdvVP vp adv = insertObj (\\_ => adv.s) vp ;
UseVV vv = {s = vv.s ; s2 = []} ; -- no "to"
CompAP ap = {s = \\_ => ap.s} ;
CompNP np = {s = \\_ => np.s ! Acc} ;
CompAdv a = {s = \\_ => a.s} ;
}
+12
View File
@@ -0,0 +1,12 @@
abstract Lex = Cat ** {
fun
walk_V : V ;
kill_V2 : V2 ;
want_VV : VV ;
big_AP : AP ;
i_NP, he_NP, we_NP : NP ;
here_Adv : Adv ;
}
+14
View File
@@ -0,0 +1,14 @@
concrete LexEng of Lex = CatEng ** open ResEng in {
lin
walk_V = regV "walk" ;
kill_V2 = regV "kill" ** {s2 = []} ;
want_VV = regV "want" ** {s2 = "to"} ;
big_AP = {s = "big"} ;
i_NP = mkNP "I" "me" "my" Sg P1 ;
he_NP = mkNP "he" "him" "his" Sg P3 ;
we_NP = mkNP "we" "us" "our" Pl P1 ;
here_Adv = {s = "here"} ;
}
+147
View File
@@ -0,0 +1,147 @@
resource ResEng = {
param
Number = Sg | Pl ;
Person = P1 | P2 | P3 ;
Case = Nom | Acc | Gen ;
Anteriority = Simul | Anter ;
Tense = Pres | Past | Fut | Cond ;
Pol = PPos | PNeg ;
Ord = ODir | OQuest ;
VForm = VInf | VPres | VPast | VPPart | VPresPart ;
oper
Agr = {n : Number ; p : Person} ;
regV : Str -> {s : VForm => Str} = \walk -> {
s = table {
VInf => walk ;
VPres => walk + "s" ;
VPast | VPPart => walk + "ed" ;
VPresPart => walk + "ing"
}
} ;
mkNP : (i,me,my : Str) -> Number -> Person -> {s : Case => Str ; a : Agr} =
\i,me,my,n,p -> {
s = table {
Nom => i ;
Acc => me ;
Gen => my
} ;
a = {
n = n ;
p = p
}
} ;
Verb : Type = {
s : VForm => Str
} ;
VP : Type = {
s : Tense => Anteriority => Ord => Pol => Agr => {fin, inf : Str} ;
s2 : Agr => Str
} ;
predV : Verb -> VP = \verb -> {
s = \\t,ant,ord,b,agr =>
let
inf = verb.s ! VInf ;
fin = presVerb verb agr ;
past = verb.s ! VPast ;
part = verb.s ! VPPart ;
vf : Str -> Str -> {fin, inf : Str} = \x,y ->
{fin = x ; inf = y} ;
in
case <t,ant,b,ord> of {
<Pres,Simul,PPos,ODir> => vf fin [] ;
<Pres,Simul,PPos,OQuest> => vf (does agr) inf ;
<Pres,Simul,PNeg,_> => vf (doesnt agr) inf ;
<Pres,Anter,PPos,_> => vf (have agr) part ;
<Pres,Anter,PNeg,_> => vf (havent agr) part ;
<Past,Simul,PPos,ODir> => vf past [] ;
<Past,Simul,PPos,OQuest> => vf "did" inf ;
<Past,Simul,PNeg,_> => vf "didn't" inf ;
<Past,Anter,PPos,_> => vf "had" part ;
<Past,Anter,PNeg,_> => vf "hadn't" part ;
<Fut, Simul,PPos,_> => vf "will" inf ;
<Fut, Simul,PNeg,_> => vf "won't" inf ;
<Fut, Anter,PPos,_> => vf "will" ("have" ++ part) ;
<Fut, Anter,PNeg,_> => vf "won't" ("have" ++ part) ;
<Cond,Simul,PPos,_> => vf "would" inf ;
<Cond,Simul,PNeg,_> => vf "wouldn't" inf ;
<Cond,Anter,PPos,_> => vf "would" ("have" ++ part) ;
<Cond,Anter,PNeg,_> => vf "wouldn't" ("have" ++ part)
} ;
s2 = \\_ => []
} ;
predAux : Aux -> VP = \verb -> {
s = \\t,ant,ord,b,agr =>
let
inf = verb.inf ;
fin = verb.pres ! b ! agr ;
past = verb.past ! b ! agr ;
part = verb.ppart ;
vf : Str -> Str -> {fin, inf : Str} = \x,y ->
{fin = x ; inf = y} ;
in
case <t,ant,b,ord> of {
<Pres,Simul,_, _> => vf fin [] ;
<Pres,Anter,PPos,_> => vf (have agr) part ;
<Pres,Anter,PNeg,_> => vf (havent agr) part ;
<Past,Simul,_, _> => vf fin [] ;
<Past,Anter,PPos,_> => vf "had" part ;
<Past,Anter,PNeg,_> => vf "hadn't" part ;
<Fut, Simul,PPos,_> => vf "will" inf ;
<Fut, Simul,PNeg,_> => vf "won't" inf ;
<Fut, Anter,PPos,_> => vf "will" ("have" ++ part) ;
<Fut, Anter,PNeg,_> => vf "won't" ("have" ++ part) ;
<Cond,Simul,PPos,_> => vf "would" inf ;
<Cond,Simul,PNeg,_> => vf "wouldn't" inf ;
<Cond,Anter,PPos,_> => vf "would" ("have" ++ part) ;
<Cond,Anter,PNeg,_> => vf "wouldn't" ("have" ++ part)
} ;
s2 = \\_ => []
} ;
insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> {
s = vp.s ;
s2 = \\a => vp.s2 ! a ++ obj ! a
} ;
presVerb : {s : VForm => Str} -> Agr -> Str = \verb ->
agrVerb (verb.s ! VPres) (verb.s ! VInf) ;
infVP : VP -> Agr -> Str = \vp,a ->
(vp.s ! Fut ! Simul ! ODir ! PNeg ! a).inf ++ vp.s2 ! a ;
agrVerb : Str -> Str -> Agr -> Str = \has,have,agr ->
case agr of {
{n = Sg ; p = P3} => has ;
_ => have
} ;
have = agrVerb "has" "have" ;
havent = agrVerb "hasn't" "haven't" ;
does = agrVerb "does" "do" ;
doesnt = agrVerb "doesn't" "don't" ;
Aux = {pres,past : Pol => Agr => Str ; inf,ppart : Str} ;
auxBe : Aux = {
pres = \\b,a => agrVerb (posneg b "is") (posneg b "are") a ;
past = \\b,a => agrVerb (posneg b "was") (posneg b "were") a ;
inf = "be" ;
ppart = "been"
} ;
posneg : Pol -> Str -> Str = \p,s -> case p of {
PPos => s ;
PNeg => s + "n't"
} ;
}
+1
View File
@@ -0,0 +1 @@
abstract Test = Fun, Lex ** {} ;
+1
View File
@@ -0,0 +1 @@
concrete TestEng of Test = FunEng, LexEng ** {} ;