1
0
forked from GitHub/gf-core

resource = resource-1.0

This commit is contained in:
aarne
2006-06-22 22:25:55 +00:00
parent 7e5584b1ab
commit 251bc4c738
881 changed files with 31130 additions and 31130 deletions

195
lib/resource-0.9/Basic.txt Normal file
View File

@@ -0,0 +1,195 @@
airplane_N
answer_V2S
apartment_N
apple_N
art_N
ask_V2Q
baby_N
bad_ADeg
bank_N
beautiful_ADeg
become_VA
beer_N
beg_VV
be_V
big_ADeg
bike_N
bird_N
black_ADeg
blue_ADeg
boat_N
book_N
boot_N
boss_N
boy_N
bread_N
break_V2
broad_ADeg
brother_N2
brown_ADeg
butter_N
buy_V2
camera_N
cap_N
car_N
carpet_N
cat_N
ceiling_N
chair_N
cheese_N
child_N
church_N
city_N
clean_ADeg
clever_ADeg
close_V2
coat_N
cold_ADeg
come_V
computer_N
country_N
cousin_N
cow_N
die_V
dirty_ADeg
doctor_N
dog_N
door_N
drink_V2
eat_V2
enemy_N
factory_N
father_N2
fear_VS
find_V2
fish_N
floor_N
forget_V2
fridge_N
friend_N
fruit_N
garden_N
girl_N
glove_N
gold_N
good_ADeg
go_V
green_ADeg
harbour_N
hate_V2
hat_N
have_V2
hear_V2
hill_N
hope_VS
horse_N
hot_ADeg
house_N
important_ADeg
industry_N
iron_N
king_N
know_V2
lake_N
lamp_N
learn_V2
leather_N
leave_V2
like_V2
listen_V2
live_V
long_ADeg
lose_V2
love_N
love_V2
man_N
meat_N
milk_N
moon_N
mother_N2
mountain_N
music_N
narrow_ADeg
new_ADeg
newspaper_N
oil_N
old_ADeg
open_V2
paper_N
peace_N
pen_N
planet_N
plastic_N
play_V2
policeman_N
priest_N
queen_N
radio_N
read_V2
red_ADeg
religion_N
restaurant_N
river_N
rock_N
roof_N
rubber_N
run_V
say_VS
school_N
science_N
sea_N
seek_V2
see_V2
sell_V3
send_V3
sheep_N
ship_N
shirt_N
shoe_N
shop_N
short_ADeg
silver_N
sister_N
sleep_V
small_ADeg
snake_N
sock_N
speak_V2
star_N
steel_N
stone_N
stove_N
student_N
stupid_ADeg
sun_N
switch8off_V2
switch8on_V2
table_N
teacher_N
teach_V2
television_N
thick_ADeg
thin_ADeg
train_N
travel_V
tree_N
--trousers_N
ugly_ADeg
understand_V2
university_N
village_N
wait_V2
walk_V
warm_ADeg
war_N
watch_V2
water_N
white_ADeg
window_N
wine_N
win_V2
woman_N
wood_N
write_V2
yellow_ADeg
young_ADeg

340
lib/resource-0.9/LICENSE Normal file
View File

@@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@@ -0,0 +1,5 @@
all:
gf +RTS -K10M -M1012M <MkResource.gfs
# gf +RTS -K10M <MkResource.gfs
clean:
rm -f */*.gfc */*.gfr

View File

@@ -0,0 +1,137 @@
module MkLexicon where
import Char
allLines o f = do
s <- readFile f
mapM_ (putStrLn . o) (filter noComm (lines s))
-- discard comments and empty lines
noComm s = case s of
'-':'-':_ -> False
"" -> False
_ -> True
-- remove tailing comments
remTail s = case s of
'-':'-':_ -> []
c:cs -> c : remTail cs
_ -> s
-- postfix with category
postfix p s = takeWhile (not . isSpace) s ++ "_" ++ p
-- make fun rule
mkFun s =
let (w,p) = span (/='_') s in
" " ++ s ++ " : " ++ tail p ++ " ;"
-- make regular lin rule
mkLin s =
let (w,p) = span (/='_') s in
" " ++ s ++ " = " ++ lin (tail p) w ++ " ;"
where
lin cat w = case cat of
"V2" -> "dirV2 (regV" ++ " \"" ++ w ++ "\")"
'V':_ -> "mk" ++ cat ++ " (regV" ++ " \"" ++ w ++ "\")"
_ -> "reg" ++ cat ++ " \"" ++ w ++ "\""
-- normalize identifiers in Structural
mkIdent s = case words s of
w:ws -> if obsolete w then ""
else " " ++ (unwords $ mkId (update w) : ws)
_ -> s
where
mkId name@(c:cs) =
let
(x,y) = span isCat cs
in
toLower c : clean x ++ "_" ++ new y
isCat = flip notElem "PDNVCAIS"
clean x = case span isLower x of
(_,[]) -> x
(u,v) -> u ++ "8" ++ map toLower v
new y = case y of
"NumDet" -> "NDet"
_ -> y
obsolete w = elem w $ words "TheseNumNP ThoseNumNP NobodyNP NeitherNor NoDet AnyDet"
update w = case w of
"EitherOr" -> "EitherOrConjD"
"BothAnd" -> "BothAndConjD"
"PhrYes" -> "YesPhr"
"PhrNo" -> "NoPhr"
"WeNumNP" -> "WeNP"
"YeNumNP" -> "YeNP"
"HowManyDet" -> "HowManyIDet"
"MostsDet" -> "MostManyDet"
"WhichDet" -> "WhichOneIDet"
"WhichNDet" -> "WhichManyIDet"
"EverywhereNP" -> "EverywhereAdv"
"SomewhereNP" -> "SomewhereAdv"
"AgentPrep" -> "By8agentPrep"
_ -> w
-- massage French verbs 9/2/2005
freVerb s = case words s of
v:_ -> " " ++ v ++ " : " ++ cat v ++ " ;"
_ -> []
where
cat v = dropWhile (not . isUpper) v
-- Swedish verbs 17/2
sweVerb s = case words s of
('v':a:u:[]):verb:_ -> "fun " ++ verb ++ " : V ;\n" ++
"lin " ++ verb ++ " = " ++ infl a u verb ++ " ;"
_ -> []
where
infl a u verb =
let
(dne,geb) = span isConsonant $ tail $ reverse verb
(beg,voc,end) = (reverse (tail geb), head geb, reverse dne)
(pret,sup) = (beg++ [toLower a] ++end, beg++ [toLower u] ++ end ++"it")
in
unwords ["irregV", prQuot verb, prQuot pret, prQuot sup]
prQuot s = "\"" ++ s ++ "\""
isConsonant = not . isVowel
isVowel = flip elem "aeiouyäöå"
-- Norwegian 13/3
groupLines :: [String] -> [String]
groupLines ss = [unwords [a, b, c] | [a,_,b,c,_] <- grps ss] where
grps ls = let (g,rest) = splitAt 5 ls in g:grps rest
lin2fun s = case words s of
_:fun:_:_ -> " fun " ++ fun ++ " : " ++ cat fun ++ " ;"
_ -> s
where
cat fun = reverse (takeWhile (/='_') (reverse fun))
-- filter from a given file those lines whose first word is in a sought-set
allThose :: [String] -> [String] -> [String]
allThose soughts givens = concatMap seek soughts where
seek w = let s = [line | line <- givens, w':_ <- [words line], w == w']
in if null s then ["-- " ++ w] else s
-- do this with files
-- example: getAllThose "abstract/Mtmp" "english/BasicEng.gf"
getAllThose :: FilePath -> FilePath -> IO ()
getAllThose sought given = do
s <- readFile sought
gi <- readFile given
let so = [w | l <- lines s, w:_ <- [words l]]
mapM_ putStrLn $ allThose so $ lines gi

View File

@@ -0,0 +1,12 @@
i finnish/LangFin.gf
s
i french/LangFre.gf
i italian/LangIta.gf
i spanish/LangSpa.gf
s
i norwegian/LangNor.gf
i swedish/LangSwe.gf
s
i english/LangEng.gf
s
pm | wf langs.gfcm

27
lib/resource-0.9/README Normal file
View File

@@ -0,0 +1,27 @@
23/1/2005 -- 21/12/2005
GF Resource Grammar Library Version 0.9
The contents of this directory are open source software
under GNU General Public License (See LICENCE).
Authors (c): Janna Khegai (Russian), Aarne Ranta.
For more information, see doc/gf-resource.html.
To compile a gfcm package, type 'make'. Then open the resource
with either of
gf langs.gfcm
gfeditor langs.gfcm
VERSION NOTICE: this resource grammar library is at the moment of
writing the most complete one. It supersedes and includes
v 0.6 (../resource-0.6) in all other respects except that
it is not implemented for German.
HOWEVER, this library is no longer developed, but the
development has been moved to v 1.0 (../resource-1.0).
V 1.0 will replace v 0.9 during Winter and Spring 2006.

View File

@@ -0,0 +1,223 @@
abstract Basic = Categories ** {
fun
airplane_N : N ;
answer_V2S : V2S ;
apartment_N : N ;
apple_N : N ;
art_N : N ;
ask_V2Q : V2Q ;
baby_N : N ;
bad_ADeg : ADeg ;
bank_N : N ;
beautiful_ADeg : ADeg ;
become_VA : VA ;
beer_N : N ;
beg_V2V : V2V ;
big_ADeg : ADeg ;
bike_N : N ;
bird_N : N ;
black_ADeg : ADeg ;
blue_ADeg : ADeg ;
boat_N : N ;
book_N : N ;
boot_N : N ;
boss_N : N ;
boy_N : N ;
bread_N : N ;
break_V2 : V2 ;
broad_ADeg : ADeg ;
brother_N2 : N2 ;
brown_ADeg : ADeg ;
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_ADeg : ADeg ;
clever_ADeg : ADeg ;
close_V2 : V2 ;
coat_N : N ;
cold_ADeg : ADeg ;
come_V : V ;
computer_N : N ;
country_N : N ;
cousin_N : N ;
cow_N : N ;
die_V : V ;
dirty_ADeg : ADeg ;
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_ADeg : ADeg ;
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_ADeg : ADeg ;
go_V : V ;
green_ADeg : ADeg ;
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_ADeg : ADeg ;
house_N : N ;
important_ADeg : ADeg ;
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_ADeg : ADeg ;
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_ADeg : ADeg ;
new_ADeg : ADeg ;
newspaper_N : N ;
oil_N : N ;
old_ADeg : ADeg ;
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_ADeg : ADeg ;
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_ADeg : ADeg ;
silver_N : N ;
sister_N : N ;
sleep_V : V ;
small_ADeg : ADeg ;
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_ADeg : ADeg ;
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_ADeg : ADeg ;
thin_ADeg : ADeg ;
train_N : N ;
travel_V : V ;
tree_N : N ;
---- trousers_N : N ;
ugly_ADeg : ADeg ;
understand_V2 : V2 ;
university_N : N ;
village_N : N ;
wait_V2 : V2 ;
walk_V : V ;
warm_ADeg : ADeg ;
war_N : N ;
watch_V2 : V2 ;
water_N : N ;
white_ADeg : ADeg ;
window_N : N ;
wine_N : N ;
win_V2 : V2 ;
woman_N : N ;
wonder_VQ : VQ ;
wood_N : N ;
write_V2 : V2 ;
yellow_ADeg : ADeg ;
young_ADeg : ADeg ;
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 ;
here_Adv : Adv ;
here7to_Adv : Adv ;
here7from_Adv : Adv ;
there_Adv : Adv ;
there7to_Adv : Adv ;
there7from_Adv : Adv ;
}

View File

@@ -0,0 +1,190 @@
--1 Abstract Syntax Categories for Multilingual Resource Grammar
--
-- Aarne Ranta 2002 -- 2004
--
-- Although concrete syntax differs a lot between different languages,
-- many structures can be treated as common, on the level
-- of abstraction that GF provides.
-- What we will present in the following is a linguistically oriented abstract
-- syntax that has been successfully defined for the following languages:
--
--* $Eng$lish
--* $Fin$nish
--* $Fre$nch
--* $Ger$man
--* $Ita$lian
--* $Rus$sian
--* $Swe$dish
--
-- The three-letter prefixes are used in file names all over the resource
-- grammar library; we refer to them commonly as $X$ below.
--!
-- The grammar has been applied to define language
-- fragments on technical or near-to-technical domains: database queries,
-- video recorder dialogue systems, software specifications, and a
-- health-related phrase book. Each new application helped to identify some
-- missing structures in the resource and suggested some additions, but the
-- number of required additions was usually small.
--
-- To use the resource in applications, you need the following
-- $cat$ and $fun$ rules in $oper$ form, completed by taking the
-- $lincat$ and $lin$ judgements of a particular language. This is done
-- by using, instead of this module, the $reuse$ module which has the name
-- $ResourceX$. It is located in the subdirectory
-- $lib/resource/lang$ where $lang$ is the full name of the language.
abstract Categories = PredefAbs ** {
--!
--2 Categories
--
-- The categories of this resource grammar are mostly 'standard' categories
-- of linguistics. Their is no claim that they correspond to semantic categories
-- definable in type theory: to define such correspondences is the business
-- of applications grammars. In general, the correspondence between linguistic
-- and semantic categories is many-to-many.
--
-- Categories that may look special are $A2$, $N2$, and $V2$. They are all
-- instances of endowing another category with a complement, which can be either
-- a direct object (whose case may vary) or a prepositional phrase. Prepositional
-- phrases that are not complements belong to the category
-- $Adv$ of adverbs.
--
-- In each group below, some categories are *lexical* in the sense of only
-- containing atomic elements. These elements are not necessarily expressed by
-- one word in all languages; the essential thing is that they have no
-- constituents. Thus they have no productions in this part of the
-- resource grammar. The $ParadigmsX$ grammars provide ways of defining
-- lexical elements.
--
-- Lexical categories are listed before other categories
-- in each group and divided by an empty line.
--!
--3 Nouns and noun phrases
--
cat
N ; -- simple common noun, e.g. "car"
CN ; -- common noun phrase, e.g. "red car", "car that John owns"
N2 ; -- function word, e.g. "mother (of)"
N3 ; -- two-place function, e.g. "flight (from) (to)"
PN ; -- proper name, e.g. "John", "New York"
NP ; -- noun phrase, e.g. "John", "all cars", "you"
Det ; -- determiner, e.g. "every", "many"
NDet ; -- det that admits a num, e.g. "all (the 5)"
Num ; -- numeral, e.g. "three", "879"
--!
--3 Adjectives and adjectival phrases
--
A ; -- one-place adjective, e.g. "even"
A2 ; -- two-place adjective, e.g. "divisible (by)"
ADeg ; -- degree adjective, e.g. "big/bigger/biggest"
AP ; -- adjective phrase, e.g. "divisible by two", "bigger than John"
-- The difference between $A$ and $ADeg$ is that the former has no
-- comparison forms.
--!
--3 Verbs and verb phrases
--
V ; -- one-place verb, e.g. "walk"
V2 ; -- two-place verb, e.g. "love", "wait (for)", "switch on"
V3 ; -- three-place verb, e.g. "give", "prefer (stg) (to stg)"
VS ; -- sentence-compl. verb, e.g. "say", "prove"
VV ; -- verb-compl. verb, e.g. "can", "want"
VP ; -- verb phrase, e.g. "switch the light on"
VPI ; -- infinitive verb phrase e.g. "switch the light on", "not have run"
VCl ; -- same (variable ant.) e.g. "walk"/"have walked"
--!
--3 Adverbs and prepositions/cases
--
Adv ; -- sentence adverb e.g. "now", "in the house"
AdV ; -- verb adverb e.g. "always"
AdA ; -- ad-adjective e.g. "very"
AdC ; -- conjoining adverb e.g. "therefore", "otherwise"
PP ; -- prepositional phrase e.g. "in London"
Prep ; -- pre/postposition, case e.g. "after", Adessive
--!
--3 Sentences and relative clauses
--
-- This group has no lexical categories.
S ; -- sentence (fixed tense) e.g. "John walks", "John walked"
Cl ; -- clause (variable tense) e.g. "John walks"/"John walked"
Slash ; -- sentence without NP, e.g. "John waits for (...)"
RP ; -- relative pronoun, e.g. "which", "the mother of whom"
RCl ; -- relative clause, e.g. "who walks", "that I wait for"
--!
--3 Questions and imperatives
--
-- This group has no lexical categories.
IP ; -- interrogative pronoun, e.g. "who", "whose mother", "which car"
IDet ; -- interrog. determiner, e.g. "which", "how many"
IAdv ; -- interrogative adverb., e.g. "when", "why"
QCl ; -- question, e.g. "who walks"
QS ; -- question w. fixed tense
Imp ; -- imperative, e.g. "walk!"
--!
--3 Coordination and subordination
--
Conj ; -- conjunction, e.g. "and"
ConjD ; -- distributed conj. e.g. "both - and"
Subj ; -- subjunction, e.g. "if", "when"
ListS ; -- list of sentences
ListAP ; -- list of adjectival phrases
ListNP ; -- list of noun phrases
ListAdv ;-- list of adverbs
--!
--3 Complete utterances
--
-- This group has no lexical categories.
Phr ; -- full phrase, e.g. "John walks.","Who walks?", "Wait for me!"
Text ; -- sequence of phrases e.g. "One is odd. Therefore, two is even."
---- next
V2A ; -- paint the house red
V2V ; -- promise John to come / ask John to come
V2S ; -- tell John that it is raining
VQ ; -- ask who comes
V2Q ; -- ask John who comes
VA ; -- look yellow
V0 ; -- (it) rains
AS ; -- (it is) important that he comes
A2S ; -- (it is) important for me that he comes
AV ; -- difficult to play
A2V ; -- difficult for him to play
-- NB: it is difficult to play the sonata
-- vs. it (the sonata) is difficult to play
--- also: John is easy (for you) to please vs. John is eager to please
RS ; -- relative clause with fixed tense and polarity
TP ; -- tense x polarity selector
Tense ; -- (abstract) tense
Ant ; -- (abstract) anteriority
Pol ; -- polarity (positive or negative)
}

View File

@@ -0,0 +1,145 @@
--!
--1 Rules for predication forming clauses
--
-- This module treats predications in a shallow way, without right-branching
-- $VP$ structures. This has the disadvantage of duplicating rules but the
-- advantage of fast parsing due to elimination of discontinuous
-- constituents. Also the canonical GF structures (in $.gfc$) files
-- get smaller, because much more pruning of case alternatives can
-- be performed at compile time.
--
-- Each of the rules below has the following structure:
--
-- "Subject -> Verb -> Complements -> Clause"
--
-- What complements are needed depends on the type of the verb.
-- For instance, $V$ takes no complement, $V2$ takes one $NP$
-- complement, $VS$ takes an $S$ complement, etc. There is an elegant
-- way of expressing this using dependent types:
--
-- (v : VType) -> Subj -> Verb v -> Compl v -> Clause
--
-- Since there are 12 verb types in our category system, using this
-- rule would be economical. The effect is amplified by another
-- distinction that the rules make: there are separate sets of
-- rules just differing in what type the subject and
-- the resulting clause have. There are four different types:
--
--* $SPred$ (declarative clause, from $NP$ to $Cl$),
--* $QPred$ (interrogative clause, from $IP$ to $QCl$),
--* $RPred$ (relative clause, from $RP$ to $RCl$),
--* $IPred$ (infinitive clause, from no subject to $VCl$).
--
-- The ultimate dependent type formalization of all the 4x12 rules is
--
-- (n : NType) -> (v : VType) -> Subj n -> Verb v -> Compl v -> Clause n
--
-- In the following, however, an expanded set of rules with no
-- dependent types is shown.
abstract Clause = Categories ** {
fun
SPredV : NP -> V -> Cl ; -- "John walks"
SPredPassV : NP -> V -> Cl ; -- "John is seen"
SPredV2 : NP -> V2 -> NP -> Cl ; -- "John sees Mary"
SPredV3 : NP -> V3 -> NP -> NP -> Cl ; -- "John tells Mary everything"
SPredReflV2 : NP -> V2 -> Cl ; -- "John loves himself"
SPredVS : NP -> VS -> S -> Cl ; -- "John says that Mary runs"
SPredVV : NP -> VV -> VPI -> Cl ; -- "John must walk"
SPredVQ : NP -> VQ -> QS -> Cl ; -- "John asks who will come"
SPredVA : NP -> VA -> AP -> Cl ; -- "John looks ill"
SPredV2A : NP -> V2A -> NP -> AP -> Cl ; -- "John paints the house red"
SPredSubjV2V : NP -> V2V -> NP -> VPI -> Cl ; -- "John promises Mary to leave"
SPredObjV2V : NP -> V2V -> NP -> VPI -> Cl ; -- "John asks me to come"
SPredV2S : NP -> V2S -> NP -> S -> Cl ; -- "John told me that it is good"
SPredV2Q : NP -> V2Q -> NP -> QS -> Cl ; -- "John asked me if it is good"
SPredAP : NP -> AP -> Cl ; -- "John is old"
SPredCN : NP -> CN -> Cl ; -- "John is a man"
SPredNP : NP -> NP -> Cl ; -- "John is Bill"
SPredAdv : NP -> Adv -> Cl ; -- "John is in France"
SPredProgVP : NP -> VPI -> Cl ; -- "he is eating"
QPredV : IP -> V -> QCl ; -- "who walks"
QPredPassV : IP -> V -> QCl ; -- "who is seen"
QPredV2 : IP -> V2 -> NP -> QCl ; -- "who sees Mary"
QPredV3 : IP -> V3 -> NP -> NP -> QCl ; -- "who gives Mary food"
QPredReflV2 : IP -> V2 -> QCl ; -- "who loves himself"
QPredVS : IP -> VS -> S -> QCl ; -- "who says that Mary runs"
QPredVV : IP -> VV -> VPI -> QCl ; -- "who must walk"
QPredVQ : IP -> VQ -> QS -> QCl ; -- "who asks who will come"
QPredVA : IP -> VA -> AP -> QCl ; -- "who looks ill"
QPredV2A : IP -> V2A -> NP ->AP ->QCl ; -- "who paints the house red"
QPredSubjV2V : IP -> V2V -> NP ->VPI ->QCl ; -- "who promises Mary to leave"
QPredObjV2V : IP -> V2V -> NP -> VPI -> QCl ; -- "who asks me to come"
QPredV2S : IP -> V2S -> NP -> S -> QCl ; -- "who told me that it is good"
QPredV2Q : IP -> V2Q -> NP -> QS -> QCl ; -- "who asked me if it is good"
QPredAP : IP -> AP -> QCl ; -- "who is old"
QPredCN : IP -> CN -> QCl ; -- "who is a man"
QPredNP : IP -> NP -> QCl ; -- "who is Bill"
QPredAdv : IP -> Adv -> QCl ; -- "who is in France"
QPredProgVP : IP -> VPI -> QCl ; -- "who is eating"
RPredV : RP -> V -> RCl ; -- "who walks"
RPredPassV : RP -> V -> RCl ; -- "who is seen"
RPredV2 : RP -> V2 -> NP -> RCl ; -- "who sees Mary"
RPredV3 : RP -> V3 -> NP -> NP -> RCl ; -- "who gives Mary food"
RPredReflV2 : RP -> V2 -> RCl ; -- "who loves himself"
RPredVS : RP -> VS -> S -> RCl ; -- "who says that Mary runs"
RPredVV : RP -> VV -> VPI -> RCl ; -- "who must walk"
RPredVQ : RP -> VQ -> QS -> RCl ; -- "who asks who will come"
RPredVA : RP -> VA -> AP -> RCl ; -- "who looks ill"
RPredV2A : RP -> V2A -> NP -> AP -> RCl ; -- "who paints the house red"
RPredSubjV2V : RP -> V2V -> NP -> VPI -> RCl ; -- "who promises Mary to leave"
RPredObjV2V : RP -> V2V -> NP -> VPI -> RCl ; -- "who asks me to come"
RPredV2S : RP -> V2S -> NP -> S -> RCl ; -- "who told me that it is good"
RPredV2Q : RP -> V2Q -> NP -> QS -> RCl ; -- "who asked me if it is good"
RPredAP : RP -> AP -> RCl ; -- "who is old"
RPredCN : RP -> CN -> RCl ; -- "who is a man"
RPredNP : RP -> NP -> RCl ; -- "who is Bill"
RPredAdv : RP -> Adv -> RCl ; -- "who is in France"
RPredProgVP : RP -> VPI -> RCl ; -- "who is eating"
IPredV : V -> VCl ; -- "walk"
IPredPassV : V -> VCl ; -- "be seen"
IPredV2 : V2 -> NP -> VCl ; -- "see Mary"
IPredV3 : V3 -> NP -> NP -> VCl ; -- "give Mary food"
IPredReflV2 : V2 -> VCl ; -- "love himself"
IPredVS : VS -> S -> VCl ; -- "say that Mary runs"
IPredVV : VV -> VPI -> VCl ; -- "want to walk"
IPredVQ : VQ -> QS -> VCl ; -- "ask who will come"
IPredVA : VA -> AP -> VCl ; -- "look ill"
IPredV2A : V2A -> NP -> AP -> VCl ; -- "paint the house red"
IPredSubjV2V : V2V -> NP -> VPI -> VCl ; -- "promise Mary to leave"
IPredObjV2V : V2V -> NP -> VPI -> VCl ; -- "ask me to come"
IPredV2S : V2S -> NP -> S -> VCl ; -- "tell me that it is good"
IPredV2Q : V2Q -> NP -> QS -> VCl ; -- "ask me if it is good"
IPredAP : AP -> VCl ; -- "be old"
IPredCN : CN -> VCl ; -- "be a man"
IPredNP : NP -> VCl ; -- "be Bill"
IPredAdv : Adv -> VCl ; -- "be in France"
IPredProgVP : VPI -> VCl ; -- "be eating"
{-
-- These rules *use* verb phrases.
PredVP : NP -> VP -> Cl ; -- "John walks"
RelVP : RP -> VP -> RCl ; -- "who walks", "who doesn't walk"
IntVP : IP -> VP -> QCl ; -- "who walks"
PosVP, NegVP : Ant -> VP -> VPI ; -- to eat, not to eat
AdvVP : VP -> AdV -> VP ; -- "always walks"
SubjVP : VP -> Subj -> S -> VP ; -- "(a man who) sings when he runs"
-}
} ;

View File

