1
0
forked from GitHub/gf-core

interface for shallow parsing + basic lexicon

This commit is contained in:
aarne
2005-02-01 15:43:47 +00:00
parent d1035f4e18
commit 1df951b93d
21 changed files with 1489 additions and 161 deletions

View File

@@ -0,0 +1,203 @@
--# -path=.:../abstract:../../prelude
concrete BasicEng of Basic = ShallowEng ** open NewParadigmsEng in {
flags startcat=Phr ; lexer=textlit ; parser=chart ; unlexer=text ;
lin
airplane_N = regN "airplane" ;
--- answer_V2S = mkV2S (regV "answer") ;
apartment_N = regN "apartment" ;
apple_N = regN "apple" ;
art_N = regN "art" ;
---- ask_V2Q = mkV2Q (regV "ask") ;
baby_N = regN "baby" ;
bad_ADeg = regADeg "bad" ;
bank_N = regN "bank" ;
beautiful_ADeg = regADeg "beautiful" ;
---- become_VA = mkVA (regV "become") ;
beer_N = regN "beer" ;
---- beg_VV = mkVV (regV "beg") ;
---- be_V = (regV "be") ;
big_ADeg = regADeg "big" ;
bike_N = regN "bike" ;
bird_N = regN "bird" ;
black_ADeg = regADeg "black" ;
blue_ADeg = regADeg "blue" ;
boat_N = regN "boat" ;
book_N = regN "book" ;
boot_N = regN "boot" ;
boss_N = regN "boss" ;
boy_N = regN "boy" ;
bread_N = regN "bread" ;
break_V2 = dirV2 (regV "break") ;
broad_ADeg = regADeg "broad" ;
brother_N = regN "brother" ;
brown_ADeg = regADeg "brown" ;
butter_N = regN "butter" ;
buy_V2 = dirV2 (regV "buy") ;
camera_N = regN "camera" ;
cap_N = regN "cap" ;
car_N = regN "car" ;
carpet_N = regN "carpet" ;
cat_N = regN "cat" ;
ceiling_N = regN "ceiling" ;
chair_N = regN "chair" ;
cheese_N = regN "cheese" ;
child_N = regN "child" ;
church_N = regN "church" ;
city_N = regN "city" ;
clean_ADeg = regADeg "clean" ;
clever_ADeg = regADeg "clever" ;
close_V2 = dirV2 (regV "close") ;
coat_N = regN "coat" ;
cold_ADeg = regADeg "cold" ;
come_V = (regV "come") ;
computer_N = regN "computer" ;
country_N = regN "country" ;
cousin_N = regN "cousin" ;
cow_N = regN "cow" ;
die_V = (regV "die") ;
dirty_ADeg = regADeg "dirty" ;
doctor_N = regN "doctor" ;
dog_N = regN "dog" ;
door_N = regN "door" ;
drink_V2 = dirV2 (regV "drink") ;
eat_V2 = dirV2 (regV "eat") ;
enemy_N = regN "enemy" ;
factory_N = regN "factory" ;
father_N = regN "father" ;
---- fear_VS = mkVS (regV "fear") ;
find_V2 = dirV2 (regV "find") ;
fish_N = regN "fish" ;
floor_N = regN "floor" ;
forget_V2 = dirV2 (regV "forget") ;
fridge_N = regN "fridge" ;
friend_N = regN "friend" ;
fruit_N = regN "fruit" ;
garden_N = regN "garden" ;
girl_N = regN "girl" ;
glove_N = regN "glove" ;
gold_N = regN "gold" ;
good_ADeg = regADeg "good" ;
go_V = (regV "go") ;
green_ADeg = regADeg "green" ;
harbour_N = regN "harbour" ;
hate_V2 = dirV2 (regV "hate") ;
hat_N = regN "hat" ;
have_V2 = dirV2 (regV "have") ;
hear_V2 = dirV2 (regV "hear") ;
hill_N = regN "hill" ;
---- hope_VS = mkVS (regV "hope") ;
horse_N = regN "horse" ;
hot_ADeg = regADeg "hot" ;
house_N = regN "house" ;
important_ADeg = regADeg "important" ;
industry_N = regN "industry" ;
iron_N = regN "iron" ;
king_N = regN "king" ;
know_V2 = dirV2 (regV "know") ;
lake_N = regN "lake" ;
lamp_N = regN "lamp" ;
learn_V2 = dirV2 (regV "learn") ;
leather_N = regN "leather" ;
leave_V2 = dirV2 (regV "leave") ;
like_V2 = dirV2 (regV "like") ;
listen_V2 = dirV2 (regV "listen") ;
live_V = (regV "live") ;
long_ADeg = regADeg "long" ;
lose_V2 = dirV2 (regV "lose") ;
love_N = regN "love" ;
love_V2 = dirV2 (regV "love") ;
man_N = regN "man" ;
meat_N = regN "meat" ;
milk_N = regN "milk" ;
moon_N = regN "moon" ;
mother_N = regN "mother" ;
mountain_N = regN "mountain" ;
music_N = regN "music" ;
narrow_ADeg = regADeg "narrow" ;
new_ADeg = regADeg "new" ;
newspaper_N = regN "newspaper" ;
oil_N = regN "oil" ;
old_ADeg = regADeg "old" ;
open_V2 = dirV2 (regV "open") ;
paper_N = regN "paper" ;
peace_N = regN "peace" ;
pen_N = regN "pen" ;
planet_N = regN "planet" ;
plastic_N = regN "plastic" ;
play_V2 = dirV2 (regV "play") ;
policeman_N = regN "policeman" ;
priest_N = regN "priest" ;
queen_N = regN "queen" ;
radio_N = regN "radio" ;
read_V2 = dirV2 (regV "read") ;
red_ADeg = regADeg "red" ;
religion_N = regN "religion" ;
restaurant_N = regN "restaurant" ;
river_N = regN "river" ;
rock_N = regN "rock" ;
roof_N = regN "roof" ;
rubber_N = regN "rubber" ;
run_V = (regV "run") ;
---- say_VS = mkVS (regV "say") ;
school_N = regN "school" ;
science_N = regN "science" ;
sea_N = regN "sea" ;
seek_V2 = dirV2 (regV "seek") ;
see_V2 = dirV2 (regV "see") ;
---- sell_V3 = mkV3 (regV "sell") ;
---- send_V3 = mkV3 (regV "send") ;
sheep_N = regN "sheep" ;
ship_N = regN "ship" ;
shirt_N = regN "shirt" ;
shoe_N = regN "shoe" ;
shop_N = regN "shop" ;
short_ADeg = regADeg "short" ;
silver_N = regN "silver" ;
sister_N = regN "sister" ;
sleep_V = (regV "sleep") ;
small_ADeg = regADeg "small" ;
snake_N = regN "snake" ;
sock_N = regN "sock" ;
speak_V2 = dirV2 (regV "speak") ;
star_N = regN "star" ;
steel_N = regN "steel" ;
stone_N = regN "stone" ;
stove_N = regN "stove" ;
student_N = regN "student" ;
stupid_ADeg = regADeg "stupid" ;
sun_N = regN "sun" ;
switch8off_V = (regV "switch8off") ;
switch8on_V = (regV "switch8on") ;
table_N = regN "table" ;
teacher_N = regN "teacher" ;
teach_V2 = dirV2 (regV "teach") ;
television_N = regN "television" ;
thick_ADeg = regADeg "thick" ;
thin_ADeg = regADeg "thin" ;
train_N = regN "train" ;
travel_V = (regV "travel") ;
tree_N = regN "tree" ;
trousers_N = regN "trousers" ;
ugly_ADeg = regADeg "ugly" ;
understand_V2 = dirV2 (regV "understand") ;
university_N = regN "university" ;
village_N = regN "village" ;
wait_V2 = dirV2 (regV "wait") ;
walk_V = (regV "walk") ;
warm_ADeg = regADeg "warm" ;
war_N = regN "war" ;
watch_V2 = dirV2 (regV "watch") ;
water_N = regN "water" ;
white_ADeg = regADeg "white" ;
window_N = regN "window" ;
wine_N = regN "wine" ;
win_V2 = dirV2 (regV "win") ;
woman_N = regN "woman" ;
wood_N = regN "wood" ;
write_V2 = dirV2 (regV "write") ;
yellow_ADeg = regADeg "yellow" ;
young_ADeg = regADeg "young" ;
} ;

