mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
restoring full coverage
This commit is contained in:
223
lib/resource-1.0/gf/Basic.gf
Normal file
223
lib/resource-1.0/gf/Basic.gf
Normal file
@@ -0,0 +1,223 @@
|
||||
abstract Basic = Cat ** {
|
||||
fun
|
||||
airplane_N : N ;
|
||||
-- answer_V2S : V2S ;
|
||||
apartment_N : N ;
|
||||
apple_N : N ;
|
||||
art_N : N ;
|
||||
-- ask_V2Q : V2Q ;
|
||||
baby_N : N ;
|
||||
bad_A : A ;
|
||||
bank_N : N ;
|
||||
beautiful_A : A ;
|
||||
-- become_VA : VA ;
|
||||
beer_N : N ;
|
||||
-- beg_V2V : V2V ;
|
||||
big_A : A ;
|
||||
bike_N : N ;
|
||||
bird_N : N ;
|
||||
black_A : A ;
|
||||
blue_A : A ;
|
||||
boat_N : N ;
|
||||
book_N : N ;
|
||||
boot_N : N ;
|
||||
boss_N : N ;
|
||||
boy_N : N ;
|
||||
bread_N : N ;
|
||||
break_V2 : V2 ;
|
||||
broad_A : A ;
|
||||
brother_N2 : N2 ;
|
||||
brown_A : A ;
|
||||
butter_N : N ;
|
||||
buy_V2 : V2 ;
|
||||
camera_N : N ;
|
||||
cap_N : N ;
|
||||
car_N : N ;
|
||||
carpet_N : N ;
|
||||
cat_N : N ;
|
||||
ceiling_N : N ;
|
||||
chair_N : N ;
|
||||
cheese_N : N ;
|
||||
child_N : N ;
|
||||
church_N : N ;
|
||||
city_N : N ;
|
||||
clean_A : A ;
|
||||
clever_A : A ;
|
||||
close_V2 : V2 ;
|
||||
coat_N : N ;
|
||||
cold_A : A ;
|
||||
come_V : V ;
|
||||
computer_N : N ;
|
||||
country_N : N ;
|
||||
cousin_N : N ;
|
||||
cow_N : N ;
|
||||
die_V : V ;
|
||||
dirty_A : A ;
|
||||
distance_N3 : N3 ;
|
||||
doctor_N : N ;
|
||||
dog_N : N ;
|
||||
door_N : N ;
|
||||
drink_V2 : V2 ;
|
||||
-- easy_A2V : A2V ;
|
||||
eat_V2 : V2 ;
|
||||
enemy_N : N ;
|
||||
empty_A : A ;
|
||||
factory_N : N ;
|
||||
father_N2 : N2 ;
|
||||
fear_VS : VS ;
|
||||
find_V2 : V2 ;
|
||||
fish_N : N ;
|
||||
floor_N : N ;
|
||||
forget_V2 : V2 ;
|
||||
fridge_N : N ;
|
||||
friend_N : N ;
|
||||
fruit_N : N ;
|
||||
-- fun_AV : AV ;
|
||||
garden_N : N ;
|
||||
girl_N : N ;
|
||||
glove_N : N ;
|
||||
gold_N : N ;
|
||||
good_A : A ;
|
||||
go_V : V ;
|
||||
green_A : A ;
|
||||
harbour_N : N ;
|
||||
hate_V2 : V2 ;
|
||||
hat_N : N ;
|
||||
have_V2 : V2 ;
|
||||
hear_V2 : V2 ;
|
||||
hill_N : N ;
|
||||
hope_VS : VS ;
|
||||
horse_N : N ;
|
||||
hot_A : A ;
|
||||
house_N : N ;
|
||||
important_A : A ;
|
||||
industry_N : N ;
|
||||
iron_N : N ;
|
||||
king_N : N ;
|
||||
know_V2 : V2 ;
|
||||
lake_N : N ;
|
||||
lamp_N : N ;
|
||||
learn_V2 : V2 ;
|
||||
leather_N : N ;
|
||||
leave_V2 : V2 ;
|
||||
like_V2 : V2 ;
|
||||
listen_V2 : V2 ;
|
||||
live_V : V ;
|
||||
long_A : A ;
|
||||
lose_V2 : V2 ;
|
||||
love_N : N ;
|
||||
love_V2 : V2 ;
|
||||
man_N : N ;
|
||||
married_A2 : A2 ;
|
||||
meat_N : N ;
|
||||
milk_N : N ;
|
||||
moon_N : N ;
|
||||
mother_N2 : N2 ;
|
||||
mountain_N : N ;
|
||||
music_N : N ;
|
||||
narrow_A : A ;
|
||||
new_A : A ;
|
||||
newspaper_N : N ;
|
||||
oil_N : N ;
|
||||
old_A : A ;
|
||||
open_V2 : V2 ;
|
||||
-- paint_V2A : V2A ;
|
||||
paper_N : N ;
|
||||
peace_N : N ;
|
||||
pen_N : N ;
|
||||
planet_N : N ;
|
||||
plastic_N : N ;
|
||||
play_V2 : V2 ;
|
||||
policeman_N : N ;
|
||||
priest_N : N ;
|
||||
-- probable_AS : AS ;
|
||||
queen_N : N ;
|
||||
radio_N : N ;
|
||||
-- rain_V0 : V0 ;
|
||||
read_V2 : V2 ;
|
||||
red_A : A ;
|
||||
religion_N : N ;
|
||||
restaurant_N : N ;
|
||||
river_N : N ;
|
||||
rock_N : N ;
|
||||
roof_N : N ;
|
||||
rubber_N : N ;
|
||||
run_V : V ;
|
||||
say_VS : VS ;
|
||||
school_N : N ;
|
||||
science_N : N ;
|
||||
sea_N : N ;
|
||||
seek_V2 : V2 ;
|
||||
see_V2 : V2 ;
|
||||
sell_V3 : V3 ;
|
||||
send_V3 : V3 ;
|
||||
sheep_N : N ;
|
||||
ship_N : N ;
|
||||
shirt_N : N ;
|
||||
shoe_N : N ;
|
||||
shop_N : N ;
|
||||
short_A : A ;
|
||||
silver_N : N ;
|
||||
sister_N : N ;
|
||||
sleep_V : V ;
|
||||
small_A : A ;
|
||||
snake_N : N ;
|
||||
sock_N : N ;
|
||||
speak_V2 : V2 ;
|
||||
star_N : N ;
|
||||
steel_N : N ;
|
||||
stone_N : N ;
|
||||
stove_N : N ;
|
||||
student_N : N ;
|
||||
stupid_A : A ;
|
||||
sun_N : N ;
|
||||
switch8off_V2 : V2 ;
|
||||
switch8on_V2 : V2 ;
|
||||
table_N : N ;
|
||||
talk_V3 : V3 ;
|
||||
teacher_N : N ;
|
||||
teach_V2 : V2 ;
|
||||
television_N : N ;
|
||||
thick_A : A ;
|
||||
thin_A : A ;
|
||||
train_N : N ;
|
||||
travel_V : V ;
|
||||
tree_N : N ;
|
||||
---- trousers_N : N ;
|
||||
ugly_A : A ;
|
||||
understand_V2 : V2 ;
|
||||
university_N : N ;
|
||||
village_N : N ;
|
||||
wait_V2 : V2 ;
|
||||
walk_V : V ;
|
||||
warm_A : A ;
|
||||
war_N : N ;
|
||||
watch_V2 : V2 ;
|
||||
water_N : N ;
|
||||
white_A : A ;
|
||||
window_N : N ;
|
||||
wine_N : N ;
|
||||
win_V2 : V2 ;
|
||||
woman_N : N ;
|
||||
wonder_VQ : VQ ;
|
||||
wood_N : N ;
|
||||
write_V2 : V2 ;
|
||||
yellow_A : A ;
|
||||
young_A : A ;
|
||||
|
||||
do_V2 : V2 ;
|
||||
now_Adv : Adv ;
|
||||
already_Adv : Adv ;
|
||||
song_N : N ;
|
||||
add_V3 : V3 ;
|
||||
number_N : N ;
|
||||
put_V2 : V2 ;
|
||||
stop_V : V ;
|
||||
jump_V : V ;
|
||||
|
||||
here7to_Adv : Adv ;
|
||||
here7from_Adv : Adv ;
|
||||
there_Adv : Adv ;
|
||||
there7to_Adv : Adv ;
|
||||
there7from_Adv : Adv ;
|
||||
}
|
||||
230
lib/resource-1.0/gf/BasicEng.gf
Normal file
230
lib/resource-1.0/gf/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"] ;
|
||||
} ;
|
||||
15
lib/resource-1.0/gf/Lang.gf
Normal file
15
lib/resource-1.0/gf/Lang.gf
Normal file
@@ -0,0 +1,15 @@
|
||||
abstract Lang =
|
||||
Noun,
|
||||
Verb,
|
||||
Adjective,
|
||||
Adverb,
|
||||
Numeral,
|
||||
Sentence,
|
||||
Question,
|
||||
Relative,
|
||||
Conjunction,
|
||||
Phrase,
|
||||
Tensed,
|
||||
Structural,
|
||||
Basic
|
||||
** {} ;
|
||||
21
lib/resource-1.0/gf/LangEng.gf
Normal file
21
lib/resource-1.0/gf/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 ;
|
||||
|
||||
} ;
|
||||
222
lib/resource-1.0/gf/MorphoEng.gf
Normal file
222
lib/resource-1.0/gf/MorphoEng.gf
Normal file
@@ -0,0 +1,222 @@
|
||||
--# -path=.:../../prelude
|
||||
|
||||
--1 A Simple English Resource Morphology
|
||||
--
|
||||
-- Aarne Ranta 2002 -- 2005
|
||||
--
|
||||
-- This resource morphology contains definitions needed in the resource
|
||||
-- syntax. It moreover contains the most usual inflectional patterns.
|
||||
--
|
||||
-- We use the parameter types and word classes defined in $Types.gf$.
|
||||
|
||||
resource MorphoEng = ResEng ** open Prelude, (Predef=Predef) in {
|
||||
|
||||
--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}
|
||||
}} ;
|
||||
|
||||
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'") ;
|
||||
|
||||
nounGen : Str -> CommonNoun = \dog -> case last dog of {
|
||||
"y" => nounY "dog" ;
|
||||
"s" => nounS (init "dog") ;
|
||||
_ => nounReg "dog"
|
||||
} ;
|
||||
|
||||
--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 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 ;
|
||||
|
||||
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") ;
|
||||
|
||||
verbGen : Str -> Verb = \kill -> case last kill of {
|
||||
"y" => verbP3y (init kill) ;
|
||||
"e" => verbP3y (init kill) ;
|
||||
"s" => verbP3s (init kill) ;
|
||||
_ => regVerbP3 kill
|
||||
} ;
|
||||
|
||||
--- These are for later use.
|
||||
|
||||
verbPart : Verb -> Str -> Verb = \v,p ->
|
||||
v ** {s1 = p} ;
|
||||
|
||||
verbNoPart : Verb -> Verb = \v -> verbPart v [] ;
|
||||
|
||||
|
||||
} ;
|
||||
|
||||
@@ -19,14 +19,14 @@ concrete NounEng of Noun = CatEng ** open ResEng, Prelude in {
|
||||
NumInt n = n ;
|
||||
|
||||
NumNumeral numeral = {s = numeral.s ! NCard} ;
|
||||
OrdNumeral numeral = {s = numeral.s ! NOrd} ;
|
||||
OrdNumeral numeral = {s = numeral.s ! NOrd} ;
|
||||
|
||||
OrdSuperl a = {s = a.s ! AAdj Superl} ;
|
||||
|
||||
DefSg = {s = "the" ; n = Sg} ;
|
||||
DefPl = {s = "the" ; n = Pl} ;
|
||||
DefSg = {s = artDef ; n = Sg} ;
|
||||
DefPl = {s = artDef ; n = Pl} ;
|
||||
|
||||
IndefSg = {s = "a" ; n = Sg} ;
|
||||
IndefSg = {s = artIndef ; n = Sg} ;
|
||||
IndefPl = {s = [] ; n = Pl} ;
|
||||
|
||||
ComplN2 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c} ;
|
||||
|
||||
59
lib/resource-1.0/gf/ParamEng.gf
Normal file
59
lib/resource-1.0/gf/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
|
||||
} ;
|
||||
|
||||
}
|
||||
@@ -11,6 +11,7 @@ concrete PhraseEng of Phrase = CatEng, TenseX ** open ResEng in {
|
||||
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 = []} ;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
abstract Question = Cat, Sentence ** {
|
||||
abstract Question = Cat ** {
|
||||
|
||||
fun
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
concrete QuestionEng of Question = CatEng, SentenceEng ** open ResEng in {
|
||||
concrete QuestionEng of Question = CatEng ** open ResEng in {
|
||||
|
||||
lin
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
abstract Relative = Cat, Sentence ** {
|
||||
abstract Relative = Cat ** {
|
||||
|
||||
fun
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
concrete RelativeEng of Relative = CatEng, SentenceEng ** open ResEng in {
|
||||
concrete RelativeEng of Relative = CatEng ** open ResEng in {
|
||||
|
||||
lin
|
||||
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
resource ResEng = ParamX ** open Prelude in {
|
||||
--1 English auxiliary operations.
|
||||
|
||||
param
|
||||
-- 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$.
|
||||
|
||||
Case = Nom | Acc | Gen ;
|
||||
|
||||
VForm = VInf | VPres | VPast | VPPart | VPresPart ;
|
||||
|
||||
Ord = ODir | OQuest ;
|
||||
resource ResEng = ParamEng ** open Prelude in {
|
||||
|
||||
oper
|
||||
|
||||
Agr = {n : Number ; p : Person} ;
|
||||
-- For $Lex$.
|
||||
|
||||
agrP3 : Number -> {a : Agr} = \n -> {a = {n = n ; p = P3}} ;
|
||||
|
||||
|
||||
regN : Str -> {s : Number => Case => Str} = \car -> {
|
||||
s = table {
|
||||
Sg => table {
|
||||
@@ -28,6 +24,16 @@ resource ResEng = ParamX ** open Prelude in {
|
||||
}
|
||||
} ;
|
||||
|
||||
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 ;
|
||||
@@ -53,6 +59,17 @@ resource ResEng = ParamX ** open Prelude in {
|
||||
}
|
||||
} ;
|
||||
|
||||
-- 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 = {
|
||||
@@ -94,8 +111,8 @@ resource ResEng = ParamX ** open Prelude in {
|
||||
<Cond,Anter,Pos,_> => vf "would" ("have" ++ part) ;
|
||||
<Cond,Anter,Neg,_> => vf "wouldn't" ("have" ++ part)
|
||||
} ;
|
||||
s2 = \\_ => []
|
||||
} ;
|
||||
s2 = \\_ => []
|
||||
} ;
|
||||
|
||||
predAux : Aux -> VP = \verb -> {
|
||||
s = \\t,ant,b,ord,agr =>
|
||||
@@ -123,14 +140,16 @@ resource ResEng = ParamX ** open Prelude in {
|
||||
<Cond,Anter,Pos,_> => vf "would" ("have" ++ part) ;
|
||||
<Cond,Anter,Neg,_> => vf "wouldn't" ("have" ++ part)
|
||||
} ;
|
||||
s2 = \\_ => []
|
||||
} ;
|
||||
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
|
||||
@@ -182,50 +201,16 @@ resource ResEng = ParamX ** open Prelude in {
|
||||
{n = Pl ; p = P3} => "themselves"
|
||||
} ;
|
||||
|
||||
-- For $Adjective$.
|
||||
|
||||
param
|
||||
AForm = AAdj Degree | AAdv ;
|
||||
|
||||
oper
|
||||
regA : Str -> {s : AForm => Str} = \warm -> {
|
||||
s = table {
|
||||
AAdj Posit => warm ;
|
||||
AAdj Compar => warm + "er" ;
|
||||
AAdj Superl => warm + "est" ;
|
||||
AAdv => warm + "ly"
|
||||
}
|
||||
} ;
|
||||
|
||||
-- For $Relative$.
|
||||
|
||||
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
|
||||
DForm = unit | teen | ten ;
|
||||
CardOrd = NCard | NOrd ;
|
||||
|
||||
oper
|
||||
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
|
||||
}
|
||||
} ;
|
||||
\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) ;
|
||||
@@ -233,11 +218,13 @@ oper
|
||||
regCardOrd : Str -> {s : CardOrd => Str} = \ten ->
|
||||
{s = table {NCard => ten ; NOrd => regOrd ten}} ;
|
||||
|
||||
mkCard : CardOrd -> Str -> Str = \c,ten -> (regCardOrd ten).s ! c ;
|
||||
mkCard : CardOrd -> Str -> Str = \c,ten ->
|
||||
(regCardOrd ten).s ! c ;
|
||||
|
||||
regOrd : Str -> Str = \ten -> case last ten of {
|
||||
"y" => init ten + "ieth" ;
|
||||
_ => ten + "th"
|
||||
} ;
|
||||
regOrd : Str -> Str = \ten ->
|
||||
case last ten of {
|
||||
"y" => init ten + "ieth" ;
|
||||
_ => ten + "th"
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
41
lib/resource-1.0/gf/Structural.gf
Normal file
41
lib/resource-1.0/gf/Structural.gf
Normal file
@@ -0,0 +1,41 @@
|
||||
abstract Structural = Cat ** {
|
||||
|
||||
fun
|
||||
|
||||
-- structural
|
||||
|
||||
|
||||
only_Predet, all_Predet : Predet ;
|
||||
|
||||
this_Quant, these_Quant : Quant ;
|
||||
|
||||
|
||||
i_Pron, he_Pron, we_Pron : Pron ;
|
||||
|
||||
whoSg_IP, whoPl_IP : IP ;
|
||||
|
||||
when_IAdv, where_IAdv, why_IAdv : IAdv ;
|
||||
|
||||
whichSg_IDet, whichPl_IDet : IDet ;
|
||||
|
||||
here_Adv : Adv ;
|
||||
|
||||
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 ;
|
||||
}
|
||||
47
lib/resource-1.0/gf/StructuralEng.gf
Normal file
47
lib/resource-1.0/gf/StructuralEng.gf
Normal file
@@ -0,0 +1,47 @@
|
||||
concrete StructuralEng of Structural = CatEng ** open ResEng, Prelude in {
|
||||
|
||||
lin
|
||||
|
||||
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" ;
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
abstract Tensed = Cat, Tense ** {
|
||||
|
||||
fun
|
||||
UseCl : Tense -> Ant -> Pol -> Cl -> S ;
|
||||
UseCl : Tense -> Ant -> Pol -> Cl -> S ;
|
||||
UseQCl : Tense -> Ant -> Pol -> QCl -> QS ;
|
||||
UseRCl : Tense -> Ant -> Pol -> RCl -> RS ;
|
||||
|
||||
}
|
||||
@@ -3,6 +3,8 @@ 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} ;
|
||||
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} ;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user