@@ -0,0 +1,111 @@
--# -path=.:../abstract:../../prelude
incomplete concrete ClauseI of Clause = open Rules, Verbphrase in {
flags optimize=all_subs ;
lin
SPredV np v = PredVP np (UseV v) ;
SPredPassV np v = PredVP np (UsePassV v) ;
SPredV2 np v x = PredVP np (ComplV2 v x) ;
SPredV3 np v x y = PredVP np (ComplV3 v x y) ;
SPredReflV2 np v = PredVP np (ComplReflV2 v) ;
SPredVS np v x = PredVP np (ComplVS v x) ;
SPredVV np v x = PredVP np (ComplVV v x) ;
SPredVQ np v x = PredVP np (ComplVQ v x) ;
SPredVA np v x = PredVP np (ComplVA v x) ;
SPredV2A np v x y = PredVP np (ComplV2A v x y) ;
SPredSubjV2V np v x y = PredVP np (ComplSubjV2V v x y) ;
SPredObjV2V np v x y = PredVP np (ComplObjV2V v x y) ;
SPredV2S np v x y = PredVP np (ComplV2S v x y) ;
SPredV2Q np v x y = PredVP np (ComplV2Q v x y) ;
SPredAP np v = PredVP np (PredAP v) ;
SPredCN np v = PredVP np (PredCN v) ;
SPredNP np v = PredVP np (PredNP v) ;
SPredAdv np v = PredVP np (PredAdv v) ;
SPredProgVP np vp = PredVP np (PredProgVP vp) ;
QPredV np v = IntVP np (UseV v) ;
QPredPassV np v = IntVP np (UsePassV v) ;
QPredV2 np v x = IntVP np (ComplV2 v x) ;
QPredV3 np v x y = IntVP np (ComplV3 v x y) ;
QPredReflV2 np v = IntVP np (ComplReflV2 v) ;
QPredVS np v x = IntVP np (ComplVS v x) ;
QPredVV np v x = IntVP np (ComplVV v x) ;
QPredVQ np v x = IntVP np (ComplVQ v x) ;
QPredVA np v x = IntVP np (ComplVA v x) ;
QPredV2A np v x y = IntVP np (ComplV2A v x y) ;
QPredSubjV2V np v x y = IntVP np (ComplSubjV2V v x y) ;
QPredObjV2V np v x y = IntVP np (ComplObjV2V v x y) ;
QPredV2S np v x y = IntVP np (ComplV2S v x y) ;
QPredV2Q np v x y = IntVP np (ComplV2Q v x y) ;
QPredAP np v = IntVP np (PredAP v) ;
QPredCN np v = IntVP np (PredCN v) ;
QPredNP np v = IntVP np (PredNP v) ;
QPredAdv np v = IntVP np (PredAdv v) ;
QPredProgVP np vp = IntVP np (PredProgVP vp) ;
RPredV np v = RelVP np (UseV v) ;
RPredPassV np v = RelVP np (UsePassV v) ;
RPredV2 np v x = RelVP np (ComplV2 v x) ;
RPredV3 np v x y = RelVP np (ComplV3 v x y) ;
RPredReflV2 np v = RelVP np (ComplReflV2 v) ;
RPredVS np v x = RelVP np (ComplVS v x) ;
RPredVV np v x = RelVP np (ComplVV v x) ;
RPredVQ np v x = RelVP np (ComplVQ v x) ;
RPredVA np v x = RelVP np (ComplVA v x) ;
RPredV2A np v x y = RelVP np (ComplV2A v x y) ;
RPredSubjV2V np v x y = RelVP np (ComplSubjV2V v x y) ;
RPredObjV2V np v x y = RelVP np (ComplObjV2V v x y) ;
RPredV2S np v x y = RelVP np (ComplV2S v x y) ;
RPredV2Q np v x y = RelVP np (ComplV2Q v x y) ;
RPredAP np v = RelVP np (PredAP v) ;
RPredCN np v = RelVP np (PredCN v) ;
RPredNP np v = RelVP np (PredNP v) ;
RPredAdv np v = RelVP np (PredAdv v) ;
RPredProgVP np vp = RelVP np (PredProgVP vp) ;
IPredV v = UseVP (UseV v) ;
IPredV2 v x = UseVP (ComplV2 v x) ;
IPredPassV v = UseVP (UsePassV v) ;
IPredV3 v x y = UseVP (ComplV3 v x y) ;
IPredReflV2 v = UseVP (ComplReflV2 v) ;
IPredVS v x = UseVP (ComplVS v x) ;
IPredVV v x = UseVP (ComplVV v x) ;
IPredVQ v x = UseVP (ComplVQ v x) ;
IPredVA v x = UseVP (ComplVA v x) ;
IPredV2A v x y = UseVP (ComplV2A v x y) ;
IPredSubjV2V v x y = UseVP (ComplSubjV2V v x y) ;
IPredObjV2V v x y = UseVP (ComplObjV2V v x y) ;
IPredV2S v x y = UseVP (ComplV2S v x y) ;
IPredV2Q v x y = UseVP (ComplV2Q v x y) ;
IPredAP v = UseVP (PredAP v) ;
IPredCN v = UseVP (PredCN v) ;
IPredNP v = UseVP (PredNP v) ;
IPredAdv v = UseVP (PredAdv v) ;
IPredProgVP vp = UseVP (PredProgVP vp) ;
{-
-- Use VPs
IntVP = intVerbPhrase ;
RelVP = relVerbPhrase ;
PosVP tp = predVerbGroup True tp.a ;
NegVP tp = predVerbGroup False tp.a ;
AdvVP = adVerbPhrase ;
SubjVP = subjunctVerbPhrase ;
-}
}

View File

@@ -0,0 +1,113 @@
--# -path=.:../abstract:../../prelude
incomplete concrete ClausePredI of Clause = open Predic in {
flags optimize=all ;
lin
SPredV np v = SPredVerb Vt_ np (UseV1 v) ComplNil ;
SPredV2 np v x = SPredVerb (Vt CtN) np (UseV2 v) (ComplNP x) ;
---- SPredV3 np v x y = SPredVerb (VtN CtN) np (UseV3 v) (ComplAdd (Vt CtN) x (ComplNP y)) ;
---- SPredVS np v x = SPredVerb (Vt CtS) np (UseVS v) (ComplS x) ;
-- SPredPassV np v = PredVP np (UsePassV v) ;
-- SPredReflV2 np v = PredVP np (ComplReflV2 v) ;
{-
SPredVV np v x = PredVP np (ComplVV v x) ;
SPredVQ np v x = PredVP np (ComplVQ v x) ;
SPredVA np v x = PredVP np (ComplVA v x) ;
SPredV2A np v x y = PredVP np (ComplV2A v x y) ;
SPredSubjV2V np v x y = PredVP np (ComplSubjV2V v x y) ;
SPredObjV2V np v x y = PredVP np (ComplObjV2V v x y) ;
SPredV2S np v x y = PredVP np (ComplV2S v x y) ;
SPredV2Q np v x y = PredVP np (ComplV2Q v x y) ;
SPredAP np v = PredVP np (PredAP v) ;
SPredCN np v = PredVP np (PredCN v) ;
SPredNP np v = PredVP np (PredNP v) ;
SPredAdv np v = PredVP np (PredAdv v) ;
SPredProgVP np vp = PredVP np (PredProgVP vp) ;
QPredV np v = IntVP np (UseV v) ;
QPredPassV np v = IntVP np (UsePassV v) ;
QPredV2 np v x = IntVP np (ComplV2 v x) ;
QPredV3 np v x y = IntVP np (ComplV3 v x y) ;
QPredReflV2 np v = IntVP np (ComplReflV2 v) ;
QPredVS np v x = IntVP np (ComplVS v x) ;
QPredVV np v x = IntVP np (ComplVV v x) ;
QPredVQ np v x = IntVP np (ComplVQ v x) ;
QPredVA np v x = IntVP np (ComplVA v x) ;
QPredV2A np v x y = IntVP np (ComplV2A v x y) ;
QPredSubjV2V np v x y = IntVP np (ComplSubjV2V v x y) ;
QPredObjV2V np v x y = IntVP np (ComplObjV2V v x y) ;
QPredV2S np v x y = IntVP np (ComplV2S v x y) ;
QPredV2Q np v x y = IntVP np (ComplV2Q v x y) ;
QPredAP np v = IntVP np (PredAP v) ;
QPredCN np v = IntVP np (PredCN v) ;
QPredNP np v = IntVP np (PredNP v) ;
QPredAdv np v = IntVP np (PredAdv v) ;
QPredProgVP np vp = IntVP np (PredProgVP vp) ;
RPredV np v = RelVP np (UseV v) ;
RPredPassV np v = RelVP np (UsePassV v) ;
RPredV2 np v x = RelVP np (ComplV2 v x) ;
RPredV3 np v x y = RelVP np (ComplV3 v x y) ;
RPredReflV2 np v = RelVP np (ComplReflV2 v) ;
RPredVS np v x = RelVP np (ComplVS v x) ;
RPredVV np v x = RelVP np (ComplVV v x) ;
RPredVQ np v x = RelVP np (ComplVQ v x) ;
RPredVA np v x = RelVP np (ComplVA v x) ;
RPredV2A np v x y = RelVP np (ComplV2A v x y) ;
RPredSubjV2V np v x y = RelVP np (ComplSubjV2V v x y) ;
RPredObjV2V np v x y = RelVP np (ComplObjV2V v x y) ;
RPredV2S np v x y = RelVP np (ComplV2S v x y) ;
RPredV2Q np v x y = RelVP np (ComplV2Q v x y) ;
RPredAP np v = RelVP np (PredAP v) ;
RPredCN np v = RelVP np (PredCN v) ;
RPredNP np v = RelVP np (PredNP v) ;
RPredAdv np v = RelVP np (PredAdv v) ;
RPredProgVP np vp = RelVP np (PredProgVP vp) ;
IPredV v = UseVP (UseV v) ;
IPredV2 v x = UseVP (ComplV2 v x) ;
IPredPassV v = UseVP (UsePassV v) ;
IPredV3 v x y = UseVP (ComplV3 v x y) ;
IPredReflV2 v = UseVP (ComplReflV2 v) ;
IPredVS v x = UseVP (ComplVS v x) ;
IPredVV v x = UseVP (ComplVV v x) ;
IPredVQ v x = UseVP (ComplVQ v x) ;
IPredVA v x = UseVP (ComplVA v x) ;
IPredV2A v x y = UseVP (ComplV2A v x y) ;
IPredSubjV2V v x y = UseVP (ComplSubjV2V v x y) ;
IPredObjV2V v x y = UseVP (ComplObjV2V v x y) ;
IPredV2S v x y = UseVP (ComplV2S v x y) ;
IPredV2Q v x y = UseVP (ComplV2Q v x y) ;
IPredAP v = UseVP (PredAP v) ;
IPredCN v = UseVP (PredCN v) ;
IPredNP v = UseVP (PredNP v) ;
IPredAdv v = UseVP (PredAdv v) ;
IPredProgVP vp = UseVP (PredProgVP vp) ;
-}
{-
-- Use VPs
IntVP = intVerbPhrase ;
RelVP = relVerbPhrase ;
PosVP tp = predVerbGroup True tp.a ;
NegVP tp = predVerbGroup False tp.a ;
AdvVP = adVerbPhrase ;
SubjVP = subjunctVerbPhrase ;
-}
}

View File

@@ -0,0 +1,114 @@
--# -path=.:../abstract:../../prelude
abstract ClauseVP = Rules, Clause, Verbphrase ** {
fun
trCl : Cl -> Cl ;
trQCl : QCl -> QCl ;
trRCl : RCl -> RCl ;
trVCl : VCl -> VCl ;
def
trCl (SPredV np v) = PredVP np (UseV v) ;
trCl (SPredPassV np v) = PredVP np (UsePassV v) ;
trCl (SPredV2 np v x) = PredVP np (ComplV2 v x) ;
trCl (SPredV3 np v x y) = PredVP np (ComplV3 v x y) ;
trCl (SPredReflV2 np v) = PredVP np (ComplReflV2 v) ;
trCl (SPredVS np v x) = PredVP np (ComplVS v x) ;
trCl (SPredVV np v x) = PredVP np (ComplVV v x) ;
trCl (SPredVQ np v x) = PredVP np (ComplVQ v x) ;
trCl (SPredVA np v x) = PredVP np (ComplVA v x) ;
trCl (SPredV2A np v x y) = PredVP np (ComplV2A v x y) ;
trCl (SPredSubjV2V np v x y) = PredVP np (ComplSubjV2V v x y) ;
trCl (SPredObjV2V np v x y) = PredVP np (ComplObjV2V v x y) ;
trCl (SPredV2S np v x y) = PredVP np (ComplV2S v x y) ;
trCl (SPredV2Q np v x y) = PredVP np (ComplV2Q v x y) ;
trCl (SPredAP np v) = PredVP np (PredAP v) ;
trCl (SPredCN np v) = PredVP np (PredCN v) ;
trCl (SPredNP np v) = PredVP np (PredNP v) ;
trCl (SPredAdv np v) = PredVP np (PredAdv v) ;
trCl (SPredProgVP np vp) = PredVP np (PredProgVP vp) ;
trQCl (QPredV np v) = IntVP np (UseV v) ;
trQCl (QPredPassV np v) = IntVP np (UsePassV v) ;
trQCl (QPredV2 np v x) = IntVP np (ComplV2 v x) ;
trQCl (QPredV3 np v x y) = IntVP np (ComplV3 v x y) ;
trQCl (QPredReflV2 np v) = IntVP np (ComplReflV2 v) ;
trQCl (QPredVS np v x) = IntVP np (ComplVS v x) ;
trQCl (QPredVV np v x) = IntVP np (ComplVV v x) ;
trQCl (QPredVQ np v x) = IntVP np (ComplVQ v x) ;
trQCl (QPredVA np v x) = IntVP np (ComplVA v x) ;
trQCl (QPredV2A np v x y) = IntVP np (ComplV2A v x y) ;
trQCl (QPredSubjV2V np v x y) = IntVP np (ComplSubjV2V v x y) ;
trQCl (QPredObjV2V np v x y) = IntVP np (ComplObjV2V v x y) ;
trQCl (QPredV2S np v x y) = IntVP np (ComplV2S v x y) ;
trQCl (QPredV2Q np v x y) = IntVP np (ComplV2Q v x y) ;
trQCl (QPredAP np v) = IntVP np (PredAP v) ;
trQCl (QPredCN np v) = IntVP np (PredCN v) ;
trQCl (QPredNP np v) = IntVP np (PredNP v) ;
trQCl (QPredAdv np v) = IntVP np (PredAdv v) ;
trQCl (QPredProgVP np vp) = IntVP np (PredProgVP vp) ;
trRCl (RPredV np v) = RelVP np (UseV v) ;
trRCl (RPredPassV np v) = RelVP np (UsePassV v) ;
trRCl (RPredV2 np v x) = RelVP np (ComplV2 v x) ;
trRCl (RPredV3 np v x y) = RelVP np (ComplV3 v x y) ;
trRCl (RPredReflV2 np v) = RelVP np (ComplReflV2 v) ;
trRCl (RPredVS np v x) = RelVP np (ComplVS v x) ;
trRCl (RPredVV np v x) = RelVP np (ComplVV v x) ;
trRCl (RPredVQ np v x) = RelVP np (ComplVQ v x) ;
trRCl (RPredVA np v x) = RelVP np (ComplVA v x) ;
trRCl (RPredV2A np v x y) = RelVP np (ComplV2A v x y) ;
trRCl (RPredSubjV2V np v x y) = RelVP np (ComplSubjV2V v x y) ;
trRCl (RPredObjV2V np v x y) = RelVP np (ComplObjV2V v x y) ;
trRCl (RPredV2S np v x y) = RelVP np (ComplV2S v x y) ;
trRCl (RPredV2Q np v x y) = RelVP np (ComplV2Q v x y) ;
trRCl (RPredAP np v) = RelVP np (PredAP v) ;
trRCl (RPredCN np v) = RelVP np (PredCN v) ;
trRCl (RPredNP np v) = RelVP np (PredNP v) ;
trRCl (RPredAdv np v) = RelVP np (PredAdv v) ;
trRCl (RPredProgVP np vp) = RelVP np (PredProgVP vp) ;
trVCl (IPredV v) = UseVP (UseV v) ;
trVCl (IPredV2 v x) = UseVP (ComplV2 v x) ;
trVCl (IPredPassV v) = UseVP (UsePassV v) ;
trVCl (IPredV3 v x y) = UseVP (ComplV3 v x y) ;
trVCl (IPredReflV2 v) = UseVP (ComplReflV2 v) ;
trVCl (IPredVS v x) = UseVP (ComplVS v x) ;
trVCl (IPredVV v x) = UseVP (ComplVV v x) ;
trVCl (IPredVQ v x) = UseVP (ComplVQ v x) ;
trVCl (IPredVA v x) = UseVP (ComplVA v x) ;
trVCl (IPredV2A v x y) = UseVP (ComplV2A v x y) ;
trVCl (IPredSubjV2V v x y) = UseVP (ComplSubjV2V v x y) ;
trVCl (IPredObjV2V v x y) = UseVP (ComplObjV2V v x y) ;
trVCl (IPredV2S v x y) = UseVP (ComplV2S v x y) ;
trVCl (IPredV2Q v x y) = UseVP (ComplV2Q v x y) ;
trVCl (IPredAP v) = UseVP (PredAP v) ;
trVCl (IPredCN v) = UseVP (PredCN v) ;
trVCl (IPredNP v) = UseVP (PredNP v) ;
trVCl (IPredAdv v) = UseVP (PredAdv v) ;
trVCl (IPredProgVP vp) = UseVP (PredProgVP vp) ;
{-
-- Use VPs
trRCl (IntVP) = intVerbPhrase ;
trRCl (RelVP) = relVerbPhrase ;
trRCl (PosVP tp) = predVerbGroup True tp.a ;
trRCl (NegVP tp) = predVerbGroup False tp.a ;
trRCl (AdvVP) = adVerbPhrase ;
trRCl (SubjVP) = subjunctVerbPhrase ;
-}
}

View File

@@ -0,0 +1,23 @@
abstract Country = {
cat
Country ; Nationality ; Language ;
fun
Denmark,
England,
Finland,
France,
Germany,
Italy,
Norway,
Russia,
Spain,
Sweden
: Country ;
Danish,
English
: Nationality ;
DanishLang,
EnglishLang
: Language ;
} ;

View File

@@ -0,0 +1,56 @@
interface DemRes = open Prelude, Resource in {
oper
Pointing = {s5 : Str} ;
noPointing : Pointing = {s5 = []} ;
mkDemS : Cl -> DemAdverb -> Pointing -> MultiSentence = \cl,adv,p ->
{s = table {
MInd b => msS (UseCl (polar b) (AdvCl cl adv)) ;
MQuest b => msQS (UseQCl (polar b) (QuestCl (AdvCl cl adv)))
} ;
s5 = p.s5 ++ adv.s5
} ;
polar : Bool -> TP = \b -> case b of {
True => PosTP TPresent ASimul ;
False => NegTP TPresent ASimul
} ;
mkDemQ : QCl -> DemAdverb -> Pointing -> MultiQuestion = \cl,adv,p ->
{s = \\b => msQS (UseQCl (polar b) cl) ++ adv.s ; --- (AdvQCl cl adv)) ;
s5 = p.s5 ++ adv.s5
} ;
mkDemImp : VCl -> DemAdverb -> Pointing -> MultiImperative = \cl,adv,p ->
{s = table {
True => msImp (PosImpVP cl) ++ adv.s ;
False => msImp (NegImpVP cl) ++ adv.s
} ;
s5 = p.s5 ++ adv.s5
} ;
msS : S -> Str ;
msQS : QS -> Str ;
msImp : Imp -> Str ;
concatDem : (x,y : Pointing) -> Pointing = \x,y -> {
s5 = x.s5 ++ y.s5
} ;
mkDemType : Type -> Type = \t -> t ** Pointing ;
MultiSentence : Type = mkDemType {s : MSForm => Str} ;
MultiQuestion : Type = mkDemType {s : Bool => Str} ;
MultiImperative : Type = mkDemType {s : Bool => Str} ;
Demonstrative : Type = mkDemType NP ;
DemAdverb : Type = mkDemType Adv ;
mkDAdv : Adv -> Pointing -> DemAdverb = \a,p ->
a ** p ** {lock_Adv = a.lock_Adv} ;
param
MSForm = MInd Bool | MQuest Bool ;
}

View File

@@ -0,0 +1,44 @@
abstract Demonstrative = Categories ** {
cat
MS ; -- multimodal sentence or question
MQS ; -- multimodal wh question
MImp ; -- multimodal imperative
DNP ; -- demonstrative noun phrase
DAdv ; -- demonstrative adverbial
[DAdv] ; -- list of demonstrative adverbials
Point ; -- pointing gesture
fun
MkPoint : String -> Point ;
DemV : V -> DNP -> [DAdv] -> MS ; -- this flies (here)
DemV2 : V2 -> DNP -> DNP -> [DAdv] -> MS ; -- this takes that
ModDemV : VV -> V -> DNP -> [DAdv] -> MS ; -- this wants to fly
ModDemV2 : VV -> V2 -> DNP -> DNP -> [DAdv] -> MS ; -- this wants to take that
ImpDemV : V -> [DAdv] -> MImp ; -- fly (here)
ImpDemV2 : V2 -> DNP -> [DAdv] -> MImp ; -- take that
QDemV : V -> IP -> [DAdv] -> MQS ; -- who flies (here)
QDemV2 : V2 -> IP -> DNP -> [DAdv] -> MQS ; -- who takes that
QDemSlashV2 : V2 -> DNP -> IP -> [DAdv] -> MQS ; -- whom does that take
QModDemV : VV -> V -> IP -> [DAdv] -> MQS ; -- who wants to fly (here)
QModDemV2 : VV -> V2 -> IP -> DNP -> [DAdv] -> MQS ; -- who wants to take that
QModDemSlashV2 : VV -> V2 -> DNP -> IP -> [DAdv] -> MQS ; -- whom does that want to take
this_DNP : Point -> DNP ; -- this
that_DNP : Point -> DNP ; -- that
thisDet_DNP : Point -> CN -> DNP ; -- this car
thatDet_DNP : Point -> CN -> DNP ; -- that car
here_DAdv : Point -> DAdv ; -- here
here7from_DAdv : Point -> DAdv ; -- from here
here7to_DAdv : Point -> DAdv ; -- to here
PrepDNP : Prep -> DNP -> DAdv ;
-- to test
point1, point2 : Point ;
}

View File

@@ -0,0 +1,62 @@
--# -path=.:../abstract:../../prelude
incomplete concrete DemonstrativeI of Demonstrative =
open Prelude, Resource, Basic, DemRes in {
lincat
MS = MultiSentence ;
MQS = MultiQuestion ;
MImp = MultiImperative ;
DNP = Demonstrative ;
DAdv = DemAdverb ;
[DAdv] = DemAdverb ;
Point = Pointing ;
lin
MkPoint s = {s5 = s.s} ;
DemV verb dem adv =
mkDemS (SPredV dem verb) adv dem ;
DemV2 verb su ob adv =
mkDemS (SPredV2 su verb ob) adv (concatDem su ob) ;
ModDemV vv verb dem adv =
mkDemS (SPredVV dem vv (UseVCl PPos ASimul (IPredV verb))) adv dem ;
ModDemV2 vv verb su ob adv =
mkDemS (SPredVV su vv (UseVCl PPos ASimul (IPredV2 verb ob))) adv (concatDem su ob) ;
ImpDemV verb adv =
mkDemImp (IPredV verb) adv noPointing ;
ImpDemV2 verb ob adv =
mkDemImp (IPredV2 verb ob) adv ob ;
QDemV verb ip adv =
mkDemQ (QPredV ip verb) adv noPointing ;
QDemV2 verb ip ob adv =
mkDemQ (QPredV2 ip verb ob) adv ob ;
QDemSlashV2 verb su ip adv =
mkDemQ (IntSlash ip (SlashV2 su verb)) adv su ;
QModDemV vv verb ip adv =
mkDemQ (QPredVV ip vv (UseVCl PPos ASimul (IPredV verb))) adv noPointing ;
QModDemV2 vv verb ip ob adv =
mkDemQ (QPredVV ip vv (UseVCl PPos ASimul (IPredV2 verb ob))) adv ob ;
QModDemSlashV2 vv verb su ip adv =
mkDemQ (IntSlash ip (SlashVV2 su vv verb)) adv su ;
this_DNP p = this_NP ** p ;
that_DNP p = that_NP ** p ;
thisDet_DNP p cn = DetNP this_Det cn ** p ;
thatDet_DNP p cn = DetNP that_Det cn ** p ;
here_DAdv p = mkDAdv here_Adv p ;
here7from_DAdv p = mkDAdv here7from_Adv p ;
here7to_DAdv p = mkDAdv here7to_Adv p ;
BaseDAdv = {s,s5 = [] ; lock_Adv = <>} ;
ConsDAdv a as = {s = a.s ++ as.s ; s5 = a.s5 ++ as.s5 ; lock_Adv = <>} ;
PrepDNP p np = mkDAdv (AdvPP (PrepNP p np)) np ;
point1 = {s5 = "p1"} ;
point2 = {s5 = "p2"} ;
}

View File

@@ -0,0 +1,31 @@
--# -path=.:../../prelude
abstract Lang =
Rules,
Clause,
Structural,
Basic,
Time,
Country,
Math
** {
flags startcat=Phr ;
fun
-- Mount $Time$.
AdvDate : Date -> Adv ;
AdvTime : Time -> Adv ;
NWeekday : Weekday -> N ;
PNWeekday : Weekday -> PN ;
-- Mount $Country$.
PNCountry : Country -> PN ;
ANationality : Nationality -> A ;
NLanguage : Language -> N ;
}

View File

@@ -0,0 +1,13 @@
--# -path=.:../abstract:../../prelude
-- alternative API that is able to return VP's by parsing with Cl
-- constructors and then computing. AR 14/11/2005
--
-- to import: 'i -noparse=vp.gfnoparse LangVPEng'
-- to use: 'p -cat=Cl "I see her" | wt -c trCl'
abstract LangVP =
Lang,
Verbphrase,
ClauseVP ** {
} ;

View File

@@ -0,0 +1,53 @@
abstract Math = Categories ** {
--3 Noun phrases with symbols
fun
SymbPN : String -> PN ; -- "x"
IntPN : Int -> PN ; -- "27"
IntNP : CN -> Int -> NP ; -- "level 53"
IndefSymbNumNP : Num -> CN -> SymbList -> NP ; -- "(2) numbers x and y"
DefSymbNumNP : Num -> CN -> SymbList -> NP ; -- "the (2) numbers x and y"
NDetSymbNP : NDet -> Num -> CN -> SymbList -> NP ; -- "some (3) points x, y and z"
--3 Symbol lists
-- A symbol list has at least two elements. The last two are separated
-- by a conjunction ("and" in English), the others by commas.
-- This produces "x, y and z", in English.
cat
SymbList ;
fun
SymbTwo : String -> String -> SymbList ;
SymbMore : String -> SymbList -> SymbList ;
--3 Special forms of expression
-- This expression form is typical of mathematical texts.
-- It is realized with different constructs in different languages, typically
-- some kind of 3rd person imperative of the verb "be".
LetImp : NP -> NP -> Imp ; -- let x be a number
-- This rule is slightly overgenerating: "there exists every number x".
-- The problem seems to be of semantic nature. By this we avoid having many rules.
ExistNP : NP -> Cl ; -- there exist (2) number(s) x and y
--3 Rules moved from $Rules$.
-- This rule is powerful but overgenerating.
SymbCN : CN -> String -> CN ; -- "number x"
-- This rule is simply wrong, and will be deprecated: the correct
-- value type is $NP$.
IntCN : CN -> Int -> CN ; -- "level 53"
}

View File

@@ -0,0 +1,43 @@
--# -path=.:../../prelude
abstract Minimal = Categories ** {
-- a minimum sample of lexicon to test resource grammar with
fun
-- nouns: count and mass, relational
man_N : N ;
wine_N : N ;
mother_N2 : N2 ;
distance_N3 : N3 ;
-- proper names
john_PN : PN ;
-- adjectives: with and without degree
blue_ADeg : ADeg ;
american_A : A ;
-- adjectives: noun phase, sentence, and verb complements
married_A2 : A2 ;
probable_AS : AS ;
important_A2S : A2S ;
easy_A2V : A2V ;
-- adverbs
now_Adv : Adv ;
-- verbs
walk_V : V ;
love_V2 : V2 ;
give_V3 : V3 ;
believe_VS : VS ;
try_VV : VV ;
wonder_VQ : VQ ;
become_VA : VA ;
paint_V2A : V2A ;
promise_V2V : V2V ;
ask_V2Q : V2Q ;
tell_V2S : V2S ;
rain_V0 : V0 ;
} ;

View File

@@ -0,0 +1,30 @@
--# -path=.:../../prelude
abstract Multimodal =
Rules,
Structural,
Basic,
Time,
Demonstrative
** {
flags startcat=Phr ;
fun
-- Interface to $Demonstrative$.
DemNP : NP -> DNP ;
DemAdv : Adv -> DAdv ;
SentMS : Pol -> MS -> Phr ;
QuestMS : Pol -> MS -> Phr ;
QuestMQS : Pol -> MQS -> Phr ;
ImpMImp : Pol -> MImp -> Phr ;
-- Mount $Time$.
AdvDate : Date -> Adv ;
AdvTime : Time -> Adv ;
}

View File

@@ -0,0 +1,16 @@
incomplete concrete MultimodalI of Multimodal =
open Prelude, Resource, Basic, Lang, DemRes in {
lin
DemNP np = np ** {s5 = [] ; lock_NP = <>} ;
DemAdv adv = mkDAdv (adv ** {lock_Adv = <>}) {s5 = []} ;
SentMS p ms = {s = p.s ++ ms.s ! MInd (p.p) ++ ";" ++ ms.s5} ;
QuestMS p ms = {s = p.s ++ ms.s ! MQuest (p.p) ++ ";" ++ ms.s5} ;
QuestMQS p ms = {s = p.s ++ ms.s ! p.p ++ ";" ++ ms.s5} ;
ImpMImp p ms = {s = p.s ++ ms.s ! p.p ++ ";" ++ ms.s5} ;
AdvDate = AdvDate ;
AdvTime = AdvTime ;
}