View File

@@ -74,7 +74,10 @@ lincat
Tense = {s : Str ; t : Tense} ;
Ant = {s : Str ; a : Anteriority} ;
Adv = {s : Str ; p : Bool} ;
Adv = {s : Str} ;
AdV = {s : Str} ;
AdA = {s : Str} ;
AdC = {s : Str} ;
S = {s : Str} ;
Cl = Clause ;

View File

@@ -17,13 +17,13 @@ resource MorphoEng = TypesEng ** open Prelude, (Predef=Predef) in {
oper
y2ie : Str -> Str -> Str = \fly,s ->
let y = last fly in
let y = last (init fly) in
case y of {
"a" => fly + "s" ;
"e" => fly + "s" ;
"o" => fly + "s" ;
"u" => fly + "s" ;
_ => init fly ++ "ies"
"a" => fly + s ;
"e" => fly + s ;
"o" => fly + s ;
"u" => fly + s ;
_ => init fly + "ie" + s
} ;
@@ -175,17 +175,25 @@ oper
--
-- Except for "be", the worst case needs four forms.
mkVerbP3 : (_,_,_,_: Str) -> VerbP3 = \go,goes,went,gone ->
mkVerbP3worst : (_,_,_,_,_: Str) -> VerbP3 = \go,goes,went,gone,going ->
{s = table {
InfImp => go ;
Indic P3 => goes ;
Indic _ => go ;
Pastt _ => went ;
PPart => gone ;
PresPart => go + "ing" ---- fix!
PresPart => going
}
} ;
mkVerbP3 : (_,_,_,_: Str) -> VerbP3 = \go,goes,went,gone ->
let going = case last go of {
"e" => init go + "ing" ;
_ => go + "ing"
}
in
mkVerbP3worst go goes went gone going ;
-- This is what we use to derive the irregular forms in almost all cases
mkVerbIrreg : (_,_,_ : Str) -> VerbP3 = \bite,bit,bitten ->

View File

@@ -26,7 +26,7 @@
--
-- The following modules are presupposed:
resource ParadigmsEng = open (Predef=Predef), Prelude, SyntaxEng, ResourceEng in {
resource NewParadigmsEng = open (Predef=Predef), Prelude, SyntaxEng, ResourceEng in {
--2 Parameters
--
@@ -35,8 +35,10 @@ resource ParadigmsEng = open (Predef=Predef), Prelude, SyntaxEng, ResourceEng in
oper
Gender : Type ;
human : Gender ;
nonhuman : Gender ;
human : Gender ;
nonhuman : Gender ;
masculine : Gender ;
feminite : Gender ;
-- To abstract over number names, we define the following.
@@ -52,28 +54,32 @@ oper
nominative : Case ;
genitive : Case ;
-- Prepositions used in many-argument functions are just strings.
Preposition : Type = Str ;
--2 Nouns
-- Worst case: give all four forms and the semantic gender.
mkN : (man,men,man's,men's : Str) -> N ;
-- The regular function captures the variants for nouns ending with
-- "s","sh","x","z" or "y": "kiss - kisses", "flash - flashes";
-- "fly - flies" (but "toy - toys"),
regN : Str -> N ;
-- Worst case: give all four forms and the semantic gender.
mkN : (man,men,man's,men's : Str) -> N ;
-- In practice the worst case is just: give singular and plural nominative.
manN : (man,men : Str) -> N ;
reg2N : (man,men : Str) -> N ;
-- All nouns created by the previous functions are marked as
-- $nonhuman$. If you want a $human$ noun, wrap it with the following
-- function:
humanN : N -> N ;
genderN : Gender -> N -> N ;
--3 Compound nouns
--
@@ -85,34 +91,40 @@ oper
--
-- Relational nouns ("daughter of x") need a preposition.
mkN2 : N -> Prep -> N2 ;
mkN2 : N -> Preposition -> N2 ;
-- The most common preposition is "of", and the following is a
-- shortcut for regulat, $nonhuman$ relational nouns with "of".
-- shortcut for regular, $nonhuman$ relational nouns with "of".
regN2 : Str -> N2 ;
-- Use the function $mkPrep$ or see the section on prepositions below to
-- Use the function $mkPreposition$ or see the section on prepositions below to
-- form other prepositions.
--
-- Three-place relational nouns ("the connection from x to y") need two prepositions.
mkN3 : N -> Prep -> Prep -> N3 ;
mkN3 : N -> Preposition -> Preposition -> N3 ;
--3 Relational common noun phrases
--
-- In some cases, you may want to make a complex $CN$ into a
-- relational noun (e.g. "the old town hall of").
cnN2 : CN -> Prep -> N2 ;
cnN3 : CN -> Prep -> Prep -> N3 ;
cnN2 : CN -> Preposition -> N2 ;
cnN3 : CN -> Preposition -> Preposition -> N3 ;
--
--3 Proper names
--3 Proper names and noun phrases
--
-- Proper names, with a regular genitive, are formed as follows
pnReg : Str -> PN ; -- John, John's
regPN : Str -> Gender -> PN ; -- John, John's
-- To form a noun phrase that can also be plural and have an irregular
-- genitive, you can use the worst-case function.
mkNP : Str -> Str -> Number -> Gender -> NP ;
--2 Adjectives
@@ -130,7 +142,7 @@ oper
--
-- Two-place adjectives need a preposition for their second argument.
mkA2 : A -> Prep -> A2 ;
mkA2 : A -> Preposition -> A2 ;
-- Comparison adjectives may two more forms.
@@ -145,7 +157,7 @@ oper
-- However, the duplication of the final consonant is nor predicted,
-- but a separate pattern is used:
fatADeg : Str -> ADeg ; -- fat, fatter, fattest
duplADeg : Str -> ADeg ; -- fat, fatter, fattest
-- If comparison is formed by "more, "most", as in general for
-- long adjective, the following pattern is used:
@@ -162,19 +174,18 @@ oper
-- Adverbs are not inflected. Most lexical ones have position
-- after the verb. Some can be preverbal (e.g. "always").
mkAdv : Str -> Adv ;
preAdv : Str -> Adv ;
mkAdv : Str -> Adv ;
mkAdV : Str -> AdV ;
-- Adverbs modifying adjectives and sentences can also be formed.
mkAdA : Str -> AdA ;
mkAdS : Str -> AdS ;
--2 Prepositions
--
-- A preposition is just a string.
mkPrep : Str -> Prep ;
mkPreposition : Str -> Preposition ;
--2 Verbs
--
@@ -190,6 +201,11 @@ oper
regV : Str -> V ;
-- The following variant duplicates the in consonant in the forms like
-- "rip - ripped - ripping".
regDuplV : Str -> V ;
-- There is an extensive list of irregular verbs in the module $IrregularEng$.
-- In practice, it is enough to give three forms,
-- e.g. "drink - drank - drunk", with a variant indicating consonant
@@ -210,7 +226,7 @@ oper
-- Two-place verbs need a preposition, except the special case with direct object.
-- (transitive verbs). Notice that a particle comes from the $V$.
mkV2 : V -> Prep -> V2 ;
mkV2 : V -> Preposition -> V2 ;
dirV2 : V -> V2 ;
@@ -223,6 +239,7 @@ oper
dirV3 : V -> Str -> V3 ; -- give,_,to
dirdirV3 : V -> V3 ; -- give,_,_
--2 Definitions of paradigms
--
-- The definitions should not bother the user of the API. So they are
@@ -232,114 +249,130 @@ oper
Gender = SyntaxEng.Gender ;
Number = SyntaxEng.Number ;
Case = SyntaxEng.Case ;
human = Hum ;
nonhuman = NoHum ;
human = Masc ;
nonhuman = Neutr ;
masculine = Masc ;
feminine = Fem ;
singular = Sg ;
plural = Pl ;
nominative = Nom ;
genitive = Gen ;
mkN = \man,men,man's,men's,g ->
mkNoun man men man's men's ** {g = g ; lock_N = <>} ;
---
nReg a g = addGenN nounReg a g ;
nKiss n g = addGenN nounS n g ;
nFly = \fly -> addGenN nounY (Predef.tk 1 fly) ;
nMan = \man,men -> mkN man men (man + "'s") (men + "'s") ;
nHero = nKiss ;
nSheep = \sheep -> nMan sheep sheep ;
regN = \ray ->
let
ra = Predef.tk 1 ray ;
y = Predef.dp 1 ray ;
r = Predef.tk 2 ray ;
ay = Predef.dp 2 ray ;
rays =
case y of {
"y" => y2ie ray "s" ;
"s" => ray + "es" ;
"z" => ray + "es" ;
"x" => ray + "es" ;
_ => case ay of {
"sh" => ray + "es" ;
"ch" => ray + "es" ;
_ => ray + "s"
}
}
in
reg2N ray rays ;
nHuman = \s -> nGen s Hum ;
nNonhuman = \s -> nGen s NoHum ;
reg2N = \man,men ->
let mens = case last men of {
"s" => men + "'" ;
_ => men + "'s"
}
in
mkN man men (man + "'s") mens ;
nGen : Str -> Gender -> N = \fly,g -> let {
fl = Predef.tk 1 fly ;
y = Predef.dp 1 fly ;
eqy = ifTok (Str -> Gender -> N) y
} in
eqy "y" nFly (
eqy "s" nKiss (
eqy "z" nKiss (
nReg))) fly g ;
mkN = \man,men,man's,men's ->
mkNoun man men man's men's ** {g = Neutr ; lock_N = <>} ;
mkN2 = \n,p -> n ** {lock_N2 = <> ; s2 = p} ;
funNonhuman = \s -> mkN2 (nNonhuman s) "of" ;
funHuman = \s -> mkN2 (nHuman s) "of" ;
genderN g man = {s = man.s ; g = g ; lock_N = <>} ;
pnReg n = nameReg n ** {lock_PN = <>} ;
mkN2 = \n,p -> UseN n ** {lock_N2 = <> ; s2 = p} ;
regN2 n = mkN2 (regN n) (mkPreposition "of") ;
mkN3 = \n,p,q -> UseN n ** {lock_N3 = <> ; s2 = p ; s3 = q} ;
cnN2 = \n,p -> n ** {lock_N2 = <> ; s2 = p} ;
cnN3 = \n,p,q -> n ** {lock_N3 = <> ; s2 = p ; s3 = q} ;
cnNonhuman = \s -> UseN (nGen s nonhuman) ;
cnHuman = \s -> UseN (nGen s human) ;
npReg = \s -> UsePN (pnReg s) ;
regPN n g = nameReg n g ** {lock_PN = <>} ;
mkNP x y n g = {s = table {GenP => x ; _ => y} ; a = toAgr n P3 g ;
lock_NP = <>} ;
mkN2CN = \n,p -> n ** {lock_N2 = <> ; s2 = p} ;
funOfCN = \n -> mkN2CN n "of" ;
mkA a b = mkAdjective a b ** {lock_A = <>} ;
regA a = regAdjective a ** {lock_A = <>} ;
addGenN : (Str -> CommonNoun) -> Str -> Gender -> N = \f ->
\s,g -> f s ** {g = g ; lock_N = <>} ;
mkA2 a p = a ** {s2 = p ; lock_A2 = <>} ;
mkA a = regAdjective a ** {lock_A = <>} ;
mkA2 = \s,p -> regAdjective s ** {s2 = p} ** {lock_A2 = <>} ;
mkADeg a b c = adjDegrIrreg a b c ** {lock_ADeg = <>} ;
aReg a = adjDegrReg a ** {lock_ADeg = <>} ;
aFat = \fat -> let {fatt = fat + Predef.dp 1 fat} in
mkADeg fat (fatt + "er") (fatt + "est") ;
aRidiculous a = adjDegrLong a ** {lock_ADeg = <>} ;
apReg = \s -> UseA (mkA s) ;
mkADeg a b c d = mkAdjDegrWorst a b c c d d ** {lock_ADeg = <>} ;
aGen : Str -> ADeg = \s -> case last s of {
"y" => mkADeg s (init s + "ier") (init s + "iest") ;
"e" => mkADeg s (s + "r") (s + "st") ;
_ => aReg s
} ;
regADeg happy =
let
happ = init happy ;
y = last happy ;
happie = case y of {
"y" => happ + "ie" ;
"e" => happy ;
_ => happy + "e"
} ;
happily = case y of {
"y" => happ + "ily" ;
_ => happy + "ly"
} ;
in mkADeg happy happily (happie + "r") (happie + "st") ;
mkAdv a = advPost a ** {lock_Adv = <>} ;
mkAdvPre a = advPre a ** {lock_Adv = <>} ;
mkPP x y = prepPhrase x y ** {lock_Adv = <>} ;
mkAdA a = ss a ** {lock_AdA = <>} ;
mkAdS a = ss a ** {lock_AdS = <>} ;
duplADeg fat = mkADeg fat
(fat + "ly") (fat + last fat + "er") (fat + last fat + "est") ;
compoundADeg a = let ad = (a.s ! AAdj) in
mkADeg ad (a.s ! AAdv) ("more" ++ ad) ("most" ++ ad) ;
adegA a = {s = a.s ! Pos ; lock_A = <>} ;
mkV = \go,goes,went,gone -> verbNoPart (mkVerbP3 go goes went gone) **
{lock_V = <>} ;
vReg = \walk -> mkV walk (walk + "s") (walk + "ed") (walk + "ed") ;
vKiss = \kiss -> mkV kiss (kiss + "es") (kiss + "ed") (kiss + "ed") ;
vFly = \cry -> let {cr = Predef.tk 1 cry} in
mkV cry (cr + "ies") (cr + "ied") (cr + "ied") ;
vGo = vKiss ;
mkAdv x = ss x ** {lock_Adv = <>} ;
mkAdV x = ss x ** {lock_AdV = <>} ;
mkAdA x = ss x ** {lock_AdA = <>} ;
vGen = \fly -> let {
fl = Predef.tk 1 fly ;
y = Predef.dp 1 fly ;
eqy = ifTok (Str -> V) y
} in
eqy "y" vFly (
eqy "s" vKiss (
eqy "z" vKiss (
vReg))) fly ;
mkPreposition p = p ;
vPart = \go, goes, went, gone, up ->
verbPart (mkVerbP3 go goes went gone) up ** {lock_V = <>} ;
vPartReg = \get, up ->
verbPart (vGen get) up ** {lock_V = <>} ;
mkV a b c d e = mkVerbP3worst a b c d e ** {s1 = [] ; lock_V = <>} ;
mkV2 = \v,p -> v ** {lock_V2 = <> ; s3 = p} ;
tvPartReg = \get, along, to -> mkV2 (vPartReg get along) to ;
regV cry =
let
cr = init cry ;
y = last cry ;
cries = (regN cry).s ! Pl ! Nom ; -- !
crie = init cries ;
cried = case last crie of {
"e" => crie + "d" ;
_ => crie + "ed"
} ;
crying = case y of {
"e" => cr + "ing" ;
_ => cry + "ing"
}
in mkV cry cries cried cried crying ;
vBe = verbBe ** {s1 = [] ; lock_V = <>} ;
vHave = verbP3Have ** {s1 = [] ; lock_V = <>} ;
regDuplV fit =
let fitt = fit + last fit in
mkV fit (fit + "s") (fitt + "ed") (fitt + "ed") (fitt + "ing") ;
tvGen = \s,p -> mkV2 (vGen s) p ;
tvDir = \v -> mkV2 v [] ;
tvGenDir = \s -> tvDir (vGen s) ;
irregV x y z = mkVerbIrreg x y z ** {s1 = [] ; lock_V = <>} ;
mkV3 x y z = mkDitransVerb x y z ** {lock_V3 = <>} ;
v3Dir x y = mkV3 x [] y ;
v3DirDir x = v3Dir x [] ;
irregDuplV fit y z =
let
fitting = (regDuplV fit).s ! PresPart
in
mkV fit (fit + "s") y z fitting ;
-- these are used in the generated lexicon
noun : Str -> N = nNonhuman ;
partV v p = {s = v.s ; s1 = p ; lock_V = <>} ;
verb2 : Str -> Str -> V2 = \v -> mkV2 (vGen v) ;
verb3 : Str -> Str -> Str -> V3 = \v -> mkV3 (vGen v) ;
mkV2 v p = v ** {s = v.s ; s1 = v.s1 ; s3 = p ; lock_V2 = <>} ;
dirV2 v = mkV2 v [] ;
mkV3 v p q = v ** {s = v.s ; s1 = v.s1 ; s3 = p ; s4 = q ; lock_V3 = <>} ;
dirV3 v p = mkV3 v [] p ;
dirdirV3 v = dirV3 v [] ;
} ;

View File

@@ -128,7 +128,7 @@ oper
-- Adverbs modifying adjectives and sentences can also be formed.
mkAdA : Str -> AdA ;
mkAdS : Str -> AdS ;
mkAdC : Str -> AdC ;
-- Prepositional phrases are another productive form of adverbials.
@@ -249,11 +249,11 @@ oper
_ => aReg s
} ;
mkAdv a = advPost a ** {lock_Adv = <>} ;
mkAdvPre a = advPre a ** {lock_Adv = <>} ;
mkAdv a = ss a ** {lock_Adv = <>} ;
mkAdvPre a = ss a ** {lock_Adv = <>} ;
mkPP x y = prepPhrase x y ** {lock_Adv = <>} ;
mkAdA a = ss a ** {lock_AdA = <>} ;
mkAdS a = ss a ** {lock_AdS = <>} ;
mkAdC a = ss a ** {lock_AdC = <>} ;
mkV = \go,goes,went,gone -> verbNoPart (mkVerbP3 go goes went gone) **
{lock_V = <>} ;

View File

@@ -133,8 +133,8 @@ lin
-- Adverbs.
AdjAdv a = advPost (a.s ! AAdv) ;
AdvPP p = advPost p.s ;
AdjAdv a = ss (a.s ! AAdv) ;
AdvPP p = p ;
PrepNP p = prepPhrase p.s ; ---
AdvVP = adVerbPhrase ;
@@ -181,8 +181,8 @@ lin
ImperOne = imperUtterance singular ;
ImperMany = imperUtterance plural ;
PrepS p = ss (p.s ++ ",") ;
AdvS = advSentence ;
AdvCl = advClause ;
AdvPhr = advSentence ;
--!

View File

@@ -0,0 +1,4 @@
--# -path=.:../abstract:../../prelude
concrete ShallowEng of Shallow = ShallowI with (Resource = ResourceEng) ;

View File

@@ -65,9 +65,9 @@ concrete StructuralEng of Structural =
WhenIAdv = ss "when" ;
WhereIAdv = ss "where" ;
WhyIAdv = ss "why" ;
EverywhereNP = advPost "everywhere" ;
SomewhereNP = advPost "somewhere" ;
NowhereNP = advPost "nowhere" ;
EverywhereNP = ss "everywhere" ;
SomewhereNP = ss "somewhere" ;
NowhereNP = ss "nowhere" ;
AndConj = ss "and" ** {n = Pl} ;
OrConj = ss "or" ** {n = Sg} ;

View File

@@ -573,21 +573,17 @@ oper
--
-- Adverbs are not inflected (we ignore comparison, and treat
-- compared adverbials as separate expressions; this could be done another way).
-- We distinguish between post- and pre-verbal adverbs.
-- We distinguish between different combinatory adverbs in the sybntax itself.
Adverb : Type = SS ** {p : Bool} ;
advPre : Str -> Adverb = \seldom -> ss seldom ** {p = False} ;
advPost : Str -> Adverb = \well -> ss well ** {p = True} ;
Adverb : Type = SS ;
-- N.B. this rule generates the cyclic parsing rule $VP#2 ::= VP#2$
-- and cannot thus be parsed.
adVerbPhrase : VerbGroup -> Adverb -> VerbGroup = \sings, well ->
let {postp = orB well.p sings.isAux} in
adVerbPhrase : VerbGroup -> Adverb -> VerbGroup = \sings, often ->
{
s = \\b,sf,a => (if_then_else Str postp [] well.s) ++ sings.s ! b ! sf ! a ;
s2 = \\b,sf,a => sings.s2 ! b ! sf ! a ++ (if_then_else Str postp well.s []) ;
s = \\b,sf,a => sings.s ! b ! sf ! a ++ often.s ; ---- depends on sf and isAux
s2 = \\b,sf,a => sings.s2 ! b ! sf ! a ;
isAux = sings.isAux
} ;
@@ -601,7 +597,7 @@ oper
-- is a little shaky, since other prepositions may be preferred ("on", "at").
prepPhrase : Preposition -> NounPhrase -> Adverb = \on, it ->
advPost (on ++ it.s ! AccP) ;
ss (on ++ it.s ! AccP) ;
locativeNounPhrase : NounPhrase -> Adverb =
prepPhrase "in" ;
@@ -1042,7 +1038,13 @@ oper
--2 Sentence adverbs
--
-- This class covers adverbs such as "otherwise", "therefore", which are prefixed
-- Sentence adverbs is the largest class and open for
-- e.g. prepositional phrases.
advClause : Clause -> Adverb -> Clause = \yousing,well ->
{s = \\b,c => yousing.s ! b ! c ++ well.s} ;
-- Conjunctive adverbs are such as "otherwise", "therefore", which are prefixed
-- to a sentence to form a phrase.
advSentence : SS -> Sentence -> Utterance = \hence,itiseven ->
@@ -1206,7 +1208,7 @@ oper
subjunctVerbPhrase : VerbGroup -> Subjunction -> Sentence -> VerbGroup =
\V, if, A ->
adVerbPhrase V (advPost (if.s ++ A.s)) ;
adVerbPhrase V (ss (if.s ++ A.s)) ;
--2 One-word utterances
--

View File

@@ -39,8 +39,8 @@ lin
Uncle = funOfReg "uncle" human ;
Connection = cnNoHum (nounReg "connection") ** {s2 = "from" ; s3 = "to"} ;
Always = advPre "always" ;
Well = advPost "well" ;
Always = ss "always" ;
Well = ss "well" ;
SwitchOn = mkTransVerbPart (verbP3s "switch") "on" ;
SwitchOff = mkTransVerbPart (verbP3s "switch") "off" ;
@@ -49,8 +49,8 @@ lin
Mary = nameReg "Mary" Fem ;
--- next
AlreadyAdv = advPre "already" ;
NowAdv = advPre "now" ;
AlreadyAdv = ss "already" ;
NowAdv = ss "now" ;
Paint = mkTransVerbDir (verbNoPart (regVerbP3 "paint")) ;
Green = adjDegrReg "green" ;