mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-22 09:32:53 -06:00
rearranging resource-1.0
This commit is contained in:
42
lib/resource-1.0/english/AdjectiveEng.gf
Normal file
42
lib/resource-1.0/english/AdjectiveEng.gf
Normal file
@@ -0,0 +1,42 @@
|
||||
concrete AdjectiveEng of Adjective = CatEng ** open ResEng, Prelude in {
|
||||
|
||||
lin
|
||||
|
||||
PositA a = {
|
||||
s = \\_ => a.s ! AAdj Posit ;
|
||||
isPre = True
|
||||
} ;
|
||||
ComparA a np = {
|
||||
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 ;
|
||||
isPre = False
|
||||
} ;
|
||||
|
||||
ReflA2 a = {
|
||||
s = \\ag => a.s ! AAdj Posit ++ a.c2 ++ reflPron ! ag ;
|
||||
isPre = False
|
||||
} ;
|
||||
|
||||
SentAP ap s = {
|
||||
s = \\a => ap.s ! a ++ conjThat ++ s.s ;
|
||||
isPre = False
|
||||
} ;
|
||||
QuestAP ap qs = {
|
||||
s = \\a => ap.s ! a ++ qs.s ! QIndir ;
|
||||
isPre = False
|
||||
} ;
|
||||
|
||||
AdAP ada ap = {
|
||||
s = \\a => ada.s ++ ap.s ! a ;
|
||||
isPre = ap.isPre
|
||||
} ;
|
||||
|
||||
UseA2 a = a ;
|
||||
|
||||
}
|
||||
20
lib/resource-1.0/english/AdverbEng.gf
Normal file
20
lib/resource-1.0/english/AdverbEng.gf
Normal file
@@ -0,0 +1,20 @@
|
||||
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 ;
|
||||
|
||||
AdnCAdv cadv = {s = cadv.s ++ "than"} ;
|
||||
|
||||
}
|
||||
230
lib/resource-1.0/english/BasicEng.gf
Normal file
230
lib/resource-1.0/english/BasicEng.gf
Normal file
@@ -0,0 +1,230 @@
|
||||
--# -path=.:prelude
|
||||
|
||||
concrete BasicEng of Basic = CatEng ** open ParadigmsEng in {
|
||||
|
||||
flags
|
||||
startcat=Phr ; lexer=textlit ; unlexer=text ;
|
||||
optimize=all ;
|
||||
|
||||
lin
|
||||
airplane_N = regN "airplane" ;
|
||||
-- answer_V2S = mkV2S (regV "answer") "to" ;
|
||||
apartment_N = regN "apartment" ;
|
||||
apple_N = regN "apple" ;
|
||||
art_N = regN "art" ;
|
||||
-- ask_V2Q = mkV2Q (regV "ask") [] ;
|
||||
baby_N = regN "baby" ;
|
||||
bad_A = regADeg "bad" ;
|
||||
bank_N = regN "bank" ;
|
||||
beautiful_A = regADeg "beautiful" ;
|
||||
-- become_VA = mkVA (irregV "become" "became" "become") ;
|
||||
beer_N = regN "beer" ;
|
||||
-- beg_V2V = mkV2V (regDuplV "beg") [] "to" ;
|
||||
big_A = regADeg "big" ;
|
||||
bike_N = regN "bike" ;
|
||||
bird_N = regN "bird" ;
|
||||
black_A = regADeg "black" ;
|
||||
blue_A = 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 (irregV "break" "broke" "broken") ;
|
||||
broad_A = regADeg "broad" ;
|
||||
brother_N2 = regN2 "brother" ;
|
||||
brown_A = regADeg "brown" ;
|
||||
butter_N = regN "butter" ;
|
||||
buy_V2 = dirV2 (irregV "buy" "bought" "bought") ;
|
||||
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 = mk2N "child" "children" ;
|
||||
church_N = regN "church" ;
|
||||
city_N = regN "city" ;
|
||||
clean_A = regADeg "clean" ;
|
||||
clever_A = regADeg "clever" ;
|
||||
close_V2 = dirV2 (regV "close") ;
|
||||
coat_N = regN "coat" ;
|
||||
cold_A = regADeg "cold" ;
|
||||
come_V = (irregV "come" "came" "come") ;
|
||||
computer_N = regN "computer" ;
|
||||
country_N = regN "country" ;
|
||||
cousin_N = regN "cousin" ;
|
||||
cow_N = regN "cow" ;
|
||||
die_V = (regV "die") ;
|
||||
dirty_A = regADeg "dirty" ;
|
||||
distance_N3 = mkN3 (regN "distance") "from" "to" ;
|
||||
doctor_N = regN "doctor" ;
|
||||
dog_N = regN "dog" ;
|
||||
door_N = regN "door" ;
|
||||
drink_V2 = dirV2 (irregV "drink" "drank" "drunk") ;
|
||||
-- easy_A2V = mkA2V (regA "easy") "for" ;
|
||||
eat_V2 = dirV2 (irregV "eat" "ate" "eaten") ;
|
||||
empty_A = regADeg "empty" ;
|
||||
enemy_N = regN "enemy" ;
|
||||
factory_N = regN "factory" ;
|
||||
father_N2 = regN2 "father" ;
|
||||
fear_VS = mkVS (regV "fear") ;
|
||||
find_V2 = dirV2 (irregV "find" "found" "found") ;
|
||||
fish_N = mk2N "fish" "fish" ;
|
||||
floor_N = regN "floor" ;
|
||||
forget_V2 = dirV2 (irregV "forget" "forgot" "forgotten") ;
|
||||
fridge_N = regN "fridge" ;
|
||||
friend_N = regN "friend" ;
|
||||
fruit_N = regN "fruit" ;
|
||||
-- fun_AV = mkAV (regA "fun") ;
|
||||
garden_N = regN "garden" ;
|
||||
girl_N = regN "girl" ;
|
||||
glove_N = regN "glove" ;
|
||||
gold_N = regN "gold" ;
|
||||
good_A = mkADeg "good" "well" "better" "best" ;
|
||||
go_V = (mkV "go" "goes" "went" "gone" "going") ;
|
||||
green_A = regADeg "green" ;
|
||||
harbour_N = regN "harbour" ;
|
||||
hate_V2 = dirV2 (regV "hate") ;
|
||||
hat_N = regN "hat" ;
|
||||
have_V2 = dirV2 (mkV "have" "has" "had" "had" "having") ;
|
||||
hear_V2 = dirV2 (irregV "hear" "heard" "heard") ;
|
||||
hill_N = regN "hill" ;
|
||||
hope_VS = mkVS (regV "hope") ;
|
||||
horse_N = regN "horse" ;
|
||||
hot_A = regADeg "hot" ;
|
||||
house_N = regN "house" ;
|
||||
important_A = compoundADeg (regA "important") ;
|
||||
industry_N = regN "industry" ;
|
||||
iron_N = regN "iron" ;
|
||||
king_N = regN "king" ;
|
||||
know_V2 = dirV2 (irregV "know" "knew" "known") ;
|
||||
lake_N = regN "lake" ;
|
||||
lamp_N = regN "lamp" ;
|
||||
learn_V2 = dirV2 (regV "learn") ;
|
||||
leather_N = regN "leather" ;
|
||||
leave_V2 = dirV2 (irregV "leave" "left" "left") ;
|
||||
like_V2 = dirV2 (regV "like") ;
|
||||
listen_V2 = dirV2 (regV "listen") ;
|
||||
live_V = (regV "live") ;
|
||||
long_A = regADeg "long" ;
|
||||
lose_V2 = dirV2 (irregV "lose" "lost" "lost") ;
|
||||
love_N = regN "love" ;
|
||||
love_V2 = dirV2 (regV "love") ;
|
||||
man_N = mk2N "man" "men" ;
|
||||
married_A2 = mkA2 (regA "married") "to" ;
|
||||
meat_N = regN "meat" ;
|
||||
milk_N = regN "milk" ;
|
||||
moon_N = regN "moon" ;
|
||||
mother_N2 = regN2 "mother" ;
|
||||
mountain_N = regN "mountain" ;
|
||||
music_N = regN "music" ;
|
||||
narrow_A = regADeg "narrow" ;
|
||||
new_A = regADeg "new" ;
|
||||
newspaper_N = regN "newspaper" ;
|
||||
oil_N = regN "oil" ;
|
||||
old_A = regADeg "old" ;
|
||||
open_V2 = dirV2 (regV "open") ;
|
||||
-- paint_V2A = mkV2A (regV "paint") [] ;
|
||||
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" ;
|
||||
-- probable_AS = mkAS (regA "probable") ;
|
||||
queen_N = regN "queen" ;
|
||||
radio_N = regN "radio" ;
|
||||
-- rain_V0 = mkV0 (regV "rain") ;
|
||||
read_V2 = dirV2 (irregV "read" "read" "read") ;
|
||||
red_A = 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 = (irregDuplV "run" "ran" "run") ;
|
||||
say_VS = mkVS (irregV "say" "said" "said") ;
|
||||
school_N = regN "school" ;
|
||||
science_N = regN "science" ;
|
||||
sea_N = regN "sea" ;
|
||||
seek_V2 = dirV2 (irregV "seek" "sought" "sought") ;
|
||||
see_V2 = dirV2 (irregV "see" "saw" "seen") ;
|
||||
sell_V3 = dirV3 (irregV "sell" "sold" "sold") "to" ;
|
||||
send_V3 = dirV3 (irregV "send" "sent" "sent") "to" ;
|
||||
sheep_N = mk2N "sheep" "sheep" ;
|
||||
ship_N = regN "ship" ;
|
||||
shirt_N = regN "shirt" ;
|
||||
shoe_N = regN "shoe" ;
|
||||
shop_N = regN "shop" ;
|
||||
short_A = regADeg "short" ;
|
||||
silver_N = regN "silver" ;
|
||||
sister_N = regN "sister" ;
|
||||
sleep_V = (irregV "sleep" "slept" "slept") ;
|
||||
small_A = regADeg "small" ;
|
||||
snake_N = regN "snake" ;
|
||||
sock_N = regN "sock" ;
|
||||
speak_V2 = dirV2 (irregV "speak" "spoke" "spoken") ;
|
||||
star_N = regN "star" ;
|
||||
steel_N = regN "steel" ;
|
||||
stone_N = regN "stone" ;
|
||||
stove_N = regN "stove" ;
|
||||
student_N = regN "student" ;
|
||||
stupid_A = regADeg "stupid" ;
|
||||
sun_N = regN "sun" ;
|
||||
switch8off_V2 = dirV2 (partV (regV "switch") "off") ;
|
||||
switch8on_V2 = dirV2 (partV (regV "switch") "on") ;
|
||||
table_N = regN "table" ;
|
||||
talk_V3 = mkV3 (regV "talk") "to" "about" ;
|
||||
teacher_N = regN "teacher" ;
|
||||
teach_V2 = dirV2 (irregV "teach" "taught" "taught") ;
|
||||
television_N = regN "television" ;
|
||||
thick_A = regADeg "thick" ;
|
||||
thin_A = regADeg "thin" ;
|
||||
train_N = regN "train" ;
|
||||
travel_V = (regDuplV "travel") ;
|
||||
tree_N = regN "tree" ;
|
||||
---- trousers_N = regN "trousers" ;
|
||||
ugly_A = regADeg "ugly" ;
|
||||
understand_V2 = dirV2 (irregV "understand" "understood" "understood") ;
|
||||
university_N = regN "university" ;
|
||||
village_N = regN "village" ;
|
||||
wait_V2 = mkV2 (regV "wait") "for" ;
|
||||
walk_V = (regV "walk") ;
|
||||
warm_A = regADeg "warm" ;
|
||||
war_N = regN "war" ;
|
||||
watch_V2 = dirV2 (regV "watch") ;
|
||||
water_N = regN "water" ;
|
||||
white_A = regADeg "white" ;
|
||||
window_N = regN "window" ;
|
||||
wine_N = regN "wine" ;
|
||||
win_V2 = dirV2 (irregV "win" "won" "won") ;
|
||||
woman_N = mk2N "woman" "women" ;
|
||||
wonder_VQ = mkVQ (regV "wonder") ;
|
||||
wood_N = regN "wood" ;
|
||||
write_V2 = dirV2 (irregV "write" "wrote" "written") ;
|
||||
yellow_A = regADeg "yellow" ;
|
||||
young_A = regADeg "young" ;
|
||||
|
||||
do_V2 = dirV2 (mkV "do" "does" "did" "done" "doing") ;
|
||||
now_Adv = mkAdv "now" ;
|
||||
already_Adv = mkAdv "already" ;
|
||||
song_N = regN "song" ;
|
||||
add_V3 = dirV3 (regV "add") "to" ;
|
||||
number_N = regN "number" ;
|
||||
put_V2 = mkV2 (irregDuplV "put" "put" "put") [] ;
|
||||
stop_V = regDuplV "stop" ;
|
||||
jump_V = regV "jump" ;
|
||||
|
||||
here7to_Adv = mkAdv ["to here"] ;
|
||||
here7from_Adv = mkAdv ["from here"] ;
|
||||
there_Adv = mkAdv "there" ;
|
||||
there7to_Adv = mkAdv "there" ;
|
||||
there7from_Adv = mkAdv ["from there"] ;
|
||||
} ;
|
||||
63
lib/resource-1.0/english/CatEng.gf
Normal file
63
lib/resource-1.0/english/CatEng.gf
Normal file
@@ -0,0 +1,63 @@
|
||||
concrete CatEng of Cat = open ResEng, Prelude, (R = ParamX) in {
|
||||
|
||||
lincat
|
||||
Text, Phr, Utt = {s : Str} ;
|
||||
|
||||
Imp = {s : Polarity => Number => Str} ;
|
||||
|
||||
S = {s : Str} ;
|
||||
QS = {s : QForm => Str} ;
|
||||
RS = {s : Agr => Str} ;
|
||||
|
||||
Cl = {s : Tense => Anteriority => Polarity => Ord => Str} ;
|
||||
Slash = {s : Tense => Anteriority => Polarity => Ord => Str} ** {c2 : Str} ;
|
||||
|
||||
QCl = {s : Tense => Anteriority => Polarity => QForm => Str} ;
|
||||
RCl = {s : Tense => Anteriority => Polarity => Agr => Str} ;
|
||||
|
||||
VP = {
|
||||
s : Tense => Anteriority => Polarity => Ord => Agr => {fin, inf : Str} ;
|
||||
s2 : Agr => Str
|
||||
} ;
|
||||
|
||||
V, VS, VQ = Verb ; -- = {s : VForm => Str} ;
|
||||
V2, VV = Verb ** {c2 : Str} ;
|
||||
V3 = Verb ** {c2, c3 : Str} ;
|
||||
|
||||
AP = {s : Agr => Str ; isPre : Bool} ;
|
||||
Comp = {s : Agr => Str} ;
|
||||
|
||||
A = {s : AForm => Str} ;
|
||||
A2 = {s : AForm => Str ; c2 : Str} ;
|
||||
|
||||
Adv, AdV, AdA, AdS, AdN = {s : Str} ;
|
||||
Prep = {s : Str} ;
|
||||
|
||||
Det, Quant = {s : Str ; n : Number} ;
|
||||
Predet, Num, Ord = {s : Str} ;
|
||||
|
||||
CN,N = {s : Number => Case => Str} ;
|
||||
PN = {s : Case => Str} ;
|
||||
Pron, NP = {s : Case => Str ; a : Agr} ;
|
||||
N2 = {s : Number => Case => Str} ** {c2 : Str} ;
|
||||
N3 = {s : Number => Case => Str} ** {c2,c3 : Str} ;
|
||||
|
||||
IP = {s : Case => Str ; n : Number} ;
|
||||
IDet = {s : Str ; n : Number} ;
|
||||
IAdv = {s : Str} ;
|
||||
|
||||
RP = {s : Case => Str ; a : RAgr} ;
|
||||
|
||||
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} ;
|
||||
|
||||
}
|
||||
35
lib/resource-1.0/english/ConjunctionEng.gf
Normal file
35
lib/resource-1.0/english/ConjunctionEng.gf
Normal file
@@ -0,0 +1,35 @@
|
||||
concrete ConjunctionEng of Conjunction =
|
||||
CatEng ** open ResEng, Coordination, Prelude 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
|
||||
} ;
|
||||
|
||||
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} ;
|
||||
|
||||
}
|
||||
21
lib/resource-1.0/english/LangEng.gf
Normal file
21
lib/resource-1.0/english/LangEng.gf
Normal file
@@ -0,0 +1,21 @@
|
||||
--# -path=.:prelude
|
||||
|
||||
concrete LangEng of Lang =
|
||||
NounEng,
|
||||
VerbEng,
|
||||
AdjectiveEng,
|
||||
AdverbEng,
|
||||
NumeralEng,
|
||||
SentenceEng,
|
||||
QuestionEng,
|
||||
RelativeEng,
|
||||
ConjunctionEng,
|
||||
PhraseEng,
|
||||
TensedEng,
|
||||
StructuralEng,
|
||||
BasicEng
|
||||
** {
|
||||
|
||||
flags startcat = Phr ;
|
||||
|
||||
} ;
|
||||
60
lib/resource-1.0/english/LexEng.gf
Normal file
60
lib/resource-1.0/english/LexEng.gf
Normal file
@@ -0,0 +1,60 @@
|
||||
concrete LexEng of Lex = CatEng ** open ResEng, Prelude in {
|
||||
|
||||
lin
|
||||
walk_V = regV "walk" ;
|
||||
help_V2 = regV "help" ** {c2 = []} ;
|
||||
show_V3 = regV "show" ** {c2 = [] ; c3 = "to"} ;
|
||||
want_VV = regV "want" ** {c2 = "to"} ;
|
||||
claim_VS = regV "claim" ;
|
||||
ask_VQ = regV "ask" ;
|
||||
|
||||
dog_N = regN "dog" ;
|
||||
son_N2 = regN "son" ** {c2 = "of"} ;
|
||||
way_N3 = regN "way" ** {c2 = "from" ; c3 = "to"} ;
|
||||
|
||||
warm_A = regA "warm" ;
|
||||
close_A2 = regA "close" ** {c2 = "to"} ;
|
||||
|
||||
here_Adv = {s = "here"} ;
|
||||
very_AdA = {s = "very"} ;
|
||||
always_AdV = {s = "always"} ;
|
||||
|
||||
only_Predet = {s = "only"} ;
|
||||
all_Predet = {s = "only"} ;
|
||||
this_Quant = {s = "this" ; n = Sg} ;
|
||||
these_Quant = {s = "these" ; n = Pl} ;
|
||||
|
||||
i_Pron = mkNP "I" "me" "my" Sg P1 ;
|
||||
he_Pron = mkNP "he" "him" "his" Sg P3 ;
|
||||
we_Pron = mkNP "we" "us" "our" Pl P1 ;
|
||||
|
||||
whoSg_IP = mkIP "who" "whom" "whose" Sg ;
|
||||
whoPl_IP = mkIP "who" "whom" "whose" Pl ;
|
||||
|
||||
when_IAdv = {s = "when"} ;
|
||||
where_IAdv = {s = "where"} ;
|
||||
why_IAdv = {s = "why"} ;
|
||||
|
||||
whichSg_IDet = {s = "which" ; n = Sg} ;
|
||||
whichPl_IDet = {s = "which" ; n = Pl} ;
|
||||
|
||||
one_Numeral = {s = table {NCard => "one" ; NOrd => "first"} ; n = Sg} ;
|
||||
forty_Numeral = {s = table {NCard => "forty" ; NOrd => "fortieth"} ; n = Pl} ;
|
||||
|
||||
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" ;
|
||||
|
||||
}
|
||||
226
lib/resource-1.0/english/MorphoEng.gf
Normal file
226
lib/resource-1.0/english/MorphoEng.gf
Normal file
@@ -0,0 +1,226 @@
|
||||
--# -path=.:../../prelude
|
||||
|
||||
--1 A Simple English Resource Morphology
|
||||
--
|
||||
-- Aarne Ranta 2002 -- 2005
|
||||
--
|
||||
-- This resource morphology contains definitions needed in the resource
|
||||
-- syntax. To build a lexicon, it is better to use $ParadigmsEng$, which
|
||||
-- gives a higher-level access to this module.
|
||||
|
||||
resource MorphoEng = ResEng ** open Prelude, (Predef=Predef) in {
|
||||
|
||||
flags optimize=all ;
|
||||
|
||||
--2 Phonology
|
||||
--
|
||||
-- To regulate the use of endings for both nouns, adjectives, and verbs:
|
||||
|
||||
oper
|
||||
y2ie : Str -> Str -> Str = \fly,s ->
|
||||
let y = last (init fly) in
|
||||
case y of {
|
||||
"a" => fly + s ;
|
||||
"e" => fly + s ;
|
||||
"o" => fly + s ;
|
||||
"u" => fly + s ;
|
||||
_ => init fly + "ie" + s
|
||||
} ;
|
||||
|
||||
|
||||
--2 Nouns
|
||||
--
|
||||
-- For conciseness and abstraction, we define a worst-case macro for
|
||||
-- noun inflection. It is used for defining special case that
|
||||
-- only need one string as argument.
|
||||
|
||||
oper
|
||||
CommonNoun : Type = {s : Number => Case => Str} ;
|
||||
|
||||
mkNoun : (_,_,_,_ : Str) -> CommonNoun =
|
||||
\man,men, mans, mens -> {s = table {
|
||||
Sg => table {Gen => mans ; _ => man} ;
|
||||
Pl => table {Gen => mens ; _ => men}
|
||||
}} ;
|
||||
|
||||
nounGen : Str -> CommonNoun = \dog -> case last dog of {
|
||||
"y" => nounY "dog" ;
|
||||
"s" => nounS (init "dog") ;
|
||||
_ => nounReg "dog"
|
||||
} ;
|
||||
|
||||
-- These are auxiliaries to $nounGen$.
|
||||
|
||||
nounReg : Str -> CommonNoun = \dog ->
|
||||
mkNoun dog (dog + "s") (dog + "'s") (dog + "s'");
|
||||
nounS : Str -> CommonNoun = \kiss ->
|
||||
mkNoun kiss (kiss + "es") (kiss + "'s") (kiss + "es'") ;
|
||||
nounY : Str -> CommonNoun = \fl ->
|
||||
mkNoun (fl + "y") (fl + "ies") (fl + "y's") (fl + "ies'") ;
|
||||
|
||||
|
||||
--3 Proper names
|
||||
--
|
||||
-- Regular proper names are inflected with "'s" in the genitive.
|
||||
|
||||
nameReg : Str -> Gender -> {s : Case => Str} = \john,g ->
|
||||
{s = table {Gen => john + "'s" ; _ => john} ; g = g} ;
|
||||
|
||||
--2 Determiners
|
||||
|
||||
mkDeterminer : Number -> Str -> {s : Str ; n : Number} = \n,s ->
|
||||
{s = s ; n = n} ;
|
||||
|
||||
--2 Pronouns
|
||||
--
|
||||
-- Here we define personal pronouns.
|
||||
--
|
||||
-- We record the form "mine" and the gender for later use.
|
||||
|
||||
Pronoun : Type =
|
||||
{s : Case => Str ; a : Agr ; g : Gender} ;
|
||||
|
||||
mkPronoun : (_,_,_,_ : Str) -> Number -> Person -> Gender -> Pronoun =
|
||||
\I,me,my,mine,n,p,g ->
|
||||
{s = table {Nom => I ; Acc => me ; Gen => my} ;
|
||||
a = {n = n ; p = p} ;
|
||||
g = g
|
||||
} ;
|
||||
|
||||
human : Gender = Masc ; --- doesn't matter
|
||||
|
||||
pronI = mkPronoun "I" "me" "my" "mine" Sg P1 human ;
|
||||
pronYouSg = mkPronoun "you" "you" "your" "yours" Sg P2 human ; -- verb agr OK
|
||||
pronHe = mkPronoun "he" "him" "his" "his" Sg P3 Masc ;
|
||||
pronShe = mkPronoun "she" "her" "her" "hers" Sg P3 Fem ;
|
||||
pronIt = mkPronoun "it" "it" "its" "it" Sg P3 Neutr ;
|
||||
|
||||
pronWe = mkPronoun "we" "us" "our" "ours" Pl P1 human ;
|
||||
pronYouPl = mkPronoun "you" "you" "your" "yours" Pl P2 human ;
|
||||
pronThey = mkPronoun "they" "them" "their" "theirs" Pl P3 human ; ---
|
||||
|
||||
|
||||
--2 Adjectives
|
||||
--
|
||||
-- To form the adjectival and the adverbial forms, two strings are needed
|
||||
-- in the worst case. (First without degrees.)
|
||||
|
||||
Adjective = {s : AForm => Str} ;
|
||||
|
||||
mkAdjective : (_,_,_,_ : Str) -> Adjective = \free,freer,freest,freely -> {
|
||||
s = table {
|
||||
AAdj Posit => free ;
|
||||
AAdj Compar => freer ;
|
||||
AAdj Superl => freest ;
|
||||
AAdv => freely
|
||||
}
|
||||
} ;
|
||||
|
||||
-- However, most adjectives can be inflected using the final character.
|
||||
-- N.B. this is not correct for "shy", but $mkAdjective$ has to be used.
|
||||
|
||||
regAdjective : Str -> Adjective = \free ->
|
||||
let
|
||||
e = last free ;
|
||||
fre = init free ;
|
||||
freely = case e of {
|
||||
"y" => fre + "ily" ;
|
||||
_ => free + "ly"
|
||||
} ;
|
||||
fre = case e of {
|
||||
"e" => fre ;
|
||||
"y" => fre + "i" ;
|
||||
_ => free
|
||||
}
|
||||
in
|
||||
mkAdjective free (fre + "er") (fre + "est") freely ;
|
||||
|
||||
-- Many adjectives are 'inflected' by adding a comparison word.
|
||||
|
||||
adjDegrLong : Str -> Adjective = \ridiculous ->
|
||||
mkAdjective
|
||||
ridiculous
|
||||
("more" ++ ridiculous)
|
||||
("most" ++ ridiculous)
|
||||
((regAdjective ridiculous).s ! AAdv) ;
|
||||
|
||||
|
||||
--3 Verbs
|
||||
--
|
||||
-- The worst case needs five forms. (The verb "be" is treated separately.)
|
||||
|
||||
mkVerbWorst : (_,_,_,_,_: Str) -> Verb = \go,goes,went,gone,going ->
|
||||
{s = table {
|
||||
VInf => go ;
|
||||
VPres => goes ;
|
||||
VPast => went ;
|
||||
VPPart => gone ;
|
||||
VPresPart => going
|
||||
}
|
||||
} ;
|
||||
|
||||
mkVerb4 : (_,_,_,_: Str) -> Verb = \go,goes,went,gone ->
|
||||
let going = case last go of {
|
||||
"e" => init go + "ing" ;
|
||||
_ => go + "ing"
|
||||
}
|
||||
in
|
||||
mkVerbWorst go goes went gone going ;
|
||||
|
||||
-- This is what we use to derive the irregular forms in almost all cases
|
||||
|
||||
mkVerbIrreg : (_,_,_ : Str) -> Verb = \bite,bit,bitten ->
|
||||
let bites = case last bite of {
|
||||
"y" => y2ie bite "s" ;
|
||||
"s" => init bite + "es" ;
|
||||
_ => bite + "s"
|
||||
}
|
||||
in mkVerb4 bite bites bit bitten ;
|
||||
|
||||
-- This is used to derive regular forms.
|
||||
|
||||
mkVerbReg : Str -> Verb = \soak ->
|
||||
let
|
||||
soaks = case last soak of {
|
||||
"y" => y2ie soak "s" ;
|
||||
"s" => init soak + "es" ;
|
||||
_ => soak + "s"
|
||||
} ;
|
||||
soaked = case last soak of {
|
||||
"e" => init soak + "s" ;
|
||||
_ => soak + "ed"
|
||||
}
|
||||
in
|
||||
mkVerb4 soak soaks soaked soaked ;
|
||||
|
||||
mkVerb : (_,_,_ : Str) -> Verb = \ring,rang,rung ->
|
||||
mkVerb4 ring (ring + "s") rang rung ;
|
||||
|
||||
verbGen : Str -> Verb = \kill -> case last kill of {
|
||||
"y" => verbP3y (init kill) ;
|
||||
"e" => verbP3e (init kill) ;
|
||||
"s" => verbP3s (init kill) ;
|
||||
_ => regVerbP3 kill
|
||||
} ;
|
||||
|
||||
-- These are just auxiliary to $verbGen$.
|
||||
|
||||
regVerbP3 : Str -> Verb = \walk ->
|
||||
mkVerb walk (walk + "ed") (walk + "ed") ;
|
||||
verbP3s : Str -> Verb = \kiss ->
|
||||
mkVerb4 kiss (kiss + "es") (kiss + "ed") (kiss + "ed") ;
|
||||
verbP3e : Str -> Verb = \love ->
|
||||
mkVerb4 love (love + "s") (love + "d") (love + "d") ;
|
||||
verbP3y : Str -> Verb = \cr ->
|
||||
mkVerb4 (cr + "y") (cr + "ies") (cr + "ied") (cr + "ied") ;
|
||||
|
||||
--- The particle always appears right after the verb.
|
||||
|
||||
verbPart : Verb -> Str -> Verb = \v,p ->
|
||||
{s = \\f => v.s ! f ++ p} ;
|
||||
|
||||
verbNoPart : Verb -> Verb = \v -> verbPart v [] ;
|
||||
|
||||
|
||||
} ;
|
||||
|
||||
47
lib/resource-1.0/english/NounEng.gf
Normal file
47
lib/resource-1.0/english/NounEng.gf
Normal file
@@ -0,0 +1,47 @@
|
||||
concrete NounEng of Noun = CatEng ** open ResEng, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
DetCN det cn = {s = \\c => det.s ++ cn.s ! det.n ! c} ** agrP3 det.n ;
|
||||
UsePN pn = pn ** agrP3 Sg ;
|
||||
UsePron p = p ;
|
||||
|
||||
MkDet pred quant num ord = {
|
||||
s = pred.s ++ quant.s ++ num.s ++ ord.s ;
|
||||
n = quant.n
|
||||
} ;
|
||||
|
||||
PossPronSg p = {s = p.s ! Gen ; n = Sg} ;
|
||||
PossPronPl p = {s = p.s ! Gen ; n = Pl} ;
|
||||
|
||||
NoPredet, NoNum, NoOrd = {s = []} ;
|
||||
NumInt n = n ;
|
||||
|
||||
NumNumeral numeral = {s = numeral.s ! NCard} ;
|
||||
OrdNumeral numeral = {s = numeral.s ! NOrd} ;
|
||||
|
||||
AdNum adn num = {s = adn.s ++ num.s} ;
|
||||
|
||||
OrdSuperl a = {s = a.s ! AAdj Superl} ;
|
||||
|
||||
DefSg = {s = artDef ; n = Sg} ;
|
||||
DefPl = {s = artDef ; n = Pl} ;
|
||||
|
||||
IndefSg = {s = artIndef ; n = Sg} ;
|
||||
IndefPl = {s = [] ; n = Pl} ;
|
||||
|
||||
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 ! (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} ;
|
||||
QuestCN cn qs = {s = \\n,c => cn.s ! n ! c ++ qs.s ! QIndir} ;
|
||||
|
||||
UseN n = n ;
|
||||
|
||||
}
|
||||
44
lib/resource-1.0/english/NumeralEng.gf
Normal file
44
lib/resource-1.0/english/NumeralEng.gf
Normal file
@@ -0,0 +1,44 @@
|
||||
concrete NumeralEng of Numeral = CatEng ** open ResEng in {
|
||||
|
||||
lincat
|
||||
Digit = {s : DForm => CardOrd => Str} ;
|
||||
Sub10 = {s : DForm => CardOrd => Str ; n : Number} ;
|
||||
Sub100 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
|
||||
lin num x = x ;
|
||||
lin n2 = let two = mkNum "two" "twelve" "twenty" "second" in
|
||||
{s = \\f,c => case <f,c> of {
|
||||
<teen,NOrd> => "twelfth" ;
|
||||
_ => two.s ! f ! c
|
||||
}
|
||||
} ;
|
||||
|
||||
lin n3 = mkNum "three" "thirteen" "thirty" "third" ;
|
||||
lin n4 = mkNum "four" "fourteen" "forty" "fourth" ;
|
||||
lin n5 = mkNum "five" "fifteen" "fifty" "fifth" ;
|
||||
lin n6 = regNum "six" ;
|
||||
lin n7 = regNum "seven" ;
|
||||
lin n8 = mkNum "eight" "eighteen" "eighty" "eighth" ;
|
||||
lin n9 = regNum "nine" ;
|
||||
|
||||
lin pot01 = mkNum "one" "eleven" "ten" "first" ** {n = Sg} ;
|
||||
lin pot0 d = d ** {n = Pl} ;
|
||||
lin pot110 = regCardOrd "ten" ** {n = Pl} ;
|
||||
lin pot111 = regCardOrd "eleven" ** {n = Pl} ;
|
||||
lin pot1to19 d = {s = d.s ! teen} ** {n = Pl} ;
|
||||
lin pot0as1 n = {s = n.s ! unit} ** {n = n.n} ;
|
||||
lin pot1 d = {s = d.s ! ten} ** {n = Pl} ;
|
||||
lin pot1plus d e = {
|
||||
s = \\c => d.s ! ten ! NCard ++ "-" ++ e.s ! unit ! c ; n = Pl} ;
|
||||
lin pot1as2 n = n ;
|
||||
lin pot2 d = {s = \\c => d.s ! unit ! NCard ++ mkCard c "hundred"} ** {n = Pl} ;
|
||||
lin pot2plus d e = {
|
||||
s = \\c => d.s ! unit ! NCard ++ "hundred" ++ "and" ++ e.s ! c ; n = Pl} ;
|
||||
lin pot2as3 n = n ;
|
||||
lin pot3 n = {
|
||||
s = \\c => n.s ! NCard ++ mkCard c "thousand" ; n = Pl} ;
|
||||
lin pot3plus n m = {
|
||||
s = \\c => n.s ! NCard ++ "thousand" ++ m.s ! c ; n = Pl} ;
|
||||
}
|
||||
59
lib/resource-1.0/english/ParamEng.gf
Normal file
59
lib/resource-1.0/english/ParamEng.gf
Normal file
@@ -0,0 +1,59 @@
|
||||
--1 English parameters
|
||||
--
|
||||
-- This module defines the parameter types specific to English.
|
||||
-- Some parameters, such as $Number$, are inherited from $ParamX$.
|
||||
|
||||
resource ParamEng = ParamX ** {
|
||||
|
||||
--2 For $Noun$
|
||||
|
||||
-- This is the worst-case $Case$ needed for pronouns.
|
||||
|
||||
param
|
||||
Case = Nom | Acc | Gen ;
|
||||
|
||||
-- Agreement of $NP$ is a record. We'll add $Gender$ later.
|
||||
|
||||
oper
|
||||
Agr = {n : Number ; p : Person} ;
|
||||
|
||||
param
|
||||
Gender = Neutr | Masc | Fem ;
|
||||
|
||||
--2 For $Verb$
|
||||
|
||||
-- Only these five forms are needed for open-lexicon verbs.
|
||||
|
||||
param
|
||||
VForm = VInf | VPres | VPast | VPPart | VPresPart ;
|
||||
|
||||
-- The order of sentence is needed already in $VP$.
|
||||
|
||||
Ord = ODir | OQuest ;
|
||||
|
||||
|
||||
--2 For $Adjective$
|
||||
|
||||
AForm = AAdj Degree | AAdv ;
|
||||
|
||||
--2 For $Relative$
|
||||
|
||||
RAgr = RNoAg | RAg {n : Number ; p : Person} ;
|
||||
|
||||
--2 For $Numeral$
|
||||
|
||||
CardOrd = NCard | NOrd ;
|
||||
DForm = unit | teen | ten ;
|
||||
|
||||
--2 Transformations between parameter types
|
||||
|
||||
oper
|
||||
agrP3 : Number -> {a : Agr} = \n ->
|
||||
{a = {n = n ; p = P3}} ;
|
||||
|
||||
conjAgr : Agr -> Agr -> Agr = \a,b -> {
|
||||
n = conjNumber a.n b.n ;
|
||||
p = conjPerson a.p b.p
|
||||
} ;
|
||||
|
||||
}
|
||||
23
lib/resource-1.0/english/PhraseEng.gf
Normal file
23
lib/resource-1.0/english/PhraseEng.gf
Normal file
@@ -0,0 +1,23 @@
|
||||
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} ;
|
||||
UttVP vp = {s = "to" ++ infVP vp (agrP3 Sg).a} ;
|
||||
UttAdv adv = adv ;
|
||||
|
||||
NoPConj = {s = []} ;
|
||||
PConjConj conj = conj ;
|
||||
|
||||
NoVoc = {s = []} ;
|
||||
VocNP np = {s = "," ++ np.s ! Nom} ;
|
||||
|
||||
}
|
||||
61
lib/resource-1.0/english/QuestionEng.gf
Normal file
61
lib/resource-1.0/english/QuestionEng.gf
Normal file
@@ -0,0 +1,61 @@
|
||||
concrete QuestionEng of Question = CatEng ** open ResEng in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
|
||||
QuestCl cl = {
|
||||
s = \\t,a,p =>
|
||||
let cls = cl.s ! t ! a ! p
|
||||
in table {
|
||||
QDir => cls ! OQuest ;
|
||||
QIndir => "if" ++ cls ! ODir
|
||||
} ---- "whether" in ExtEng
|
||||
} ;
|
||||
|
||||
QuestVP qp vp = {
|
||||
s = \\t,a,b,q =>
|
||||
let
|
||||
agr = {n = qp.n ; p = P3} ;
|
||||
verb = vp.s ! t ! a ! b ! ODir ! agr ;
|
||||
subj = qp.s ! Nom ;
|
||||
compl = vp.s2 ! agr
|
||||
in
|
||||
subj ++ verb.fin ++ verb.inf ++ compl
|
||||
} ;
|
||||
|
||||
QuestSlash ip slash = {
|
||||
s = \\t,a,p =>
|
||||
let
|
||||
cls = slash.s ! t ! a ! p ;
|
||||
who = slash.c2 ++ ip.s ! Acc --- stranding in ExtEng
|
||||
in table {
|
||||
QDir => who ++ cls ! OQuest ;
|
||||
QIndir => who ++ cls ! ODir
|
||||
}
|
||||
} ;
|
||||
|
||||
QuestIAdv iadv cl = {
|
||||
s = \\t,a,p =>
|
||||
let
|
||||
cls = cl.s ! t ! a ! p ;
|
||||
why = iadv.s
|
||||
in table {
|
||||
QDir => why ++ cls ! OQuest ;
|
||||
QIndir => why ++ cls ! ODir
|
||||
}
|
||||
} ;
|
||||
|
||||
PrepIP p ip = {s = p.s ++ ip.s ! Nom} ;
|
||||
|
||||
AdvIP ip adv = {
|
||||
s = \\c => ip.s ! c ++ adv.s ;
|
||||
n = ip.n
|
||||
} ;
|
||||
|
||||
IDetCN idet num ord cn = {
|
||||
s = \\c => idet.s ++ num.s ++ ord.s ++ cn.s ! idet.n ! c ;
|
||||
n = idet.n
|
||||
} ;
|
||||
|
||||
}
|
||||
36
lib/resource-1.0/english/RelativeEng.gf
Normal file
36
lib/resource-1.0/english/RelativeEng.gf
Normal file
@@ -0,0 +1,36 @@
|
||||
concrete RelativeEng of Relative = CatEng ** open ResEng in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
|
||||
RelCl cl = {
|
||||
s = \\t,a,p,_ => "such" ++ "that" ++ cl.s ! t ! a ! p ! ODir
|
||||
} ;
|
||||
|
||||
RelVP rp vp = {
|
||||
s = \\t,ant,b,ag =>
|
||||
let
|
||||
agr = case rp.a of {
|
||||
RNoAg => ag ;
|
||||
RAg a => a
|
||||
} ;
|
||||
verb = vp.s ! t ! ant ! b ! ODir ! agr ;
|
||||
subj = rp.s ! Nom ;
|
||||
compl = vp.s2 ! agr
|
||||
in
|
||||
subj ++ verb.fin ++ verb.inf ++ compl
|
||||
} ;
|
||||
|
||||
RelSlash rp slash = {
|
||||
s = \\t,a,p,_ => slash.c2 ++ rp.s ! Acc ++ slash.s ! t ! a ! p ! ODir
|
||||
} ;
|
||||
|
||||
FunRP p np rp = {
|
||||
s = \\c => np.s ! c ++ p.s ++ rp.s ! Acc ;
|
||||
a = RAg np.a
|
||||
} ;
|
||||
|
||||
IdRP = mkIP "which" "which" "whose" Sg ** {a = RNoAg} ;
|
||||
|
||||
}
|
||||
235
lib/resource-1.0/english/ResEng.gf
Normal file
235
lib/resource-1.0/english/ResEng.gf
Normal file
@@ -0,0 +1,235 @@
|
||||
--1 English auxiliary operations.
|
||||
|
||||
-- This module contains operations that are needed to make the
|
||||
-- resource syntax work. To define everything that is needed to
|
||||
-- implement $Test$, it moreover contains regular lexical
|
||||
-- patterns needed for $Lex$.
|
||||
|
||||
resource ResEng = ParamEng ** open Prelude in {
|
||||
|
||||
flags optimize=all ;
|
||||
|
||||
oper
|
||||
|
||||
-- For $Lex$.
|
||||
|
||||
regN : Str -> {s : Number => Case => Str} = \car -> {
|
||||
s = table {
|
||||
Sg => table {
|
||||
Gen => car + "'s" ;
|
||||
_ => car
|
||||
} ;
|
||||
Pl => table {
|
||||
Gen => car + "s'" ;
|
||||
_ => car + "s"
|
||||
}
|
||||
}
|
||||
} ;
|
||||
|
||||
regA : Str -> {s : AForm => Str} = \warm -> {
|
||||
s = table {
|
||||
AAdj Posit => warm ;
|
||||
AAdj Compar => warm + "er" ;
|
||||
AAdj Superl => warm + "est" ;
|
||||
AAdv => warm + "ly"
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
regV : Str -> {s : VForm => Str} = \walk -> {
|
||||
s = table {
|
||||
VInf => walk ;
|
||||
VPres => walk + "s" ;
|
||||
VPast | VPPart => walk + "ed" ;
|
||||
VPresPart => walk + "ing"
|
||||
}
|
||||
} ;
|
||||
|
||||
mkIP : (i,me,my : Str) -> Number -> {s : Case => Str ; n : Number} =
|
||||
\i,me,my,n -> let who = mkNP i me my n P3 in {s = who.s ; n = n} ;
|
||||
|
||||
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
|
||||
}
|
||||
} ;
|
||||
|
||||
regNP : Str -> Number -> {s : Case => Str ; a : Agr} = \that,n ->
|
||||
mkNP that that (that + "'s") n P3 ;
|
||||
|
||||
-- We have just a heuristic definition of the indefinite article.
|
||||
-- There are lots of exceptions: consonantic "e" ("euphemism"), consonantic
|
||||
-- "o" ("one-sided"), vocalic "u" ("umbrella").
|
||||
|
||||
artIndef = pre {
|
||||
"a" ;
|
||||
"an" / strs {"a" ; "e" ; "i" ; "o" ; "A" ; "E" ; "I" ; "O" }
|
||||
} ;
|
||||
|
||||
artDef = "the" ;
|
||||
|
||||
-- For $Verb$.
|
||||
|
||||
Verb : Type = {
|
||||
s : VForm => Str
|
||||
} ;
|
||||
|
||||
VP : Type = {
|
||||
s : Tense => Anteriority => Polarity => Ord => Agr => {fin, inf : Str} ;
|
||||
s2 : Agr => Str
|
||||
} ;
|
||||
|
||||
predV : Verb -> VP = \verb -> {
|
||||
s = \\t,ant,b,ord,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,Pos,ODir> => vf fin [] ;
|
||||
<Pres,Simul,Pos,OQuest> => vf (does agr) inf ;
|
||||
<Pres,Simul,Neg,_> => vf (doesnt agr) inf ;
|
||||
<Pres,Anter,Pos,_> => vf (have agr) part ;
|
||||
<Pres,Anter,Neg,_> => vf (havent agr) part ;
|
||||
<Past,Simul,Pos,ODir> => vf past [] ;
|
||||
<Past,Simul,Pos,OQuest> => vf "did" inf ;
|
||||
<Past,Simul,Neg,_> => vf "didn't" inf ;
|
||||
<Past,Anter,Pos,_> => vf "had" part ;
|
||||
<Past,Anter,Neg,_> => vf "hadn't" part ;
|
||||
<Fut, Simul,Pos,_> => vf "will" inf ;
|
||||
<Fut, Simul,Neg,_> => vf "won't" inf ;
|
||||
<Fut, Anter,Pos,_> => vf "will" ("have" ++ part) ;
|
||||
<Fut, Anter,Neg,_> => vf "won't" ("have" ++ part) ;
|
||||
<Cond,Simul,Pos,_> => vf "would" inf ;
|
||||
<Cond,Simul,Neg,_> => vf "wouldn't" inf ;
|
||||
<Cond,Anter,Pos,_> => vf "would" ("have" ++ part) ;
|
||||
<Cond,Anter,Neg,_> => vf "wouldn't" ("have" ++ part)
|
||||
} ;
|
||||
s2 = \\_ => []
|
||||
} ;
|
||||
|
||||
predAux : Aux -> VP = \verb -> {
|
||||
s = \\t,ant,b,ord,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,Pos,_> => vf (have agr) part ;
|
||||
<Pres,Anter,Neg,_> => vf (havent agr) part ;
|
||||
<Past,Simul,_, _> => vf fin [] ;
|
||||
<Past,Anter,Pos,_> => vf "had" part ;
|
||||
<Past,Anter,Neg,_> => vf "hadn't" part ;
|
||||
<Fut, Simul,Pos,_> => vf "will" inf ;
|
||||
<Fut, Simul,Neg,_> => vf "won't" inf ;
|
||||
<Fut, Anter,Pos,_> => vf "will" ("have" ++ part) ;
|
||||
<Fut, Anter,Neg,_> => vf "won't" ("have" ++ part) ;
|
||||
<Cond,Simul,Pos,_> => vf "would" inf ;
|
||||
<Cond,Simul,Neg,_> => vf "wouldn't" inf ;
|
||||
<Cond,Anter,Pos,_> => vf "would" ("have" ++ part) ;
|
||||
<Cond,Anter,Neg,_> => vf "wouldn't" ("have" ++ part)
|
||||
} ;
|
||||
s2 = \\_ => []
|
||||
} ;
|
||||
|
||||
insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> {
|
||||
s = vp.s ;
|
||||
s2 = \\a => vp.s2 ! a ++ obj ! a
|
||||
} ;
|
||||
|
||||
--- This is not functional.
|
||||
|
||||
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) ;
|
||||
|
||||
infVP : VP -> Agr -> Str = \vp,a ->
|
||||
(vp.s ! Fut ! Simul ! Neg ! ODir ! 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 : Polarity => Agr => Str ; inf,ppart : Str} ;
|
||||
|
||||
auxBe : Aux = {
|
||||
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"
|
||||
} ;
|
||||
|
||||
posneg : Polarity -> Str -> Str = \p,s -> case p of {
|
||||
Pos => s ;
|
||||
Neg => s + "n't"
|
||||
} ;
|
||||
|
||||
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 $Numeral$.
|
||||
|
||||
mkNum : Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Str} =
|
||||
\two, twelve, twenty, second ->
|
||||
{s = table {
|
||||
unit => table {NCard => two ; NOrd => second} ;
|
||||
teen => \\c => mkCard c twelve ;
|
||||
ten => \\c => mkCard c twenty
|
||||
}
|
||||
} ;
|
||||
|
||||
regNum : Str -> {s : DForm => CardOrd => Str} =
|
||||
\six -> mkNum six (six + "teen") (six + "ty") (regOrd six) ;
|
||||
|
||||
regCardOrd : Str -> {s : CardOrd => Str} = \ten ->
|
||||
{s = table {NCard => ten ; NOrd => regOrd ten}} ;
|
||||
|
||||
mkCard : CardOrd -> Str -> Str = \c,ten ->
|
||||
(regCardOrd ten).s ! c ;
|
||||
|
||||
regOrd : Str -> Str = \ten ->
|
||||
case last ten of {
|
||||
"y" => init ten + "ieth" ;
|
||||
_ => ten + "th"
|
||||
} ;
|
||||
|
||||
}
|
||||
71
lib/resource-1.0/english/SentenceEng.gf
Normal file
71
lib/resource-1.0/english/SentenceEng.gf
Normal file
@@ -0,0 +1,71 @@
|
||||
concrete SentenceEng of Sentence = CatEng ** open ResEng in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
PredVP np vp = {
|
||||
s = \\t,a,b,o =>
|
||||
let
|
||||
agr = np.a ;
|
||||
verb = vp.s ! t ! a ! b ! o ! 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
|
||||
}
|
||||
} ;
|
||||
|
||||
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
|
||||
agr = np.a ;
|
||||
verb = (predV v2).s ! t ! a ! b ! o ! agr ;
|
||||
subj = np.s ! Nom
|
||||
in
|
||||
case o of {
|
||||
ODir => subj ++ verb.fin ++ verb.inf ;
|
||||
OQuest => verb.fin ++ subj ++ verb.inf
|
||||
} ;
|
||||
c2 = v2.c2
|
||||
} ;
|
||||
--- not possible:
|
||||
--- PredVP (np ** {lock_NP =<>}) (UseV (v2 ** {lock_V = <>})) ** {c2 = v2.c2} ;
|
||||
|
||||
SlashVVV2 np vv v2 = {
|
||||
s = \\t,a,b,o =>
|
||||
let
|
||||
agr = np.a ;
|
||||
verb = (predV vv).s ! t ! a ! b ! o ! agr ;
|
||||
inf = "to" ++ v2.s ! VInf ;
|
||||
subj = np.s ! Nom
|
||||
in
|
||||
case o of {
|
||||
ODir => subj ++ verb.fin ++ verb.inf ++ inf ;
|
||||
OQuest => verb.fin ++ subj ++ verb.inf ++ inf
|
||||
} ;
|
||||
c2 = v2.c2
|
||||
} ;
|
||||
|
||||
AdvSlash slash adv = {
|
||||
s = \\t,a,b,o => slash.s ! t ! a ! b ! o ++ adv.s ;
|
||||
c2 = slash.c2
|
||||
} ;
|
||||
|
||||
SlashPrep cl prep = cl ** {c2 = prep.s} ;
|
||||
|
||||
}
|
||||
95
lib/resource-1.0/english/StructuralEng.gf
Normal file
95
lib/resource-1.0/english/StructuralEng.gf
Normal file
@@ -0,0 +1,95 @@
|
||||
concrete StructuralEng of Structural = CatEng **
|
||||
open MorphoEng, Prelude in {
|
||||
|
||||
flags optimize=all ;
|
||||
|
||||
lin
|
||||
above_Prep = ss "above" ;
|
||||
after_Prep = ss "after" ;
|
||||
all_Predet = ss "all" ;
|
||||
almost_AdA, almost_AdN = ss "almost" ;
|
||||
although_Subj = ss "although" ;
|
||||
always_AdV = ss "always" ;
|
||||
and_Conj = ss "and" ** {n = Pl} ;
|
||||
because_Subj = ss "because" ;
|
||||
before_Prep = ss "before" ;
|
||||
behind_Prep = ss "behind" ;
|
||||
between_Prep = ss "between" ;
|
||||
both7and_DConj = sd2 "both" "and" ** {n = Pl} ;
|
||||
but_PConj = ss "but" ;
|
||||
by8agent_Prep = ss "by" ;
|
||||
by8means_Prep = ss "by" ;
|
||||
can8know_VV = verbPart (mkVerbIrreg "know" "knew" "known") "how"** {c2 = "to"} ;---
|
||||
can_VV = verbGen "manage" ** {c2 = "to"} ; ---
|
||||
during_Prep = ss "during" ;
|
||||
either7or_DConj = sd2 "either" "or" ** {n = Sg} ;
|
||||
everybody_NP = regNP "everybody" Sg ;
|
||||
every_Det = mkDeterminer Sg "every" ;
|
||||
everything_NP = regNP "everything" Sg ;
|
||||
everywhere_Adv = ss "everywhere" ;
|
||||
from_Prep = ss "from" ;
|
||||
he_Pron = mkNP "he" "him" "his" Sg P3 ;
|
||||
here_Adv = ss "here" ;
|
||||
how_IAdv = ss "how" ;
|
||||
how8many_IDet = mkDeterminer Pl ["how many"] ;
|
||||
if_Subj = ss "if" ;
|
||||
in8front_Prep = ss ["in front of"] ;
|
||||
i_Pron = mkNP "I" "me" "my" Sg P1 ;
|
||||
in_Prep = ss "in" ;
|
||||
it_Pron = mkNP "it" "it" "its" Sg P3 ;
|
||||
less_CAdv = ss "less" ;
|
||||
many_Det = mkDeterminer Pl "many" ;
|
||||
more_CAdv = ss "more" ;
|
||||
most_Predet = ss "most" ;
|
||||
much_Det = mkDeterminer Sg "much" ;
|
||||
must_VV = mkVerb4 "have" "has" "had" "had" ** {c2 = "to"} ; ---
|
||||
no_Phr = ss "no" ;
|
||||
on_Prep = ss "on" ;
|
||||
only_Predet = ss "only" ;
|
||||
or_Conj = ss "or" ** {n = Sg} ;
|
||||
otherwise_PConj = ss "otherwise" ;
|
||||
part_Prep = ss "of" ;
|
||||
please_Voc = ss "please" ;
|
||||
possess_Prep = ss "of" ;
|
||||
quite_Adv = ss "quite" ;
|
||||
she_Pron = mkNP "she" "her" "her" Sg P3 ;
|
||||
so_AdA = ss "so" ;
|
||||
somebody_NP = regNP "somebody" Sg ;
|
||||
someSg_Det = mkDeterminer Sg "some" ;
|
||||
somePl_Det = mkDeterminer Pl "some" ;
|
||||
something_NP = regNP "something" Sg ;
|
||||
somewhere_Adv = ss "somewhere" ;
|
||||
that_Quant = mkDeterminer Sg "that" ;
|
||||
that_NP = regNP "that" Sg ;
|
||||
therefore_PConj = ss "therefore" ;
|
||||
these_Quant = mkDeterminer Pl "these" ;
|
||||
they_Pron = mkNP "they" "them" "their" Pl P3 ;
|
||||
this_Quant = mkDeterminer Sg "this" ;
|
||||
this_NP = regNP "this" Sg ;
|
||||
those_Quant = mkDeterminer Pl "those" ;
|
||||
thou_Pron = mkNP "you" "you" "your" Sg P2 ;
|
||||
through_Prep = ss "through" ;
|
||||
too_AdA = ss "too" ;
|
||||
to_Prep = ss "to" ;
|
||||
under_Prep = ss "under" ;
|
||||
very_AdA = ss "very" ;
|
||||
want_VV = verbGen "want" ** {c2 = "to"} ;
|
||||
we_Pron = mkNP "we" "us" "our" Pl P1 ;
|
||||
whatPl_IP = mkIP "what" "what" "what's" Sg ;
|
||||
whatSg_IP = mkIP "what" "what" "what's" Sg ;
|
||||
when_IAdv = ss "when" ;
|
||||
when_Subj = ss "when" ;
|
||||
where_IAdv = ss "where" ;
|
||||
whichPl_IDet = mkDeterminer Pl ["which"] ;
|
||||
whichSg_IDet = mkDeterminer Sg ["which"] ;
|
||||
whoSg_IP = mkIP "who" "whom" "whose" Sg ;
|
||||
whoPl_IP = mkIP "who" "whom" "whose" Pl ;
|
||||
why_IAdv = ss "why" ;
|
||||
without_Prep = ss "without" ;
|
||||
with_Prep = ss "with" ;
|
||||
ye_Pron = mkNP "you" "you" "your" Pl P2 ;
|
||||
you_Pron = mkNP "you" "you" "your" Sg P2 ;
|
||||
yes_Phr = ss "yes" ;
|
||||
|
||||
}
|
||||
|
||||
10
lib/resource-1.0/english/TensedEng.gf
Normal file
10
lib/resource-1.0/english/TensedEng.gf
Normal file
@@ -0,0 +1,10 @@
|
||||
concrete TensedEng of Tensed = CatEng, TenseX ** open ResEng in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
UseCl t a p cl = {s = t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! ODir} ;
|
||||
UseQCl t a p cl = {s = \\q => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! q} ;
|
||||
UseRCl t a p cl = {s = \\r => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! r} ;
|
||||
|
||||
}
|
||||
21
lib/resource-1.0/english/TestEng.gf
Normal file
21
lib/resource-1.0/english/TestEng.gf
Normal file
@@ -0,0 +1,21 @@
|
||||
--# -path=.:prelude
|
||||
|
||||
concrete TestEng of Test =
|
||||
NounEng,
|
||||
VerbEng,
|
||||
AdjectiveEng,
|
||||
AdverbEng,
|
||||
-- NumeralEng,
|
||||
SentenceEng,
|
||||
QuestionEng,
|
||||
RelativeEng,
|
||||
ConjunctionEng,
|
||||
PhraseEng,
|
||||
UntensedEng,
|
||||
-- TensedEng,
|
||||
LexEng
|
||||
** {
|
||||
|
||||
flags startcat = Phr ;
|
||||
|
||||
} ;
|
||||
15
lib/resource-1.0/english/UntensedEng.gf
Normal file
15
lib/resource-1.0/english/UntensedEng.gf
Normal file
@@ -0,0 +1,15 @@
|
||||
concrete UntensedEng of Untensed = CatEng ** open ResEng in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
PosCl cl = {s = cl.s ! Pres ! Simul ! Pos ! ODir} ;
|
||||
NegCl cl = {s = cl.s ! Pres ! Simul ! Neg ! ODir} ;
|
||||
|
||||
PosQCl cl = {s = cl.s ! Pres ! Simul ! Pos} ;
|
||||
NegQCl cl = {s = cl.s ! Pres ! Simul ! Neg} ;
|
||||
|
||||
PosRCl cl = {s = cl.s ! Pres ! Simul ! Pos} ;
|
||||
NegRCl cl = {s = cl.s ! Pres ! Simul ! Neg} ;
|
||||
|
||||
}
|
||||
29
lib/resource-1.0/english/VerbEng.gf
Normal file
29
lib/resource-1.0/english/VerbEng.gf
Normal file
@@ -0,0 +1,29 @@
|
||||
concrete VerbEng of Verb = CatEng ** open ResEng in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
UseV = predV ;
|
||||
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 = ap ;
|
||||
CompNP np = {s = \\_ => np.s ! Acc} ;
|
||||
CompAdv a = {s = \\_ => a.s} ;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user