View File

@@ -0,0 +1,34 @@
-- numerals from 1 to 999999 in decimal notation
abstract Numerals = {
flags startcat=Numeral ;
cat
Numeral ; -- 0..
Digit ; -- 2..9
Sub10 ; -- 1..9
Sub100 ; -- 1..99
Sub1000 ; -- 1..999
Sub1000000 ; -- 1..999999
fun
num : Sub1000000 -> Numeral ;
n2, n3, n4, n5, n6, n7, n8, n9 : Digit ;
pot01 : Sub10 ; -- 1
pot0 : Digit -> Sub10 ; -- d * 1
pot110 : Sub100 ; -- 10
pot111 : Sub100 ; -- 11
pot1to19 : Digit -> Sub100 ; -- 10 + d
pot0as1 : Sub10 -> Sub100 ; -- coercion of 1..9
pot1 : Digit -> Sub100 ; -- d * 10
pot1plus : Digit -> Sub10 -> Sub100 ; -- d * 10 + n
pot1as2 : Sub100 -> Sub1000 ; -- coercion of 1..99
pot2 : Sub10 -> Sub1000 ; -- m * 100
pot2plus : Sub10 -> Sub100 -> Sub1000 ; -- m * 100 + n
pot2as3 : Sub1000 -> Sub1000000 ; -- coercion of 1..999
pot3 : Sub1000 -> Sub1000000 ; -- m * 1000
pot3plus : Sub1000 -> Sub1000 -> Sub1000000 ; -- m * 1000 + n
}

View File

@@ -0,0 +1,44 @@
abstract Predic = Categories ** {
cat
VType ;
CType ;
Verb VType ;
Compl VType ;
fun
Vt_ : VType ;
Vt : CType -> VType ;
VtN : CType -> VType ;
CtN, CtS, CtV, CtQ, CtA : CType ;
SPredVerb : (v : VType) -> NP -> Verb v -> Compl v -> Cl ;
QPredVerb : (v : VType) -> IP -> Verb v -> Compl v -> QCl ;
RPredVerb : (v : VType) -> RP -> Verb v -> Compl v -> RCl ;
IPredVerb : (v : VType) -> Verb v -> Compl v -> VCl ;
Compl_ : Compl Vt_ ;
ComplN : NP -> Compl (Vt CtN) ;
ComplS : S -> Compl (Vt CtS) ;
ComplQ : QS -> Compl (Vt CtQ) ;
ComplA : AP -> Compl (Vt CtQ) ;
ComplAdd : (c : CType) -> NP -> Compl (Vt c) -> Compl (VtN c) ;
VeV1 : V -> Verb Vt_ ;
VeV2 : V2 -> Verb (Vt CtN) ;
VeVS : VS -> Verb (Vt CtS) ;
VeV3 : V3 -> Verb (VtN CtN) ;
VeV2S : V2S -> Verb (VtN CtS) ;
VeV2Q : V2Q -> Verb (VtN CtQ) ;
---- etc
}
{-
MkSlash3 : NG NtS -> VG (VtN CtN) -> CG (Vt CtN) -> Slash ;
MkSlash2 : (c : CType) -> NG NtS -> VG (VtN c) -> CG (Vt c) -> Slash ;
MkSlash1 : NG NtS -> VG (Vt CtN) -> Slash ;
SlashQ : NG NtQ -> Slash -> SG NtQ ;
-}

View File

@@ -0,0 +1,3 @@
--# -path=.:../../prelude
abstract Resource = Rules, Clause, Structural ** {} ;

View File

@@ -0,0 +1,243 @@
--!
--2 Rules
--
-- This set of rules is minimal, in the sense of defining the simplest combinations
-- of categories and not having redundant rules.
-- When the resource grammar is used as a library, it will often be useful to
-- access it through an intermediate library that defines more rules as
-- 'macros' for combinations of the ones below.
abstract Rules = Categories ** {
--!
--3 Nouns and noun phrases
--
fun
UseN : N -> CN ; -- "car"
UsePN : PN -> NP ; -- "John"
-- These three rules have been moved to the module $Math$.
{-
SymbPN : String -> PN ; -- "x"
SymbCN : CN -> String -> CN ; -- "number x"
IntCN : CN -> Int -> CN ; -- "number 53"
-}
IndefOneNP : CN -> NP ; -- "a car", "cars"
IndefNumNP : Num -> CN -> NP ; -- "houses", "86 houses"
DefOneNP : CN -> NP ; -- "the car"
DefNumNP : Num -> CN -> NP ; -- "the cars", "the 86 cars"
DetNP : Det -> CN -> NP ; -- "every car"
NDetNP : NDet -> Num -> CN -> NP ; -- "these (5) cars"
NDetNum : NDet -> Num -> NP ; -- "these (5)"
MassNP : CN -> NP ; -- "wine"
AppN2 : N2 -> NP -> CN ; -- "successor of zero"
AppN3 : N3 -> NP -> N2 ; -- "flight from Paris"
UseN2 : N2 -> CN ; -- "successor"
ModAP : AP -> CN -> CN ; -- "red car"
CNthatS : CN -> S -> CN ; -- "idea that the Earth is flat"
ModGenOne : NP -> CN -> NP ; -- "John's car"
ModGenNum : Num -> NP -> CN -> NP ; -- "John's cars", "John's 86 cars"
UseInt : Int -> Num ; -- "32" --- assumes i > 1
NoNum : Num ; -- no numeral modifier
--!
--3 Adjectives and adjectival phrases
--
UseA : A -> AP ; -- "red"
ComplA2 : A2 -> NP -> AP ; -- "divisible by two"
PositADeg : ADeg -> AP ; -- "old"
ComparADeg : ADeg -> NP -> AP ; -- "older than John"
SuperlADeg : ADeg -> AP ; -- "the oldest"
ComplAV : AV -> VPI -> AP ; -- "eager to leave"
ComplObjA2V : A2V -> NP -> VPI -> AP ; -- "easy for us to convince"
--!
--3 Verbs and verb phrases
--
-- The main uses of verbs and verb phrases have been moved to the
-- module $Verbphrase$ (deep $VP$ nesting) and its alternative,
-- $Clause$ (shallow many-place predication structure).
PredAS : AS -> S -> Cl ; -- "it is good that he comes"
PredV0 : V0 -> Cl ; -- "it is raining"
-- Partial saturation.
UseV2 : V2 -> V ; -- "loves"
ComplA2S : A2S -> NP -> AS ; -- "good for John"
UseV2V : V2V -> VV ;
UseV2S : V2S -> VS ;
UseV2Q : V2Q -> VQ ;
UseA2S : A2S -> AS ;
UseA2V : A2V -> AV ;
-- Formation of tensed phrases.
AdjPart : V -> A ; -- past participle, e.g. "forgotten"
UseCl : TP -> Cl -> S ;
UseRCl : TP -> RCl -> RS ;
UseQCl : TP -> QCl -> QS ;
UseVCl : Pol -> Ant -> VCl -> VPI ;
PosTP : Tense -> Ant -> TP ;
NegTP : Tense -> Ant -> TP ;
TPresent : Tense ;
TPast : Tense ;
TFuture : Tense ;
TConditional : Tense ;
ASimul : Ant ;
AAnter : Ant ;
PPos : Pol ;
PNeg : Pol ;
--!
--3 Adverbs
--
-- Here is how complex adverbs can be formed and used.
AdjAdv : A -> Adv ; -- "freely"
AdvPP : PP -> Adv ; -- "in London", "after the war"
PrepNP : Prep -> NP -> PP ; -- "in London", "after the war"
AdvCN : CN -> Adv -> CN ; -- "house in London"
AdvNP : NP -> Adv -> NP ; -- "the house in London"
AdvAP : AdA -> AP -> AP ; -- "very good"
AdvAdv : AdA -> Adv -> Adv ; -- "very well"
--!
--3 Sentences and relative clauses
--
SlashV2 : NP -> V2 -> Slash ; -- "(whom) John doesn't love"
SlashVV2 : NP -> VV -> V2 -> Slash ; -- "(which song do you) want to play"
SlashAdv : Cl -> Prep -> Slash ; -- "(whom) John walks with"
IdRP : RP ; -- "which"
FunRP : N2 -> RP -> RP ; -- "the successor of which"
RelSlash : RP -> Slash -> RCl ; -- "that I wait for"/"for which I wait"
ModRS : CN -> RS -> CN ; -- "man who walks"
RelCl : Cl -> RCl ; -- "such that it is even"
--!
--3 Questions and imperatives
--
FunIP : N2 -> IP -> IP ; -- "the mother of whom"
IDetCN : IDet -> CN -> IP ; -- "which car", "which cars"
QuestCl : Cl -> QCl ; -- "does John walk"; "doesn't John walk"
IntSlash : IP -> Slash -> QCl ; -- "whom does John see"
QuestAdv : IAdv -> Cl -> QCl ; -- "why do you walk"
PosImpVP, NegImpVP : VCl -> Imp ; -- "(don't) be a man"
----rename these ??
IndicPhrase : S -> Phr ; -- "I walk."
QuestPhrase : QS -> Phr ; -- "Do I walk?"
ImperOne, ImperMany : Imp -> Phr ; -- "Be a man!", "Be men!"
AdvCl : Cl -> Adv -> Cl ; -- "John walks in the park"
AdvVPI : VPI -> Adv -> VPI ; -- "walk in the park"
AdCPhr : AdC -> S -> Phr ; -- "Therefore, 2 is prime."
AdvPhr : Adv -> S -> Phr ; -- "In India, there are tigers."
--!
--3 Coordination
--
-- We consider "n"-ary coordination, with "n" > 1. To this end, we have introduced
-- a *list category* $ListX$ for each category $X$ whose expressions we want to
-- conjoin. Each list category has two constructors, the base case being $TwoX$.
-- We have not defined coordination of all possible categories here,
-- since it can be tricky in many languages. For instance, $VP$ coordination
-- is linguistically problematic in German because $VP$ is a discontinuous
-- category.
ConjS : Conj -> ListS -> S ; -- "John walks and Mary runs"
ConjAP : Conj -> ListAP -> AP ; -- "even and prime"
ConjNP : Conj -> ListNP -> NP ; -- "John or Mary"
ConjAdv : Conj -> ListAdv -> Adv ; -- "quickly or slowly"
ConjDS : ConjD -> ListS -> S ; -- "either John walks or Mary runs"
ConjDAP : ConjD -> ListAP -> AP ; -- "both even and prime"
ConjDNP : ConjD -> ListNP -> NP ; -- "either John or Mary"
ConjDAdv : ConjD -> ListAdv -> Adv ; -- "both badly and slowly"
TwoS : S -> S -> ListS ;
ConsS : ListS -> S -> ListS ;
TwoAP : AP -> AP -> ListAP ;
ConsAP : ListAP -> AP -> ListAP ;
TwoNP : NP -> NP -> ListNP ;
ConsNP : ListNP -> NP -> ListNP ;
TwoAdv : Adv -> Adv -> ListAdv ;
ConsAdv : ListAdv -> Adv -> ListAdv ;
--!
--3 Subordination
--
-- Subjunctions are different from conjunctions, but form
-- a uniform category among themselves.
SubjS : Subj -> S -> S -> S ; -- "if 2 is odd, 3 is even"
SubjImper : Subj -> S -> Imp -> Imp ; -- "if it is hot, use a glove!"
SubjQS : Subj -> S -> QS -> QS ; -- "if you are new, who are you?"
-- This rule makes a subordinate clause into a sentence adverb, which
-- can be attached to e.g. noun phrases. It might even replace the
-- previous subjunction rules.
AdvSubj : Subj -> S -> Adv ; -- "when he arrives"
--!
--2 One-word utterances
--
-- These are, more generally, *one-phrase utterances*. The list below
-- is very incomplete.
PhrNP : NP -> Phr ; -- "Some man.", "John."
PhrOneCN, PhrManyCN : CN -> Phr ; -- "A car.", "Cars."
PhrIP : IAdv -> Phr ; -- "Who?"
PhrIAdv : IAdv -> Phr ; -- "Why?"
PhrVPI : VPI -> Phr ; -- "Tända ljus."
--!
--2 Text formation
--
-- A text is a sequence of phrases. It is defined like a non-empty list.
OnePhr : Phr -> Text ;
ConsPhr : Phr -> Text -> Text ;
--2 Special constructs.
--
-- These constructs tend to have language-specific syntactic realizations.
ExistCN : CN -> Cl ; -- "there is a bar"
ExistNumCN : Num -> CN -> Cl ; -- "there are (86) bars"
OneNP : NP ; -- "one (walks)"
} ;

View File

@@ -0,0 +1,49 @@
--1 Topological structure of Scandinavian sentences.
--
-- This is an alternative, more 'native' analysis than $Clause$ and
-- $Verbphrase$, due to Diderichsen.
--
-- Sources:
-- N. Jörgensen & J. Svensson, "Nusvensk grammatik" (Gleerups, 2001);
-- R. Zola Christensen, "Dansk grammatik for svenskere"
-- (Studentlitteratur 1999).
abstract Sats = Categories ** {
-- Idea: form primarily a $Sats$, which can then be lifted to a $Cl$
-- and used elsewhere in grammar.
cat Sats ;
fun
ClSats : Sats -> Cl ;
-- There will be $Sats$-forming functions for all subcategorization
-- patterns of verbs.
SatsV : NP -> V -> Sats ;
SatsV2 : NP -> V2 -> NP -> Sats ;
SatsV3 : NP -> V3 -> NP -> NP -> Sats ;
SatsReflV2 : NP -> V2 -> Sats ;
SatsVS : NP -> VS -> S -> Sats ;
SatsVQ : NP -> VQ -> QS -> Sats ;
SatsV2S : NP -> V2S -> NP -> S -> Sats ;
SatsV2Q : NP -> V2Q -> NP -> QS -> Sats ;
SatsAP : NP -> AP -> Sats ;
SatsCN : NP -> CN -> Sats ;
SatsNP : NP -> NP -> Sats ;
SatsAdv : NP -> Adv -> Sats ;
-- To a $Sats$, you can insert a sentence adverbial ($AdV$, e.g. "ändå") or
-- 'TSR' adverbial ($Adv$, e.g. "nu"; the name TSR is from Jörgensen
-- and Svensson).
AdVSats : Sats -> AdV -> Sats ;
AdvSats : Sats -> Adv -> Sats ;
-- We can also insert a verb-complement verb.
VVSats : Sats -> VV -> Sats ;
}

View File

@@ -0,0 +1,41 @@
abstract Simple = Categories ** {
cat
Sentence ;
fun
PAffirm : Sentence -> Phr ;
PNegate : Sentence -> Phr ;
PQuestion : Sentence -> Phr ;
PCommand : Imp -> Phr ;
SVerb : NP -> V -> Sentence ;
STransVerb : NP -> V2 -> NP -> Sentence ;
SAdjective : NP -> AP -> Sentence ;
SAdverb : NP -> Adv -> Sentence ;
SModified : Sentence -> Adv -> Sentence ;
PIntV : IP -> V -> Phr ;
PIntSubjV2 : IP -> V2 -> NP -> Phr ;
PIntObjV2 : IP -> NP -> V2 -> Phr ;
PIntAP : IP -> AP -> Phr ;
PIntAdv : IP -> Adv -> Phr ;
NPDef : CN -> NP ;
NPIndef : CN -> NP ;
NPGroup : CN -> NP ;
NPMass : CN -> NP ;
NPName : PN -> NP ;
NSimple : N -> CN ;
NModified : AP -> CN -> CN ;
ASimple : ADeg -> AP ;
AVery : ADeg -> AP ;
AdvPrep : Prep -> NP -> Adv ;
}

View File

@@ -0,0 +1,6 @@
resource SimpleAux = {
param
SentenceForm = SAffirm | SNegate | SQuestion ;
}

View File

@@ -0,0 +1,73 @@
incomplete concrete SimpleI of Simple =
open Predef, Prelude, SimpleAux, Categories, Rules, Structural, Verbphrase in {
lincat
Sentence = {s : SentenceForm => Str} ;
lin
PAffirm sent = ss (sent.s ! SAffirm) ** {lock_Phr = <>} ;
PNegate sent = ss (sent.s ! SNegate) ** {lock_Phr = <>} ;
PQuestion sent = ss (sent.s ! SQuestion) ** {lock_Phr = <>} ;
PCommand = ImperOne ;
SVerb np v = {s = table {
SAffirm => toStr S (UseCl (PosTP TPresent ASimul) (PredVP np (UseV v))) ;
SNegate => toStr S (UseCl (NegTP TPresent ASimul) (PredVP np (UseV v))) ;
SQuestion => toStr QS (UseQCl (PosTP TPresent ASimul) (QuestCl (PredVP np
(UseV v))))
}
} ;
STransVerb np tv obj = {s = table {
SAffirm => toStr S (UseCl (PosTP TPresent ASimul) (PredVP np (ComplV2 tv obj))) ;
SNegate => toStr S (UseCl (PosTP TPresent ASimul) (PredVP np (ComplV2 tv obj))) ;
SQuestion =>
toStr QS (UseQCl (PosTP TPresent ASimul) (QuestCl (PredVP np (ComplV2 tv obj))))
}
} ;
SAdjective np ap = {s = table {
SAffirm => toStr S (UseCl (PosTP TPresent ASimul) (PredVP np (PredAP ap))) ;
SNegate => toStr S (UseCl (NegTP TPresent ASimul) (PredVP np (PredAP ap))) ;
SQuestion => toStr QS (UseQCl (PosTP TPresent ASimul) (QuestCl (PredVP np
(PredAP ap))))
}
} ;
SAdverb np ap = {s = table {
SAffirm => toStr S (UseCl (PosTP TPresent ASimul) (PredVP np (PredAdv ap))) ;
SNegate => toStr S (UseCl (NegTP TPresent ASimul) (PredVP np (PredAdv ap))) ;
SQuestion => toStr QS (UseQCl (PosTP TPresent ASimul) (QuestCl (PredVP np
(PredAdv ap))))
}
} ;
SModified s a = {s = \\f => s.s ! f ++ a.s ; lock_S = <>} ; ---
PIntV ip v =
QuestPhrase (UseQCl (PosTP TPresent ASimul) (IntVP ip (UseV v))) ;
PIntSubjV2 ip v np =
QuestPhrase (UseQCl (PosTP TPresent ASimul) (IntVP ip (ComplV2 v np))) ;
PIntObjV2 ip np v =
QuestPhrase (UseQCl (PosTP TPresent ASimul) (IntSlash ip (SlashV2 np v))) ;
PIntAP ip v =
QuestPhrase (UseQCl (PosTP TPresent ASimul) (IntVP ip (PredAP v))) ;
PIntAdv ip v =
QuestPhrase (UseQCl (PosTP TPresent ASimul) (IntVP ip (PredAdv v))) ;
NPDef = DefOneNP ;
NPIndef = IndefOneNP ;
NPGroup = IndefNumNP NoNum ;
NPMass = MassNP ;
NPName = UsePN ;
NSimple = UseN ;
NModified = ModAP ;
ASimple = PositADeg ;
AVery a = AdvAP very_Adv (PositADeg a) ;
AdvPrep p np = AdvPP (PrepNP p np) ;
}

View File

@@ -0,0 +1,26 @@
--# -path=.:../../prelude
abstract SimpleLang =
Simple,
Structural,
Basic,
Time,
Country
** {
fun
-- Mount $Time$.
AdvDate : Date -> Adv ;
AdvTime : Time -> Adv ;
NWeekday : Weekday -> N ;
PNWeekday : Weekday -> PN ;
-- Mount $Country$.
PNCountry : Country -> PN ;
ANationality : Nationality -> A ;
NLanguage : Language -> N ;
}

View File

@@ -0,0 +1,103 @@
--1 GF Resource Grammar API for Structural Words
--
-- AR 21/11/2003
--
-- Here we have some words belonging to closed classes and appearing
-- in all languages we have considered.
-- Sometimes they are not really meaningful, e.g. $we_NP$ in Spanish
-- should be replaced by masculine and feminine variants.
abstract Structural = Categories, Numerals ** {
fun
-- First mount the numerals.
UseNumeral : Numeral-> Num ;
-- Then an alphabetical list of structural words
above_Prep : Prep ;
after_Prep : Prep ;
all8mass_Det : Det ;
all_NDet : NDet ;
almost_Adv : AdA ;
although_Subj : Subj ;
and_Conj : Conj ;
because_Subj : Subj ;
before_Prep : Prep ;
behind_Prep : Prep ;
between_Prep : Prep ;
both_AndConjD : ConjD ;
by8agent_Prep : Prep ;
by8means_Prep : Prep ;
can8know_VV : VV ;
can_VV : VV ;
during_Prep : Prep ;
either8or_ConjD : ConjD ;
every_Det : Det ;
everybody_NP : NP ;
everything_NP : NP ;
everywhere_Adv : Adv ;
from_Prep : Prep ;
he_NP : NP ;
how_IAdv : IAdv ;
how8many_IDet : IDet ;
i_NP : NP ;
if_Subj : Subj ;
in8front_Prep : Prep ;
in_Prep : Prep ;
it_NP : NP ;
many_Det : Det ;
most_Det : Det ;
most8many_Det : Det ;
much_Det : Det ;
must_VV : VV ;
no_Phr : Phr ;
on_Prep : Prep ;
or_Conj : Conj ;
otherwise_Adv : AdC ;
part_Prep : Prep ;
possess_Prep : Prep ;
quite_Adv : AdA ;
she_NP : NP ;
so_Adv : AdA ;
some_Det : Det ;
some_NDet : NDet ;
somebody_NP : NP ;
something_NP : NP ;
somewhere_Adv : Adv ;
that_Det : Det ;
that_NP : NP ;
therefore_Adv : AdC ;
these_NDet : NDet ;
they8fem_NP : NP ;
they_NP : NP ;
this_Det : Det ;
this_NP : NP ;
those_NDet : NDet ;
thou_NP : NP ;
through_Prep : Prep ;
to_Prep : Prep ;
too_Adv : AdA ;
under_Prep : Prep ;
very_Adv : AdA ;
want_VV : VV ;
we_NP : NP ;
what8many_IP : IP ;
what8one_IP : IP ;
when_IAdv : IAdv ;
when_Subj : Subj ;
where_IAdv : IAdv ;
which8many_IDet : IDet ;
which8one_IDet : IDet ;
who8many_IP : IP ;
who8one_IP : IP ;
why_IAdv : IAdv ;
with_Prep : Prep ;
without_Prep : Prep ;
ye_NP : NP ;
yes_Phr : Phr ;
you_NP : NP ;
}

View File

@@ -0,0 +1,243 @@
-- Swadesh 207
abstract SwadeshLex = Categories ** {
fun
-- Pronouns
i_NP : NP ;
thou_NP : NP ;
he_NP : NP ;
we_NP : NP ;
you_NP : NP ;
they_NP : NP ;
who8many_IP : IP ; -- only one who in Swadesh 207
who8one_IP : IP ;
what8many_IP : IP ; -- only one what in Swadesh 207
what8one_IP : IP ;
-- Determiners
that_Det : Det ;
this_Det : Det ;
all_NDet : NDet ;
many_Det : Det ;
some_Det : Det ;
few_Det : Det ;
other_Det : Det ;
-- Adverbs
here_Adv : Adv ;
there_Adv : Adv ;
where_IAdv : IAdv ;
when_IAdv : IAdv ;
how_IAdv : IAdv ;
-- Conjunctions
and_Conj : Conj ;
-- Prepositions
at_Prep : Prep ;
in_Prep : Prep ;
with_Prep : Prep ;
-- not -- ?
-- if -- ?
-- because -- ?
-- Numerals
one_Num : Num ;
two_Num : Num ;
three_Num : Num ;
four_Num : Num ;
five_Num : Num ;
-- Adjectives
bad_ADeg : ADeg ;
big_ADeg : ADeg ;
black_ADeg : ADeg ;
cold_ADeg : ADeg ;
correct_ADeg : ADeg ;
dirty_ADeg : ADeg ;
dry_ADeg : ADeg ;
dull_ADeg : ADeg ;
far_ADeg : ADeg ;
full_ADeg : ADeg ;
good_ADeg : ADeg ;
green_ADeg : ADeg ;
heavy_ADeg : ADeg ;
long_ADeg : ADeg ;
narrow_ADeg : ADeg ;
near_ADeg : ADeg ;
new_ADeg : ADeg ;
old_ADeg : ADeg ;
red_ADeg : ADeg ;
rotten_ADeg : ADeg ;
round_ADeg : ADeg ;
sharp_ADeg : ADeg ;
short_ADeg : ADeg ;
small_ADeg : ADeg ;
smooth_ADeg : ADeg ;
straight_ADeg : ADeg ;
thick_ADeg : ADeg ;
thin_ADeg : ADeg ;
warm_ADeg : ADeg ;
wet_ADeg : ADeg ;
white_ADeg : ADeg ;
wide_ADeg : ADeg ;
yellow_ADeg : ADeg ;
left_A : A ;
right_A : A ;
-- Nouns
animal_N : N ;
ashes_N : N ;
back_N : N ;
bark_N : N ;
belly_N : N ;
bird_N : N ;
blood_N : N ;
bone_N : N ;
breast_N : N ;
child_N : N ;
cloud_N : N ;
day_N : N ;
dog_N : N ;
dust_N : N ;
ear_N : N ;
earth_N : N ;
egg_N : N ;
eye_N : N ;
fat_N : N ;
father_N : N ;
feather_N : N ;
fingernail_N : N ;
fire_N : N ;
fish_N : N ;
flower_N : N ;
fog_N : N ;
foot_N : N ;
forest_N : N ;
fruit_N : N ;
grass_N : N ;
guts_N : N ;
hair_N : N ;
hand_N : N ;
head_N : N ;
heart_N : N ;
horn_N : N ;
husband_N : N ;
ice_N : N ;
knee_N : N ;
lake_N : N ;
leaf_N : N ;
leg_N : N ;
liver_N : N ;
louse_N : N ;
man_N : N ;
meat_N : N ;
moon_N : N ;
mother_N : N ;
mountain_N : N ;
mouth_N : N ;
name_N : N ;
neck_N : N ;
night_N : N ;
nose_N : N ;
person_N : N ;
rain_N : N ;
river_N : N ;
road_N : N ;
root_N : N ;
rope_N : N ;
salt_N : N ;
sand_N : N ;
sea_N : N ;
seed_N : N ;
skin_N : N ;
sky_N : N ;
smoke_N : N ;
snake_N : N ;
snow_N : N ;
star_N : N ;
stick_N : N ;
stone_N : N ;
sun_N : N ;
tail_N : N ;
tongue_N : N ;
tooth_N : N ;
tree_N : N ;
water_N : N ;
wife_N : N ;
wind_N : N ;
wing_N : N ;
woman_N : N ;
worm_N : N ;
year_N : N ;
-- Verbs
bite_V : V ;
blow_V : V ;
breathe_V : V ;
burn_V : V ;
come_V : V ;
count_V : V ;
cut_V : V ;
die_V : V ;
dig_V : V ;
drink_V : V ;
eat_V : V ;
fall_V : V ;
fear_V : V ;
fight_V : V ;
float_V : V ;
flow_V : V ;
fly_V : V ;
freeze_V : V ;
give_V : V ;
hear_V : V ;
hit_V : V ;
hold_V : V ;
hunt_V : V ;
kill_V : V ;
know_V : V ;
laugh_V : V ;
lie_V : V ;
live_V : V ;
play_V : V ;
pull_V : V ;
push_V : V ;
rub_V : V ;
say_V : V ;
scratch_V : V ;
see_V : V ;
sew_V : V ;
sing_V : V ;
sit_V : V ;
sleep_V : V ;
smell_V : V ;
spit_V : V ;
split_V : V ;
squeeze_V : V ;
stab_V : V ;
stand_V : V ;
suck_V : V ;
swell_V : V ;
swim_V : V ;
think_V : V ;
throw_V : V ;
tie_V : V ;
turn_V : V ;
vomit_V : V ;
walk_V : V ;
wash_V : V ;
wipe_V : V ;
}

View File

@@ -0,0 +1,55 @@
abstract Time = Numerals ** {
-- Time grammar Abstract syntax. Modified by AR from Karin Cavallin.
cat
Date ;
Time ;
Hour ;
Minute ;
Weekday ;
fun
-- The variants: "two twenty", "twenty past two", "twenty to two"
DayDate : Weekday -> Date ;
DayTimeDate : Weekday -> Time -> Date ;
FormalTime : Hour -> Minute -> Time ;
PastTime : Hour -> Minute -> Time ;
ToTime : Hour -> Minute -> Time ;
ExactTime : Hour -> Time ;
-- These range from 1 to 99 and are thus overgenerating.
NumHour : Sub100 -> Hour ;
NumMinute : Sub100 -> Minute ;
fun
monday : Weekday ;
tuesday : Weekday ;
wednesday : Weekday ;
thursday : Weekday ;
friday : Weekday ;
saturday : Weekday ;
sunday : Weekday ;
{-
Add:
years
dates: the x:th of y
relative weeks: next week, last week, in x weeks, x weeks ago
relative days: today, tomorrow, yesterday, the day before yesterday,
the day after tomorrow, in x days, x days ago
relative time: in x minutes, in x hours
-}
} ;

View File

@@ -0,0 +1,54 @@
--!
--1 Rules for verbs and verb phrases
--
-- This module treats predications by means of deep right-branching
-- $VP$ structures, which have the advantage of conciseness but the
-- disadvantage of slow parsing due to discontinuous constituents.
--
-- The principal way of forming sentences ($S$) is by combining a noun phrase
-- with a verb phrase (the $PredVP$ rule below). In addition to this, verb
-- phrases have uses in relative clauses and questions. Verb phrases already
-- have (or have not) a negation, but they are formed from verbal groups
-- ($VG$), which have both positive and negative forms.
abstract Verbphrase = Categories ** {
flags optimize=all ;
-- These rules produce verb phrases.
fun
UseV : V -> VP ; -- "walks"
UsePassV : V -> VP ; -- "is seen"
ComplV2 : V2 -> NP -> VP ; -- "sees Mary"
ComplV3 : V3 -> NP -> NP -> VP ; -- "tells Mary everything"
ComplReflV2 : V2 -> VP ; -- "loves himself"
ComplVS : VS -> S -> VP ; -- "says that Mary runs"
ComplVV : VV -> VPI -> VP ; -- "must walk"
ComplVQ : VQ -> QS -> VP ; -- "asks who will come"
ComplVA : VA -> AP -> VP ; -- "looks ill"
ComplV2A : V2A -> NP -> AP -> VP ; -- "paints the house red"
ComplSubjV2V : V2V -> NP -> VPI -> VP ; -- "promises Mary to leave"
ComplObjV2V : V2V -> NP -> VPI -> VP ; -- "asked him to go"
ComplV2S : V2S -> NP -> S -> VP ; -- "told me that you came"
ComplV2Q : V2Q -> NP -> QS -> VP ; -- "asks me if you come"
PredAP : AP -> VP ; -- "is old"
PredCN : CN -> VP ; -- "is a man"
PredNP : NP -> VP ; -- "is Bill"
PredAdv : Adv -> VP ; -- "is in France", "is here"
PredProgVP : VPI -> VP ; -- "is eating fish"
-- These rules *use* verb phrases.
PredVP : NP -> VP -> Cl ; -- "John walks"
RelVP : RP -> VP -> RCl ; -- "who walks", "who doesn't walk"
IntVP : IP -> VP -> QCl ; -- "who walks"
UseVP : VP -> VCl ; -- to eat, not to eat
AdvVP : VP -> AdV -> VP ; -- "always walks"
SubjVP : VP -> Subj -> S -> VP ; -- "(a man who) sings when he runs"
}

View File

@@ -0,0 +1,235 @@
--# -path=.:../scandinavian:../abstract:../../prelude
concrete BasicDan of Basic = CategoriesDan ** open ParadigmsDan,VerbsDan in {
flags startcat=Phr ; lexer=textlit ; unlexer=text ;
optimize=values ;
lin
airplane_N = mk2N "fly" "flyet" ;
answer_V2S = mkV2S (regV "svare") "til" ;
apartment_N = mk2N "leilighet" "leiligheten" ;
apple_N = mk2N "eple" "eplet" ;
art_N = mk2N "kunst" "kunsten" ;
ask_V2Q = mkV2Q spørre_V [] ;
baby_N = mk2N "baby" "babyen" ;
bad_ADeg = regADeg "dårlig" ; ----
bank_N = mk2N "bank" "banken" ;
beautiful_ADeg = mk3ADeg "vakker" "vakkert" "vakra" ;
become_VA = mkVA bli_V;
beer_N = regN "øl" neutrum ;
beg_V2V = mkV2V be_V [] "att" ;
big_ADeg = irregADeg "stor" "større" "størst";
bike_N = mkN "sykkel" "sykkelen" "sykler" "syklene" ;
bird_N = mk2N "fugl" "fuglen" ;
black_ADeg = mk2ADeg "svart" "svart" ;
blue_ADeg = mk2ADeg "blå" "blått";
boat_N = regN "båt" utrum ;
book_N = mkN "bok" "boka" "bøker" "bøkene" ;
boot_N = mkN "støvel" "støvelen" "støvler" "støvlene" ;
boss_N = mk2N "sjef" "sjefen" ;
boy_N = regN "gutt" utrum ;
bread_N = regN "brød" neutrum ;
break_V2 = dirV2 (mk2V "knuse" "knuste") ;
broad_ADeg = regADeg "bred" ;
brother_N2 = mkN2 ( (mkN "bror" "broren" "brødre" "brødrene")) "til" ;
brown_ADeg = regADeg "brun" ;
butter_N = regN "smør" neutrum ;
buy_V2 = dirV2 (mk2V "kjøpe" "kjøpte") ;
camera_N = mk2N "kamera" "kameraen" ; ----
cap_N = mk2N "lue" "lua" ;
car_N = regN "bil" utrum ;
carpet_N = regN "matte" utrum ;
cat_N = mk2N "katt" "katten" ;
ceiling_N = regN "tak" neutrum ;
chair_N = regN "stol" utrum ;
cheese_N = regN "ost" utrum ;
child_N = regN "barn" neutrum ;
church_N = regN "kirke" utrum ;
city_N = mk2N "by" "byen" ;
clean_ADeg = regADeg "rein" ;
clever_ADeg = regADeg "klok" ;
close_V2 = dirV2 (mk2V "lukke" "lukket") ;
coat_N = regN "frakk" utrum ;
cold_ADeg = regADeg "kald" ;
come_V = komme_V ;
computer_N = mk2N "datamaskin" "datamaskinen" ;
country_N = mk2N "land" "landet" ;
cousin_N = mk2N "fetter" "fetteren" ; ----
cow_N = mkN "ku" "kua" "kyr" "kyrne" ; ----
die_V = dø_V ;
dirty_ADeg = mk3ADeg "skitten" "skittent" "skitne" ; ----
distance_N3 = mkN3 (regN "avstand" utrum) "fra" "til" ;
doctor_N = mk2N "lege" "legen" ;
dog_N = regN "hund" utrum ;
door_N = regN "dør" utrum ;
drink_V2 = dirV2 drikke_V ;
easy_A2V = mkA2V (regA "grei") "før" ;
eat_V2 = dirV2 (mk2V "spise" "spiste") ;
empty_ADeg = mkADeg "tom" "tomt" "tomme" "tommere" "tommest" ;
enemy_N = regN "fiende" utrum ;
factory_N = mk2N "fabrikk" "fabrikken" ;
father_N2 = mkN2 ( (mkN "far" "faren" "fedre" "fedrene")) "til" ;
fear_VS = mkVS (regV "frykte") ;
find_V2 = dirV2 (irregV "finne" "fann" "funnet") ;
fish_N = mk2N "fisk" "fisken" ;
floor_N = regN "golv" neutrum ;
forget_V2 = dirV2 (mkV "glemme" "glemmer" "glemmes" "glemte" "glemt" "glem") ;
fridge_N = regN "kjøleskap" neutrum ;
friend_N = mkN "venn" "vennen" "venner" "vennene" ;
fruit_N = mk2N "frukt" "frukten" ;
fun_AV = mkAV (mkA "morsom" "morsomt" "morsomme") ;
garden_N = regN "hage" utrum ;
girl_N = regN "jente" utrum ;
glove_N = regN "hanske" utrum ;
gold_N = regN "gull" neutrum ;
good_ADeg = mkADeg "god" "godt" "gode" "bedre" "best" ;
go_V = gå_V ;
green_ADeg = mk2ADeg "grønn" "grønt" ;
harbour_N = regN "havn" utrum;
hate_V2 = dirV2 (regV "hate") ;
hat_N = regN "hatt" utrum ;
have_V2 = dirV2 ha_V ;
hear_V2 = dirV2 (mk2V "høre" "hørte") ;
hill_N = regN "haug" utrum ;
hope_VS = mkVS (regV "håpe") ;
horse_N = regN "hest" utrum ;
hot_ADeg = regADeg "heit" ;
house_N = regN "hus" neutrum ;
important_ADeg = regADeg "viktig" ;
industry_N = mk2N "industri" "industrien" ;
iron_N = regN "jern" neutrum ;
king_N = regN "konge" utrum ;
know_V2 = dirV2 vite_V ;
lake_N = regN "vann" neutrum ;
lamp_N = regN "lampe" utrum ;
learn_V2 = dirV2 (mk2V "lære" "lærte") ;
leather_N = regN "lær" neutrum ;
leave_V2 = dirV2 forlate_V ;
like_V2 = dirV2 (mk2V "like" "likte") ;
listen_V2 = dirV2 (regV "lytte") ;
live_V = mk2V "leve" "levde" ;
long_ADeg = irregADeg "lang" "lengre" "lengst" ;
lose_V2 = dirV2 (mk2V "tape" "tapte") ;
love_N = regN "kjærlighet" utrum ;
love_V2 = dirV2 (regV "elske") ;
man_N = (mkN "mann" "mannen" "menn" "mennen") ;
married_A2 = mkA2 (mk2A "gift" "gift") "med" ;
meat_N = regN "kjøtt" neutrum ;
milk_N = regN "melk" utrum ;
moon_N = regN "måne" utrum ;
mother_N2 = mkN2 (mkN "mor" "moren" "mødre" "mødrene") "til" ; ---- fem
mountain_N = regN "berg" neutrum ;
music_N = mk2N "musikk" "musikken" ;
narrow_ADeg = regADeg "smal" ;
new_ADeg = mkADeg "ny" "nytt" "nye" "nyere" "nyest" ;
newspaper_N = regN "avis" utrum ;
oil_N = regN "olje" utrum ;
old_ADeg = mkADeg "gammel" "gammelt" "gamle" "eldre" "eldst" ;
open_V2 = dirV2 (regV "åpne") ;
paint_V2A = mkV2A (regV "male") [] ;
paper_N = regN "papir" neutrum ; ----
peace_N = regN "fred" utrum ;
pen_N = regN "penn" utrum ;
planet_N = mk2N "planet" "planeten" ;
plastic_N = mk2N "plast" "plasten" ;
play_V2 = dirV2 (mk2V "spille" "spilte") ;
policeman_N = mk2N "politi" "politien" ;
priest_N = mk2N "prest" "presten" ;
probable_AS = mkAS (regA "sannsynlig") ;
queen_N = regN "dronning" utrum ;
radio_N = regN "radio" utrum ;
rain_V0 = mkV0 (regV "regne") ;
read_V2 = dirV2 (mk2V "lese" "leste") ;
red_ADeg = regADeg "rød" ;
religion_N = mk2N "religion" "religionen" ;
restaurant_N = mk2N "restaurant" "restauranten" ;
river_N = mk2N "elv" "elva" ;
rock_N = regN "stein" utrum ;
roof_N = regN "tak" neutrum ;
rubber_N = mk2N "gummi" "gummien" ;
run_V = springe_V ;
say_VS = mkVS si_V ;
school_N = regN "skole" utrum;
science_N = mk2N "vitenskap" "vitenskapen" ;
sea_N = mk2N "sjø" "sjøen" ;
seek_V2 = mkV2 (mk2V "lete" "lette") "etter" ;
see_V2 = dirV2 se_V ;
sell_V3 = dirV3 selge_V "til" ;
send_V3 = dirV3 (mk2V "sende" "sendte") "til" ;
sheep_N = mk2N "får" "fåret" ;
ship_N = regN "skip" neutrum ;
shirt_N = regN "skjorte" utrum ;
shoe_N = regN "sko" utrum ;
shop_N = mk2N "butikk" "butikken" ;
short_ADeg = regADeg "kort" ;
silver_N = mk2N "sølv" "sølvet";
sister_N = mkN "søster" "søsteren" "søstrer" "søstrene" ;
sleep_V = irregV "sove" "sov" "sovet" ;
small_ADeg = mkADeg "liten" "lite" "små" "mindre" "minst" ; ---- lille
snake_N = regN "orm" utrum ;
sock_N = regN "strømpe" utrum ;
speak_V2 = dirV2 (regV "snakke") ;
star_N = regN "stjerne" utrum ;
steel_N = regN "stål" neutrum ;
stone_N = regN "stein" utrum ;
stove_N = regN "komfyr" utrum ;
student_N = mk2N "student" "studenten" ;
stupid_ADeg = mk3ADeg "dum" "dumt" "dumme" ;
sun_N = regN "sol" utrum ;
switch8off_V2 = dirV2 (partV (irregV "slå" "slo" "slått") "av") ;
switch8on_V2 = dirV2 (partV (irregV "slå" "slo" "slått") "på") ;
table_N = regN "bord" neutrum ;
talk_V3 = mkV3 (regV "snakke") "til" "om" ;
teacher_N = mkN "lærer" "læreren" "lærere" "lærerne" ;
teach_V2 = dirV2 (mk2V "undervise" "underviste") ;
television_N = mk2N "fjernsyn" "fjernsynet" ;
thick_ADeg = mk2ADeg "tykk" "tykt" ;
thin_ADeg = mk2ADeg "tynn" "tynt" ;
train_N = regN "tog" neutrum ;
travel_V = mk2V "reise" "reiste" ;
tree_N = mkN "tre" "treet" "trær" "træne" ;
---- trousers_N = regN "trousers" ; ---- pl t !
ugly_ADeg = mk2ADeg "stygg" "stygt" ;
understand_V2 = dirV2 (irregV "forstå" "forstod" "forstått") ;
university_N = regN "universitet" neutrum ;
village_N = mk2N "grend" "grenda" ;
wait_V2 = mkV2 (regV "vente") "på" ;
walk_V = (irregV "gå" "gikk" "gått") ;
warm_ADeg = regADeg "varm" ;
war_N = regN "krig" utrum ;
watch_V2 = mkV2 se_V "på" ;
water_N = mk2N "vatn" "vatnet" ;
white_ADeg = regADeg "hvit" ;
window_N = mkN "vindu" "vinduet" "vinduer" "vinduene" ; ---- er?
wine_N = mk2N "vin" "vinen" ;
win_V2 = dirV2 (irregV "vinne" "vant" "vunnet") ;
woman_N = regN "kvinne" utrum ; ---- kvinnen
wonder_VQ = mkVQ (regV "undre") ; ---- seg
wood_N = mkN "tre" "treet" "trær" "træne" ;
write_V2 = dirV2 (irregV "skrive" "skrev" "skrevet") ;
yellow_ADeg = regADeg "gul" ;
young_ADeg = irregADeg "ung" "yngre" "yngst" ;
do_V2 = dirV2 (irregV "gjøre" "gjorde" "gjort") ;
now_Adv = mkAdv "nå" ;
already_Adv = mkAdv "allerede" ;
song_N = mk2N "sang" "sangen" ;
add_V3 = mkV3 (partV (irregV "legge" "la" "lagt") "til") [] "til" ;
number_N = mk2N "nummer" "nummeret" ;
put_V2 = mkV2 (irregV "sette" "satte" "satt") [] ;
stop_V = regV "stanse" ;
jump_V = regV "hoppe" ;
here_Adv = mkAdv "her" ;
here7to_Adv = mkAdv "hit" ;
here7from_Adv = mkAdv ["herfra"] ;
there_Adv = mkAdv "der" ;
there7to_Adv = mkAdv "dit" ;
there7from_Adv = mkAdv ["derfra"] ;
} ;
-- a" -> e" 86
-- ö -> ø 66
-- ck -> kk 20
-- ä -> e 44

View File

@@ -0,0 +1,4 @@
--# -path=.:../scandinavian:../abstract:../../prelude
concrete CategoriesDan of Categories =
CategoriesScand with (SyntaxScand=SyntaxDan) ;

View File

@@ -0,0 +1,4 @@
--# -path=.:../scandinavian:../abstract:../../prelude
concrete ClauseDan of Clause = CategoriesDan **
ClauseI with (Rules=RulesDan), (Verbphrase=VerbphraseDan) ;

View File

@@ -0,0 +1,27 @@
concrete CountryDan of Country = open CategoriesDan, ParadigmsDan in {
lincat
Country = PN ;
Nationality = A ;
Language = N ;
lin
Denmark = regPN "Danmark" neutrum ;
England = regPN "England" neutrum ;
Finland = regPN "Finland" neutrum ;
France = regPN "Frankrike" neutrum ;
Germany = regPN "Tyskland" neutrum ;
Italy = regPN "Italien" neutrum ;
Norway = regPN "Norge" neutrum ;
Russia = regPN "Ryssland" neutrum ;
Spain = regPN "Spanien" neutrum ;
Sweden = regPN "Sverige" neutrum ;
Danish = regA "dansk" ;
English = regA "engelsk" ;
DanishLang = regN "dansk" utrum ;
EnglishLang = regN "engelsk" utrum ;
} ;

View File

@@ -0,0 +1,22 @@
--# -path=.:../scandinavian:../abstract:../../prelude
concrete LangDan of Lang =
RulesDan,
ClauseDan,
StructuralDan,
BasicDan,
TimeDan,
CountryDan
** open Prelude, ParadigmsDan in {
lin
AdvDate d = prefixSS "på" d ;
AdvTime t = prefixSS "klokken" t ;
NWeekday w = w ;
PNWeekday w = nounPN w ;
PNCountry x = x ;
ANationality x = x ;
NLanguage x = x ;
}

View File

@@ -0,0 +1,4 @@
--# -path=.:../scandinavian:../abstract:../../prelude
concrete MathDan of Math = CategoriesDan **
MathScand with (SyntaxScand=SyntaxDan) ;

View File

@@ -0,0 +1,266 @@
--1 A Simple Danish Resource Morphology
--
-- Aarne Ranta 2002
--
-- This resource morphology contains definitions needed in the resource
-- syntax. It moreover contains copies of the most usual inflectional patterns
-- as defined in functional morphology (in the Haskell file $RulesSw.hs$).
--
-- We use the parameter types and word classes defined for morphology.
resource MorphoDan = open Prelude, TypesDan in {
-- Danish grammar source: http://users.cybercity.dk/~nmb3879/danish.html
-- nouns
oper
mkSubstantive : (_,_,_,_ : Str) -> {s : SubstForm => Str} =
\dreng, drengen, drenge, drengene -> {s = table {
SF Sg Indef c => mkCase dreng ! c ;
SF Sg Def c => mkCase drengen ! c ;
SF Pl Indef c => mkCase drenge ! c ;
SF Pl Def c => mkCase drengene ! c
}
} ;
mkCase : Str -> Case => Str = \bil -> table {
Nom => bil ;
Gen => bil + "s" --- but: hus --> hus
} ;
extNGen : Str -> NounGender = \s -> case last s of {
"n" => NUtr ;
_ => NNeutr
} ;
nDreng : Str -> Subst = \dreng ->
mkSubstantive dreng (dreng + "en") (dreng + "e") (dreng + "ene") **
{h1 = Utr} ;
nBil : Str -> Subst = \bil ->
mkSubstantive bil (bil + "en") (bil + "er") (bil + "erne") **
{h1 = Utr} ;
nUge : Str -> Subst = \uge ->
mkSubstantive uge (uge + "n") (uge + "r") (uge + "rne") **
{h1 = Utr} ;
nHus : Str -> Subst = \hus ->
mkSubstantive hus (hus + "et") hus (hus + "ene") **
{h1 = Neutr} ;
-- adjectives
mkAdjective : (_,_,_,_,_ : Str) -> Adj =
\stor,stort,store,storre,storst -> {s = table {
AF (Posit (Strong (ASg Utr))) c => mkCase stor ! c ;
AF (Posit (Strong (ASg Neutr))) c => mkCase stort ! c ;
AF (Posit _) c => mkCase store ! c ;
AF Compar c => mkCase storre ! c ;
AF (Super SupStrong) c => mkCase storst ! c ;
AF (Super SupWeak) c => mkCase (storst + "e") ! c
}
} ;
aRod : Str -> Adj = \rod ->
mkAdjective rod (rod + "t") (rod + "e") (rod + "ere") (rod + "est") ;
aAbstrakt : Str -> Adj = \abstrakt ->
mkAdjective abstrakt abstrakt (abstrakt + "e") (abstrakt + "ere") (abstrakt + "est") ;
aRask : Str -> Adj = \rask ->
mkAdjective rask rask (rask + "e") (rask + "ere") (rask + "est") ;
extractPositive : Adj -> {s : AdjFormPos => Case => Str} = \adj ->
{s = \\a,c => adj.s ! (AF (Posit a) c)} ;
-- verbs
mkVerb : (_,_,_,_,_,_ : Str) -> Verbum =
\spise,spiser,spises,spiste,spist,spis -> {s = table {
VI (Inf v) => mkVoice v spise ;
VF (Pres Act) => spiser ;
VF (Pres Pass) => spises ;
VF (Pret v) => mkVoice v spiste ;
VI (Supin v) => mkVoice v spist ;
VI (PtPret _ c) => mkCase spist ! c ; ---- GenNum
VF (Imper v) => mkVoice v spis
}
} ;
irregVerb : (drikke,drakk,drukket : Str) -> Verbum =
\drikke,drakk,drukket ->
let
drikk = init drikke ;
drikker = case last (init drikke) of {
"r" => drikk ;
_ => drikke + "r"
}
in
mkVerb drikke drikker (drikke + "s") drakk drukket drikk ;
regVerb : Str -> Str -> Verbum = \spise, spiste ->
let
spis = init spise ;
te = Predef.dp 2 spiste
in
case te of {
"te" => vSpis spis ;
"de" => case last spise of {
"e" => vHusk spis ;
_ => vBo spise
} ;
_ => vHusk spis
} ;
mkVoice : Voice -> Str -> Str = \v,s -> case v of {
Act => s ;
Pass => s + case last s of {
"s" => "es" ;
_ => "s"
}
} ;
vHusk : Str -> Verbum = \husk ->
mkVerb (husk + "e") (husk + "er") (husk + "es") (husk + "ede") (husk + "et") husk ;
vSpis : Str -> Verbum = \spis ->
mkVerb (spis + "e") (spis + "er") (spis + "es") (spis + "te") (spis + "t") spis ;
vBo : Str -> Verbum = \bo ->
mkVerb bo (bo + "r") (bo + "es") (bo + "ede") (bo + "et") bo ;
-- pronouns
oper jag_32 : ProPN =
{s = table {
PNom => "jeg" ;
PAcc => "mig" ;
PGen (ASg Utr) => "min" ;
PGen (ASg Neutr) => "mit" ;
PGen APl => "mine"
} ;
h1 = Utr ;
h2 = Sg ;
h3 = P1
} ;
oper du_33 : ProPN =
{s = table {
PNom => "du" ;
PAcc => "dig" ;
PGen (ASg Utr) => "din" ;
PGen (ASg Neutr) => "dit" ;
PGen APl => "dine"
} ;
h1 = Utr ;
h2 = Sg ;
h3 = P2
} ;
oper han_34 : ProPN =
{s = table {
PNom => "han" ;
PAcc => "ham" ;
PGen (ASg Utr) => "hans" ;
PGen (ASg Neutr) => "hans" ;
PGen APl => "hans"
} ;
h1 = Utr ;
h2 = Sg ;
h3 = P3
} ;
oper hon_35 : ProPN =
{s = table {
PNom => "hun" ;
PAcc => "hende" ;
PGen (ASg Utr) => "hendes" ;
PGen (ASg Neutr) => "hendes" ;
PGen APl => "hendes"
} ;
h1 = Utr ;
h2 = Sg ;
h3 = P3
} ;
oper vi_36 : ProPN =
{s = table {
PNom => "vi" ;
PAcc => "os" ;
PGen _ => "vores"
} ;
h1 = Utr ;
h2 = Pl ;
h3 = P1
} ;
oper ni_37 : ProPN =
{s = table {
PNom => "i" ;
PAcc => "jer" ;
PGen _ => "jeres"
} ;
h1 = Utr ;
h2 = Pl ;
h3 = P2
} ;
oper de_38 : ProPN =
{s = table {
PNom => "de" ;
PAcc => "dem" ;
PGen _ => "deres"
} ;
h1 = Utr ;
h2 = Pl ;
h3 = P3
} ;
oper De_38 : ProPN =
{s = table {
PNom => "De" ;
PAcc => "Dem" ;
PGen _ => "Deres"
} ;
h1 = Utr ;
h2 = Sg ;
h3 = P2
} ;
oper den_39 : ProPN =
{s = table {
PNom => "den" ;
PAcc => "den" ;
PGen _ => "dens"
} ;
h1 = Utr ;
h2 = Sg ;
h3 = P3
} ;
oper det_40 : ProPN =
{s = table {
PNom => "det" ;
PAcc => "det" ;
PGen _ => "dets"
} ;
h1 = Neutr ;
h2 = Sg ;
h3 = P3
} ;
-- from Numerals
param DForm = ental | ton | tiotal ;
oper mkTal : Str -> Str -> Str -> {s : DForm => Str} =
\to, tolv, tyve ->
{s = table {ental => to ; ton => tolv ; tiotal => tyve}} ;
oper regTal : Str -> {s : DForm => Str} = \fem -> mkTal fem (fem + "ton") (fem + "tio") ;
numPl : Str -> {s : Gender => Str ; n : Number} = \n ->
{s = \\_ => n ; n = Pl} ;
}

View File

@@ -0,0 +1,40 @@
-- AR 12/10/2002 following www.geocities.com/tsca.geo/dansk/dknummer.html
concrete NumeralsDan of Numerals = open Prelude, TypesDan, MorphoDan in {
lincat
Numeral = {s : Gender => Str ; n : Number} ;
Digit = {s : DForm => Str} ;
Sub10 = {s : DForm => Gender => Str ; n : Number} ;
Sub100 = {s : Gender => Str ; n : Number} ;
Sub1000 = {s : Gender => Str ; n : Number} ;
Sub1000000 = {s : Gender => Str ; n : Number} ;
lin num x = x ;
lin n2 = mkTal "to" "tolv" "tyve" ;
lin n3 = mkTal "tre" "tretten" "tredive" ;
lin n4 = mkTal "fire" "fjorten" "fyrre" ;
lin n5 = mkTal "fem" "femten" "halvtreds" ;
lin n6 = mkTal "seks" "seksten" "tres" ;
lin n7 = mkTal "syv" "sytten" "halvfjerds" ;
lin n8 = mkTal "otte" "atten" "firs" ;
lin n9 = mkTal "ni" "nitten" "halvfems" ;
pot01 = {s = table {f => table {Neutr => "et" ; _ => "en"}} ; n = Sg} ;
pot0 d = {s = \\f,g => d.s ! f ; n = Pl} ;
pot110 = numPl "ti" ;
pot111 = numPl "elleve" ;
pot1to19 d = numPl (d.s ! ton) ;
pot0as1 n = {s = n.s ! ental ; n = n.n} ;
pot1 d = numPl (d.s ! tiotal) ;
pot1plus d e = {s = \\g => e.s ! ental ! g ++ "og" ++ d.s ! tiotal ; n = Pl} ;
pot1as2 n = n ;
pot2 d = numPl (d.s ! ental ! Neutr ++ "hundrede") ;
pot2plus d e =
{s = \\g => d.s ! ental ! Neutr ++ "hundrede" ++ "og" ++ e.s ! g ; n = Pl} ;
pot2as3 n = n ;
pot3 n = numPl (n.s ! Neutr ++ "tusind") ;
pot3plus n m = {s = \\g => n.s ! Neutr ++ "tusind" ++ "og" ++ m.s ! g ; n = Pl} ;
}

View File

@@ -0,0 +1,370 @@
--# -path=.:../scandinavian:../abstract:../../prelude
--1 Sanish Lexical Paradigms
--
-- Aarne Ranta 2003
--
-- This is an API to the user of the resource grammar
-- for adding lexical items. It gives functions for forming
-- expressions of open categories: nouns, adjectives, verbs.
--
-- Closed categories (determiners, pronouns, conjunctions) are
-- accessed through the resource syntax API, $Structural.gf$.
--
-- The main difference with $MorphoDan.gf$ is that the types
-- referred to are compiled resource grammar types. We have moreover
-- had the design principle of always having existing forms, rather
-- than stems, as string arguments of the paradigms.
--
-- The structure of functions for each word class $C$ is the following:
-- first we give a handful of patterns that aim to cover all
-- regular cases. Then we give a worst-case function $mkC$, which serves as an
-- escape to construct the most irregular words of type $C$.
-- However, this function should only seldom be needed: we have a
-- separate module $IrregularEng$, which covers all irregularly inflected
-- words.
--
-- The following modules are presupposed:
resource ParadigmsDan =
open (Predef=Predef), Prelude, TypesDan, MorphoDan, SyntaxDan, CategoriesDan in {
--2 Parameters
--
-- To abstract over gender names, we define the following identifiers.
oper
Gender : Type ;
utrum : Gender ;
neutrum : Gender ;
-- To abstract over number names, we define the following.
Number : Type ;
singular : Number ;
plural : Number ;
-- To abstract over case names, we define the following.
Case : Type ;
nominative : Case ;
genitive : Case ;
-- Prepositions used in many-argument functions are just strings.
Preposition : Type = Str ;
--2 Nouns
-- Worst case: give all four forms. The gender is computed from the
-- last letter of the second form (if "n", then $utrum$, otherwise $neutrum$).
mkN : (dreng,drengen,drenger,drengene : Str) -> N ;
-- The regular function takes the singular indefinite form and the gender,
-- and computes the other forms by a heuristic.
-- If in doubt, use the $cc$ command to test!
regN : Str -> Gender -> N ;
-- This function takes the singular indefinite and definite forms; the
-- gender is computed from the definite form.
mk2N : (bil,bilen : Str) -> N ;
--3 Compound nouns
--
-- All the functions above work quite as well to form compound nouns,
-- such as "fotboll".
--3 Relational nouns
--
-- Relational nouns ("daughter of x") need a preposition.
mkN2 : N -> Preposition -> N2 ;
-- The most common preposition is "av", and the following is a
-- shortcut for regular, $nonhuman$ relational nouns with "av".
regN2 : Str -> Gender -> N2 ;
-- 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 -> 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"). However, $N2$ and
-- $N3$ are purely lexical categories. But you can use the $AdvCN$
-- and $PrepNP$ constructions to build phrases like this.
--
--3 Proper names and noun phrases
--
-- Proper names, with a regular genitive, are formed as follows
regPN : Str -> Gender -> PN ; -- John, John's
-- Sometimes you can reuse a common noun as a proper name, e.g. "Bank".
nounPN : N -> PN ;
-- 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
-- Non-comparison one-place adjectives need three forms:
mkA : (galen,galet,galne : Str) -> A ;
-- For regular adjectives, the other forms are derived.
regA : Str -> A ;
-- In most cases, two forms are enough.
mk2A : (stor,stort : Str) -> A ;
--3 Two-place adjectives
--
-- Two-place adjectives need a preposition for their second argument.
mkA2 : A -> Preposition -> A2 ;
-- Comparison adjectives may need as many as five forms.
mkADeg : (stor,stort,store,storre,storst : Str) -> ADeg ;
-- The regular pattern works for many adjectives, e.g. those ending
-- with "ig".
regADeg : Str -> ADeg ;
-- Just the comparison forms can be irregular.
irregADeg : (tung,tyngre,tyngst : Str) -> ADeg ;
-- Sometimes just the positive forms are irregular.
mk3ADeg : (galen,galet,galna : Str) -> ADeg ;
mk2ADeg : (bred,bredt : Str) -> ADeg ;
-- If comparison is formed by "mer, "mest", as in general for
-- long adjective, the following pattern is used:
compoundADeg : A -> ADeg ; -- -/mer/mest norsk
-- From a given $ADeg$, it is possible to get back to $A$.
adegA : ADeg -> A ;
--2 Adverbs
-- Adverbs are not inflected. Most lexical ones have position
-- after the verb. Some can be preverbal (e.g. "always").
mkAdv : Str -> Adv ;
mkAdV : Str -> AdV ;
-- Adverbs modifying adjectives and sentences can also be formed.
mkAdA : Str -> AdA ;
--2 Prepositions
--
-- A preposition is just a string.
mkPreposition : Str -> Preposition ;
--2 Verbs
--
-- The worst case needs six forms.
mkV : (spise,spiser,spises,spiste,spist,spis : Str) -> V ;
-- The 'regular verb' function is the first conjugation.
regV : (snakke : Str) -> V ;
-- The almost regular verb function needs the infinitive and the preteritum.
mk2V : (leve,levde : Str) -> V ;
-- There is an extensive list of irregular verbs in the module $IrregularSwe$.
-- In practice, it is enough to give three forms, as in school books.
irregV : (drikke, drakk, drukket : Str) -> V ;
--3 Verbs with a particle.
--
-- The particle, such as in "switch on", is given as a string.
partV : V -> Str -> V ;
--3 Deponent verbs.
--
-- Some words are used in passive forms only, e.g. "hoppas".
depV : V -> V ;
--3 Two-place verbs
--
-- 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 -> Preposition -> V2 ;
dirV2 : V -> V2 ;
--3 Three-place verbs
--
-- Three-place (ditransitive) verbs need two prepositions, of which
-- the first one or both can be absent.
mkV3 : V -> Str -> Str -> V3 ; -- speak, with, about
dirV3 : V -> Str -> V3 ; -- give,_,to
dirdirV3 : V -> V3 ; -- give,_,_
--3 Other complement patterns
--
-- Verbs and adjectives can take complements such as sentences,
-- questions, verb phrases, and adjectives.
mkV0 : V -> V0 ;
mkVS : V -> VS ;
mkV2S : V -> Str -> V2S ;
mkVV : V -> VV ;
mkV2V : V -> Str -> Str -> V2V ;
mkVA : V -> VA ;
mkV2A : V -> Str -> V2A ;
mkVQ : V -> VQ ;
mkV2Q : V -> Str -> V2Q ;
mkAS : A -> AS ;
mkA2S : A -> Str -> A2S ;
mkAV : A -> AV ;
mkA2V : A -> Str -> A2V ;
--2 Definitions of the paradigms
--
-- The definitions should not bother the user of the API. So they are
-- hidden from the document.
--.
Gender = SyntaxDan.NounGender ;
Number = TypesDan.Number ;
Case = TypesDan.Case ;
utrum = NUtr ;
neutrum = NNeutr ;
singular = Sg ;
plural = Pl ;
nominative = Nom ;
genitive = Gen ;
mkN x y z u = let sb = mkSubstantive x y z u
in {s = \\n,b,c => sb.s ! SF n b c ; g = extNGen y ; lock_N = <>} ;
regN x g = case last x of {
"e" => case g of {
NUtr => mkN x (x + "n") (x + "r") (x + "rne") ;
NNeutr => mkN x (x + "t") (x + "r") (init x + "ene")
} ;
_ => case g of {
NUtr => mkN x (x + "en") (x + "er") (x + "rene") ;
NNeutr => mkN x (x + "et") (x + "") (x + "ene")
}
} ;
mk2N x y = case last y of {
"n" => regN x utrum ;
_ => regN x neutrum
} ;
mkN2 = \n,p -> n ** {lock_N2 = <> ; s2 = p} ;
regN2 n g = mkN2 (regN n g) (mkPreposition "av") ;
mkN3 = \n,p,q -> n ** {lock_N3 = <> ; s2 = p ; s3 = q} ;
regPN n g = {s = \\c => mkCase n ! c ; g = g} ** {lock_PN = <>} ;
nounPN n = {s = n.s ! singular ! Indef ; g = n.g ; lock_PN = <>} ;
mkNP x y n g =
{s = table {PGen _ => x ; _ => y} ; g = genNoun g ; n = n ; p = P3 ;
lock_NP = <>} ;
mkA a b c = extractPositive (mkAdjective a b c [] []) ** {lock_A = <>} ;
mk2A a b = mkA a b (a + "e") ;
regA a = extractPositive (regADeg a) ** {lock_A = <>} ;
mkA2 a p = a ** {s2 = p ; lock_A2 = <>} ;
mkADeg a b c d e = mkAdjective a b c d e ** {lock_ADeg = <>} ;
regADeg a = case Predef.dp 2 a of {
---- "ig" => aBillig a ;
"sk" => aRask a ;
_ => case last a of {
"t" => aAbstrakt a ;
_ => aRod a
}} ** {lock_ADeg = <>} ;
irregADeg a b c = mkAdjective a (a + "t") (a + "e") b c ** {lock_ADeg = <>} ;
mk3ADeg a b c = mkAdjective a b c (a + "ere") (a + "est") ** {lock_ADeg = <>} ;
mk2ADeg a b = mkAdjective a b (a + "e") (a + "ere") (a + "est") ** {lock_ADeg = <>} ;
mkAdv x = ss x ** {lock_Adv = <>} ;
mkAdV x = ss x ** {lock_AdV = <>} ;
mkAdA x = ss x ** {lock_AdA = <>} ;
mkPreposition p = p ;
mkV a b c d e f = mkVerb a b c d e f ** {s1 = [] ; lock_V = <>} ;
regV a = case last a of {
"e" => vHusk (init a) ;
_ => vBo a
} ** {s1 = [] ; lock_V = <>} ;
mk2V a b = regVerb a b ** {s1 = [] ; lock_V = <>} ;
irregV x y z = irregVerb x y z
** {s1 = [] ; lock_V = <>} ;
partV v p = {s = v.s ; s1 = p ; lock_V = <>} ;
depV v = deponentVerb v ** {lock_V = <>} ;
mkV2 v p = v ** {s = v.s ; s1 = v.s1 ; s2 = p ; lock_V2 = <>} ;
dirV2 v = mkV2 v [] ;
mkV3 v p q = v ** {s = v.s ; s1 = v.s1 ; s2 = p ; s3 = q ; lock_V3 = <>} ;
dirV3 v p = mkV3 v [] p ;
dirdirV3 v = dirV3 v [] ;
mkV0 v = v ** {lock_V0 = <>} ;
mkVS v = v ** {lock_VS = <>} ;
mkV2S v p = mkV2 v p ** {lock_V2S = <>} ;
mkVV v = v ** {isAux = False ; lock_VV = <>} ;
mkV2V v p t = mkV2 v p ** {s3 = t ; lock_V2V = <>} ;
mkVA v = v ** {lock_VA = <>} ;
mkV2A v p = mkV2 v p ** {lock_V2A = <>} ;
mkVQ v = v ** {lock_VQ = <>} ;
mkV2Q v p = mkV2 v p ** {lock_V2Q = <>} ;
mkAS v = v ** {lock_AS = <>} ;
mkA2S v p = mkA2 v p ** {lock_A2S = <>} ;
mkAV v = v ** {lock_AV = <>} ;
mkA2V v p = mkA2 v p ** {lock_A2V = <>} ;
} ;

View File

@@ -0,0 +1,4 @@
--# -path=.:../scandinavian:../abstract:../../prelude
concrete ResourceDan of Resource = RulesDan, StructuralDan, ClauseDan ** {} ;

View File

@@ -0,0 +1,4 @@
--# -path=.:../scandinavian:../abstract:../../prelude
concrete RulesDan of Rules = CategoriesDan **
RulesScand with (SyntaxScand=SyntaxDan) ;

View File

@@ -0,0 +1,107 @@
--# -path=.:../scandinavian:../abstract:../../prelude
--1 The Top-Level Swedish Resource Grammar: Structural Words
--
-- Aarne Ranta 2002 -- 2004
--
concrete StructuralDan of Structural =
CategoriesDan, NumeralsDan ** open Prelude, MorphoDan, SyntaxDan in {
flags optimize=values ;
lin
UseNumeral i = {
s = \\g => table {Nom => i.s ! g ; Gen => i.s ! g ++ "s"} ; ---
n = i.n
} ;
above_Prep = ss "ovenfor" ;
after_Prep = ss "efter" ;
by8agent_Prep = ss "af" ;
all8mass_Det = mkDeterminerSgGender2 "all" "alt" IndefP ;
all_NDet = mkDeterminerPl "alle" IndefP ;
almost_Adv = ss "næsten" ;
although_Subj = ss ["selv om"] ;
and_Conj = ss "og" ** {n = Pl} ;
because_Subj = ss ["fordi"] ;
before_Prep = ss "før" ;
behind_Prep = ss "bag" ;
between_Prep = ss "mellem" ;
both_AndConjD = sd2 "både" "og" ** {n = Pl} ;
by8means_Prep = ss "med" ;
can8know_VV = mkVerb "kunne" "kan" nonExist "kunne" "kunnet" nonExist **
{s1 = [] ; isAux = True} ;
can_VV = mkVerb "kunne" "kan" nonExist "kunne" "kunnet" nonExist **
{s1 = [] ; isAux = True} ;
during_Prep = ss "under" ;
either8or_ConjD = sd2 "enten" "eller" ** {n = Sg} ;
everybody_NP = let alla = table {Nom => "alle" ; Gen => "alles"} in
{s = \\c => alla ! npCase c ; g = Utr ; n = Pl ; p = P3} ;
every_Det = varjeDet ;
everything_NP = nameNounPhrase (mkProperName "alt" NNeutr) ;
everywhere_Adv = advPost "overalt" ;
from_Prep = ss "fra" ;
he_NP = pronNounPhrase han_34 ;
how_IAdv = ss "hvor" ;
how8many_IDet = mkDeterminerPl ["hvor mange"] IndefP ;
if_Subj = ss "hvis" ;
in8front_Prep = ss "fremfor" ; ---- ?
i_NP = pronNounPhrase jag_32 ;
in_Prep = ss "i" ;
it_NP = pronNounPhrase det_40 ; ----
many_Det = mkDeterminerPl "mange" IndefP ;
most_Det = mkDeterminerSgGender2 ["den meste"] ["det meste"] (DefP Def) ;
most8many_Det = flestaDet ;
much_Det = mkDeterminerSg (detSgInvar "meget") IndefP ;
must_VV = mkVerb "måtte" "må" "mås" "måtte" "måttet" "må" **
{s1 = [] ; isAux = True} ; ---- ?
on_Prep = ss "på" ;
or_Conj = ss "eller" ** {n = Sg} ;
otherwise_Adv = ss "anderledes" ; ---- ?
part_Prep = ss "af" ;
no_Phr = ss ["Nej ."] ;
yes_Phr = ss ["Ja ."] ;
possess_Prep = ss "af" ;
quite_Adv = ss "temmelig" ;
she_NP = pronNounPhrase hon_35 ;
so_Adv = ss "så" ;
somebody_NP = nameNounPhrase (mkProperName "nogen" NUtr) ;
some_Det = mkDeterminerSgGender2 "nogen" "noget" IndefP ;
some_NDet = mkDeterminerPlNum "nogle" IndefP ;
something_NP = nameNounPhrase (mkProperName "noget" NNeutr) ;
somewhere_Adv = advPost ["et eller andet sted"] ; ---- ?
that_Det = mkDeterminerSgGender2 ["den der"] ["det der"] (DefP Indef) ;
that_NP = regNameNounPhrase ["det der"] NNeutr ;
therefore_Adv = ss "derfor" ;
these_NDet = mkDeterminerPlNum ["de her"] (DefP Indef) ;
they8fem_NP = pronNounPhrase de_38 ;
they_NP = pronNounPhrase de_38 ;
this_Det = mkDeterminerSgGender2 ["den her"] ["det her"] (DefP Indef) ;
this_NP = regNameNounPhrase ["det her"] NNeutr ;
those_NDet = mkDeterminerPlNum ["de der"] (DefP Indef) ;
thou_NP = pronNounPhrase du_33 ;
through_Prep = ss "igennem" ;
too_Adv = ss "for" ; ---- ?
to_Prep = ss "til" ;
under_Prep = ss "under" ;
very_Adv = ss "meget" ;
want_VV = mkVerb "ville" "vil" nonExist "ville" "villet" nonExist **
{s1 = [] ; isAux = True} ; ---
we_NP = pronNounPhrase (vi_36) ;
what8many_IP = intPronWhat plural ;
what8one_IP = intPronWhat singular ;
when_IAdv = ss "hvornår" ;
when_Subj = ss "når" ;
where_IAdv = ss "hver" ;
which8one_IDet = vilkenDet ;
which8many_IDet = mkDeterminerPl "hvilke" IndefP ;
who8many_IP = intPronWho plural ;
who8one_IP = intPronWho singular ;
why_IAdv = ss "hvorfor" ;
without_Prep = ss "uden" ;
with_Prep = ss "med" ;
ye_NP = pronNounPhrase (ni_37) ;
you_NP = pronNounPhrase De_38 ;
}

View File

@@ -0,0 +1,120 @@
--# -path=.:../scandinavian:../../prelude
instance SyntaxDan of SyntaxScand = TypesDan **
open Prelude, (CO = Coordination), MorphoDan in {
flags optimize=all ;
oper
------ mkAdjForm
-- When common nouns are extracted from lexicon, the composite noun form is ignored.
npDet : NounPhrase = nameNounPhrase (mkProperName "det" NNeutr) ;
mkAdjForm : Species -> Number -> NounGender -> AdjFormPos = \b,n,g ->
case <b,n> of {
<Indef,Sg> => Strong (ASg (genNoun g)) ;
<Indef,Pl> => Strong APl ;
<Def, _> => Weak
} ;
verbFinnas : Verb =
deponentVerb (mkVerb "finde" "finder" "findes" "fandt" "fundet" "find" ** {s1 = []}) ;
verbVara = mkVerb "være" "er" nonExist "var" "været" "vær" ** {s1 = []} ;
verbHava = mkVerb "have" "har" "haves" "havde" "haft" "hav" ** {s1 = []} ;
relPronForms : RelCase => GenNum => Str = table {
RNom => \\_ => "som" ;
RAcc => \\_ => variants {"som" ; []} ;
RGen => \\_ => "hvis" ;
RPrep => pronVilken
} ;
pronVilken = table {
ASg Utr => "hvilken" ;
ASg Neutr => "hvilket" ;
APl => "hvilke"
} ;
pronSådan = table {
ASg Utr => "sådan" ;
ASg Neutr => "sådant" ;
APl => "sådanne"
} ;
pronNågon = table {
ASg Utr => "nogen" ;
ASg Neutr => "noget" ;
APl => "nogle"
} ;
specDefPhrase : Bool -> Species = \b ->
if_then_else Species b Indef Def ;
superlSpecies = Indef ;
artIndef = table {Utr => "en" ; Neutr => "et"} ;
artDef : Bool => GenNum => Str = table {
True => table {
ASg Utr => "den" ;
ASg Neutr => "det" ; -- det gamla huset
APl => variants {"de"}
} ;
False => table {_ => []} -- huset
} ;
auxHar = "har" ;
auxHade = "havde" ;
auxHa = "have" ;
auxSka = "vil" ;
auxSkulle = "ville" ;
infinAtt, subordAtt = "at" ;
varjeDet : Determiner = mkDeterminerSg (detSgInvar "hver") IndefP ;
allaDet : Determiner = mkDeterminerPl "alle" IndefP ;
flestaDet : Determiner = mkDeterminerPl ["de fleste"] IndefP ;
prepÄn = "end" ;
negInte = "ikke" ;
conjOm = "hvis" ;
pronVars = "hvis" ;
pronVem = "hvem" ;
pronVems = "hvis" ; ---- ??
pronVad = "hvad" ;
--- added with Nor
conjGender : Gender -> Gender -> Gender = \m,n ->
case <m,n> of {
<Utr,Utr> => Utr ;
_ => Neutr
} ;
mkDeterminerSgGender3 : Str -> Str -> Str -> SpeciesP -> Determiner = \en,_,ett ->
mkDeterminerSgGender (table {Utr => en ; Neutr => ett}) ;
reflPron : Number -> Person -> Str = \n,p -> case <n,p> of {
<Sg,P1> => "mig" ;
<Sg,P2> => "dig" ;
<Pl,P1> => "os" ;
<Pl,P2> => "seg" ; --- ? dere ?
_ => "seg"
} ;
progressiveVerbPhrase : VerbPhrase -> VerbGroup =
complVerbVerb
{s = verbVara.s ; s1 = "ved" ; isAux = False} ;
progressiveClause : NounPhrase -> VerbPhrase -> Clause = \np,vp ->
predVerbGroupClause np
(complVerbVerb
{s = verbVara.s ; s1 = "ved" ; isAux = False}
vp) ;
conjEt = "og" ;
}

View File

@@ -0,0 +1,33 @@
concrete TimeDan of Time = NumeralsDan **
open Prelude, TypesDan, CategoriesDan, ParadigmsDan in {
lincat
Date = SS ;
Weekday = N ;
Hour = SS ;
Minute = SS ;
Time = SS ;
lin
DayDate day = ss (day.s ! singular ! Indef ! nominative) ;
DayTimeDate day time = ss (day.s ! singular ! Indef ! nominative ++ "klokken" ++ time.s) ;
FormalTime = infixSS "og" ;
PastTime h m = ss (m.s ++ "over" ++ h.s) ;
ToTime h m = ss (m.s ++ "på" ++ h.s) ;
ExactTime h = ss (h.s ++ "akkurat") ;
NumHour n = {s = n.s ! Neutr} ;
NumMinute n = {s = n.s ! Neutr} ;
monday = regN "mandag" utrum ;
tuesday = regN "tirsdag" utrum ;
wednesday = regN "onsdag" utrum ;
thursday = regN "torsdag" utrum ;
friday = regN "fredag" utrum ;
saturday = regN "lørdag" utrum ;
sunday = regN "søndag" utrum ;
} ;

View File

@@ -0,0 +1,26 @@
--1 Danish Word Classes and Morphological Parameters
--
-- This is a resource module for Italian morphology, defining the
-- morphological parameters and word classes of Italian.
-- The morphology is so far only
-- complete w.r.t. the syntax part of the resource grammar.
-- It does not include those parameters that are not needed for
-- analysing individual words: such parameters are defined in syntax modules.
instance TypesDan of TypesScand = {
param
Gender = Utr | Neutr ;
NounGender = NUtr | NNeutr ;
oper
genNoun = \s -> case s of {NUtr => Utr ; NNeutr => Neutr} ;
sexNoun _ = NoMasc ;
gen2nounGen = \s -> case s of {Utr => NUtr ; Neutr => NNeutr} ;
utrum = Utr ; neutrum = Neutr ;
param
AdjFormPos = Strong GenNum | Weak ;
}

View File

@@ -0,0 +1,4 @@
--# -path=.:../scandinavian:../abstract:../../prelude
concrete VerbphraseDan of Verbphrase = CategoriesDan **
VerbphraseScand with (SyntaxScand=SyntaxDan) ;

View File

@@ -0,0 +1,71 @@
--# -path=.:../scandinavian:../abstract:../../prelude
-- see: http://frodo.bruderhof.com/norskklassen/commonverbs.htm
concrete VerbsDan of VerbsDanAbs = CategoriesDan ** open ParadigmsDan in {
flags optimize=values ;
lin be_V = irregV "be" "bad" "bedt" ;
lin bite_V = irregV "bite" (variants {"bet" ; "beit"}) "bitt" ;
lin bli_V = irregV "bli" (variants {"ble" ; "blei"}) "blitt" ;
lin brenne_V = irregV "brenne" (variants {"brant" ; "brente"}) "brent" ;
lin bringe_V = irregV "bringe" "brakte" "brakt" ;
lin burde_V = irregV "burde" "burde" "burdet" ;
lin bære_V = irregV "bære" "bar" "båret" ;
lin dra_V = mkV "dra" "drar" "dras" "drog" (variants {"dradd" ; "dratt"}) "dra" ;
lin drikke_V = irregV "drikke" "drakk" "drukket" ;
lin drive_V = irregV "drive" (variants {"drev" ; "dreiv"}) "drevet" ;
lin dø_V = irregV "dø" (variants {"dødde" ; "døde"}) "dødd" ;
lin eie_V = irregV "eie" (variants {"eide" ; "åtte"}) (variants {"eid" ; "ått"}) ;
lin falle_V = irregV "falle" "falt" "falt" ;
lin finne_V = irregV "finne" "fant" "funnet" ;
lin fly_V = irregV "fly" (variants {"fløy" ; "flaug"}) (variants {"fløyet" ; "flydd"}) ; lin flyte_V = irregV "flyte" (variants {"fløte" ; "flaut"}) "flytt" ;
lin foretrekke_V = irregV "foretrekke" "foretrakk" "foretrukket" ;
lin forlate_V = irregV "forlate" "forlot" "forlatt" ;
lin forstå_V = irregV "forstå" "forstod" "forstått" ;
lin fortelle_V = irregV "fortelle" "fortalte" "fortalt" ;
lin fryse_V = irregV "fryse" "frøs" "frosset" ;
lin få_V = irregV "få" "fikk" "fått" ;
lin gi_V = irregV "gi" "gav" "gitt" ;
lin gjelde_V = irregV "gjelde" (variants {"gjaldt" ; "galdt"}) "gjeldt" ;
lin gjøre_V = irregV "gjøre" "gjorde" "gjort" ;
lin gni_V = irregV "gni" (variants {"gned" ; "gnei" ; "gnidde"}) "gnidd" ;
lin gå_V = irregV "gå" "gikk" "gått" ;
lin ha_V = irregV "ha" "hadde" "hatt" ;
lin hente_V = irregV "hente" "hentet" "hendt" ;
lin hete_V = irregV "hete" (variants {"het" ; "hette"}) "hett" ;
lin hjelpe_V = irregV "hjelpe" "hjalp" "hjulpet" ;
lin holde_V = irregV "holde" "holdt" "holdt" ;
lin komme_V = irregV "komme" "kom" "kommet" ;
lin kunne_V = irregV "kunne" "kunne" "kunnet" ;
lin la_V = irregV "la" "lot" "latt" ;
lin legge_V = irregV "legge" "la" "lagt" ;
lin ligge_V = irregV "ligge" "lå" "ligget" ;
lin løpe_V = irregV "løpe" "løp" (variants {"løpt" ; "løpet"}) ;
lin måtte_V = irregV "måtte" "måtte" "måttet" ;
lin renne_V = irregV "renne" "rant" "rent" ;
lin se_V = irregV "se" "så" "sett" ;
lin selge_V = irregV "selge" "solgte" "solgt" ;
lin sette_V = irregV "sette" "satte" "satt" ;
lin si_V = irregV "si" "sa" "sagt" ;
lin sitte_V = irregV "sitte" "satt" "sittet" ;
lin skjære_V = irregV "skjære" "skar" "skåret" ;
lin skrive_V = irregV "skrive" "skrev" "skrevet" ;
lin skulle_V = irregV "skulle" "skulle" "skullet" ;
lin slå_V = irregV "slå" "slo" "slått" ;
lin slåss_V = mkV "slåss" "slåss" "slåss" "sloss" "slåss" "slåss" ;
lin sove_V = irregV "sove" "sov" "sovet" ;
lin springe_V = irregV "springe" "sprang" "sprunget" ;
lin spørre_V = irregV "spørre" "spurte" "spurt" ;
lin stikke_V = irregV "stikke" "stakk" "stukket" ;
lin stå_V = irregV "stå" "stod" "stått" ;
lin suge_V = irregV "suge" (variants {"sugde" ; "saug"}) "sugd" ;
lin synes_V = irregV "synes" "syntes" (variants {"synes" ; "syns"}) ;
lin synge_V = irregV "synge" "sang" "sunget" ;
lin ta_V = irregV "ta" "tok" "tatt" ;
lin treffe_V = irregV "treffe" "traff" "truffet" ;
lin trives_V = irregV "trives" "trivdes" (variants {"trives" ; "trivs"}) ;
lin ville_V = irregV "ville" "ville" "villet" ;
lin vite_V = mkV "vite" "vet" "vetes" "visste" "visst" "vit" ;
}

View File

@@ -0,0 +1,65 @@
abstract VerbsDanAbs = Categories ** {
fun be_V : V ;
fun bite_V : V ;
fun bli_V : V ;
fun brenne_V : V ;
fun bringe_V : V ;
fun burde_V : V ;
fun bćre_V : V ;
fun dra_V : V ;
fun drikke_V : V ;
fun drive_V : V ;
fun dř_V : V ;
fun eie_V : V ;
fun falle_V : V ;
fun finne_V : V ;
fun fly_V : V ;
fun flyte_V : V ;
fun foretrekke_V : V ;
fun forlate_V : V ;
fun forstĺ_V : V ;
fun fortelle_V : V ;
fun fryse_V : V ;
fun fĺ_V : V ;
fun gi_V : V ;
fun gjelde_V : V ;
fun gjřre_V : V ;
fun gni_V : V ;
fun gĺ_V : V ;
fun ha_V : V ;
fun hente_V : V ;
fun hete_V : V ;
fun hjelpe_V : V ;
fun holde_V : V ;
fun komme_V : V ;
fun kunne_V : V ;
fun la_V : V ;
fun legge_V : V ;
fun ligge_V : V ;
fun lřpe_V : V ;
fun mĺtte_V : V ;
fun renne_V : V ;
fun se_V : V ;
fun selge_V : V ;
fun sette_V : V ;
fun si_V : V ;
fun sitte_V : V ;
fun skjćre_V : V ;
fun skrive_V : V ;
fun skulle_V : V ;
fun slĺ_V : V ;
fun slĺss_V : V ;
fun sove_V : V ;
fun springe_V : V ;
fun spřrre_V : V ;
fun stikke_V : V ;
fun stĺ_V : V ;
fun suge_V : V ;
fun synes_V : V ;
fun synge_V : V ;
fun ta_V : V ;
fun treffe_V : V ;
fun trives_V : V ;
fun ville_V : V ;
fun vite_V : V ;
}

View File

@@ -0,0 +1,56 @@
all: gfdoc htmls gifs
htmls:
htmls gf-resource.html
gfdoc:
gfdoc ../abstract/Categories.gf ; mv ../abstract/Categories.html .
gfdoc ../abstract/Rules.gf ; mv ../abstract/Rules.html .
gfdoc ../abstract/Verbphrase.gf ; mv ../abstract/Verbphrase.html .
gfdoc ../abstract/Clause.gf ; mv ../abstract/Clause.html .
gfdoc ../abstract/Structural.gf ; mv ../abstract/Structural.html .
gfdoc ../abstract/Basic.gf ; mv ../abstract/Basic.html .
gfdoc ../abstract/Time.gf ; mv ../abstract/Time.html .
gfdoc ../abstract/Lang.gf ; mv ../abstract/Lang.html .
gfdoc ../swedish/ParadigmsSwe.gf ; mv ../swedish/ParadigmsSwe.html .
gfdoc ../swedish/VerbsSwe.gf ; mv ../swedish/VerbsSwe.html .
gfdoc ../swedish/BasicSwe.gf ; mv ../swedish/BasicSwe.html .
gfdoc ../english/ParadigmsEng.gf ; mv ../english/ParadigmsEng.html .
gfdoc ../english/VerbsEng.gf ; mv ../english/VerbsEng.html .
gfdoc ../english/BasicEng.gf ; mv ../english/BasicEng.html .
gfdoc ../french/ParadigmsFre.gf ; mv ../french/ParadigmsFre.html .
gfdoc ../french/VerbsFre.gf ; mv ../french/VerbsFre.html .
gfdoc ../french/BasicFre.gf ; mv ../french/BasicFre.html .
gfdoc ../norwegian/ParadigmsNor.gf ; mv ../norwegian/ParadigmsNor.html .
gfdoc ../norwegian/VerbsNor.gf ; mv ../norwegian/VerbsNor.html .
gfdoc ../norwegian/BasicNor.gf ; mv ../norwegian/BasicNor.html .
gfdoc ../finnish/ParadigmsFin.gf ; mv ../finnish/ParadigmsFin.html .
gfdoc ../finnish/BasicFin.gf ; mv ../finnish/BasicFin.html .
gfdoc ../italian/ParadigmsIta.gf ; mv ../italian/ParadigmsIta.html .
gfdoc ../italian/BasicIta.gf ; mv ../italian/BasicIta.html .
gfdoc ../italian/BeschIta.gf ; mv ../italian/BeschIta.html .
gfdoc ../spanish/ParadigmsSpa.gf ; mv ../spanish/ParadigmsSpa.html .
gfdoc ../spanish/BasicSpa.gf ; mv ../spanish/BasicSpa.html .
gfdoc ../spanish/BeschSpa.gf ; mv ../spanish/BeschSpa.html .
gifs: api lang scand low
api:
# echo "pm -printer=graph | wf Resource.dot" | gf ../abstract/Resource.gf
dot -Tgif ResourceVP.dot>Resource.gif
lang:
echo "pm -printer=graph | wf Lang.dot" | gf ../abstract/Lang.gf
dot -Tgif Lang.dot>Lang.gif
low:
echo "pm -printer=graph | wf Low.dot" | gf ../english/RulesEng.gf
dot -Tgif Low.dot >Low.gif
scand:
echo "pm -printer=graph | wf Scand.dot" | gf ../swedish/RulesSwe.gf
dot -Tgif Scand.dot >Scand.gif

View File

@@ -0,0 +1,28 @@
digraph {
Verbphrase [style = "solid", shape = "ellipse", URL = "Verbphrase.gf"];
Clause -> Categories [style = "solid"];
Resource [style = "solid", shape = "ellipse", URL = "Resource.gf"];
Resource -> Rules [style = "solid"];
Resource -> Clause [style = "solid"];
Resource -> Structural [style = "solid"];
Clause [style = "solid", shape = "ellipse", URL = "Clause.gf"];
Clause -> Categories [style = "solid"];
Rules [style = "solid", shape = "ellipse", URL = "Rules.gf"];
Rules -> Categories [style = "solid"];
Structural [style = "solid", shape = "ellipse", URL = "Structural.gf"];
Structural -> Categories [style = "solid"];
Structural -> Numerals [style = "solid"];
Categories [style = "solid", shape = "ellipse", URL = "Categories.gf"];
Categories -> PredefAbs [style = "solid"];
PredefAbs [style = "solid", shape = "ellipse", URL = "PredefAbs.gf"];
Numerals [style = "solid", shape = "ellipse", URL = "Numerals.gf"];
}

View File

@@ -0,0 +1,28 @@
digraph {
Verbphrase [style = "solid", shape = "ellipse", URL = "Verbphrase.gf"];
Verbphrase -> Categories [style = "solid"];
Resource [style = "solid", shape = "ellipse", URL = "Resource.gf"];
Resource -> Rules [style = "solid"];
Resource -> Clause [style = "solid"];
Resource -> Structural [style = "solid"];
Rules [style = "solid", shape = "ellipse", URL = "Rules.gf"];
Rules -> Categories [style = "solid"];
Clause [style = "solid", shape = "ellipse", URL = "Clause.gf"];
Clause -> Categories [style = "solid"];
Structural [style = "solid", shape = "ellipse", URL = "Structural.gf"];
Structural -> Categories [style = "solid"];
Structural -> Numerals [style = "solid"];
Categories [style = "solid", shape = "ellipse", URL = "Categories.gf"];
Categories -> PredefAbs [style = "solid"];
PredefAbs [style = "solid", shape = "ellipse", URL = "PredefAbs.gf"];
Numerals [style = "solid", shape = "ellipse", URL = "Numerals.gf"];
}

View File

@@ -0,0 +1,29 @@
digraph {
GrammarSwe [style = "solid", shape = "box", color = "green"];
GrammarSwe -> GrammarScand [style = "solid"];
GrammarSwe -> SyntaxSwe [style = "solid"];
LexiconSwe [style = "solid", shape = "box", color = "red"];
LexiconSwe -> MorphoSwe [style = "solid"];
GrammarScand [style = "solid", shape = "box"];
GrammarScand -> SyntaxScand [style = "solid"];
SyntaxScand [style = "solid", shape = "ellipse"];
SyntaxScand -> TypesScand [style = "solid"];
SyntaxSwe [style = "solid", shape = "ellipse", color = "yellow"];
SyntaxSwe -> SyntaxScand [style = "solid"];
SyntaxSwe -> TypesSwe [style = "solid"];
SyntaxSwe -> MorphoSwe [style = "solid"];
MorphoSwe [style = "solid", shape = "ellipse", color="red"];
MorphoSwe -> TypesSwe [style = "solid"];
TypesSwe [style = "solid", shape = "ellipse", color = "yellow"];
TypesSwe -> TypesScand [style = "solid"];
TypesScand [style = "solid", shape = "ellipse"];
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -0,0 +1,12 @@
-- The Question grammar specialized to animals.
abstract Animals = Questions ** {
flags startcat=Phrase ;
fun
-- a lexicon of animals and actions among them
Dog, Cat, Mouse, Lion, Zebra : Entity ;
Chase, Eat, See : Action ;
}

View File

@@ -0,0 +1,15 @@
--# -path=.:resource/english:resource/abstract:resource/../prelude
concrete AnimalsEng of Animals = QuestionsEng **
open ResourceEng, ParadigmsEng, VerbsEng in {
lin
Dog = regN "dog" ;
Cat = regN "cat" ;
Mouse = mk2N "mouse" "mice" ;
Lion = regN "lion" ;
Zebra = regN "zebra" ;
Chase = dirV2 (regV "chase") ;
Eat = dirV2 eat_V ;
See = dirV2 see_V ;
}

View File

@@ -0,0 +1,15 @@
--# -path=.:resource/french:resource/romance:resource/abstract:resource/../prelude
concrete AnimalsFre of Animals = QuestionsFre **
open ResourceFre, ParadigmsFre, VerbsFre in {
lin
Dog = regN "chien" masculine ;
Cat = regN "chat" masculine ;
Mouse = regN "souris" feminine ;
Lion = regN "lion" masculine ;
Zebra = regN "zèbre" masculine ;
Chase = dirV2 (regV "chasser") ;
Eat = dirV2 (regV "manger") ;
See = voir_V2 ;
}

View File

@@ -0,0 +1,15 @@
--# -path=.:resource/swedish:resource/scandinavian:resource/abstract:resource/../prelude
concrete AnimalsSwe of Animals = QuestionsSwe **
open ResourceSwe, ParadigmsSwe, VerbsSwe in {
lin
Dog = regN "hund" utrum ;
Cat = mk2N "katt" "katter" ;
Mouse = mkN "mus" "musen" "möss" "mössen" ;
Lion = mk2N "lejon" "lejon" ;
Zebra = regN "zebra" utrum ;
Chase = dirV2 (regV "jaga") ;
Eat = dirV2 äta_V ;
See = dirV2 se_V ;
}

View File

@@ -0,0 +1,20 @@
--# -path=.:resource/abstract:resource/../prelude
-- Language-independent question grammar parametrized on Resource.
incomplete concrete QuestionsI of Questions = open Resource in {
lincat
Phrase = Phr ;
Entity = N ;
Action = V2 ;
lin
Who act obj =
QuestPhrase (UseQCl (PosTP TPresent ASimul)
(QPredV2 who8one_IP act (IndefNumNP NoNum (UseN obj)))) ;
Whom subj act =
QuestPhrase (UseQCl (PosTP TPresent ASimul)
(IntSlash who8one_IP (SlashV2 (DefOneNP (UseN subj)) act))) ;
Answer subj act obj =
IndicPhrase (UseCl (PosTP TPresent ASimul)
(SPredV2 (DefOneNP (UseN subj)) act (IndefNumNP NoNum (UseN obj)))) ;
}

View File

@@ -0,0 +1,10 @@
-- Simple questions and answers, in present tense.
abstract Questions = {
cat
Phrase ; Entity ; Action ;
fun
Who : Action -> Entity -> Phrase ; -- who chases X
Whom : Entity -> Action -> Phrase ; -- whom does X chase
Answer : Entity -> Action -> Entity -> Phrase ; -- X chases Y
}

View File

@@ -0,0 +1,2 @@
concrete QuestionsEng of Questions = QuestionsI with
(Resource = ResourceEng) ;

View File

@@ -0,0 +1,2 @@
concrete QuestionsFre of Questions = QuestionsI with
(Resource = ResourceFre) ;

View File

@@ -0,0 +1,19 @@
-- File generated by GF from ./QuestionsI.gfe
--# -resource=../../english/LangEng.gf
-- to compile: gf -examples QuestionsI.gfe
incomplete concrete QuestionsI of Questions = open Resource in {
lincat
Phrase = Phr ;
Entity = N ;
Action = V2 ;
lin
Who love_V2 man_N = QuestPhrase (UseQCl (PosTP TPresent ASimul) (QPredV2 who8one_IP love_V2 (IndefNumNP NoNum (UseN man_N)))) ;
Whom man_N love_V2 = QuestPhrase (UseQCl (PosTP TPresent ASimul) (IntSlash who8many_IP (SlashV2 (DefOneNP (UseN man_N)) love_V2))) ; -- AMBIGUOUS:
-- QuestPhrase (UseQCl (PosTP TPresent ASimul) (IntSlash who8one_IP (SlashV2 (DefOneNP (UseN man_N)) love_V2))) ;
Answer woman_N love_V2 man_N = IndicPhrase (UseCl (PosTP TPresent ASimul) (SPredV2 (DefOneNP (UseN woman_N)) love_V2 (IndefNumNP NoNum (UseN man_N)))) ;
}

View File

@@ -0,0 +1,16 @@
--# -resource=../../english/LangEng.gf
-- to compile: gf -examples QuestionsI.gfe
incomplete concrete QuestionsI of Questions = open Resource in {
lincat
Phrase = Phr ;
Entity = N ;
Action = V2 ;
lin
Who love_V2 man_N = in Phr "who loves men ?" ;
Whom man_N love_V2 = in Phr "whom does the man love ?" ;
Answer woman_N love_V2 man_N = in Phr "the woman loves men ." ;
}

View File

@@ -0,0 +1,2 @@
concrete QuestionsSwe of Questions = QuestionsI with
(Resource = ResourceSwe) ;

View File

@@ -0,0 +1,4 @@
i -ex AnimalsEng.gf ;; s
i AnimalsFre.gf ;; s
i AnimalsSwe.gf ;; s
pm | wf animals.gfcm

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,231 @@
--# -path=.:../abstract:../../prelude
--# -val
concrete BasicEng of Basic = CategoriesEng ** 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_ADeg = regADeg "bad" ;
bank_N = regN "bank" ;
beautiful_ADeg = regADeg "beautiful" ;
become_VA = mkVA (irregV "become" "became" "become") ;
beer_N = regN "beer" ;
beg_V2V = mkV2V (regDuplV "beg") [] "to" ;
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 (irregV "break" "broke" "broken") ;
broad_ADeg = regADeg "broad" ;
brother_N2 = regN2 "brother" ;
brown_ADeg = 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_ADeg = regADeg "clean" ;
clever_ADeg = regADeg "clever" ;
close_V2 = dirV2 (regV "close") ;
coat_N = regN "coat" ;
cold_ADeg = 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_ADeg = 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_ADeg = 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_ADeg = mkADeg "good" "well" "better" "best" ;
go_V = (mkV "go" "goes" "went" "gone" "going") ;
green_ADeg = 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_ADeg = regADeg "hot" ;
house_N = regN "house" ;
important_ADeg = 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_ADeg = 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_ADeg = regADeg "narrow" ;
new_ADeg = regADeg "new" ;
newspaper_N = regN "newspaper" ;
oil_N = regN "oil" ;
old_ADeg = 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_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 = (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_ADeg = regADeg "short" ;
silver_N = regN "silver" ;
sister_N = regN "sister" ;
sleep_V = (irregV "sleep" "slept" "slept") ;
small_ADeg = 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_ADeg = 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_ADeg = regADeg "thick" ;
thin_ADeg = regADeg "thin" ;
train_N = regN "train" ;
travel_V = (regDuplV "travel") ;
tree_N = regN "tree" ;
---- trousers_N = regN "trousers" ;
ugly_ADeg = 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_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 (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_ADeg = regADeg "yellow" ;
young_ADeg = 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" ;
here_Adv = mkAdv "here" ;
here7to_Adv = mkAdv ["to here"] ;
here7from_Adv = mkAdv ["from here"] ;
there_Adv = mkAdv "there" ;
there7to_Adv = mkAdv "there" ;
there7from_Adv = mkAdv ["from there"] ;
} ;

View File

@@ -0,0 +1,107 @@
--# -path=.:../abstract:../../prelude
--1 The Top-Level English Resource Grammar: Combination Rules
--
-- Aarne Ranta 2002 -- 2003
--
-- This is the English concrete syntax of the multilingual resource
-- grammar. Most of the work is done in the file $syntax.Eng.gf$.
-- However, for the purpose of documentation, we make here explicit the
-- linearization types of each category, so that their structures and
-- dependencies can be seen.
-- Another substantial part are the linearization rules of some
-- structural words.
--
-- The users of the resource grammar should not look at this file for the
-- linearization rules, which are in fact hidden in the document version.
-- They should use $resource.Abs.gf$ to access the syntactic rules.
-- This file can be consulted in those, hopefully rare, occasions in which
-- one has to know how the syntactic categories are
-- implemented. The parameter types are defined in $TypesEng.gf$.
concrete CategoriesEng of Categories = PredefCnc ** open Prelude, SyntaxEng in {
lincat
N = CommNoun ;
-- = {s : Number => Case => Str}
CN = CommNounPhrase ;
-- = CommNoun ** {g : Gender}
NP = {s : NPForm => Str ; a : Agr} ;
PN = {s : Case => Str ; g : Gender} ;
Det = {s : Str ; n : Number} ;
NDet = {s : Str} ;
N2 = Function ;
-- = CommNounPhrase ** {s2 : Preposition} ;
N3 = Function ** {s3 : Preposition} ;
Num = {s : Case => Str ; n : Number} ;
Prep = {s : Str} ;
A = Adjective ;
-- = {s : AForm => Str}
A2 = Adjective ** {s2 : Preposition} ;
ADeg = {s : Degree => AForm => Str} ;
AP = {s : Agr => Str ; p : Bool} ;
AS = Adjective ; --- "more difficult for him to come than..."
A2S = Adjective ** {s2 : Preposition} ;
AV = Adjective ;
A2V = Adjective ** {s2 : Preposition} ;
V = Verb ;
-- = {s : VForm => Str ; s1 : Particle}
VP = {s,s2 : Bool => SForm => Agr => Str ; isAux : Bool} ;
VPI = {s : VIForm => Agr => Str ; s1 : Str} ; -- s1 is "not" or []
VCl = {s : Bool => Anteriority => VIForm => Agr => Str ; s1 : Bool => Str} ;
V2 = TransVerb ;
-- = Verb ** {s3 : Preposition} ;
V3 = TransVerb ** {s4 : Preposition} ;
VS = Verb ;
VV = AuxVerb ** {isAux : Bool} ;
VS = Verb ;
VQ = Verb ;
VA = Verb ;
V2S = TransVerb ;
V2Q = TransVerb ;
V2V = TransVerb ** {s4 : Str} ;
----V2V = {s : VForm => Str ; s1 : Particle ; s3, s4 : Str} ;
V2A = TransVerb ;
V0 = Verb ;
TP = {s : Str ; b : Bool ; t : Tense ; a : Anteriority} ; --- the Str field is dummy
Tense = {s : Str ; t : Tense} ;
Pol = {s : Str ; p : Bool} ;
Ant = {s : Str ; a : Anteriority} ;
PP = {s : Str} ;
Adv = {s : Str} ;
AdV = {s : Str} ;
AdA = {s : Str} ;
AdC = {s : Str} ;
S = {s : Str} ;
Cl = Clause ;
-- = {s : Order => Bool => SForm => Str} ;
Slash = {s : QuestForm => Bool => SForm => Str ; s2 : Preposition} ;
RP = {s : Gender => Number => NPForm => Str} ;
RCl = {s : (Bool * SForm * Agr) => Str} ;
RS = {s : Agr => Str} ;
IP = {s : NPForm => Str ; n : Number ; g : Gender} ;
IDet = {s : Str ; n : Number} ;
IAdv = {s : Str} ;
QCl = {s : Bool => SForm => QuestForm => Str} ;
QS = {s : QuestForm => Str} ;
Imp = {s : Number => Str} ;
Phr = {s : Str} ;
Text = {s : Str} ;
Conj = {s : Str ; n : Number} ;
ConjD = {s1 : Str ; s2 : Str ; n : Number} ;
ListS = {s1 : Str ; s2 : Str} ;
ListAP = {s1,s2 : Agr => Str ; p : Bool} ;
ListNP = {s1,s2 : NPForm => Str ; a : Agr} ;
ListAdv = {s1 : Str ; s2 : Str} ;
} ;

View File

@@ -0,0 +1,97 @@
--# -path=.:../abstract:../../prelude
concrete ClauseEng of Clause = CategoriesEng **
open Prelude, SyntaxEng in {
flags optimize=all_subs ;
lin
SPredV np v = predVerbClause np v (complVerb v) ;
SPredPassV np v = predBeGroup np (passVerb v) ;
SPredV2 np v x = predVerbClause np v (complTransVerb v x) ;
SPredReflV2 np v = predVerbClause np v (reflTransVerb v) ;
SPredV3 np v x y = predVerbClause np v (complDitransVerb v x y) ;
SPredVS np v x = predVerbClause np v (complSentVerb v x) ;
SPredVV np v x = predVerbClause np (aux2verb v) (complVerbVerb v x) ;
SPredVQ np v x = predVerbClause np v (complQuestVerb v x) ;
SPredVA np v x = predVerbClause np v (complAdjVerb v x) ;
SPredV2A np v x y = predVerbClause np v (complDitransAdjVerb v x y) ;
SPredSubjV2V np v x y = predVerbClause np v (complDitransVerbVerb False v x y) ;
SPredObjV2V np v x y = predVerbClause np v (complDitransVerbVerb True v x y) ;
SPredV2S np v x y = predVerbClause np v (complDitransSentVerb v x y) ;
SPredV2Q np v x y = predVerbClause np v (complDitransQuestVerb v x y) ;
SPredAP np v = predBeGroup np v.s ;
SPredCN np v = predBeGroup np (complCommNoun v) ;
SPredNP np v = predBeGroup np (complNounPhrase v) ;
SPredAdv np v = predBeGroup np (complAdverb v) ;
SPredProgVP = progressiveClause ;
QPredV np v = intVerbClause np v (complVerb v) ;
QPredPassV np v = predBeGroupQ np (passVerb v) ;
QPredV2 np v x = intVerbClause np v (complTransVerb v x) ;
QPredReflV2 np v = intVerbClause np v (reflTransVerb v) ;
QPredV3 np v x y = intVerbClause np v (complDitransVerb v x y) ;
QPredVS np v x = intVerbClause np v (complSentVerb v x) ;
QPredVV np v x = intVerbClause np (aux2verb v) (complVerbVerb v x) ;
QPredVQ np v x = intVerbClause np v (complQuestVerb v x) ;
QPredVA np v x = intVerbClause np v (complAdjVerb v x) ;
QPredV2A np v x y = intVerbClause np v (complDitransAdjVerb v x y) ;
QPredSubjV2V np v x y = intVerbClause np v (complDitransVerbVerb False v x y) ;
QPredObjV2V np v x y = intVerbClause np v (complDitransVerbVerb True v x y) ;
QPredV2S np v x y = intVerbClause np v (complDitransSentVerb v x y) ;
QPredV2Q np v x y = intVerbClause np v (complDitransQuestVerb v x y) ;
QPredAP np v = predBeGroupQ np v.s ;
QPredCN np v = predBeGroupQ np (complCommNoun v) ;
QPredNP np v = predBeGroupQ np (complNounPhrase v) ;
QPredAdv np v = predBeGroupQ np (complAdverb v) ;
QPredProgVP np vp = predBeGroupQ np (vp.s ! VIPresPart) ;
RPredV np v = relVerbClause np v (complVerb v) ;
RPredPassV np v = predBeGroupR np (passVerb v) ;
RPredV2 np v x = relVerbClause np v (complTransVerb v x) ;
RPredReflV2 np v = relVerbClause np v (reflTransVerb v) ;
RPredV3 np v x y = relVerbClause np v (complDitransVerb v x y) ;
RPredVS np v x = relVerbClause np v (complSentVerb v x) ;
RPredVV np v x = relVerbClause np (aux2verb v) (complVerbVerb v x) ;
RPredVQ np v x = relVerbClause np v (complQuestVerb v x) ;
RPredVA np v x = relVerbClause np v (complAdjVerb v x) ;
RPredV2A np v x y = relVerbClause np v (complDitransAdjVerb v x y) ;
RPredSubjV2V np v x y = relVerbClause np v (complDitransVerbVerb False v x y) ;
RPredObjV2V np v x y = relVerbClause np v (complDitransVerbVerb True v x y) ;
RPredV2S np v x y = relVerbClause np v (complDitransSentVerb v x y) ;
RPredV2Q np v x y = relVerbClause np v (complDitransQuestVerb v x y) ;
RPredAP np v = predBeGroupR np v.s ;
RPredCN np v = predBeGroupR np (complCommNoun v) ;
RPredNP np v = predBeGroupR np (complNounPhrase v) ;
RPredAdv np v = predBeGroupR np (complAdverb v) ;
RPredProgVP np vp = predBeGroupR np (vp.s ! VIPresPart) ;
IPredV v = predVerbI v (complVerb v) ;
IPredPassV v = predVerbI v (passVerb v) ;
IPredV2 v x = predVerbI v (complTransVerb v x) ;
IPredReflV2 v = predVerbI v (reflTransVerb v) ;
IPredV3 v x y = predVerbI v (complDitransVerb v x y) ;
IPredVS v x = predVerbI v (complSentVerb v x) ;
IPredVV v x = predVerbI (aux2verb v) (complVerbVerb v x) ;
IPredVQ v x = predVerbI v (complQuestVerb v x) ;
IPredVA v x = predVerbI v (complAdjVerb v x) ;
IPredV2A v x y = predVerbI v (complDitransAdjVerb v x y) ;
IPredSubjV2V v x y = predVerbI v (complDitransVerbVerb False v x y) ;
IPredObjV2V v x y = predVerbI v (complDitransVerbVerb True v x y) ;
IPredV2S v x y = predVerbI v (complDitransSentVerb v x y) ;
IPredV2Q v x y = predVerbI v (complDitransQuestVerb v x y) ;
IPredAP v = predBeGroupI v.s ;
IPredCN v = predBeGroupI (complCommNoun v) ;
IPredNP v = predBeGroupI (complNounPhrase v) ;
IPredAdv v = predBeGroupI (complAdverb v) ;
IPredProgVP vp = predBeGroupI (vp.s ! VIPresPart) ;
}

View File

@@ -0,0 +1,5 @@
--# -path=.:../abstract:../../prelude
--# -opt
concrete ClauseEngVP of Clause = CategoriesEng **
ClauseI with (Rules=RulesEng), (Verbphrase=VerbphraseEng) ;

View File

@@ -0,0 +1,27 @@
concrete CountryEng of Country = open CategoriesEng, ParadigmsEng in {
lincat
Country = PN ;
Nationality = A ;
Language = N ;
lin
Denmark = regPN "Denmark" nonhuman ;
England = regPN "England" nonhuman ;
Finland = regPN "Finland" nonhuman ;
France = regPN "France" nonhuman ;
Germany = regPN "Germany" nonhuman ;
Italy = regPN "Italy" nonhuman ;
Norway = regPN "Norway" nonhuman ;
Russia = regPN "Russia" nonhuman ;
Spain = regPN "Spain" nonhuman ;
Sweden = regPN "Sweden" nonhuman ;
Danish = regA "Danish" ;
English = regA "English" ;
DanishLang = regN "Danish" ;
EnglishLang = regN "English" ;
} ;

View File

@@ -0,0 +1,9 @@
instance DemResEng of DemRes = open Prelude, ResourceEng, SyntaxEng in {
oper
msS : S -> Str = \x -> x.s ;
msQS : QS -> Str = \x -> x.s ! DirQ ;
msImp : Imp -> Str = \x -> x.s ! Sg ;
} ;

View File

@@ -0,0 +1,7 @@
--# -path=.:../abstract:../../prelude
concrete DemonstrativeEng of Demonstrative =
CategoriesEng ** DemonstrativeI with
(Resource = ResourceEng),
(Basic = BasicEng),
(DemRes = DemResEng) ;

View File

@@ -0,0 +1,43 @@
---- to be merged in TypesEng
resource DeptypEng = open Prelude, TypesEng in {
param
VComp =
CVt_
| CVt CComp
| CVtN CPrep CComp ;
CComp =
CCtN CPrep
| CCtS
| CCtV
| CCtQ
| CCtA ;
CPrep = CP_ | CP_at | CP_in | CP_on | CP_to ;
oper
strCPrep : CPrep -> Str = \p -> case p of {
CP_ => [] ;
CP_at => "at" ;
CP_in => "in" ;
CP_on => "on" ;
CP_to => "to"
} ;
cprep1, cprep2 : VComp -> Str -> Str ;
cprep1 c s = case c of {
CVt (CCtN cp) => strCPrep cp ++ s ;
CVtN cp _ => strCPrep cp ++ s ;
_ => s
} ;
cprep2 c s = case c of {
CVtN _ (CCtN cp) => strCPrep cp ++ s ;
_ => s
} ;
}

View File

@@ -0,0 +1,26 @@
--# -path=.:../abstract:../../prelude
-- # -path=.:resource/english:resource/abstract:prelude
concrete LangEng of Lang =
RulesEng,
ClauseEng,
StructuralEng,
BasicEng,
TimeEng,
CountryEng,
MathEng
** open Prelude, ParadigmsEng in {
lin
AdvDate d = prefixSS "on" d ;
AdvTime t = prefixSS "at" t ;
NWeekday w = w ;
PNWeekday w = nounPN w ;
PNCountry x = x ;
ANationality x = x ;
NLanguage x = x ;
}

View File

@@ -0,0 +1,6 @@
--# -path=.:../abstract:../../prelude
concrete LangVPEng of LangVP =
LangEng,
VerbphraseEng,
** {} ;

View File

@@ -0,0 +1,43 @@
--# -path=.:../abstract:../../prelude
concrete MathEng of Math = CategoriesEng ** open Prelude, SyntaxEng, ParadigmsEng in {
lin
SymbPN i = {s = \\c => caseSymb c i.s ; g = Neutr} ;
IntPN i = {s = \\c => caseSymb c i.s ; g = Neutr} ;
IntNP cn i = nameNounPhrase {
s = \\c => (cn.s ! Sg ! Nom ++ caseSymb c i.s) ;
g = Neutr
} ;
IndefSymbNumNP nu cn xs =
addSymbNounPhrase (indefNounPhraseNum plural nu cn) xs.s ;
DefSymbNumNP nu cn xs =
addSymbNounPhrase (defNounPhraseNum plural nu cn) xs.s ;
NDetSymbNP det nu cn xs =
addSymbNounPhrase (numDetNounPhrase det nu cn) xs.s ;
lincat
SymbList = SS ;
lin
SymbTwo = infixSS "and" ;
SymbMore = infixSS "," ;
LetImp x np = {s = \\_ => "let" ++ x.s ! NomP ++ "be" ++ np.s ! NomP} ;
ExistNP np = predVerbClause
(nameNounPhraseN (fromAgr np.a).n (nameReg "there" Neutr))
(regV "exist")
(complNounPhrase np) ;
-- Moved from $RulesEng$.
SymbCN cn s =
{s = \\n,c => cn.s ! n ! Nom ++ caseSymb c s.s ;
g = cn.g} ;
IntCN cn s =
{s = \\n,c => cn.s ! n ! Nom ++ caseSymb c s.s ;
g = cn.g} ;
}

View File

@@ -0,0 +1,34 @@
--# -path=.:../abstract:../../prelude
concrete MinimalEng of Minimal = CategoriesEng ** open ParadigmsEng in {
flags
optimize=all ;
lin
man_N = mk2N "man" "men" ;
wine_N = regN "wine" ;
mother_N2 = regN2 "mother" ;
distance_N3 = mkN3 (regN "distance") "from" "to" ;
john_PN = regPN "John" masculine ;
blue_ADeg = regADeg "blue" ;
american_A = regA "american" ;
married_A2 = mkA2 (regA "married") "to" ;
probable_AS = mkAS (regA "probable") ;
important_A2S = mkA2S (regA "important") "to" ;
easy_A2V = mkA2V (regA "easy") "for" ;
now_Adv = mkAdv "now" ;
walk_V = (regV "walk") ;
love_V2 = dirV2 (regV "love") ;
give_V3 = dirV3 (irregV "give" "gave" "given") "to" ;
believe_VS = mkVS (regV "believe") ;
try_VV = mkVV (regV "try") ;
wonder_VQ = mkVQ (regV "wonder") ;
become_VA = mkVA (irregV "become" "became" "become") ;
paint_V2A = mkV2A (regV "paint") [] ;
promise_V2V = mkV2V (regV "promise") [] "to" ;
ask_V2Q = mkV2Q (regV "ask") [] ;
tell_V2S = mkV2S (irregV "tell" "told" "told") [] ;
rain_V0 = mkV0 (regV "rain") ;
} ;

View File

@@ -0,0 +1,52 @@
module Main where
import List
-- create a GF file from a word form list:
-- one entry per line, newline or tab separated;
-- variants separated by /
-- comments are lines starting with --
-- example line: bid bid/bade bid/bidden
-- example resource: http://www2.gsu.edu/~wwwesl/egw/verbs.htm
-- parameters, depending on language
infile = "norwegian/web2.txt"
outfile = "Verbs.gf"
preamble = ""
{-
"resource VerbsEng = open ResourceEng, MorphoEng in {\n" ++
" oper vIrreg : Str -> Str -> Str -> V = \\x,y,z ->\n" ++
" mkVerbIrreg x y z ** {s1 = [] ; lock_V = <>} ;\n\n"
-}
oper = "irregV"
cat = "V"
name s = s ++ "_V"
ending = "}\n"
main :: IO ()
main = do
ss <- readFile infile >>= return . filter (not . null) . lines
writeFile outfile preamble
mapM_ (appendFile outfile . mkOne . words) (filter notComment ss)
appendFile outfile ending
notComment = (/="--") . take 2
mkOne :: [String] -> String
mkOne ws@(v:_) =
" fun " ++ name v ++ " : " ++ cat ++ " ;\n" ++
" lin " ++ name v ++ " : " ++ cat ++ " = " ++
oper ++ " " ++ unwords (map arg ws) ++ " ;\n"
where
arg w = case variants w of
[s] -> quote s
vs -> "(variants {" ++
unwords (intersperse ";" (map quote vs)) ++ "})"
quote s = "\"" ++ s ++ "\""
variants = chopBy '/'
chopBy c s = case span (/= c) s of
(w1,_:w2) -> w1 : chopBy c w2
(w1,_) -> [w1]

View File

@@ -0,0 +1,341 @@
--# -path=.:../../prelude
--1 A Simple English Resource Morphology
--
-- Aarne Ranta 2002
--
-- 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 = TypesEng ** 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
mkNoun : (_,_,_,_ : Str) -> CommonNoun =
\man,men, mans, mens -> {s = table {
Sg => table {Nom => man ; Gen => mans} ;
Pl => table {Nom => men ; Gen => mens}
}} ;
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 -> ProperName = \john,g ->
{s = table {Nom => john ; Gen => john + "'s"} ; g = g} ;
--2 Pronouns
--
-- Here we define personal and relative pronouns.
mkPronoun : (_,_,_,_ : Str) -> Number -> Person -> Gender -> Pronoun =
\I,me,my,mine,n,p,g ->
{s = table {NomP => I ; AccP => me ; GenP => my ; GenSP => mine} ;
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 form still 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 ; ---
-- Relative pronouns in the accusative have the 'no pronoun' variant.
-- The simple pronouns do not really depend on number.
relPron : RelPron = {s = table {
Neutr => \\_ => table {
NomP => variants {"that" ; "which"} ;
AccP => variants {"that" ; "which" ; []} ;
GenP => variants {"whose"} ;
GenSP => variants {"which"}
} ;
_ => \\_ => table {
NomP => variants {"that" ; "who"} ;
AccP => variants {"that" ; "who" ; "whom" ; []} ;
GenP => variants {"whose"} ;
GenSP => variants {"whom"}
}
}
} ;
--3 Determiners
--
-- 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" ;
--2 Adjectives
--
-- To form the adjectival and the adverbial forms, two strings are needed
-- in the worst case.
mkAdjective : Str -> Str -> Adjective = \free,freely -> {
s = table {
AAdj => free ;
AAdv => freely
}
} ;
-- However, the ending "iy" is sufficient for most cases. This function
-- automatically changes the word-final "y" to "i" ("happy" - "happily").
-- N.B. this is not correct for "shy", but $mkAdjective$ has to be used.
regAdjective : Str -> Adjective = \free ->
let
y = Predef.dp 1 free
in mkAdjective
free
(ifTok Str y "y" (Predef.tk 1 free + ("ily")) (free + "ly")) ;
-- For the comparison of adjectives, six forms are needed to cover all cases.
-- But there is no adjective that actually needs all these.
mkAdjDegrWorst : (_,_,_,_,_,_ : Str) -> AdjDegr =
\good,well,better,betterly,best,bestly ->
{s = table {
Pos => (mkAdjective good well).s ;
Comp => (mkAdjective better betterly).s ;
Sup => (mkAdjective best bestly).s
}
} ;
-- What is usually needed for irregular comparisons are just three forms,
-- since the adverbial form is the same (in comparative or superlative)
-- or formed in the regular way (positive).
adjDegrIrreg : (_,_,_ : Str) -> AdjDegr = \bad,worse,worst ->
let badly = (regAdjective bad).s ! AAdv
in mkAdjDegrWorst bad badly worse worse worst worst ;
-- Like above, the regular formation takes account of final "y".
adjDegrReg : Str -> AdjDegr = \happy ->
let happi = ifTok Str (Predef.dp 1 happy) "y" (Predef.tk 1 happy + "i") happy
in adjDegrIrreg happy (happi + "er") (happi + "est") ;
-- Many adjectives are 'inflected' by adding a comparison word.
adjDegrLong : Str -> AdjDegr = \ridiculous ->
adjDegrIrreg ridiculous ("more" ++ ridiculous) ("most" ++ ridiculous) ;
--3 Verbs
--
-- Except for "be", the worst case needs four forms.
mkVerbP3worst : (_,_,_,_,_: Str) -> VerbP3 = \go,goes,went,gone,going ->
{s = table {
InfImp => go ;
Indic Sg => goes ;
Indic _ => go ;
Pastt => went ;
PPart => gone ;
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 ->
let bites = case last bite of {
"y" => y2ie bite "s" ;
"s" => init bite + "es" ;
_ => bite + "s"
}
in mkVerbP3 bite bites bit bitten ;
-- This is used to derive regular forms.
mkVerbReg : Str -> VerbP3 = \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
mkVerbP3 soak soaks soaked soaked ;
mkVerb : (_,_,_ : Str) -> VerbP3 = \ring,rang,rung ->
mkVerbP3 ring (ring + "s") rang rung ;
regVerbP3 : Str -> VerbP3 = \walk ->
mkVerb walk (walk + "ed") (walk + "ed") ;
verbP3s : Str -> VerbP3 = \kiss ->
mkVerbP3 kiss (kiss + "es") (kiss + "ed") (kiss + "ed") ;
verbP3e : Str -> VerbP3 = \love ->
mkVerbP3 love (love + "s") (love + "d") (love + "d") ;
verbP3y : Str -> VerbP3 = \cr ->
mkVerbP3 (cr + "y") (cr + "ies") (cr + "ied") (cr + "ied") ;
verbGen : Str -> VerbP3 = \kill -> case last kill of {
"y" => verbP3y (init kill) ;
"e" => verbP3y (init kill) ;
"s" => verbP3s (init kill) ;
_ => regVerbP3 kill
} ;
verbP3Have = mkVerbP3 "have" "has" "had" "had" ;
verbP3Do = mkVerbP3 "do" "does" "did" "done" ;
auxVerbBe : AuxVerb = {s = table {
AInfImp => "be" ;
AIndic P1 b => if_then_Str b "am" ["am not"] ;
AIndic P2 b => negAux b "are" ;
AIndic P3 b => negAux b "is" ;
APastt Sg b => negAux b "was" ;
APastt Pl b => negAux b "were" ;
APPart => "been" ;
APresPart => "being"
}
} ;
-- The negative forms are not used;
--- the particle $want.s1$ disappears - is it ever needed?
verb2aux : Verb -> AuxVerb = \want -> {s = table {
AInfImp => want.s ! InfImp ;
AIndic P3 b => want.s ! Indic Sg ;
AIndic _ b => want.s ! Indic Pl ;
APastt _ b => want.s ! Pastt ;
APPart => want.s ! PPart ;
APresPart => want.s ! PresPart
}
} ;
aux2verb : AuxVerb -> Verb = \want -> {s = table {
InfImp => want.s ! AInfImp ;
Indic Sg => want.s ! AIndic P3 True ;
Indic _ => want.s ! AIndic P2 True ;
Pastt => want.s ! APastt Pl True ;
PPart => want.s ! APPart ;
PresPart => want.s ! APresPart
} ;
s1 = []
} ;
-- The three most important example auxiliaries.
mkVerbAux : (_,_,_,_: Str) -> AuxVerb = \beable, can, could, beenable ->
{s = table {
AInfImp => beable ;
AIndic _ b => negAux b can ;
APastt _ b => negAux b could ;
APPart => beenable ;
APrepPart => nonExist ---- fix!
} ;
} ;
verbPart : VerbP3 -> Particle -> Verb = \v,p ->
v ** {s1 = p} ;
verbNoPart : VerbP3 -> Verb = \v -> verbPart v [] ;
negAux : Bool -> Str -> Str = \b,is -> if_then_Str b is (is + "n't") ;
-- The optional negation contraction is a useful macro e.g. for "do".
contractNot : Str -> Str = \is -> variants {is ++ "not" ; is + "n't"} ;
dont = contractNot (verbP3Do.s ! InfImp) ;
-- From $numerals$.
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
}
} ;
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"
} ;
} ;

View File

@@ -0,0 +1,8 @@
--# -path=.:../abstract:../../prelude
concrete MultimodalEng of Multimodal =
RulesEng, StructuralEng, BasicEng, TimeEng, DemonstrativeEng ** MultimodalI with
(Resource = ResourceEng),
(Basic = BasicEng),
(Lang = LangEng),
(DemRes = DemResEng) ;

View File

@@ -0,0 +1,45 @@
concrete NumeralsEng of Numerals = open Prelude, MorphoEng in {
lincat Numeral = {s : CardOrd => Str ; n : Number} ;
lincat Digit = {s : DForm => CardOrd => Str} ;
lincat
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} ;
}

View File

@@ -0,0 +1,300 @@
--# -path=.:../abstract:../../prelude
--1 English Lexical Paradigms
--
-- Aarne Ranta 2003
--
-- This is an API to the user of the resource grammar
-- for adding lexical items. It give shortcuts for forming
-- expressions of basic categories: nouns, adjectives, verbs.
--
-- Closed categories (determiners, pronouns, conjunctions) are
-- accessed through the resource syntax API, $Structural.gf$.
--
-- The main difference with $MorphoEng.gf$ is that the types
-- referred to are compiled resource grammar types. We have moreover
-- had the design principle of always having existing forms, rather
-- than stems, as string
-- arguments of the paradigms.
--
-- The following modules are presupposed:
resource OldParadigmsEng = open (Predef=Predef), Prelude, SyntaxEng, ResourceEng in {
--2 Parameters
--
-- To abstract over gender names, we define the following identifiers.
oper
Gender : Type ;
human : Gender ;
nonhuman : Gender ;
-- To abstract over number names, we define the following.
Number : Type ;
singular : Number ;
plural : Number ;
-- To abstract over case names, we define the following.
Case : Type ;
nominative : Case ;
genitive : Case ;
--2 Nouns
-- Worst case: give all four forms and the semantic gender.
-- In practice the worst case is just: give singular and plural nominative.
oper
mkN : (man,men,man's,men's : Str) -> Gender -> N ;
nMan : (man,men : Str) -> Gender -> N ;
-- Regular nouns, nouns ending with "s", "y", or "o", and nouns with the same
-- plural form as the singular.
nReg : Str -> Gender -> N ; -- dog, dogs
nKiss : Str -> Gender -> N ; -- kiss, kisses
nFly : Str -> Gender -> N ; -- fly, flies
nHero : Str -> Gender -> N ; -- hero, heroes (= nKiss !)
nSheep : Str -> Gender -> N ; -- sheep, sheep
-- These use general heuristics, that recognizes the last letter. *N.B* it
-- does not get right with "boy", "rush", since it only looks at one letter.
nHuman : Str -> N ; -- gambler/actress/nanny
nNonhuman : Str -> N ; -- dog/kiss/fly
-- Nouns used as functions need a preposition. The most common is "of".
mkN2 : N -> Preposition -> N2 ;
funHuman : Str -> N2 ; -- the father/mistress/daddy of
funNonhuman : Str -> N2 ; -- the successor/address/copy of
-- Proper names, with their regular genitive.
pnReg : (John : Str) -> PN ; -- John, John's
-- The most common cases on the higher-level category $CN$ have shortcuts.
-- The regular "y"/"s" variation is taken into account.
cnNonhuman : Str -> CN ;
cnHuman : Str -> CN ;
npReg : Str -> NP ;
-- In some cases, you may want to make a complex $CN$ into a function.
mkN2CN : CN -> Preposition -> N2 ;
funOfCN : CN -> N2 ;
--2 Adjectives
-- Non-comparison one-place adjectives just have one form.
mkA : (even : Str) -> A ;
-- Two-place adjectives need a preposition as second argument.
mkA2 : (divisible, by : Str) -> A2 ;
-- Comparison adjectives have three forms. The common irregular
-- cases are ones ending with "y" and a consonant that is duplicated;
-- the "y" ending is recognized by the function $aReg$.
mkADeg : (good,better,best : Str) -> ADeg ;
aReg : (long : Str) -> ADeg ; -- long, longer, longest
aFat : (fat : Str) -> ADeg ; -- fat, fatter, fattest
aRidiculous : (ridiculous : Str) -> ADeg ; -- -/more/most ridiculous
-- On higher level, there are adjectival phrases. The most common case is
-- just to use a one-place adjective.
apReg : Str -> AP ;
--2 Adverbs
-- Adverbs are not inflected. Most lexical ones have position not
-- before the verb. Some can be preverbal (e.g. "always").
mkAdv : Str -> Adv ;
mkAdvPre : Str -> Adv ;
-- Adverbs modifying adjectives and sentences can also be formed.
mkAdA : Str -> AdA ;
mkAdC : Str -> AdC ;
-- Prepositional phrases are another productive form of adverbials.
mkPP : Str -> NP -> Adv ;
--2 Verbs
--
-- The fragment now has all verb forms, except the gerund/present participle.
-- Except for "be", the worst case needs four forms: the infinitive and
-- the third person singular present, the past indicative, and the past participle.
mkV : (go, goes, went, gone : Str) -> V ;
vReg : (walk : Str) -> V ; -- walk, walks
vKiss : (kiss : Str) -> V ; -- kiss, kisses
vFly : (fly : Str) -> V ; -- fly, flies
vGo : (go : Str) -> V ; -- go, goes (= vKiss !)
-- This generic function recognizes the special cases where the last
-- character is "y", "s", or "z". It is not right for "finish" and "convey".
vGen : Str -> V ; -- walk/kiss/fly
-- The verbs "be" and "have" are special.
---- vBe : V ;
vHave : V ;
-- Verbs with a particle.
vPart : (go, goes, went, gone, up : Str) -> V ;
vPartReg : (get, up : Str) -> V ;
-- Two-place verbs, and the special case with direct object.
-- Notice that a particle can already be included in $V$.
mkV2 : V -> Str -> V2 ; -- look for, kill
tvGen : (look, for : Str) -> V2 ; -- look for, talk about
tvDir : V -> V2 ; -- switch off
tvGenDir : (kill : Str) -> V2 ; -- kill
-- Regular two-place verbs with a particle.
tvPartReg : Str -> Str -> Str -> V2 ; -- get, along, with
-- Ditransitive verbs.
mkV3 : V -> Str -> Str -> V3 ; -- speak, with, about
v3Dir : V -> Str -> V3 ; -- give,_,to
v3DirDir : V -> V3 ; -- give,_,_
-- The definitions should not bother the user of the API. So they are
-- hidden from the document.
--.
Gender = SyntaxEng.Gender ;
Number = SyntaxEng.Number ;
Case = SyntaxEng.Case ;
human = Masc ;
nonhuman = Neutr ;
singular = Sg ;
plural = Pl ;
nominative = Nom ;
genitive = Nom ;
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 ;
nHuman = \s -> nGen s human ;
nNonhuman = \s -> nGen s nonhuman ;
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 ;
mkN2 = \n,p -> n ** {lock_N2 = <> ; s2 = p} ;
funNonhuman = \s -> mkN2 (nNonhuman s) "of" ;
funHuman = \s -> mkN2 (nHuman s) "of" ;
pnReg n = nameReg n human ** {lock_PN = <>} ;
cnNonhuman = \s -> UseN (nGen s nonhuman) ;
cnHuman = \s -> UseN (nGen s human) ;
npReg = \s -> UsePN (pnReg s) ;
mkN2CN = \n,p -> n ** {lock_N2 = <> ; s2 = p} ;
funOfCN = \n -> mkN2CN n "of" ;
addGenN : (Str -> CommonNoun) -> Str -> Gender -> N = \f ->
\s,g -> f s ** {g = g ; lock_N = <>} ;
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) ;
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
} ;
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 = <>} ;
mkAdC a = ss a ** {lock_AdC = <>} ;
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 ;
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 ;
vPart = \go, goes, went, gone, up ->
verbPart (mkVerbP3 go goes went gone) up ** {lock_V = <>} ;
vPartReg = \get, up ->
verbPart (vGen get) up ** {lock_V = <>} ;
mkV2 = \v,p -> v ** {lock_V2 = <> ; s3 = p} ;
tvPartReg = \get, along, to -> mkV2 (vPartReg get along) to ;
vHave = verbP3Have ** {s1 = [] ; lock_V = <>} ;
tvGen = \s,p -> mkV2 (vGen s) p ;
tvDir = \v -> mkV2 v [] ;
tvGenDir = \s -> tvDir (vGen s) ;
mkV3 x y z = mkDitransVerb x y z ** {lock_V3 = <>} ;
v3Dir x y = mkV3 x [] y ;
v3DirDir x = v3Dir x [] ;
-- these are used in the generated lexicon
noun : Str -> N = nNonhuman ;
verb2 : Str -> Str -> V2 = \v -> mkV2 (vGen v) ;
verb3 : Str -> Str -> Str -> V3 = \v -> mkV3 (vGen v) ;
} ;

View File

@@ -0,0 +1,429 @@
--# -path=.:../abstract:../../prelude
--1 English Lexical Paradigms
--
-- Aarne Ranta 2003
--
-- This is an API to the user of the resource grammar
-- for adding lexical items. It gives functions for forming
-- expressions of open categories: nouns, adjectives, verbs.
--
-- Closed categories (determiners, pronouns, conjunctions) are
-- accessed through the resource syntax API, $Structural.gf$.
--
-- The main difference with $MorphoEng.gf$ is that the types
-- referred to are compiled resource grammar types. We have moreover
-- had the design principle of always having existing forms, rather
-- than stems, as string arguments of the paradigms.
--
-- The structure of functions for each word class $C$ is the following:
-- first we give a handful of patterns that aim to cover all
-- regular cases. Then we give a worst-case function $mkC$, which serves as an
-- escape to construct the most irregular words of type $C$.
-- However, this function should only seldom be needed: we have a
-- separate module $IrregularEng$, which covers all irregularly inflected
-- words.
--
-- The following modules are presupposed:
resource ParadigmsEng = open (Predef=Predef), Prelude, SyntaxEng,
CategoriesEng, RulesEng in {
--2 Parameters
--
-- To abstract over gender names, we define the following identifiers.
oper
Gender : Type ;
human : Gender ;
nonhuman : Gender ;
masculine : Gender ;
feminite : Gender ;
-- To abstract over number names, we define the following.
Number : Type ;
singular : Number ;
plural : Number ;
-- To abstract over case names, we define the following.
Case : Type ;
nominative : Case ;
genitive : Case ;
-- Prepositions are used in many-argument functions for rection.
Preposition : Type ;
--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 ;
-- In practice the worst case is just: give singular and plural nominative.
mk2N : (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:
genderN : Gender -> N -> N ;
--3 Compound nouns
--
-- All the functions above work quite as well to form compound nouns,
-- such as "baby boom".
--3 Relational nouns
--
-- Relational nouns ("daughter of x") need a preposition.
mkN2 : N -> Preposition -> N2 ;
-- The most common preposition is "of", and the following is a
-- shortcut for regular, $nonhuman$ relational nouns with "of".
regN2 : Str -> N2 ;
-- 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 -> 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 -> Preposition -> N2 ;
cnN3 : CN -> Preposition -> Preposition -> N3 ;
--
--3 Proper names and noun phrases
--
-- Proper names, with a regular genitive, are formed as follows
regPN : Str -> Gender -> PN ; -- John, John's
-- Sometimes you can reuse a common noun as a proper name, e.g. "Bank".
nounPN : N -> PN ;
-- 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
-- Non-comparison one-place adjectives need two forms: one for
-- the adjectival and one for the adverbial form ("free - freely")
mkA : (free,freely : Str) -> A ;
-- For regular adjectives, the adverbial form is derived. This holds
-- even for cases with the variation "happy - happily".
regA : Str -> A ;
--3 Two-place adjectives
--
-- Two-place adjectives need a preposition for their second argument.
mkA2 : A -> Preposition -> A2 ;
-- Comparison adjectives may two more forms.
mkADeg : (good,better,best,well : Str) -> ADeg ;
-- The regular pattern recognizes two common variations:
-- "-e" ("rude" - "ruder" - "rudest") and
-- "-y" ("happy - happier - happiest - happily")
regADeg : Str -> ADeg ; -- long, longer, longest
-- However, the duplication of the final consonant is nor predicted,
-- but a separate pattern is used:
duplADeg : Str -> ADeg ; -- fat, fatter, fattest
-- If comparison is formed by "more, "most", as in general for
-- long adjective, the following pattern is used:
compoundADeg : A -> ADeg ; -- -/more/most ridiculous
-- From a given $ADeg$, it is possible to get back to $A$.
adegA : ADeg -> A ;
--2 Adverbs
-- Adverbs are not inflected. Most lexical ones have position
-- after the verb. Some can be preverbal (e.g. "always").
mkAdv : Str -> Adv ;
mkAdV : Str -> AdV ;
-- Adverbs modifying adjectives and sentences can also be formed.
mkAdA : Str -> AdA ;
--2 Prepositions
--
-- A preposition as used for rection in the lexicon, as well as to
-- build $PP$s in the resource API, just requires a string.
mkPreposition : Str -> Preposition ;
mkPrep : Str -> Prep ;
-- (These two functions are synonyms.)
--2 Verbs
--
-- Except for "be", the worst case needs five forms: the infinitive and
-- the third person singular present, the past indicative, and the
-- past and present participles.
mkV : (go, goes, went, gone, going : Str) -> V ;
-- The regular verb function recognizes the special cases where the last
-- character is "y" ("cry - cries" but "buy - buys") or "s", "sh", "x", "z"
-- ("fix - fixes", etc).
regV : Str -> V ;
-- The following variant duplicates the last letter 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
-- duplication in the present participle.
irregV : (drink, drank, drunk : Str) -> V ;
irregDuplV : (get, got, gotten : Str) -> V ;
--3 Verbs with a particle.
--
-- The particle, such as in "switch on", is given as a string.
partV : V -> Str -> V ;
--3 Two-place verbs
--
-- 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 -> Preposition -> V2 ;
dirV2 : V -> V2 ;
--3 Three-place verbs
--
-- Three-place (ditransitive) verbs need two prepositions, of which
-- the first one or both can be absent.
mkV3 : V -> Str -> Str -> V3 ; -- speak, with, about
dirV3 : V -> Str -> V3 ; -- give,_,to
dirdirV3 : V -> V3 ; -- give,_,_
--3 Other complement patterns
--
-- Verbs and adjectives can take complements such as sentences,
-- questions, verb phrases, and adjectives.
mkV0 : V -> V0 ;
mkVS : V -> VS ;
mkV2S : V -> Str -> V2S ;
mkVV : V -> VV ;
mkV2V : V -> Str -> Str -> V2V ;
mkVA : V -> VA ;
mkV2A : V -> Str -> V2A ;
mkVQ : V -> VQ ;
mkV2Q : V -> Str -> V2Q ;
mkAS : A -> AS ;
mkA2S : A -> Str -> A2S ;
mkAV : A -> AV ;
mkA2V : A -> Str -> A2V ;
--2 Definitions of paradigms
--
-- The definitions should not bother the user of the API. So they are
-- hidden from the document.
--.
Gender = SyntaxEng.Gender ;
Number = SyntaxEng.Number ;
Case = SyntaxEng.Case ;
human = Masc ;
nonhuman = Neutr ;
masculine = Masc ;
feminine = Fem ;
singular = Sg ;
plural = Pl ;
nominative = Nom ;
genitive = Gen ;
Preposition = Str ;
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
mk2N ray rays ;
mk2N = \man,men ->
let mens = case last men of {
"s" => men + "'" ;
_ => men + "'s"
}
in
mkN man men (man + "'s") mens ;
mkN = \man,men,man's,men's ->
mkNoun man men man's men's ** {g = Neutr ; lock_N = <>} ;
genderN g man = {s = man.s ; g = g ; lock_N = <>} ;
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} ;
regPN n g = nameReg n g ** {lock_PN = <>} ;
nounPN n = {s = n.s ! singular ; g = n.g ; lock_PN = <>} ;
mkNP x y n g = {s = table {GenP => x ; _ => y} ; a = toAgr n P3 g ;
lock_NP = <>} ;
mkA a b = mkAdjective a b ** {lock_A = <>} ;
regA a = regAdjective a ** {lock_A = <>} ;
mkA2 a p = a ** {s2 = p ; lock_A2 = <>} ;
mkADeg a b c d = mkAdjDegrWorst a b c c d d ** {lock_ADeg = <>} ;
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") ;
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 = <>} ;
mkAdv x = ss x ** {lock_Adv = <>} ;
mkAdV x = ss x ** {lock_AdV = <>} ;
mkAdA x = ss x ** {lock_AdA = <>} ;
mkPreposition p = p ;
mkPrep p = ss p ** {lock_Prep = <>} ;
mkV a b c d e = mkVerbP3worst a b c d e ** {s1 = [] ; lock_V = <>} ;
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" => case last cr of {
"e" => cry + "ing" ;
_ => cr + "ing"
} ;
_ => cry + "ing"
}
in mkV cry cries cried cried crying ;
regDuplV fit =
let fitt = fit + last fit in
mkV fit (fit + "s") (fitt + "ed") (fitt + "ed") (fitt + "ing") ;
irregV x y z = let reg = (regV x).s in
mkV x (reg ! Indic Sg) y z (reg ! PresPart) ** {s1 = [] ; lock_V = <>} ;
irregDuplV fit y z =
let
fitting = (regDuplV fit).s ! PresPart
in
mkV fit (fit + "s") y z fitting ;
partV v p = {s = v.s ; s1 = p ; lock_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 [] ;
mkV0 v = v ** {lock_V0 = <>} ;
mkVS v = v ** {lock_VS = <>} ;
mkV2S v p = mkV2 v p ** {lock_V2S = <>} ;
mkVV v = verb2aux v ** {isAux = False ; lock_VV = <>} ;
mkV2V v p t = mkV2 v p ** {s4 = t ; lock_V2V = <>} ;
mkVA v = v ** {lock_VA = <>} ;
mkV2A v p = mkV2 v p ** {lock_V2A = <>} ;
mkVQ v = v ** {lock_VQ = <>} ;
mkV2Q v p = mkV2 v p ** {lock_V2Q = <>} ;
mkAS v = v ** {lock_AS = <>} ;
mkA2S v p = mkA2 v p ** {lock_A2S = <>} ;
mkAV v = v ** {lock_AV = <>} ;
mkA2V v p = mkA2 v p ** {lock_A2V = <>} ;
} ;

View File

@@ -0,0 +1,67 @@
--# -path=.:../abstract:../../prelude
--# -opt
concrete PredicEng of Predic = CategoriesEng **
open Prelude, SyntaxEng, DeptypEng in {
flags optimize=all_subs ;
lincat
VType, CType = SS ;
Verb = {s : VForm => Str ; isAux : Bool ; s1 : Particle ; c : VComp} ;
Compl = {s1, s2 : Agr => Str} ;
lin
CtN, CtV, CtS, CtQ, CtA = ss [] ;
Vt, VtN = \x -> x ;
Vt_ = ss [] ;
Compl_ = {s1, s2 = \\_ => []} ;
ComplN np = {s1 = \\_ => np.s ! AccP ; s2 = \\_ => []} ;
ComplA ap = {s1 = ap.s ; s2 = \\_ => []} ;
ComplQ q = {s1 = \\_ => q.s ! DirQ ; s2 = \\_ => []} ;
ComplS s = {s1 = \\_ => "that" ++ s.s ; s2 = \\_ => []} ;
ComplAdd c np co = {s1 = \\_ => c.s ++ np.s ! AccP ; s2 = co.s1} ;
SPredVerb vt np verb compl =
predVerbClause np verb
(\\a => vt.s ++
cprep1 verb.c (compl.s1 ! a) ++
cprep2 verb.c (compl.s2 ! a)
) ;
QPredVerb vt np verb compl =
intVerbClause np verb
(\\a => vt.s ++
cprep1 verb.c (compl.s1 ! a) ++
cprep2 verb.c (compl.s2 ! a)
) ;
RPredVerb vt np verb compl =
relVerbClause np verb
(\\a => vt.s ++
cprep1 verb.c (compl.s1 ! a) ++
cprep2 verb.c (compl.s2 ! a)
) ;
IPredVerb vt verb compl =
predVerbI verb
(\\a => vt.s ++
cprep1 verb.c (compl.s1 ! a) ++
cprep2 verb.c (compl.s2 ! a)
) ;
VeV1 v = v ** {isAux = False ; c = CVt_} ;
VeV2 v = v ** {isAux = False ; c = CVt (CCtN CP_)} ; ---- other preps
{-
Walk = {s = "walks" ; c = VC_} ;
Love = {s = "loves" ; c = VC1 C_} ;
Know = {s = "knows" ; c = VC_} ;
Give = {s = "gives" ; c = VC2 C_ C_to} ;
Tell = {s = "tells" ; c = VC_} ;
Ask = {s = "asks" ; c = VC_} ;
-}
}

View File

@@ -0,0 +1,4 @@
--# -path=.:../abstract:../../prelude
concrete ResourceEng of Resource = RulesEng, ClauseEng, StructuralEng ** {} ;
---- concrete ResourceEng of Resource = RulesEng, VerbphraseEng ** {} ;

View File

@@ -0,0 +1,207 @@
--# -path=.:../abstract:../../prelude
--1 The Top-Level English Resource Grammar: Combination Rules
--
-- Aarne Ranta 2002 -- 2003
--
-- This is the English concrete syntax of the multilingual resource
-- grammar. Most of the work is done in the file $syntax.Eng.gf$.
-- However, for the purpose of documentation, we make here explicit the
-- linearization types of each category, so that their structures and
-- dependencies can be seen.
-- Another substantial part are the linearization rules of some
-- structural words.
--
-- The users of the resource grammar should not look at this file for the
-- linearization rules, which are in fact hidden in the document version.
-- They should use $resource.Abs.gf$ to access the syntactic rules.
-- This file can be consulted in those, hopefully rare, occasions in which
-- one has to know how the syntactic categories are
-- implemented. The parameter types are defined in $TypesEng.gf$.
concrete RulesEng of Rules = CategoriesEng ** open Prelude, SyntaxEng in {
flags
optimize=all_subs ;
lin
UseN = noun2CommNounPhrase ;
UsePN = nameNounPhrase ;
IndefOneNP = indefNounPhrase singular ;
IndefNumNP = indefNounPhraseNum plural ;
DefOneNP = defNounPhrase singular ;
DefNumNP = defNounPhraseNum plural ;
DetNP = detNounPhrase ;
NDetNP = numDetNounPhrase ;
NDetNum = justNumDetNounPhrase ;
MassNP = detNounPhrase (mkDeterminer Sg []) ;
AppN2 = appFunComm ;
AppN3 = appFun2 ;
UseN2 = funAsCommNounPhrase ;
ModAP = modCommNounPhrase ;
CNthatS = nounThatSentence ;
ModGenOne = npGenDet singular noNum ;
ModGenNum = npGenDet plural ;
UseInt i = {s = table {Nom => i.s ; Gen => i.s ++ "s"} ; n = Pl} ; ---
NoNum = noNum ;
UseA = adj2adjPhrase ;
ComplA2 = complAdj ;
ComplAV v x = complVerbAdj v x ;
ComplObjA2V v x y = complVerbAdj2 True v x y ;
PositADeg = positAdjPhrase ;
ComparADeg = comparAdjPhrase ;
SuperlADeg = superlAdjPhrase ;
-- verbs and verb prases
PredAS = predAdjSent ;
PredV0 rain = predVerbClause (pronNounPhrase pronIt) rain (complVerb rain) ;
-- Partial saturation.
UseV2 = transAsVerb ;
ComplA2S = predAdjSent2 ;
AdjPart = adjPastPart ;
UseV2V x = verb2aux x ** {isAux = False} ;
UseV2S x = x ;
UseV2Q x = x ;
UseA2S x = x ;
UseA2V x = x ;
UseCl tp cl = {s = tp.s ++ cl.s ! Dir ! tp.b ! VFinite tp.t tp.a} ;
UseQCl tp cl = {s = \\q => tp.s ++ cl.s ! tp.b ! VFinite tp.t tp.a ! q} ;
UseRCl tp cl = {s = \\a => tp.s ++ cl.s ! <tp.b, VFinite tp.t tp.a, a>} ;
UseVCl p a cl = {
s = \\v,ag => p.s ++ a.s ++ cl.s ! p.p ! a.a ! v ! ag ;
s1 = cl.s1 ! p.p
} ;
PosTP t a = {s = t.s ++ a.s ; b = True ; t = t.t ; a = a.a} ;
NegTP t a = {s = t.s ++ a.s ; b = False ; t = t.t ; a = a.a} ;
TPresent = {s = [] ; t = Present} ;
TPast = {s = [] ; t = Past} ;
TFuture = {s = [] ; t = Future} ;
TConditional = {s = [] ; t = Conditional} ;
ASimul = {s = [] ; a = Simul} ;
AAnter = {s = [] ; a = Anter} ;
PPos = {s = [] ; p = True} ;
PNeg = {s = [] ; p = False} ;
-- Adverbs.
AdjAdv a = ss (a.s ! AAdv) ;
AdvPP p = p ;
PrepNP p = prepPhrase p.s ; ---
AdvCN = advCommNounPhrase ;
AdvAP = advAdjPhrase ;
AdvAdv = cc2 ;
AdvNP pn pp = {s = \\c => pn.s ! c ++ pp.s ; a = pn.a} ;
--3 Sentences and relative clauses
--
SlashV2 = slashTransVerbCl ;
SlashVV2 = slashVerbVerb ;
SlashAdv cl p = slashAdverb cl p.s ;
IdRP = identRelPron ;
FunRP = funRelPron ;
RelSlash = relSlash ;
ModRS = modRelClause ;
RelCl = relSuch ;
--!
--3 Questions and imperatives
--
IDetCN d n = nounPhraseInt (detNounPhrase d n) ;
FunIP = funIntPron ;
QuestCl = questClause ;
IntSlash = intSlash ;
QuestAdv = questAdverbial ;
PosImpVP = imperVerbPhrase True ;
NegImpVP = imperVerbPhrase False ;
IndicPhrase = indicUtt ;
QuestPhrase = interrogUtt ;
ImperOne = imperUtterance singular ;
ImperMany = imperUtterance plural ;
AdvCl = advClause ;
AdvVPI = advVerbPhrase ;
AdCPhr = advSentence ;
AdvPhr = advSentence ;
--!
--3 Coordination
--
TwoS = twoSentence ;
ConsS = consSentence ;
ConjS = conjunctSentence ;
ConjDS = conjunctDistrSentence ;
TwoAP = twoAdjPhrase ;
ConsAP = consAdjPhrase ;
ConjAP = conjunctAdjPhrase ;
ConjDAP = conjunctDistrAdjPhrase ;
TwoNP = twoNounPhrase ;
ConsNP = consNounPhrase ;
ConjNP = conjunctNounPhrase ;
ConjDNP = conjunctDistrNounPhrase ;
TwoAdv = twoSentence ;
ConsAdv = consSentence ;
ConjAdv = conjunctSentence ;
ConjDAdv = conjunctDistrSentence ;
SubjS = subjunctSentence ;
SubjImper = subjunctImperative ;
SubjQS = subjunctQuestion ;
AdvSubj if A = ss (if.s ++ A.s) ;
PhrNP = useNounPhrase ;
PhrOneCN = useCommonNounPhrase singular ;
PhrManyCN = useCommonNounPhrase plural ;
PhrIP ip = ip ;
PhrIAdv ia = ia ;
PhrVPI = verbUtterance ;
OnePhr p = p ;
ConsPhr = cc2 ;
-----------------------
-- special constructions
OneNP = nameNounPhrase (nameReg "one" human) ;
ExistCN A = predBeGroup
(nameNounPhrase (nameReg "there" Neutr))
(complNounPhrase (indefNounPhrase singular A)) ;
ExistNumCN nu A =
predBeGroup
(nameNounPhrasePl (nameReg "there" Neutr))
(complNounPhrase (indefNounPhraseNum plural nu A)) ;
} ;

View File

@@ -0,0 +1,8 @@
--# -path=.:../abstract:../../prelude
concrete SimpleEng of Simple = CategoriesEng ** SimpleI with
(Categories = CategoriesEng),
(Rules = RulesEng),
(Structural = StructuralEng),
(Verbphrase = VerbphraseEng)
;

View File

@@ -0,0 +1,21 @@
--# -path=.:../abstract:../../prelude
concrete SimpleLangEng of SimpleLang =
SimpleEng,
StructuralEng,
BasicEng,
TimeEng,
CountryEng
** open Prelude, ParadigmsEng in {
lin
AdvDate d = prefixSS "on" d ;
AdvTime t = prefixSS "at" t ;
NWeekday w = w ;
PNWeekday w = nounPN w ;
PNCountry x = x ;
ANationality x = x ;
NLanguage x = x ;
}

View File

@@ -0,0 +1,101 @@
--# -path=.:../abstract:../../prelude
--1 The Top-Level English Resource Grammar: Structural Words
--
-- Aarne Ranta 2002 -- 2003
--
concrete StructuralEng of Structural =
CategoriesEng, NumeralsEng ** open Prelude, SyntaxEng in {
flags optimize=all ;
lin
UseNumeral i = {
s = table {Nom => i.s ! NCard ; Gen => i.s ! NCard ++ "'s"} ; n = i.n} ; ---
above_Prep = ss "above" ;
after_Prep = ss "after" ;
all8mass_Det = mkDeterminer Sg "all" ; --- all the missing
all_NDet = mkDeterminerNum "all" ;
almost_Adv = ss "almost" ;
although_Subj = ss "although" ;
and_Conj = ss "and" ** {n = Pl} ;
because_Subj = ss "because" ;
before_Prep = ss "before" ;
behind_Prep = ss "behind" ;
between_Prep = ss "between" ;
both_AndConjD = sd2 "both" "and" ** {n = Pl} ;
by8agent_Prep = ss "by" ;
by8means_Prep = ss "by" ;
can8know_VV = vvCan ;
can_VV = vvCan ;
during_Prep = ss "during" ;
either8or_ConjD = sd2 "either" "or" ** {n = Sg} ;
everybody_NP = nameNounPhrase (nameReg "everybody" human) ;
every_Det = everyDet ;
everything_NP = nameNounPhrase (nameReg "everything" Neutr) ;
everywhere_Adv = ss "everywhere" ;
from_Prep = ss "from" ;
he_NP = pronNounPhrase pronHe ;
how_IAdv = ss "how" ;
how8many_IDet = mkDeterminer Pl ["how many"] ;
if_Subj = ss "if" ;
in8front_Prep = ss ["in front of"] ;
i_NP = pronNounPhrase pronI ;
in_Prep = ss "in" ;
it_NP = pronNounPhrase pronIt ;
many_Det = mkDeterminer Pl "many" ;
most_Det = mkDeterminer Sg "most" ;
most8many_Det = mostDet ;
much_Det = mkDeterminer Sg ["a lot of"] ; ---
must_VV = vvMust ;
no_Phr = ss "No." ;
on_Prep = ss "on" ;
or_Conj = ss "or" ** {n = Sg} ;
otherwise_Adv = ss "otherwise" ;
part_Prep = ss "of" ;
possess_Prep = ss "of" ;
quite_Adv = ss "quite" ;
she_NP = pronNounPhrase pronShe ;
so_Adv = ss "so" ;
somebody_NP = nameNounPhrase (nameReg "somebody" human) ;
some_Det = mkDeterminer Sg "some" ;
some_NDet = mkDeterminerNum "some" ;
something_NP = nameNounPhrase (nameReg "something" Neutr) ;
somewhere_Adv = ss "somewhere" ;
that_Det = mkDeterminer Sg "that" ;
that_NP = nameNounPhrase (nameReg "that" Neutr) ;
therefore_Adv = ss "therefore" ;
these_NDet = mkDeterminerNum "these" ;
they8fem_NP = pronNounPhrase pronThey ;
they_NP = pronNounPhrase pronThey ;
this_Det = mkDeterminer Sg "this" ;
this_NP = nameNounPhrase (nameReg "this" Neutr) ;
those_NDet = mkDeterminerNum "those" ;
thou_NP = pronNounPhrase pronYouSg ;
through_Prep = ss "through" ;
too_Adv = ss "too" ;
to_Prep = ss "to" ;
under_Prep = ss "under" ;
very_Adv = ss "very" ;
want_VV = verb2aux (verbNoPart (regVerbP3 "want")) ** {isAux = False} ;
we_NP = pronNounPhrase pronWe ;
what8many_IP = intPronWhat plural ;
what8one_IP = intPronWhat singular ;
when_IAdv = ss "when" ;
when_Subj = ss "when" ;
where_IAdv = ss "where" ;
which8many_IDet = mkDeterminer Pl ["which"] ;
which8one_IDet = mkDeterminer Sg ["which"] ;
who8many_IP = intPronWho plural ;
who8one_IP = intPronWho singular ;
why_IAdv = ss "why" ;
without_Prep = ss "without" ;
with_Prep = ss "with" ;
ye_NP = pronNounPhrase pronYouPl ;
you_NP = pronNounPhrase pronYouSg ;
yes_Phr = ss "Yes." ;
}

View File

@@ -0,0 +1,247 @@
--# -path=.:../abstract:../../prelude
concrete SwadeshLexEng of SwadeshLex = CategoriesEng
** open ResourceEng, SyntaxEng, ParadigmsEng, VerbsEng,
BasicEng, Prelude in {
lin
-- Pronouns
i_NP = i_NP ;
thou_NP = thou_NP ;
he_NP = he_NP ;
we_NP = we_NP ;
you_NP = you_NP ;
they_NP = they_NP ;
who8many_IP = who8many_IP ;
who8one_IP = who8one_IP ;
what8many_IP = what8many_IP ;
what8one_IP = what8one_IP ;
-- Determiners
this_Det = this_Det ;
that_Det = that_Det ;
all_NDet = all_NDet ;
many_Det = many_Det ;
some_Det = some_Det ;
few_Det = mkDeterminer Pl "few" ;
other_Det = mkDeterminer Pl "other" ;
-- Adverbs
here_Adv = here_Adv;
there_Adv = there_Adv;
where_IAdv = where_IAdv;
when_IAdv = when_IAdv;
how_IAdv = how_IAdv;
-- not : Adv ; -- ?
-- Conjunctions
and_Conj = and_Conj ;
-- Prepositions
at_Prep = ss "at" ;
in_Prep = ss "in" ;
with_Prep = ss "with" ;
-- Numerals
one_Num = UseNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01)))) ;
two_Num = UseNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2))))) ;
three_Num = UseNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3))))) ;
four_Num = UseNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n4))))) ;
five_Num = UseNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n5))))) ;
-- Adjectives
bad_ADeg = bad_ADeg ;
big_ADeg = big_ADeg ;
black_ADeg = black_ADeg ;
cold_ADeg = cold_ADeg ;
correct_ADeg = compoundADeg (regA "correct") ;
dirty_ADeg = dirty_ADeg ;
dry_ADeg = regADeg "dry" ;
dull_ADeg = regADeg "dull" ;
far_ADeg = mkADeg "far" (variants { "further"; "farther" })
(variants { "furthest"; "farthest" }) "far" ;
full_ADeg = regADeg "full" ;
good_ADeg = good_ADeg ;
green_ADeg = green_ADeg ;
heavy_ADeg = regADeg "heavy" ;
long_ADeg = long_ADeg ;
narrow_ADeg = narrow_ADeg ;
near_ADeg = regADeg "near" ;
new_ADeg = new_ADeg ;
old_ADeg = old_ADeg ;
red_ADeg = red_ADeg ;
rotten_ADeg = compoundADeg (regA "rotten") ;
round_ADeg = regADeg "round" ;
sharp_ADeg = regADeg "sharp" ;
short_ADeg = short_ADeg ;
small_ADeg = small_ADeg ;
smooth_ADeg = regADeg "smooth" ;
straight_ADeg = regADeg "straight" ;
thick_ADeg = thick_ADeg ;
thin_ADeg = thin_ADeg ;
warm_ADeg = warm_ADeg ;
wet_ADeg = duplADeg "wet" ;
white_ADeg = white_ADeg ;
wide_ADeg = regADeg "wide" ;
yellow_ADeg = yellow_ADeg ;
left_A = regA "left" ;
right_A = regA "right" ;
-- Nouns
animal_N = regN "animal" ;
ashes_N = regN "ash" ; -- FIXME: plural only?
back_N = regN "back" ;
bark_N = regN "bark" ;
belly_N = regN "belly" ;
bird_N = bird_N;
blood_N = regN "blood" ;
bone_N = regN "bone" ;
breast_N = regN "breast" ;
child_N = child_N ;
cloud_N = regN "cloud" ;
day_N = regN "day" ;
dog_N = dog_N ;
dust_N = regN "dust" ;
ear_N = regN "ear" ;
earth_N = regN "earth" ;
egg_N = regN "egg" ;
eye_N = regN "eye" ;
fat_N = regN "fat" ;
father_N = UseN2 father_N2 ;
feather_N = regN "feather" ;
fingernail_N = regN "fingernail" ;
fire_N = regN "fire" ;
fish_N = fish_N ;
flower_N = regN "flower" ;
fog_N = regN "fog" ;
foot_N = mk2N "foot" "feet" ;
forest_N = regN "forest" ;
fruit_N = fruit_N ;
grass_N = regN "grass" ;
guts_N = regN "gut" ; -- FIXME: no singular
hair_N = regN "hair" ;
hand_N = regN "hand" ;
head_N = regN "head" ;
heart_N = regN "heart" ;
horn_N = regN "horn" ;
husband_N = genderN masculine (regN "husband") ;
ice_N = regN "ice" ;
knee_N = regN "knee" ;
lake_N = lake_N ;
leaf_N = mk2N "leaf" "leaves" ;
leg_N = regN "leg" ;
liver_N = regN "liver" ;
louse_N = mk2N "louse" "lice" ;
man_N = man_N ;
meat_N = meat_N ;
moon_N = moon_N ;
mother_N = UseN2 mother_N2 ;
mountain_N = mountain_N ;
mouth_N = regN "mouth" ;
name_N = regN "name" ;
neck_N = regN "neck" ;
night_N = regN "night" ;
nose_N = regN "nose" ;
person_N = genderN human (regN "person") ;
rain_N = regN "rain" ;
river_N = river_N ;
road_N = regN "road" ;
root_N = regN "root" ;
rope_N = regN "rope" ;
salt_N = regN "salt" ;
sand_N = regN "sand" ;
sea_N = sea_N ;
seed_N = regN "seed" ;
skin_N = regN "skin" ;
sky_N = regN "sky" ;
smoke_N = regN "smoke" ;
snake_N = snake_N ;
snow_N = regN "snow" ;
star_N = star_N ;
stick_N = regN "stick" ;
stone_N = stone_N ;
sun_N = sun_N ;
tail_N = regN "tail" ;
tongue_N = regN "tongue" ;
tooth_N = mk2N "tooth" "teeth" ;
tree_N = tree_N ;
water_N = water_N ;
wife_N = genderN feminine (mk2N "wife" "wives") ;
wind_N = regN "wind" ;
wing_N = regN "wing" ;
woman_N = woman_N ;
worm_N = regN "worm" ;
year_N = regN "year" ;
-- Verbs
bite_V = bite_V ;
blow_V = blow_V ;
breathe_V = regV "breathe" ;
burn_V = burn_V ;
come_V = come_V ;
count_V = regV "count" ;
cut_V = cut_V ;
die_V = die_V ;
dig_V = dig_V ;
drink_V = drink_V ;
eat_V = eat_V ;
fall_V = fall_V ;
fear_V = regV "fear" ;
fight_V = fight_V ;
float_V = regV "float" ;
flow_V = regV "flow" ;
fly_V = fly_V ;
freeze_V = freeze_V ;
give_V = give_V ;
hear_V = hear_V ;
hit_V = hit_V ;
hold_V = hold_V ;
hunt_V = regV "hunt" ;
kill_V = regV "kill" ;
know_V = know_V ;
laugh_V = regV "laugh" ;
lie_V = lie_V ;
live_V = live_V ;
play_V = UseV2 play_V2 ;
pull_V = regV "pull" ;
push_V = regV "push" ;
rub_V = regDuplV "rub" ;
say_V = say_V ;
scratch_V = regV "scratch" ;
see_V = see_V ;
sew_V = sew_V ;
sing_V = sing_V ;
sit_V = sit_V ;
sleep_V = sleep_V ;
smell_V = regV "smell" ;
spit_V = spit_V ;
split_V = split_V ;
squeeze_V = regV "squeeze" ;
stab_V = regDuplV "stab" ;
stand_V = stand_V ;
suck_V = regV "suck" ;
swell_V = swell_V ;
swim_V = swim_V ;
think_V = think_V ;
throw_V = throw_V ;
tie_V = regV "tie" ;
turn_V = regV "turn" ;
vomit_V = regV "vomit" ;
walk_V = walk_V ;
wash_V = regV "wash" ;
wipe_V = regV "wipe" ;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,31 @@
concrete TimeEng of Time = NumeralsEng **
open Prelude, CategoriesEng, ParadigmsEng, MorphoEng in {
lincat
Date = SS ;
Weekday = N ;
Hour = SS ;
Minute = SS ;
Time = SS ;
lin
DayDate day = ss (day.s ! singular ! nominative) ;
DayTimeDate day time = ss (day.s ! singular ! nominative ++ "at" ++ time.s) ;
FormalTime = infixSS ["hundred and"] ;
PastTime h m = ss (m.s ++ "past" ++ h.s) ;
ToTime h m = ss (m.s ++ "to" ++ h.s) ;
ExactTime h = ss (h.s ++ "sharp") ;
NumHour n = {s = n.s ! NCard} ;
NumMinute n = {s = n.s ! NCard} ;
monday = regN "Monday" ;
tuesday = regN "Tuesday" ;
wednesday = regN "Wednesday" ;
thursday = regN "Thursday" ;
friday = regN "Friday" ;
saturday = regN "Saturday" ;
sunday = regN "Sunday" ;
} ;

Some files were not shown because too many files have changed in this diff Show More