forked from GitHub/gf-core
preserve 1.0
This commit is contained in:
@@ -1,340 +0,0 @@
|
||||
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.
|
||||
@@ -1,89 +0,0 @@
|
||||
GF=gf
|
||||
RTS=+RTS -M800M -K100M
|
||||
RTSS=+RTS -M1000M -K100M
|
||||
GFCA=$(GF) -nocf
|
||||
GFCC=$(GF) -nocf -make
|
||||
GFC=$(GFCC) -src
|
||||
GFCP=$(GFC) -preproc=./mkPresent
|
||||
|
||||
|
||||
.PHONY: show-path all test alltenses pretest langs present mathematical multimodal compiled treebank stat gfdoc clean
|
||||
|
||||
all: show-path present alltenses langs multimodal mathematical compiled
|
||||
|
||||
show-path:
|
||||
@echo GF_LIB_PATH=$(GF_LIB_PATH)
|
||||
|
||||
test:
|
||||
echo "gr -cat=Text -number=11 -prob | tb" | $(GF) -nocf -probs=lang.gfprob langs.gfcm
|
||||
|
||||
pretest:
|
||||
echo "gr -cat=Cl -number=11 -prob | tb" | $(GF) -probs=lang.gfprob -path=present:prelude -nocf ../present/Lang???.gfc
|
||||
|
||||
alltenses:
|
||||
# $(GFC) arabic/LangAra.gf
|
||||
$(GFC) danish/Danish.gf
|
||||
$(GFC) english/English.gf
|
||||
$(GFC) finnish/Finnish.gf
|
||||
$(GFC) french/French.gf
|
||||
$(GFC) german/German.gf
|
||||
$(GFC) italian/Italian.gf
|
||||
$(GFC) norwegian/Norwegian.gf
|
||||
$(GFC) russian/Russian.gf
|
||||
$(GFC) spanish/Spanish.gf
|
||||
$(GFC) swedish/Swedish.gf
|
||||
cp -p */*.gfc */*.gfr ../alltenses
|
||||
|
||||
langs:
|
||||
echo "s ;; pm | wf langs.gfcm" | $(GFCA) -path=alltenses:prelude ../alltenses/Lang???.gfc $(RTSS)
|
||||
|
||||
|
||||
present:
|
||||
# $(GFCP) arabic/LangAra.gf
|
||||
$(GFCP) danish/Danish.gf
|
||||
$(GFCP) english/English.gf
|
||||
$(GFCP) finnish/Finnish.gf
|
||||
$(GFCP) french/French.gf
|
||||
$(GFCP) german/German.gf
|
||||
$(GFCP) italian/Italian.gf
|
||||
$(GFCP) norwegian/Norwegian.gf
|
||||
$(GFCP) russian/LangRus.gf
|
||||
$(GFCP) spanish/Spanish.gf
|
||||
$(GFCP) swedish/Swedish.gf
|
||||
mv */*.gfc */*.gfr ../present
|
||||
|
||||
mathematical:
|
||||
$(GF) -make -nocf -preproc=./mkPresent mathematical/Mathematical???.gf
|
||||
mv mathematical/*.gfc ../mathematical
|
||||
|
||||
multimodal:
|
||||
$(GF) -make -nocf multimodal/Multi???.gf
|
||||
mv multimodal/*.gfc ../multimodal
|
||||
|
||||
compiled:
|
||||
cd .. ; tar cvfz compiled.tgz alltenses/ mathematical/ multimodal/ present/ prelude/*.gf?
|
||||
|
||||
treebank:
|
||||
gf <mkTreebank.gfs
|
||||
|
||||
stat:
|
||||
wc */*.gfc
|
||||
|
||||
gfdoc:
|
||||
gfdoc -txthtml abstract/*.gf
|
||||
gfdoc -txthtml */Paradigms*.gf
|
||||
gfdoc -txthtml mathematical/Mathematical.gf
|
||||
gfdoc -txthtml mathematical/Symbol.gf
|
||||
gfdoc -txthtml mathematical/Predication.gf
|
||||
gfdoc -txthtml multimodal/Multi.gf
|
||||
gfdoc -txthtml ../prelude/*.gf
|
||||
mv abstract/*.html doc/gfdoc
|
||||
mv mathematical/*.html doc/gfdoc
|
||||
mv multimodal/*.html doc/gfdoc
|
||||
mv */Paradigms*.html doc/gfdoc
|
||||
cp */Irreg???.gf doc/gfdoc
|
||||
mv ../prelude/*.html doc/gfdoc
|
||||
|
||||
clean:
|
||||
-rm */*.gfc */*.gfr */*.gf~
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
LICENSE: This library is free software licensed under GNU General
|
||||
Public License (GPL), see LICENSE.
|
||||
|
||||
Author (c) Aarne Ranta 2005-2006.
|
||||
|
||||
-- file GF/lib/resource-1.0/README
|
||||
-- created Thu Dec 1 22:21:21 CET 2005
|
||||
-- by A. Ranta, aarne@cs.chalmers.se
|
||||
|
||||
This is a working directory for the next version of GF resource
|
||||
grammar library, incomplete in many ways but aimed to become the
|
||||
first "mature" release. The old releases (resource-0.6 and resource)
|
||||
will be kept available, but 'resource' will be renamed 'resource-0.9',
|
||||
and 'resource' will probably be made into a symbolic link to the
|
||||
current version.
|
||||
|
||||
To compile:
|
||||
|
||||
make
|
||||
|
||||
For translation from Eng to all others, try e.g.
|
||||
|
||||
gf -nocf langs.gfcm
|
||||
> p -cat=Phr -fcfg "I haven't seen her" | l -multi
|
||||
|
||||
To link to the library, use the precompiled packages
|
||||
|
||||
- ``lib/alltenses`` the complete ground-API library with all forms
|
||||
- ``lib/present`` a pruned ground-API library with present tense only
|
||||
- ``lib/mathematical`` special-purpose API for mathematical applications
|
||||
- ``lib/multimodal`` special-purpose API for multimodal dialogue applications
|
||||
|
||||
The main changes from 0.9 to 1.0 are
|
||||
|
||||
1. Refactoring of module structure: there are many more modules now.
|
||||
However, the full API is still available as LangX.
|
||||
|
||||
2. Increased coverage. We have used the second CLE book ("Spoken
|
||||
Language Translation", by M. Rayner, D. Carter, P. Bouillon
|
||||
V. Digalakis, and M. Wirén, Cambridge UP, 2000) as guideline and
|
||||
goal.
|
||||
|
||||
3. Some constructions have been dropped out or modified. This concerns
|
||||
in particular the determiner structure in the module Noun. Also the
|
||||
number of verb subcategorization patterns is lower: predication can
|
||||
be done by adding adverbs instead. Also the division between A and ADeg
|
||||
is eliminated.
|
||||
|
||||
4. The implementation is more direct; there is no "SyntaxX" variant of
|
||||
each rule as in 0.9. The ease to find definitions and change them
|
||||
weighs many times more than the abstraction attained by indirection,
|
||||
in this case. Also compilation time and amount of generated code (gfr)
|
||||
decreases quite a bit.
|
||||
|
||||
5. The result is a lighter and more efficient resource library, just
|
||||
because of lessons learned from earlier implementations.
|
||||
Compared to 0.9, compilation times and gfc sizes have dropped by
|
||||
50% up to 70%.
|
||||
|
||||
Version 0.9 is hereby "frozen" to its current state, which means that
|
||||
extensions and bug fixes are not carried over to it. However, if
|
||||
requested, we might provide a reimplementation of the old API using
|
||||
the new.
|
||||
|
||||
When will it be ready? Today (25 February 2006) the implementation
|
||||
is complete for 8 languages (which excludes Danish and Russian).
|
||||
A number of bugs wait to be fixes, and a SourceForge release will
|
||||
be made some time in March.
|
||||
|
||||
BUT WE ALREADY RECOMMEND USING 1.0 INSTEAD OF THE OLDER VERSIONS.
|
||||
Notice that GF v.
|
||||
|
||||
---------- later history and status:
|
||||
|
||||
16/6 Close to complete, with 10 languages and a substantial part of
|
||||
Arabic.
|
||||
|
||||
25/2 Added directories for precompiled libraries directly under lib.
|
||||
See doc/index.html for more information.
|
||||
|
||||
21/2 Added modules Text and Idiom. Many bugs fixed, see TODO.
|
||||
|
||||
7/2 Finnish added.
|
||||
|
||||
3/2 Spanish added, except ordinal numerals. Much remains to do in Spa & Ita clitics.
|
||||
|
||||
1/2 Italian added.
|
||||
|
||||
26/1 Norwegian added.
|
||||
|
||||
24/1 French complete, as well as the Romance parametrized modules.
|
||||
|
||||
20/1 Main difficulties of French and Romance implemented. Also
|
||||
ParadigmsFre and fragments of LangFre.
|
||||
|
||||
17/1 All of English, Swedish, and German implemented. Some known bugs
|
||||
remain, also some ToDo API functions.
|
||||
|
||||
13/1/2006 All of English, most of Scandinavian/Swedish, and TestGer
|
||||
have now been implemented. Most abstract/ modules have been documented
|
||||
using gfdoc.
|
||||
@@ -1,47 +0,0 @@
|
||||
TODO in Resource 1.0 implementation
|
||||
|
||||
6/2/2006
|
||||
|
||||
%Eng: non-contracted negations
|
||||
|
||||
%Eng: auxiliaries in standard API
|
||||
|
||||
%API: idiomatic expressions: ExistNP, ProgressiveVP, ImpersonalVP
|
||||
|
||||
%Spa: clitic order and changes
|
||||
|
||||
%Ita: clitic order and changes
|
||||
|
||||
%Ita: infinitive contractions
|
||||
|
||||
%Ita: articles in possessives
|
||||
|
||||
%Ger: constituents of infinitive VP
|
||||
|
||||
%Spa: ordinal numbers
|
||||
|
||||
%Nor: Ext: possessives
|
||||
|
||||
%Spa: zero subjects
|
||||
|
||||
%Ita: zero subjects
|
||||
|
||||
Fin: zero subjects
|
||||
|
||||
%Spa: verb constructors in Paradigms or list of irregular verbs
|
||||
|
||||
%Ita: verb constructors in Paradigms
|
||||
|
||||
API: mathematical/: math-specific lexicon
|
||||
|
||||
API: multimodal/: dialogue-specific lexicon
|
||||
|
||||
%API: swadesh/: build a swadesh-related API and migrate lexica
|
||||
|
||||
%API: mathematical/: symbolic formulas as Cl
|
||||
|
||||
%API: text construction
|
||||
|
||||
%All: punctuation
|
||||
|
||||
%API: apposition, e.g. Det -> CN -> [PN] -> NP
|
||||
@@ -1,30 +0,0 @@
|
||||
--1 Adjective: Adjectives and Adjectival Phrases
|
||||
|
||||
abstract Adjective = Cat ** {
|
||||
|
||||
fun
|
||||
|
||||
-- The principal ways of forming an adjectival phrase are
|
||||
-- positive, comparative, relational, reflexive-relational, and
|
||||
-- elliptic-relational.
|
||||
-- (The superlative use is covered in [Noun Noun.html].$SuperlA$.)
|
||||
|
||||
PositA : A -> AP ; -- warm
|
||||
ComparA : A -> NP -> AP ; -- warmer than Spain
|
||||
ComplA2 : A2 -> NP -> AP ; -- divisible by 2
|
||||
ReflA2 : A2 -> AP ; -- divisible by itself
|
||||
UseA2 : A2 -> A ; -- divisible
|
||||
|
||||
-- Sentence and question complements defined for all adjectival
|
||||
-- phrases, although the semantics is only clear for some adjectives.
|
||||
|
||||
SentAP : AP -> SC -> AP ; -- great that she won, uncertain if she did
|
||||
|
||||
-- An adjectival phrase can be modified by an *adadjective*, such as "very".
|
||||
|
||||
AdAP : AdA -> AP -> AP ; -- very uncertain
|
||||
|
||||
-- The formation of adverbs from adjective (e.g. "quickly") is covered
|
||||
-- by [Adverb Adverb.html].
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
--1 Adverb: Adverbs and Adverbial Phrases
|
||||
|
||||
abstract Adverb = Cat ** {
|
||||
|
||||
fun
|
||||
|
||||
-- The two main ways of forming adverbs are from adjectives and by
|
||||
-- prepositions from noun phrases.
|
||||
|
||||
PositAdvAdj : A -> Adv ; -- quickly
|
||||
PrepNP : Prep -> NP -> Adv ; -- in the house
|
||||
|
||||
-- Comparative adverbs have a noun phrase or a sentence as object of
|
||||
-- comparison.
|
||||
|
||||
ComparAdvAdj : CAdv -> A -> NP -> Adv ; -- more quickly than John
|
||||
ComparAdvAdjS : CAdv -> A -> S -> Adv ; -- more quickly than he runs
|
||||
|
||||
-- Adverbs can be modified by 'adadjectives', just like adjectives.
|
||||
|
||||
AdAdv : AdA -> Adv -> Adv ; -- very quickly
|
||||
|
||||
-- Subordinate clauses can function as adverbs.
|
||||
|
||||
SubjS : Subj -> S -> Adv ; -- when he arrives
|
||||
AdvSC : SC -> Adv ; -- that he arrives ---- REMOVE?
|
||||
|
||||
-- Comparison adverbs also work as numeral adverbs.
|
||||
|
||||
AdnCAdv : CAdv -> AdN ; -- more (than five)
|
||||
|
||||
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
--1 Cat: the Category System
|
||||
|
||||
-- The category system is central to the library in the sense
|
||||
-- that the other modules ($Adjective$, $Adverb$, $Noun$, $Verb$ etc)
|
||||
-- communicate through it. This means that a e.g. a function using
|
||||
-- $NP$s in $Verb$ need not know how $NP$s are constructed in $Noun$:
|
||||
-- it is enough that both $Verb$ and $Noun$ use the same type $NP$,
|
||||
-- which is given here in $Cat$.
|
||||
--
|
||||
-- Some categories are inherited from [``Common`` Common.html].
|
||||
-- The reason they are defined there is that they have the same
|
||||
-- implementation in all languages in the resource (typically,
|
||||
-- just a string). These categories are
|
||||
-- $AdA, AdN, AdV, Adv, Ant, CAdv, IAdv, PConj, Phr$,
|
||||
-- $Pol, SC, Tense, Text, Utt, Voc$.
|
||||
--
|
||||
-- Moreover, the list categories $ListAdv, ListAP, ListNP, ListS$
|
||||
-- are defined on $Conjunction$ and only used locally there.
|
||||
|
||||
|
||||
abstract Cat = Common ** {
|
||||
|
||||
cat
|
||||
|
||||
--2 Sentences and clauses
|
||||
|
||||
-- Constructed in [Sentence Sentence.html], and also in
|
||||
-- [Idiom Idiom.html].
|
||||
|
||||
S ; -- declarative sentence e.g. "she lived here"
|
||||
QS ; -- question e.g. "where did she live"
|
||||
RS ; -- relative e.g. "in which she lived"
|
||||
Cl ; -- declarative clause, with all tenses e.g. "she looks at this"
|
||||
Slash ; -- clause missing NP (S/NP in GPSG) e.g. "she looks at"
|
||||
Imp ; -- imperative e.g. "look at this"
|
||||
|
||||
--2 Questions and interrogatives
|
||||
|
||||
-- Constructed in [Question Question.html].
|
||||
|
||||
QCl ; -- question clause, with all tenses e.g. "why does she walk"
|
||||
IP ; -- interrogative pronoun e.g. "who"
|
||||
IComp ; -- interrogative complement of copula e.g. "where"
|
||||
IDet ; -- interrogative determiner e.g. "which"
|
||||
|
||||
--2 Relative clauses and pronouns
|
||||
|
||||
-- Constructed in [Relative Relative.html].
|
||||
|
||||
RCl ; -- relative clause, with all tenses e.g. "in which she lives"
|
||||
RP ; -- relative pronoun e.g. "in which"
|
||||
|
||||
--2 Verb phrases
|
||||
|
||||
-- Constructed in [Verb Verb.html].
|
||||
|
||||
VP ; -- verb phrase e.g. "is very warm"
|
||||
Comp ; -- complement of copula, such as AP e.g. "very warm"
|
||||
|
||||
--2 Adjectival phrases
|
||||
|
||||
-- Constructed in [Adjective Adjective.html].
|
||||
|
||||
AP ; -- adjectival phrase e.g. "very warm"
|
||||
|
||||
--2 Nouns and noun phrases
|
||||
|
||||
-- Constructed in [Noun Noun.html].
|
||||
-- Many atomic noun phrases e.g. "everybody"
|
||||
-- are constructed in [Structural Structural.html].
|
||||
-- The determiner structure is
|
||||
-- ``` Predet (QuantSg | QuantPl Num) Ord
|
||||
-- as defined in [Noun Noun.html].
|
||||
|
||||
CN ; -- common noun (without determiner) e.g. "red house"
|
||||
NP ; -- noun phrase (subject or object) e.g. "the red house"
|
||||
Pron ; -- personal pronoun e.g. "she"
|
||||
Det ; -- determiner phrase e.g. "those seven"
|
||||
Predet; -- predeterminer (prefixed Quant) e.g. "all"
|
||||
QuantSg;-- quantifier ('nucleus' of sing. Det) e.g. "every"
|
||||
QuantPl;-- quantifier ('nucleus' of plur. Det) e.g. "many"
|
||||
Quant ; -- quantifier with both sg and pl e.g. "this/these"
|
||||
Num ; -- cardinal number (used with QuantPl) e.g. "seven"
|
||||
Ord ; -- ordinal number (used in Det) e.g. "seventh"
|
||||
|
||||
--2 Numerals
|
||||
|
||||
-- Constructed in [Numeral Numeral.html].
|
||||
|
||||
Numeral;-- cardinal or ordinal, e.g. "five/fifth"
|
||||
|
||||
--2 Structural words
|
||||
|
||||
-- Constructed in [Structural Structural.html].
|
||||
|
||||
Conj ; -- conjunction, e.g. "and"
|
||||
DConj ; -- distributed conj. e.g. "both - and"
|
||||
Subj ; -- subjunction, e.g. "if"
|
||||
Prep ; -- preposition, or just case e.g. "in"
|
||||
|
||||
--2 Words of open classes
|
||||
|
||||
-- These are constructed in [Lexicon Lexicon.html] and in
|
||||
-- additional lexicon modules.
|
||||
|
||||
V ; -- one-place verb e.g. "sleep"
|
||||
V2 ; -- two-place verb e.g. "love"
|
||||
V3 ; -- three-place verb e.g. "show"
|
||||
VV ; -- verb-phrase-complement verb e.g. "want"
|
||||
VS ; -- sentence-complement verb e.g. "claim"
|
||||
VQ ; -- question-complement verb e.g. "ask"
|
||||
VA ; -- adjective-complement verb e.g. "look"
|
||||
V2A ; -- verb with NP and AP complement e.g. "paint"
|
||||
|
||||
A ; -- one-place adjective e.g. "warm"
|
||||
A2 ; -- two-place adjective e.g. "divisible"
|
||||
|
||||
N ; -- common noun e.g. "house"
|
||||
N2 ; -- relational noun e.g. "son"
|
||||
N3 ; -- three-place relational noun e.g. "connection"
|
||||
PN ; -- proper name e.g. "Paris"
|
||||
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
--1 Common: Structures with Common Implementations.
|
||||
|
||||
-- This module defines the categories that uniformly have the linearization
|
||||
-- ${s : Str}$ in all languages.
|
||||
|
||||
-- Moreover, this module defines the abstract parameters of tense, polarity, and
|
||||
-- anteriority, which are used in [``Phrase`` Phrase.html] to generate different
|
||||
-- forms of sentences. Together they give 4 x 2 x 2 = 16 sentence forms.
|
||||
|
||||
-- These tenses are defined for all languages in the library. More tenses
|
||||
-- can be defined in the language extensions, e.g. the "passé simple" of
|
||||
-- Romance languages in [``ExtraRomance`` ../romance/ExtraRomance.gf].
|
||||
|
||||
abstract Common = {
|
||||
|
||||
cat
|
||||
|
||||
--2 Top-level units
|
||||
|
||||
-- Constructed in [``Text`` Text.html]: $Text$.
|
||||
|
||||
Text ; -- text consisting of several phrases e.g. "He is here. Why?"
|
||||
|
||||
-- Constructed in [``Phrase`` Phrase.html]:
|
||||
|
||||
Phr ; -- phrase in a text e.g. "but be quiet please"
|
||||
Utt ; -- sentence, question, word... e.g. "be quiet"
|
||||
Voc ; -- vocative or "please" e.g. "my darling"
|
||||
PConj ; -- phrase-beginning conj. e.g. "therefore"
|
||||
|
||||
-- Constructed in [``Sentence`` Sentence.html]:
|
||||
|
||||
SC ; -- embedded sentence or question e.g. "that it rains"
|
||||
|
||||
--2 Adverbs
|
||||
|
||||
-- Constructed in [``Adverb`` Adverb.html].
|
||||
-- Many adverbs are constructed in [``Structural`` Structural.html].
|
||||
|
||||
Adv ; -- verb-phrase-modifying adverb, e.g. "in the house"
|
||||
AdV ; -- adverb directly attached to verb e.g. "always"
|
||||
AdA ; -- adjective-modifying adverb, e.g. "very"
|
||||
AdN ; -- numeral-modifying adverb, e.g. "more than"
|
||||
IAdv ; -- interrogative adverb e.g. "why"
|
||||
CAdv ; -- comparative adverb e.g. "more"
|
||||
|
||||
--2 Tense, polarity, and anteriority
|
||||
|
||||
Tense ; -- tense: present, past, future, conditional
|
||||
Pol ; -- polarity: positive, negative
|
||||
Ant ; -- anteriority: simultaneous, anterior
|
||||
|
||||
fun
|
||||
PPos, PNeg : Pol ; -- I sleep/don't sleep
|
||||
|
||||
TPres : Tense ;
|
||||
ASimul : Ant ;
|
||||
TPast, TFut, TCond : Tense ; -- I slept/will sleep/would sleep --# notpresent
|
||||
AAnter : Ant ; -- I have slept --# notpresent
|
||||
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
--1 Conjunction: Coordination
|
||||
|
||||
-- Coordination is defined for many different categories; here is
|
||||
-- a sample. The rules apply to *lists* of two or more elements,
|
||||
-- and define two general patterns:
|
||||
-- - ordinary conjunction: X,...X and X
|
||||
-- - distributed conjunction: both X,...,X and X
|
||||
--
|
||||
--
|
||||
-- $VP$ conjunctions are not covered here, because their applicability
|
||||
-- depends on language. Some special cases are defined in
|
||||
-- [``Extra`` ../abstract/Extra.gf].
|
||||
|
||||
|
||||
abstract Conjunction = Cat ** {
|
||||
|
||||
--2 Rules
|
||||
|
||||
fun
|
||||
ConjS : Conj -> [S] -> S ; -- "John walks and Mary runs"
|
||||
ConjAP : Conj -> [AP] -> AP ; -- "even and prime"
|
||||
ConjNP : Conj -> [NP] -> NP ; -- "John or Mary"
|
||||
ConjAdv : Conj -> [Adv] -> Adv ; -- "quickly or slowly"
|
||||
|
||||
DConjS : DConj -> [S] -> S ; -- "either John walks or Mary runs"
|
||||
DConjAP : DConj -> [AP] -> AP ; -- "both even and prime"
|
||||
DConjNP : DConj -> [NP] -> NP ; -- "either John or Mary"
|
||||
DConjAdv : DConj -> [Adv] -> Adv; -- "both badly and slowly"
|
||||
|
||||
--2 Categories
|
||||
|
||||
-- These categories are only used in this module.
|
||||
|
||||
cat
|
||||
[S]{2} ;
|
||||
[Adv]{2} ;
|
||||
[NP]{2} ;
|
||||
[AP]{2} ;
|
||||
|
||||
--2 List constructors
|
||||
|
||||
-- The list constructors are derived from the list notation and therefore
|
||||
-- not given explicitly. But here are their type signatures:
|
||||
|
||||
-- BaseC : C -> C -> [C] ; -- for C = S, AP, NP, Adv
|
||||
-- ConsC : C -> [C] -> [C] ;
|
||||
}
|
||||
|
||||
--.
|
||||
-- *Note*. This module uses right-recursive lists. If backward
|
||||
-- compatibility with API 0.9 is needed, use
|
||||
-- [SeqConjunction SeqConjunction.html].
|
||||
@@ -1,30 +0,0 @@
|
||||
--1 More syntax rules
|
||||
|
||||
-- This module defines syntax rules that are not implemented in all
|
||||
-- languages, but in more than one, so that it makes sense to offer a
|
||||
-- common API.
|
||||
|
||||
abstract Extra = Cat ** {
|
||||
|
||||
fun
|
||||
GenNP : NP -> Quant ; -- this man's
|
||||
ComplBareVS : VS -> S -> VP ; -- know you go
|
||||
|
||||
StrandRelSlash : RP -> Slash -> RCl ; -- that he lives in
|
||||
EmptyRelSlash : RP -> Slash -> RCl ; -- he lives in
|
||||
StrandQuestSlash : IP -> Slash -> QCl ; -- whom does John live with
|
||||
|
||||
-- $VP$ conjunction, which has different fragments implemented in
|
||||
-- different languages - never a full $VP$, though.
|
||||
|
||||
cat
|
||||
VPI ;
|
||||
[VPI] {2} ;
|
||||
|
||||
fun
|
||||
MkVPI : VP -> VPI ;
|
||||
ConjVPI : Conj -> [VPI] -> VPI ;
|
||||
ComplVPIVV : VV -> VPI -> VP ;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
--1 Grammar: the Main Module of the Resource Grammar
|
||||
|
||||
-- This grammar is a collection of the different grammar modules,
|
||||
-- To test the resource, import [``Lang`` Lang.html], which also contains
|
||||
-- a lexicon.
|
||||
|
||||
abstract Grammar =
|
||||
Noun,
|
||||
Verb,
|
||||
Adjective,
|
||||
Adverb,
|
||||
Numeral,
|
||||
Sentence,
|
||||
Question,
|
||||
Relative,
|
||||
Conjunction,
|
||||
Phrase,
|
||||
Text,
|
||||
Structural,
|
||||
Idiom
|
||||
** {} ;
|
||||
@@ -1,22 +0,0 @@
|
||||
--1 Idiom: Idiomatic Expressions
|
||||
|
||||
abstract Idiom = Cat ** {
|
||||
|
||||
-- This module defines constructions that are formed in fixed ways,
|
||||
-- often different even in closely related languages.
|
||||
|
||||
fun
|
||||
ImpersCl : VP -> Cl ; -- it rains
|
||||
GenericCl : VP -> Cl ; -- one sleeps
|
||||
|
||||
CleftNP : NP -> RS -> Cl ; -- it is you who did it
|
||||
CleftAdv : Adv -> S -> Cl ; -- it is yesterday she arrived
|
||||
|
||||
ExistNP : NP -> Cl ; -- there is a house
|
||||
ExistIP : IP -> QCl ; -- which houses are there
|
||||
|
||||
ProgrVP : VP -> VP ; -- be sleeping
|
||||
|
||||
ImpPl1 : VP -> Utt ; -- let's go
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
--1 Lang: a Test Module for the Resource Grammar
|
||||
|
||||
-- This grammar is for testing the resource as included in the
|
||||
-- language-independent API, consisting of a grammar and a lexicon.
|
||||
-- The grammar without a lexicon is [``Grammar`` Grammar.html],
|
||||
-- which may be more suitable to open in applications.
|
||||
|
||||
abstract Lang =
|
||||
Grammar,
|
||||
Lexicon
|
||||
** {} ;
|
||||
@@ -1,352 +0,0 @@
|
||||
abstract Lexicon = Cat ** {
|
||||
fun
|
||||
add_V3 : V3 ;
|
||||
airplane_N : N ;
|
||||
already_Adv : Adv ;
|
||||
animal_N : N ;
|
||||
answer_V2S : V2 ;
|
||||
apartment_N : N ;
|
||||
apple_N : N ;
|
||||
art_N : N ;
|
||||
ashes_N : N ;
|
||||
ask_V2Q : V2 ;
|
||||
baby_N : N ;
|
||||
back_N : N ;
|
||||
bad_A : A ;
|
||||
bank_N : N ;
|
||||
bark_N : N ;
|
||||
beautiful_A : A ;
|
||||
become_VA : VA ;
|
||||
beer_N : N ;
|
||||
beg_V2V : V2 ;
|
||||
belly_N : N ;
|
||||
big_A : A ;
|
||||
bike_N : N ;
|
||||
bird_N : N ;
|
||||
bite_V2 : V2 ;
|
||||
black_A : A ;
|
||||
blood_N : N ;
|
||||
blow_V : V ;
|
||||
blue_A : A ;
|
||||
boat_N : N ;
|
||||
bone_N : N ;
|
||||
book_N : N ;
|
||||
boot_N : N ;
|
||||
boss_N : N ;
|
||||
boy_N : N ;
|
||||
bread_N : N ;
|
||||
break_V2 : V2 ;
|
||||
breast_N : N ;
|
||||
breathe_V : V ;
|
||||
broad_A : A ;
|
||||
brother_N2 : N2 ;
|
||||
brown_A : A ;
|
||||
burn_V : V ;
|
||||
butter_N : N ;
|
||||
buy_V2 : V2 ;
|
||||
camera_N : N ;
|
||||
cap_N : N ;
|
||||
car_N : N ;
|
||||
carpet_N : N ;
|
||||
cat_N : N ;
|
||||
ceiling_N : N ;
|
||||
chair_N : N ;
|
||||
cheese_N : N ;
|
||||
child_N : N ;
|
||||
church_N : N ;
|
||||
city_N : N ;
|
||||
clean_A : A ;
|
||||
clever_A : A ;
|
||||
close_V2 : V2 ;
|
||||
cloud_N : N ;
|
||||
coat_N : N ;
|
||||
cold_A : A ;
|
||||
come_V : V ;
|
||||
computer_N : N ;
|
||||
correct_A : A ;
|
||||
country_N : N ;
|
||||
count_V2 : V2 ;
|
||||
cousin_N : N ;
|
||||
cow_N : N ;
|
||||
cut_V2 : V2 ;
|
||||
day_N : N ;
|
||||
die_V : V ;
|
||||
dig_V : V ;
|
||||
dirty_A : A ;
|
||||
distance_N3 : N3 ;
|
||||
doctor_N : N ;
|
||||
dog_N : N ;
|
||||
door_N : N ;
|
||||
do_V2 : V2 ;
|
||||
drink_V2 : V2 ;
|
||||
drink_V2 : V2 ;
|
||||
dry_A : A ;
|
||||
dull_A : A ;
|
||||
dust_N : N ;
|
||||
ear_N : N ;
|
||||
earth_N : N ;
|
||||
easy_A2V : A2 ;
|
||||
eat_V2 : V2 ;
|
||||
eat_V2 : V2 ;
|
||||
egg_N : N ;
|
||||
empty_A : A ;
|
||||
enemy_N : N ;
|
||||
eye_N : N ;
|
||||
factory_N : N ;
|
||||
fall_V : V ;
|
||||
far_Adv : Adv ;
|
||||
father_N2 : N2 ;
|
||||
fat_N : N ;
|
||||
fear_VS : VS ;
|
||||
fear_V2 : V2 ;
|
||||
feather_N : N ;
|
||||
fight_V2 : V2 ;
|
||||
find_V2 : V2 ;
|
||||
fingernail_N : N ;
|
||||
fire_N : N ;
|
||||
fish_N : N ;
|
||||
float_V : V ;
|
||||
floor_N : N ;
|
||||
flower_N : N ;
|
||||
flow_V : V ;
|
||||
fly_V : V ;
|
||||
fog_N : N ;
|
||||
foot_N : N ;
|
||||
forest_N : N ;
|
||||
forget_V2 : V2 ;
|
||||
freeze_V : V ;
|
||||
fridge_N : N ;
|
||||
friend_N : N ;
|
||||
fruit_N : N ;
|
||||
full_A : A ;
|
||||
fun
|
||||
fun_AV : A ;
|
||||
garden_N : N ;
|
||||
girl_N : N ;
|
||||
give_V3 : V3 ;
|
||||
glove_N : N ;
|
||||
gold_N : N ;
|
||||
good_A : A ;
|
||||
go_V : V ;
|
||||
grammar_N : N ;
|
||||
grass_N : N ;
|
||||
green_A : A ;
|
||||
guts_N : N ;
|
||||
hair_N : N ;
|
||||
hand_N : N ;
|
||||
harbour_N : N ;
|
||||
hate_V2 : V2 ;
|
||||
hat_N : N ;
|
||||
have_V2 : V2 ;
|
||||
head_N : N ;
|
||||
heart_N : N ;
|
||||
hear_V2 : V2 ;
|
||||
hear_V2 : V2 ;
|
||||
heavy_A : A ;
|
||||
hill_N : N ;
|
||||
hit_V2 : V2 ;
|
||||
hold_V2 : V2 ;
|
||||
hope_VS : VS ;
|
||||
horn_N : N ;
|
||||
horse_N : N ;
|
||||
hot_A : A ;
|
||||
house_N : N ;
|
||||
hunt_V2 : V2 ;
|
||||
husband_N : N ;
|
||||
ice_N : N ;
|
||||
important_A : A ;
|
||||
industry_N : N ;
|
||||
iron_N : N ;
|
||||
jump_V : V ;
|
||||
kill_V2 : V2 ;
|
||||
king_N : N ;
|
||||
knee_N : N ;
|
||||
know_V2 : V2 ;
|
||||
know_V2 : V2 ;
|
||||
lake_N : N ;
|
||||
lamp_N : N ;
|
||||
language_N : N ;
|
||||
laugh_V : V ;
|
||||
leaf_N : N ;
|
||||
learn_V2 : V2 ;
|
||||
leather_N : N ;
|
||||
leave_V2 : V2 ;
|
||||
left_Ord : Ord ;
|
||||
leg_N : N ;
|
||||
lie_V : V ;
|
||||
like_V2 : V2 ;
|
||||
listen_V2 : V2 ;
|
||||
liver_N : N ;
|
||||
live_V : V ;
|
||||
long_A : A ;
|
||||
lose_V2 : V2 ;
|
||||
louse_N : N ;
|
||||
love_N : N ;
|
||||
love_V2 : V2 ;
|
||||
man_N : N ;
|
||||
married_A2 : A2 ;
|
||||
meat_N : N ;
|
||||
meat_N : N ;
|
||||
milk_N : N ;
|
||||
moon_N : N ;
|
||||
mother_N2 : N2 ;
|
||||
mountain_N : N ;
|
||||
mouth_N : N ;
|
||||
music_N : N ;
|
||||
name_N : N ;
|
||||
narrow_A : A ;
|
||||
near_A : A ;
|
||||
neck_N : N ;
|
||||
new_A : A ;
|
||||
newspaper_N : N ;
|
||||
night_N : N ;
|
||||
nose_N : N ;
|
||||
now_Adv : Adv ;
|
||||
number_N : N ;
|
||||
oil_N : N ;
|
||||
old_A : A ;
|
||||
open_V2 : V2 ;
|
||||
paint_V2A : V2A ;
|
||||
paper_N : N ;
|
||||
paris_PN : PN ;
|
||||
peace_N : N ;
|
||||
pen_N : N ;
|
||||
person_N : N ;
|
||||
planet_N : N ;
|
||||
plastic_N : N ;
|
||||
play_V2 : V2 ;
|
||||
play_V : V ;
|
||||
policeman_N : N ;
|
||||
priest_N : N ;
|
||||
probable_AS : A ;
|
||||
pull_V2 : V2 ;
|
||||
push_V2 : V2 ;
|
||||
put_V2 : V2 ;
|
||||
queen_N : N ;
|
||||
radio_N : N ;
|
||||
rain_N : N ;
|
||||
rain_V0 : V ;
|
||||
read_V2 : V2 ;
|
||||
red_A : A ;
|
||||
religion_N : N ;
|
||||
restaurant_N : N ;
|
||||
right_Ord : Ord ;
|
||||
river_N : N ;
|
||||
road_N : N ;
|
||||
rock_N : N ;
|
||||
roof_N : N ;
|
||||
root_N : N ;
|
||||
rope_N : N ;
|
||||
rotten_A : A ;
|
||||
round_A : A ;
|
||||
rubber_N : N ;
|
||||
rub_V2 : V2 ;
|
||||
rule_N : N ;
|
||||
run_V : V ;
|
||||
salt_N : N ;
|
||||
sand_N : N ;
|
||||
say_VS : VS ;
|
||||
school_N : N ;
|
||||
science_N : N ;
|
||||
scratch_V2 : V2 ;
|
||||
sea_N : N ;
|
||||
seed_N : N ;
|
||||
seek_V2 : V2 ;
|
||||
see_V2 : V2 ;
|
||||
see_V2 : V2 ;
|
||||
sell_V3 : V3 ;
|
||||
send_V3 : V3 ;
|
||||
sew_V : V ;
|
||||
sharp_A : A ;
|
||||
sheep_N : N ;
|
||||
ship_N : N ;
|
||||
shirt_N : N ;
|
||||
shoe_N : N ;
|
||||
shop_N : N ;
|
||||
short_A : A ;
|
||||
silver_N : N ;
|
||||
sing_V : V ;
|
||||
sister_N : N ;
|
||||
sit_V : V ;
|
||||
skin_N : N ;
|
||||
sky_N : N ;
|
||||
sleep_V : V ;
|
||||
small_A : A ;
|
||||
smell_V : V ;
|
||||
smoke_N : N ;
|
||||
smooth_A : A ;
|
||||
snake_N : N ;
|
||||
snow_N : N ;
|
||||
sock_N : N ;
|
||||
song_N : N ;
|
||||
speak_V2 : V2 ;
|
||||
spit_V : V ;
|
||||
split_V2 : V2 ;
|
||||
squeeze_V2 : V2 ;
|
||||
stab_V2 : V2 ;
|
||||
stand_V : V ;
|
||||
star_N : N ;
|
||||
steel_N : N ;
|
||||
stick_N : N ;
|
||||
stone_N : N ;
|
||||
stop_V : V ;
|
||||
stove_N : N ;
|
||||
straight_A : A ;
|
||||
student_N : N ;
|
||||
stupid_A : A ;
|
||||
suck_V2 : V2 ;
|
||||
sun_N : N ;
|
||||
swell_V : V ;
|
||||
swim_V : V ;
|
||||
switch8off_V2 : V2 ;
|
||||
switch8on_V2 : V2 ;
|
||||
table_N : N ;
|
||||
tail_N : N ;
|
||||
talk_V3 : V3 ;
|
||||
teacher_N : N ;
|
||||
teach_V2 : V2 ;
|
||||
television_N : N ;
|
||||
thick_A : A ;
|
||||
thin_A : A ;
|
||||
think_V : V ;
|
||||
throw_V2 : V2 ;
|
||||
tie_V2 : V2 ;
|
||||
tongue_N : N ;
|
||||
tooth_N : N ;
|
||||
train_N : N ;
|
||||
travel_V : V ;
|
||||
tree_N : N ;
|
||||
turn_V : V ;
|
||||
ugly_A : A ;
|
||||
understand_V2 : V2 ;
|
||||
university_N : N ;
|
||||
village_N : N ;
|
||||
vomit_V : V ;
|
||||
wait_V2 : V2 ;
|
||||
walk_V : V ;
|
||||
warm_A : A ;
|
||||
war_N : N ;
|
||||
wash_V2 : V2 ;
|
||||
watch_V2 : V2 ;
|
||||
water_N : N ;
|
||||
water_N : N ;
|
||||
wet_A : A ;
|
||||
white_A : A ;
|
||||
wide_A : A ;
|
||||
wife_N : N ;
|
||||
wind_N : N ;
|
||||
window_N : N ;
|
||||
wine_N : N ;
|
||||
wing_N : N ;
|
||||
win_V2 : V2 ;
|
||||
wipe_V2 : V2 ;
|
||||
woman_N : N ;
|
||||
wonder_VQ : VQ ;
|
||||
wood_N : N ;
|
||||
worm_N : N ;
|
||||
write_V2 : V2 ;
|
||||
year_N : N ;
|
||||
yellow_A : A ;
|
||||
young_A : A ;
|
||||
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
--1 Noun: Nouns, noun phrases, and determiners
|
||||
|
||||
abstract Noun = Cat ** {
|
||||
|
||||
--2 Noun phrases
|
||||
|
||||
-- The three main types of noun phrases are
|
||||
-- - common nouns with determiners
|
||||
-- - proper names
|
||||
-- - pronouns
|
||||
--
|
||||
--
|
||||
fun
|
||||
DetCN : Det -> CN -> NP ; -- the man
|
||||
UsePN : PN -> NP ; -- John
|
||||
UsePron : Pron -> NP ; -- he
|
||||
|
||||
-- Pronouns are defined in the module [``Structural`` Structural.html].
|
||||
|
||||
-- A noun phrase already formed can be modified by a $Predet$erminer.
|
||||
|
||||
PredetNP : Predet -> NP -> NP; -- only the man
|
||||
|
||||
-- A noun phrase can also be postmodified by the past participle of a
|
||||
-- verb or by an adverb.
|
||||
|
||||
PPartNP : NP -> V2 -> NP ; -- the number squared
|
||||
AdvNP : NP -> Adv -> NP ; -- Paris at midnight
|
||||
|
||||
--2 Determiners
|
||||
|
||||
-- The determiner has a fine-grained structure, in which a 'nucleus'
|
||||
-- quantifier and two optional parts can be discerned.
|
||||
-- The cardinal numeral is only available for plural determiners.
|
||||
-- (This is modified from CLE by further dividing their $Num$ into
|
||||
-- cardinal and ordinal.)
|
||||
|
||||
DetSg : QuantSg -> Ord -> Det ; -- this best man
|
||||
DetPl : QuantPl -> Num -> Ord -> Det ; -- these five best men
|
||||
|
||||
-- Quantifiers that have both forms can be used in both ways.
|
||||
|
||||
SgQuant : Quant -> QuantSg ; -- this
|
||||
PlQuant : Quant -> QuantPl ; -- these
|
||||
|
||||
-- Pronouns have possessive forms. Genitives of other kinds
|
||||
-- of noun phrases are not given here, since they are not possible
|
||||
-- in e.g. Romance languages. They can be found in
|
||||
-- [``Extra`` ../abstract/Extra.gf].
|
||||
|
||||
PossPron : Pron -> Quant ; -- my (house)
|
||||
|
||||
-- All parts of the determiner can be empty, except $Quant$, which is
|
||||
-- the "kernel" of a determiner.
|
||||
|
||||
NoNum : Num ;
|
||||
NoOrd : Ord ;
|
||||
|
||||
-- $Num$ consists of either digits or numeral words.
|
||||
|
||||
NumInt : Int -> Num ; -- 51
|
||||
NumNumeral : Numeral -> Num ; -- fifty-one
|
||||
|
||||
-- The construction of numerals is defined in [Numeral Numeral.html].
|
||||
|
||||
-- $Num$ can be modified by certain adverbs.
|
||||
|
||||
AdNum : AdN -> Num -> Num ; -- almost 51
|
||||
|
||||
-- $Ord$ consists of either digits or numeral words.
|
||||
|
||||
OrdInt : Int -> Ord ; -- 51st
|
||||
OrdNumeral : Numeral -> Ord ; -- fifty-first
|
||||
|
||||
-- Superlative forms of adjectives behave syntactically in the same way as
|
||||
-- ordinals.
|
||||
|
||||
OrdSuperl : A -> Ord ; -- largest
|
||||
|
||||
-- Definite and indefinite constructions are sometimes realized as
|
||||
-- neatly distinct words (Spanish "un, unos ; el, los") but also without
|
||||
-- any particular word (Finnish; Swedish definites).
|
||||
|
||||
DefArt : Quant ; -- the (house), the (houses)
|
||||
IndefArt : Quant ; -- a (house), (houses)
|
||||
|
||||
-- Nouns can be used without an article as mass nouns. The resource does
|
||||
-- not distinguish mass nouns from other common nouns, which can result
|
||||
-- in semantically odd expressions.
|
||||
|
||||
MassDet : QuantSg ; -- (beer)
|
||||
|
||||
-- Other determiners are defined in [Structural Structural.html].
|
||||
|
||||
|
||||
|
||||
--2 Common nouns
|
||||
|
||||
-- Simple nouns can be used as nouns outright.
|
||||
|
||||
UseN : N -> CN ; -- house
|
||||
|
||||
-- Relational nouns take one or two arguments.
|
||||
|
||||
ComplN2 : N2 -> NP -> CN ; -- son of the king
|
||||
ComplN3 : N3 -> NP -> N2 ; -- flight from Moscow (to Paris)
|
||||
|
||||
-- Relational nouns can also be used without their arguments.
|
||||
-- The semantics is typically derivative of the relational meaning.
|
||||
|
||||
UseN2 : N2 -> CN ; -- son
|
||||
UseN3 : N3 -> CN ; -- flight
|
||||
|
||||
-- Nouns can be modified by adjectives, relative clauses, and adverbs
|
||||
-- (the last rule will give rise to many 'PP attachment' ambiguities
|
||||
-- when used in connection with verb phrases).
|
||||
|
||||
AdjCN : AP -> CN -> CN ; -- big house
|
||||
RelCN : CN -> RS -> CN ; -- house that John owns
|
||||
AdvCN : CN -> Adv -> CN ; -- house on the hill
|
||||
|
||||
-- Nouns can also be modified by embedded sentences and questions.
|
||||
-- For some nouns this makes little sense, but we leave this for applications
|
||||
-- to decide. Sentential complements are defined in [Verb Verb.html].
|
||||
|
||||
SentCN : CN -> SC -> CN ; -- fact that John smokes, question if he does
|
||||
|
||||
--2 Apposition
|
||||
|
||||
-- This is certainly overgenerating.
|
||||
|
||||
ApposCN : CN -> NP -> CN ; -- number x, numbers x and y
|
||||
|
||||
} ;
|
||||
@@ -1,49 +0,0 @@
|
||||
--1 Numerals
|
||||
|
||||
-- This grammar defines numerals from 1 to 999999.
|
||||
-- The implementations are adapted from the
|
||||
-- [numerals library http://www.cs.chalmers.se/~aarne/GF/examples/numerals/]
|
||||
-- which defines numerals for 88 languages.
|
||||
-- The resource grammar implementations add to this inflection (if needed)
|
||||
-- and ordinal numbers.
|
||||
--
|
||||
-- *Note* 1. Number 1 as defined
|
||||
-- in the category $Numeral$ here should not be used in the formation of
|
||||
-- noun phrases, and should therefore be removed. Instead, one should use
|
||||
-- [Structural Structural.html]$.one_Quant$. This makes the grammar simpler
|
||||
-- because we can assume that numbers form plural noun phrases.
|
||||
--
|
||||
-- *Note* 2. The implementations introduce spaces between
|
||||
-- parts of a numeral, which is often incorrect - more work on
|
||||
-- (un)lexing is needed to solve this problem.
|
||||
|
||||
abstract Numeral = Cat ** {
|
||||
|
||||
cat
|
||||
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
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
--1 Phrase: Phrases and Utterances
|
||||
|
||||
abstract Phrase = Cat ** {
|
||||
|
||||
-- When a phrase is built from an utterance it can be prefixed
|
||||
-- with a phrasal conjunction (such as "but", "therefore")
|
||||
-- and suffixing with a vocative (typically a noun phrase).
|
||||
|
||||
fun
|
||||
PhrUtt : PConj -> Utt -> Voc -> Phr ; -- But go home my friend.
|
||||
|
||||
-- Utterances are formed from sentences, questions, and imperatives.
|
||||
|
||||
UttS : S -> Utt ; -- John walks
|
||||
UttQS : QS -> Utt ; -- is it good
|
||||
UttImpSg : Pol -> Imp -> Utt; -- (don't) help yourself
|
||||
UttImpPl : Pol -> Imp -> Utt; -- (don't) help yourselves
|
||||
|
||||
-- There are also 'one-word utterances'. A typical use of them is
|
||||
-- as answers to questions.
|
||||
-- *Note*. This list is incomplete. More categories could be covered.
|
||||
-- Moreover, in many languages e.g. noun phrases in different cases
|
||||
-- can be used.
|
||||
|
||||
UttIP : IP -> Utt ; -- who
|
||||
UttIAdv : IAdv -> Utt ; -- why
|
||||
UttNP : NP -> Utt ; -- this man
|
||||
UttAdv : Adv -> Utt ; -- here
|
||||
UttVP : VP -> Utt ; -- to sleep
|
||||
|
||||
-- The phrasal conjunction is optional. A sentence conjunction
|
||||
-- can also used to prefix an utterance.
|
||||
|
||||
NoPConj : PConj ;
|
||||
PConjConj : Conj -> PConj ; -- and
|
||||
|
||||
-- The vocative is optional. Any noun phrase can be made into vocative,
|
||||
-- which may be overgenerating (e.g. "I").
|
||||
|
||||
NoVoc : Voc ;
|
||||
VocNP : NP -> Voc ; -- my friend
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
--1 Question: Questions and Interrogative Pronouns
|
||||
|
||||
abstract Question = Cat ** {
|
||||
|
||||
-- A question can be formed from a clause ('yes-no question') or
|
||||
-- with an interrogative.
|
||||
|
||||
fun
|
||||
QuestCl : Cl -> QCl ; -- does John walk
|
||||
QuestVP : IP -> VP -> QCl ; -- who walks
|
||||
QuestSlash : IP -> Slash -> QCl ; -- who does John love
|
||||
QuestIAdv : IAdv -> Cl -> QCl ; -- why does John walk
|
||||
QuestIComp : IComp -> NP -> QCl ; -- where is John
|
||||
|
||||
-- Interrogative pronouns can be formed with interrogative
|
||||
-- determiners.
|
||||
|
||||
IDetCN : IDet -> Num -> Ord -> CN -> IP; -- which five best songs
|
||||
AdvIP : IP -> Adv -> IP ; -- who in Europe
|
||||
|
||||
PrepIP : Prep -> IP -> IAdv ; -- with whom
|
||||
|
||||
CompIAdv : IAdv -> IComp ; -- where
|
||||
|
||||
|
||||
-- More $IP$, $IDet$, and $IAdv$ are defined in
|
||||
-- [``Structural`` Structural.html].
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
--1 Relative clauses and pronouns
|
||||
|
||||
abstract Relative = Cat ** {
|
||||
|
||||
fun
|
||||
|
||||
-- The simplest way to form a relative clause is from a clause by
|
||||
-- a pronoun similar to "such that".
|
||||
|
||||
RelCl : Cl -> RCl ; -- such that John loves her
|
||||
|
||||
-- The more proper ways are from a verb phrase
|
||||
-- (formed in [``Verb`` Verb.html]) or a sentence
|
||||
-- with a missing noun phrase (formed in [``Sentence`` Sentence.html]).
|
||||
|
||||
RelVP : RP -> VP -> RCl ; -- who loves John
|
||||
RelSlash : RP -> Slash -> RCl ; -- whom John loves
|
||||
|
||||
-- Relative pronouns are formed from an 'identity element' by prefixing
|
||||
-- or suffixing (depending on language) prepositional phrases.
|
||||
|
||||
IdRP : RP ; -- which
|
||||
FunRP : Prep -> NP -> RP -> RP ; -- all the roots of which
|
||||
|
||||
}
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
--1 Sentence: Sentences, Clauses, and Imperatives
|
||||
|
||||
abstract Sentence = Cat ** {
|
||||
|
||||
--2 Clauses
|
||||
|
||||
-- The $NP VP$ predication rule form a clause whose linearization
|
||||
-- gives a table of all tense variants, positive and negative.
|
||||
-- Clauses are converted to $S$ (with fixed tense) with the
|
||||
-- $UseCl$ function below.
|
||||
|
||||
fun
|
||||
PredVP : NP -> VP -> Cl ; -- John walks
|
||||
|
||||
-- Using an embedded sentence as a subject is treated separately.
|
||||
-- This can be overgenerating. E.g. "whether you go" as subject
|
||||
-- is only meaningful for some verb phrases.
|
||||
|
||||
PredSCVP : SC -> VP -> Cl ; -- that you go makes me happy
|
||||
|
||||
--2 Clauses missing object noun phrases
|
||||
|
||||
-- This category is a variant of the 'slash category' $S/NP$ of
|
||||
-- GPSG and categorial grammars, which in turn replaces
|
||||
-- movement transformations in the formation of questions
|
||||
-- and relative clauses. Except $SlashV2$, the construction
|
||||
-- rules can be seen as special cases of function composition, in
|
||||
-- the style of CCG.
|
||||
-- *Note* the set is not complete and lacks e.g. verbs with more than 2 places.
|
||||
|
||||
SlashV2 : NP -> V2 -> Slash ; -- (whom) he sees
|
||||
SlashVVV2 : NP -> VV -> V2 -> Slash; -- (whom) he wants to see
|
||||
AdvSlash : Slash -> Adv -> Slash ; -- (whom) he sees tomorrow
|
||||
SlashPrep : Cl -> Prep -> Slash ; -- (with whom) he walks
|
||||
|
||||
--2 Imperatives
|
||||
|
||||
-- An imperative is straightforwardly formed from a verb phrase.
|
||||
-- It has variation over positive and negative, singular and plural.
|
||||
-- To fix these parameters, see [Phrase Phrase.html].
|
||||
|
||||
ImpVP : VP -> Imp ; -- go
|
||||
|
||||
--2 Embedded sentences
|
||||
|
||||
-- Sentences, questions, and infinitival phrases can be used as
|
||||
-- subjects and (adverbial) complements.
|
||||
|
||||
EmbedS : S -> SC ; -- that you go
|
||||
EmbedQS : QS -> SC ; -- whether you go
|
||||
EmbedVP : VP -> SC ; -- to go
|
||||
|
||||
--2 Sentences
|
||||
|
||||
-- These are the 2 x 4 x 4 = 16 forms generated by different
|
||||
-- combinations of tense, polarity, and
|
||||
-- anteriority, which are defined in [``Common`` Common.html].
|
||||
|
||||
fun
|
||||
UseCl : Tense -> Ant -> Pol -> Cl -> S ;
|
||||
UseQCl : Tense -> Ant -> Pol -> QCl -> QS ;
|
||||
UseRCl : Tense -> Ant -> Pol -> RCl -> RS ;
|
||||
|
||||
}
|
||||
|
||||
--.
|
||||
-- Examples for English $S$/$Cl$:
|
||||
{-
|
||||
Pres Simul Pos ODir : he sleeps
|
||||
Pres Simul Neg ODir : he doesn't sleep
|
||||
Pres Anter Pos ODir : he has slept
|
||||
Pres Anter Neg ODir : he hasn't slept
|
||||
Past Simul Pos ODir : he slept
|
||||
Past Simul Neg ODir : he didn't sleep
|
||||
Past Anter Pos ODir : he had slept
|
||||
Past Anter Neg ODir : he hadn't slept
|
||||
Fut Simul Pos ODir : he will sleep
|
||||
Fut Simul Neg ODir : he won't sleep
|
||||
Fut Anter Pos ODir : he will have slept
|
||||
Fut Anter Neg ODir : he won't have slept
|
||||
Cond Simul Pos ODir : he would sleep
|
||||
Cond Simul Neg ODir : he wouldn't sleep
|
||||
Cond Anter Pos ODir : he would have slept
|
||||
Cond Anter Neg ODir : he wouldn't have slept
|
||||
-}
|
||||
@@ -1,111 +0,0 @@
|
||||
--1 Structural: Structural Words
|
||||
--
|
||||
-- Here we have some words belonging to closed classes and appearing
|
||||
-- in all languages we have considered.
|
||||
-- Sometimes more distinctions are needed, e.g. $we_Pron$ in Spanish
|
||||
-- should be replaced by masculine and feminine variants, found in
|
||||
-- [``ExtraSpa`` ../spanish/ExtraSpa.gf].
|
||||
|
||||
abstract Structural = Cat ** {
|
||||
|
||||
fun
|
||||
|
||||
-- This is an alphabetical list of structural words
|
||||
|
||||
above_Prep : Prep ;
|
||||
after_Prep : Prep ;
|
||||
all_Predet : Predet ;
|
||||
almost_AdA : AdA ;
|
||||
almost_AdN : AdN ;
|
||||
although_Subj : Subj ;
|
||||
always_AdV : AdV ;
|
||||
and_Conj : Conj ;
|
||||
because_Subj : Subj ;
|
||||
before_Prep : Prep ;
|
||||
behind_Prep : Prep ;
|
||||
between_Prep : Prep ;
|
||||
both7and_DConj : DConj ;
|
||||
but_PConj : PConj ;
|
||||
by8agent_Prep : Prep ;
|
||||
by8means_Prep : Prep ;
|
||||
can8know_VV : VV ;
|
||||
can_VV : VV ;
|
||||
during_Prep : Prep ;
|
||||
either7or_DConj : DConj ;
|
||||
every_Det : Det ;
|
||||
everybody_NP : NP ;
|
||||
everything_NP : NP ;
|
||||
everywhere_Adv : Adv ;
|
||||
first_Ord : Ord ;
|
||||
few_Det : Det ;
|
||||
from_Prep : Prep ;
|
||||
he_Pron : Pron ;
|
||||
here_Adv : Adv ;
|
||||
here7to_Adv : Adv ;
|
||||
here7from_Adv : Adv ;
|
||||
how_IAdv : IAdv ;
|
||||
how8many_IDet : IDet ;
|
||||
i_Pron : Pron ;
|
||||
if_Subj : Subj ;
|
||||
in8front_Prep : Prep ;
|
||||
in_Prep : Prep ;
|
||||
it_Pron : Pron ;
|
||||
less_CAdv : CAdv ;
|
||||
many_Det : Det ;
|
||||
more_CAdv : CAdv ;
|
||||
most_Predet : Predet ;
|
||||
much_Det : Det ;
|
||||
must_VV : VV ;
|
||||
no_Phr : Phr ;
|
||||
on_Prep : Prep ;
|
||||
one_Quant : QuantSg ;
|
||||
only_Predet : Predet ;
|
||||
or_Conj : Conj ;
|
||||
otherwise_PConj : PConj ;
|
||||
part_Prep : Prep ;
|
||||
please_Voc : Voc ;
|
||||
possess_Prep : Prep ;
|
||||
quite_Adv : AdA ;
|
||||
she_Pron : Pron ;
|
||||
so_AdA : AdA ;
|
||||
someSg_Det : Det ;
|
||||
somePl_Det : Det ;
|
||||
somebody_NP : NP ;
|
||||
something_NP : NP ;
|
||||
somewhere_Adv : Adv ;
|
||||
that_Quant : Quant ;
|
||||
that_NP : NP ;
|
||||
there_Adv : Adv ;
|
||||
there7to_Adv : Adv ;
|
||||
there7from_Adv : Adv ;
|
||||
therefore_PConj : PConj ;
|
||||
these_NP : NP ;
|
||||
they_Pron : Pron ;
|
||||
this_Quant : Quant ;
|
||||
this_NP : NP ;
|
||||
those_NP : NP ;
|
||||
through_Prep : Prep ;
|
||||
to_Prep : Prep ;
|
||||
too_AdA : AdA ;
|
||||
under_Prep : Prep ;
|
||||
very_AdA : AdA ;
|
||||
want_VV : VV ;
|
||||
we_Pron : Pron ;
|
||||
whatPl_IP : IP ;
|
||||
whatSg_IP : IP ;
|
||||
when_IAdv : IAdv ;
|
||||
when_Subj : Subj ;
|
||||
where_IAdv : IAdv ;
|
||||
whichPl_IDet : IDet ;
|
||||
whichSg_IDet : IDet ;
|
||||
whoPl_IP : IP ;
|
||||
whoSg_IP : IP ;
|
||||
why_IAdv : IAdv ;
|
||||
with_Prep : Prep ;
|
||||
without_Prep : Prep ;
|
||||
yes_Phr : Phr ;
|
||||
youSg_Pron : Pron ;
|
||||
youPl_Pron : Pron ;
|
||||
youPol_Pron : Pron ;
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
--1 Text: Texts
|
||||
|
||||
-- Texts are built from an empty text by adding $Phr$ases,
|
||||
-- using as constructors the punctuation marks ".", "?", and "!".
|
||||
-- Any punctuation mark can be attached to any kind of phrase.
|
||||
|
||||
abstract Text = Common ** {
|
||||
|
||||
fun
|
||||
TEmpty : Text ; --
|
||||
TFullStop : Phr -> Text -> Text ; -- John walks. ...
|
||||
TQuestMark : Phr -> Text -> Text ; -- Are you OK? ...
|
||||
TExclMark : Phr -> Text -> Text ; -- John walks! ...
|
||||
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
--1 The construction of verb phrases
|
||||
|
||||
abstract Verb = Cat ** {
|
||||
|
||||
--2 Complementization rules
|
||||
|
||||
-- Verb phrases are constructed from verbs by providing their
|
||||
-- complements. There is one rule for each verb category.
|
||||
|
||||
fun
|
||||
UseV : V -> VP ; -- sleep
|
||||
ComplV2 : V2 -> NP -> VP ; -- use it
|
||||
ComplV3 : V3 -> NP -> NP -> VP ; -- send a message to her
|
||||
|
||||
ComplVV : VV -> VP -> VP ; -- want to run
|
||||
ComplVS : VS -> S -> VP ; -- know that she runs
|
||||
ComplVQ : VQ -> QS -> VP ; -- ask if she runs
|
||||
|
||||
ComplVA : VA -> AP -> VP ; -- look red
|
||||
ComplV2A : V2A -> NP -> AP -> VP ; -- paint the house red
|
||||
|
||||
--2 Other ways of forming verb phrases
|
||||
|
||||
-- Verb phrases can also be constructed reflexively and from
|
||||
-- copula-preceded complements.
|
||||
|
||||
ReflV2 : V2 -> VP ; -- use itself
|
||||
UseComp : Comp -> VP ; -- be warm
|
||||
|
||||
-- Passivization of two-place verbs is another way to use
|
||||
-- them. In many languages, the result is a participle that
|
||||
-- is used as complement to a copula ("is used"), but other
|
||||
-- auxiliary verbs are possible (Ger. "wird angewendet", It.
|
||||
-- "viene usato"), as well as special verb forms (Fin. "käytetään",
|
||||
-- Swe. "används").
|
||||
--
|
||||
-- *Note*. the rule can be overgenerating, since the $V2$ need not
|
||||
-- take a direct object.
|
||||
|
||||
PassV2 : V2 -> VP ; -- be used
|
||||
|
||||
-- Adverbs can be added to verb phrases. Many languages make
|
||||
-- a distinction between adverbs that are attached in the end
|
||||
-- vs. next to (or before) the verb.
|
||||
|
||||
AdvVP : VP -> Adv -> VP ; -- sleep here
|
||||
AdVVP : AdV -> VP -> VP ; -- always sleep
|
||||
|
||||
-- *Agents of passives* are constructed as adverbs with the
|
||||
-- preposition [Structural Structural.html]$.8agent_Prep$.
|
||||
|
||||
|
||||
--2 Complements to copula
|
||||
|
||||
-- Adjectival phrases, noun phrases, and adverbs can be used.
|
||||
|
||||
CompAP : AP -> Comp ; -- (be) small
|
||||
CompNP : NP -> Comp ; -- (be) a soldier
|
||||
CompAdv : Adv -> Comp ; -- (be) here
|
||||
|
||||
--2 Coercions
|
||||
|
||||
-- Verbs can change subcategorization patterns in systematic ways,
|
||||
-- but this is very much language-dependent. The following two
|
||||
-- work in all the languages we cover.
|
||||
|
||||
UseVQ : VQ -> V2 ; -- ask (a question)
|
||||
UseVS : VS -> V2 ; -- know (a secret)
|
||||
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
concrete AdjectiveAra of Adjective = CatAra ** open ResAra, Prelude in {
|
||||
|
||||
lin
|
||||
|
||||
PositA a = {
|
||||
s =
|
||||
table {
|
||||
Hum => a.s ;
|
||||
NoHum => \\g,n =>
|
||||
case n of {
|
||||
Pl => a.s ! Fem ! Sg ;
|
||||
_ => a.s ! g ! n
|
||||
}
|
||||
}
|
||||
};
|
||||
-- ComparA a np = {
|
||||
-- s = \\_ => a.s ! AAdj Compar ++ "تهَن" ++ np.s ! Nom ;
|
||||
-- isPre = False
|
||||
-- } ;
|
||||
--
|
||||
---- $SuperlA$ belongs to determiner syntax in $Noun$.
|
||||
--
|
||||
-- ComplA2 a np = {
|
||||
-- s = \\_ => a.s ! AAdj Posit ++ a.c2 ++ np.s ! Acc ;
|
||||
-- isPre = False
|
||||
-- } ;
|
||||
--
|
||||
-- ReflA2 a = {
|
||||
-- s = \\ag => a.s ! AAdj Posit ++ a.c2 ++ reflPron ! ag ;
|
||||
-- isPre = False
|
||||
-- } ;
|
||||
--
|
||||
-- SentAP ap sc = {
|
||||
-- s = \\a => ap.s ! a ++ sc.s ;
|
||||
-- isPre = False
|
||||
-- } ;
|
||||
--
|
||||
-- AdAP ada ap = {
|
||||
-- s = \\a => ada.s ++ ap.s ! a ;
|
||||
-- isPre = ap.isPre
|
||||
-- } ;
|
||||
--
|
||||
-- UseA2 a = a ;
|
||||
--
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
concrete AdverbAra of Adverb = CatAra ** open ResAra, Prelude in {
|
||||
--
|
||||
-- lin
|
||||
-- PositAdvAdj a = {s = a.s ! AAdv} ;
|
||||
-- ComparAdvAdj cadv a np = {
|
||||
-- s = cadv.s ++ a.s ! AAdv ++ "تهَن" ++ np.s ! Nom
|
||||
-- } ;
|
||||
-- ComparAdvAdjS cadv a s = {
|
||||
-- s = cadv.s ++ a.s ! AAdv ++ "تهَن" ++ s.s
|
||||
-- } ;
|
||||
--
|
||||
-- PrepNP prep np = {s = prep.s ++ np.s ! Acc} ;
|
||||
--
|
||||
-- AdAdv = cc2 ;
|
||||
--
|
||||
-- SubjS = cc2 ;
|
||||
-- AdvSC s = s ; --- this rule give stack overflow in ordinary parsing
|
||||
--
|
||||
-- AdnCAdv cadv = {s = cadv.s ++ "تهَن"} ;
|
||||
--
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lincat
|
||||
|
||||
-- Phrase
|
||||
|
||||
Utt = {s : Gender => Str};
|
||||
-- Voc = {s : Str} ;
|
||||
|
||||
-- Tensed/Untensed
|
||||
|
||||
S = {s : Str} ;
|
||||
QS = {s : QForm => Str} ;
|
||||
-- RS = {s : Agr => Str} ;
|
||||
|
||||
-- Sentence
|
||||
|
||||
Cl = {s : ResAra.Tense => Polarity => Order => Str} ;
|
||||
-- Slash = {s : Tense => Anteriority => Polarity => Order => Str} ** {c2 : Str} ;
|
||||
Imp = {s : Polarity => Gender => ResAra.Number => Str} ;
|
||||
|
||||
-- Question
|
||||
|
||||
QCl = {s : ResAra.Tense => Polarity => QForm => Str} ;
|
||||
IP = {s : Str ; n : ResAra.Number} ;
|
||||
-- IAdv = {s : Str} ;
|
||||
-- IDet = {s : Str ; n : ResAra.Number} ;
|
||||
--
|
||||
---- Relative
|
||||
--
|
||||
-- RCl = {s : Tense => Anteriority => Polarity => Agr => Str} ;
|
||||
-- RP = {s : Case => Str ; a : RAgr} ;
|
||||
--
|
||||
-- Verb
|
||||
--
|
||||
{-
|
||||
VP = {
|
||||
s : Tense => Polarity => Order => Agr => Str;
|
||||
comp : NP
|
||||
};
|
||||
-}
|
||||
VP = ResAra.VP ;
|
||||
Comp = ResAra.Comp ; --{s : AAgr => Case => Str} ;
|
||||
-- SC = {s : Str} ;
|
||||
--
|
||||
-- Adjective
|
||||
|
||||
AP = {s : Species => Gender => NTable } ;
|
||||
|
||||
-- Noun
|
||||
|
||||
CN = ResAra.Noun;
|
||||
NP, Pron = ResAra.NP; --{s : Case => Str ; a : Agr } ;
|
||||
Num, Ord = {s : Gender => State => Case => Str ;
|
||||
n : Size };
|
||||
Predet, QuantSg, QuantPl =
|
||||
{s : Species => Gender => Case => Str;
|
||||
n : ResAra.Number; d : State; isNum : Bool} ;
|
||||
Det = ResAra.Det ;
|
||||
-- {s : Species => Gender => Case => Str ; d : State; n : Size; isNum : Bool } ;
|
||||
Quant = {s : ResAra.Number => Species => Gender => Case => Str; d : State} ;
|
||||
|
||||
-- Adverb
|
||||
|
||||
-- Adv, AdV, AdA, AdS, AdN = {s : Str} ;
|
||||
|
||||
-- Numeral
|
||||
|
||||
Numeral = {s : Gender => State => Case => Str ;
|
||||
n : Size } ;
|
||||
|
||||
|
||||
---- Structural
|
||||
--
|
||||
Conj = {s : Str ; n : ResAra.Number} ;
|
||||
-- DConj = {s1,s2 : Str ; n : ResAra.Number} ;
|
||||
-- PConj = {s : Str} ;
|
||||
-- CAdv = {s : Str} ;
|
||||
-- Subj = {s : Str} ;
|
||||
Prep = {s : Str} ;
|
||||
--
|
||||
-- Open lexical classes, e.g. Lexicon
|
||||
|
||||
V, VS, VQ, VA = ResAra.Verb ; -- = {s : VForm => Str} ;
|
||||
V2, V2A = ResAra.Verb ** {c2 : Str} ;
|
||||
V3 = ResAra.Verb ** {c2, c3 : Str} ;
|
||||
-- VV = {s : VVForm => Str ; isAux : Bool} ;
|
||||
--
|
||||
A = ResAra.Adj ;
|
||||
A2 = ResAra.Adj ** {c2 : Str} ;
|
||||
--
|
||||
N, N2 = ResAra.Noun ; --{s : ResAra.Number => State => Case => Str; g : Gender ; h = Species} ;
|
||||
-- N2 = {s : ResAra.Number => Case => Str} ** {c2 : Str} ;
|
||||
N3 = ResAra.Noun ** {c2,c3 : Str} ;
|
||||
PN = {s : Case => Str} ;
|
||||
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
concrete ConjunctionAra of Conjunction =
|
||||
CatAra ** open ResAra, Coordination, Prelude in {
|
||||
--
|
||||
-- flags optimize=all_subs ;
|
||||
--
|
||||
-- lin
|
||||
--
|
||||
-- ConjS = conjunctSS ;
|
||||
-- DConjS = conjunctDistrSS ;
|
||||
--
|
||||
-- ConjAdv = conjunctSS ;
|
||||
-- DConjAdv = conjunctDistrSS ;
|
||||
--
|
||||
-- ConjNP conj ss = conjunctTable Case conj ss ** {
|
||||
-- a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p}
|
||||
-- } ;
|
||||
-- DConjNP conj ss = conjunctDistrTable Case conj ss ** {
|
||||
-- a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p}
|
||||
-- } ;
|
||||
--
|
||||
-- ConjAP conj ss = conjunctTable Agr conj ss ** {
|
||||
-- isPre = ss.isPre
|
||||
-- } ;
|
||||
-- DConjAP conj ss = conjunctDistrTable Agr conj ss ** {
|
||||
-- isPre = ss.isPre
|
||||
-- } ;
|
||||
--
|
||||
---- These fun's are generated from the list cat's.
|
||||
--
|
||||
-- BaseS = twoSS ;
|
||||
-- ConsS = consrSS comma ;
|
||||
-- BaseAdv = twoSS ;
|
||||
-- ConsAdv = consrSS comma ;
|
||||
-- BaseNP x y = twoTable Case x y ** {a = conjAgr x.a y.a} ;
|
||||
-- ConsNP xs x = consrTable Case comma xs x ** {a = conjAgr xs.a x.a} ;
|
||||
-- BaseAP x y = twoTable Agr x y ** {isPre = andB x.isPre y.isPre} ;
|
||||
-- ConsAP xs x = consrTable Agr comma xs x ** {isPre = andB xs.isPre x.isPre} ;
|
||||
--
|
||||
-- lincat
|
||||
-- [S] = {s1,s2 : Str} ;
|
||||
-- [Adv] = {s1,s2 : Str} ;
|
||||
-- [NP] = {s1,s2 : Case => Str ; a : Agr} ;
|
||||
-- [AP] = {s1,s2 : Agr => Str ; isPre : Bool} ;
|
||||
--
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
concrete ExtAra of ExtAraAbs = CatAra ** open ResAra in {
|
||||
--
|
||||
-- lincat
|
||||
--
|
||||
-- Aux = {s : Polarity => Str} ;
|
||||
--
|
||||
-- lin
|
||||
--
|
||||
-- PredAux np aux vp = mkClause (np.s ! Nom) np.a {
|
||||
-- s = \\t,ant,b,ord,agr =>
|
||||
-- let
|
||||
-- fin = aux.s ! b ;
|
||||
-- vf : Str -> Str -> {fin, inf : Str} = \x,y ->
|
||||
-- {fin = x ; inf = y} ;
|
||||
-- in
|
||||
-- case ant of {
|
||||
-- Simul => vf fin [] ;
|
||||
-- Anter => vf fin "هَثي"
|
||||
-- } ;
|
||||
-- s2 = \\agr => infVP vp agr
|
||||
-- } ;
|
||||
--
|
||||
-- can_Aux = {s = \\p => posneg p "عَن"} ; ---- cannt
|
||||
-- must_Aux = {s = \\p => posneg p "مُست"} ;
|
||||
--
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
concrete IdiomAra of Idiom = CatAra ** open Prelude, ResAra in {
|
||||
--
|
||||
-- flags optimize=all_subs ;
|
||||
--
|
||||
-- lin
|
||||
-- ExistNP np =
|
||||
-- mkClause "تهري" (agrP3 np.a.n) (insertObj (\\_ => np.s ! Acc) (predAux auxBe)) ;
|
||||
-- ImpersCl vp = mkClause "ِت" (agrP3 Sg) vp ;
|
||||
-- GenericCl vp = mkClause "ْني" (agrP3 Sg) vp ;
|
||||
--
|
||||
-- ProgrVP vp = insertObj (\\a => vp.ad ++ vp.prp ++ vp.s2 ! a) (predAux auxBe) ;
|
||||
--
|
||||
}
|
||||
|
||||
@@ -1,181 +0,0 @@
|
||||
--# -path=.:prelude:../abstract:../common
|
||||
--
|
||||
concrete IrregAra of IrregAraAbs = CatAra ** open ParadigmsAra in {
|
||||
--
|
||||
--flags optimize=values ;
|
||||
--
|
||||
-- lin
|
||||
-- awake_V = irregV "َوَكي" "َوْكي" "َوْكن" ;
|
||||
-- bear_V = irregV "بَر" "بْري" "بْرن" ;
|
||||
-- beat_V = irregV "بَت" "بَت" "بَت" ;
|
||||
-- become_V = irregV "بعْمي" "بعَمي" "بعْمي" ;
|
||||
-- begin_V = irregV "بغِن" "بغَن" "بغُن" ;
|
||||
-- bend_V = irregV "بند" "بنت" "بنت" ;
|
||||
-- beset_V = irregV "بست" "بست" "بست" ;
|
||||
-- bet_V = irregDuplV "بت" "بت" "بت" ;
|
||||
-- bid_V = irregDuplV "بِد" (variants {"بِد" ; "بَدي"}) (variants {"بِد" ; "بِدّن"}) ;
|
||||
-- bind_V = irregV "بِند" "بُْند" "بُْند" ;
|
||||
-- bite_V = irregV "بِتي" "بِت" "بِتّن" ;
|
||||
-- bleed_V = irregV "بلّد" "بلد" "بلد" ;
|
||||
-- blow_V = irregV "بلْو" "بلو" "بلْون" ;
|
||||
-- break_V = irregV "برَك" "برْكي" "برْكن" ;
|
||||
-- breed_V = irregV "برّد" "برد" "برد" ;
|
||||
-- bring_V = irregV "برِنغ" "برُْغهت" "برُْغهت" ;
|
||||
-- broadcast_V = irregV "برَْدعَست" "برَْدعَست" "برَْدعَست" ;
|
||||
-- build_V = irregV "بُِلد" "بُِلت" "بُِلت" ;
|
||||
-- burn_V = irregV "بُرن" (variants {"بُرند" ; "بُرنت"}) (variants {"بُرند" ; "بُرنت"}) ;
|
||||
-- burst_V = irregV "بُرست" "بُرست" "بُرست" ;
|
||||
-- buy_V = irregV "بُي" "بُْغهت" "بُْغهت" ;
|
||||
-- cast_V = irregV "عَست" "عَست" "عَست" ;
|
||||
-- catch_V = irregV "عَتعه" "عَُغهت" "عَُغهت" ;
|
||||
-- choose_V = irregV "عهّْسي" "عهْسي" "عهْسن" ;
|
||||
-- cling_V = irregV "علِنغ" "علُنغ" "علُنغ" ;
|
||||
-- come_V = irregV "عْمي" "عَمي" "عْمي" ;
|
||||
-- cost_V = irregV "عْست" "عْست" "عْست" ;
|
||||
-- creep_V = irregV "عرّة" "عرةت" "عرةت" ;
|
||||
-- cut_V = irregDuplV "عُت" "عُت" "عُت" ;
|
||||
-- deal_V = irregV "دَل" "دَلت" "دَلت" ;
|
||||
-- dig_V = irregDuplV "دِغ" "دُغ" "دُغ" ;
|
||||
-- dive_V = irregV "دِثي" (variants {"دِثد" ; "دْثي"}) "دِثد" ;
|
||||
-- do_V = mkV "دْ" "دْس" "دِد" "دْني" "دِْنغ" ;
|
||||
-- draw_V = irregV "درَو" "درو" "درَون" ;
|
||||
-- dream_V = irregV "درَم" (variants {"درَمد" ; "درَمت"}) (variants {"درَمد" ; "درَمت"}) ;
|
||||
-- drive_V = irregV "درِثي" "درْثي" "درِثن" ;
|
||||
-- drink_V = irregV "درِنك" "درَنك" "درُنك" ;
|
||||
-- eat_V = irregV "َت" "َتي" "َتن" ;
|
||||
-- fall_V = irregV "فَلّ" "فلّ" "فَلّن" ;
|
||||
-- feed_V = irregV "فّد" "فد" "فد" ;
|
||||
-- feel_V = irregV "فّل" "فلت" "فلت" ;
|
||||
-- fight_V = irregV "فِغهت" "فُْغهت" "فُْغهت" ;
|
||||
-- find_V = irregV "فِند" "فُْند" "فُْند" ;
|
||||
-- fit_V = irregDuplV "فِت" "فِت" "فِت" ;
|
||||
-- flee_V = irregV "فلّ" "فلد" "فلد" ;
|
||||
-- fling_V = irregV "فلِنغ" "فلُنغ" "فلُنغ" ;
|
||||
-- fly_V = irregV "فلي" "فلو" "فلْون" ;
|
||||
-- forbid_V = irregDuplV "فْربِد" "فْربَدي" "فْربِدّن" ;
|
||||
-- forget_V = irregDuplV "فْرغت" "فْرغْت" "فْرغْتّن" ;
|
||||
-- forgive_V = irregV "فْرغِثي" "فْرغَثي" "فْرغِثن" ;
|
||||
-- forsake_V = irregV "فْرسَكي" "فْرسّْك" "فْرسَكن" ;
|
||||
-- freeze_V = irregV "فرّزي" "فرْزي" "فرْزن" ;
|
||||
-- get_V = irregDuplV "غت" "غْت" "غْتّن" ;
|
||||
-- give_V = irregV "غِثي" "غَثي" "غِثن" ;
|
||||
-- go_V = irregV "غْ" "ونت" "غْني" ;
|
||||
-- grind_V = irregV "غرِند" "غرُْند" "غرُْند" ;
|
||||
-- grow_V = irregV "غرْو" "غرو" "غرْون" ;
|
||||
-- hang_V = irregV "هَنغ" "هُنغ" "هُنغ" ;
|
||||
-- have_V = mkV "هَثي" "هَس" "هَد" "هَد" "هَثِنغ" ;
|
||||
-- hear_V = irregV "هَر" "هَرد" "هَرد" ;
|
||||
-- hide_V = irregV "هِدي" "هِد" "هِدّن" ;
|
||||
-- hit_V = irregDuplV "هِت" "هِت" "هِت" ;
|
||||
-- hold_V = irregV "هْلد" "هلد" "هلد" ;
|
||||
-- hurt_V = irregV "هُرت" "هُرت" "هُرت" ;
|
||||
-- keep_V = irregV "كّة" "كةت" "كةت" ;
|
||||
-- kneel_V = irregV "كنّل" "كنلت" "كنلت" ;
|
||||
-- knit_V = irregDuplV "كنِت" "كنِت" "كنِت" ;
|
||||
-- know_V = irregV "كنْو" "كنو" "كنْو" ;
|
||||
-- lay_V = irregV "لَي" "لَِد" "لَِد" ;
|
||||
-- lead_V = irregV "لَد" "لد" "لد" ;
|
||||
-- leap_V = irregV "لَة" (variants {"لَةد" ; "لةت"}) (variants {"لَةد" ; "لةت"}) ;
|
||||
-- learn_V = irregV "لَرن" (variants {"لَرند" ; "لَرنت"}) (variants {"لَرند" ; "لَرنت"}) ;
|
||||
-- leave_V = irregV "لَثي" "لفت" "لفت" ;
|
||||
-- lend_V = irregV "لند" "لنت" "لنت" ;
|
||||
-- let_V = irregDuplV "لت" "لت" "لت" ;
|
||||
-- lie_V = irregV "لِي" "لَي" "لَِن" ;
|
||||
-- light_V = irregV "لِغهت" (variants {"لِغهتد" ; "لِت"}) "لِغهتد" ;
|
||||
-- lose_V = irregV "لْسي" "لْست" "لْست" ;
|
||||
-- make_V = irregV "مَكي" "مَدي" "مَدي" ;
|
||||
-- mean_V = irregV "مَن" "مَنت" "مَنت" ;
|
||||
-- meet_V = irregV "مّت" "مت" "مت" ;
|
||||
-- misspell_V = irregV "مِسّةلّ" (variants {"مِسّةلّد" ; "مِسّةلت"}) (variants {"مِسّةلّد" ; "مِسّةلت"}) ;
|
||||
-- mistake_V = irregV "مِستَكي" "مِستّْك" "مِستَكن" ;
|
||||
-- mow_V = irregV "مْو" "مْود" (variants {"مْود" ; "مْون"}) ;
|
||||
-- overcome_V = irregV "ْثرعْمي" "ْثرعَمي" "ْثرعْمي" ;
|
||||
-- overdo_V = mkV "ْثردْ" "ْثردْس" "ْثردِد" "ْثردْني" "ْثردِْنغ" ;
|
||||
-- overtake_V = irregV "ْثرتَكي" "ْثرتّْك" "ْثرتَكن" ;
|
||||
-- overthrow_V = irregV "ْثرتهرْو" "ْثرتهرو" "ْثرتهرْون" ;
|
||||
-- pay_V = irregV "ةَي" "ةَِد" "ةَِد" ;
|
||||
-- plead_V = irregV "ةلَد" "ةلد" "ةلد" ;
|
||||
-- prove_V = irregV "ةرْثي" "ةرْثد" (variants {"ةرْثد" ; "ةرْثن"}) ;
|
||||
-- put_V = irregDuplV "ةُت" "ةُت" "ةُت" ;
|
||||
-- quit_V = irregDuplV "قُِت" "قُِت" "قُِت" ;
|
||||
-- read_V = irregV "رَد" "رَد" "رَد" ;
|
||||
-- rid_V = irregDuplV "رِد" "رِد" "رِد" ;
|
||||
-- ride_V = irregV "رِدي" "رْدي" "رِدّن" ;
|
||||
-- ring_V = irregV "رِنغ" "رَنغ" "رُنغ" ;
|
||||
-- rise_V = irregV "رِسي" "رْسي" "رِسن" ;
|
||||
-- run_V = irregDuplV "رُن" "رَن" "رُن" ;
|
||||
-- saw_V = irregV "سَو" "سَود" (variants {"سَود" ; "سَون"}) ;
|
||||
-- say_V = irregV "سَي" "سَِد" "سَِد" ;
|
||||
-- see_V = irregV "سّ" "سَو" "سّن" ;
|
||||
-- seek_V = irregV "سّك" "سُْغهت" "سُْغهت" ;
|
||||
-- sell_V = irregV "سلّ" "سْلد" "سْلد" ;
|
||||
-- send_V = irregV "سند" "سنت" "سنت" ;
|
||||
-- set_V = irregDuplV "ست" "ست" "ست" ;
|
||||
-- sew_V = irregV "سو" "سود" (variants {"سود" ; "سون"}) ;
|
||||
-- shake_V = irregV "سهَكي" "سهّْك" "سهَكن" ;
|
||||
-- shave_V = irregV "سهَثي" "سهَثد" (variants {"سهَثد" ; "سهَثن"}) ;
|
||||
-- shear_V = irregV "سهَر" "سهْري" "سهْرن" ;
|
||||
-- shed_V = irregDuplV "سهد" "سهد" "سهد" ;
|
||||
-- shine_V = irregV "سهِني" "سهْني" "سهْني" ;
|
||||
-- shoe_V = irregV "سهْي" "سهْد" (variants {"سهْد" ; "سهْد"}) ;
|
||||
-- shoot_V = irregV "سهّْت" "سهْت" "سهْت" ;
|
||||
-- show_V = irregV "سهْو" "سهْود" (variants {"سهْود" ; "سهْون"}) ;
|
||||
-- shrink_V = irregV "سهرِنك" "سهرَنك" "سهرُنك" ;
|
||||
-- shut_V = irregDuplV "سهُت" "سهُت" "سهُت" ;
|
||||
-- sing_V = irregV "سِنغ" "سَنغ" "سُنغ" ;
|
||||
-- sink_V = irregV "سِنك" "سَنك" "سُنك" ;
|
||||
-- sit_V = irregDuplV "سِت" "سَت" "سَت" ;
|
||||
-- sleep_V = irregV "سلّة" "سلةت" "سلةت" ;
|
||||
-- slay_V = irregV "سلَي" "سلو" "سلَِن" ;
|
||||
-- slide_V = irregV "سلِدي" "سلِد" "سلِد" ;
|
||||
-- sling_V = irregV "سلِنغ" "سلُنغ" "سلُنغ" ;
|
||||
-- slit_V = irregDuplV "سلِت" "سلِت" "سلِت" ;
|
||||
-- smite_V = irregV "سمِتي" "سمْتي" "سمِتّن" ;
|
||||
-- sow_V = irregV "سْو" "سْود" (variants {"سْود" ; "سْون"}) ;
|
||||
-- speak_V = irregV "سةَك" "سةْكي" "سةْكن" ;
|
||||
-- speed_V = irregV "سةّد" "سةد" "سةد" ;
|
||||
-- spend_V = irregV "سةند" "سةنت" "سةنت" ;
|
||||
-- spill_V = irregV "سةِلّ" (variants {"سةِلّد" ; "سةِلت"}) (variants {"سةِلّد" ; "سةِلت"}) ;
|
||||
-- spin_V = irregDuplV "سةِن" "سةُن" "سةُن" ;
|
||||
-- spit_V = irregDuplV "سةِت" (variants {"سةِت" ; "سةَت"}) "سةِت" ;
|
||||
-- split_V = irregDuplV "سةلِت" "سةلِت" "سةلِت" ;
|
||||
-- spread_V = irregV "سةرَد" "سةرَد" "سةرَد" ;
|
||||
-- spring_V = irregV "سةرِنغ" (variants {"سةرَنغ" ; "سةرُنغ"}) "سةرُنغ" ;
|
||||
-- stand_V = irregV "ستَند" "ستّْد" "ستّْد" ;
|
||||
-- steal_V = irregV "ستَل" "ستْلي" "ستْلن" ;
|
||||
-- stick_V = irregV "ستِعك" "ستُعك" "ستُعك" ;
|
||||
-- sting_V = irregV "ستِنغ" "ستُنغ" "ستُنغ" ;
|
||||
-- stink_V = irregV "ستِنك" "ستَنك" "ستُنك" ;
|
||||
-- stride_V = irregV "سترِدي" "سترْد" "سترِدّن" ;
|
||||
-- strike_V = irregV "سترِكي" "سترُعك" "سترُعك" ;
|
||||
-- string_V = irregV "سترِنغ" "سترُنغ" "سترُنغ" ;
|
||||
-- strive_V = irregV "سترِثي" "سترْثي" "سترِثن" ;
|
||||
-- swear_V = irregV "سوَر" "سوْري" "سوْرن" ;
|
||||
-- sweep_V = irregV "سوّة" "سوةت" "سوةت" ;
|
||||
-- swell_V = irregV "سولّ" "سولّد" (variants {"سولّد" ; "سوْلّن"}) ;
|
||||
-- swim_V = irregDuplV "سوِم" "سوَم" "سوُم" ;
|
||||
-- swing_V = irregV "سوِنغ" "سوُنغ" "سوُنغ" ;
|
||||
-- take_V = irregV "تَكي" "تّْك" "تَكن" ;
|
||||
-- teach_V = irregV "تَعه" "تَُغهت" "تَُغهت" ;
|
||||
-- tear_V = irregV "تَر" "تْري" "تْرن" ;
|
||||
-- tell_V = irregV "تلّ" "تْلد" "تْلد" ;
|
||||
-- think_V = irregV "تهِنك" "تهُْغهت" "تهُْغهت" ;
|
||||
-- thrive_V = irregV "تهرِثي" (variants {"تهرِثد" ; "تهرْثي"}) "تهرِثد" ;
|
||||
-- throw_V = irregV "تهرْو" "تهرو" "تهرْون" ;
|
||||
-- thrust_V = irregV "تهرُست" "تهرُست" "تهرُست" ;
|
||||
-- tread_V = irregV "ترَد" "ترْد" "ترْدّن" ;
|
||||
-- understand_V = irregV "ُندرستَند" "ُندرستّْد" "ُندرستّْد" ;
|
||||
-- uphold_V = irregV "ُةهْلد" "ُةهلد" "ُةهلد" ;
|
||||
-- upset_V = irregDuplV "ُةست" "ُةست" "ُةست" ;
|
||||
-- wake_V = irregV "وَكي" "وْكي" "وْكن" ;
|
||||
-- wear_V = irregV "وَر" "وْري" "وْرن" ;
|
||||
-- weave_V = irregV "وَثي" (variants {"وَثد" ; "وْثي"}) (variants {"وَثد" ; "وْثن"}) ;
|
||||
-- wed_V = irregDuplV "ود" "ود" "ود" ;
|
||||
-- weep_V = irregV "وّة" "وةت" "وةت" ;
|
||||
-- wind_V = irregV "وِند" "وُْند" "وُْند" ;
|
||||
-- win_V = irregDuplV "وِن" "وْن" "وْن" ;
|
||||
-- withhold_V = irregV "وِتهّْلد" "وِتهّلد" "وِتهّلد" ;
|
||||
-- withstand_V = irregV "وِتهستَند" "وِتهستّْد" "وِتهستّْد" ;
|
||||
-- wring_V = irregV "ورِنغ" "ورُنغ" "ورُنغ" ;
|
||||
-- write_V = irregV "ورِتي" "ورْتي" "ورِتّن" ;
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
--# -path=.:../abstract:../common:prelude
|
||||
|
||||
concrete LangAra of Lang =
|
||||
NounAra,
|
||||
VerbAra,
|
||||
AdjectiveAra,
|
||||
AdverbAra,
|
||||
NumeralAra,
|
||||
SentenceAra,
|
||||
QuestionAra,
|
||||
RelativeAra,
|
||||
ConjunctionAra,
|
||||
PhraseAra,
|
||||
TextX - [Utt],
|
||||
StructuralAra,
|
||||
IdiomAra,
|
||||
LexiconAra
|
||||
** {
|
||||
|
||||
flags startcat = Phr ; unlexer = text ; lexer = text ;
|
||||
|
||||
} ;
|
||||
@@ -1,360 +0,0 @@
|
||||
--# -path=.:prelude
|
||||
--
|
||||
concrete LexiconAra of Lexicon = CatAra ** open
|
||||
ParadigmsAra,
|
||||
ResAra,
|
||||
MorphoAra, --shouldn't open it here, only needed reg &sndf
|
||||
Prelude in {
|
||||
|
||||
flags
|
||||
optimize=values ;
|
||||
|
||||
lin
|
||||
|
||||
airplane_N = sdfN "ط؟ر" "فاعِلة" Fem NoHum ;
|
||||
answer_V2S = dirV2 (v3 "جوب") ;
|
||||
apartment_N = regN "شقّ" "فِعّة" "فِعَل" Fem NoHum ;
|
||||
apple_N = sdfN "تفح" "فِعّالة" Fem NoHum ;
|
||||
art_N = regN "فنّ" "فَعّ" "فُعُول" Masc NoHum ;
|
||||
ask_V2Q = dirV2 (v1 "س؟ل" a a) ;
|
||||
baby_N = regN "طفل" "فِعل" "أَفعال" Masc Hum;
|
||||
bad_A = regA "سي؟" "فَعِّل" ;
|
||||
bank_N = regN "بنك" "فَعل" "فُعُول" Masc NoHum ;
|
||||
beautiful_A = regA "جمل" "فَعِيل" ;
|
||||
become_VA = mkVA (v4 "صبح") ;
|
||||
beer_N = sdfN "بير" "فِعلة" Fem NoHum ;
|
||||
beg_V2V = dirV2 (v5 "وسل") ;
|
||||
big_A = regA "كبر" "فَعِيل" ;
|
||||
bike_N = sdfN "درج" "فَعّالة" Fem NoHum ;
|
||||
bird_N = regN "طير" "فَعل" "فُعُول" Masc NoHum;
|
||||
black_A = clrA "سود" ;
|
||||
blue_A = clrA "زرق" ;
|
||||
boat_N = regN "قرب" "فاعِل" "فَواعِل" Masc NoHum ;
|
||||
book_N = regN "كتب" "فِعال" "فُعُل" Masc NoHum ;
|
||||
boot_N = sdfN "جزم" "فَعلة" Fem NoHum ;
|
||||
boss_N = regN "دور" "مُفِيع" "مُفَعاء" Masc Hum ;
|
||||
boy_N = regN "صبي" "فَعِل" "فُعلان" Masc Hum ;
|
||||
bread_N = regN "خبز" "فُعل" "أَفعال" Masc NoHum ;
|
||||
break_V2 = dirV2 (v1 "كسر" a u) ;
|
||||
broad_A = regA "وسع" "فاعِل" ;
|
||||
brother_N2 = regN "؟خو" "فَع" "فِعلة" Masc Hum ; --FIXME
|
||||
brown_A = regA "بني" "فُعِّل";
|
||||
butter_N = sdfN "سبد" "فُعلة" Fem NoHum ;
|
||||
buy_V2 = dirV2 (v8 "شري") ;
|
||||
camera_N = sdfN "كمر" "فاعِيلا" Fem NoHum ; -- |Alö taSwIr
|
||||
cap_N = sdfN "قبع" "فُعَّلة" Fem NoHum ; --qalnUsö
|
||||
car_N = sdfN "سير" "فَعّالة" Fem NoHum ;
|
||||
carpet_N = sdfN "سجد" "فَعّالة" Fem NoHum ;
|
||||
cat_N = regN "هرّ" "فِعّة" "فِعَل" Fem NoHum ;
|
||||
ceiling_N = regN "سقف" "فَعل" "أَفعُل" Masc NoHum ;
|
||||
chair_N = regN "كرس" "فُعلِي" "فَعالِي" Masc NoHum ;
|
||||
cheese_N = regN "جبن" "فُعلة" "أَفعال" Fem NoHum ;
|
||||
child_N = regN "ولد" "فَعَل" "أَفعال" Masc Hum ;
|
||||
church_N = regN "كنس" "فَعِيلة" "فَعاٱِل" Fem Hum ;
|
||||
city_N = regN "مدن" "فَعِيلة" "فُعُل" Fem NoHum ;
|
||||
clean_A = regA "نظف" "فَعِيل" ;
|
||||
clever_A = regA "جهد" "مُفتَعِل" ;
|
||||
close_V2 = dirV2 (v4 "غلق") ;
|
||||
coat_N = regN "عطف" "مِفعَل" "مَفاعِل" Masc NoHum ;
|
||||
cold_A = regA "برد" "فاعِل" ;
|
||||
come_V = v1 "جي؟" a i ; --check
|
||||
computer_N = regN "حسب" "فاعُول" "فَواعِيل" Masc NoHum ;
|
||||
country_N = regN "بلد" "فَعَل" "فِعال" Masc NoHum ;
|
||||
cousin_N = regN "قرب" "فَعِيل" "أَفعِلاء" Masc Hum ; -- (<bn / bnt) (cam[ö] / xAl[ö])
|
||||
cow_N = sdfN "بقر" "فَعلة" Fem NoHum ;
|
||||
die_V = v1 "موت" a u ; --check
|
||||
dirty_A = regA "وسخ" "فَعِل" ;
|
||||
distance_N3 = mkN3 (sdfN "سوف" "مَفاعة" Fem NoHum) "مِن" "إِلَى" ;
|
||||
doctor_N = regN "طبّ" "فَعِيل" "أَفِعّاء" Masc Hum ;
|
||||
dog_N = regN "كلب" "فَعل" "فِعال" Masc NoHum ;
|
||||
door_N = regN "بوب" "فاع" "أَفعال" Masc NoHum ;
|
||||
drink_V2 = dirV2 (v1 "شرب" i a) ;
|
||||
easy_A2V = mkA2 (regA "سهل" "فَعل") "لِ" ;
|
||||
eat_V2 = dirV2 (v1 "؟كل" a u) ;
|
||||
empty_A = regA "فرج" "فاعِل" ;
|
||||
enemy_N = regN "عدو" "فَعُلّ" "أَفعاء" Masc Hum ;
|
||||
factory_N = regN "صنع" "مَفعَل" "مَفاعِل" Masc NoHum ;
|
||||
father_N2 = regN "؟ب" "فَع" "أَفعاء" Masc Hum;
|
||||
fear_VS = mkVS (v1 "خشي" i a );
|
||||
find_V2 = dirV2 (v1 "وجد" a i ) ;
|
||||
fish_N = regN "سمك" "فَعَلة" "أَفعال" Fem NoHum ;
|
||||
floor_N = regN "؟رض" "فَعل" "فَعالِي" Fem NoHum;
|
||||
forget_V2 = dirV2 (v1 "نسي" i a ) ;
|
||||
fridge_N = sdfN "برد" "فَعّال" Masc NoHum ;
|
||||
friend_N = regN "صدق" "فَعِيل" "أَفعِلاء" Masc Hum ; --SadIqö
|
||||
fruit_N = regN "فكه" "فاعِلة" "فَواعِل" Fem NoHum ;
|
||||
fun_AV = regA "متع" "مُفعِل" ;
|
||||
garden_N = regN "حدق" "فَعِيلة" "فَعاٱِل" Fem NoHum ;
|
||||
girl_N = regN "بنت" "فِعل" "فَعال" Fem Hum ;
|
||||
glove_N = sdfN "قفز" "فُعّال" Masc NoHum ;
|
||||
gold_N = sdfN "ذهب" "فَعَل" Masc NoHum ;
|
||||
good_A = regA "جود" "فَيِّع" ; -- Hasan, HisAn
|
||||
go_V = v1 "ذهب" a a ;
|
||||
green_A = clrA "خضر" ;
|
||||
harbour_N = regN "رف؟" "مَفعَل" "مَفاعِل" Masc NoHum ; --mInA', marsaY
|
||||
hate_V2 = dirV2 (v1 "كره" a i ) ;
|
||||
hat_N = sdfN "قبع" "فُعَّلة" Fem NoHum ;
|
||||
have_V2 = dirV2 (v1 "ملك" a i) ; --FIXME, have is PP in Arabic
|
||||
hear_V2 = dirV2 (v1 "سمع" i a) ;
|
||||
hill_N = regN "هضب" "فَعلة" "فِعال" Fem NoHum ; --tallö, rAbiyö
|
||||
hope_VS = mkVS (v1 "رجو" a u) ; --check
|
||||
horse_N = regN "حصن" "فِعال" "أَفعِلة" Masc NoHum ;
|
||||
hot_A = regA "سخن" "فاعِل" ; --HAr
|
||||
house_N = regN "بيت" "فَعل" "فُعُول" Masc NoHum ; --manzil
|
||||
important_A = regA "هيم" "فاعّ" ;
|
||||
industry_N = sdfN "صنع" "فِعالة" Fem NoHum ;
|
||||
iron_N = regN "حدّ" "فَعِيل" "فَعائِل" Masc NoHum ;
|
||||
king_N = regN "ملك" "فَعِل" "فُعُول" Masc Hum ;
|
||||
know_V2 = dirV2 (v1 "عرف" i a) ;
|
||||
lake_N = sdfN "بحر" "فُعَيلة" Fem NoHum ;
|
||||
lamp_N = regN "صبح" "مِفعال" "مَفاعِيل" Masc NoHum ; --qanDIl, fAnUs
|
||||
learn_V2 = dirV2 (v5 "علم") ;
|
||||
leather_N = regN "جلد" "فِعل" "فُعُول" Masc NoHum ;
|
||||
leave_V2 = dirV2 (v1 "ترك" a u) ;
|
||||
like_V2 = dirV2 (v1 "هوي" i a) ; --check
|
||||
listen_V2 = mkV2 (v8 "سمع") "إِلَى" ;
|
||||
live_V = v1 "عيش" a i ; --check
|
||||
long_A = regA "طول" "فَعِيل" ;
|
||||
lose_V2 = dirV2 (v1 "خسر" i a) ; --Dayyac, >aDAc
|
||||
love_N = regN "حبّ" "فُعّ" "فُعّ" Masc NoHum ; -- no plur
|
||||
love_V2 = dirV2 (v1 "حبّ" a i) ;
|
||||
man_N = regN "رجل" "فَعُل" "فِعال" Masc Hum ;
|
||||
married_A2 = mkA2 (regA "زوج" "مُتَفَعِّل") "مِن" ;
|
||||
meat_N = regN "لحم" "فَعلة" "فُعُول" Masc NoHum ;
|
||||
milk_N = regN "حلب" "فَعِيل" "فَعِيل" Masc NoHum ; --no plur
|
||||
moon_N = regN "قمر" "فَعَل" "أَفعال" Masc NoHum ;
|
||||
mother_N2 = sdfN "؟م" "فُعّ" Fem Hum ;
|
||||
mountain_N = regN "جبل" "فَعَل" "فِعال" Masc NoHum ;
|
||||
music_N = mkN (reg "مُوسِيقَى" "مُوسِيقَى") Fem NoHum ; --no plur
|
||||
narrow_A = regA "ضيق" "فَعِّل" ;
|
||||
new_A = regA "جدّ" "فَعِيل" ;
|
||||
newspaper_N = regN "صحف" "فَعِيلة" "فُعُل" Fem NoHum ;
|
||||
oil_N = regN "زيت" "فَعل" "فُعُول" Masc NoHum ;
|
||||
old_A = regA "قدم" "فَعِيل" ;
|
||||
open_V2 = dirV2 (v1 "فتح" a a ) ;
|
||||
paint_V2A = mkV2A (v1 "دهن" a u ) [] ;
|
||||
paper_N = regN "ورق" "فَعَلة" "أَفعال" Fem NoHum ;
|
||||
-- paris_PN = regPN "بارِيس" nonhuman ;
|
||||
peace_N = regN "سلم" "فَعال" "فَعال" Masc NoHum; --no plur
|
||||
pen_N = regN "قلم" "فَعَل" "أَفعال" Masc NoHum;
|
||||
planet_N = mkN (reg "كَوكَب" "كَواكِب") Masc NoHum ; -- quadriconsonantal
|
||||
plastic_N = mkN (sndf "بلاستِيك") Masc NoHum ;
|
||||
play_V2 = dirV2 (v1 "لعب" i a) ;
|
||||
policeman_N = sdmN "شرط" "فِعلِي" Masc Hum ;
|
||||
priest_N = regN "قسّ" "فِعِّيل" "أَفِعّة" Masc Hum ;
|
||||
probable_AS = mkAS (regA "مكن" "مُفعِل") ;
|
||||
queen_N = sdfN "ملك" "فَعِلة" Fem Hum ;
|
||||
radio_N = mkN (sndf "راديُو") Masc NoHum ;
|
||||
rain_V0 = mkV0 (v1 "مطر" a u) ;
|
||||
read_V2 = dirV2 (v1 "قر؟" a a ) ;
|
||||
red_A = clrA "حمر" ;
|
||||
religion_N = regN "دين" "فِعل" "أَفعال" Masc NoHum ;
|
||||
restaurant_N = regN "طعم" "مَفعَل" "مَفاعِل" Masc NoHum ;
|
||||
river_N = regN "نهر" "فَعل" "أَفعال" Masc NoHum ;
|
||||
rock_N = regN "صخر" "فَعلة" "فُعُول" Fem NoHum ;
|
||||
roof_N = regN "سطح" "فَعل" "أَفعُل" Masc NoHum ;
|
||||
rubber_N = regN "مطّ" "فَعّال" "فَعّال" Masc NoHum ; -- no hum
|
||||
run_V = v1 "ركض" a u ;
|
||||
say_VS = mkVS (v1 "قول" a u) ; --check
|
||||
school_N = regN "درس" "مَسفعَلة" "مَفاعِل" Masc NoHum ;
|
||||
science_N = regN "علم" "فِعل" "فُعُول" Masc NoHum ;
|
||||
sea_N = regN "بحر" "فَعل" "فُعُول" Masc NoHum ;
|
||||
seek_V2 = dirV2 (v1 "طلب" a u) ;
|
||||
see_V2 = dirV2 (v1 "ر؟ي" a a) ;
|
||||
sell_V3 = dirdirV3 (v1 "بيع" a i) ; --check
|
||||
send_V3 = dirdirV3 (v4 "رسل") ;
|
||||
sheep_N = regN "خرف" "فَعُول" "فِعال" Masc NoHum ;
|
||||
ship_N = regN "سفن" "فَعِيلة" "فُعُل" Fem NoHum ;
|
||||
shirt_N = regN "قمص" "فَعِيل" "فُعلان" Masc NoHum ;
|
||||
shoe_N = regN "حذو" "فِعاء" "أَفعِية" Masc NoHum ;
|
||||
shop_N = regN "تجر" "مَفعَل" "مَفاعِل" Masc NoHum ;
|
||||
short_A = regA "قصر" "فَعِيل" ;
|
||||
silver_N = regN "فضّ" "فِعّة" "فِعَل" Fem NoHum ;
|
||||
sister_N = regN "؟خو" "فُعت" "فَعَوات" Fem Hum ; --FIXME
|
||||
sleep_V = v1 "نوم" i a ; --check
|
||||
small_A = regA "صغر" "فَعِيل" ;
|
||||
snake_N = sdfN "حيّ" "فَعّة" Fem NoHum ;
|
||||
sock_N = regN "جرب" "فَوعَل" "فَواعِل" Masc NoHum ;
|
||||
speak_V2 = dirV2 (v5 "كلم") ;
|
||||
star_N = regN "نجم" "فَعل" "فُعُول" Masc NoHum ; --najmö
|
||||
steel_N = regN "فلذ" "فُوعال" "فَواعِل" Masc NoHum ;
|
||||
stone_N = regN "حجر" "فَعَل" "أَفعال" Masc NoHum ;
|
||||
stove_N = regN "وقد" "مَفعِل" "مَفاعِل" Masc NoHum ;
|
||||
student_N = regN "طلب" "فاعِل" "فُعّال" Masc Hum ; --tilmI*
|
||||
stupid_A = clrA "بله" ;
|
||||
sun_N = regN "شمس" "فَعل" "فُعُول" Fem NoHum ;
|
||||
switch8off_V2 = dirV2 (v4 "طف؟") ;
|
||||
switch8on_V2 = dirV2 (v4 "شعل") ;
|
||||
table_N = sdfN "طول" "فاعِلة" Fem NoHum ;
|
||||
talk_V3 = mkV3 (v5 "حدث") "لِ" "عَن" ;
|
||||
teacher_N = sdmN "علم" "مُفَعِّل" Masc Hum ; --mucal~imö
|
||||
teach_V2 = dirV2 (v2 "علم") ;
|
||||
television_N = mkN (sndf "تِلِفِزيُون") Masc NoHum ;
|
||||
thick_A = regA "سمك" "فَعِيل" ;
|
||||
thin_A = regA "رفع" "فَعِيل" ;
|
||||
train_N = sdfN "قطر" "فِعال" Masc NoHum;
|
||||
travel_V = v3 "سفر" ;
|
||||
tree_N = regN "شجر" "فَعلة" "أَفعال" Fem NoHum ;
|
||||
ugly_A = regA "قبح" "فَعِيل" ;
|
||||
understand_V2 = dirV2 (v1 "فهم" i a ) ;
|
||||
university_N = sdfN "جمع" "فاعِلة" Fem NoHum ;
|
||||
village_N = regN "قري" "فَعلة" "فُعَى" Fem NoHum ; --Daycö
|
||||
wait_V2 = dirV2 (v8 "نظر") ;
|
||||
walk_V = v1 "مشي" a i ; --check
|
||||
warm_A = regA "دف؟" "فاعِل" ;
|
||||
war_N = regN "حرب" "فَعل" "فُعُول" Fem NoHum ;
|
||||
watch_V2 = dirV2 (v3 "شهد") ;
|
||||
water_N = mkN (reg "ماء" "مِياه") Fem NoHum ; --"موه" "فاء" "فِياع" ??
|
||||
white_A = clrA "بيض" ;
|
||||
window_N = regN "نفذ" "فاعِلة" "فَواعِل" Fem NoHum ; --$ub~Ak
|
||||
wine_N = regN "خمر" "فَعل" "فُعُول" Masc NoHum ;
|
||||
win_V2 = dirV2 (v1 "ربح" a i) ;
|
||||
woman_N = mkN (reg "إِمرَأَة" "نِسوَة") Fem Hum ;
|
||||
wonder_VQ = mkVQ (v6 "س؟ل") ;
|
||||
wood_N = regN "خشب" "فَعَل" "أَفعال" Masc NoHum ;
|
||||
write_V2 = dirV2 (v1 "كتب" a u) ;
|
||||
yellow_A = clrA "صفر" ;
|
||||
young_A = regA "شبّ" "فاعّ" ;
|
||||
|
||||
do_V2 = dirV2 (v1 "فعل" a a ) ;
|
||||
now_Adv = mkAdv "الآن" ;
|
||||
already_Adv = mkAdv "سابِقاً" ;
|
||||
song_N = regN "غني" "أَفعِلة" "أَفاعِي" Fem NoHum ;
|
||||
add_V3 = dirV3 (v1 "جمع" a a) "وَ" ;
|
||||
number_N = regN "رقم" "فَعل" "أَفعال" Masc NoHum ; --cadad
|
||||
put_V2 = dirV2 (v1 "وضع" a a );
|
||||
stop_V = v5 "وقف" ;
|
||||
jump_V = v1 "قفز" a i ;
|
||||
|
||||
left_Ord = mkOrd "أَيسَر" "يُسرَى";
|
||||
right_Ord = mkOrd "أَيمَن" "يُمنَى" ;
|
||||
|
||||
far_Adv = mkAdv "بَعِيداً" ;
|
||||
correct_A = regA "صحّ" "فَعِيل" ;
|
||||
dry_A = regA "نشف" "فاعِل" ;
|
||||
dull_A = regA "بهت" "فاعِل" ;
|
||||
full_A = regA "مل؟" "فَعِيل" ;
|
||||
heavy_A = regA "ثقل" "فَعِيل" ;
|
||||
near_A = regA "قرب" "فَعِيل" ;
|
||||
rotten_A = regA "فسد" "فاعِل" ;
|
||||
round_A = regA "دور" "مُفَعَّل" ;
|
||||
sharp_A = regA "حدّ" "فاعّ" ;
|
||||
smooth_A = regA "نعم" "فاعِل" ;
|
||||
straight_A = regA "قوم" "مُستَفِيع" ;
|
||||
wet_A = regA "رطب" "فَعِل" ;
|
||||
wide_A = regA "وسع" "فاعِل" ;
|
||||
|
||||
animal_N = sdfN "حيّ" "فَعَوان" Masc NoHum ;
|
||||
ashes_N = regN "رمد" "فَعال" "أَفعِلة" Masc NoHum;
|
||||
back_N = regN "ظهر" "فَعل" "فُعُول" Masc NoHum;
|
||||
bark_N = regN "نبح" "فَعل" "فُعال" Masc NoHum;
|
||||
belly_N = regN "بطن" "فَعل" "فُعُول" Fem NoHum;
|
||||
blood_N = regN "دم" "فَع" "فِعاء" Masc NoHum;
|
||||
bone_N = regN "عظم" "فَعلة" "فِعال" Fem NoHum;
|
||||
breast_N = regN "صدر" "فَعل" "فُعُول" Masc NoHum;
|
||||
cloud_N = regN "غيم" "فَعلة" "فُعُول" Fem NoHum;
|
||||
day_N = regN "يوم" "فَعل" "أَفّاع" Masc NoHum;
|
||||
dust_N = regN "غبر" "فُعال" "أَفعِلة" Masc NoHum;
|
||||
ear_N = regN "؟ذن" "فُعل" "أَفعال" Fem NoHum;
|
||||
earth_N = regN "ترب" "فُعلة" "فُعَل" Fem NoHum;
|
||||
egg_N = sdfN "بيض" "فَعلة" Fem NoHum;
|
||||
eye_N = regN "عين" "فَعل" "فُعُول" Fem NoHum;
|
||||
fat_N = regN "دهن" "فُعل" "فُعُول" Masc NoHum ;
|
||||
feather_N = sdfN "ريش" "فِعلة" Fem NoHum;
|
||||
fingernail_N = regN "ظفر" "فُعل" "أَفاعِل" Masc NoHum;
|
||||
fire_N = regN "نور" "فاع" "فِيعان" Fem NoHum;
|
||||
flower_N = regN "زهر" "فَعلة" "فُعُول" Fem NoHum;
|
||||
fog_N = regN "ضبّ" "فَعال" "فَعال" Masc NoHum; --no plural ?
|
||||
foot_N = regN "قدم" "فَعَل" "أَفعال" Fem NoHum;
|
||||
forest_N = sdfN "غيب" "فاعة" Fem NoHum;
|
||||
grass_N = regN "عشب" "فُعلة" "أَفعال" Fem NoHum;
|
||||
guts_N = regN "حشو" "فَعا" "أَفعاء" Fem NoHum;
|
||||
hair_N = sdfN "شعر" "فَعلة" Fem NoHum ;
|
||||
hand_N = regN "يد" "فَع" "أَفاعِي" Fem NoHum ;
|
||||
head_N = regN "ر؟س" "فَعل" "فُعُول" Masc NoHum;
|
||||
heart_N = regN "قلب" "فَعل" "فُعُول" Masc NoHum;
|
||||
horn_N = regN "قرن" "فَعل" "فُعُول" Masc NoHum;
|
||||
husband_N = regN "زوج" "فَعل" "أَفعال" Masc NoHum;
|
||||
ice_N = regN "ثلج" "فَعل" "فُعُول" Masc NoHum;
|
||||
knee_N = regN "ركب" "فُعلة" "فُعَل" Fem NoHum;
|
||||
leaf_N = regN "ورق" "فَعَلة" "أَفعال" Fem NoHum;
|
||||
leg_N = regN "رجل" "فِعل" "أَفعُل" Fem NoHum;
|
||||
liver_N = regN "كبد" "فَعِل" "أَفعال" Masc NoHum ;
|
||||
louse_N = sdfN "قمل" "فَعلة" Fem NoHum;
|
||||
mouth_N = regN "فوه" "فُعل" "أَفعال" Masc NoHum ;
|
||||
name_N = regN "؟سم" "فِعل" "فَعالِي" Masc NoHum;
|
||||
neck_N = regN "رقب" "فَعَلة" "فِعال" Fem NoHum;
|
||||
night_N = regN "ليل" "فَعلة" "فَعالِي" Fem NoHum; --plural?
|
||||
nose_N = regN "؟نف" "فَعل" "فُعُول" Masc NoHum;
|
||||
person_N = regN "شخص" "فَعل" "أَفعال" Masc Hum;
|
||||
rain_N = regN "مطر" "فَعَل" "أَفعال" Masc NoHum;
|
||||
road_N = regN "طرق" "فَعِيل" "فُعُل" Fem NoHum;
|
||||
root_N = regN "جذر" "فَعل" "فُعُول" Masc NoHum ;
|
||||
rope_N = regN "حبل" "فَعل" "فِعال" Masc NoHum;
|
||||
salt_N = regN "ملح" "فِعل" "أَفعال" Masc NoHum;
|
||||
sand_N = regN "رمل" "فَعل" "فِعال" Masc NoHum;
|
||||
seed_N = regN "بذر" "فَعل" "فُعُول" Masc NoHum;
|
||||
skin_N = regN "جلد" "فِعل" "فُعُول" Masc NoHum;
|
||||
sky_N = sdfN "سمو" "فَعاء" Fem NoHum;
|
||||
smoke_N = regN "دخن" "فُعال" "أَفعِلة" Masc NoHum;
|
||||
snow_N = regN "ثلج" "فَعل" "فُعُول" Masc NoHum;
|
||||
stick_N = regN "عصو" "فَعا" "فِعِي" Masc NoHum ; --"عصو"
|
||||
tail_N = regN "ذنب" "فَعَل" "أَفعال" Masc NoHum;
|
||||
tongue_N = regN "لسن" "فِعال" "أَفعِلة" Masc NoHum;
|
||||
tooth_N = regN "سنّ" "فِعل" "أَفعال" Masc NoHum ;
|
||||
wife_N = sdfN "زوج" "فَعلة" Fem Hum;
|
||||
wind_N = regN "ريح" "فِعل" "فِعال" Fem NoHum;
|
||||
wing_N = regN "جنح" "فَعال" "أَفعِلة" Masc NoHum ;
|
||||
worm_N = regN "دود" "فُعلة" "فِيعان" Fem NoHum ;
|
||||
year_N = sdfN "سن" "فَعة" Fem NoHum ;
|
||||
|
||||
blow_V = v1 "نفخ" a u ;
|
||||
breathe_V = dirV2 (v5 "نفس") ;
|
||||
burn_V = v1 "حرق" a i ;
|
||||
dig_V = v1 "حفر" a i ;
|
||||
fall_V = v1 "وقع" a a ;
|
||||
float_V = v1 "عوم" a u ;
|
||||
flow_V = v1 "سيل" a i ;
|
||||
fly_V = v1 "طير" a i ;
|
||||
freeze_V = v2 "جمد" ;
|
||||
give_V3 = dirdirV3 (v4 "عطي") ;
|
||||
laugh_V = v1 "ضحك" i a ;
|
||||
lie_V = v1 "كذب" a i ;
|
||||
play_V = v1 "لعب" i a ;
|
||||
sew_V = v1 "خيط" a i ;
|
||||
sing_V = v2 "غني" ;
|
||||
sit_V = v1 "قعد" a u ;
|
||||
smell_V = v1 "شمّ" i a ;
|
||||
spit_V = v1 "بصق" a u ;
|
||||
stand_V = v1 "وقف" a i ;
|
||||
swell_V = v8 "نفخ" ;
|
||||
swim_V = v1 "سبح" a a ;
|
||||
think_V = v2 "فكر" ;
|
||||
turn_V = v1 "برم" a u ;
|
||||
vomit_V = v5 "قي؟" ;
|
||||
|
||||
bite_V2 = dirV2 ( v1 "عضّ" a a ) ;
|
||||
count_V2 = dirV2 (v1 "عدّ" a u) ;
|
||||
cut_V2 = dirV2 (v1 "قصّ" a u) ;
|
||||
fear_V2 = dirV2 (v1 "خوف" i a) ;
|
||||
fight_V2 = dirV2 (v3 "قتل") ;
|
||||
hit_V2 = dirV2 (v1 "ضرب" a i) ;
|
||||
hold_V2 = dirV2 (v1 "مسك" a i) ;
|
||||
hunt_V2 = dirV2 (v1 "صيد" a i) ;
|
||||
kill_V2 = dirV2 (v1 "قتل" a u) ;
|
||||
pull_V2 = dirV2 (v1 "سحب" a a) ;
|
||||
push_V2 = dirV2 (v1 "دفع" a a) ;
|
||||
rub_V2 = dirV2 ( v1 "فرك" a u ) ;
|
||||
scratch_V2 = dirV2 (v1 "خدش" a i) ;
|
||||
split_V2 = dirV2 ( v2 "قسم" ) ;
|
||||
squeeze_V2 = dirV2 (v1 "عصر" a i) ;
|
||||
stab_V2 = dirV2 ( v1 "طعن" a u) ;
|
||||
suck_V2 = dirV2 (v1 "مصّ" a u) ;
|
||||
throw_V2 = dirV2 (v1 "رمي" a i) ;
|
||||
tie_V2 = dirV2 (v1 "ربط" a u) ;
|
||||
wash_V2 = dirV2 ( v1 "غسل" a i ) ;
|
||||
wipe_V2 = dirV2 ( v1 "مسح" a a ) ;
|
||||
|
||||
-- other_A = regA "ْتهر" ;
|
||||
|
||||
} ;
|
||||
@@ -1,36 +0,0 @@
|
||||
resource MorphoAra = ResAra ** open Prelude in {
|
||||
|
||||
flags optimize = all ;--noexpand;
|
||||
|
||||
oper
|
||||
mkDet : Str -> Number -> State -> Det
|
||||
= \word,num,state ->
|
||||
{ s = \\_,_,c => word + vowel ! c ;
|
||||
n = numberToSize num;
|
||||
d = state;
|
||||
isNum = False
|
||||
};
|
||||
|
||||
mkQuantNum : Str -> Number -> State -> {
|
||||
s: Species => Gender => Case => Str; n: Number; d : State; isNum : Bool} =
|
||||
\waHid,num,state ->
|
||||
let waHida = waHid + "َة" in
|
||||
{ s = \\_,g,c =>
|
||||
let word =
|
||||
case g of {
|
||||
Masc => waHid;
|
||||
Fem => waHida
|
||||
} in Al ! state + word + dec1sg ! state ! c;
|
||||
n = num;
|
||||
d = state;
|
||||
isNum = True
|
||||
};
|
||||
|
||||
vowel : Case => Str =
|
||||
table {
|
||||
Nom => "ُ";
|
||||
Acc => "َ";
|
||||
Gen => "ِ"
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
concrete NounAra of Noun = CatAra ** open ResAra, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
|
||||
DetCN det cn =
|
||||
let {
|
||||
number = sizeToNumber det.n;
|
||||
determiner : Case -> Str = \c ->
|
||||
det.s ! cn.h ! (detGender cn.g det.n) ! c;
|
||||
noun : Case -> Str = \c ->
|
||||
cn.s ! number ! (nounState det.d number) ! (nounCase c det.n det.d)
|
||||
} in
|
||||
{ s = \\c =>
|
||||
case detAsAdj det.isNum det.n det.d of {
|
||||
False => determiner c ++ noun c;
|
||||
--FIXME use the adj -> cn -> cn rule from below instead of repeating code
|
||||
True => cn.s ! number ! det.d ! c ++ det.s ! cn.h ! cn.g ! c
|
||||
};
|
||||
a = { pgn = agrP3 cn.h cn.g number;
|
||||
isPron = False }
|
||||
};
|
||||
|
||||
-- UsePN pn = pn ** {a = agrP3 Sg} ;
|
||||
UsePron p = p ;
|
||||
--
|
||||
-- PredetNP pred np = {
|
||||
-- s = \\c => pred.s ++ np.s ! c ;
|
||||
-- a = np.a
|
||||
-- } ;
|
||||
|
||||
DetSg quant ord = {
|
||||
s = quant.s ; --++ ord.s
|
||||
n = One;
|
||||
d = quant.d;
|
||||
isNum = quant.isNum
|
||||
} ;
|
||||
|
||||
|
||||
DetPl quant num ord = {
|
||||
s = \\h,g,c =>
|
||||
quant.s ! h ! g ! c ++ num.s ! g ! (toDef quant.d num.n) ! c ;
|
||||
n = num.n;
|
||||
d = quant.d;
|
||||
isNum =
|
||||
case num.n of {
|
||||
None => False;
|
||||
_ => True
|
||||
};
|
||||
} ;
|
||||
|
||||
SgQuant quant = {s = quant.s ! Sg ; n = Sg; d = quant.d; isNum = False} ;
|
||||
PlQuant quant = {s = quant.s ! Pl ; n = Pl; d = quant.d; isNum = False} ;
|
||||
|
||||
|
||||
-- PossPron p = {s = \\_ => p.s ! Gen} ;
|
||||
|
||||
NoNum, NoOrd = {s = \\_,_,_ => [] ;
|
||||
n = None} ;
|
||||
|
||||
-- NumInt n = n ;
|
||||
-- OrdInt n = {s = n.s ++ "ته"} ; ---
|
||||
|
||||
NumNumeral numeral = numeral ;
|
||||
-- OrdNumeral numeral = {s = numeral.s ! NOrd} ;
|
||||
--
|
||||
-- AdNum adn num = {s = adn.s ++ num.s} ;
|
||||
--
|
||||
-- OrdSuperl a = {s = a.s ! AAdj Superl} ;
|
||||
--
|
||||
DefArt = {s = \\_,_,_,_ => []; d = Def } ;
|
||||
|
||||
IndefArt = {s = \\_,_,_,_ => []; d = Indef} ;
|
||||
|
||||
MassDet = {s = \\_,_,_ => [] ; n = Sg; d = Indef; isNum = False} ;
|
||||
|
||||
UseN n = n ;
|
||||
-- UseN2 n = n ;
|
||||
-- UseN3 n = n ;
|
||||
--
|
||||
-- ComplN2 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c} ;
|
||||
-- ComplN3 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c ; c2 = f.c3} ;
|
||||
--
|
||||
AdjCN ap cn = {
|
||||
s = \\n,d,c =>
|
||||
cn.s ! n ! d ! c ++ ap.s ! cn.h ! cn.g ! n ! (definite ! d) ! c ;
|
||||
g = cn.g;
|
||||
h = cn.h
|
||||
};
|
||||
-- RelCN cn rs = {s = \\n,c => cn.s ! n ! c ++ rs.s ! {n = n ; p = P3}} ;
|
||||
-- AdvCN cn ad = {s = \\n,c => cn.s ! n ! c ++ ad.s} ;
|
||||
--
|
||||
-- SentCN cn sc = {s = \\n,c => cn.s ! n ! c ++ sc.s} ;
|
||||
--
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
concrete NumeralAra of Numeral = CatAra **
|
||||
open Predef, Prelude, ResAra, MorphoAra in {
|
||||
|
||||
|
||||
|
||||
lincat
|
||||
|
||||
Digit = {s : DForm => Gender => State => Case => Str ;
|
||||
n : Size } ;
|
||||
Sub10 = {s : DForm => Gender => State => Case => Str ;
|
||||
n : Size } ;
|
||||
Sub100 = {s : Gender => State => Case => Str ;
|
||||
n : Size} ;
|
||||
Sub1000 = {s : Gender => State => Case => Str ;
|
||||
n : Size } ;
|
||||
Sub1000000 = {s : Gender => State => Case => Str ;
|
||||
n : Size} ;
|
||||
|
||||
|
||||
|
||||
lin num x = x ;
|
||||
|
||||
|
||||
lin n2 = num2 ** {n = Two };
|
||||
|
||||
|
||||
lin n3 = num3_10 "ثَلاث";
|
||||
lin n4 = num3_10 "أَربَع";
|
||||
lin n5 = num3_10 "خَمس";
|
||||
lin n6 = num3_10 "سِتّ";
|
||||
lin n7 = num3_10 "سَبع";
|
||||
lin n8 = num3_10 "ثَمانِي";
|
||||
lin n9 = num3_10 "تِسع";
|
||||
|
||||
|
||||
lin pot01 = num1_10 "واحِد" ** { n = One } ;
|
||||
|
||||
lin pot0 d = d ;
|
||||
|
||||
lin pot110 =
|
||||
{ s= ((num3_10 "عَشر").s ! unit ) ;
|
||||
n = ThreeTen
|
||||
};
|
||||
lin pot111 =
|
||||
{ s = \\g,d,_ =>
|
||||
case g of {
|
||||
Masc => Al ! d + "أَحَدَ" ++ teen ! Masc ;
|
||||
Fem => Al ! d + "إِحدَى" ++ teen ! Fem
|
||||
};
|
||||
n = NonTeen
|
||||
};
|
||||
|
||||
lin pot1to19 dig =
|
||||
{ s = \\g,d,c =>
|
||||
case dig.n of {
|
||||
Two => Al ! d + num2.s ! unit ! g ! Const ! c ++ teen ! g ;
|
||||
_ => dig.s ! unit ! g ! (toDef d ThreeTen) ! Acc ++
|
||||
teen ! (genPolarity ! g)
|
||||
};
|
||||
n = case dig.n of {
|
||||
Two => NonTeen;
|
||||
_ => Teen
|
||||
}
|
||||
};
|
||||
|
||||
lin pot0as1 num =
|
||||
{ s= num.s ! unit;
|
||||
n = num.n
|
||||
} ;
|
||||
|
||||
lin pot1 dig =
|
||||
{ s = dig.s ! ten;
|
||||
n = NonTeen
|
||||
};
|
||||
|
||||
lin pot1plus dig n = {
|
||||
s = \\g,d,c => n.s ! unit ! g ! d ! c
|
||||
++ "وَ" ++ dig.s ! ten ! g ! d ! c ;
|
||||
n = NonTeen
|
||||
};
|
||||
|
||||
lin pot1as2 n = n ;
|
||||
|
||||
lin pot2 dig = {
|
||||
s = \\g,d,c =>
|
||||
case dig.n of {
|
||||
One => num100 ! d ! c ;
|
||||
Two => num200 ! d ! c ;
|
||||
_ => dig.s ! unit ! Masc ! (toDef d ThreeTen) ! c ++ "مِٱَةِ"
|
||||
};
|
||||
n = Hundreds
|
||||
};
|
||||
|
||||
lin pot2plus m e = {
|
||||
s = \\g,d,c =>
|
||||
case m.n of {
|
||||
One => num100 ! d ! c;
|
||||
Two => num200 ! d ! c;
|
||||
_ => m.s ! unit ! Masc ! (toDef d ThreeTen) ! c ++ "مِٱَةٌ"
|
||||
} ++ "وَ" ++ e.s ! g ! d ! c ;
|
||||
n = e.n
|
||||
};
|
||||
|
||||
|
||||
lin pot2as3 n = n ;
|
||||
|
||||
lin pot3 m = {
|
||||
s = \\g,d,c =>
|
||||
case m.n of {
|
||||
One => num1000 ! (definite ! d) ! c;
|
||||
Two => num2000 ! (definite ! d) ! c;
|
||||
_ => m.s ! Fem ! (toDef d ThreeTen) ! c ++ "آلافٌ"
|
||||
} ;
|
||||
n = m.n
|
||||
};
|
||||
--lin pot3plus n m = {
|
||||
-- s = \\c => n.s ! NCard ++ "تهُْسَند" ++ m.s ! c ; n = Pl} ;
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
resource OrthoAra = open Prelude, Predef in {
|
||||
|
||||
oper
|
||||
|
||||
rectifyHmz: Str -> Str = \word ->
|
||||
case word of {
|
||||
l@(""|"ال") + "؟" + v@("َ"|"ُ") + tail => l + "أ" + v + tail;
|
||||
l@(""|"ال") + "؟" + v@("ِ") + tail => l + "إ" + v + tail;
|
||||
head + v1@("ِ"|"ُ"|"َ"|"ْ"|"ا"|"ي"|"و") + "؟" + v2@(""|"ُ"|"َ"|"ْ"|"ِ") => head + v1 + (tHmz v1) + v2;
|
||||
head + "؟" + tail => head + (bHmz (dp 2 head) (take 2 tail)) + tail; --last head , take 1 tail
|
||||
_ => word
|
||||
};
|
||||
|
||||
--hamza at beginning of word (head)
|
||||
hHmz : Str -> Str = \d ->
|
||||
case d of {
|
||||
"ِ" => "إ";
|
||||
_ => "أ"
|
||||
};
|
||||
|
||||
--hamza in middle of word (body)
|
||||
bHmz : Str -> Str -> Str = \d1,d2 ->
|
||||
case <d1,d2> of {
|
||||
<"ِ",_> | <_,"ِ"> => "ئ";
|
||||
<"ُ",_> | <_,"ُ"> => "ؤ";
|
||||
<"َ",_> | <_,"َ"> => "أ";
|
||||
_ => "ء"
|
||||
};
|
||||
|
||||
--hamza carrier sequence
|
||||
tHmz : Str -> Str = \d ->
|
||||
case d of {
|
||||
"ِ" => "ئ";
|
||||
"ُ" => "ؤ";
|
||||
"َ" => "أ";
|
||||
"ْ"|"ا"|"و"|"ي" => "ء"
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,533 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude:../common
|
||||
|
||||
--1 Arabic Lexical Paradigms
|
||||
--
|
||||
-- Ali El Dada 2005--2006
|
||||
--
|
||||
-- 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 $MorphoAra.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 $IrregularAra$, which covers all irregularly inflected
|
||||
-- words.
|
||||
--
|
||||
-- The following modules are presupposed:
|
||||
|
||||
resource ParadigmsAra = open
|
||||
Predef,
|
||||
Prelude,
|
||||
MorphoAra,
|
||||
OrthoAra,
|
||||
CatAra
|
||||
in {
|
||||
|
||||
flags optimize = noexpand;
|
||||
|
||||
oper
|
||||
|
||||
--lexical paradigms for nouns
|
||||
|
||||
mkN : NTable -> Gender -> Species -> N =
|
||||
\nsc,gen,spec ->
|
||||
{ s = nsc;
|
||||
g = gen;
|
||||
h = spec;
|
||||
lock_N = <>
|
||||
};
|
||||
|
||||
--takes a root string, a singular pattern string, a broken plural
|
||||
--pattern string, a gender, and species. Gives a noun
|
||||
regN : Str -> Str -> Str -> Gender -> Species -> N =
|
||||
\root,sg,pl,gen,spec ->
|
||||
let { raw = regN' root sg pl gen spec} in
|
||||
{ s = \\n,d,c =>
|
||||
case root of {
|
||||
_ + "؟" + _ => rectifyHmz(raw.s ! n ! d ! c);
|
||||
_ => raw.s ! n ! d ! c
|
||||
};
|
||||
g = gen;
|
||||
h = spec ; lock_N = <>
|
||||
};
|
||||
|
||||
regN' : Str -> Str -> Str -> Gender -> Species -> N =
|
||||
\root,sg,pl,gen,spec ->
|
||||
let { kitAb = mkWord sg root;
|
||||
kutub = mkWord pl root
|
||||
} in mkN (reg kitAb kutub) gen spec;
|
||||
|
||||
--takes a root string, a singular pattern string, a gender,
|
||||
--and species. Gives a noun whose plural is sound feminine
|
||||
sdfN : Str -> Str -> Gender -> Species -> N =
|
||||
\root,sg,gen,spec ->
|
||||
let { kalima = mkWord sg root;
|
||||
} in mkN (sndf kalima) gen spec;
|
||||
|
||||
|
||||
--takes a root string, a singular pattern string, a gender,
|
||||
--and species. Gives a noun whose plural is sound masculine
|
||||
sdmN : Str -> Str -> Gender -> Species -> N =
|
||||
\root,sg,gen,spec ->
|
||||
let { mucallim = mkWord sg root;
|
||||
} in mkN (sndm mucallim) gen spec;
|
||||
|
||||
-- mkN3 : N -> Str -> Str -> N3 =
|
||||
-- \n,p,q -> n ** {c2 = p ; c3 = q; lock_N3 = <>} ;
|
||||
|
||||
--lexical paradigms for adjectives
|
||||
|
||||
--takes a root string and a pattern string
|
||||
regA : Str -> Str -> A =
|
||||
\root,pat ->
|
||||
let { raw = regA' root pat } in
|
||||
{ s = \\g,n,d,c =>
|
||||
case root of {
|
||||
_ + "؟" + _ => rectifyHmz(raw.s ! g ! n ! d ! c);
|
||||
_ => raw.s ! g ! n ! d ! c
|
||||
};
|
||||
lock_A = <>
|
||||
};
|
||||
|
||||
regA' : Str -> Str -> A =
|
||||
\root,pat ->
|
||||
let { kabIr = mkWord pat root
|
||||
} in {
|
||||
s = adj kabIr ;
|
||||
lock_A = <>
|
||||
};
|
||||
|
||||
--takes a root string only
|
||||
clrA : Str -> A =
|
||||
\root ->
|
||||
let { eaHmar = mkWord "أَفعَل" root;
|
||||
HamrA' = mkWord "فَعلاء" root;
|
||||
Humr = mkWord "فُعل" root
|
||||
} in {
|
||||
s = clr eaHmar HamrA' Humr;
|
||||
lock_A = <>
|
||||
};
|
||||
|
||||
--lexical paradigms for verbs
|
||||
|
||||
v1 : Str -> Vowel -> Vowel -> V =
|
||||
\rootStr,vPerf,vImpf ->
|
||||
let { raw = v1' rootStr vPerf vImpf } in
|
||||
{ s = \\vf =>
|
||||
case rootStr of {
|
||||
_ + "؟" + _ => rectifyHmz(raw.s ! vf);
|
||||
_ => raw.s ! vf
|
||||
};
|
||||
lock_V = <>
|
||||
} ;
|
||||
|
||||
|
||||
v1' : Str -> Vowel -> Vowel -> Verb =
|
||||
\rootStr,vPerf,vImpf ->
|
||||
let { root = mkRoot3 rootStr ;
|
||||
l = dp 2 rootStr } in --last rootStr
|
||||
case <l, root.c> of {
|
||||
<"ّ",_> => v1geminate rootStr vPerf vImpf ;
|
||||
<"و"|"ي",_> => v1defective root vImpf ;
|
||||
<_,"و"|"ي"> => v1hollow root vImpf ;
|
||||
_ => v1sound root vPerf vImpf
|
||||
};
|
||||
|
||||
|
||||
--Verb Form II : faccala
|
||||
|
||||
v2 : Str -> V =
|
||||
\rootStr ->
|
||||
let {
|
||||
root = mkRoot3 rootStr
|
||||
} in {
|
||||
s =
|
||||
case root.l of {
|
||||
"و"|"ي" => (v2defective root).s;
|
||||
_ => (v2sound root).s
|
||||
};
|
||||
lock_V = <>
|
||||
};
|
||||
|
||||
--Verb Form III : fAcala
|
||||
|
||||
v3 : Str -> V =
|
||||
\rootStr ->
|
||||
let {
|
||||
tbc = mkRoot3 rootStr ;
|
||||
} in {
|
||||
s = (v3sound tbc).s ;
|
||||
lock_V = <>
|
||||
};
|
||||
|
||||
--Verb Form IV : >afcala
|
||||
|
||||
v4 : Str -> V =
|
||||
\rootStr ->
|
||||
let {
|
||||
root = mkRoot3 rootStr
|
||||
} in {
|
||||
s =
|
||||
case root.l of {
|
||||
"و"|"ي" => (v4defective root).s;
|
||||
_ => (v4sound root).s
|
||||
};
|
||||
lock_V = <>
|
||||
};
|
||||
|
||||
--Verb Form V : tafaccala
|
||||
|
||||
v5 : Str -> V =
|
||||
\rootStr ->
|
||||
let { raw = v5' rootStr } in
|
||||
{ s = \\vf =>
|
||||
case rootStr of {
|
||||
_ + "؟" + _ => rectifyHmz(raw.s ! vf);
|
||||
_ => raw.s ! vf
|
||||
};
|
||||
lock_V = <>
|
||||
};
|
||||
|
||||
v5' : Str -> V =
|
||||
\rootStr ->
|
||||
let {
|
||||
nfs = mkRoot3 rootStr ;
|
||||
} in {
|
||||
s = (v5sound nfs).s ; lock_V = <>
|
||||
};
|
||||
|
||||
--Verb Form VI : tafaacala
|
||||
|
||||
v6 : Str -> V =
|
||||
\rootStr ->
|
||||
let {
|
||||
fqm = mkRoot3 rootStr ;
|
||||
} in {
|
||||
s = (v6sound fqm).s ;
|
||||
lock_V = <>
|
||||
};
|
||||
|
||||
--Verb Form VIII <iftacala
|
||||
|
||||
v8 : Str -> V =
|
||||
\rootStr ->
|
||||
let {
|
||||
rbT = mkRoot3 rootStr ;
|
||||
} in {
|
||||
s = (v8sound rbT).s ;
|
||||
lock_V = <>
|
||||
};
|
||||
|
||||
|
||||
---- Prepositions are used in many-argument functions for rection.
|
||||
--
|
||||
Preposition : Type ;
|
||||
|
||||
|
||||
--2 Nouns
|
||||
|
||||
-- Use the function $mkPreposition$ or see the section on prepositions below to
|
||||
-- form other prepositions.
|
||||
--
|
||||
--3 Relational nouns
|
||||
--
|
||||
-- Relational nouns ("دَُغهتر ْف خ") need a preposition.
|
||||
|
||||
mkN2 : N -> Preposition -> N2 ;
|
||||
|
||||
-- Three-place relational nouns ("تهي عْنّعتِْن فرْم خ تْ ي") 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. "تهي ْلد تْون هَلّ ْف").
|
||||
--
|
||||
-- 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
|
||||
|
||||
mkPN : Str -> Gender -> PN ;
|
||||
|
||||
---- Sometimes you can reuse a common noun as a proper name, e.g. "َنك".
|
||||
--
|
||||
-- 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
|
||||
--
|
||||
--3 Two-place adjectives
|
||||
--
|
||||
-- Two-place adjectives need a preposition for their second argument.
|
||||
|
||||
mkA2 : A -> Preposition -> A2 ;
|
||||
|
||||
---- Comparison adjectives may two more forms.
|
||||
--
|
||||
-- ADeg : Type ;
|
||||
--
|
||||
-- mkADeg : (good,better,best,well : Str) -> ADeg ;
|
||||
--
|
||||
---- The regular pattern recognizes two common variations:
|
||||
---- "ي" ("رُدي" - "رُدر" - "رُدست") and
|
||||
---- "ي" ("هَةّي هَةِّر هَةِّست هَةِّلي")
|
||||
--
|
||||
-- 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 "مْري، "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. "َلوَيس").
|
||||
|
||||
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
|
||||
--
|
||||
----3 Verbs with a particle.
|
||||
----
|
||||
---- The particle, such as in "سوِتعه ْن", is given as a string.
|
||||
--
|
||||
-- partV : V -> Str -> V ;
|
||||
--
|
||||
----3 Reflexive verbs
|
||||
----
|
||||
---- By default, verbs are not reflexive; this function makes them that.
|
||||
--
|
||||
-- reflV : 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 -> Preposition -> Preposition -> V3 ; -- speak, with, about
|
||||
dirV3 : V -> Preposition -> 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 ;
|
||||
|
||||
-- Notice: categories $V2S, V2V, V2A, V2Q$ are in v 1.0 treated
|
||||
-- just as synonyms of $V2$, and the second argument is given
|
||||
-- as an adverb. Likewise $AS, A2S, AV, A2V$ are just $A$.
|
||||
-- $V0$ is just $V$.
|
||||
|
||||
V0, V2S, V2V, V2A, V2Q : Type ;
|
||||
AS, A2S, AV, A2V : Type ;
|
||||
|
||||
--
|
||||
----2 Definitions of paradigms
|
||||
----
|
||||
---- The definitions should not bother the user of the API. So they are
|
||||
---- hidden from the document.
|
||||
----.
|
||||
--
|
||||
-- Gender = MorphoAra.Gender ;
|
||||
-- Number = MorphoAra.Number ;
|
||||
-- Case = MorphoAra.Case ;
|
||||
-- human = Masc ;
|
||||
-- nonhuman = Neutr ;
|
||||
-- masculine = Masc ;
|
||||
-- feminine = Fem ;
|
||||
-- singular = Sg ;
|
||||
-- plural = Pl ;
|
||||
-- nominative = Nom ;
|
||||
-- genitive = Gen ;
|
||||
--
|
||||
Preposition = Str ;
|
||||
|
||||
mkN2 = \n,p -> n ** {lock_N2 = <> ; c2 = p} ;
|
||||
-- regN2 n = mkN2 (regN n) (mkPreposition "ْف") ;
|
||||
mkN3 = \n,p,q -> n ** {lock_N3 = <> ; c2 = p ; c3 = q} ;
|
||||
-- cnN2 = \n,p -> n ** {lock_N2 = <> ; c2 = p} ;
|
||||
-- cnN3 = \n,p,q -> n ** {lock_N3 = <> ; c2 = p ; c3 = q} ;
|
||||
--
|
||||
-- mkPN n g = nameReg n g ** {lock_PN = <>} ;
|
||||
-- nounPN n = {s = n.s ! singular ; g = n.g ; lock_PN = <>} ;
|
||||
mkNP : (_,_,_ : Str) -> PerGenNum -> NP = \ana,nI,I,pgn ->
|
||||
{ s =
|
||||
table {
|
||||
Nom => ana;
|
||||
Acc => nI;
|
||||
Gen => I
|
||||
};
|
||||
a = {pgn = pgn; isPron = True };
|
||||
lock_NP = <>
|
||||
};
|
||||
|
||||
-- mkNP x y n g = {s = table {Gen => x ; _ => y} ; a = agrP3 n ;
|
||||
-- lock_NP = <>} ;
|
||||
--
|
||||
mkQuant7 : (_,_,_,_,_,_,_ : Str) -> State -> Quant =
|
||||
\hava,havihi,havAn,havayn,hAtAn,hAtayn,hA'ulA,det ->
|
||||
{ s = \\n,s,g,c =>
|
||||
case <s,g,c,n> of {
|
||||
<_,Masc,_,Sg> => hava;
|
||||
<_,Fem,_,Sg> => havihi;
|
||||
<_,Masc,Nom,Dl>=> havAn;
|
||||
<_,Masc,_,Dl> => havayn;
|
||||
<_,Fem,Nom,Dl> => hAtAn;
|
||||
<_,Fem,_,Dl> => hAtayn;
|
||||
<Hum,_,_,Pl> => hA'ulA;
|
||||
_ => havihi
|
||||
};
|
||||
d = Def;
|
||||
lock_Quant = <>
|
||||
};
|
||||
|
||||
mkQuant3 : (_,_,_ : Str) -> State -> Quant =
|
||||
\dalika,tilka,ula'ika,det ->
|
||||
{ s = \\n,s,g,c =>
|
||||
case <s,g,c,n> of {
|
||||
<_,Masc,_,Sg> => dalika;
|
||||
<_,Fem,_,Sg> => tilka;
|
||||
<Hum,_,_,_> => ula'ika;
|
||||
_ => tilka
|
||||
};
|
||||
d = Def;
|
||||
lock_Quant = <>
|
||||
};
|
||||
|
||||
|
||||
-- mkA a b = mkAdjective a a a b ** {lock_A = <>} ;
|
||||
-- regA a = regAdjective a ** {lock_A = <>} ;
|
||||
--
|
||||
mkA2 a p = a ** {c2 = p ; lock_A2 = <>} ;
|
||||
--
|
||||
-- ADeg = A ; ----
|
||||
--
|
||||
-- mkADeg a b c d = mkAdjective a b c d ** {lock_A = <>} ;
|
||||
--
|
||||
|
||||
-- duplADeg fat =
|
||||
-- mkADeg fat
|
||||
-- (fat + last fat + "ر") (fat + last fat + "ست") (fat + "لي") ;
|
||||
--
|
||||
-- compoundADeg a =
|
||||
-- let ad = (a.s ! AAdj Posit)
|
||||
-- in mkADeg ad ("مْري" ++ ad) ("مْست" ++ ad) (a.s ! AAdv) ;
|
||||
--
|
||||
-- adegA a = 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 = mkVerb a b c d e ** {s1 = [] ; lock_V = <>} ;
|
||||
--
|
||||
--
|
||||
-- partV v p = verbPart v p ** {lock_V = <>} ;
|
||||
-- reflV v = {s = v.s ; part = v.part ; lock_V = v.lock_V ; isRefl = True} ;
|
||||
--
|
||||
mkV2 v p = v ** {s = v.s ; c2 = p ; lock_V2 = <>} ;
|
||||
dirV2 v = mkV2 v [] ;
|
||||
|
||||
mkV3 v p q = v ** {s = v.s ; c2 = p ; c3 = q ; lock_V3 = <>} ;
|
||||
dirV3 v p = mkV3 v [] p ;
|
||||
dirdirV3 v = dirV3 v [] ;
|
||||
|
||||
mkVS v = v ** {lock_VS = <>} ;
|
||||
-- mkVV v = {
|
||||
-- s = table {VVF vf => v.s ! vf ; _ => variants {}} ;
|
||||
-- isAux = False ; lock_VV = <>
|
||||
-- } ;
|
||||
mkVQ v = v ** {lock_VQ = <>} ;
|
||||
|
||||
V0 : Type = V ;
|
||||
V2S, V2V, V2Q, V2A : Type = V2 ;
|
||||
AS, A2S, AV : Type = A ;
|
||||
A2V : Type = A2 ;
|
||||
|
||||
mkV0 v = v ** {lock_V = <>} ;
|
||||
mkV2S v p = mkV2 v p ** {lock_V2 = <>} ;
|
||||
mkV2V v p t = mkV2 v p ** {s4 = t ; lock_V2 = <>} ;
|
||||
mkVA v = v ** {lock_VA = <>} ;
|
||||
mkV2A v p = mkV2 v p ** {lock_V2A = <>} ;
|
||||
mkV2Q v p = mkV2 v p ** {lock_V2 = <>} ;
|
||||
|
||||
mkAS v = v ** {lock_A = <>} ;
|
||||
mkA2S v p = mkA2 v p ** {lock_A = <>} ;
|
||||
mkAV v = v ** {lock_A = <>} ;
|
||||
mkA2V v p = mkA2 v p ** {lock_A2 = <>} ;
|
||||
|
||||
} ;
|
||||
@@ -1,102 +0,0 @@
|
||||
resource PatternsAra = {
|
||||
|
||||
oper
|
||||
|
||||
fA' = { h = "" ; m1 = ""; m2 = ""; t = "َاء"} ;
|
||||
|
||||
eafAcI = { h = "أَ"; m1 = "َا"; m2 = ""; t = "ِي" } ;
|
||||
eafcA' = { h = "أَ"; m1 = "ْ" ; m2 = ""; t = "َاء"} ;
|
||||
eafcI = { h = "أَ"; m1 = "ْ" ; m2 = ""; t = "ِي" } ;
|
||||
fac = { h = "" ; m1 = "َ" ; m2 = ""; t = "" } ;
|
||||
facc = { h = "" ; m1 = "َ" ; m2 = ""; t = "ّ" } ;
|
||||
facca = { h = "" ; m1 = "َ" ; m2 = ""; t = "َّ" } ;
|
||||
facci = { h = "" ; m1 = "َ" ; m2 = ""; t = "ِّ" } ;
|
||||
faccu = { h = "" ; m1 = "َ" ; m2 = ""; t = "ُّ" } ;
|
||||
facp = { h = "" ; m1 = "َ" ; m2 = ""; t = "َة" } ;
|
||||
faca = { h = "" ; m1 = "َ" ; m2 = ""; t = "َ" } ;
|
||||
facA = { h = "" ; m1 = "َ" ; m2 = ""; t = "َا" } ;
|
||||
facA' = { h = "" ; m1 = "َ" ; m2 = ""; t = "َاء"} ;
|
||||
fAc = { h = "" ; m1 = "َا"; m2 = ""; t = "" } ;
|
||||
fAcp = { h = "" ; m1 = "َا"; m2 = ""; t = "َة" } ;
|
||||
fic = { h = "" ; m1 = "ِ" ; m2 = ""; t = "" } ;
|
||||
ficc = { h = "" ; m1 = "ِ" ; m2 = ""; t = "ّ" } ;
|
||||
ficA' = { h = "" ; m1 = "ِ" ; m2 = ""; t = "َاء"} ;
|
||||
fIc = { h = "" ; m1 = "ِي"; m2 = ""; t = "" } ;
|
||||
fIcAn = { h = "" ; m1 = "ِي"; m2 = ""; t = "َان"} ;
|
||||
fca = { h = "" ; m1 = "ْ" ; m2 = ""; t = "َ" } ;
|
||||
fci = { h = "" ; m1 = "ْ" ; m2 = ""; t = "ِ" } ;
|
||||
fcu = { h = "" ; m1 = "ْ" ; m2 = ""; t = "ُ" } ;
|
||||
fuc = { h = "" ; m1 = "ُ" ; m2 = ""; t = "" } ;
|
||||
fucc = { h = "" ; m1 = "ُ" ; m2 = ""; t = "ّ" } ;
|
||||
fucci = { h = "" ; m1 = "ُ" ; m2 = ""; t = "ِّ" } ;
|
||||
fuccu = { h = "" ; m1 = "ُ" ; m2 = ""; t = "ُّ" } ;
|
||||
fuci = { h = "" ; m1 = "ُ" ; m2 = ""; t = "ِ" } ;
|
||||
fucu = { h = "" ; m1 = "ُ" ; m2 = ""; t = "ُ" } ;
|
||||
fUc = { h = "" ; m1 = "ُو"; m2 = ""; t = "" } ;
|
||||
ufAc = { h = "ُ" ; m1 = "َا"; m2 = ""; t = "" } ;
|
||||
ufca = { h = "ُ" ; m1 = "ْ" ; m2 = ""; t = "َ" } ;
|
||||
|
||||
eafAcil = { h = "أَ"; m1 = "َا" ; m2 = "ِ" ; t = "" } ;
|
||||
eafAcIl = { h = "أَ"; m1 = "َا" ; m2 = "ِي" ; t = "" } ;
|
||||
eafcilp = { h = "أَ"; m1 = "ْ" ; m2 = "ِ" ; t = "َة" } ;
|
||||
eafcal = { h = "أَ"; m1 = "ْ" ; m2 = "َ" ; t = "" } ;
|
||||
eafcAl = { h = "أَ"; m1 = "ْ" ; m2 = "َا" ; t = "" } ;
|
||||
eafcil = { h = "أَ"; m1 = "ْ" ; m2 = "ِ" ; t = "" } ;
|
||||
eafcul = { h = "أَ"; m1 = "ْ" ; m2 = "ُ" ; t = "" } ;
|
||||
eiftacal = { h = "إِ"; m1 = "ْتَ" ; m2 = "َ" ; t = "" } ;
|
||||
eufcil = { h = "أُ"; m1 = "ْ" ; m2 = "ِ" ; t = "" } ;
|
||||
euftucil = { h = "أُ"; m1 = "ْتُ" ; m2 = "ِ" ; t = "" } ;
|
||||
afcul = { h = "َ" ; m1 = "ْ" ; m2 = "ُ" ; t = "" } ;
|
||||
faccalo = { h = "" ; m1 = "َ" ; m2 = "َّ" ; t = "ْ" } ;
|
||||
facal = { h = "" ; m1 = "َ" ; m2 = "َ" ; t = "" } ;
|
||||
facalo = { h = "" ; m1 = "َ" ; m2 = "َ" ; t = "ْ" } ;
|
||||
facalp = { h = "" ; m1 = "َ" ; m2 = "َ" ; t = "َة" } ;
|
||||
facA'il = { h = "" ; m1 = "َ" ; m2 = "َائِ"; t = "" } ;
|
||||
facAl = { h = "" ; m1 = "َ" ; m2 = "َا" ; t = "" } ;
|
||||
facAlI = { h = "" ; m1 = "َ" ; m2 = "َا" ; t = "ِي" } ;
|
||||
facil = { h = "" ; m1 = "َ" ; m2 = "ِ" ; t = "" } ;
|
||||
facIl = { h = "" ; m1 = "َ" ; m2 = "ِي" ; t = "" } ;
|
||||
facl = { h = "" ; m1 = "َ" ; m2 = "ْ" ; t = "" } ;
|
||||
faclp = { h = "" ; m1 = "َ" ; m2 = "ْ" ; t = "َة" } ;
|
||||
facul = { h = "" ; m1 = "َ" ; m2 = "ُ" ; t = "" } ;
|
||||
fAcal = { h = "" ; m1 = "َا" ; m2 = "َ" ; t = "" } ;
|
||||
fAcil = { h = "" ; m1 = "َا" ; m2 = "ِ" ; t = "" } ;
|
||||
faccal = { h = "" ; m1 = "َ" ; m2 = "َّ" ; t = "" } ;
|
||||
faccil = { h = "" ; m1 = "َ" ; m2 = "ِّ" ; t = "" } ;
|
||||
faclA' = { h = "" ; m1 = "َ" ; m2 = "ْ" ; t = "َاء"} ;
|
||||
fAcilp = { h = "" ; m1 = "َا" ; m2 = "ِ" ; t = "َة" } ;
|
||||
fawAcil = { h = "" ; m1 = "َوَا"; m2 = "ِ" ; t = "" } ;
|
||||
ficAlp = { h = "" ; m1 = "ِ" ; m2 = "َا" ; t = "َة" } ;
|
||||
fcal = { h = "" ; m1 = "ْ" ; m2 = "َ" ; t = "" } ;
|
||||
fcil = { h = "" ; m1 = "ْ" ; m2 = "ِ" ; t = "" } ;
|
||||
fcul = { h = "" ; m1 = "ْ" ; m2 = "ُ" ; t = "" } ;
|
||||
ficl = { h = "" ; m1 = "ِ" ; m2 = "ْ" ; t = "" } ;
|
||||
ficAl = { h = "" ; m1 = "ِ" ; m2 = "َا" ; t = "" } ;
|
||||
ficlp = { h = "" ; m1 = "ِ" ; m2 = "ْ" ; t = "َة" } ;
|
||||
ftacal = { h = "" ; m1 = "ْتَ" ; m2 = "َ" ; t = "" } ;
|
||||
ftacil = { h = "" ; m1 = "ْتَ" ; m2 = "ِ" ; t = "" } ;
|
||||
fuccAl = { h = "" ; m1 = "ُ" ; m2 = "َّا" ; t = "" } ;
|
||||
fuccil = { h = "" ; m1 = "ُ" ; m2 = "ِّ" ; t = "" } ;
|
||||
fuccilo = { h = "" ; m1 = "ُ" ; m2 = "ِّ" ; t = "ْ" } ;
|
||||
fucal = { h = "" ; m1 = "ُ" ; m2 = "َ" ; t = "" } ;
|
||||
fucaylp = { h = "" ; m1 = "ُ" ; m2 = "َيْ" ; t = "َة" } ;
|
||||
fucAl = { h = "" ; m1 = "ُ" ; m2 = "َا" ; t = "" } ;
|
||||
fucl = { h = "" ; m1 = "ُ" ; m2 = "ْ" ; t = "" } ;
|
||||
fucil = { h = "" ; m1 = "ُ" ; m2 = "ِ" ; t = "" } ;
|
||||
fuclp = { h = "" ; m1 = "ُ" ; m2 = "ْ" ; t = "َة" } ;
|
||||
fucilo = { h = "" ; m1 = "ُ" ; m2 = "ِ" ; t = "ْ" } ;
|
||||
fucul = { h = "" ; m1 = "ُ" ; m2 = "ُ" ; t = "" } ;
|
||||
fuculo = { h = "" ; m1 = "ُ" ; m2 = "ُ" ; t = "ْ" } ;
|
||||
fucUl = { h = "" ; m1 = "ُ" ; m2 = "ُو" ; t = "" } ;
|
||||
fUcil = { h = "" ; m1 = "ُو" ; m2 = "ِ" ; t = "" } ;
|
||||
tafAcal = { h = "تَ"; m1 = "َا" ; m2 = "َ" ; t = "" } ;
|
||||
tafaccal = { h = "تَ"; m1 = "َ" ; m2 = "َّ" ; t = "" } ;
|
||||
tufuccil = { h = "تُ"; m1 = "ُ" ; m2 = "ِّ" ; t = "" } ;
|
||||
tufUcil = { h = "تُ"; m1 = "ُو" ; m2 = "ِ" ; t = "" } ;
|
||||
ufAcal = { h = "ُ" ; m1 = "َا" ; m2 = "َ" ; t = "" } ;
|
||||
ufAcil = { h = "ُ" ; m1 = "َا" ; m2 = "ِ" ; t = "" } ;
|
||||
ufcal = { h = "ُ" ; m1 = "ْ" ; m2 = "َ" ; t = "" } ;
|
||||
ufcil = { h = "ُ" ; m1 = "ْ" ; m2 = "ِ" ; t = "" } ;
|
||||
ufcul = { h = "ُ" ; m1 = "ْ" ; m2 = "ُ" ; t = "" } ;
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
concrete PhraseAra of Phrase = CatAra ** open
|
||||
ParamX,
|
||||
Prelude,
|
||||
ResAra in {
|
||||
|
||||
lin
|
||||
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ! Masc ++ voc.s} ;--FIXME
|
||||
|
||||
-- UttS s = s ;
|
||||
-- UttQS qs = {s = qs.s ! QDir} ;
|
||||
UttImpSg pol imp = {s = \\g => imp.s ! pol.p ! g ! Sg} ;
|
||||
-- UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p ! Pl} ;
|
||||
--
|
||||
-- UttIP ip = {s = ip.s ! Nom} ; --- Acc also
|
||||
-- UttIAdv iadv = iadv ;
|
||||
-- UttNP np = {s = np.s ! Acc} ;
|
||||
-- UttVP vp = {s = infVP False vp (agrP3 Sg)} ;
|
||||
-- UttAdv adv = adv ;
|
||||
--
|
||||
NoPConj = {s = []} ;
|
||||
-- PConjConj conj = conj ;
|
||||
--
|
||||
NoVoc = {s = []} ;
|
||||
-- VocNP np = {s = "،" ++ np.s ! Nom} ;
|
||||
--
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
concrete QuestionAra of Question = CatAra ** open ResAra, ParamX in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
|
||||
QuestCl cl = {
|
||||
s = \\t,p =>
|
||||
table {
|
||||
QIndir => "إِذا" ++ cl.s ! t ! p ! Verbal ;
|
||||
QDir => cl.s ! t ! p ! Verbal
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
--
|
||||
-- QuestVP qp vp =
|
||||
-- let cl = mkClause (qp.s ! Nom) {n = qp.n ; p = P3} vp
|
||||
-- in {s = \\t,a,b,_ => cl.s ! t ! a ! b ! ODir} ;
|
||||
--
|
||||
-- QuestSlash ip slash = {
|
||||
-- s = \\t,a,p =>
|
||||
-- let
|
||||
-- cls = slash.s ! t ! a ! p ;
|
||||
-- who = slash.c2 ++ ip.s ! Acc --- stranding in ExtAra
|
||||
-- in table {
|
||||
-- QDir => who ++ cls ! OQuest ;
|
||||
-- QIndir => who ++ cls ! ODir
|
||||
-- }
|
||||
-- } ;
|
||||
--
|
||||
-- QuestIAdv iadv cl = {
|
||||
-- s = \\t,a,p =>
|
||||
-- let
|
||||
-- cls = cl.s ! t ! a ! p ;
|
||||
-- why = iadv.s
|
||||
-- in table {
|
||||
-- QDir => why ++ cls ! OQuest ;
|
||||
-- QIndir => why ++ cls ! ODir
|
||||
-- }
|
||||
-- } ;
|
||||
--
|
||||
-- PrepIP p ip = {s = p.s ++ ip.s ! Nom} ;
|
||||
--
|
||||
-- AdvIP ip adv = {
|
||||
-- s = \\c => ip.s ! c ++ adv.s ;
|
||||
-- n = ip.n
|
||||
-- } ;
|
||||
--
|
||||
-- IDetCN idet num ord cn = {
|
||||
-- s = \\c => idet.s ++ num.s ++ ord.s ++ cn.s ! idet.n ! c ;
|
||||
-- n = idet.n
|
||||
-- } ;
|
||||
--
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
concrete RelativeAra of Relative = CatAra ** open ResAra in {
|
||||
--
|
||||
-- flags optimize=all_subs ;
|
||||
--
|
||||
-- lin
|
||||
--
|
||||
-- RelCl cl = {
|
||||
-- s = \\t,a,p,_ => "سُعه" ++ "تهَت" ++ cl.s ! t ! a ! p ! ODir
|
||||
-- } ;
|
||||
--
|
||||
-- RelVP rp vp = {
|
||||
-- s = \\t,ant,b,ag =>
|
||||
-- let
|
||||
-- agr = case rp.a of {
|
||||
-- RNoAg => ag ;
|
||||
-- RAg a => a
|
||||
-- } ;
|
||||
-- cl = mkClause (rp.s ! Nom) agr vp
|
||||
-- in
|
||||
-- cl.s ! t ! ant ! b ! ODir
|
||||
-- } ;
|
||||
--
|
||||
-- RelSlash rp slash = {
|
||||
-- s = \\t,a,p,_ => slash.c2 ++ rp.s ! Acc ++ slash.s ! t ! a ! p ! ODir
|
||||
-- } ;
|
||||
--
|
||||
-- FunRP p np rp = {
|
||||
-- s = \\c => np.s ! c ++ p.s ++ rp.s ! Acc ;
|
||||
-- a = RAg np.a
|
||||
-- } ;
|
||||
--
|
||||
-- IdRP = mkIP "وهِعه" "وهِعه" "وهْسي" Sg ** {a = RNoAg} ;
|
||||
--
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,131 +0,0 @@
|
||||
--# -path=.:abstract:common:prelude
|
||||
|
||||
concrete SentenceAra of Sentence = CatAra ** open
|
||||
ResAra,
|
||||
Prelude,
|
||||
ResAra,
|
||||
ParamX,
|
||||
CommonX in {
|
||||
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
{-
|
||||
PredVP np vp =
|
||||
{ s = \\t,p,o =>
|
||||
case o of {
|
||||
Verbal =>
|
||||
case vp.comp.a.isPron of {
|
||||
False => vp.s ! t ! p ! Verbal ! np.a ++ np.s ! Nom ++ vp.comp.s ! Acc ;
|
||||
True => vp.s ! t ! p ! Verbal ! np.a ++ vp.comp.s ! Acc ++ np.s ! Nom
|
||||
};
|
||||
Nominal =>
|
||||
np.s ! Nom ++ vp.s ! t ! p ! Nominal ! np.a ++ vp.comp.s ! Acc
|
||||
}
|
||||
};
|
||||
-}
|
||||
PredVP np vp =
|
||||
{ s =\\t,p,o =>
|
||||
let {
|
||||
pgn =
|
||||
case <o,np.a.isPron> of {
|
||||
<Verbal, False> => verbalAgr np.a.pgn;
|
||||
_ => np.a.pgn
|
||||
};
|
||||
gn = pgn2gn pgn;
|
||||
kataba = vp.s ! pgn ! VPPerf ;
|
||||
yaktubu = vp.s ! pgn ! VPImpf Ind ;
|
||||
yaktuba = vp.s ! pgn ! VPImpf Cnj ;
|
||||
yaktub = vp.s ! pgn ! VPImpf Jus ;
|
||||
vStr : ResAra.Tense -> Polarity -> Str =
|
||||
\tn,pl -> case<vp.isPred,tn,pl> of {
|
||||
<False, ResAra.Pres, Pos> => yaktubu ;
|
||||
<False, ResAra.Pres, Neg> => "لَا" ++ yaktubu ;
|
||||
<True, ResAra.Pres, Pos> => "" ; --no verb "to be" in present
|
||||
<True, ResAra.Pres, Neg> => "لَيسَ" ;--same here, just add negation particle
|
||||
<_, ResAra.Past, Pos> => kataba ;
|
||||
<_, ResAra.Past, Neg> => "لَمْ" ++ yaktub ;
|
||||
<_, ResAra.Fut, Pos> => "سَ" ++ yaktubu ;
|
||||
<_, ResAra.Fut, Neg> => "لَنْ" ++ yaktuba
|
||||
};
|
||||
pred : ResAra.Tense -> Polarity -> Str =
|
||||
\tn,pl -> case <vp.isPred,tn,pl> of {
|
||||
<True, ResAra.Pres, Pos> => vp.pred.s ! gn ! Nom; --xabar marfooc
|
||||
_ => vp.pred.s ! gn ! Acc --xabar kaana wa laysa manSoob
|
||||
};
|
||||
} in
|
||||
case o of {
|
||||
Verbal =>
|
||||
case <vp.obj.a.isPron, np.a.isPron> of {
|
||||
<False,True> => (vStr t p) ++ vp.obj.s ++ vp.s2 ++ (pred t p);
|
||||
<False,False> => (vStr t p) ++ np.s ! Nom ++ vp.obj.s ++ vp.s2 ++ (pred t p);
|
||||
<True,False> => (vStr t p) ++ vp.obj.s ++ np.s ! Nom ++ vp.s2 ++ (pred t p);
|
||||
<True,True> => (vStr t p) ++ vp.obj.s ++ vp.s2 ++ (pred t p)
|
||||
};
|
||||
Nominal =>
|
||||
np.s ! Nom ++ (vStr t p) ++ vp.obj.s ++ vp.s2 ++ (pred t p)
|
||||
}
|
||||
};
|
||||
-- PredVP np vp = mkClause (np.s ! Nom) np.a vp ;
|
||||
|
||||
-- PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp ;
|
||||
|
||||
ImpVP vp = {
|
||||
s = \\p,g,n =>
|
||||
case p of {
|
||||
Pos => vp.s ! (Per2 g n) ! VPImp ++ vp.obj.s ++ vp.s2 ;
|
||||
Neg => "لا" ++ vp.s ! (Per2 g n) ! (VPImpf Jus) ++ vp.obj.s ++ vp.s2
|
||||
}
|
||||
};
|
||||
|
||||
--
|
||||
-- SlashV2 np v2 =
|
||||
-- mkClause (np.s ! Nom) np.a (predV v2) ** {c2 = v2.c2} ;
|
||||
--
|
||||
-- SlashVVV2 np vv v2 =
|
||||
-- mkClause (np.s ! Nom) np.a
|
||||
-- (insertObj (\\a => infVP vv.isAux (predV v2) a) (predVV vv)) **
|
||||
-- {c2 = v2.c2} ;
|
||||
--
|
||||
-- AdvSlash slash adv = {
|
||||
-- s = \\t,a,b,o => slash.s ! t ! a ! b ! o ++ adv.s ;
|
||||
-- c2 = slash.c2
|
||||
-- } ;
|
||||
--
|
||||
-- SlashPrep cl prep = cl ** {c2 = prep.s} ;
|
||||
--
|
||||
-- EmbedS s = {s = conjThat ++ s.s} ;
|
||||
-- EmbedQS qs = {s = qs.s ! QIndir} ;
|
||||
-- EmbedVP vp = {s = infVP False vp (agrP3 Sg)} ; --- agr
|
||||
--
|
||||
|
||||
--FIXME, all tenses
|
||||
UseCl t a p cl =
|
||||
{s = cl.s ! ResAra.Pres ! p.p ! Verbal
|
||||
{- case t of {
|
||||
TPres => cl.s ! ResAra.Pres ! p.p ! Verbal ;
|
||||
TCond => cl.s ! ResAra.Pres ! p.p ! Verbal ;
|
||||
TPast => cl.s ! ResAra.Past ! p.p ! Verbal ;
|
||||
TFut => cl.s ! ResAra.Fut ! p.p ! Verbal
|
||||
}
|
||||
-} };
|
||||
|
||||
--FIXME, all tenses
|
||||
UseQCl t a p qcl = --{s = cl.s ! t ! p ! Verbal } ;
|
||||
{s =
|
||||
table {
|
||||
QDir => "هَل" ++ qcl.s ! ResAra.Pres ! p.p ! QDir;
|
||||
QIndir => qcl.s ! ResAra.Pres ! p.p ! QIndir
|
||||
}
|
||||
{- case t of {
|
||||
TPres => "هَل" ++ qcl.s ! ResAra.Pres ! p.p ! q ;
|
||||
TCond => "هَل" ++ qcl.s ! ResAra.Pres ! p.p ! q ;
|
||||
TPast => "هَل" ++ qcl.s ! ResAra.Past ! p.p ! q ;
|
||||
TFut => "هَل" ++ qcl.s ! ResAra.Fut ! p.p ! q
|
||||
}
|
||||
-} };
|
||||
|
||||
-- UseRCl t a p cl = {s = \\r => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! r} ;
|
||||
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
concrete StructuralAra of Structural = CatAra **
|
||||
open MorphoAra, ResAra, ParadigmsAra, Prelude in {
|
||||
|
||||
flags optimize=all ;
|
||||
|
||||
lin
|
||||
-- above_Prep = ss "َبْثي" ;
|
||||
-- after_Prep = ss "َفتر" ;
|
||||
-- all_Predet = ss "َلّ" ;
|
||||
-- almost_AdA, almost_AdN = ss "َلمْست" ;
|
||||
-- although_Subj = ss "َلتهُْغه" ;
|
||||
-- always_AdV = ss "َلوَيس" ;
|
||||
and_Conj = ss "وَ" ** {n = Pl} ;
|
||||
-- because_Subj = ss "بعَُسي" ;
|
||||
-- before_Prep = ss "بفْري" ;
|
||||
-- behind_Prep = ss "بهِند" ;
|
||||
-- between_Prep = ss "بتوّن" ;
|
||||
-- both7and_DConj = sd2 "بْته" "َند" ** {n = Pl} ;
|
||||
-- but_PConj = ss "بُت" ;
|
||||
-- by8agent_Prep = ss "بي" ;
|
||||
-- by8means_Prep = ss "بي" ;
|
||||
-- can8know_VV, can_VV = {
|
||||
-- s = table VVForm [["بي َبلي تْ"] ; "عَن" ; "عُْلد" ;
|
||||
-- ["بّن َبلي تْ"] ; ["بِنغ َبلي تْ"] ; "عَنءت" ; "عُْلدنءت"] ;
|
||||
-- isAux = True
|
||||
-- } ;
|
||||
-- during_Prep = ss "دُرِنغ" ;
|
||||
-- either7or_DConj = sd2 "ِتهر" "ْر" ** {n = Sg} ;
|
||||
-- everybody_NP = regNP "ثريبْدي" Sg ;
|
||||
every_Det = mkDet "كُلّ" Sg Const ;
|
||||
-- everything_NP = regNP "ثريتهِنغ" Sg ;
|
||||
-- everywhere_Adv = ss "ثريوهري" ;
|
||||
few_Det = mkDet "بَعض" Pl Const ;
|
||||
-- first_Ord = ss "فِرست" ;
|
||||
-- from_Prep = ss "فرْم" ;
|
||||
he_Pron = mkNP "هُوَ" "هُ" "هُ" (Per3 Masc Sg) ;
|
||||
here_Adv = ss "هُنا" ;
|
||||
-- here7to_Adv = ss ["تْ هري"] ;
|
||||
-- here7from_Adv = ss ["فرْم هري"] ;
|
||||
how_IAdv = ss "كَيفَ" ;
|
||||
-- how8many_IDet = mkDeterminer Pl ["هْو مَني"] ;
|
||||
-- if_Subj = ss "ِف" ;
|
||||
-- in8front_Prep = ss ["ِن فرْنت ْف"] ;
|
||||
i_Pron = mkNP "أَنَا" "نِي" "ِي" (Per1 Sing);
|
||||
in_Prep = ss "فِي" ;
|
||||
-- it_Pron = mkNP "ِت" "ِت" "ِتس" Sg P3 ;
|
||||
-- less_CAdv = ss "لسّ" ;
|
||||
many_Det = mkDet "جَمِيع" Pl Const ;
|
||||
-- more_CAdv = ss "مْري" ;
|
||||
-- most_Predet = ss "مْست" ;
|
||||
much_Det = mkDet "الكَثِير" Pl Const ;
|
||||
-- must_VV = {
|
||||
-- s = table VVForm [["بي هَثي تْ"] ; "مُست" ; ["هَد تْ"] ;
|
||||
-- ["هَد تْ"] ; ["هَثِنغ تْ"] ; "مُستنءت" ; ["هَدنءت تْ"]] ; ----
|
||||
-- isAux = True
|
||||
-- } ;
|
||||
-- no_Phr = ss "نْ" ;
|
||||
-- on_Prep = ss "ْن" ;
|
||||
one_Quant = mkQuantNum "واحِد" Sg Indef ;
|
||||
-- only_Predet = ss "ْنلي" ;
|
||||
-- or_Conj = ss "ْر" ** {n = Sg} ;
|
||||
-- otherwise_PConj = ss "ْتهروِسي" ;
|
||||
-- part_Prep = ss "ْف" ;
|
||||
-- please_Voc = ss "ةلَسي" ;
|
||||
-- possess_Prep = ss "ْف" ;
|
||||
-- quite_Adv = ss "قُِتي" ;
|
||||
-- she_Pron = mkNP "سهي" "هر" "هر" Sg P3 ;
|
||||
-- so_AdA = ss "سْ" ;
|
||||
-- somebody_NP = regNP "سْمبْدي" Sg ;
|
||||
someSg_Det = mkDet "أَحَد" Pl Const ;
|
||||
somePl_Det = mkDet "بَعض" Pl Const ;
|
||||
-- something_NP = regNP "سْمتهِنغ" Sg ;
|
||||
-- somewhere_Adv = ss "سْموهري" ;
|
||||
that_Quant = mkQuant3 "ذَلِكَ" "تِلكَ" "أُلٱِكَ" Def;
|
||||
-- that_NP = regNP "تهَت" Sg ;
|
||||
there_Adv = ss "هُناك" ;
|
||||
-- there7to_Adv = ss "تهري" ;
|
||||
-- there7from_Adv = ss ["فرْم تهري"] ;
|
||||
-- therefore_PConj = ss "تهرفْري" ;
|
||||
-- these_NP = regNP "تهسي" Pl ;
|
||||
they_Pron = mkNP "هُمْ" "هُمْ" "هُمْ" (Per3 Masc Pl) ;
|
||||
this_Quant = mkQuant7 "هَذا" "هَذِهِ" "هَذَان" "هَذَيْن" "هَاتَان" "هَاتَيْن" "هَؤُلَاء" Def;
|
||||
-- this_NP = regNP "تهِس" Sg ;
|
||||
-- those_NP = regNP "تهْسي" Pl ;
|
||||
-- through_Prep = ss "تهرُْغه" ;
|
||||
-- too_AdA = ss "تّْ" ;
|
||||
-- to_Prep = ss "تْ" ;
|
||||
-- under_Prep = ss "ُندر" ;
|
||||
-- very_AdA = ss "ثري" ;
|
||||
-- want_VV = P.mkVV (P.regV "وَنت") ;
|
||||
we_Pron = mkNP "نَحنُ" "نا" "نا" (Per1 Plur) ;
|
||||
whatPl_IP = mkIP "ماذا" Pl ;
|
||||
whatSg_IP = mkIP "ماذا" Sg ;
|
||||
when_IAdv = ss "مَتَى" ;
|
||||
-- when_Subj = ss "وهن" ;
|
||||
where_IAdv = ss "أَينَ" ;
|
||||
-- whichPl_IDet = mkDeterminer Pl ["وهِعه"] ;
|
||||
-- whichSg_IDet = mkDeterminer Sg ["وهِعه"] ;
|
||||
whoSg_IP = mkIP "مَنْ" Sg ;
|
||||
whoPl_IP = mkIP "مَنْ" Pl ;
|
||||
-- why_IAdv = ss "وهي" ;
|
||||
-- without_Prep = ss "وِتهُْت" ;
|
||||
with_Prep = ss "مَع" ;
|
||||
-- yes_Phr = ss "يس" ;
|
||||
youSg_Pron = mkNP "أَنتَ" "كَ" "كَ" (Per2 Masc Sg) ;
|
||||
youPl_Pron = mkNP "أَنتُمْ" "كُمْ" "كُمْ" (Per2 Masc Sg) ;
|
||||
youPol_Pron = mkNP "أَنتِ" "كِ" "كِ" (Per2 Fem Sg) ;
|
||||
--
|
||||
--
|
||||
--oper
|
||||
-- mkQuant : Str -> Str -> {s : Number => Str} = \x,y -> {
|
||||
-- s = table Number [x ; y]
|
||||
-- } ;
|
||||
--
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
UseV = predV ;
|
||||
ComplV2 v np = insertObj np (predV v);
|
||||
ComplV3 v np np2 = insertObj np2 (insertObj np (predV v)) ;
|
||||
|
||||
{-{s = \\_ => v.c2 ++ np.s ! Acc ++ v.c3 ++ np2.s ! Acc ;
|
||||
a = {pgn = Per3 Masc Sg ; isPron = False} } --FIXME
|
||||
(predV v) ;-}
|
||||
--
|
||||
-- ComplVV v vp = insertObj (\\a => infVP v.isAux vp a) (predVV v) ;
|
||||
--
|
||||
-- ComplVS v s = insertObj (\\_ => conjThat ++ s.s) (predV v) ;
|
||||
-- ComplVQ v q = insertObj (\\_ => q.s ! QIndir) (predV v) ;
|
||||
--
|
||||
-- ComplVA v ap = insertObj (ap.s) (predV v) ;
|
||||
-- ComplV2A v np ap =
|
||||
-- insertObj (\\_ => v.c2 ++ np.s ! Acc ++ ap.s ! np.a) (predV v) ;
|
||||
--
|
||||
UseComp xabar = kaan xabar ;
|
||||
|
||||
AdvVP vp adv = insertStr adv.s vp ;
|
||||
|
||||
-- AdVVP adv vp = insertAdV adv.s vp ;
|
||||
--
|
||||
-- ReflV2 v = insertObj (\\a => v.c2 ++ reflPron ! a) (predV v) ;
|
||||
--
|
||||
-- PassV2 v = insertObj (\\_ => v.s ! VPPart) (predAux auxBe) ;
|
||||
--
|
||||
-- UseVS, UseVQ = \vv -> {s = vv.s ; c2 = [] ; isRefl = vv.isRefl} ; -- no "تْ"
|
||||
--
|
||||
CompAP ap = {s = \\agr,c => ap.s ! Hum ! agr.g ! agr.n ! Indef ! c} ; --FIXME
|
||||
CompNP np = {s = \\_,c => np.s ! c};
|
||||
-- CompAdv a = {s = \\_ => a.s} ;
|
||||
--
|
||||
--
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
concrete CommonX of Common = open (R = ParamX) in {
|
||||
|
||||
lincat
|
||||
Text = {s : Str} ; --lock_Text : {}} ;
|
||||
Phr = {s : Str} ; --lock_Phr : {}} ;
|
||||
Utt = {s : Str} ; --lock_Utt : {}} ;
|
||||
Voc = {s : Str} ; --lock_Voc : {}} ;
|
||||
SC = {s : Str} ; --lock_SC : {}} ;
|
||||
Adv = {s : Str} ; --lock_Adv : {}} ;
|
||||
AdV = {s : Str} ; --lock_AdV : {}} ;
|
||||
AdA = {s : Str} ; --lock_AdA : {}} ;
|
||||
AdN = {s : Str} ; --lock_AdN : {}} ;
|
||||
IAdv = {s : Str} ; --lock_IAdv : {}} ;
|
||||
CAdv = {s : Str} ; --lock_CAdv : {}} ;
|
||||
PConj = {s : Str} ; --lock_PConj : {}} ;
|
||||
|
||||
Tense = {s : Str ; t : R.Tense} ;
|
||||
Ant = {s : Str ; a : R.Anteriority} ;
|
||||
Pol = {s : Str ; p : R.Polarity} ;
|
||||
|
||||
lin
|
||||
PPos = {s = []} ** {p = R.Pos} ;
|
||||
PNeg = {s = []} ** {p = R.Neg} ;
|
||||
TPres = {s = []} ** {t = R.Pres} ;
|
||||
TPast = {s = []} ** {t = R.Past} ; --# notpresent
|
||||
TFut = {s = []} ** {t = R.Fut} ; --# notpresent
|
||||
TCond = {s = []} ** {t = R.Cond} ; --# notpresent
|
||||
ASimul = {s = []} ** {a = R.Simul} ;
|
||||
AAnter = {s = []} ** {a = R.Anter} ; --# notpresent
|
||||
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
resource ConstructX = open CommonX in {
|
||||
|
||||
oper
|
||||
mkText : Str -> Text = \s -> {s = s ; lock_Text = <>} ;
|
||||
mkPhr : Str -> Phr = \s -> {s = s ; lock_Phr = <>} ;
|
||||
mkUtt : Str -> Utt = \s -> {s = s ; lock_Utt = <>} ;
|
||||
mkVoc : Str -> Voc = \s -> {s = s ; lock_Voc = <>} ;
|
||||
mkSC : Str -> SC = \s -> {s = s ; lock_SC = <>} ;
|
||||
mkAdv : Str -> Adv = \s -> {s = s ; lock_Adv = <>} ;
|
||||
mkAdV : Str -> AdV = \s -> {s = s ; lock_AdV = <>} ;
|
||||
mkAdA : Str -> AdA = \s -> {s = s ; lock_AdA = <>} ;
|
||||
mkAdN : Str -> AdN = \s -> {s = s ; lock_AdN = <>} ;
|
||||
mkIAdv : Str -> IAdv = \s -> {s = s ; lock_IAdv = <>} ;
|
||||
mkCAdv : Str -> CAdv = \s -> {s = s ; lock_CAdv = <>} ;
|
||||
mkPConj : Str -> PConj = \s -> {s = s ; lock_PConj = <>} ;
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
resource ParamX = open Prelude in {
|
||||
|
||||
param
|
||||
Number = Sg | Pl ;
|
||||
Person = P1 | P2 | P3 ;
|
||||
Degree = Posit | Compar | Superl ;
|
||||
|
||||
Anteriority =
|
||||
Simul
|
||||
| Anter --# notpresent
|
||||
;
|
||||
Tense =
|
||||
Pres
|
||||
| Past --# notpresent
|
||||
| Fut --# notpresent
|
||||
| Cond --# notpresent
|
||||
;
|
||||
|
||||
param
|
||||
|
||||
Polarity = Pos | Neg ;
|
||||
|
||||
QForm = QDir | QIndir ;
|
||||
|
||||
oper
|
||||
conjNumber : Number -> Number -> Number = \m,n ->
|
||||
case <m,n> of {
|
||||
<Sg,Sg> => Sg ;
|
||||
_ => Pl
|
||||
} ;
|
||||
|
||||
-- For persons, we let the latter argument win ("either you or I am absent"
|
||||
-- but "either I or you are absent"). This is not quite clear.
|
||||
|
||||
conjPerson : Person -> Person -> Person = \_,p ->
|
||||
p ;
|
||||
|
||||
-- To construct a record with a polarity-dependent table.
|
||||
|
||||
polCases : SS -> SS -> {s : Polarity => Str} = \true,false -> {
|
||||
s = table {
|
||||
Pos => true.s ;
|
||||
Neg => false.s
|
||||
}
|
||||
} ;
|
||||
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
concrete TenseX of Tense = open (R = ParamX) in {
|
||||
|
||||
lincat
|
||||
Tense = {s : Str ; t : R.Tense} ;
|
||||
Ant = {s : Str ; a : R.Anteriority} ;
|
||||
Pol = {s : Str ; p : R.Polarity} ;
|
||||
|
||||
lin
|
||||
PPos = {s = []} ** {p = R.Pos} ;
|
||||
PNeg = {s = []} ** {p = R.Neg} ;
|
||||
TPres = {s = []} ** {t = R.Pres} ;
|
||||
TPast = {s = []} ** {t = R.Past} ;
|
||||
TFut = {s = []} ** {t = R.Fut} ;
|
||||
TCond = {s = []} ** {t = R.Cond} ;
|
||||
ASimul = {s = []} ** {a = R.Simul} ;
|
||||
AAnter = {s = []} ** {a = R.Anter} ;
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
concrete TextX of Text = CommonX ** {
|
||||
|
||||
-- This will work for almost all languages except Spanish.
|
||||
|
||||
lin
|
||||
TEmpty = {s = []} ;
|
||||
TFullStop x xs = {s = x.s ++ "." ++ xs.s} ;
|
||||
TQuestMark x xs = {s = x.s ++ "?" ++ xs.s} ;
|
||||
TExclMark x xs = {s = x.s ++ "!" ++ xs.s} ;
|
||||
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
concrete AdjectiveDan of Adjective = CatDan ** AdjectiveScand with
|
||||
(ResScand = ResDan) ;
|
||||
@@ -1,2 +0,0 @@
|
||||
concrete AdverbDan of Adverb = CatDan ** AdverbScand with
|
||||
(ResScand = ResDan) ;
|
||||
@@ -1,2 +0,0 @@
|
||||
concrete CatDan of Cat = CommonX ** CatScand with
|
||||
(ResScand = ResDan) ;
|
||||
@@ -1,2 +0,0 @@
|
||||
concrete ConjunctionDan of Conjunction = CatDan ** ConjunctionScand with
|
||||
(ResScand = ResDan) ;
|
||||
@@ -1,7 +0,0 @@
|
||||
--# -path=.:../scandinavian:../abstract:../common:prelude
|
||||
|
||||
concrete Danish of DanishAbs =
|
||||
LangDan,
|
||||
IrregDan - [fly_V],
|
||||
ExtraDan
|
||||
** {} ;
|
||||
@@ -1,5 +0,0 @@
|
||||
abstract DanishAbs =
|
||||
Lang,
|
||||
IrregDanAbs - [fly_V],
|
||||
ExtraDanAbs
|
||||
** {} ;
|
||||
@@ -1,86 +0,0 @@
|
||||
instance DiffDan of DiffScand = open CommonScand, Prelude in {
|
||||
|
||||
-- Parameters.
|
||||
|
||||
param
|
||||
Gender = Utr | Neutr ;
|
||||
|
||||
oper
|
||||
utrum = Utr ;
|
||||
neutrum = Neutr ;
|
||||
|
||||
gennum : Gender -> Number -> GenNum = \g,n ->
|
||||
case <g,n> of {
|
||||
<Utr, Sg> => SgUtr ;
|
||||
<Neutr,Sg> => SgNeutr ;
|
||||
_ => Plg
|
||||
} ;
|
||||
|
||||
detDef : Species = Indef ;
|
||||
|
||||
Verb : Type = {
|
||||
s : VForm => Str ;
|
||||
part : Str ;
|
||||
vtype : VType ;
|
||||
isVaere : Bool
|
||||
} ;
|
||||
|
||||
hasAuxBe v = v.isVaere ;
|
||||
|
||||
-- Strings.
|
||||
|
||||
conjThat = "at" ;
|
||||
conjThan = "end" ;
|
||||
conjAnd = "og" ;
|
||||
infMark = "at" ;
|
||||
compMore = "mere" ;
|
||||
|
||||
subjIf = "hvis" ;
|
||||
|
||||
artIndef : Gender => Str = table {
|
||||
Utr => "en" ;
|
||||
Neutr => "et"
|
||||
} ;
|
||||
|
||||
verbHave =
|
||||
mkVerb "have" "har" "hav" "havde" "haft" nonExist nonExist nonExist **
|
||||
{part = [] ; isVaere = False} ;
|
||||
verbBe =
|
||||
mkVerb "være" "er" "var" "var" "været" "væren" "været" "værne" **
|
||||
{part = [] ; isVaere = False} ;
|
||||
verbBecome =
|
||||
mkVerb "blive" "bliver" "bliv" "blev" "blevet"
|
||||
"bliven" "blivet" "blivne" **
|
||||
{part = [] ; isVaere = True} ;
|
||||
|
||||
auxFut = "vil" ; -- "skal" in ExtDan
|
||||
auxCond = "ville" ;
|
||||
|
||||
negation : Polarity => Str = table {
|
||||
Pos => [] ;
|
||||
Neg => "ikke"
|
||||
} ;
|
||||
|
||||
genderForms : (x1,x2 : Str) -> Gender => Str = \all,allt ->
|
||||
table {
|
||||
Utr => all ;
|
||||
Neutr => allt
|
||||
} ;
|
||||
|
||||
relPron : GenNum => RCase => Str = \\gn,c => case c of {
|
||||
RNom => "som" ;
|
||||
RGen => "hvis" ;
|
||||
RPrep => gennumForms "hvilken" "hvilket" "hvilke" ! gn
|
||||
} ;
|
||||
|
||||
pronSuch = gennumForms "sådan" "sådant" "sådanne" ;
|
||||
|
||||
reflPron : Agr -> Str = \a -> case a of {
|
||||
{gn = Plg ; p = P1} => "oss" ;
|
||||
{gn = Plg ; p = P2} => "jer" ;
|
||||
{p = P1} => "mig" ;
|
||||
{p = P2} => "dig" ;
|
||||
{p = P3} => "sig"
|
||||
} ;
|
||||
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
concrete ExtraDan of ExtraDanAbs = ExtraScandDan ** open CommonScand, ResDan in {
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
-- Structures special for Danish. These are not implemented in other
|
||||
-- Scandinavian languages.
|
||||
|
||||
abstract ExtraDanAbs = ExtraScandAbs ** {
|
||||
|
||||
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
concrete ExtraScandDan of ExtraScandAbs = CatDan ** ExtraScand with
|
||||
(ResScand = ResDan) ;
|
||||
@@ -1,21 +0,0 @@
|
||||
--# -path=.:../scandinavian:../abstract:../common:prelude
|
||||
|
||||
concrete GrammarDan of Grammar =
|
||||
NounDan,
|
||||
VerbDan,
|
||||
AdjectiveDan,
|
||||
AdverbDan,
|
||||
NumeralDan,
|
||||
SentenceDan,
|
||||
QuestionDan,
|
||||
RelativeDan,
|
||||
ConjunctionDan,
|
||||
PhraseDan,
|
||||
TextX,
|
||||
IdiomDan,
|
||||
StructuralDan
|
||||
** {
|
||||
|
||||
flags startcat = Phr ; unlexer = text ; lexer = text ;
|
||||
|
||||
} ;
|
||||
@@ -1,41 +0,0 @@
|
||||
concrete IdiomDan of Idiom = CatDan **
|
||||
open MorphoDan, ParadigmsDan, IrregDan, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
ImpersCl vp = mkClause "det" (agrP3 neutrum Sg) vp ;
|
||||
GenericCl vp = mkClause "man" (agrP3 utrum Sg) vp ;
|
||||
|
||||
CleftNP np rs = mkClause "det" (agrP3 neutrum Sg)
|
||||
(insertObj (\\_ => rs.s ! np.a)
|
||||
(insertObj (\\_ => np.s ! rs.c) (predV verbBe))) ;
|
||||
|
||||
CleftAdv ad s = mkClause "det" (agrP3 neutrum Sg)
|
||||
(insertObj (\\_ => "som" ++ s.s ! Sub)
|
||||
(insertObj (\\_ => ad.s) (predV verbBe))) ;
|
||||
|
||||
|
||||
ExistNP np =
|
||||
mkClause "det" (agrP3 neutrum Sg) (insertObj
|
||||
(\\_ => np.s ! accusative) (predV (depV finde_V))) ;
|
||||
|
||||
ExistIP ip = {
|
||||
s = \\t,a,p =>
|
||||
let
|
||||
cls =
|
||||
(mkClause "det" (agrP3 neutrum Sg) (predV (depV finde_V))).s ! t ! a ! p ;
|
||||
who = ip.s ! accusative
|
||||
in table {
|
||||
QDir => who ++ cls ! Inv ;
|
||||
QIndir => who ++ cls ! Sub
|
||||
}
|
||||
} ;
|
||||
|
||||
ProgrVP vp =
|
||||
insertObj (\\a => ["ved å"] ++ infVP vp a) (predV verbBe) ;
|
||||
|
||||
ImpPl1 vp = {s = ["lad os"] ++ infVP vp {gn = Plg ; p = P1}} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
--# -path=.:../scandinavian:../common:../abstract:../../prelude
|
||||
|
||||
-- http://users.cybercity.dk/~nmb3879/danishgram3.html
|
||||
|
||||
concrete IrregDan of IrregDanAbs = CatDan ** open Prelude, ParadigmsDan in {
|
||||
|
||||
flags optimize=values ;
|
||||
|
||||
lin
|
||||
|
||||
bære_V = irregV "bære" "bar" "båret" ;
|
||||
bede_V = mkV "bede" "beder" "bedes" "bad" "bedt" "bed" ;
|
||||
bide_V = irregV "bite" "bed" "bidt" ;
|
||||
binde_V = irregV "binde" "bandt" "bundet" ;
|
||||
blive_V = irregV "blive" "blev" "blevet" ;
|
||||
brænde_V = irregV "brænde" "brandt" "brændt" ;--
|
||||
bringe_V = irregV "bringe" "bragte" "bragt" ;
|
||||
burde_V = irregV "burde" "burde" "burdet" ;--
|
||||
dø_V = irregV "dø" "døde" "død" ;
|
||||
drage_V = irregV "drage" "drog" "draget" ;
|
||||
drikke_V = irregV "drikke" "drak" "drukket" ;
|
||||
drive_V = irregV "drive" "drev" "drevet" ;
|
||||
falde_V = irregV "falde" "faldt" "faldet" ;----er
|
||||
få_V = irregV "få" "fik" "fået" ;
|
||||
finde_V = irregV "finde" "fandt" "fundet" ;
|
||||
flyde_V = irregV "flyde" "flød" "flydt" ;
|
||||
flyve_V = irregV "flyve" "fløj" "fløjet" ;
|
||||
forlade_V = irregV "forlade" "forlod" "forladet" ;
|
||||
forstå_V = irregV "forstå" "forstod" "forstået" ;
|
||||
fryse_V = irregV "fryse" "frøs" "frosset" ;
|
||||
gå_V = irregV "gå" "gik" "gået" ;----er
|
||||
give_V = irregV "give" "gav" "givet" ;
|
||||
gnide_V = irregV "gnide" "gned" "gnidd" ;--
|
||||
gøre_V = irregV "gøre" "gjorde" "gjort" ;
|
||||
have_V = mkV "have" "har" "havde" "haft" nonExist "hav" ;
|
||||
hente_V = irregV "hente" "hentet" "hendt" ;--
|
||||
-- hete_V = irregV "hete" (variants {"het" ;-- "hette"}) "hett" ;--
|
||||
-- hjelpe_V = irregV "hjelpe" "hjalp" "hjulpet" ;--
|
||||
holde_V = irregV "holde" "holdt" "holdt" ;--
|
||||
komme_V = irregV "komme" "kom" "kommet" ;
|
||||
kunne_V = irregV "kunne" "kunne" "kunnet" ;
|
||||
lade_V = irregV "lade" "lod" "ladet" ;
|
||||
lægge_V = irregV "lægge" "lagde" "lagt" ;
|
||||
le_V = irregV "le" "lo" "leet" ;
|
||||
ligge_V = irregV "ligge" "lå" "ligget" ;
|
||||
løbe_V = irregV "løbe" "løb" "løbet" ;
|
||||
måtte_V = irregV "måtte" "måtte" "måttet" ;
|
||||
renne_V = irregV "renne" "rant" "rent" ;--
|
||||
sælge_V = irregV "sælge" "solgte" "solgt" ;
|
||||
sætte_V = irregV "sætte" "satte" "sat" ;
|
||||
se_V = irregV "se" "så" "set" ;
|
||||
sidde_V = irregV "sidde" "sad" "siddet" ;
|
||||
sige_V = irregV "sige" "sagde" "sagt" ;
|
||||
skære_V = irregV "skære" "skar" "skåret" ;--
|
||||
skrive_V = irregV "skrive" "skrev" "skrevet" ;
|
||||
skulle_V = irregV "skulle" "skulle" "skullet" ;
|
||||
slå_V = irregV "slå" "slog" "slått" ;--
|
||||
sove_V = irregV "sove" "sov" "sovet" ;
|
||||
spørge_V = irregV "spørge" "spurgte" "spurgt" ;
|
||||
springe_V = irregV "springe" "sprang" "sprunget" ;--
|
||||
stå_V = irregV "stå" "stod" "stået" ;
|
||||
stikke_V = irregV "stikke" "stakk" "stukket" ;--
|
||||
synge_V = irregV "synge" "sang" "sunget" ;--
|
||||
tage_V = irregV "tage" "tog" "taget" ;
|
||||
-- treffe_V = irregV "treffe" "traff" "truffet" ;--
|
||||
-- trives_V = irregV "trives" "trivdes" (variants {"trives" ;-- "trivs"}) ;--
|
||||
tælle_V = irregV "tælle" "talte" "talt" ;
|
||||
vide_V = irregV "vide" "vidste" "vidst" ;
|
||||
|
||||
}
|
||||
|
||||
-- readFile "vrbs.tmp" >>= mapM_ (putStrLn . (\ (a:_:b:c:_) -> " " ++ a ++ "_V = irregV \"" ++ a ++ "\" \"" ++ b ++ "\" \"" ++ c ++ "\" ;") . words) . lines
|
||||
@@ -1,65 +0,0 @@
|
||||
abstract IrregDanAbs = Cat ** {
|
||||
|
||||
fun
|
||||
|
||||
bćre_V : V ;
|
||||
bede_V : V ;
|
||||
bide_V : V ;
|
||||
binde_V : V ;
|
||||
blive_V : V ;
|
||||
brćnde_V : V ;
|
||||
bringe_V : V ;
|
||||
burde_V : V ;
|
||||
dř_V : V ;
|
||||
drage_V : V ;
|
||||
drikke_V : V ;
|
||||
drive_V : V ;
|
||||
falde_V : V ;
|
||||
fĺ_V : V ;
|
||||
finde_V : V ;
|
||||
flyde_V : V ;
|
||||
flyve_V : V ;
|
||||
forlade_V : V ;
|
||||
forstĺ_V : V ;
|
||||
fryse_V : V ;
|
||||
gĺ_V : V ;
|
||||
give_V : V ;
|
||||
-- gjelde_V : V ;
|
||||
gnide_V : V ;
|
||||
gřre_V : V ;
|
||||
have_V : V ;
|
||||
hente_V : V ;
|
||||
-- hete_V : V ;
|
||||
-- hjelpe_V : V ;
|
||||
holde_V : V ;
|
||||
komme_V : V ;
|
||||
kunne_V : V ;
|
||||
lade_V : V ;
|
||||
lćgge_V : V ;
|
||||
le_V : V ;
|
||||
ligge_V : V ;
|
||||
lřbe_V : V ;
|
||||
mĺtte_V : V ;
|
||||
renne_V : V ;
|
||||
sćlge_V : V ;
|
||||
sćtte_V : V ;
|
||||
se_V : V ;
|
||||
sidde_V : V ;
|
||||
sige_V : V ;
|
||||
skćre_V : V ;
|
||||
skrive_V : V ;
|
||||
skulle_V : V ;
|
||||
slĺ_V : V ;
|
||||
sove_V : V ;
|
||||
spřrge_V : V ;
|
||||
springe_V : V ;
|
||||
stĺ_V : V ;
|
||||
stikke_V : V ;
|
||||
synge_V : V ;
|
||||
tage_V : V ;
|
||||
tćlle_V : V ;
|
||||
-- treffe_V : V ;
|
||||
-- trives_V : V ;
|
||||
vide_V : V ;
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
--# -path=.:../scandinavian:../abstract:../common:prelude
|
||||
|
||||
concrete LangDan of Lang =
|
||||
GrammarDan,
|
||||
LexiconDan
|
||||
** {
|
||||
|
||||
flags startcat = Phr ; unlexer = text ; lexer = text ;
|
||||
|
||||
} ;
|
||||
@@ -1,359 +0,0 @@
|
||||
--# -path=.:../scandinavian:../common:../abstract:../../prelude
|
||||
|
||||
|
||||
|
||||
concrete LexiconDan of Lexicon = CatDan **
|
||||
open Prelude, ParadigmsDan, IrregDan in {
|
||||
|
||||
flags startcat=Phr ; lexer=textlit ; unlexer=text ;
|
||||
optimize=values ;
|
||||
|
||||
lin
|
||||
airplane_N = mk2N "fly" "flyet" ;
|
||||
answer_V2S = mkV2S (regV "svare") (mkPrep "til") ;
|
||||
apartment_N = mk2N "værelse" "værelsen" ;
|
||||
apple_N = mk3N "æble" "æblet" "æbler" ;
|
||||
art_N = mk2N "kunst" "kunsten" ;
|
||||
ask_V2Q = mkV2Q spørge_V noPrep ;
|
||||
baby_N = mk2N "baby" "babyen" ; ---- babyen
|
||||
bad_A = regADeg "dårlig" ; ----
|
||||
bank_N = mk2N "bank" "banken" ;
|
||||
beautiful_A = mk3ADeg "smuk" "smukt" "smukke" ; ----
|
||||
become_VA = mkVA blive_V ;
|
||||
beer_N = mk2N "øl" "ølet" ;
|
||||
beg_V2V = mkV2V bede_V noPrep (mkPrep "at") ;
|
||||
big_A = irregADeg "stor" "større" "størst";
|
||||
bike_N = mkN "cykel" "cykeln" "cykler" "cyklerne" ; ----
|
||||
bird_N = mk2N "fugl" "fuglen" ;
|
||||
black_A = mk2ADeg "sort" "sort" ;
|
||||
blue_A = mk2ADeg "blå" "blått";
|
||||
boat_N = mk3N "båd" "båden" "både" ;
|
||||
book_N = mkN "bog" "bogen" "bøger" "bøgene" ;
|
||||
boot_N = mkN "støvle" "støvlen" "støvler" "støvlerne" ;
|
||||
boss_N = mk2N "chef" "chefen" ;
|
||||
boy_N = mk2N "dreng" "drengen" ;
|
||||
bread_N = mk2N "brød" "brødet" ;
|
||||
break_V2 = dirV2 (mk2V "knuse" "knuste") ;
|
||||
broad_A = regADeg "bred" ;
|
||||
brother_N2 = mkN2 (mk3N "broder" "brodren" "brødre") (mkPrep "til") ; ----
|
||||
brown_A = regADeg "brun" ;
|
||||
butter_N = mk2N "smør" "smøret" ;
|
||||
buy_V2 = dirV2 (mk2V "købe" "købte") ; ----
|
||||
camera_N = mk2N "kamera" "kameraen" ; ----
|
||||
cap_N = mk2N "hue" "huen" ;
|
||||
car_N = mk2N "bil" "bilen" ;
|
||||
carpet_N = mk2N "tæppe" "tæppen" ;
|
||||
cat_N = mk3N "kat" "katten" "katte" ;
|
||||
ceiling_N = mk2N "loft" "loftet" ;
|
||||
chair_N = mk3N "stol" "stolen" "stole" ;
|
||||
cheese_N = mk2N "ost" "osten" ;
|
||||
child_N = mk3N "barn" "barnet" "børn" ; ----
|
||||
church_N = mk2N "kirke" "kirken" ;
|
||||
city_N = mk2N "by" "byen" ;
|
||||
clean_A = regADeg "ren" ;
|
||||
clever_A = regADeg "flink" ;
|
||||
close_V2 = dirV2 (mk2V "lukke" "lukkede") ;
|
||||
coat_N = mk2N "frakke" "frakken" ;
|
||||
cold_A = regADeg "kold" ;
|
||||
come_V = vaereV komme_V ;
|
||||
computer_N = mk2N "datamaskine" "datamaskinen" ;
|
||||
country_N = mk2N "land" "landet" ;
|
||||
cousin_N = mk3N "fætter" "fættren" "fættre" ; ----
|
||||
cow_N = mk2N "ku" "kuen" ; ----
|
||||
die_V = vaereV dø_V ;
|
||||
dirty_A = regADeg "smudsig" ; ----
|
||||
distance_N3 = mkN3 (regGenN "afstand" utrum) (mkPrep "fra") (mkPrep "til") ;
|
||||
doctor_N = mk2N "læge" "lægen" ;
|
||||
dog_N = mk2N "hund" "hunden" ;
|
||||
door_N = mk2N "dør" "døren" ;
|
||||
drink_V2 = dirV2 drikke_V ;
|
||||
easy_A2V = mkA2V (regA "nem") (mkPrep "for") ; ----
|
||||
eat_V2 = dirV2 (mk2V "spise" "spiste") ;
|
||||
empty_A = mkADeg "tøm" "tømt" "tømme" "tømmere" "tømmest" ; ----
|
||||
enemy_N = mk2N "fjende" "fjenden" ;
|
||||
factory_N = mk2N "fabrik" "fabriken" ;
|
||||
father_N2 = mkN2 ( (mk3N "far" "fadren" "fædre")) (mkPrep "til") ; ----
|
||||
fear_VS = mkVS (regV "frygte") ;
|
||||
find_V2 = dirV2 (irregV "finde" "fand" "fundet") ; ----
|
||||
fish_N = mk2N "fisk" "fisken" ;
|
||||
floor_N = mk2N "gulv" "gulvet" ;
|
||||
forget_V2 = dirV2 (mkV "glemme" "glemmer" "glemmes" "glemte" "glemt" "glem") ; ----
|
||||
fridge_N = mk2N "køleskab" "køleskabet" ;
|
||||
friend_N = mk3N "ven" "vennen" "venner" ; ----
|
||||
fruit_N = mk2N "frugt" "frugten" ;
|
||||
fun_AV = mkAV (mkA "morsom" "morsomt" "morsomme") ; ----
|
||||
garden_N = mk2N "have" "haven" ;
|
||||
girl_N = mk2N "pige" "pigen" ;
|
||||
glove_N = mk2N "handske" "handsken" ;
|
||||
gold_N = mk2N "guld" "guldet" ;
|
||||
good_A = mkADeg "god" "godt" "gode" "bedre" "bedst" ; ----
|
||||
go_V = vaereV gå_V ;
|
||||
green_A = mk3ADeg "grøn" "grønt" "grønne" ;
|
||||
harbour_N = mk2N "havn" "havnen" ;
|
||||
hate_V2 = dirV2 (regV "hade") ;
|
||||
hat_N = mk3N "hat" "hatten" "hatte" ;
|
||||
have_V2 = dirV2 have_V ;
|
||||
hear_V2 = dirV2 (mk2V "høre" "hørte") ;
|
||||
hill_N = mk2N "høj" "højen" ;
|
||||
hope_VS = mkVS (regV "håbe") ;
|
||||
horse_N = mk3N "hest" "hesten" "heste" ;
|
||||
hot_A = regADeg "hed" ;
|
||||
house_N = mk3N "hus" "huset" "huse" ;
|
||||
important_A = regADeg "vigtig" ;
|
||||
industry_N = mk2N "industri" "industrien" ;
|
||||
iron_N = mk2N "jern" "jernet" ;
|
||||
king_N = mk2N "konge" "kongen" ;
|
||||
know_V2 = dirV2 vide_V ;
|
||||
lake_N = mk2N "sø" "søen" ;
|
||||
lamp_N = mk2N "lampe" "lampen" ;
|
||||
learn_V2 = dirV2 (mk2V "lære" "lærte") ;
|
||||
leather_N = mk2N "læder" "lædret" ;
|
||||
leave_V2 = dirV2 forlade_V ;
|
||||
like_V2 = mkV2 holde_V (mkPrep "af") ;
|
||||
listen_V2 = dirV2 (regV "lytte") ;
|
||||
live_V = mk2V "leve" "levde" ;
|
||||
long_A = irregADeg "lang" "længere" "længst" ; ----
|
||||
lose_V2 = dirV2 (regV "tabe") ;
|
||||
love_N = mk2N "kærlighed" "kærligheden" ;
|
||||
love_V2 = dirV2 (regV "elske") ;
|
||||
man_N = mkN "mand" "manden" "mænd" "mændene" ;
|
||||
married_A2 = mkA2 (mk2A "gift" "gift") (mkPrep "med") ;
|
||||
meat_N = mk2N "kød" "kødet" ;
|
||||
milk_N = mk2N "mælk" "mælken" ;
|
||||
moon_N = mk2N "måne" "månen" ;
|
||||
mother_N2 = mkN2 (mkN "moder" "moderen" "mødre" "mødrene") (mkPrep "til") ; ----
|
||||
mountain_N = mk2N "bjerg" "bjerget" ;
|
||||
music_N = mk2N "musik" "musiken" ;
|
||||
narrow_A = regADeg "smal" ;
|
||||
new_A = mkADeg "ny" "nytt" "nye" "nyere" "nyest" ;
|
||||
newspaper_N = mk2N "avis" "avisen" ;
|
||||
oil_N = mk2N "olie" "olien" ;
|
||||
old_A = mkADeg "gammel" "gammelt" "gamle" "ældre" "ældst" ; ----
|
||||
open_V2 = dirV2 (regV "åbne") ;
|
||||
paint_V2A = mkV2A (regV "male") noPrep ;
|
||||
paper_N = mk2N "papir" "papiret" ;
|
||||
paris_PN = mkPN "Paris" neutrum ;
|
||||
peace_N = mk2N "fred" "freden" ;
|
||||
pen_N = mk2N "pen" "penen" ;
|
||||
planet_N = mk2N "planet" "planeten" ;
|
||||
plastic_N = mk2N "plast" "plasten" ;
|
||||
play_V2 = dirV2 (mk2V "spille" "spilte") ;
|
||||
policeman_N = mk2N "politibetjent" "politibetjenten" ; ----
|
||||
priest_N = mk2N "præst" "præsten" ;
|
||||
probable_AS = mkAS (regA "sandsynlig") ;
|
||||
queen_N = mk2N "dronning" "dronningen" ;
|
||||
radio_N = mk2N "radio" "radioen" ;
|
||||
rain_V0 = mkV0 (regV "regne") ;
|
||||
read_V2 = dirV2 (mk2V "læse" "læste") ;
|
||||
red_A = regADeg "rød" ;
|
||||
religion_N = mk2N "religion" "religionen" ;
|
||||
restaurant_N = mk2N "restaurant" "restauranten" ;
|
||||
river_N = mk2N "flod" "floden" ;
|
||||
rock_N = mk2N "sten" "stenen" ;
|
||||
roof_N = mk2N "tag" "taget" ;
|
||||
rubber_N = mk2N "gummi" "gummien" ;
|
||||
run_V = vaereV (regV "løbe") ;
|
||||
say_VS = mkVS sige_V ;
|
||||
school_N = mk2N "skole" "skolen" ;
|
||||
science_N = mk2N "videnskab" "videnskaben" ;
|
||||
sea_N = mk2N "hav" "havet" ;
|
||||
see_V2 = dirV2 se_V ;
|
||||
seek_V2 = mkV2 (mk2V "søge" "søgte") (mkPrep "efter") ;
|
||||
sell_V3 = dirV3 sælge_V (mkPrep "til") ;
|
||||
send_V3 = dirV3 (mk2V "sende" "sendte") (mkPrep "til") ;
|
||||
sheep_N = mk2N "får" "fåret" ;
|
||||
ship_N = mk2N "skib" "skibet" ;
|
||||
shirt_N = mk2N "skjorte" "skjorten" ;
|
||||
shoe_N = mk2N "sko" "skoen" ;
|
||||
shop_N = mk2N "butik" "butiken" ;
|
||||
short_A = regADeg "kort" ;
|
||||
silver_N = mk2N "sølv" "sølvet";
|
||||
sister_N = mk3N "søster" "søstren" "søstrer" ; ----
|
||||
sleep_V = sove_V ;
|
||||
small_A = mkADeg "lille" "lille" "små" "mindre" "mindst" ; ----
|
||||
snake_N = mk2N "slange" "slangen" ;
|
||||
sock_N = mk2N "sok" "sokken" ;
|
||||
speak_V2 = dirV2 (regV "tale") ; ----
|
||||
star_N = mk2N "stjerne" "stjernen" ;
|
||||
steel_N = mk2N "stål" "stålet" ;
|
||||
stone_N = mk2N "sten" "stenen" ;
|
||||
stove_N = mk2N "komfur" "komfuren" ;
|
||||
student_N = mk2N "student" "studenten" ;
|
||||
stupid_A = mk3ADeg "dum" "dumt" "dumme" ;
|
||||
sun_N = mk2N "sol" "solen" ;
|
||||
switch8off_V2 = dirV2 (partV (regV "lukke") "for") ;
|
||||
switch8on_V2 = dirV2 (partV (regV "lukke") "op") ;
|
||||
table_N = mk2N "bord" "bordet" ;
|
||||
talk_V3 = mkV3 (regV "tale") (mkPrep "til") (mkPrep "om") ;
|
||||
teacher_N = mkN "lærer" "læreren" "lærere" "lærerne" ;
|
||||
teach_V2 = dirV2 (mk2V "undervise" "underviste") ;
|
||||
television_N = mk2N "fjernsyn" "fjernsynet" ;
|
||||
thick_A = mk3ADeg "tyk" "tykt" "tykke" ;
|
||||
thin_A = mk2ADeg "tynd" "tyndt" ; ----
|
||||
train_N = mk2N "tog" "toget" ;
|
||||
travel_V = vaereV (mk2V "rejse" "rejste") ;
|
||||
tree_N = mkN "træ" "træet" "træer" "træene" ; ----
|
||||
---- trousers_N = regGenN "trousers" ; ---- pl t !
|
||||
ugly_A = mk3ADeg "grim" "grimt" "grimme" ;
|
||||
understand_V2 = dirV2 (irregV "forstå" "forstod" "forstått") ;
|
||||
university_N = mk2N "universitet" "universitetet" ;
|
||||
village_N = mk2N "landsby" "landsbyen" ;
|
||||
wait_V2 = mkV2 (regV "vente") (mkPrep "på") ;
|
||||
walk_V = vaereV gå_V ;
|
||||
warm_A = regADeg "varm" ;
|
||||
war_N = mk2N "krig" "krigen" ;
|
||||
watch_V2 = mkV2 se_V (mkPrep "på") ;
|
||||
water_N = mk2N "vand" "vandet" ;
|
||||
white_A = regADeg "hvid" ;
|
||||
window_N = mkN "vindue" "vinduet" "vinduer" "vinduene" ; ---- er?
|
||||
wine_N = mk2N "vin" "vinen" ;
|
||||
win_V2 = dirV2 (irregV "vinde" "vand" "vundet") ;
|
||||
woman_N = mk2N "kvinde" "kvinden" ;
|
||||
wonder_VQ = mkVQ (depV (regV "undre")) ;
|
||||
wood_N = mkN "træ" "træet" "træer" "træene" ; ----
|
||||
write_V2 = dirV2 (irregV "skrive" "skrev" "skrevet") ;
|
||||
yellow_A = regADeg "gul" ;
|
||||
young_A = irregADeg "ung" "yngre" "yngst" ; ----
|
||||
|
||||
do_V2 = dirV2 gøre_V ;
|
||||
now_Adv = mkAdv "nu" ;
|
||||
already_Adv = mkAdv "allerede" ;
|
||||
song_N = mk2N "sang" "sangen" ;
|
||||
add_V3 = mkV3 (regV "tilføje") noPrep (mkPrep "til") ; ----
|
||||
number_N = mk2N "nummer" "numret" ; ----
|
||||
put_V2 = dirV2 sætte_V ;
|
||||
stop_V = vaereV (regV "standse") ;
|
||||
jump_V = regV "hoppe" ;
|
||||
|
||||
left_Ord = {s = "venstre" ; isDet = True} ;
|
||||
right_Ord = {s = "højre" ; isDet = True} ;
|
||||
far_Adv = mkAdv "fjern" ;
|
||||
correct_A = regA "rigtig" ;
|
||||
dry_A = mk3ADeg "tør" "tørt" "tørre" ;
|
||||
dull_A = regA "sløv" ;
|
||||
full_A = regA "fuld" ;
|
||||
heavy_A = irregADeg "tung" "tyngre" "tyngst" ;
|
||||
near_A = mkADeg "nære" "nære" "nære" "nærmere" "nærmest" ;
|
||||
rotten_A = mk3ADeg "rådden" "råddent" "rådne" ; ----
|
||||
round_A = regA "rund" ;
|
||||
sharp_A = regA "skarp" ;
|
||||
smooth_A = regA "jævn" ;
|
||||
straight_A = mk3ADeg "ret" "rett" "rette" ; ----
|
||||
wet_A = regA "våd" ;
|
||||
wide_A = regA "bred" ;
|
||||
animal_N = mk2N "dyr" "dyret" ;
|
||||
ashes_N = mk2N "aske" "asken" ;
|
||||
back_N = mk2N "ryg" "ryggen" ; ----
|
||||
bark_N = mk2N "bark" "barken" ;
|
||||
belly_N = mk2N "mave" "maven" ;
|
||||
blood_N = mk2N "blod" "blodet" ;
|
||||
bone_N = mk2N "ben" "benet" ;
|
||||
breast_N = mk2N "bryst" "brystet" ;
|
||||
cloud_N = mk2N "sky" "skyen" ;
|
||||
day_N = mk3N "dag" "dagen" "dage" ;
|
||||
dust_N = mk2N "støv" "støvet" ;
|
||||
ear_N = mk3N "øre" "øret" "ører" ;
|
||||
earth_N = mk2N "jord" "jorden" ;
|
||||
egg_N = mk2N "æg" "æget" ;
|
||||
eye_N = mk3N "øje" "øjet" "øjne" ;
|
||||
fat_N = mk2N "fedt" "fedtet" ;
|
||||
feather_N = mk2N "fjer" "fjeren" ;
|
||||
fingernail_N = mk2N "negl" "neglen" ;
|
||||
fire_N = mk2N "ild" "ilden" ;
|
||||
flower_N = mk2N "blomst" "blomsten" ;
|
||||
fog_N = mk2N "tåge" "tågen" ;
|
||||
foot_N = mk2N "fod" "føder" ; ----
|
||||
forest_N = mk2N "skov" "skoven" ;
|
||||
grass_N = mk2N "græs" "græset" ;
|
||||
guts_N = mk2N "tarm" "tarmen" ; ---- indvolde
|
||||
hair_N = mk2N "hår" "håret" ;
|
||||
hand_N = mk2N "hånd" "hånden" ;
|
||||
head_N = mk2N "hoved" "hovedet" ;
|
||||
heart_N = mk3N "hjerte" "hjertet" "hjerter" ;
|
||||
horn_N = mk2N "horn" "hornet" ;
|
||||
husband_N = mk2N "ægtefælle" "ægtefællen" ; ----
|
||||
ice_N = mk2N "is" "isen" ;
|
||||
knee_N = mkN "knæ" "knæt" "knær" "knæne" ; ----
|
||||
leaf_N = mk2N "løv" "løvet" ;
|
||||
leg_N = mk2N "ben" "benet" ;
|
||||
liver_N = mkN "lever" "leveren" "levrer" "levrene" ; ----
|
||||
louse_N = mk3N "lus" "lusen" "lus" ;
|
||||
mouth_N = mk2N "mund" "munden" ;
|
||||
name_N = mk2N "navn" "navnet" ;
|
||||
neck_N = mk2N "hals" "halsen" ;
|
||||
night_N = mk3N "nat" "natten" "nætter" ; ----
|
||||
nose_N = mk2N "næse" "næsen" ;
|
||||
person_N = mk2N "person" "personen" ;
|
||||
rain_N = mk2N "regn" "regnet" ;
|
||||
road_N = mk2N "vej" "vejen" ;
|
||||
root_N = mk3N "rod" "roden" "røder" ; ----
|
||||
rope_N = mk2N "reb" "rebet" ;
|
||||
salt_N = mk2N "salt" "saltet" ;
|
||||
sand_N = mk2N "sand" "sanden" ;
|
||||
seed_N = mk2N "frø" "frøet" ;
|
||||
skin_N = mk2N "skind" "skindet" ;
|
||||
sky_N = mk3N "himmel" "himlen" "himler" ; ----
|
||||
smoke_N = mk2N "røg" "røgen" ;
|
||||
snow_N = mk2N "snø" "snøen" ;
|
||||
stick_N = mk2N "pind" "pinden" ;
|
||||
tail_N = mk2N "hale" "halen" ;
|
||||
tongue_N = mk2N "tunge" "tungen" ;
|
||||
tooth_N = mkN "tand" "tanden" "tænder" "tændene" ; ----
|
||||
wife_N = mk2N "kone" "konen" ;
|
||||
wind_N = mk2N "vind" "vinden" ;
|
||||
wing_N = mk2N "vinge" "vingen" ;
|
||||
worm_N = mk2N "orm" "ormen" ;
|
||||
year_N = mk2N "år" "året" ;
|
||||
bite_V2 = dirV2 bide_V ;
|
||||
blow_V = mk2V "blæse" "blæste" ;
|
||||
burn_V = brænde_V ;
|
||||
count_V2 = dirV2 tælle_V ;
|
||||
cut_V2 = dirV2 (skære_V) ;
|
||||
dig_V = mk2V "grave" "gravde" ;
|
||||
fall_V = vaereV falde_V ;
|
||||
fear_V2 = dirV2 (regV "frygte") ;
|
||||
fight_V2 = dirV2 (regV "kæmpe") ;
|
||||
float_V = flyde_V ;
|
||||
flow_V = regV "strømme" ;
|
||||
fly_V = vaereV flyve_V ;
|
||||
freeze_V = fryse_V ;
|
||||
give_V3 = dirdirV3 give_V ;
|
||||
hit_V2 = dirV2 (slå_V) ;
|
||||
hold_V2 = dirV2 (holde_V) ;
|
||||
hunt_V2 = dirV2 (regV "jage") ;
|
||||
kill_V2 = dirV2 (regV "dræbe") ;
|
||||
laugh_V = le_V ;
|
||||
lie_V = ligge_V ;
|
||||
play_V = regV "spille" ;
|
||||
pull_V2 = dirV2 (regV "trække") ;
|
||||
push_V2 = dirV2 (regV "skubbe") ;
|
||||
rub_V2 = dirV2 (gnide_V) ;
|
||||
scratch_V2 = dirV2 (regV "kradse") ;
|
||||
sew_V = mk2V "sy" "sydde" ;
|
||||
sing_V = synge_V ;
|
||||
sit_V = sidde_V ;
|
||||
smell_V = regV "lugte" ;
|
||||
spit_V = regV "spytte" ;
|
||||
split_V2 = dirV2 (regV "splitte") ; ----
|
||||
squeeze_V2 = dirV2 (regV "presse") ;
|
||||
stab_V2 = dirV2 (stikke_V) ;
|
||||
stand_V = vaereV stå_V ;
|
||||
suck_V2 = dirV2 (regV "sutte") ; ----
|
||||
swell_V = regV "svulme" ;
|
||||
swim_V = regV "svømme" ;
|
||||
think_V = mk2V "tænke" "tænkte" ; ----
|
||||
throw_V2 = dirV2 (regV "kaste") ;
|
||||
tie_V2 = dirV2 binde_V ;
|
||||
turn_V = regV "dreje" ;
|
||||
vomit_V = partV (regV "kaste") "op" ;
|
||||
wash_V2 = dirV2 (regV "vaske") ;
|
||||
wipe_V2 = dirV2 (regV "viske") ;
|
||||
breathe_V = regV "ånde" ;
|
||||
|
||||
grammar_N = regN "grammatik" ;
|
||||
language_N = mk2N "sprog" "sproget" ;
|
||||
rule_N = mkN "regel" "regeln" "regler" "reglerne" ;
|
||||
|
||||
|
||||
} ;
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
concrete MathDan of Math = CatDan ** MathScand with
|
||||
(ResScand = ResDan) ;
|
||||
@@ -1,164 +0,0 @@
|
||||
--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 = CommonScand, ResDan ** open Prelude, Predef in {
|
||||
|
||||
oper
|
||||
|
||||
-- type synonyms
|
||||
|
||||
Subst : Type = {s : Number => Species => Case => Str} ;
|
||||
Adj = Adjective ;
|
||||
|
||||
-- nouns
|
||||
|
||||
mkSubstantive : (_,_,_,_ : Str) -> Subst =
|
||||
\dreng, drengen, drenger, drengene ->
|
||||
{s = nounForms dreng drengen drenger drengene} ;
|
||||
|
||||
extNGen : Str -> Gender = \s -> case last s of {
|
||||
"n" => Utr ;
|
||||
_ => Neutr
|
||||
} ;
|
||||
|
||||
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
|
||||
|
||||
mkAdject : (_,_,_,_,_ : Str) -> Adj =
|
||||
\stor,stort,store,storre,storst -> {s = table {
|
||||
AF (APosit (Strong SgUtr )) c => mkCase c stor ;
|
||||
AF (APosit (Strong SgNeutr)) c => mkCase c stort ;
|
||||
AF (APosit _) c => mkCase c store ;
|
||||
AF ACompar c => mkCase c storre ;
|
||||
AF (ASuperl SupStrong) c => mkCase c storst ;
|
||||
AF (ASuperl SupWeak) c => mkCase c (storst + "e")
|
||||
}
|
||||
} ;
|
||||
|
||||
aRod : Str -> Adj = \rod ->
|
||||
mkAdject rod (rod + "t") (rod + "e") (rod + "ere") (rod + "est") ;
|
||||
|
||||
aAbstrakt : Str -> Adj = \abstrakt ->
|
||||
mkAdject abstrakt abstrakt (abstrakt + "e") (abstrakt + "ere") (abstrakt + "est") ;
|
||||
|
||||
aRask : Str -> Adj = \rask ->
|
||||
mkAdject rask rask (rask + "e") (rask + "ere") (rask + "est") ;
|
||||
|
||||
|
||||
-- verbs
|
||||
|
||||
Verbum : Type = {s : VForm => Str} ;
|
||||
|
||||
mkVerb6 : (_,_,_,_,_,_ : Str) -> Verbum =
|
||||
\spise,spiser,spises,spiste,spist,spis -> {s = table {
|
||||
VI (VInfin v) => mkVoice v spise ;
|
||||
VF (VPres Act) => spiser ;
|
||||
VF (VPres Pass) => spises ;
|
||||
VF (VPret v) => mkVoice v spiste ; --# notpresent
|
||||
VI (VSupin v) => mkVoice v spist ; --# notpresent
|
||||
VI (VPtPret (Strong (SgUtr | SgNeutr)) c) => mkCase c spist ;
|
||||
VI (VPtPret _ c) => mkCase c (spist + "e") ;
|
||||
VF (VImper 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
|
||||
mkVerb6 drikke drikker (drikke + "s") drakk drukket (mkImper 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
|
||||
} ;
|
||||
|
||||
vHusk : Str -> Verbum = \husk ->
|
||||
mkVerb6 (husk + "e") (husk + "er") (husk + "es") (husk + "ede") (husk + "et")
|
||||
(mkImper husk) ;
|
||||
|
||||
vSpis : Str -> Verbum = \spis ->
|
||||
mkVerb6 (spis + "e") (spis + "er") (spis + "es") (spis + "te") (spis + "t")
|
||||
(mkImper spis) ;
|
||||
|
||||
vBo : Str -> Verbum = \bo ->
|
||||
mkVerb6 bo (bo + "r") (bo + "es") (bo + "ede") (bo + "et") (mkImper bo) ;
|
||||
|
||||
-- Remove consonant duplication: "passe - pas"
|
||||
|
||||
mkImper : Str -> Str = \s ->
|
||||
if_then_Str (pbool2bool (Predef.eqStr (last s) (last (init s)))) (init s) s ;
|
||||
|
||||
-- For $Numeral$.
|
||||
|
||||
param DForm = ental | ton | tiotal ;
|
||||
|
||||
oper
|
||||
LinDigit = {s : DForm => CardOrd => Str} ;
|
||||
|
||||
cardOrd : Str -> Str -> CardOrd => Str = \tre,tredje ->
|
||||
table {
|
||||
NCard _ => tre ;
|
||||
NOrd a => tredje ---- a
|
||||
} ;
|
||||
|
||||
cardReg : Str -> CardOrd => Str = \syv ->
|
||||
cardOrd syv (syv + case last syv of {
|
||||
"n" => "de" ;
|
||||
"e" => "nde" ;
|
||||
_ => "ende"
|
||||
}) ;
|
||||
|
||||
|
||||
mkTal : (x1,_,_,_,x5 : Str) -> LinDigit =
|
||||
\två, tolv, tjugo, andra, tyvende ->
|
||||
{s = table {
|
||||
ental => cardOrd två andra ;
|
||||
ton => cardReg tolv ;
|
||||
tiotal => cardOrd tjugo tyvende
|
||||
}
|
||||
} ;
|
||||
|
||||
numPl : (CardOrd => Str) -> {s : CardOrd => Str ; n : Number} = \n ->
|
||||
{s = n ; n = Pl} ;
|
||||
|
||||
invNum : CardOrd = NCard Neutr ;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
concrete NounDan of Noun = CatDan ** NounScand with
|
||||
(ResScand = ResDan) ;
|
||||
@@ -1,55 +0,0 @@
|
||||
concrete NumeralDan of Numeral = CatDan ** open ResScand, MorphoDan in {
|
||||
|
||||
|
||||
-- AR 12/10/2002 following www.geocities.com/tsca.geo/dansk/dknummer.html
|
||||
|
||||
lincat
|
||||
Digit = {s : DForm => CardOrd => Str} ;
|
||||
Sub10 = {s : DForm => CardOrd => Str ; n : Number} ;
|
||||
Sub100, Sub1000, Sub1000000 =
|
||||
{s : CardOrd => Str ; n : Number} ;
|
||||
|
||||
lin num x = x ;
|
||||
|
||||
lin n2 = mkTal "to" "tolv" "tyve" "anden" "tyvende" ;
|
||||
lin n3 = mkTal "tre" "tretten" "tredive" "tredje" "tredivte" ;
|
||||
lin n4 = mkTal "fire" "fjorten" "fyrre" "fjerde" "fyrretyvende" ;
|
||||
lin n5 = mkTal "fem" "femten" "halvtreds" "femte" "halvtredsindstyvende" ;
|
||||
lin n6 = mkTal "seks" "seksten" "tres" "sjette" "tredsindstyvende" ;
|
||||
lin n7 = mkTal "syv" "sytten" "halvfjerds" "syvende""halvfjerdsindstyvende" ;
|
||||
lin n8 = mkTal "otte" "atten" "firs" "ottende""firsindstyvende" ;
|
||||
lin n9 = mkTal "ni" "nitten" "halvfems" "niende" "halvfemsindstyvende" ;
|
||||
|
||||
pot01 = {
|
||||
s = \\f => table {
|
||||
NCard g => case g of {Neutr => "et" ; _ => "en"} ;
|
||||
_ => "første"
|
||||
} ;
|
||||
n = Sg
|
||||
} ;
|
||||
pot0 d = {s = \\f,g => d.s ! f ! g ; n = Pl} ;
|
||||
pot110 = numPl (cardReg "ti") ;
|
||||
pot111 = numPl (cardOrd "elleve" "elvte") ;
|
||||
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 ! invNum ++ "og" ++ d.s ! tiotal ! g ; n = Pl} ;
|
||||
pot1as2 n = n ;
|
||||
pot2 d = numPl (\\_ => d.s ! ental ! invNum ++ "hundrede") ;
|
||||
pot2plus d e =
|
||||
{s = \\g => d.s ! ental ! invNum ++ "hundrede" ++ "og" ++ e.s ! g ; n = Pl} ;
|
||||
pot2as3 n = n ;
|
||||
pot3 n = numPl (\\g => n.s ! invNum ++ cardOrd "tusind" "tusinde" ! g) ;
|
||||
pot3plus n m = {s = \\g => n.s ! invNum ++ "tusind" ++ "og" ++ m.s ! g ; n =Pl} ;
|
||||
|
||||
}
|
||||
|
||||
{-
|
||||
lincat
|
||||
Digit = {s : DForm => CardOrd => Str} ;
|
||||
Sub10 = {s : DForm => CardOrd => Str ; n : Number} ;
|
||||
Sub100, Sub1000, Sub1000000 =
|
||||
{s : CardOrd => Str ; n : Number} ;
|
||||
-}
|
||||
@@ -1,456 +0,0 @@
|
||||
--# -path=.:../scandinavian:../common:../abstract:../../prelude
|
||||
|
||||
--1 Danish Lexical Paradigms
|
||||
--
|
||||
-- Aarne Ranta 2005 - 2006
|
||||
--
|
||||
-- This is an API for 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 [``IrregDan`` ../../danish/IrregDan.gf],
|
||||
-- which haves a list of irregular verbs.
|
||||
|
||||
resource ParadigmsDan =
|
||||
open
|
||||
(Predef=Predef),
|
||||
Prelude,
|
||||
CommonScand,
|
||||
ResDan,
|
||||
MorphoDan,
|
||||
CatDan 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.
|
||||
|
||||
mkPrep : Str -> Prep ;
|
||||
noPrep : Prep ; -- empty string
|
||||
|
||||
--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,drenge,drengene : Str) -> N ;
|
||||
|
||||
-- The regular function takes the singular indefinite form
|
||||
-- and computes the other forms and the gender by a heuristic.
|
||||
-- The heuristic is that all nouns are $utrum$ with the
|
||||
-- plural ending "er" or "r".
|
||||
|
||||
regN : Str -> N ;
|
||||
|
||||
-- Giving gender manually makes the heuristic more reliable.
|
||||
|
||||
regGenN : 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 ;
|
||||
|
||||
-- This function takes the singular indefinite and definite and the plural
|
||||
-- indefinite
|
||||
|
||||
mk3N : (bil,bilen,biler : Str) -> N ;
|
||||
|
||||
|
||||
--3 Compound nouns
|
||||
--
|
||||
-- All the functions above work quite as well to form compound nouns,
|
||||
-- such as "fodbold".
|
||||
|
||||
|
||||
--3 Relational nouns
|
||||
--
|
||||
-- Relational nouns ("datter til x") need a preposition.
|
||||
|
||||
mkN2 : N -> Prep -> N2 ;
|
||||
|
||||
-- The most common preposition is "af", and the following is a
|
||||
-- shortcut for regular relational nouns with "af".
|
||||
|
||||
regN2 : Str -> Gender -> N2 ;
|
||||
|
||||
-- Use the function $mkPrep$ or see the section on prepositions below to
|
||||
-- form other prepositions.
|
||||
--
|
||||
-- Three-place relational nouns ("forbindelse fra x til y")
|
||||
-- need two prepositions.
|
||||
|
||||
mkN3 : N -> Prep -> Prep -> N3 ;
|
||||
|
||||
|
||||
--3 Relational common noun phrases
|
||||
--
|
||||
-- In some cases, you may want to make a complex $CN$ into a
|
||||
-- relational noun (e.g. "tidligere kone til"). 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
|
||||
|
||||
mkPN : Str -> Gender -> PN ; -- Paris neutrum
|
||||
regPN : Str -> PN ; -- utrum gender
|
||||
|
||||
-- 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 -> Prep -> A2 ;
|
||||
|
||||
-- Comparison adjectives may need as many as five forms.
|
||||
|
||||
mkADeg : (stor,stort,store,storre,storst : Str) -> A ;
|
||||
|
||||
-- The regular pattern works for many adjectives, e.g. those ending
|
||||
-- with "ig".
|
||||
|
||||
regADeg : Str -> A ;
|
||||
|
||||
-- Just the comparison forms can be irregular.
|
||||
|
||||
irregADeg : (tung,tyngre,tyngst : Str) -> A ;
|
||||
|
||||
-- Sometimes just the positive forms are irregular.
|
||||
|
||||
mk3ADeg : (galen,galet,galna : Str) -> A ;
|
||||
mk2ADeg : (bred,bredt : Str) -> A ;
|
||||
|
||||
-- If comparison is formed by "mer", "mest", as in general for
|
||||
-- long adjective, the following pattern is used:
|
||||
|
||||
compoundA : A -> A ; -- -/mer/mest norsk
|
||||
|
||||
|
||||
--2 Adverbs
|
||||
|
||||
-- Adverbs are not inflected. Most lexical ones have position
|
||||
-- after the verb. Some can be close to the verb like the negation
|
||||
-- "ikke" (e.g. "altid").
|
||||
|
||||
mkAdv : Str -> Adv ;
|
||||
mkAdV : Str -> AdV ;
|
||||
|
||||
-- Adverbs modifying adjectives and sentences can also be formed.
|
||||
|
||||
mkAdA : Str -> AdA ;
|
||||
|
||||
|
||||
--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 $IrregDan$.
|
||||
-- In practice, it is enough to give three forms, as in school books.
|
||||
|
||||
irregV : (drikke, drak, drukket : Str) -> V ;
|
||||
|
||||
|
||||
--3 Verbs with 'være' as auxiliary
|
||||
--
|
||||
-- By default, the auxiliary is "have". This function changes it to "være".
|
||||
|
||||
vaereV : V -> V ;
|
||||
|
||||
|
||||
|
||||
--3 Verbs with a particle
|
||||
--
|
||||
-- The particle, such as in "passe på", is given as a string.
|
||||
|
||||
partV : V -> Str -> V ;
|
||||
|
||||
|
||||
--3 Deponent verbs
|
||||
--
|
||||
-- Some words are used in passive forms only, e.g. "undres", some as
|
||||
-- reflexive e.g. "forestille sig".
|
||||
|
||||
depV : V -> V ;
|
||||
reflV : 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 -> Prep -> 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 -> Prep -> Prep -> V3 ; -- snakke, med, om
|
||||
dirV3 : V -> Prep -> V3 ; -- give,_,til
|
||||
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 -> Prep -> V2S ;
|
||||
mkVV : V -> VV ;
|
||||
mkV2V : V -> Prep -> Prep -> V2V ;
|
||||
mkVA : V -> VA ;
|
||||
mkV2A : V -> Prep -> V2A ;
|
||||
mkVQ : V -> VQ ;
|
||||
mkV2Q : V -> Prep -> V2Q ;
|
||||
|
||||
mkAS : A -> AS ;
|
||||
mkA2S : A -> Prep -> A2S ;
|
||||
mkAV : A -> AV ;
|
||||
mkA2V : A -> Prep -> A2V ;
|
||||
|
||||
-- Notice: categories $V2S, V2V, V2A, V2Q$ are in v 1.0 treated
|
||||
-- just as synonyms of $V2$, and the second argument is given
|
||||
-- as an adverb. Likewise $AS, A2S, AV, A2V$ are just $A$.
|
||||
-- $V0$ is just $V$.
|
||||
|
||||
V0, V2S, V2V, V2A, V2Q : Type ;
|
||||
AS, A2S, AV, A2V : Type ;
|
||||
|
||||
--.
|
||||
|
||||
--2 Definitions of the paradigms
|
||||
--
|
||||
-- The definitions should not bother the user of the API. So they are
|
||||
-- hidden from the document.
|
||||
|
||||
|
||||
Gender = MorphoDan.Gender ;
|
||||
Number = MorphoDan.Number ;
|
||||
Case = MorphoDan.Case ;
|
||||
utrum = Utr ;
|
||||
neutrum = Neutr ;
|
||||
singular = Sg ;
|
||||
plural = Pl ;
|
||||
nominative = Nom ;
|
||||
genitive = Gen ;
|
||||
|
||||
Preposition : Type = Str ; -- obsolete
|
||||
|
||||
mkPreposition : Str -> Prep ; -- obsolete
|
||||
mkPreposition = mkPrep ;
|
||||
|
||||
mkPrep p = {s = p ; lock_Prep = <>} ;
|
||||
noPrep = mkPrep [] ;
|
||||
|
||||
mkN x y z u = mkSubstantive x y z u ** {g = extNGen y ; lock_N = <>} ;
|
||||
|
||||
regN x = regGenN x Utr ;
|
||||
|
||||
regGenN x g = case last x of {
|
||||
"e" => case g of {
|
||||
Utr => mkN x (x + "n") (x + "r") (x + "rne") ;
|
||||
Neutr => mkN x (x + "t") (x + "r") (init x + "ene")
|
||||
} ;
|
||||
_ => case g of {
|
||||
Utr => mkN x (x + "en") (x + "er") (x + "erne") ;
|
||||
Neutr => mkN x (x + "et") (x + "") (x + "ene")
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
mk2N x y = case last y of {
|
||||
"n" => mk3N x y (init y + "r") ;
|
||||
_ => mk3N x y x
|
||||
} ;
|
||||
|
||||
mk3N x y z = let u = ifTok Str x z "ene" "ne" in mkN x y z (z + u) ;
|
||||
|
||||
mkN2 = \n,p -> n ** {lock_N2 = <> ; c2 = p.s} ;
|
||||
regN2 n g = mkN2 (regGenN n g) (mkPreposition "av") ;
|
||||
mkN3 = \n,p,q -> n ** {lock_N3 = <> ; c2 = p.s ; c3 = q.s} ;
|
||||
|
||||
mkPN n g = {s = \\c => mkCase c n ; g = g} ** {lock_PN = <>} ;
|
||||
regPN n = mkPN n utrum ;
|
||||
nounPN n = {s = n.s ! singular ! Indef ; g = n.g ; lock_PN = <>} ;
|
||||
mkNP x y n g =
|
||||
{s = table {NPPoss _ => x ; _ => y} ; a = agrP3 g n ;
|
||||
lock_NP = <>} ;
|
||||
|
||||
mkA = mk3ADeg ;
|
||||
mk2A a b = mkA a b (a + "e") ;
|
||||
regA a = (regADeg a) ** {lock_A = <>} ;
|
||||
|
||||
mkA2 a p = a ** {c2 = p.s ; lock_A2 = <>} ;
|
||||
|
||||
mkADeg a b c d e = mkAdject a b c d e ** {isComp = False ; lock_A = <>} ;
|
||||
|
||||
regADeg a = case Predef.dp 2 a of {
|
||||
"sk" => aRask a ;
|
||||
_ => case last a of {
|
||||
"t" => aAbstrakt a ;
|
||||
_ => aRod a
|
||||
}} ** {isComp = False ; lock_A = <>} ;
|
||||
|
||||
irregADeg a b c = mkAdject a (a + "t") (a + "e") b c **
|
||||
{isComp = False ; lock_A = <>} ;
|
||||
mk3ADeg a b c = mkAdject a b c (c + "re") (c + "st") **
|
||||
{isComp = False ; lock_A = <>} ;
|
||||
mk2ADeg a b = mkAdject a b (a + "e") (a + "ere") (a + "est") **
|
||||
{isComp = False ; lock_A = <>} ;
|
||||
|
||||
compoundA adj = {s = adj.s ; isComp = True ; lock_A = <>} ;
|
||||
|
||||
mkAdv x = ss x ** {lock_Adv = <>} ;
|
||||
mkAdV x = ss x ** {lock_AdV = <>} ;
|
||||
mkAdA x = ss x ** {lock_AdA = <>} ;
|
||||
|
||||
mkV a b c d e f = mkVerb6 a b c d e f **
|
||||
{part = [] ; vtype = VAct ; lock_V = <> ; isVaere = False} ;
|
||||
|
||||
regV a = case last a of {
|
||||
"e" => vHusk (init a) ;
|
||||
_ => vBo a
|
||||
} ** {part = [] ; vtype = VAct ; isVaere = False ; lock_V = <>} ;
|
||||
|
||||
mk2V a b = regVerb a b **
|
||||
{part = [] ; vtype = VAct ; isVaere = False ; lock_V = <>} ;
|
||||
|
||||
irregV =
|
||||
\drikke,drakk,drukket ->
|
||||
let
|
||||
drikk = case last drikke of {
|
||||
"e" => init drikke ;
|
||||
_ => drikke
|
||||
} ;
|
||||
drikker = case last (init drikke) of {
|
||||
"r" => init drikke ;
|
||||
_ => drikke + "r"
|
||||
}
|
||||
in
|
||||
mkV drikke drikker (drikke + "s") drakk drukket (mkImper drikk) ;
|
||||
|
||||
vaereV v = {
|
||||
s = v.s ;
|
||||
part = [] ;
|
||||
vtype = v.vtype ;
|
||||
isVaere = True ;
|
||||
lock_V = <>
|
||||
} ;
|
||||
|
||||
partV v p = {
|
||||
s = v.s ;
|
||||
part = p ;
|
||||
vtype = v.vtype ;
|
||||
isVaere = v.isVaere ;
|
||||
lock_V = <>
|
||||
} ;
|
||||
|
||||
depV v = {
|
||||
s = v.s ; part = v.part ; vtype = VPass ; isVaere = False ; lock_V = <>
|
||||
} ;
|
||||
reflV v = {
|
||||
s = v.s ; part = v.part ; vtype = VRefl ; isVaere = False ; lock_V = <>
|
||||
} ;
|
||||
|
||||
mkV2 v p = v ** {c2 = p.s ; lock_V2 = <>} ;
|
||||
dirV2 v = mkV2 v (mkPrep []) ;
|
||||
|
||||
mkV3 v p q = v ** {c2 = p.s ; c3 = q.s ; lock_V3 = <>} ;
|
||||
dirV3 v p = mkV3 v noPrep p ;
|
||||
dirdirV3 v = dirV3 v noPrep ;
|
||||
|
||||
mkV0 v = v ** {lock_V0 = <>} ;
|
||||
mkVS v = v ** {lock_VS = <>} ;
|
||||
mkV2S v p = mkV2 v p ** {lock_V2S = <>} ;
|
||||
mkVV v = v ** {c2 = "å" ; 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_A = <>} ;
|
||||
mkA2S v p = mkA2 v p ** {lock_A = <>} ;
|
||||
mkAV v = v ** {lock_A = <>} ;
|
||||
mkA2V v p = mkA2 v p ** {lock_A = <>} ;
|
||||
|
||||
V0 : Type = V ;
|
||||
V2S, V2V, V2Q, V2A : Type = V2 ;
|
||||
AS, A2S, AV : Type = A ;
|
||||
A2V : Type = A2 ;
|
||||
|
||||
|
||||
} ;
|
||||
@@ -1,2 +0,0 @@
|
||||
concrete PhraseDan of Phrase = CatDan ** PhraseScand with
|
||||
(ResScand = ResDan) ;
|
||||
@@ -1,2 +0,0 @@
|
||||
concrete QuestionDan of Question = CatDan ** QuestionScand with
|
||||
(ResScand = ResDan) ;
|
||||
@@ -1,2 +0,0 @@
|
||||
concrete RelativeDan of Relative = CatDan ** RelativeScand with
|
||||
(ResScand = ResDan) ;
|
||||
@@ -1,3 +0,0 @@
|
||||
instance ResDan of ResScand = DiffDan ** open CommonScand, Prelude in {
|
||||
} ;
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
concrete SentenceDan of Sentence = CatDan ** SentenceScand with
|
||||
(ResScand = ResDan) ;
|
||||
@@ -1,126 +0,0 @@
|
||||
concrete StructuralDan of Structural = CatDan **
|
||||
open MorphoDan, ParadigmsDan, Prelude in {
|
||||
|
||||
flags optimize=all ;
|
||||
|
||||
lin
|
||||
above_Prep = ss "ovenfor" ;
|
||||
after_Prep = ss "efter" ;
|
||||
by8agent_Prep = ss "af" ;
|
||||
all_Predet = {s = gennumForms "all" "alt" "alle"} ;
|
||||
almost_AdA, almost_AdN = ss "næsten" ;
|
||||
although_Subj = ss ["selv om"] ;
|
||||
always_AdV = ss "altid" ;
|
||||
and_Conj = ss "og" ** {n = Pl} ;
|
||||
because_Subj = ss "fordi" ;
|
||||
before_Prep = ss "før" ;
|
||||
behind_Prep = ss "bag" ;
|
||||
between_Prep = ss "mellem" ;
|
||||
both7and_DConj = sd2 "både" "og" ** {n = Pl} ;
|
||||
but_PConj = ss "men" ;
|
||||
by8means_Prep = ss "med" ;
|
||||
can8know_VV, can_VV =
|
||||
mkV "kunne" "kan" nonExist "kunne" "kunnet" nonExist **
|
||||
{c2 = [] ; lock_VV = <>} ;
|
||||
during_Prep = ss "under" ;
|
||||
either7or_DConj = sd2 "enten" "eller" ** {n = Sg} ;
|
||||
everybody_NP = regNP "alle" "alles" Plg ;
|
||||
every_Det = {s = \\_,_ => "hver" ; n = Sg ; det = DDef Indef} ;
|
||||
everything_NP = regNP "alt" "alts" SgNeutr ;
|
||||
everywhere_Adv = ss "overalt" ;
|
||||
few_Det = {s = \\_,_ => "få" ; n = Pl ; det = DDef Indef} ;
|
||||
first_Ord = {s = "første" ; isDet = True} ;
|
||||
from_Prep = ss "fra" ;
|
||||
he_Pron = MorphoDan.mkNP "han" "ham" "hans" "hans" "hans" SgUtr P3 ;
|
||||
here_Adv = ss "her" ;
|
||||
here7to_Adv = ss "hit" ;
|
||||
here7from_Adv = ss "herfra" ;
|
||||
how_IAdv = ss "hvor" ;
|
||||
how8many_IDet = {s = \\_ => ["hur mange"] ; n = Pl ; det = DDef Indef} ;
|
||||
if_Subj = ss "hvis" ;
|
||||
in8front_Prep = ss "foran" ;
|
||||
i_Pron =
|
||||
MorphoDan.mkNP "jeg" "mig" "min" "mit" "mine" SgUtr P1 ;
|
||||
in_Prep = ss "i" ;
|
||||
it_Pron = MorphoDan.regNP "det" "dets" SgNeutr ;
|
||||
less_CAdv = ss "mindre" ;
|
||||
many_Det = {s = \\_,_ => "mange" ; n = Pl ; det = DDef Indef} ;
|
||||
more_CAdv = ss "mer" ;
|
||||
most_Predet = {s = gennumForms ["den meste"] ["det meste"] ["de fleste"]} ;
|
||||
much_Det = {s = \\_,_ => "meget" ; n = Pl ; det = DDef Indef} ;
|
||||
must_VV =
|
||||
mkV "måtte" "må" "må" "måtte" "måttet" "mått" ** {c2 = [] ; lock_VV = <>} ;
|
||||
no_Phr = ss ["Nej"] ;
|
||||
on_Prep = ss "på" ;
|
||||
one_Quant = {s = \\_ => genderForms ["en"] ["et"] ; n = Sg ; det = DIndef} ; --- ei
|
||||
only_Predet = {s = \\_ => "kun"} ;
|
||||
or_Conj = ss "eller" ** {n = Sg} ;
|
||||
otherwise_PConj = ss "anderledes" ;
|
||||
part_Prep = ss "af" ;
|
||||
please_Voc = ss "tak" ; ---
|
||||
possess_Prep = ss "af" ;
|
||||
quite_Adv = ss "temmelig" ;
|
||||
she_Pron = MorphoDan.mkNP "hun" "hende" "hendes" "hendes" "hendes" SgUtr P3 ;
|
||||
so_AdA = ss "så" ;
|
||||
someSg_Det = {s = \\_ => genderForms "nogen" "noget" ; n = Sg ; det = DIndef} ;
|
||||
somePl_Det = {s = \\_,_ => "nogle" ; n = Pl ; det = DIndef} ;
|
||||
somebody_NP = regNP "nogen" "nogens" SgUtr ;
|
||||
something_NP = regNP "noget" "nogets" SgNeutr ;
|
||||
somewhere_Adv = ss ["et eller annet sted"] ; ---- ?
|
||||
that_Quant =
|
||||
{s = table {
|
||||
Sg => \\_ => genderForms ["den der"] ["det der"] ;
|
||||
Pl => \\_,_ => ["de der"]
|
||||
} ;
|
||||
det = DDef Indef
|
||||
} ;
|
||||
that_NP = regNP ["det der"] ["det ders"] SgNeutr ;
|
||||
there_Adv = ss "der" ;
|
||||
there7to_Adv = ss "dit" ;
|
||||
there7from_Adv = ss "derfra" ;
|
||||
therefore_PConj = ss "derfor" ;
|
||||
these_NP = regNP ["disse"] ["disses"] Plg ;
|
||||
they_Pron = MorphoDan.mkNP "de" "dem" "deres" "deres" "deres" Plg P1 ;
|
||||
this_Quant =
|
||||
{s = table {
|
||||
Sg => \\_ => genderForms ["denne"] ["dette"] ;
|
||||
Pl => \\_,_ => ["disse"]
|
||||
} ;
|
||||
det = DDef Indef
|
||||
} ;
|
||||
this_NP = regNP ["dette"] ["dettes"] SgNeutr ;
|
||||
those_NP = regNP ["de der"] ["de ders"] Plg ;
|
||||
through_Prep = ss "gennem" ;
|
||||
too_AdA = ss "for" ;
|
||||
to_Prep = ss "til" ;
|
||||
under_Prep = ss "under" ;
|
||||
very_AdA = ss "meget" ;
|
||||
want_VV =
|
||||
mkV "ville" "vil" nonExist "ville" "villet" "villed" **
|
||||
{c2 = [] ; lock_VV = <>} ;
|
||||
we_Pron = MorphoDan.mkNP "vi" "os" "vores" "vores" "vores" Plg P1 ;
|
||||
whatSg_IP = {s = \\_ => "hvad" ; gn = SgUtr} ; ---- infl
|
||||
whatPl_IP = {s = \\_ => "hvilke" ; gn = Plg} ; ---- infl
|
||||
when_IAdv = ss "hvornår" ;
|
||||
when_Subj = ss "når" ;
|
||||
where_IAdv = ss "hver" ;
|
||||
whichPl_IDet = {s = \\_ => "hvilke" ; n = Pl ; det = DIndef} ;
|
||||
whichSg_IDet = {s = genderForms "hvilken" "hvilket" ; n = Sg ; det = DIndef} ;
|
||||
whoSg_IP = {s = vem.s ; gn = SgUtr} ;
|
||||
whoPl_IP = {s = \\_ => "hvilke" ; gn = Plg} ;
|
||||
why_IAdv = ss "hvorfor" ;
|
||||
without_Prep = ss "uden" ;
|
||||
with_Prep = ss "med" ;
|
||||
yes_Phr = ss ["ja"] ;
|
||||
youSg_Pron =
|
||||
MorphoDan.mkNP "du" "dig" "din" "dit" "dine" SgUtr P2 ; ----
|
||||
youPl_Pron = MorphoDan.mkNP "i" "jer" "jeres" "jeres" "jeres" Plg P2 ;
|
||||
youPol_Pron = MorphoDan.mkNP "Dere" "Dere" "Deres" "Deres" "Deres" SgUtr P2 ; --- wrong in refl
|
||||
|
||||
-- Auxiliaries that are used repeatedly.
|
||||
|
||||
oper
|
||||
vem = MorphoDan.mkNP "hvem" "hvem" "hvis" "hvis" "hvis" SgUtr P3 ;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
concrete VerbDan of Verb = CatDan ** VerbScand with
|
||||
(ResScand = ResDan) ;
|
||||
@@ -1,107 +0,0 @@
|
||||
digraph {
|
||||
|
||||
size = "12,12" ;
|
||||
|
||||
LangGer [style = "dashed", shape = "box", URL = "LangGer.gf"];
|
||||
LangGer -> NounGer [style = "solid"];
|
||||
LangGer -> VerbGer [style = "solid"];
|
||||
LangGer -> ConjunctionGer [style = "solid"];
|
||||
LangGer -> StructuralGer [style = "solid"];
|
||||
LangGer -> LexiconGer [style = "solid"];
|
||||
LangGer -> Lang [arrowhead = "empty", style = "dashed"];
|
||||
|
||||
Lang [style = "solid", shape = "ellipse", URL = "Lang.gf"];
|
||||
Lang -> Noun [style = "solid"];
|
||||
Lang -> Verb [style = "solid"];
|
||||
Lang -> Conjunction [style = "solid"];
|
||||
Lang -> Structural [style = "solid"];
|
||||
Lang -> Lexicon [style = "solid"];
|
||||
|
||||
NounGer [style = "dashed", shape = "box", URL = "NounGer.gf"];
|
||||
NounGer -> CatGer [style = "solid"];
|
||||
NounGer -> ResGer [style = "dotted"];
|
||||
NounGer -> Prelude [style = "dotted"];
|
||||
NounGer -> Noun [arrowhead = "empty", style = "dashed"];
|
||||
|
||||
Noun [style = "solid", shape = "ellipse", URL = "Noun.gf"];
|
||||
Noun -> Cat [style = "solid"];
|
||||
|
||||
VerbGer [style = "dashed", shape = "box", URL = "VerbGer.gf"];
|
||||
VerbGer -> CatGer [style = "solid"];
|
||||
VerbGer -> Prelude [style = "dotted"];
|
||||
VerbGer -> ResGer [style = "dotted"];
|
||||
VerbGer -> Verb [arrowhead = "empty", style = "dashed"];
|
||||
|
||||
Verb [style = "solid", shape = "ellipse", URL = "Verb.gf"];
|
||||
Verb -> Cat [style = "solid"];
|
||||
|
||||
ConjunctionGer [style = "dashed", shape = "box", URL = "ConjunctionGer.gf"];
|
||||
ConjunctionGer -> CatGer [style = "solid"];
|
||||
ConjunctionGer -> ResGer [style = "dotted"];
|
||||
ConjunctionGer -> Coordination [style = "dotted"];
|
||||
ConjunctionGer -> Prelude [style = "dotted"];
|
||||
ConjunctionGer -> Conjunction [arrowhead = "empty", style = "dashed"];
|
||||
|
||||
Conjunction [style = "solid", shape = "ellipse", URL = "Conjunction.gf"];
|
||||
Conjunction -> Cat [style = "solid"];
|
||||
|
||||
Coordination [style = "dashed", shape = "ellipse", URL = "Coordination.gf"];
|
||||
Coordination -> Prelude [style = "dotted"];
|
||||
|
||||
StructuralGer [style = "dashed", shape = "box", URL = "StructuralGer.gf"];
|
||||
StructuralGer -> CatGer [style = "solid"];
|
||||
StructuralGer -> MorphoGer [style = "dotted"];
|
||||
StructuralGer -> Prelude [style = "dotted"];
|
||||
StructuralGer -> Structural [arrowhead = "empty", style = "dashed"];
|
||||
|
||||
Structural [style = "solid", shape = "ellipse", URL = "Structural.gf"];
|
||||
Structural -> Cat [style = "solid"];
|
||||
|
||||
LexiconGer [style = "dashed", shape = "box", URL = "LexiconGer.gf"];
|
||||
LexiconGer -> CatGer [style = "solid"];
|
||||
LexiconGer -> Prelude [style = "dotted"];
|
||||
LexiconGer -> ParadigmsGer [style = "dotted"];
|
||||
LexiconGer -> Lexicon [arrowhead = "empty", style = "dashed"];
|
||||
|
||||
Lexicon [style = "solid", shape = "ellipse", URL = "Lexicon.gf"];
|
||||
Lexicon -> Cat [style = "solid"];
|
||||
|
||||
ParadigmsGer [style = "dashed", shape = "ellipse", URL = "ParadigmsGer.gf"];
|
||||
ParadigmsGer -> Predef [style = "dotted"];
|
||||
ParadigmsGer -> Prelude [style = "dotted"];
|
||||
ParadigmsGer -> MorphoGer [style = "dotted"];
|
||||
ParadigmsGer -> CatGer [style = "dotted"];
|
||||
|
||||
CatGer [style = "dashed", shape = "box", URL = "CatGer.gf"];
|
||||
CatGer -> CommonX [style = "solid"];
|
||||
CatGer -> ResGer [style = "dotted"];
|
||||
CatGer -> Prelude [style = "dotted"];
|
||||
CatGer -> Cat [arrowhead = "empty", style = "dashed"];
|
||||
|
||||
Cat [style = "solid", shape = "ellipse", URL = "Cat.gf"];
|
||||
Cat -> Common [style = "solid"];
|
||||
|
||||
CommonX [style = "dashed", shape = "box", URL = "CommonX.gf"];
|
||||
CommonX -> ParamX [style = "dotted"];
|
||||
CommonX -> Common [arrowhead = "empty", style = "dashed"];
|
||||
|
||||
Common [style = "solid", shape = "ellipse", URL = "Common.gf"];
|
||||
|
||||
MorphoGer [style = "dashed", shape = "ellipse", URL = "MorphoGer.gf"];
|
||||
MorphoGer -> ResGer [style = "solid"];
|
||||
MorphoGer -> Prelude [style = "dotted"];
|
||||
MorphoGer -> Predef [style = "dotted"];
|
||||
|
||||
ResGer [style = "dashed", shape = "ellipse", URL = "ResGer.gf"];
|
||||
ResGer -> ParamX [style = "solid"];
|
||||
ResGer -> Prelude [style = "dotted"];
|
||||
|
||||
ParamX [style = "dashed", shape = "ellipse", URL = "ParamX.gf"];
|
||||
ParamX -> Prelude [style = "dotted"];
|
||||
|
||||
Prelude [style = "dashed", shape = "ellipse", URL = "Prelude.gf"];
|
||||
Prelude -> Predef [style = "dotted"];
|
||||
|
||||
Predef [style = "dashed", shape = "ellipse", URL = "Predef.gf"];
|
||||
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB |
@@ -1,75 +0,0 @@
|
||||
digraph {
|
||||
|
||||
size = "12,8" ;
|
||||
|
||||
Lang [style = "solid", shape = "ellipse", URL = "Lang.gf"];
|
||||
|
||||
Lang -> Grammar [style = "solid"];
|
||||
Lang -> Lexicon [style = "solid"];
|
||||
|
||||
Grammar [style = "solid", shape = "ellipse", URL = "Lang.gf"];
|
||||
|
||||
|
||||
Grammar -> Noun [style = "solid"];
|
||||
Grammar -> Verb [style = "solid"];
|
||||
Grammar -> Adjective [style = "solid"];
|
||||
Grammar -> Adverb [style = "solid"];
|
||||
Grammar -> Numeral [style = "solid"];
|
||||
Grammar -> Sentence [style = "solid"];
|
||||
Grammar -> Question [style = "solid"];
|
||||
Grammar -> Relative [style = "solid"];
|
||||
Grammar -> Conjunction [style = "solid"];
|
||||
Grammar -> Phrase [style = "solid"];
|
||||
Grammar -> Text [style = "solid"];
|
||||
Grammar -> Idiom [style = "solid"];
|
||||
Grammar -> Structural [style = "solid"];
|
||||
|
||||
|
||||
Noun [style = "solid", shape = "ellipse", URL = "Noun.gf"];
|
||||
Noun -> Cat [style = "solid"];
|
||||
|
||||
Verb [style = "solid", shape = "ellipse", URL = "Verb.gf"];
|
||||
Verb -> Cat [style = "solid"];
|
||||
|
||||
Adjective [style = "solid", shape = "ellipse", URL = "Adjective.gf"];
|
||||
Adjective -> Cat [style = "solid"];
|
||||
|
||||
Adverb [style = "solid", shape = "ellipse", URL = "Adverb.gf"];
|
||||
Adverb -> Cat [style = "solid"];
|
||||
|
||||
Numeral [style = "solid", shape = "ellipse", URL = "Numeral.gf"];
|
||||
Numeral -> Cat [style = "solid"];
|
||||
|
||||
Sentence [style = "solid", shape = "ellipse", URL = "Sentence.gf"];
|
||||
Sentence -> Cat [style = "solid"];
|
||||
|
||||
Question [style = "solid", shape = "ellipse", URL = "Question.gf"];
|
||||
Question -> Cat [style = "solid"];
|
||||
|
||||
Relative [style = "solid", shape = "ellipse", URL = "Relative.gf"];
|
||||
Relative -> Cat [style = "solid"];
|
||||
|
||||
Conjunction [style = "solid", shape = "ellipse", URL = "Conjunction.gf"];
|
||||
Conjunction -> Cat [style = "solid"];
|
||||
|
||||
Phrase [style = "solid", shape = "ellipse", URL = "Phrase.gf"];
|
||||
Phrase -> Cat [style = "solid"];
|
||||
|
||||
Text [style = "solid", shape = "ellipse", URL = "Phrase.gf"];
|
||||
Text -> Cat [style = "solid"];
|
||||
|
||||
Idiom [style = "solid", shape = "ellipse", URL = "Phrase.gf"];
|
||||
Idiom -> Cat [style = "solid"];
|
||||
|
||||
Structural [style = "solid", shape = "ellipse", URL = "Structural.gf"];
|
||||
Structural -> Cat [style = "solid"];
|
||||
|
||||
Lexicon [style = "solid", shape = "ellipse", URL = "Lexicon.gf"];
|
||||
Lexicon -> Cat [style = "solid"];
|
||||
|
||||
Cat [style = "solid", shape = "ellipse", URL = "Cat.gf"];
|
||||
Cat -> Common [style = "solid"];
|
||||
|
||||
Common [style = "solid", shape = "ellipse", URL = "Tense.gf"];
|
||||
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.4 KiB |
@@ -1,68 +0,0 @@
|
||||
digraph {
|
||||
|
||||
size = "12,8" ;
|
||||
|
||||
Lang [style = "solid", shape = "ellipse", URL = "Lang.gf"];
|
||||
Lang -> Noun [style = "solid"];
|
||||
Lang -> Verb [style = "solid"];
|
||||
Lang -> Adjective [style = "solid"];
|
||||
Lang -> Adverb [style = "solid"];
|
||||
Lang -> Numeral [style = "solid"];
|
||||
Lang -> Sentence [style = "solid"];
|
||||
Lang -> Question [style = "solid"];
|
||||
Lang -> Relative [style = "solid"];
|
||||
Lang -> Conjunction [style = "solid"];
|
||||
Lang -> Phrase [style = "solid"];
|
||||
Lang -> Text [style = "solid"];
|
||||
Lang -> Idiom [style = "solid"];
|
||||
Lang -> Structural [style = "solid"];
|
||||
Lang -> Lexicon [style = "solid"];
|
||||
|
||||
Noun [style = "solid", shape = "ellipse", URL = "Noun.gf"];
|
||||
Noun -> Cat [style = "solid"];
|
||||
|
||||
Verb [style = "solid", shape = "ellipse", URL = "Verb.gf"];
|
||||
Verb -> Cat [style = "solid"];
|
||||
|
||||
Adjective [style = "solid", shape = "ellipse", URL = "Adjective.gf"];
|
||||
Adjective -> Cat [style = "solid"];
|
||||
|
||||
Adverb [style = "solid", shape = "ellipse", URL = "Adverb.gf"];
|
||||
Adverb -> Cat [style = "solid"];
|
||||
|
||||
Numeral [style = "solid", shape = "ellipse", URL = "Numeral.gf"];
|
||||
Numeral -> Cat [style = "solid"];
|
||||
|
||||
Sentence [style = "solid", shape = "ellipse", URL = "Sentence.gf"];
|
||||
Sentence -> Cat [style = "solid"];
|
||||
|
||||
Question [style = "solid", shape = "ellipse", URL = "Question.gf"];
|
||||
Question -> Cat [style = "solid"];
|
||||
|
||||
Relative [style = "solid", shape = "ellipse", URL = "Relative.gf"];
|
||||
Relative -> Cat [style = "solid"];
|
||||
|
||||
Conjunction [style = "solid", shape = "ellipse", URL = "Conjunction.gf"];
|
||||
Conjunction -> Cat [style = "solid"];
|
||||
|
||||
Phrase [style = "solid", shape = "ellipse", URL = "Phrase.gf"];
|
||||
Phrase -> Cat [style = "solid"];
|
||||
|
||||
Text [style = "solid", shape = "ellipse", URL = "Phrase.gf"];
|
||||
Text -> Cat [style = "solid"];
|
||||
|
||||
Idiom [style = "solid", shape = "ellipse", URL = "Phrase.gf"];
|
||||
Idiom -> Cat [style = "solid"];
|
||||
|
||||
Structural [style = "solid", shape = "ellipse", URL = "Structural.gf"];
|
||||
Structural -> Cat [style = "solid"];
|
||||
|
||||
Lexicon [style = "solid", shape = "ellipse", URL = "Lexicon.gf"];
|
||||
Lexicon -> Cat [style = "solid"];
|
||||
|
||||
Cat [style = "solid", shape = "ellipse", URL = "Cat.gf"];
|
||||
Cat -> Common [style = "solid"];
|
||||
|
||||
Common [style = "solid", shape = "ellipse", URL = "Tense.gf"];
|
||||
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.5 KiB |
@@ -1,7 +0,0 @@
|
||||
clt:
|
||||
txt2tags clt2006.txt
|
||||
htmls clt2006.html
|
||||
gslt:
|
||||
txt2tags gslt-sem-2006.txt
|
||||
htmls gslt-sem-2006.html
|
||||
|
||||
@@ -1,877 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
|
||||
<TITLE>Resource grammar writing HOWTO</TITLE>
|
||||
</HEAD><BODY BGCOLOR="white" TEXT="black">
|
||||
<P ALIGN="center"><CENTER><H1>Resource grammar writing HOWTO</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Author: Aarne Ranta <aarne (at) cs.chalmers.se></I><BR>
|
||||
Last update: Fri Jun 23 00:13:11 2006
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
<HR NOSHADE SIZE=1>
|
||||
<P></P>
|
||||
<UL>
|
||||
<LI><A HREF="#toc1">The resource grammar API</A>
|
||||
<UL>
|
||||
<LI><A HREF="#toc2">Phrase category modules</A>
|
||||
<LI><A HREF="#toc3">Infrastructure modules</A>
|
||||
<LI><A HREF="#toc4">Lexical modules</A>
|
||||
</UL>
|
||||
<LI><A HREF="#toc5">Language-dependent syntax modules</A>
|
||||
<LI><A HREF="#toc6">The core of the syntax</A>
|
||||
<UL>
|
||||
<LI><A HREF="#toc7">Another reduced API</A>
|
||||
<LI><A HREF="#toc8">The present-tense fragment</A>
|
||||
</UL>
|
||||
<LI><A HREF="#toc9">Phases of the work</A>
|
||||
<UL>
|
||||
<LI><A HREF="#toc10">Putting up a directory</A>
|
||||
<LI><A HREF="#toc11">Direction of work</A>
|
||||
<LI><A HREF="#toc12">The develop-test cycle</A>
|
||||
<LI><A HREF="#toc13">Resource modules used</A>
|
||||
<LI><A HREF="#toc14">Morphology and lexicon</A>
|
||||
<LI><A HREF="#toc15">Lock fields</A>
|
||||
<LI><A HREF="#toc16">Lexicon construction</A>
|
||||
</UL>
|
||||
<LI><A HREF="#toc17">Inside grammar modules</A>
|
||||
<UL>
|
||||
<LI><A HREF="#toc18">The category system</A>
|
||||
<LI><A HREF="#toc19">Phrase category modules</A>
|
||||
<LI><A HREF="#toc20">Resource modules</A>
|
||||
<LI><A HREF="#toc21">Lexicon</A>
|
||||
</UL>
|
||||
<LI><A HREF="#toc22">Lexicon extension</A>
|
||||
<UL>
|
||||
<LI><A HREF="#toc23">The irregularity lexicon</A>
|
||||
<LI><A HREF="#toc24">Lexicon extraction from a word list</A>
|
||||
<LI><A HREF="#toc25">Lexicon extraction from raw text data</A>
|
||||
<LI><A HREF="#toc26">Extending the resource grammar API</A>
|
||||
</UL>
|
||||
<LI><A HREF="#toc27">Writing an instance of parametrized resource grammar implementation</A>
|
||||
<LI><A HREF="#toc28">Parametrizing a resource grammar implementation</A>
|
||||
</UL>
|
||||
|
||||
<P></P>
|
||||
<HR NOSHADE SIZE=1>
|
||||
<P></P>
|
||||
<P>
|
||||
The purpose of this document is to tell how to implement the GF
|
||||
resource grammar API for a new language. We will <I>not</I> cover how
|
||||
to use the resource grammar, nor how to change the API. But we
|
||||
will give some hints how to extend the API.
|
||||
</P>
|
||||
<P>
|
||||
A manual for using the resource grammar is found in
|
||||
</P>
|
||||
<P>
|
||||
<A HREF="http://www.cs.chalmers.se/~aarne/GF/doc/resource.pdf"><CODE>http://www.cs.chalmers.se/~aarne/GF/doc/resource.pdf</CODE></A>.
|
||||
</P>
|
||||
<P>
|
||||
A tutorial on GF, also introducing the idea of resource grammars, is found in
|
||||
</P>
|
||||
<P>
|
||||
<A HREF="../../../doc/tutorial/gf-tutorial2.html"><CODE>http://www.cs.chalmers.se/~aarne/GF/doc/tutorial/gf-tutorial2.html</CODE></A>.
|
||||
</P>
|
||||
<P>
|
||||
This document concerns the API v. 1.0. You can find the current code in
|
||||
</P>
|
||||
<P>
|
||||
<A HREF=".."><CODE>http://www.cs.chalmers.se/~aarne/GF/lib/resource-1.0/</CODE></A>
|
||||
</P>
|
||||
<P>
|
||||
See the <A HREF="../README"><CODE>README</CODE></A> for
|
||||
details on how this differs from previous versions.
|
||||
</P>
|
||||
<A NAME="toc1"></A>
|
||||
<H2>The resource grammar API</H2>
|
||||
<P>
|
||||
The API is divided into a bunch of <CODE>abstract</CODE> modules.
|
||||
The following figure gives the dependencies of these modules.
|
||||
</P>
|
||||
<P>
|
||||
<IMG ALIGN="left" SRC="Grammar.png" BORDER="0" ALT="">
|
||||
</P>
|
||||
<P>
|
||||
Thus the API consists of a grammar and a lexicon, which is
|
||||
provided for test purposes.
|
||||
</P>
|
||||
<P>
|
||||
The module structure is rather flat: most modules are direct
|
||||
parents of <CODE>Grammar</CODE>. The idea
|
||||
is that you can concentrate on one linguistic aspect at a time, or
|
||||
also distribute the work among several authors. The module <CODE>Cat</CODE>
|
||||
defines the "glue" that ties the aspects together - a type system
|
||||
to which all the other modules conform, so that e.g. <CODE>NP</CODE> means
|
||||
the same thing in those modules that use <CODE>NP</CODE>s and those that
|
||||
constructs them.
|
||||
</P>
|
||||
<A NAME="toc2"></A>
|
||||
<H3>Phrase category modules</H3>
|
||||
<P>
|
||||
The direct parents of the top will be called <B>phrase category modules</B>,
|
||||
since each of them concentrates on a particular phrase category (nouns, verbs,
|
||||
adjectives, sentences,...). A phrase category module tells
|
||||
<I>how to construct phrases in that category</I>. You will find out that
|
||||
all functions in any of these modules have the same value type (or maybe
|
||||
one of a small number of different types). Thus we have
|
||||
</P>
|
||||
<UL>
|
||||
<LI><CODE>Noun</CODE>: construction of nouns and noun phrases
|
||||
<LI><CODE>Adjective</CODE>: construction of adjectival phrases
|
||||
<LI><CODE>Verb</CODE>: construction of verb phrases
|
||||
<LI><CODE>Adverb</CODE>: construction of adverbial phrases
|
||||
<LI><CODE>Numeral</CODE>: construction of cardinal and ordinal numerals
|
||||
<LI><CODE>Sentence</CODE>: construction of sentences and imperatives
|
||||
<LI><CODE>Question</CODE>: construction of questions
|
||||
<LI><CODE>Relative</CODE>: construction of relative clauses
|
||||
<LI><CODE>Conjunction</CODE>: coordination of phrases
|
||||
<LI><CODE>Phrase</CODE>: construction of the major units of text and speech
|
||||
<LI><CODE>Text</CODE>: construction of texts as sequences of phrases
|
||||
<LI><CODE>Idiom</CODE>: idiomatic phrases such as existentials
|
||||
</UL>
|
||||
|
||||
<A NAME="toc3"></A>
|
||||
<H3>Infrastructure modules</H3>
|
||||
<P>
|
||||
Expressions of each phrase category are constructed in the corresponding
|
||||
phrase category module. But their <I>use</I> takes mostly place in other modules.
|
||||
For instance, noun phrases, which are constructed in <CODE>Noun</CODE>, are
|
||||
used as arguments of functions of almost all other phrase category modules.
|
||||
How can we build all these modules independently of each other?
|
||||
</P>
|
||||
<P>
|
||||
As usual in typeful programming, the <I>only</I> thing you need to know
|
||||
about an object you use is its type. When writing a linearization rule
|
||||
for a GF abstract syntax function, the only thing you need to know is
|
||||
the linearization types of its value and argument categories. To achieve
|
||||
the division of the resource grammar to several parallel phrase category modules,
|
||||
what we need is an underlying definition of the linearization types. This
|
||||
definition is given as the implementation of
|
||||
</P>
|
||||
<UL>
|
||||
<LI><CODE>Cat</CODE>: syntactic categories of the resource grammar
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
Any resource grammar implementation has first to agree on how to implement
|
||||
<CODE>Cat</CODE>. Luckily enough, even this can be done incrementally: you
|
||||
can skip the <CODE>lincat</CODE> definition of a category and use the default
|
||||
<CODE>{s : Str}</CODE> until you need to change it to something else. In
|
||||
English, for instance, many categories do have this linearization type.
|
||||
</P>
|
||||
<A NAME="toc4"></A>
|
||||
<H3>Lexical modules</H3>
|
||||
<P>
|
||||
What is lexical and what is syntactic is not as clearcut in GF as in
|
||||
some other grammar formalisms. Logically, lexical means atom, i.e. a
|
||||
<CODE>fun</CODE> with no arguments. Linguistically, one may add to this
|
||||
that the <CODE>lin</CODE> consists of only one token (or of a table whose values
|
||||
are single tokens). Even in the restricted lexicon included in the resource
|
||||
API, the latter rule is sometimes violated in some languages. For instance,
|
||||
<CODE>Structural.both7and_DConj</CODE> is an atom, but its linearization is
|
||||
two words e.g. <I>both - and</I>.
|
||||
</P>
|
||||
<P>
|
||||
Another characterization of lexical is that lexical units can be added
|
||||
almost <I>ad libitum</I>, and they cannot be defined in terms of already
|
||||
given rules. The lexical modules of the resource API are thus more like
|
||||
samples than complete lists. There are two such modules:
|
||||
</P>
|
||||
<UL>
|
||||
<LI><CODE>Structural</CODE>: structural words (determiners, conjunctions,...)
|
||||
<LI><CODE>Lexicon</CODE>: basic everyday content words (nouns, verbs,...)
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
The module <CODE>Structural</CODE> aims for completeness, and is likely to
|
||||
be extended in future releases of the resource. The module <CODE>Lexicon</CODE>
|
||||
gives a "random" list of words, which enable interesting testing of syntax,
|
||||
and also a check list for morphology, since those words are likely to include
|
||||
most morphological patterns of the language.
|
||||
</P>
|
||||
<P>
|
||||
In the case of <CODE>Lexicon</CODE> it may come out clearer than anywhere else
|
||||
in the API that it is impossible to give exact translation equivalents in
|
||||
different languages on the level of a resource grammar. In other words,
|
||||
application grammars are likely to use the resource in different ways for
|
||||
different languages.
|
||||
</P>
|
||||
<A NAME="toc5"></A>
|
||||
<H2>Language-dependent syntax modules</H2>
|
||||
<P>
|
||||
In addition to the common API, there is room for language-dependent extensions
|
||||
of the resource. The top level of each languages looks as follows (with English as example):
|
||||
</P>
|
||||
<PRE>
|
||||
abstract English = Grammar, ExtraEngAbs, DictEngAbs
|
||||
</PRE>
|
||||
<P>
|
||||
where <CODE>ExtraEngAbs</CODE> is a collection of syntactic structures specific to English,
|
||||
and <CODE>DictEngAbs</CODE> is an English dictionary
|
||||
(at the moment, it consists of <CODE>IrregEngAbs</CODE>,
|
||||
the irregular verbs of English). Each of these language-specific grammars has
|
||||
the potential to grow into a full-scale grammar of the language. These grammar
|
||||
can also be used as libraries, but the possibility of using functors is lost.
|
||||
</P>
|
||||
<P>
|
||||
To give a better overview of language-specific structures,
|
||||
modules like <CODE>ExtraEngAbs</CODE>
|
||||
are built from a language-independent module <CODE>ExtraAbs</CODE>
|
||||
by restricted inheritance:
|
||||
</P>
|
||||
<PRE>
|
||||
abstract ExtraEngAbs = Extra [f,g,...]
|
||||
</PRE>
|
||||
<P>
|
||||
Thus any category and function in <CODE>Extra</CODE> may be shared by a subset of all
|
||||
languages. One can see this set-up as a matrix, which tells
|
||||
what <CODE>Extra</CODE> structures
|
||||
are implemented in what languages. For the common API in <CODE>Grammar</CODE>, the matrix
|
||||
is filled with 1's (everything is implemented in every language).
|
||||
</P>
|
||||
<P>
|
||||
In a minimal resource grammar implementation, the language-dependent
|
||||
extensions are just empty modules, but it is good to provide them for
|
||||
the sake of uniformity.
|
||||
</P>
|
||||
<A NAME="toc6"></A>
|
||||
<H2>The core of the syntax</H2>
|
||||
<P>
|
||||
Among all categories and functions, a handful are
|
||||
most important and distinct ones, of which the others are can be
|
||||
seen as variations. The categories are
|
||||
</P>
|
||||
<PRE>
|
||||
Cl ; VP ; V2 ; NP ; CN ; Det ; AP ;
|
||||
</PRE>
|
||||
<P>
|
||||
The functions are
|
||||
</P>
|
||||
<PRE>
|
||||
PredVP : NP -> VP -> Cl ; -- predication
|
||||
ComplV2 : V2 -> NP -> VP ; -- complementization
|
||||
DetCN : Det -> CN -> NP ; -- determination
|
||||
ModCN : AP -> CN -> CN ; -- modification
|
||||
</PRE>
|
||||
<P>
|
||||
This <A HREF="latin.gf">toy Latin grammar</A> shows in a nutshell how these
|
||||
rules relate the categories to each other. It is intended to be a
|
||||
first approximation when designing the parameter system of a new
|
||||
language.
|
||||
</P>
|
||||
<A NAME="toc7"></A>
|
||||
<H3>Another reduced API</H3>
|
||||
<P>
|
||||
If you want to experiment with a small subset of the resource API first,
|
||||
try out the module
|
||||
<A HREF="http://www.cs.chalmers.se/~aarne/GF/doc/tutorial/resource/Syntax.gf">Syntax</A>
|
||||
explained in the
|
||||
<A HREF="http://www.cs.chalmers.se/~aarne/GF/doc/tutorial/gf-tutorial2.html">GF Tutorial</A>.
|
||||
</P>
|
||||
<A NAME="toc8"></A>
|
||||
<H3>The present-tense fragment</H3>
|
||||
<P>
|
||||
Some lines in the resource library are suffixed with the comment
|
||||
```--# notpresent
|
||||
which is used by a preprocessor to exclude those lines from
|
||||
a reduced version of the full resource. This present-tense-only
|
||||
version is useful for applications in most technical text, since
|
||||
they reduce the grammar size and compilation time. It can also
|
||||
be useful to exclude those lines in a first version of resource
|
||||
implementation. To compile a grammar with present-tense-only, use
|
||||
</P>
|
||||
<PRE>
|
||||
i -preproc=GF/lib/resource-1.0/mkPresent LangGer.gf
|
||||
</PRE>
|
||||
<P></P>
|
||||
<A NAME="toc9"></A>
|
||||
<H2>Phases of the work</H2>
|
||||
<A NAME="toc10"></A>
|
||||
<H3>Putting up a directory</H3>
|
||||
<P>
|
||||
Unless you are writing an instance of a parametrized implementation
|
||||
(Romance or Scandinavian), which will be covered later, the
|
||||
simplest way is to follow roughly the following procedure. Assume you
|
||||
are building a grammar for the German language. Here are the first steps,
|
||||
which we actually followed ourselves when building the German implementation
|
||||
of resource v. 1.0.
|
||||
</P>
|
||||
<OL>
|
||||
<LI>Create a sister directory for <CODE>GF/lib/resource/english</CODE>, named
|
||||
<CODE>german</CODE>.
|
||||
<PRE>
|
||||
cd GF/lib/resource/
|
||||
mkdir german
|
||||
cd german
|
||||
</PRE>
|
||||
<P></P>
|
||||
<LI>Check out the [ISO 639 3-letter language code
|
||||
<A HREF="http://www.w3.org/WAI/ER/IG/ert/iso639.htm">http://www.w3.org/WAI/ER/IG/ert/iso639.htm</A>]
|
||||
for German: both <CODE>Ger</CODE> and <CODE>Deu</CODE> are given, and we pick <CODE>Ger</CODE>.
|
||||
<P></P>
|
||||
<LI>Copy the <CODE>*Eng.gf</CODE> files from <CODE>english</CODE> <CODE>german</CODE>,
|
||||
and rename them:
|
||||
<PRE>
|
||||
cp ../english/*Eng.gf .
|
||||
rename 's/Eng/Ger/' *Eng.gf
|
||||
</PRE>
|
||||
<P></P>
|
||||
<LI>Change the <CODE>Eng</CODE> module references to <CODE>Ger</CODE> references
|
||||
in all files:
|
||||
<PRE>
|
||||
sed -i 's/English/German/g' *Ger.gf
|
||||
sed -i 's/Eng/Ger/g' *Ger.gf
|
||||
</PRE>
|
||||
The first line prevents changing the word <CODE>English</CODE>, which appears
|
||||
here and there in comments, to <CODE>Gerlish</CODE>.
|
||||
<P></P>
|
||||
<LI>This may of course change unwanted occurrences of the
|
||||
string <CODE>Eng</CODE> - verify this by
|
||||
<PRE>
|
||||
grep Ger *.gf
|
||||
</PRE>
|
||||
But you will have to make lots of manual changes in all files anyway!
|
||||
<P></P>
|
||||
<LI>Comment out the contents of these files:
|
||||
<PRE>
|
||||
sed -i 's/^/--/' *Ger.gf
|
||||
</PRE>
|
||||
This will give you a set of templates out of which the grammar
|
||||
will grow as you uncomment and modify the files rule by rule.
|
||||
<P></P>
|
||||
<LI>In all <CODE>.gf</CODE> files, uncomment the module headers and brackets,
|
||||
leaving the module bodies commented. Unfortunately, there is no
|
||||
simple way to do this automatically (or to avoid commenting these
|
||||
lines in the previous step) - but uncommenting the first
|
||||
and the last lines will actually do the job for many of the files.
|
||||
<P></P>
|
||||
<LI>Uncomment the contents of the main grammar file:
|
||||
<PRE>
|
||||
sed -i 's/^--//' LangGer.gf
|
||||
</PRE>
|
||||
<P></P>
|
||||
<LI>Now you can open the grammar <CODE>LangGer</CODE> in GF:
|
||||
<PRE>
|
||||
gf LangGer.gf
|
||||
</PRE>
|
||||
You will get lots of warnings on missing rules, but the grammar will compile.
|
||||
<P></P>
|
||||
<LI>At all following steps you will now have a valid, but incomplete
|
||||
GF grammar. The GF command
|
||||
<PRE>
|
||||
pg -printer=missing
|
||||
</PRE>
|
||||
tells you what exactly is missing.
|
||||
</OL>
|
||||
|
||||
<P>
|
||||
Here is the module structure of <CODE>LangGer</CODE>. It has been simplified by leaving out
|
||||
the majority of the phrase category modules. Each of them has the same dependencies
|
||||
as e.g. <CODE>VerbGer</CODE>.
|
||||
</P>
|
||||
<P>
|
||||
<IMG ALIGN="middle" SRC="German.png" BORDER="0" ALT="">
|
||||
</P>
|
||||
<A NAME="toc11"></A>
|
||||
<H3>Direction of work</H3>
|
||||
<P>
|
||||
The real work starts now. There are many ways to proceed, the main ones being
|
||||
</P>
|
||||
<UL>
|
||||
<LI>Top-down: start from the module <CODE>Phrase</CODE> and go down to <CODE>Sentence</CODE>, then
|
||||
<CODE>Verb</CODE>, <CODE>Noun</CODE>, and in the end <CODE>Lexicon</CODE>. In this way, you are all the time
|
||||
building complete phrases, and add them with more content as you proceed.
|
||||
<B>This approach is not recommended</B>. It is impossible to test the rules if
|
||||
you have no words to apply the constructions to.
|
||||
<P></P>
|
||||
<LI>Bottom-up: set as your first goal to implement <CODE>Lexicon</CODE>. To this end, you
|
||||
need to write <CODE>ParadigmsGer</CODE>, which in turn needs parts of
|
||||
<CODE>MorphoGer</CODE> and <CODE>ResGer</CODE>.
|
||||
<B>This approach is not recommended</B>. You can get stuck to details of
|
||||
morphology such as irregular words, and you don't have enough grasp about
|
||||
the type system to decide what forms to cover in morphology.
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
The practical working direction is thus a saw-like motion between the morphological
|
||||
and top-level modules. Here is a possible course of the work that gives enough
|
||||
test data and enough general view at any point:
|
||||
</P>
|
||||
<OL>
|
||||
<LI>Define <CODE>Cat.N</CODE> and the required parameter types in <CODE>ResGer</CODE>. As we define
|
||||
<PRE>
|
||||
lincat N = {s : Number => Case => Str ; g : Gender} ;
|
||||
</PRE>
|
||||
we need the parameter types <CODE>Number</CODE>, <CODE>Case</CODE>, and <CODE>Gender</CODE>. The definition
|
||||
of <CODE>Number</CODE> in <A HREF="../common/ParamX.gf"><CODE>common/ParamX</CODE></A> works for German, so we
|
||||
use it and just define <CODE>Case</CODE> and <CODE>Gender</CODE> in <CODE>ResGer</CODE>.
|
||||
<P></P>
|
||||
<LI>Define <CODE>regN</CODE> in <CODE>ParadigmsGer</CODE>. In this way you can
|
||||
already implement a huge amount of nouns correctly in <CODE>LexiconGer</CODE>. Actually
|
||||
just adding <CODE>mkN</CODE> should suffice for every noun - but,
|
||||
since it is tedious to use, you
|
||||
might proceed to the next step before returning to morphology and defining the
|
||||
real work horse <CODE>reg2N</CODE>.
|
||||
<P></P>
|
||||
<LI>While doing this, you may want to test the resource independently. Do this by
|
||||
<PRE>
|
||||
i -retain ParadigmsGer
|
||||
cc regN "Kirche"
|
||||
</PRE>
|
||||
<P></P>
|
||||
<LI>Proceed to determiners and pronouns in
|
||||
<CODE>NounGer</CODE> (<CODE>DetCN UsePron DetSg SgQuant NoNum NoOrd DefArt IndefArt UseN</CODE>)and
|
||||
<CODE>StructuralGer</CODE> (<CODE>i_Pron every_Det</CODE>). You also need some categories and
|
||||
parameter types. At this point, it is maybe not possible to find out the final
|
||||
linearization types of <CODE>CN</CODE>, <CODE>NP</CODE>, and <CODE>Det</CODE>, but at least you should
|
||||
be able to correctly inflect noun phrases such as <I>every airplane</I>:
|
||||
<PRE>
|
||||
i LangGer.gf
|
||||
l -table DetCN every_Det (UseN airplane_N)
|
||||
|
||||
Nom: jeder Flugzeug
|
||||
Acc: jeden Flugzeug
|
||||
Dat: jedem Flugzeug
|
||||
Gen: jedes Flugzeugs
|
||||
</PRE>
|
||||
<P></P>
|
||||
<LI>Proceed to verbs: define <CODE>CatGer.V</CODE>, <CODE>ResGer.VForm</CODE>, and
|
||||
<CODE>ParadigmsGer.regV</CODE>. You may choose to exclude <CODE>notpresent</CODE>
|
||||
cases at this point. But anyway, you will be able to inflect a good
|
||||
number of verbs in <CODE>Lexicon</CODE>, such as
|
||||
<CODE>live_V</CODE> (<CODE>regV "leven"</CODE>).
|
||||
<P></P>
|
||||
<LI>Now you can soon form your first sentences: define <CODE>VP</CODE> and
|
||||
<CODE>Cl</CODE> in <CODE>CatGer</CODE>, <CODE>VerbGer.UseV</CODE>, and <CODE>SentenceGer.PredVP</CODE>.
|
||||
Even if you have excluded the tenses, you will be able to produce
|
||||
<PRE>
|
||||
i -preproc=mkPresent LangGer.gf
|
||||
> l -table PredVP (UsePron i_Pron) (UseV live_V)
|
||||
|
||||
Pres Simul Pos Main: ich lebe
|
||||
Pres Simul Pos Inv: lebe ich
|
||||
Pres Simul Pos Sub: ich lebe
|
||||
Pres Simul Neg Main: ich lebe nicht
|
||||
Pres Simul Neg Inv: lebe ich nicht
|
||||
Pres Simul Neg Sub: ich nicht lebe
|
||||
</PRE>
|
||||
<P></P>
|
||||
<LI>Transitive verbs (<CODE>CatGer.V2 ParadigmsGer.dirV2 VerbGer.ComplV2</CODE>)
|
||||
are a natural next step, so that you can
|
||||
produce <CODE>ich liebe dich</CODE>.
|
||||
<P></P>
|
||||
<LI>Adjectives (<CODE>CatGer.A ParadigmsGer.regA NounGer.AdjCN AdjectiveGer.PositA</CODE>)
|
||||
will force you to think about strong and weak declensions, so that you can
|
||||
correctly inflect <I>my new car, this new car</I>.
|
||||
<P></P>
|
||||
<LI>Once you have implemented the set
|
||||
(``Noun.DetCN Noun.AdjCN Verb.UseV Verb.ComplV2 Sentence.PredVP),
|
||||
you have overcome most of difficulties. You know roughly what parameters
|
||||
and dependences there are in your language, and you can now produce very
|
||||
much in the order you please.
|
||||
</OL>
|
||||
|
||||
<A NAME="toc12"></A>
|
||||
<H3>The develop-test cycle</H3>
|
||||
<P>
|
||||
The following develop-test cycle will
|
||||
be applied most of the time, both in the first steps described above
|
||||
and in later steps where you are more on your own.
|
||||
</P>
|
||||
<OL>
|
||||
<LI>Select a phrase category module, e.g. <CODE>NounGer</CODE>, and uncomment some
|
||||
linearization rules (for instance, <CODE>DefSg</CODE>, which is
|
||||
not too complicated).
|
||||
<P></P>
|
||||
<LI>Write down some German examples of this rule, for instance translations
|
||||
of "the dog", "the house", "the big house", etc. Write these in all their
|
||||
different forms (two numbers and four cases).
|
||||
<P></P>
|
||||
<LI>Think about the categories involved (<CODE>CN, NP, N</CODE>) and the
|
||||
variations they have. Encode this in the lincats of <CODE>CatGer</CODE>.
|
||||
You may have to define some new parameter types in <CODE>ResGer</CODE>.
|
||||
<P></P>
|
||||
<LI>To be able to test the construction,
|
||||
define some words you need to instantiate it
|
||||
in <CODE>LexiconGer</CODE>. You will also need some regular inflection patterns
|
||||
in<CODE>ParadigmsGer</CODE>.
|
||||
<P></P>
|
||||
<LI>Test by parsing, linearization,
|
||||
and random generation. In particular, linearization to a table should
|
||||
be used so that you see all forms produced:
|
||||
<PRE>
|
||||
gr -cat=NP -number=20 -tr | l -table
|
||||
</PRE>
|
||||
<P></P>
|
||||
<LI>Spare some tree-linearization pairs for later regression testing. Use the
|
||||
<CODE>tree_bank</CODE> command,
|
||||
<PRE>
|
||||
gr -cat=NP -number=20 | tb -xml | wf NP.tb
|
||||
</PRE>
|
||||
You can later compared your modified grammar to this treebank by
|
||||
<PRE>
|
||||
rf NP.tb | tb -c
|
||||
</PRE>
|
||||
</OL>
|
||||
|
||||
<P>
|
||||
You are likely to run this cycle a few times for each linearization rule
|
||||
you implement, and some hundreds of times altogether. There are 66 <CODE>cat</CODE>s and
|
||||
458 <CODE>funs</CODE> in <CODE>Lang</CODE> at the moment; 149 of the <CODE>funs</CODE> are outside the two
|
||||
lexicon modules).
|
||||
</P>
|
||||
<P>
|
||||
Here is a <A HREF="../german/log.txt">live log</A> of the actual process of
|
||||
building the German implementation of resource API v. 1.0.
|
||||
It is the basis of the more detailed explanations, which will
|
||||
follow soon. (You will found out that these explanations involve
|
||||
a rational reconstruction of the live process! Among other things, the
|
||||
API was changed during the actual process to make it more intuitive.)
|
||||
</P>
|
||||
<A NAME="toc13"></A>
|
||||
<H3>Resource modules used</H3>
|
||||
<P>
|
||||
These modules will be written by you.
|
||||
</P>
|
||||
<UL>
|
||||
<LI><CODE>ResGer</CODE>: parameter types and auxiliary operations
|
||||
(a resource for the resource grammar!)
|
||||
<LI><CODE>ParadigmsGer</CODE>: complete inflection engine and most important regular paradigms
|
||||
<LI><CODE>MorphoGer</CODE>: auxiliaries for <CODE>ParadigmsGer</CODE> and <CODE>StructuralGer</CODE>. This need
|
||||
not be separate from <CODE>ResGer</CODE>.
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
These modules are language-independent and provided by the existing resource
|
||||
package.
|
||||
</P>
|
||||
<UL>
|
||||
<LI><CODE>ParamX</CODE>: parameter types used in many languages
|
||||
<LI><CODE>CommonX</CODE>: implementation of language-uniform categories
|
||||
such as $Text$ and $Phr$, as well as of
|
||||
the logical tense, anteriority, and polarity parameters
|
||||
<LI><CODE>Coordination</CODE>: operations to deal with lists and coordination
|
||||
<LI><CODE>Prelude</CODE>: general-purpose operations on strings, records,
|
||||
truth values, etc.
|
||||
<LI><CODE>Predefined</CODE>: general-purpose operations with hard-coded definitions
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
An important decision is what rules to implement in terms of operations in
|
||||
<CODE>ResGer</CODE>. A golden rule of functional programming says that, whenever
|
||||
you find yourself programming by copy and paste, you should write a function
|
||||
instead. This indicates that an operation should be created if it is to be
|
||||
used at least twice. At the same time, a sound principle of vicinity says that
|
||||
it should not require too much browsing to understand what a rule does.
|
||||
From these two principles, we have derived the following practice:
|
||||
</P>
|
||||
<UL>
|
||||
<LI>If an operation is needed <I>in two different modules</I>,
|
||||
it should be created in <CODE>ResGer</CODE>. An example is <CODE>mkClause</CODE>,
|
||||
used in <CODE>Sentence</CODE>, <CODE>Question</CODE>, and <CODE>Relative</CODE>-
|
||||
<LI>If an operation is needed <I>twice in the same module</I>, but never
|
||||
outside, it should be created in the same module. Many examples are
|
||||
found in <CODE>Numerals</CODE>.
|
||||
<LI>If an operation is only needed once, it should not be created (but rather
|
||||
inlined). Most functions in phrase category modules are implemented in this
|
||||
way.
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
This discipline is very different from the one followed in earlier
|
||||
versions of the library (up to 0.9). We then valued the principle of
|
||||
abstraction more than vicinity, creating layers of abstraction for
|
||||
almost everything. This led in practice to the duplication of almost
|
||||
all code on the <CODE>lin</CODE> and <CODE>oper</CODE> levels, and made the code
|
||||
hard to understand and maintain.
|
||||
</P>
|
||||
<A NAME="toc14"></A>
|
||||
<H3>Morphology and lexicon</H3>
|
||||
<P>
|
||||
The paradigms needed to implement
|
||||
<CODE>LexiconGer</CODE> are defined in
|
||||
<CODE>ParadigmsGer</CODE>.
|
||||
This module provides high-level ways to define the linearization of
|
||||
lexical items, of categories <CODE>N, A, V</CODE> and their complement-taking
|
||||
variants.
|
||||
</P>
|
||||
<P>
|
||||
For ease of use, the <CODE>Paradigms</CODE> modules follow a certain
|
||||
naming convention. Thus they for each lexical category, such as <CODE>N</CODE>,
|
||||
the functions
|
||||
</P>
|
||||
<UL>
|
||||
<LI><CODE>mkN</CODE>, for worst-case construction of <CODE>N</CODE>. Its type signature
|
||||
has the form
|
||||
<PRE>
|
||||
mkN : Str -> ... -> Str -> P -> ... -> Q -> N
|
||||
</PRE>
|
||||
with as many string and parameter arguments as can ever be needed to
|
||||
construct an <CODE>N</CODE>.
|
||||
<LI><CODE>regN</CODE>, for the most common cases, with just one string argument:
|
||||
<PRE>
|
||||
regN : Str -> N
|
||||
</PRE>
|
||||
<LI>A language-dependent (small) set of functions to handle mild irregularities
|
||||
and common exceptions.
|
||||
<P></P>
|
||||
For the complement-taking variants, such as <CODE>V2</CODE>, we provide
|
||||
<P></P>
|
||||
<LI><CODE>mkV2</CODE>, which takes a <CODE>V</CODE> and all necessary arguments, such
|
||||
as case and preposition:
|
||||
<PRE>
|
||||
mkV2 : V -> Case -> Str -> V2 ;
|
||||
</PRE>
|
||||
<LI>A language-dependent (small) set of functions to handle common special cases,
|
||||
such as direct transitive verbs:
|
||||
<PRE>
|
||||
dirV2 : V -> V2 ;
|
||||
-- dirV2 v = mkV2 v accusative []
|
||||
</PRE>
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
The golden rule for the design of paradigms is that
|
||||
</P>
|
||||
<UL>
|
||||
<LI>The user will only need function applications with constants and strings,
|
||||
never any records or tables.
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
The discipline of data abstraction moreover requires that the user of the resource
|
||||
is not given access to parameter constructors, but only to constants that denote
|
||||
them. This gives the resource grammarian the freedom to change the underlying
|
||||
data representation if needed. It means that the <CODE>ParadigmsGer</CODE> module has
|
||||
to define constants for those parameter types and constructors that
|
||||
the application grammarian may need to use, e.g.
|
||||
</P>
|
||||
<PRE>
|
||||
oper
|
||||
Case : Type ;
|
||||
nominative, accusative, genitive, dative : Case ;
|
||||
</PRE>
|
||||
<P>
|
||||
These constants are defined in terms of parameter types and constructors
|
||||
in <CODE>ResGer</CODE> and <CODE>MorphoGer</CODE>, which modules are not
|
||||
visible to the application grammarian.
|
||||
</P>
|
||||
<A NAME="toc15"></A>
|
||||
<H3>Lock fields</H3>
|
||||
<P>
|
||||
An important difference between <CODE>MorphoGer</CODE> and
|
||||
<CODE>ParadigmsGer</CODE> is that the former uses "raw" record types
|
||||
for word classes, whereas the latter used category symbols defined in
|
||||
<CODE>CatGer</CODE>. When these category symbols are used to denote
|
||||
record types in a resource modules, such as <CODE>ParadigmsGer</CODE>,
|
||||
a <B>lock field</B> is added to the record, so that categories
|
||||
with the same implementation are not confused with each other.
|
||||
(This is inspired by the <CODE>newtype</CODE> discipline in Haskell.)
|
||||
For instance, the lincats of adverbs and conjunctions are the same
|
||||
in <CODE>CommonX</CODE> (and therefore in <CODE>CatGer</CODE>, which inherits it):
|
||||
</P>
|
||||
<PRE>
|
||||
lincat Adv = {s : Str} ;
|
||||
lincat Conj = {s : Str} ;
|
||||
</PRE>
|
||||
<P>
|
||||
But when these category symbols are used to denote their linearization
|
||||
types in resource module, these definitions are translated to
|
||||
</P>
|
||||
<PRE>
|
||||
oper Adv : Type = {s : Str ; lock_Adv : {}} ;
|
||||
oper Conj : Type = {s : Str} ; lock_Conj : {}} ;
|
||||
</PRE>
|
||||
<P>
|
||||
In this way, the user of a resource grammar cannot confuse adverbs with
|
||||
conjunctions. In other words, the lock fields force the type checker
|
||||
to function as grammaticality checker.
|
||||
</P>
|
||||
<P>
|
||||
When the resource grammar is <CODE>open</CODE>ed in an application grammar, the
|
||||
lock fields are never seen (except possibly in type error messages),
|
||||
and the application grammarian should never write them herself. If she
|
||||
has to do this, it is a sign that the resource grammar is incomplete, and
|
||||
the proper way to proceed is to fix the resource grammar.
|
||||
</P>
|
||||
<P>
|
||||
The resource grammarian has to provide the dummy lock field values
|
||||
in her hidden definitions of constants in <CODE>Paradigms</CODE>. For instance,
|
||||
</P>
|
||||
<PRE>
|
||||
mkAdv : Str -> Adv ;
|
||||
-- mkAdv s = {s = s ; lock_Adv = <>} ;
|
||||
</PRE>
|
||||
<P></P>
|
||||
<A NAME="toc16"></A>
|
||||
<H3>Lexicon construction</H3>
|
||||
<P>
|
||||
The lexicon belonging to <CODE>LangGer</CODE> consists of two modules:
|
||||
</P>
|
||||
<UL>
|
||||
<LI><CODE>StructuralGer</CODE>, structural words, built by directly using
|
||||
<CODE>MorphoGer</CODE>.
|
||||
<LI><CODE>BasicGer</CODE>, content words, built by using <CODE>ParadigmsGer</CODE>.
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
The reason why <CODE>MorphoGer</CODE> has to be used in <CODE>StructuralGer</CODE>
|
||||
is that <CODE>ParadigmsGer</CODE> does not contain constructors for closed
|
||||
word classes such as pronouns and determiners. The reason why we
|
||||
recommend <CODE>ParadigmsGer</CODE> for building <CODE>LexiconGer</CODE> is that
|
||||
the coverage of the paradigms gets thereby tested and that the
|
||||
use of the paradigms in <CODE>LexiconGer</CODE> gives a good set of examples for
|
||||
those who want to build new lexica.
|
||||
</P>
|
||||
<A NAME="toc17"></A>
|
||||
<H2>Inside grammar modules</H2>
|
||||
<P>
|
||||
Detailed implementation tricks
|
||||
are found in the comments of each module.
|
||||
</P>
|
||||
<A NAME="toc18"></A>
|
||||
<H3>The category system</H3>
|
||||
<UL>
|
||||
<LI><A HREF="gfdoc/Common.html">Common</A>, <A HREF="../common/CommonX.gf">CommonX</A>
|
||||
<LI><A HREF="gfdoc/Cat.html">Cat</A>, <A HREF="gfdoc/CatGer.gf">CatGer</A>
|
||||
</UL>
|
||||
|
||||
<A NAME="toc19"></A>
|
||||
<H3>Phrase category modules</H3>
|
||||
<UL>
|
||||
<LI><A HREF="gfdoc/Noun.html">Noun</A>, <A HREF="../german/NounGer.gf">NounGer</A>
|
||||
<LI><A HREF="gfdoc/Adjective.html">Adjective</A>, <A HREF="../german/AdjectiveGer.gf">AdjectiveGer</A>
|
||||
<LI><A HREF="gfdoc/Verb.html">Verb</A>, <A HREF="../german/VerbGer.gf">VerbGer</A>
|
||||
<LI><A HREF="gfdoc/Adverb.html">Adverb</A>, <A HREF="../german/AdverbGer.gf">AdverbGer</A>
|
||||
<LI><A HREF="gfdoc/Numeral.html">Numeral</A>, <A HREF="../german/NumeralGer.gf">NumeralGer</A>
|
||||
<LI><A HREF="gfdoc/Sentence.html">Sentence</A>, <A HREF="../german/SentenceGer.gf">SentenceGer</A>
|
||||
<LI><A HREF="gfdoc/Question.html">Question</A>, <A HREF="../german/QuestionGer.gf">QuestionGer</A>
|
||||
<LI><A HREF="gfdoc/Relative.html">Relative</A>, <A HREF="../german/RelativeGer.gf">RelativeGer</A>
|
||||
<LI><A HREF="gfdoc/Conjunction.html">Conjunction</A>, <A HREF="../german/ConjunctionGer.gf">ConjunctionGer</A>
|
||||
<LI><A HREF="gfdoc/Phrase.html">Phrase</A>, <A HREF="../german/PhraseGer.gf">PhraseGer</A>
|
||||
<LI><A HREF="gfdoc/Text.html">Text</A>, <A HREF="../common/TextX.gf">TextX</A>
|
||||
<LI><A HREF="gfdoc/Idiom.html">Idiom</A>, <A HREF="../german/IdiomGer.gf">IdiomGer</A>
|
||||
<LI><A HREF="gfdoc/Lang.html">Lang</A>, <A HREF="../german/LangGer.gf">LangGer</A>
|
||||
</UL>
|
||||
|
||||
<A NAME="toc20"></A>
|
||||
<H3>Resource modules</H3>
|
||||
<UL>
|
||||
<LI><A HREF="../german/ResGer.gf">ResGer</A>
|
||||
<LI><A HREF="../german/MorphoGer.gf">MorphoGer</A>
|
||||
<LI><A HREF="gfdoc/ParadigmsGer.html">ParadigmsGer</A>, <A HREF="../german/ParadigmsGer.gf">ParadigmsGer.gf</A>
|
||||
</UL>
|
||||
|
||||
<A NAME="toc21"></A>
|
||||
<H3>Lexicon</H3>
|
||||
<UL>
|
||||
<LI><A HREF="gfdoc/Structural.html">Structural</A>, <A HREF="../german/StructuralGer.gf">StructuralGer</A>
|
||||
<LI><A HREF="gfdoc/Lexicon.html">Lexicon</A>, <A HREF="../german/LexiconGer.gf">LexiconGer</A>
|
||||
</UL>
|
||||
|
||||
<A NAME="toc22"></A>
|
||||
<H2>Lexicon extension</H2>
|
||||
<A NAME="toc23"></A>
|
||||
<H3>The irregularity lexicon</H3>
|
||||
<P>
|
||||
It may be handy to provide a separate module of irregular
|
||||
verbs and other words which are difficult for a lexicographer
|
||||
to handle. There are usually a limited number of such words - a
|
||||
few hundred perhaps. Building such a lexicon separately also
|
||||
makes it less important to cover <I>everything</I> by the
|
||||
worst-case paradigms (<CODE>mkV</CODE> etc).
|
||||
</P>
|
||||
<A NAME="toc24"></A>
|
||||
<H3>Lexicon extraction from a word list</H3>
|
||||
<P>
|
||||
You can often find resources such as lists of
|
||||
irregular verbs on the internet. For instance, the
|
||||
<A HREF="http://www.iee.et.tu-dresden.de/~wernerr/grammar/verben_dt.html">Irregular German Verbs</A>
|
||||
page gives a list of verbs in the
|
||||
traditional tabular format, which begins as follows:
|
||||
</P>
|
||||
<PRE>
|
||||
backen (du bäckst, er bäckt) backte [buk] gebacken
|
||||
befehlen (du befiehlst, er befiehlt; befiehl!) befahl (beföhle; befähle) befohlen
|
||||
beginnen begann (begönne; begänne) begonnen
|
||||
beißen biß gebissen
|
||||
</PRE>
|
||||
<P>
|
||||
All you have to do is to write a suitable verb paradigm
|
||||
</P>
|
||||
<PRE>
|
||||
irregV : (x1,_,_,_,_,x6 : Str) -> V ;
|
||||
</PRE>
|
||||
<P>
|
||||
and a Perl or Python or Haskell script that transforms
|
||||
the table to
|
||||
</P>
|
||||
<PRE>
|
||||
backen_V = irregV "backen" "bäckt" "back" "backte" "backte" "gebacken" ;
|
||||
befehlen_V = irregV "befehlen" "befiehlt" "befiehl" "befahl" "beföhle" "befohlen" ;
|
||||
</PRE>
|
||||
<P></P>
|
||||
<P>
|
||||
When using ready-made word lists, you should think about
|
||||
coyright issues. Ideally, all resource grammar material should
|
||||
be provided under GNU General Public License.
|
||||
</P>
|
||||
<A NAME="toc25"></A>
|
||||
<H3>Lexicon extraction from raw text data</H3>
|
||||
<P>
|
||||
This is a cheap technique to build a lexicon of thousands
|
||||
of words, if text data is available in digital format.
|
||||
See the <A HREF="http://www.cs.chalmers.se/~markus/FM/">Functional Morphology</A>
|
||||
homepage for details.
|
||||
</P>
|
||||
<A NAME="toc26"></A>
|
||||
<H3>Extending the resource grammar API</H3>
|
||||
<P>
|
||||
Sooner or later it will happen that the resource grammar API
|
||||
does not suffice for all applications. A common reason is
|
||||
that it does not include idiomatic expressions in a given language.
|
||||
The solution then is in the first place to build language-specific
|
||||
extension modules. This chapter will deal with this issue (to be completed).
|
||||
</P>
|
||||
<A NAME="toc27"></A>
|
||||
<H2>Writing an instance of parametrized resource grammar implementation</H2>
|
||||
<P>
|
||||
Above we have looked at how a resource implementation is built by
|
||||
the copy and paste method (from English to German), that is, formally
|
||||
speaking, from scratch. A more elegant solution available for
|
||||
families of languages such as Romance and Scandinavian is to
|
||||
use parametrized modules. The advantages are
|
||||
</P>
|
||||
<UL>
|
||||
<LI>theoretical: linguistic generalizations and insights
|
||||
<LI>practical: maintainability improves with fewer components
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
In this chapter, we will look at an example: adding Italian to
|
||||
the Romance family (to be completed). Here is a set of
|
||||
<A HREF="http://www.cs.chalmers.se/~aarne/geocal2006.pdf">slides</A>
|
||||
on the topic.
|
||||
</P>
|
||||
<A NAME="toc28"></A>
|
||||
<H2>Parametrizing a resource grammar implementation</H2>
|
||||
<P>
|
||||
This is the most demanding form of resource grammar writing.
|
||||
We do <I>not</I> recommend the method of parametrizing from the
|
||||
beginning: it is easier to have one language first implemented
|
||||
in the conventional way and then add another language of the
|
||||
same family by aprametrization. This means that the copy and
|
||||
paste method is still used, but at this time the differences
|
||||
are put into an <CODE>interface</CODE> module.
|
||||
</P>
|
||||
<P>
|
||||
This chapter will work out an example of how an Estonian grammar
|
||||
is constructed from the Finnish grammar through parametrization.
|
||||
</P>
|
||||
|
||||
<!-- html code generated by txt2tags 2.3 (http://txt2tags.sf.net) -->
|
||||
<!-- cmdline: txt2tags -\-toc -thtml Resource-HOWTO.txt -->
|
||||
</BODY></HTML>
|
||||
@@ -1,769 +0,0 @@
|
||||
Resource grammar writing HOWTO
|
||||
Author: Aarne Ranta <aarne (at) cs.chalmers.se>
|
||||
Last update: %%date(%c)
|
||||
|
||||
% NOTE: this is a txt2tags file.
|
||||
% Create an html file from this file using:
|
||||
% txt2tags --toc -thtml Resource-HOWTO.txt
|
||||
|
||||
%!target:html
|
||||
|
||||
|
||||
The purpose of this document is to tell how to implement the GF
|
||||
resource grammar API for a new language. We will //not// cover how
|
||||
to use the resource grammar, nor how to change the API. But we
|
||||
will give some hints how to extend the API.
|
||||
|
||||
A manual for using the resource grammar is found in
|
||||
|
||||
[``http://www.cs.chalmers.se/~aarne/GF/doc/resource.pdf`` http://www.cs.chalmers.se/~aarne/GF/doc/resource.pdf].
|
||||
|
||||
A tutorial on GF, also introducing the idea of resource grammars, is found in
|
||||
|
||||
[``http://www.cs.chalmers.se/~aarne/GF/doc/tutorial/gf-tutorial2.html`` ../../../doc/tutorial/gf-tutorial2.html].
|
||||
|
||||
This document concerns the API v. 1.0. You can find the current code in
|
||||
|
||||
[``http://www.cs.chalmers.se/~aarne/GF/lib/resource-1.0/`` ..]
|
||||
|
||||
See the [``README`` ../README] for
|
||||
details on how this differs from previous versions.
|
||||
|
||||
|
||||
|
||||
==The resource grammar API==
|
||||
|
||||
The API is divided into a bunch of ``abstract`` modules.
|
||||
The following figure gives the dependencies of these modules.
|
||||
|
||||
[Grammar.png]
|
||||
|
||||
Thus the API consists of a grammar and a lexicon, which is
|
||||
provided for test purposes.
|
||||
|
||||
The module structure is rather flat: most modules are direct
|
||||
parents of ``Grammar``. The idea
|
||||
is that you can concentrate on one linguistic aspect at a time, or
|
||||
also distribute the work among several authors. The module ``Cat``
|
||||
defines the "glue" that ties the aspects together - a type system
|
||||
to which all the other modules conform, so that e.g. ``NP`` means
|
||||
the same thing in those modules that use ``NP``s and those that
|
||||
constructs them.
|
||||
|
||||
|
||||
|
||||
===Phrase category modules===
|
||||
|
||||
The direct parents of the top will be called **phrase category modules**,
|
||||
since each of them concentrates on a particular phrase category (nouns, verbs,
|
||||
adjectives, sentences,...). A phrase category module tells
|
||||
//how to construct phrases in that category//. You will find out that
|
||||
all functions in any of these modules have the same value type (or maybe
|
||||
one of a small number of different types). Thus we have
|
||||
|
||||
|
||||
- ``Noun``: construction of nouns and noun phrases
|
||||
- ``Adjective``: construction of adjectival phrases
|
||||
- ``Verb``: construction of verb phrases
|
||||
- ``Adverb``: construction of adverbial phrases
|
||||
- ``Numeral``: construction of cardinal and ordinal numerals
|
||||
- ``Sentence``: construction of sentences and imperatives
|
||||
- ``Question``: construction of questions
|
||||
- ``Relative``: construction of relative clauses
|
||||
- ``Conjunction``: coordination of phrases
|
||||
- ``Phrase``: construction of the major units of text and speech
|
||||
- ``Text``: construction of texts as sequences of phrases
|
||||
- ``Idiom``: idiomatic phrases such as existentials
|
||||
|
||||
|
||||
|
||||
|
||||
===Infrastructure modules===
|
||||
|
||||
Expressions of each phrase category are constructed in the corresponding
|
||||
phrase category module. But their //use// takes mostly place in other modules.
|
||||
For instance, noun phrases, which are constructed in ``Noun``, are
|
||||
used as arguments of functions of almost all other phrase category modules.
|
||||
How can we build all these modules independently of each other?
|
||||
|
||||
As usual in typeful programming, the //only// thing you need to know
|
||||
about an object you use is its type. When writing a linearization rule
|
||||
for a GF abstract syntax function, the only thing you need to know is
|
||||
the linearization types of its value and argument categories. To achieve
|
||||
the division of the resource grammar to several parallel phrase category modules,
|
||||
what we need is an underlying definition of the linearization types. This
|
||||
definition is given as the implementation of
|
||||
|
||||
- ``Cat``: syntactic categories of the resource grammar
|
||||
|
||||
|
||||
Any resource grammar implementation has first to agree on how to implement
|
||||
``Cat``. Luckily enough, even this can be done incrementally: you
|
||||
can skip the ``lincat`` definition of a category and use the default
|
||||
``{s : Str}`` until you need to change it to something else. In
|
||||
English, for instance, many categories do have this linearization type.
|
||||
|
||||
|
||||
|
||||
===Lexical modules===
|
||||
|
||||
What is lexical and what is syntactic is not as clearcut in GF as in
|
||||
some other grammar formalisms. Logically, lexical means atom, i.e. a
|
||||
``fun`` with no arguments. Linguistically, one may add to this
|
||||
that the ``lin`` consists of only one token (or of a table whose values
|
||||
are single tokens). Even in the restricted lexicon included in the resource
|
||||
API, the latter rule is sometimes violated in some languages. For instance,
|
||||
``Structural.both7and_DConj`` is an atom, but its linearization is
|
||||
two words e.g. //both - and//.
|
||||
|
||||
Another characterization of lexical is that lexical units can be added
|
||||
almost //ad libitum//, and they cannot be defined in terms of already
|
||||
given rules. The lexical modules of the resource API are thus more like
|
||||
samples than complete lists. There are two such modules:
|
||||
|
||||
- ``Structural``: structural words (determiners, conjunctions,...)
|
||||
- ``Lexicon``: basic everyday content words (nouns, verbs,...)
|
||||
|
||||
|
||||
The module ``Structural`` aims for completeness, and is likely to
|
||||
be extended in future releases of the resource. The module ``Lexicon``
|
||||
gives a "random" list of words, which enable interesting testing of syntax,
|
||||
and also a check list for morphology, since those words are likely to include
|
||||
most morphological patterns of the language.
|
||||
|
||||
In the case of ``Lexicon`` it may come out clearer than anywhere else
|
||||
in the API that it is impossible to give exact translation equivalents in
|
||||
different languages on the level of a resource grammar. In other words,
|
||||
application grammars are likely to use the resource in different ways for
|
||||
different languages.
|
||||
|
||||
|
||||
==Language-dependent syntax modules==
|
||||
|
||||
In addition to the common API, there is room for language-dependent extensions
|
||||
of the resource. The top level of each languages looks as follows (with English as example):
|
||||
```
|
||||
abstract English = Grammar, ExtraEngAbs, DictEngAbs
|
||||
```
|
||||
where ``ExtraEngAbs`` is a collection of syntactic structures specific to English,
|
||||
and ``DictEngAbs`` is an English dictionary
|
||||
(at the moment, it consists of ``IrregEngAbs``,
|
||||
the irregular verbs of English). Each of these language-specific grammars has
|
||||
the potential to grow into a full-scale grammar of the language. These grammar
|
||||
can also be used as libraries, but the possibility of using functors is lost.
|
||||
|
||||
To give a better overview of language-specific structures,
|
||||
modules like ``ExtraEngAbs``
|
||||
are built from a language-independent module ``ExtraAbs``
|
||||
by restricted inheritance:
|
||||
```
|
||||
abstract ExtraEngAbs = Extra [f,g,...]
|
||||
```
|
||||
Thus any category and function in ``Extra`` may be shared by a subset of all
|
||||
languages. One can see this set-up as a matrix, which tells
|
||||
what ``Extra`` structures
|
||||
are implemented in what languages. For the common API in ``Grammar``, the matrix
|
||||
is filled with 1's (everything is implemented in every language).
|
||||
|
||||
In a minimal resource grammar implementation, the language-dependent
|
||||
extensions are just empty modules, but it is good to provide them for
|
||||
the sake of uniformity.
|
||||
|
||||
|
||||
==The core of the syntax==
|
||||
|
||||
Among all categories and functions, a handful are
|
||||
most important and distinct ones, of which the others are can be
|
||||
seen as variations. The categories are
|
||||
```
|
||||
Cl ; VP ; V2 ; NP ; CN ; Det ; AP ;
|
||||
```
|
||||
The functions are
|
||||
```
|
||||
PredVP : NP -> VP -> Cl ; -- predication
|
||||
ComplV2 : V2 -> NP -> VP ; -- complementization
|
||||
DetCN : Det -> CN -> NP ; -- determination
|
||||
ModCN : AP -> CN -> CN ; -- modification
|
||||
```
|
||||
This [toy Latin grammar latin.gf] shows in a nutshell how these
|
||||
rules relate the categories to each other. It is intended to be a
|
||||
first approximation when designing the parameter system of a new
|
||||
language.
|
||||
|
||||
|
||||
===Another reduced API===
|
||||
|
||||
If you want to experiment with a small subset of the resource API first,
|
||||
try out the module
|
||||
[Syntax http://www.cs.chalmers.se/~aarne/GF/doc/tutorial/resource/Syntax.gf]
|
||||
explained in the
|
||||
[GF Tutorial http://www.cs.chalmers.se/~aarne/GF/doc/tutorial/gf-tutorial2.html].
|
||||
|
||||
|
||||
===The present-tense fragment===
|
||||
|
||||
Some lines in the resource library are suffixed with the comment
|
||||
```--# notpresent
|
||||
which is used by a preprocessor to exclude those lines from
|
||||
a reduced version of the full resource. This present-tense-only
|
||||
version is useful for applications in most technical text, since
|
||||
they reduce the grammar size and compilation time. It can also
|
||||
be useful to exclude those lines in a first version of resource
|
||||
implementation. To compile a grammar with present-tense-only, use
|
||||
```
|
||||
i -preproc=GF/lib/resource-1.0/mkPresent LangGer.gf
|
||||
```
|
||||
|
||||
|
||||
|
||||
==Phases of the work==
|
||||
|
||||
===Putting up a directory===
|
||||
|
||||
Unless you are writing an instance of a parametrized implementation
|
||||
(Romance or Scandinavian), which will be covered later, the
|
||||
simplest way is to follow roughly the following procedure. Assume you
|
||||
are building a grammar for the German language. Here are the first steps,
|
||||
which we actually followed ourselves when building the German implementation
|
||||
of resource v. 1.0.
|
||||
|
||||
+ Create a sister directory for ``GF/lib/resource/english``, named
|
||||
``german``.
|
||||
```
|
||||
cd GF/lib/resource/
|
||||
mkdir german
|
||||
cd german
|
||||
```
|
||||
|
||||
+ Check out the [ISO 639 3-letter language code
|
||||
http://www.w3.org/WAI/ER/IG/ert/iso639.htm]
|
||||
for German: both ``Ger`` and ``Deu`` are given, and we pick ``Ger``.
|
||||
|
||||
+ Copy the ``*Eng.gf`` files from ``english`` ``german``,
|
||||
and rename them:
|
||||
```
|
||||
cp ../english/*Eng.gf .
|
||||
rename 's/Eng/Ger/' *Eng.gf
|
||||
```
|
||||
|
||||
+ Change the ``Eng`` module references to ``Ger`` references
|
||||
in all files:
|
||||
```
|
||||
sed -i 's/English/German/g' *Ger.gf
|
||||
sed -i 's/Eng/Ger/g' *Ger.gf
|
||||
```
|
||||
The first line prevents changing the word ``English``, which appears
|
||||
here and there in comments, to ``Gerlish``.
|
||||
|
||||
+ This may of course change unwanted occurrences of the
|
||||
string ``Eng`` - verify this by
|
||||
```
|
||||
grep Ger *.gf
|
||||
```
|
||||
But you will have to make lots of manual changes in all files anyway!
|
||||
|
||||
+ Comment out the contents of these files:
|
||||
```
|
||||
sed -i 's/^/--/' *Ger.gf
|
||||
```
|
||||
This will give you a set of templates out of which the grammar
|
||||
will grow as you uncomment and modify the files rule by rule.
|
||||
|
||||
+ In all ``.gf`` files, uncomment the module headers and brackets,
|
||||
leaving the module bodies commented. Unfortunately, there is no
|
||||
simple way to do this automatically (or to avoid commenting these
|
||||
lines in the previous step) - but uncommenting the first
|
||||
and the last lines will actually do the job for many of the files.
|
||||
|
||||
+ Uncomment the contents of the main grammar file:
|
||||
```
|
||||
sed -i 's/^--//' LangGer.gf
|
||||
```
|
||||
|
||||
+ Now you can open the grammar ``LangGer`` in GF:
|
||||
```
|
||||
gf LangGer.gf
|
||||
```
|
||||
You will get lots of warnings on missing rules, but the grammar will compile.
|
||||
|
||||
+ At all following steps you will now have a valid, but incomplete
|
||||
GF grammar. The GF command
|
||||
```
|
||||
pg -printer=missing
|
||||
```
|
||||
tells you what exactly is missing.
|
||||
|
||||
|
||||
Here is the module structure of ``LangGer``. It has been simplified by leaving out
|
||||
the majority of the phrase category modules. Each of them has the same dependencies
|
||||
as e.g. ``VerbGer``.
|
||||
|
||||
[German.png]
|
||||
|
||||
|
||||
===Direction of work===
|
||||
|
||||
The real work starts now. There are many ways to proceed, the main ones being
|
||||
- Top-down: start from the module ``Phrase`` and go down to ``Sentence``, then
|
||||
``Verb``, ``Noun``, and in the end ``Lexicon``. In this way, you are all the time
|
||||
building complete phrases, and add them with more content as you proceed.
|
||||
**This approach is not recommended**. It is impossible to test the rules if
|
||||
you have no words to apply the constructions to.
|
||||
|
||||
- Bottom-up: set as your first goal to implement ``Lexicon``. To this end, you
|
||||
need to write ``ParadigmsGer``, which in turn needs parts of
|
||||
``MorphoGer`` and ``ResGer``.
|
||||
**This approach is not recommended**. You can get stuck to details of
|
||||
morphology such as irregular words, and you don't have enough grasp about
|
||||
the type system to decide what forms to cover in morphology.
|
||||
|
||||
|
||||
The practical working direction is thus a saw-like motion between the morphological
|
||||
and top-level modules. Here is a possible course of the work that gives enough
|
||||
test data and enough general view at any point:
|
||||
+ Define ``Cat.N`` and the required parameter types in ``ResGer``. As we define
|
||||
```
|
||||
lincat N = {s : Number => Case => Str ; g : Gender} ;
|
||||
```
|
||||
we need the parameter types ``Number``, ``Case``, and ``Gender``. The definition
|
||||
of ``Number`` in [``common/ParamX`` ../common/ParamX.gf] works for German, so we
|
||||
use it and just define ``Case`` and ``Gender`` in ``ResGer``.
|
||||
|
||||
+ Define ``regN`` in ``ParadigmsGer``. In this way you can
|
||||
already implement a huge amount of nouns correctly in ``LexiconGer``. Actually
|
||||
just adding ``mkN`` should suffice for every noun - but,
|
||||
since it is tedious to use, you
|
||||
might proceed to the next step before returning to morphology and defining the
|
||||
real work horse ``reg2N``.
|
||||
|
||||
+ While doing this, you may want to test the resource independently. Do this by
|
||||
```
|
||||
i -retain ParadigmsGer
|
||||
cc regN "Kirche"
|
||||
```
|
||||
|
||||
+ Proceed to determiners and pronouns in
|
||||
``NounGer`` (``DetCN UsePron DetSg SgQuant NoNum NoOrd DefArt IndefArt UseN``)and
|
||||
``StructuralGer`` (``i_Pron every_Det``). You also need some categories and
|
||||
parameter types. At this point, it is maybe not possible to find out the final
|
||||
linearization types of ``CN``, ``NP``, and ``Det``, but at least you should
|
||||
be able to correctly inflect noun phrases such as //every airplane//:
|
||||
```
|
||||
i LangGer.gf
|
||||
l -table DetCN every_Det (UseN airplane_N)
|
||||
|
||||
Nom: jeder Flugzeug
|
||||
Acc: jeden Flugzeug
|
||||
Dat: jedem Flugzeug
|
||||
Gen: jedes Flugzeugs
|
||||
```
|
||||
|
||||
+ Proceed to verbs: define ``CatGer.V``, ``ResGer.VForm``, and
|
||||
``ParadigmsGer.regV``. You may choose to exclude ``notpresent``
|
||||
cases at this point. But anyway, you will be able to inflect a good
|
||||
number of verbs in ``Lexicon``, such as
|
||||
``live_V`` (``regV "leven"``).
|
||||
|
||||
+ Now you can soon form your first sentences: define ``VP`` and
|
||||
``Cl`` in ``CatGer``, ``VerbGer.UseV``, and ``SentenceGer.PredVP``.
|
||||
Even if you have excluded the tenses, you will be able to produce
|
||||
```
|
||||
i -preproc=mkPresent LangGer.gf
|
||||
> l -table PredVP (UsePron i_Pron) (UseV live_V)
|
||||
|
||||
Pres Simul Pos Main: ich lebe
|
||||
Pres Simul Pos Inv: lebe ich
|
||||
Pres Simul Pos Sub: ich lebe
|
||||
Pres Simul Neg Main: ich lebe nicht
|
||||
Pres Simul Neg Inv: lebe ich nicht
|
||||
Pres Simul Neg Sub: ich nicht lebe
|
||||
```
|
||||
|
||||
+ Transitive verbs (``CatGer.V2 ParadigmsGer.dirV2 VerbGer.ComplV2``)
|
||||
are a natural next step, so that you can
|
||||
produce ``ich liebe dich``.
|
||||
|
||||
+ Adjectives (``CatGer.A ParadigmsGer.regA NounGer.AdjCN AdjectiveGer.PositA``)
|
||||
will force you to think about strong and weak declensions, so that you can
|
||||
correctly inflect //my new car, this new car//.
|
||||
|
||||
+ Once you have implemented the set
|
||||
(``Noun.DetCN Noun.AdjCN Verb.UseV Verb.ComplV2 Sentence.PredVP),
|
||||
you have overcome most of difficulties. You know roughly what parameters
|
||||
and dependences there are in your language, and you can now produce very
|
||||
much in the order you please.
|
||||
|
||||
|
||||
|
||||
===The develop-test cycle===
|
||||
|
||||
The following develop-test cycle will
|
||||
be applied most of the time, both in the first steps described above
|
||||
and in later steps where you are more on your own.
|
||||
|
||||
+ Select a phrase category module, e.g. ``NounGer``, and uncomment some
|
||||
linearization rules (for instance, ``DefSg``, which is
|
||||
not too complicated).
|
||||
|
||||
+ Write down some German examples of this rule, for instance translations
|
||||
of "the dog", "the house", "the big house", etc. Write these in all their
|
||||
different forms (two numbers and four cases).
|
||||
|
||||
+ Think about the categories involved (``CN, NP, N``) and the
|
||||
variations they have. Encode this in the lincats of ``CatGer``.
|
||||
You may have to define some new parameter types in ``ResGer``.
|
||||
|
||||
+ To be able to test the construction,
|
||||
define some words you need to instantiate it
|
||||
in ``LexiconGer``. You will also need some regular inflection patterns
|
||||
in``ParadigmsGer``.
|
||||
|
||||
+ Test by parsing, linearization,
|
||||
and random generation. In particular, linearization to a table should
|
||||
be used so that you see all forms produced:
|
||||
```
|
||||
gr -cat=NP -number=20 -tr | l -table
|
||||
```
|
||||
|
||||
+ Spare some tree-linearization pairs for later regression testing. Use the
|
||||
``tree_bank`` command,
|
||||
```
|
||||
gr -cat=NP -number=20 | tb -xml | wf NP.tb
|
||||
```
|
||||
You can later compared your modified grammar to this treebank by
|
||||
```
|
||||
rf NP.tb | tb -c
|
||||
```
|
||||
|
||||
|
||||
|
||||
You are likely to run this cycle a few times for each linearization rule
|
||||
you implement, and some hundreds of times altogether. There are 66 ``cat``s and
|
||||
458 ``funs`` in ``Lang`` at the moment; 149 of the ``funs`` are outside the two
|
||||
lexicon modules).
|
||||
|
||||
Here is a [live log ../german/log.txt] of the actual process of
|
||||
building the German implementation of resource API v. 1.0.
|
||||
It is the basis of the more detailed explanations, which will
|
||||
follow soon. (You will found out that these explanations involve
|
||||
a rational reconstruction of the live process! Among other things, the
|
||||
API was changed during the actual process to make it more intuitive.)
|
||||
|
||||
|
||||
===Resource modules used===
|
||||
|
||||
These modules will be written by you.
|
||||
|
||||
- ``ResGer``: parameter types and auxiliary operations
|
||||
(a resource for the resource grammar!)
|
||||
- ``ParadigmsGer``: complete inflection engine and most important regular paradigms
|
||||
- ``MorphoGer``: auxiliaries for ``ParadigmsGer`` and ``StructuralGer``. This need
|
||||
not be separate from ``ResGer``.
|
||||
|
||||
|
||||
These modules are language-independent and provided by the existing resource
|
||||
package.
|
||||
|
||||
- ``ParamX``: parameter types used in many languages
|
||||
- ``CommonX``: implementation of language-uniform categories
|
||||
such as $Text$ and $Phr$, as well as of
|
||||
the logical tense, anteriority, and polarity parameters
|
||||
- ``Coordination``: operations to deal with lists and coordination
|
||||
- ``Prelude``: general-purpose operations on strings, records,
|
||||
truth values, etc.
|
||||
- ``Predefined``: general-purpose operations with hard-coded definitions
|
||||
|
||||
|
||||
An important decision is what rules to implement in terms of operations in
|
||||
``ResGer``. A golden rule of functional programming says that, whenever
|
||||
you find yourself programming by copy and paste, you should write a function
|
||||
instead. This indicates that an operation should be created if it is to be
|
||||
used at least twice. At the same time, a sound principle of vicinity says that
|
||||
it should not require too much browsing to understand what a rule does.
|
||||
From these two principles, we have derived the following practice:
|
||||
- If an operation is needed //in two different modules//,
|
||||
it should be created in ``ResGer``. An example is ``mkClause``,
|
||||
used in ``Sentence``, ``Question``, and ``Relative``-
|
||||
- If an operation is needed //twice in the same module//, but never
|
||||
outside, it should be created in the same module. Many examples are
|
||||
found in ``Numerals``.
|
||||
- If an operation is only needed once, it should not be created (but rather
|
||||
inlined). Most functions in phrase category modules are implemented in this
|
||||
way.
|
||||
|
||||
|
||||
This discipline is very different from the one followed in earlier
|
||||
versions of the library (up to 0.9). We then valued the principle of
|
||||
abstraction more than vicinity, creating layers of abstraction for
|
||||
almost everything. This led in practice to the duplication of almost
|
||||
all code on the ``lin`` and ``oper`` levels, and made the code
|
||||
hard to understand and maintain.
|
||||
|
||||
|
||||
|
||||
===Morphology and lexicon===
|
||||
|
||||
The paradigms needed to implement
|
||||
``LexiconGer`` are defined in
|
||||
``ParadigmsGer``.
|
||||
This module provides high-level ways to define the linearization of
|
||||
lexical items, of categories ``N, A, V`` and their complement-taking
|
||||
variants.
|
||||
|
||||
|
||||
|
||||
For ease of use, the ``Paradigms`` modules follow a certain
|
||||
naming convention. Thus they for each lexical category, such as ``N``,
|
||||
the functions
|
||||
|
||||
- ``mkN``, for worst-case construction of ``N``. Its type signature
|
||||
has the form
|
||||
```
|
||||
mkN : Str -> ... -> Str -> P -> ... -> Q -> N
|
||||
```
|
||||
with as many string and parameter arguments as can ever be needed to
|
||||
construct an ``N``.
|
||||
- ``regN``, for the most common cases, with just one string argument:
|
||||
```
|
||||
regN : Str -> N
|
||||
```
|
||||
- A language-dependent (small) set of functions to handle mild irregularities
|
||||
and common exceptions.
|
||||
|
||||
For the complement-taking variants, such as ``V2``, we provide
|
||||
|
||||
- ``mkV2``, which takes a ``V`` and all necessary arguments, such
|
||||
as case and preposition:
|
||||
```
|
||||
mkV2 : V -> Case -> Str -> V2 ;
|
||||
```
|
||||
- A language-dependent (small) set of functions to handle common special cases,
|
||||
such as direct transitive verbs:
|
||||
```
|
||||
dirV2 : V -> V2 ;
|
||||
-- dirV2 v = mkV2 v accusative []
|
||||
```
|
||||
|
||||
|
||||
The golden rule for the design of paradigms is that
|
||||
|
||||
- The user will only need function applications with constants and strings,
|
||||
never any records or tables.
|
||||
|
||||
|
||||
The discipline of data abstraction moreover requires that the user of the resource
|
||||
is not given access to parameter constructors, but only to constants that denote
|
||||
them. This gives the resource grammarian the freedom to change the underlying
|
||||
data representation if needed. It means that the ``ParadigmsGer`` module has
|
||||
to define constants for those parameter types and constructors that
|
||||
the application grammarian may need to use, e.g.
|
||||
```
|
||||
oper
|
||||
Case : Type ;
|
||||
nominative, accusative, genitive, dative : Case ;
|
||||
```
|
||||
These constants are defined in terms of parameter types and constructors
|
||||
in ``ResGer`` and ``MorphoGer``, which modules are not
|
||||
visible to the application grammarian.
|
||||
|
||||
|
||||
===Lock fields===
|
||||
|
||||
An important difference between ``MorphoGer`` and
|
||||
``ParadigmsGer`` is that the former uses "raw" record types
|
||||
for word classes, whereas the latter used category symbols defined in
|
||||
``CatGer``. When these category symbols are used to denote
|
||||
record types in a resource modules, such as ``ParadigmsGer``,
|
||||
a **lock field** is added to the record, so that categories
|
||||
with the same implementation are not confused with each other.
|
||||
(This is inspired by the ``newtype`` discipline in Haskell.)
|
||||
For instance, the lincats of adverbs and conjunctions are the same
|
||||
in ``CommonX`` (and therefore in ``CatGer``, which inherits it):
|
||||
```
|
||||
lincat Adv = {s : Str} ;
|
||||
lincat Conj = {s : Str} ;
|
||||
```
|
||||
But when these category symbols are used to denote their linearization
|
||||
types in resource module, these definitions are translated to
|
||||
```
|
||||
oper Adv : Type = {s : Str ; lock_Adv : {}} ;
|
||||
oper Conj : Type = {s : Str} ; lock_Conj : {}} ;
|
||||
```
|
||||
In this way, the user of a resource grammar cannot confuse adverbs with
|
||||
conjunctions. In other words, the lock fields force the type checker
|
||||
to function as grammaticality checker.
|
||||
|
||||
When the resource grammar is ``open``ed in an application grammar, the
|
||||
lock fields are never seen (except possibly in type error messages),
|
||||
and the application grammarian should never write them herself. If she
|
||||
has to do this, it is a sign that the resource grammar is incomplete, and
|
||||
the proper way to proceed is to fix the resource grammar.
|
||||
|
||||
The resource grammarian has to provide the dummy lock field values
|
||||
in her hidden definitions of constants in ``Paradigms``. For instance,
|
||||
```
|
||||
mkAdv : Str -> Adv ;
|
||||
-- mkAdv s = {s = s ; lock_Adv = <>} ;
|
||||
```
|
||||
|
||||
|
||||
===Lexicon construction===
|
||||
|
||||
The lexicon belonging to ``LangGer`` consists of two modules:
|
||||
|
||||
- ``StructuralGer``, structural words, built by directly using
|
||||
``MorphoGer``.
|
||||
- ``BasicGer``, content words, built by using ``ParadigmsGer``.
|
||||
|
||||
|
||||
The reason why ``MorphoGer`` has to be used in ``StructuralGer``
|
||||
is that ``ParadigmsGer`` does not contain constructors for closed
|
||||
word classes such as pronouns and determiners. The reason why we
|
||||
recommend ``ParadigmsGer`` for building ``LexiconGer`` is that
|
||||
the coverage of the paradigms gets thereby tested and that the
|
||||
use of the paradigms in ``LexiconGer`` gives a good set of examples for
|
||||
those who want to build new lexica.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
==Inside grammar modules==
|
||||
|
||||
Detailed implementation tricks
|
||||
are found in the comments of each module.
|
||||
|
||||
|
||||
===The category system===
|
||||
|
||||
- [Common gfdoc/Common.html], [CommonX ../common/CommonX.gf]
|
||||
- [Cat gfdoc/Cat.html], [CatGer gfdoc/CatGer.gf]
|
||||
|
||||
|
||||
===Phrase category modules===
|
||||
|
||||
- [Noun gfdoc/Noun.html], [NounGer ../german/NounGer.gf]
|
||||
- [Adjective gfdoc/Adjective.html], [AdjectiveGer ../german/AdjectiveGer.gf]
|
||||
- [Verb gfdoc/Verb.html], [VerbGer ../german/VerbGer.gf]
|
||||
- [Adverb gfdoc/Adverb.html], [AdverbGer ../german/AdverbGer.gf]
|
||||
- [Numeral gfdoc/Numeral.html], [NumeralGer ../german/NumeralGer.gf]
|
||||
- [Sentence gfdoc/Sentence.html], [SentenceGer ../german/SentenceGer.gf]
|
||||
- [Question gfdoc/Question.html], [QuestionGer ../german/QuestionGer.gf]
|
||||
- [Relative gfdoc/Relative.html], [RelativeGer ../german/RelativeGer.gf]
|
||||
- [Conjunction gfdoc/Conjunction.html], [ConjunctionGer ../german/ConjunctionGer.gf]
|
||||
- [Phrase gfdoc/Phrase.html], [PhraseGer ../german/PhraseGer.gf]
|
||||
- [Text gfdoc/Text.html], [TextX ../common/TextX.gf]
|
||||
- [Idiom gfdoc/Idiom.html], [IdiomGer ../german/IdiomGer.gf]
|
||||
- [Lang gfdoc/Lang.html], [LangGer ../german/LangGer.gf]
|
||||
|
||||
|
||||
===Resource modules===
|
||||
|
||||
- [ResGer ../german/ResGer.gf]
|
||||
- [MorphoGer ../german/MorphoGer.gf]
|
||||
- [ParadigmsGer gfdoc/ParadigmsGer.html], [ParadigmsGer.gf ../german/ParadigmsGer.gf]
|
||||
|
||||
|
||||
===Lexicon===
|
||||
|
||||
- [Structural gfdoc/Structural.html], [StructuralGer ../german/StructuralGer.gf]
|
||||
- [Lexicon gfdoc/Lexicon.html], [LexiconGer ../german/LexiconGer.gf]
|
||||
|
||||
|
||||
==Lexicon extension==
|
||||
|
||||
===The irregularity lexicon===
|
||||
|
||||
It may be handy to provide a separate module of irregular
|
||||
verbs and other words which are difficult for a lexicographer
|
||||
to handle. There are usually a limited number of such words - a
|
||||
few hundred perhaps. Building such a lexicon separately also
|
||||
makes it less important to cover //everything// by the
|
||||
worst-case paradigms (``mkV`` etc).
|
||||
|
||||
|
||||
|
||||
===Lexicon extraction from a word list===
|
||||
|
||||
You can often find resources such as lists of
|
||||
irregular verbs on the internet. For instance, the
|
||||
[Irregular German Verbs http://www.iee.et.tu-dresden.de/~wernerr/grammar/verben_dt.html]
|
||||
page gives a list of verbs in the
|
||||
traditional tabular format, which begins as follows:
|
||||
```
|
||||
backen (du bäckst, er bäckt) backte [buk] gebacken
|
||||
befehlen (du befiehlst, er befiehlt; befiehl!) befahl (beföhle; befähle) befohlen
|
||||
beginnen begann (begönne; begänne) begonnen
|
||||
beißen biß gebissen
|
||||
```
|
||||
All you have to do is to write a suitable verb paradigm
|
||||
```
|
||||
irregV : (x1,_,_,_,_,x6 : Str) -> V ;
|
||||
```
|
||||
and a Perl or Python or Haskell script that transforms
|
||||
the table to
|
||||
```
|
||||
backen_V = irregV "backen" "bäckt" "back" "backte" "backte" "gebacken" ;
|
||||
befehlen_V = irregV "befehlen" "befiehlt" "befiehl" "befahl" "beföhle" "befohlen" ;
|
||||
```
|
||||
|
||||
When using ready-made word lists, you should think about
|
||||
coyright issues. Ideally, all resource grammar material should
|
||||
be provided under GNU General Public License.
|
||||
|
||||
|
||||
|
||||
===Lexicon extraction from raw text data===
|
||||
|
||||
This is a cheap technique to build a lexicon of thousands
|
||||
of words, if text data is available in digital format.
|
||||
See the [Functional Morphology http://www.cs.chalmers.se/~markus/FM/]
|
||||
homepage for details.
|
||||
|
||||
|
||||
|
||||
===Extending the resource grammar API===
|
||||
|
||||
Sooner or later it will happen that the resource grammar API
|
||||
does not suffice for all applications. A common reason is
|
||||
that it does not include idiomatic expressions in a given language.
|
||||
The solution then is in the first place to build language-specific
|
||||
extension modules. This chapter will deal with this issue (to be completed).
|
||||
|
||||
|
||||
==Writing an instance of parametrized resource grammar implementation==
|
||||
|
||||
Above we have looked at how a resource implementation is built by
|
||||
the copy and paste method (from English to German), that is, formally
|
||||
speaking, from scratch. A more elegant solution available for
|
||||
families of languages such as Romance and Scandinavian is to
|
||||
use parametrized modules. The advantages are
|
||||
|
||||
- theoretical: linguistic generalizations and insights
|
||||
- practical: maintainability improves with fewer components
|
||||
|
||||
|
||||
In this chapter, we will look at an example: adding Italian to
|
||||
the Romance family (to be completed). Here is a set of
|
||||
[slides http://www.cs.chalmers.se/~aarne/geocal2006.pdf]
|
||||
on the topic.
|
||||
|
||||
|
||||
==Parametrizing a resource grammar implementation==
|
||||
|
||||
This is the most demanding form of resource grammar writing.
|
||||
We do //not// recommend the method of parametrizing from the
|
||||
beginning: it is easier to have one language first implemented
|
||||
in the conventional way and then add another language of the
|
||||
same family by aprametrization. This means that the copy and
|
||||
paste method is still used, but at this time the differences
|
||||
are put into an ``interface`` module.
|
||||
|
||||
|
||||
|
||||
This chapter will work out an example of how an Estonian grammar
|
||||
is constructed from the Finnish grammar through parametrization.
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.0 KiB |
File diff suppressed because it is too large
Load Diff
@@ -1,899 +0,0 @@
|
||||
The GF Resource Grammar Library Version 1.0
|
||||
Author: Aarne Ranta <aarne (at) cs.chalmers.se>
|
||||
Last update: %%date(%c)
|
||||
|
||||
% NOTE: this is a txt2tags file.
|
||||
% Create an html file from this file using:
|
||||
% txt2tags --toc clt2006.txt
|
||||
|
||||
%!target:html
|
||||
|
||||
%!postproc(html): #NEW <!-- NEW -->
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
==Plan==
|
||||
|
||||
Purpose
|
||||
|
||||
Background
|
||||
|
||||
Coverage
|
||||
|
||||
Structure
|
||||
|
||||
How to use
|
||||
|
||||
How to implement a new language
|
||||
|
||||
How to extend the API
|
||||
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
==Purpose==
|
||||
|
||||
===Library for applications===
|
||||
|
||||
High-level access to grammatical rules
|
||||
|
||||
E.g. //You have k new messages// rendered in ten languages //X//
|
||||
```
|
||||
render X (Have (You (Number (k (New Message)))))
|
||||
```
|
||||
|
||||
Usability for different purposes
|
||||
- translation systems
|
||||
- software localization
|
||||
- dialogue systems
|
||||
- language teaching
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===Not primarily code for a parser===
|
||||
|
||||
Often in NLP, a grammar is just high-level code for a parser.
|
||||
|
||||
But writing a grammar can be inadequate for parsing:
|
||||
- too much manual work
|
||||
- too inefficient
|
||||
- not robust
|
||||
- too ambiguous
|
||||
|
||||
|
||||
Moreover, a grammar fine-tuned for parsing may not be reusable
|
||||
- for generation
|
||||
- for specialized grammars
|
||||
- as library
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===Grammar as language definition===
|
||||
|
||||
Linguistic ontology: **abstract syntax**
|
||||
|
||||
E.g. adjectival modification rule
|
||||
```
|
||||
AdjCN : AP -> CN -> CN ;
|
||||
```
|
||||
Rendering in different languages: **concrete syntax**
|
||||
```
|
||||
AdjCN (PositA even_A) (UseN number_N)
|
||||
|
||||
even number, even numbers
|
||||
|
||||
jämnt tal, jämna tal
|
||||
|
||||
nombre pair, nombres pairs
|
||||
```
|
||||
Abstract away from inflection, agreement, word order.
|
||||
|
||||
Resource grammars have generation perspective, rather than parsing
|
||||
- abstract syntax serves as a key to renderings in different languages
|
||||
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===Usability by non-linguists===
|
||||
|
||||
Division of labour: resource grammars hide linguistic details
|
||||
- ``AdjCN : AP -> CN -> CN`` hides agreement, word order,...
|
||||
|
||||
|
||||
Presentation: "school grammar" concepts, dictionary-like conventions
|
||||
```
|
||||
bird_N = reg2N "Vogel" "Vögel" masculine
|
||||
```
|
||||
API = Application Programmer's Interface
|
||||
|
||||
Documentation: ``gfdoc``
|
||||
- produces html from gf
|
||||
|
||||
|
||||
IDE = Interactive Development Environment (forthcoming)
|
||||
- library browser and syntax editor for grammar writing
|
||||
|
||||
|
||||
Example-based grammar writing
|
||||
```
|
||||
render Ita (parse Eng "you have k messages")
|
||||
```
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===Scientific interest===
|
||||
|
||||
Linguistics
|
||||
- definition of linguistic ontology
|
||||
- describing language on this level of abstraction
|
||||
- coping with different problems in different languages
|
||||
- sharing concrete-syntax code between languages
|
||||
- creating a resource for other NLP applications
|
||||
|
||||
|
||||
Computer science
|
||||
- datastructures for grammar rules
|
||||
- type systems for grammars
|
||||
- algorithms: parsing, generation, grammar compilation
|
||||
- domain-specific programming language (GF)
|
||||
- module system
|
||||
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
==Background==
|
||||
|
||||
===History===
|
||||
|
||||
2002: v. 0.2
|
||||
- English, French, German, Swedish
|
||||
|
||||
|
||||
2003: v. 0.6
|
||||
- module system
|
||||
- added Finnish, Italian, Russian
|
||||
- used in KeY
|
||||
|
||||
|
||||
2005: v. 0.9
|
||||
- tenses
|
||||
- added Danish, Norwegian, Spanish; no German
|
||||
- used in WebALT
|
||||
|
||||
|
||||
2006: v. 1.0
|
||||
- approximate CLE coverage
|
||||
- reorganized module system and implementation
|
||||
- not yet (4/3/2006) for Danish and Russian
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===Authors===
|
||||
|
||||
Janna Khegai (Russian modules, forthcoming),
|
||||
Bjorn Bringert (many Swadesh lexica),
|
||||
Inger Andersson and Therese Söderberg (Spanish morphology),
|
||||
Ludmilla Bogavac (Russian morphology),
|
||||
Carlos Gonzalia (Spanish cardinals),
|
||||
Harald Hammarström (German morphology),
|
||||
Partik Jansson (Swedish cardinals),
|
||||
Aarne Ranta.
|
||||
|
||||
We are grateful for contributions and
|
||||
comments to several other people who have used this and
|
||||
the previous versions of the resource library, including
|
||||
Ana Bove,
|
||||
David Burke,
|
||||
Lauri Carlson,
|
||||
Gloria Casanellas,
|
||||
Karin Cavallin,
|
||||
Hans-Joachim Daniels,
|
||||
Kristofer Johannisson,
|
||||
Anni Laine,
|
||||
Wanjiku Ng'ang'a,
|
||||
Jordi Saludes.
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===Related work===
|
||||
|
||||
CLE (Core Language Engine,
|
||||
[Book 1992 http://mitpress.mit.edu/catalog/item/default.asp?tid=7739&ttype=2])
|
||||
- English, Swedish, French, Danish
|
||||
- uses Definita Clause Grammars, implementation in Prolog
|
||||
- coverage for the ATIS corpus,
|
||||
[Spoken Language Translator (2001) http://www.cambridge.org/uk/catalogue/catalogue.asp?isbn=0521770777]
|
||||
- grammar specialization via explanation-based learning
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===Slightly less related work===
|
||||
|
||||
[LinGO Grammar Matrix http://www.delph-in.net/matrix/]
|
||||
- English, German, Japanese, Spanish, ...
|
||||
- uses HPSG, implementation in LKB
|
||||
- a check list for parallel grammar implementations
|
||||
|
||||
|
||||
[Pargram http://www2.parc.com/istl/groups/nltt/pargram/]
|
||||
- Aimed: Arabic, Chinese, English, French, German, Hungarian, Japanese,
|
||||
Malagasy, Norwegian, Turkish, Urdu, Vietnamese, and Welsh
|
||||
- uses LFG
|
||||
- one set of big grammars, transfer rules
|
||||
|
||||
|
||||
Rosetta Machine Translation ([Book 1994 http://citeseer.ist.psu.edu/181924.html])
|
||||
- Dutch, English, French
|
||||
- uses M-grammars, compositional translation inspired by Montague
|
||||
- compositional transfer rules
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
==Coverage==
|
||||
|
||||
===Languages===
|
||||
|
||||
The current GF Resource Project covers ten languages:
|
||||
- ``Dan``ish
|
||||
- ``Eng``lish
|
||||
- ``Fin``nish
|
||||
- ``Fre``nch
|
||||
- ``Ger``man
|
||||
- ``Ita``lian
|
||||
- ``Nor``wegian (bokmål)
|
||||
- ``Rus``sian
|
||||
- ``Spa``nish
|
||||
- ``Swe``dish
|
||||
|
||||
|
||||
In addition, parts of Arabic, Estonian, Latin, and Urdu
|
||||
|
||||
API 1.0 not yet implemented for Danish and Russian
|
||||
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===Morphology and lexicon===
|
||||
|
||||
Complete inflection engine
|
||||
- all word classes
|
||||
- all forms
|
||||
- all inflectional paradigms
|
||||
|
||||
|
||||
Basic lexicon
|
||||
- 100 structural words
|
||||
- 340 content words, mainly for testing
|
||||
- these include the 207 [Swadesh words http://en.wiktionary.org/wiki/Swadesh_List]
|
||||
|
||||
|
||||
It is more important to enable lexicon extensions than to
|
||||
provide a huge lexicon.
|
||||
- technical lexica can have very special words, which tend to be regular
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===Syntactic structures===
|
||||
|
||||
Texts:
|
||||
sequences of phrases with punctuation
|
||||
|
||||
Phrases:
|
||||
declaratives, questions, imperatives, vocatives
|
||||
|
||||
Tense, mood, and polarity:
|
||||
present, past, future, conditional ; simultaneous, anterior ; positive, negative
|
||||
|
||||
Questions:
|
||||
yes-no, "wh" ; direct, indirect
|
||||
|
||||
Clauses:
|
||||
main, relative, embedded (subject, object, adverbial)
|
||||
|
||||
Verb phrases:
|
||||
intransitive, transitive, ditransitive, prepositional
|
||||
|
||||
Noun phrases:
|
||||
proper names, pronouns, determiners, possessives, cardinals and ordinals
|
||||
|
||||
Coordination:
|
||||
lists of sentences, noun phrases, adverbs, adjectival phrases
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===Quantitative measures===
|
||||
|
||||
67 categories
|
||||
|
||||
150 abstract syntax combination rules
|
||||
|
||||
100 structural words
|
||||
|
||||
340 content words in a test lexicon
|
||||
|
||||
35 kLines of source code (4/3/2006):
|
||||
```
|
||||
abstract 1131
|
||||
english 2344
|
||||
german 2386
|
||||
finnish 3396
|
||||
norwegian 1257
|
||||
swedish 1465
|
||||
scandinavian 1023
|
||||
french 3246 -- Besch + Irreg + Morpho 2111
|
||||
italian 7797 -- Besch 6512
|
||||
spanish 7120 -- Besch 5877
|
||||
romance 1066
|
||||
```
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
==Structure of the API==
|
||||
|
||||
===Language-independent ground API===
|
||||
|
||||
[Lang.png]
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===The structure of a text sentence===
|
||||
|
||||
```
|
||||
John walks.
|
||||
|
||||
TFullStop : Phr -> Text -> Text | TQuestMark, TExclMark
|
||||
(PhrUtt : PConj -> Utt -> Voc -> Phr | PhrYes, PhrNo, ...
|
||||
NoPConj | but_PConj, ...
|
||||
(UttS : S -> Utt | UttQS, UttImp, UttNP, ...
|
||||
(UseCl : Tense -> Anter -> Pol -> Cl -> S
|
||||
TPres
|
||||
ASimul
|
||||
PPos
|
||||
(PredVP : NP -> VP -> Cl | ImpersNP, ExistNP, ...
|
||||
(UsePN : PN -> NP
|
||||
john_PN)
|
||||
(UseV : V -> VP | ComplV2, UseComp, ...
|
||||
walk_V))))
|
||||
NoVoc) | VocNP, please_Voc, ...
|
||||
TEmpty
|
||||
```
|
||||
|
||||
#NEW
|
||||
|
||||
===The structure in the syntax editor===
|
||||
|
||||
[editor.png]
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===Language-dependent paradigm modules===
|
||||
|
||||
====Regular paradigms====
|
||||
|
||||
Every language implements these regular patterns that take
|
||||
"dictionary forms" as arguments.
|
||||
```
|
||||
regN : Str -> N
|
||||
regA : Str -> A
|
||||
regV : Str -> V
|
||||
```
|
||||
Their usefulness varies. For instance, they
|
||||
all are quite good in Finnish and English.
|
||||
In Swedish, less so:
|
||||
```
|
||||
regN "val" ---> val, valen, valar, valarna
|
||||
```
|
||||
Initializing a lexicon with ``regX`` for every entry is
|
||||
usually a good starting point in grammar development.
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
====Regular paradigms====
|
||||
|
||||
In Swedish, giving the gender of ``N`` improves a lot
|
||||
```
|
||||
regGenN "val" neutrum ---> val, valet, val, valen
|
||||
```
|
||||
|
||||
There are also special constructs taking other forms:
|
||||
```
|
||||
mk2N : (nyckel,nycklar : Str) -> N
|
||||
|
||||
mk1N : (bilarna : Str) -> N
|
||||
|
||||
irregV : (dricka, drack, druckit : Str) -> V
|
||||
```
|
||||
|
||||
Regular verbs are actually implemented the
|
||||
[Lexin http://lexin.nada.kth.se/sve-sve.shtml] way
|
||||
```
|
||||
regV : (talar : Str) -> V
|
||||
```
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
====Worst-case paradigms====
|
||||
|
||||
To cover all situations, worst-case paradigms are given. E.g. Swedish
|
||||
```
|
||||
mkN : (apa,apan,apor,aporna : Str) -> N
|
||||
|
||||
mkA : (liten, litet, lilla, små, mindre, minst, minsta : Str) -> A
|
||||
|
||||
mkV : (supa,super,sup,söp,supit,supen : Str) -> V
|
||||
```
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
====Irregular words====
|
||||
|
||||
Iregular words in ``IrregX``, e.g. Swedish:
|
||||
```
|
||||
draga_V : V =
|
||||
mkV
|
||||
(variants { "dra" ; "draga"})
|
||||
(variants { "drar" ; "drager"})
|
||||
(variants { "dra" ; "drag" })
|
||||
"drog"
|
||||
"dragit"
|
||||
"dragen" ;
|
||||
```
|
||||
Goal: eliminate the user's need of worst-case functions.
|
||||
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===Language-dependent syntax extensions===
|
||||
|
||||
Syntactic structures that are not shared by all languages.
|
||||
|
||||
Alternative (and often more idiomatic) ways to say what is already covered by the API.
|
||||
|
||||
Not implemented yet.
|
||||
|
||||
Candidates:
|
||||
- Norwegian post-possessives: ``bilen min``
|
||||
- French question forms: ``est-ce que tu dors ?``
|
||||
- Romance simple past tenses
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===Special-purpose APIs===
|
||||
|
||||
Mathematical
|
||||
|
||||
Multimodal
|
||||
|
||||
Present
|
||||
|
||||
Minimal
|
||||
|
||||
Shallow
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===How to use the resource as top-level grammar===
|
||||
|
||||
===Compiling===
|
||||
|
||||
It is a good idea to compile the library, so that it can be opened faster
|
||||
```
|
||||
GF/lib/resource-1.0% make
|
||||
|
||||
writes GF/lib/alltenses
|
||||
GF/lib/present
|
||||
GF/lib/resource-1.0/langs.gfcm
|
||||
```
|
||||
If you don't intend to change the library, you never need to process the source
|
||||
files again. Just do some of
|
||||
```
|
||||
gf -nocf langs.gfcm -- all 8 languages
|
||||
|
||||
gf -nocf -path=alltenses:prelude alltenses/LangSwe.gfc -- Swedish only
|
||||
|
||||
gf -nocf -path=present:prelude present/LangSwe.gfc -- Swedish in present tense only
|
||||
```
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===Parsing===
|
||||
|
||||
The default parser does not work! (It is obsolete anyway.)
|
||||
|
||||
The MCFG parser (the new standard) works in theory, but can
|
||||
in practice be too slow to build.
|
||||
|
||||
But it does work in some languages, after waiting appr. 20 seconds
|
||||
```
|
||||
p -mcfg -lang=LangEng -cat=S "I would see her"
|
||||
|
||||
p -mcfg -lang=LangSwe -cat=S "jag skulle se henne"
|
||||
```
|
||||
Parsing in ``present/`` versions is quicker.
|
||||
|
||||
Remedies:
|
||||
- write application grammars for parsing
|
||||
- use treebank lookup instead
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===Treebank generation===
|
||||
|
||||
Multilingual treebank entry = tree + linearizations
|
||||
|
||||
Some examples on treebank generation, assuming ``langs.gfcm``
|
||||
```
|
||||
gr -cat=S -number=10 -cf | tb -- 10 random S
|
||||
|
||||
gt -cat=Phr -depth=4 | tb -xml | wf ex.xml -- all Phr to depth 4, into file ex.xml
|
||||
```
|
||||
Regression testing
|
||||
```
|
||||
rf ex.xml | tb -c -- read treebank from file and compare to present grammars
|
||||
```
|
||||
Updating a treebank
|
||||
```
|
||||
rf old.xml | tb -trees | tb -xml | wf new.xml -- read old from file, write new to file
|
||||
```
|
||||
|
||||
#NEW
|
||||
|
||||
===The multilingual treebank format===
|
||||
|
||||
Tree + linearizations
|
||||
```
|
||||
> gr -cat=Cl | tb
|
||||
PredVP (UsePron they_Pron) (PassV2 seek_V2)
|
||||
They are sought
|
||||
Elles sont cherchées
|
||||
Son buscadas
|
||||
Vengono cercate
|
||||
De blir sökta
|
||||
De blir lette
|
||||
Sie werden gesucht
|
||||
Heidät etsitään
|
||||
```
|
||||
These can also be wrapped in XML tags (``tb -xml``)
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===Treebank-based parsing===
|
||||
|
||||
Brute-force method that helps if real parsing is more expensive.
|
||||
```
|
||||
make treebank -- make treebank with all languages
|
||||
|
||||
gf -treebank langs.xml -- start GF by reading the treebank
|
||||
|
||||
> ut -strings -treebank=LangIta -- show all Ita strings
|
||||
|
||||
> ut -treebank=LangIta -raw "Quello non si romperebbe" -- look up a string
|
||||
|
||||
> i -nocf langs.gfcm -- read grammar to be able to linearize
|
||||
|
||||
> ut -treebank=LangIta "Quello non si romperebbe" | l -multi -- translate to all
|
||||
```
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===Morphology===
|
||||
|
||||
Use morphological analyser
|
||||
```
|
||||
gf -nocf -retain -path=alltenses:prelude alltenses/LangSwe.gf
|
||||
> ma "jag kan inte höra vad du säger"
|
||||
```
|
||||
|
||||
Try out a morphology quiz
|
||||
```
|
||||
> mq -cat=V
|
||||
```
|
||||
|
||||
Try out inflection patterns
|
||||
```
|
||||
gf -retain -path=alltenses:prelude alltenses/ParadigmsSwe.gfr
|
||||
> cc regV "lyser"
|
||||
```
|
||||
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===Syntax editing===
|
||||
|
||||
The simplest way to start editing with all grammars is
|
||||
```
|
||||
gfeditor langs.gfcm
|
||||
```
|
||||
The forthcoming IDE will extend the syntax editor with
|
||||
a ``Paradigms`` file browser and a control on what
|
||||
parts of an application grammar remain to be implemented.
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===Efficient parsing via application grammar===
|
||||
|
||||
Get rid of discontinuous constituents (in particular, ``VP``)
|
||||
|
||||
Example: [``mathematical/Predication`` gfdoc/Predication.html]:
|
||||
```
|
||||
predV2 : V2 -> NP -> NP -> Cl
|
||||
```
|
||||
instead of ``PredVP np (ComplV2 v2 np')``
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
==How to use as library==
|
||||
|
||||
===Specialization through parametrized modules===
|
||||
|
||||
The application grammar is implemented with reference to
|
||||
the resource API
|
||||
|
||||
Individual languages are instantiations
|
||||
|
||||
Example: [tram ../../../examples/tram/TramI.gf]
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===Compile-time transfer===
|
||||
|
||||
Instead of parametrized modules:
|
||||
|
||||
select resource functions differently for different languages
|
||||
|
||||
Example: imperative vs. infinitive in mathematical exercises
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===A natural division into modules===
|
||||
|
||||
Lexicon in language-dependent moduls
|
||||
|
||||
Combination rules in a parametrized module
|
||||
|
||||
#NEW
|
||||
|
||||
===Example-based grammar writing===
|
||||
|
||||
Example: [animal ../../../examples/animal/QuestionsI.gfe]
|
||||
```
|
||||
--# -resource=present/LangEng.gf
|
||||
--# -path=.:present:prelude
|
||||
|
||||
-- to compile: gf -examples QuestionsI.gfe
|
||||
|
||||
incomplete concrete QuestionsI of Questions = open Lang 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" ;
|
||||
}
|
||||
```
|
||||
|
||||
#NEW
|
||||
|
||||
==How to implement a new language==
|
||||
|
||||
See [Resource-HOWTO Resource-HOWTO.html]
|
||||
|
||||
==Ordinary modules==
|
||||
|
||||
Write a concrete syntax module for each abstract module in the API
|
||||
|
||||
Write a ``Paradigms`` module
|
||||
|
||||
Examples: English, Finnish, German, Russian
|
||||
|
||||
#NEW
|
||||
|
||||
==Parametrized modules==
|
||||
|
||||
Examples: Romance (French, Italian, Spanish), Scandinavian (Danish, Norwegian, Swedish)
|
||||
|
||||
Write a ``Diff`` interface for a family of languages
|
||||
|
||||
Write concrete syntaxes as functors opening the interface
|
||||
|
||||
Write separate ``Paradigms`` modules for each language
|
||||
|
||||
Advantages:
|
||||
- easier maintenance of library
|
||||
- insights into language families
|
||||
|
||||
|
||||
Problems:
|
||||
- more abstract thinking required
|
||||
- individual grammars may not come out optimal in elegance and efficiency
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===The core API===
|
||||
|
||||
Everything else is variations of this
|
||||
```
|
||||
cat
|
||||
Cl ; -- clause
|
||||
VP ; -- verb phrase
|
||||
V2 ; -- two-place verb
|
||||
NP ; -- noun phrase
|
||||
CN ; -- common noun
|
||||
Det ; -- determiner
|
||||
AP ; -- adjectival phrase
|
||||
|
||||
fun
|
||||
PredVP : NP -> VP -> Cl ; -- predication
|
||||
ComplV2 : V2 -> NP -> VP ; -- complementization
|
||||
DetCN : Det -> CN -> NP ; -- determination
|
||||
ModCN : AP -> CN -> CN ; -- modification
|
||||
```
|
||||
|
||||
#NEW
|
||||
|
||||
===The core API in Latin: parameters===
|
||||
|
||||
This [toy Latin grammar latin.gf] shows in a nutshell how the core
|
||||
can be implemented.
|
||||
```
|
||||
param
|
||||
Number = Sg | Pl ;
|
||||
Person = P1 | P2 | P3 ;
|
||||
Tense = Pres | Past ;
|
||||
Polarity = Pos | Neg ;
|
||||
Case = Nom | Acc | Dat ;
|
||||
Gender = Masc | Fem | Neutr ;
|
||||
oper
|
||||
Agr = {g : Gender ; n : Number ; p : Person} ; -- agreement features
|
||||
```
|
||||
|
||||
#NEW
|
||||
|
||||
===The core API in Latin: linearization types===
|
||||
|
||||
```
|
||||
lincat
|
||||
Cl = {
|
||||
s : Tense => Polarity => Str
|
||||
} ;
|
||||
VP = {
|
||||
verb : Tense => Polarity => Agr => Str ; -- finite verb
|
||||
neg : Polarity => Str ; -- negation
|
||||
compl : Agr => Str -- complement
|
||||
} ;
|
||||
V2 = {
|
||||
s : Tense => Number => Person => Str ;
|
||||
c : Case -- complement case
|
||||
} ;
|
||||
NP = {
|
||||
s : Case => Str ;
|
||||
a : Agr -- agreement features
|
||||
} ;
|
||||
CN = {
|
||||
s : Number => Case => Str ;
|
||||
g : Gender
|
||||
} ;
|
||||
Det = {
|
||||
s : Gender => Case => Str ;
|
||||
n : Number
|
||||
} ;
|
||||
AP = {
|
||||
s : Gender => Number => Case => Str
|
||||
} ;
|
||||
```
|
||||
|
||||
#NEW
|
||||
|
||||
===The core API in Latin: predication and complementization===
|
||||
|
||||
```
|
||||
lin
|
||||
PredVP np vp = {
|
||||
s = \\t,p =>
|
||||
let
|
||||
agr = np.a ;
|
||||
subject = np.s ! Nom ;
|
||||
object = vp.compl ! agr ;
|
||||
verb = vp.neg ! p ++ vp.verb ! t ! p ! agr
|
||||
in
|
||||
subject ++ object ++ verb
|
||||
} ;
|
||||
|
||||
ComplV2 v np = {
|
||||
verb = \\t,p,a => v.s ! t ! a.n ! a.p ;
|
||||
compl = \\_ => np.s ! v.c ;
|
||||
neg = table {Pos => [] ; Neg => "non"}
|
||||
} ;
|
||||
```
|
||||
|
||||
#NEW
|
||||
|
||||
===The core API in Latin: determination and modification===
|
||||
|
||||
```
|
||||
DetCN det cn =
|
||||
let
|
||||
g = cn.g ;
|
||||
n = det.n
|
||||
in {
|
||||
s = \\c => det.s ! g ! c ++ cn.s ! n ! c ;
|
||||
a = {g = g ; n = n ; p = P3}
|
||||
} ;
|
||||
|
||||
ModCN ap cn =
|
||||
let
|
||||
g = cn.g
|
||||
in {
|
||||
s = \\n,c => cn.s ! n ! c ++ ap.s ! g ! n ! c ;
|
||||
g = g
|
||||
} ;
|
||||
```
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
===How to proceed===
|
||||
|
||||
+ put up a directory with dummy modules by copying from e.g. English and
|
||||
commenting out the contents
|
||||
|
||||
+ so you will have a compilable ``LangX`` all the time
|
||||
|
||||
+ start with nouns and their inflection
|
||||
|
||||
+ proceed to verbs and their inflection
|
||||
|
||||
+ add some noun phrases
|
||||
|
||||
+ implement predication
|
||||
|
||||
|
||||
#NEW
|
||||
|
||||
==How to extend the API==
|
||||
|
||||
Extend old modules or add a new one?
|
||||
|
||||
Usually better to start a new one: then you don't have to implement it
|
||||
for all languages at once.
|
||||
|
||||
Exception: if you are working with a language-specific API extension,
|
||||
you can work directly in that module.
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB |
File diff suppressed because it is too large
Load Diff
@@ -1,69 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
|
||||
<TITLE> Adjective: Adjectives and Adjectival Phrases</TITLE>
|
||||
</HEAD><BODY BGCOLOR="white" TEXT="black">
|
||||
<P ALIGN="center"><CENTER><H1> Adjective: Adjectives and Adjectival Phrases</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Last update: 2006-06-22 19:14:36 CEST</I><BR>
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
<HR NOSHADE SIZE=1>
|
||||
<P></P>
|
||||
<P></P>
|
||||
<HR NOSHADE SIZE=1>
|
||||
<P></P>
|
||||
<P>
|
||||
Produced by
|
||||
gfdoc - a rudimentary GF document generator.
|
||||
(c) Aarne Ranta (<A HREF="mailto:aarne@cs.chalmers.se">aarne@cs.chalmers.se</A>) 2002 under GNU GPL.
|
||||
</P>
|
||||
<PRE>
|
||||
abstract Adjective = Cat ** {
|
||||
|
||||
fun
|
||||
</PRE>
|
||||
<P></P>
|
||||
<P>
|
||||
The principal ways of forming an adjectival phrase are
|
||||
positive, comparative, relational, reflexive-relational, and
|
||||
elliptic-relational.
|
||||
(The superlative use is covered in <A HREF="Noun.html">Noun</A>.<CODE>SuperlA</CODE>.)
|
||||
</P>
|
||||
<PRE>
|
||||
PositA : A -> AP ; -- warm
|
||||
ComparA : A -> NP -> AP ; -- warmer than Spain
|
||||
ComplA2 : A2 -> NP -> AP ; -- divisible by 2
|
||||
ReflA2 : A2 -> AP ; -- divisible by itself
|
||||
UseA2 : A2 -> A ; -- divisible
|
||||
</PRE>
|
||||
<P></P>
|
||||
<P>
|
||||
Sentence and question complements defined for all adjectival
|
||||
phrases, although the semantics is only clear for some adjectives.
|
||||
</P>
|
||||
<PRE>
|
||||
SentAP : AP -> SC -> AP ; -- great that she won, uncertain if she did
|
||||
</PRE>
|
||||
<P></P>
|
||||
<P>
|
||||
An adjectival phrase can be modified by an <B>adadjective</B>, such as <I>very</I>.
|
||||
</P>
|
||||
<PRE>
|
||||
AdAP : AdA -> AP -> AP ; -- very uncertain
|
||||
</PRE>
|
||||
<P></P>
|
||||
<P>
|
||||
The formation of adverbs from adjective (e.g. <I>quickly</I>) is covered
|
||||
by <A HREF="Adverb.html">Adverb</A>.
|
||||
</P>
|
||||
<PRE>
|
||||
}
|
||||
</PRE>
|
||||
<P></P>
|
||||
|
||||
<!-- html code generated by txt2tags 2.3 (http://txt2tags.sf.net) -->
|
||||
<!-- cmdline: txt2tags -thtml -\-toc abstract/Adjective.txt -->
|
||||
</BODY></HTML>
|
||||
@@ -1,74 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
|
||||
<TITLE> Adverb: Adverbs and Adverbial Phrases</TITLE>
|
||||
</HEAD><BODY BGCOLOR="white" TEXT="black">
|
||||
<P ALIGN="center"><CENTER><H1> Adverb: Adverbs and Adverbial Phrases</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Last update: 2006-06-14 22:56:30 CEST</I><BR>
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
<HR NOSHADE SIZE=1>
|
||||
<P></P>
|
||||
<P></P>
|
||||
<HR NOSHADE SIZE=1>
|
||||
<P></P>
|
||||
<P>
|
||||
Produced by
|
||||
gfdoc - a rudimentary GF document generator.
|
||||
(c) Aarne Ranta (<A HREF="mailto:aarne@cs.chalmers.se">aarne@cs.chalmers.se</A>) 2002 under GNU GPL.
|
||||
</P>
|
||||
<PRE>
|
||||
abstract Adverb = Cat ** {
|
||||
|
||||
fun
|
||||
</PRE>
|
||||
<P></P>
|
||||
<P>
|
||||
The two main ways of forming adverbs are from adjectives and by
|
||||
prepositions from noun phrases.
|
||||
</P>
|
||||
<PRE>
|
||||
PositAdvAdj : A -> Adv ; -- quickly
|
||||
PrepNP : Prep -> NP -> Adv ; -- in the house
|
||||
</PRE>
|
||||
<P></P>
|
||||
<P>
|
||||
Comparative adverbs have a noun phrase or a sentence as object of
|
||||
comparison.
|
||||
</P>
|
||||
<PRE>
|
||||
ComparAdvAdj : CAdv -> A -> NP -> Adv ; -- more quickly than John
|
||||
ComparAdvAdjS : CAdv -> A -> S -> Adv ; -- more quickly than he runs
|
||||
</PRE>
|
||||
<P></P>
|
||||
<P>
|
||||
Adverbs can be modified by 'adadjectives', just like adjectives.
|
||||
</P>
|
||||
<PRE>
|
||||
AdAdv : AdA -> Adv -> Adv ; -- very quickly
|
||||
</PRE>
|
||||
<P></P>
|
||||
<P>
|
||||
Subordinate clauses can function as adverbs.
|
||||
</P>
|
||||
<PRE>
|
||||
SubjS : Subj -> S -> Adv ; -- when he arrives
|
||||
AdvSC : SC -> Adv ; -- that he arrives ---- REMOVE?
|
||||
</PRE>
|
||||
<P></P>
|
||||
<P>
|
||||
Comparison adverbs also work as numeral adverbs.
|
||||
</P>
|
||||
<PRE>
|
||||
AdnCAdv : CAdv -> AdN ; -- more (than five)
|
||||
|
||||
}
|
||||
</PRE>
|
||||
<P></P>
|
||||
|
||||
<!-- html code generated by txt2tags 2.3 (http://txt2tags.sf.net) -->
|
||||
<!-- cmdline: txt2tags -thtml -\-toc abstract/Adverb.txt -->
|
||||
</BODY></HTML>
|
||||
@@ -1,264 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
|
||||
<TITLE> A Basic Lexicon</TITLE>
|
||||
</HEAD><BODY BGCOLOR="white" TEXT="black">
|
||||
<P ALIGN="center"><CENTER><H1> A Basic Lexicon</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Author: </I><BR>
|
||||
Last update: Wed Jan 25 10:50:12 2006
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
<HR NOSHADE SIZE=1>
|
||||
<P></P>
|
||||
<UL>
|
||||
<LI><A HREF="#toc1">A Basic Lexicon</A>
|
||||
</UL>
|
||||
|
||||
<P></P>
|
||||
<HR NOSHADE SIZE=1>
|
||||
<P></P>
|
||||
<P>
|
||||
Produced by
|
||||
gfdoc - a rudimentary GF document generator.
|
||||
(c) Aarne Ranta (<A HREF="mailto:aarne@cs.chalmers.se">aarne@cs.chalmers.se</A>) 2002 under GNU GPL.
|
||||
</P>
|
||||
<A NAME="toc1"></A>
|
||||
<H1>A Basic Lexicon</H1>
|
||||
<P>
|
||||
This files gives a list of words whose purpose is to test the GF
|
||||
resource grammar. It covers all lexical categories of <A HREF="Cat.html">Cat</A>.
|
||||
By containing some of the most common words,
|
||||
it is aimed to cover, with high probability, all morphological
|
||||
patterns in the different languages.
|
||||
Using this lexicon for translation is not recommended. The linearizations
|
||||
of the words in different languages are not guaranteed to be translation
|
||||
equivalents.
|
||||
</P>
|
||||
<PRE>
|
||||
abstract Basic = Cat ** {
|
||||
fun
|
||||
add_V3 : V3 ;
|
||||
airplane_N : N ;
|
||||
already_Adv : Adv ;
|
||||
answer_V2S : V2 ;
|
||||
apartment_N : N ;
|
||||
apple_N : N ;
|
||||
art_N : N ;
|
||||
ask_V2Q : V2 ;
|
||||
baby_N : N ;
|
||||
bad_A : A ;
|
||||
bank_N : N ;
|
||||
beautiful_A : A ;
|
||||
become_VA : VA ;
|
||||
beer_N : N ;
|
||||
beg_V2V : V2 ;
|
||||
big_A : A ;
|
||||
bike_N : N ;
|
||||
bird_N : N ;
|
||||
black_A : A ;
|
||||
blue_A : A ;
|
||||
boat_N : N ;
|
||||
book_N : N ;
|
||||
boot_N : N ;
|
||||
boss_N : N ;
|
||||
boy_N : N ;
|
||||
bread_N : N ;
|
||||
break_V2 : V2 ;
|
||||
broad_A : A ;
|
||||
brother_N2 : N2 ;
|
||||
brown_A : A ;
|
||||
butter_N : N ;
|
||||
buy_V2 : V2 ;
|
||||
camera_N : N ;
|
||||
cap_N : N ;
|
||||
car_N : N ;
|
||||
carpet_N : N ;
|
||||
cat_N : N ;
|
||||
ceiling_N : N ;
|
||||
chair_N : N ;
|
||||
cheese_N : N ;
|
||||
child_N : N ;
|
||||
church_N : N ;
|
||||
city_N : N ;
|
||||
clean_A : A ;
|
||||
clever_A : A ;
|
||||
close_V2 : V2 ;
|
||||
coat_N : N ;
|
||||
cold_A : A ;
|
||||
come_V : V ;
|
||||
computer_N : N ;
|
||||
country_N : N ;
|
||||
cousin_N : N ;
|
||||
cow_N : N ;
|
||||
die_V : V ;
|
||||
dirty_A : A ;
|
||||
distance_N3 : N3 ;
|
||||
do_V2 : V2 ;
|
||||
doctor_N : N ;
|
||||
dog_N : N ;
|
||||
door_N : N ;
|
||||
drink_V2 : V2 ;
|
||||
easy_A2V : A2 ;
|
||||
eat_V2 : V2 ;
|
||||
enemy_N : N ;
|
||||
empty_A : A ;
|
||||
factory_N : N ;
|
||||
father_N2 : N2 ;
|
||||
fear_VS : VS ;
|
||||
find_V2 : V2 ;
|
||||
fish_N : N ;
|
||||
floor_N : N ;
|
||||
forget_V2 : V2 ;
|
||||
fridge_N : N ;
|
||||
friend_N : N ;
|
||||
fruit_N : N ;
|
||||
fun_AV : A ;
|
||||
garden_N : N ;
|
||||
girl_N : N ;
|
||||
glove_N : N ;
|
||||
gold_N : N ;
|
||||
good_A : A ;
|
||||
go_V : V ;
|
||||
green_A : A ;
|
||||
harbour_N : N ;
|
||||
hate_V2 : V2 ;
|
||||
hat_N : N ;
|
||||
have_V2 : V2 ;
|
||||
hear_V2 : V2 ;
|
||||
hill_N : N ;
|
||||
hope_VS : VS ;
|
||||
horse_N : N ;
|
||||
hot_A : A ;
|
||||
house_N : N ;
|
||||
important_A : A ;
|
||||
industry_N : N ;
|
||||
iron_N : N ;
|
||||
jump_V : V ;
|
||||
king_N : N ;
|
||||
know_V2 : V2 ;
|
||||
lake_N : N ;
|
||||
lamp_N : N ;
|
||||
learn_V2 : V2 ;
|
||||
leather_N : N ;
|
||||
leave_V2 : V2 ;
|
||||
like_V2 : V2 ;
|
||||
listen_V2 : V2 ;
|
||||
live_V : V ;
|
||||
long_A : A ;
|
||||
lose_V2 : V2 ;
|
||||
love_N : N ;
|
||||
love_V2 : V2 ;
|
||||
man_N : N ;
|
||||
married_A2 : A2 ;
|
||||
meat_N : N ;
|
||||
milk_N : N ;
|
||||
moon_N : N ;
|
||||
mother_N2 : N2 ;
|
||||
mountain_N : N ;
|
||||
music_N : N ;
|
||||
narrow_A : A ;
|
||||
new_A : A ;
|
||||
newspaper_N : N ;
|
||||
now_Adv : Adv ;
|
||||
number_N : N ;
|
||||
oil_N : N ;
|
||||
old_A : A ;
|
||||
open_V2 : V2 ;
|
||||
paint_V2A : V2A ;
|
||||
paper_N : N ;
|
||||
paris_PN : PN ;
|
||||
peace_N : N ;
|
||||
pen_N : N ;
|
||||
planet_N : N ;
|
||||
plastic_N : N ;
|
||||
play_V2 : V2 ;
|
||||
policeman_N : N ;
|
||||
priest_N : N ;
|
||||
probable_AS : A ;
|
||||
put_V2 : V2 ;
|
||||
queen_N : N ;
|
||||
radio_N : N ;
|
||||
rain_V0 : V ;
|
||||
read_V2 : V2 ;
|
||||
red_A : A ;
|
||||
religion_N : N ;
|
||||
restaurant_N : N ;
|
||||
river_N : N ;
|
||||
rock_N : N ;
|
||||
roof_N : N ;
|
||||
rubber_N : N ;
|
||||
run_V : V ;
|
||||
say_VS : VS ;
|
||||
school_N : N ;
|
||||
science_N : N ;
|
||||
sea_N : N ;
|
||||
seek_V2 : V2 ;
|
||||
see_V2 : V2 ;
|
||||
sell_V3 : V3 ;
|
||||
send_V3 : V3 ;
|
||||
sheep_N : N ;
|
||||
ship_N : N ;
|
||||
shirt_N : N ;
|
||||
shoe_N : N ;
|
||||
shop_N : N ;
|
||||
short_A : A ;
|
||||
silver_N : N ;
|
||||
sister_N : N ;
|
||||
sleep_V : V ;
|
||||
small_A : A ;
|
||||
snake_N : N ;
|
||||
sock_N : N ;
|
||||
song_N : N ;
|
||||
speak_V2 : V2 ;
|
||||
star_N : N ;
|
||||
steel_N : N ;
|
||||
stone_N : N ;
|
||||
stop_V : V ;
|
||||
stove_N : N ;
|
||||
student_N : N ;
|
||||
stupid_A : A ;
|
||||
sun_N : N ;
|
||||
switch8off_V2 : V2 ;
|
||||
switch8on_V2 : V2 ;
|
||||
table_N : N ;
|
||||
talk_V3 : V3 ;
|
||||
teacher_N : N ;
|
||||
teach_V2 : V2 ;
|
||||
television_N : N ;
|
||||
thick_A : A ;
|
||||
thin_A : A ;
|
||||
train_N : N ;
|
||||
travel_V : V ;
|
||||
tree_N : N ;
|
||||
---- trousers_N : N ;
|
||||
ugly_A : A ;
|
||||
understand_V2 : V2 ;
|
||||
university_N : N ;
|
||||
village_N : N ;
|
||||
wait_V2 : V2 ;
|
||||
walk_V : V ;
|
||||
warm_A : A ;
|
||||
war_N : N ;
|
||||
watch_V2 : V2 ;
|
||||
water_N : N ;
|
||||
white_A : A ;
|
||||
window_N : N ;
|
||||
wine_N : N ;
|
||||
win_V2 : V2 ;
|
||||
woman_N : N ;
|
||||
wonder_VQ : VQ ;
|
||||
wood_N : N ;
|
||||
write_V2 : V2 ;
|
||||
yellow_A : A ;
|
||||
young_A : A ;
|
||||
|
||||
}
|
||||
</PRE>
|
||||
<P></P>
|
||||
|
||||
<!-- html code generated by txt2tags 2.0 (http://txt2tags.sf.net) -->
|
||||
<!-- cmdline: txt2tags -thtml -\-toc abstract/Basic.txt -->
|
||||
</BODY></HTML>
|
||||
@@ -1,195 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
|
||||
<TITLE> Cat: the Category System</TITLE>
|
||||
</HEAD><BODY BGCOLOR="white" TEXT="black">
|
||||
<P ALIGN="center"><CENTER><H1> Cat: the Category System</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Last update: 2006-06-22 19:10:58 CEST</I><BR>
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
<HR NOSHADE SIZE=1>
|
||||
<P></P>
|
||||
<UL>
|
||||
<LI><A HREF="#toc1">Sentences and clauses</A>
|
||||
<LI><A HREF="#toc2">Questions and interrogatives</A>
|
||||
<LI><A HREF="#toc3">Relative clauses and pronouns</A>
|
||||
<LI><A HREF="#toc4">Verb phrases</A>
|
||||
<LI><A HREF="#toc5">Adjectival phrases</A>
|
||||
<LI><A HREF="#toc6">Nouns and noun phrases</A>
|
||||
<LI><A HREF="#toc7">Numerals</A>
|
||||
<LI><A HREF="#toc8">Structural words</A>
|
||||
<LI><A HREF="#toc9">Words of open classes</A>
|
||||
</UL>
|
||||
|
||||
<P></P>
|
||||
<HR NOSHADE SIZE=1>
|
||||
<P></P>
|
||||
<P>
|
||||
Produced by
|
||||
gfdoc - a rudimentary GF document generator.
|
||||
(c) Aarne Ranta (<A HREF="mailto:aarne@cs.chalmers.se">aarne@cs.chalmers.se</A>) 2002 under GNU GPL.
|
||||
</P>
|
||||
<P>
|
||||
The category system is central to the library in the sense
|
||||
that the other modules (<CODE>Adjective</CODE>, <CODE>Adverb</CODE>, <CODE>Noun</CODE>, <CODE>Verb</CODE> etc)
|
||||
communicate through it. This means that a e.g. a function using
|
||||
<CODE>NP</CODE>s in <CODE>Verb</CODE> need not know how <CODE>NP</CODE>s are constructed in <CODE>Noun</CODE>:
|
||||
it is enough that both <CODE>Verb</CODE> and <CODE>Noun</CODE> use the same type <CODE>NP</CODE>,
|
||||
which is given here in <CODE>Cat</CODE>.
|
||||
</P>
|
||||
<P>
|
||||
Some categories are inherited from <A HREF="Common.html"><CODE>Common</CODE></A>.
|
||||
The reason they are defined there is that they have the same
|
||||
implementation in all languages in the resource (typically,
|
||||
just a string). These categories are
|
||||
<CODE>AdA, AdN, AdV, Adv, Ant, CAdv, IAdv, PConj, Phr</CODE>,
|
||||
<CODE>Pol, SC, Tense, Text, Utt, Voc</CODE>.
|
||||
</P>
|
||||
<P>
|
||||
Moreover, the list categories <CODE>ListAdv, ListAP, ListNP, ListS</CODE>
|
||||
are defined on <CODE>Conjunction</CODE> and only used locally there.
|
||||
</P>
|
||||
<PRE>
|
||||
abstract Cat = Common ** {
|
||||
|
||||
cat
|
||||
</PRE>
|
||||
<P></P>
|
||||
<A NAME="toc1"></A>
|
||||
<H2>Sentences and clauses</H2>
|
||||
<P>
|
||||
Constructed in <A HREF="Sentence.html">Sentence</A>, and also in
|
||||
<A HREF="Idiom.html">Idiom</A>.
|
||||
</P>
|
||||
<PRE>
|
||||
S ; -- declarative sentence e.g. "she lived here"
|
||||
QS ; -- question e.g. "where did she live"
|
||||
RS ; -- relative e.g. "in which she lived"
|
||||
Cl ; -- declarative clause, with all tenses e.g. "she looks at this"
|
||||
Slash ; -- clause missing NP (S/NP in GPSG) e.g. "she looks at"
|
||||
Imp ; -- imperative e.g. "look at this"
|
||||
</PRE>
|
||||
<P></P>
|
||||
<A NAME="toc2"></A>
|
||||
<H2>Questions and interrogatives</H2>
|
||||
<P>
|
||||
Constructed in <A HREF="Question.html">Question</A>.
|
||||
</P>
|
||||
<PRE>
|
||||
QCl ; -- question clause, with all tenses e.g. "why does she walk"
|
||||
IP ; -- interrogative pronoun e.g. "who"
|
||||
IComp ; -- interrogative complement of copula e.g. "where"
|
||||
IDet ; -- interrogative determiner e.g. "which"
|
||||
</PRE>
|
||||
<P></P>
|
||||
<A NAME="toc3"></A>
|
||||
<H2>Relative clauses and pronouns</H2>
|
||||
<P>
|
||||
Constructed in <A HREF="Relative.html">Relative</A>.
|
||||
</P>
|
||||
<PRE>
|
||||
RCl ; -- relative clause, with all tenses e.g. "in which she lives"
|
||||
RP ; -- relative pronoun e.g. "in which"
|
||||
</PRE>
|
||||
<P></P>
|
||||
<A NAME="toc4"></A>
|
||||
<H2>Verb phrases</H2>
|
||||
<P>
|
||||
Constructed in <A HREF="Verb.html">Verb</A>.
|
||||
</P>
|
||||
<PRE>
|
||||
VP ; -- verb phrase e.g. "is very warm"
|
||||
Comp ; -- complement of copula, such as AP e.g. "very warm"
|
||||
</PRE>
|
||||
<P></P>
|
||||
<A NAME="toc5"></A>
|
||||
<H2>Adjectival phrases</H2>
|
||||
<P>
|
||||
Constructed in <A HREF="Adjective.html">Adjective</A>.
|
||||
</P>
|
||||
<PRE>
|
||||
AP ; -- adjectival phrase e.g. "very warm"
|
||||
</PRE>
|
||||
<P></P>
|
||||
<A NAME="toc6"></A>
|
||||
<H2>Nouns and noun phrases</H2>
|
||||
<P>
|
||||
Constructed in <A HREF="Noun.html">Noun</A>.
|
||||
Many atomic noun phrases e.g. <I>everybody</I>
|
||||
are constructed in <A HREF="Structural.html">Structural</A>.
|
||||
The determiner structure is
|
||||
</P>
|
||||
<PRE>
|
||||
Predet (QuantSg | QuantPl Num) Ord
|
||||
</PRE>
|
||||
<P>
|
||||
as defined in <A HREF="Noun.html">Noun</A>.
|
||||
</P>
|
||||
<PRE>
|
||||
CN ; -- common noun (without determiner) e.g. "red house"
|
||||
NP ; -- noun phrase (subject or object) e.g. "the red house"
|
||||
Pron ; -- personal pronoun e.g. "she"
|
||||
Det ; -- determiner phrase e.g. "those seven"
|
||||
Predet; -- predeterminer (prefixed Quant) e.g. "all"
|
||||
QuantSg;-- quantifier ('nucleus' of sing. Det) e.g. "every"
|
||||
QuantPl;-- quantifier ('nucleus' of plur. Det) e.g. "many"
|
||||
Quant ; -- quantifier with both sg and pl e.g. "this/these"
|
||||
Num ; -- cardinal number (used with QuantPl) e.g. "seven"
|
||||
Ord ; -- ordinal number (used in Det) e.g. "seventh"
|
||||
</PRE>
|
||||
<P></P>
|
||||
<A NAME="toc7"></A>
|
||||
<H2>Numerals</H2>
|
||||
<P>
|
||||
Constructed in <A HREF="Numeral.html">Numeral</A>.
|
||||
</P>
|
||||
<PRE>
|
||||
Numeral;-- cardinal or ordinal, e.g. "five/fifth"
|
||||
</PRE>
|
||||
<P></P>
|
||||
<A NAME="toc8"></A>
|
||||
<H2>Structural words</H2>
|
||||
<P>
|
||||
Constructed in <A HREF="Structural.html">Structural</A>.
|
||||
</P>
|
||||
<PRE>
|
||||
Conj ; -- conjunction, e.g. "and"
|
||||
DConj ; -- distributed conj. e.g. "both - and"
|
||||
Subj ; -- subjunction, e.g. "if"
|
||||
Prep ; -- preposition, or just case e.g. "in"
|
||||
</PRE>
|
||||
<P></P>
|
||||
<A NAME="toc9"></A>
|
||||
<H2>Words of open classes</H2>
|
||||
<P>
|
||||
These are constructed in <A HREF="Lexicon.html">Lexicon</A> and in
|
||||
additional lexicon modules.
|
||||
</P>
|
||||
<PRE>
|
||||
V ; -- one-place verb e.g. "sleep"
|
||||
V2 ; -- two-place verb e.g. "love"
|
||||
V3 ; -- three-place verb e.g. "show"
|
||||
VV ; -- verb-phrase-complement verb e.g. "want"
|
||||
VS ; -- sentence-complement verb e.g. "claim"
|
||||
VQ ; -- question-complement verb e.g. "ask"
|
||||
VA ; -- adjective-complement verb e.g. "look"
|
||||
V2A ; -- verb with NP and AP complement e.g. "paint"
|
||||
|
||||
A ; -- one-place adjective e.g. "warm"
|
||||
A2 ; -- two-place adjective e.g. "divisible"
|
||||
|
||||
N ; -- common noun e.g. "house"
|
||||
N2 ; -- relational noun e.g. "son"
|
||||
N3 ; -- three-place relational noun e.g. "connection"
|
||||
PN ; -- proper name e.g. "Paris"
|
||||
|
||||
}
|
||||
</PRE>
|
||||
<P></P>
|
||||
|
||||
<!-- html code generated by txt2tags 2.3 (http://txt2tags.sf.net) -->
|
||||
<!-- cmdline: txt2tags -thtml -\-toc abstract/Cat.txt -->
|
||||
</BODY></HTML>
|
||||
@@ -1,107 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
|
||||
<TITLE> Common: Structures with Common Implementations.</TITLE>
|
||||
</HEAD><BODY BGCOLOR="white" TEXT="black">
|
||||
<P ALIGN="center"><CENTER><H1> Common: Structures with Common Implementations.</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Last update: 2006-06-22 19:13:55 CEST</I><BR>
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
<HR NOSHADE SIZE=1>
|
||||
<P></P>
|
||||
<UL>
|
||||
<LI><A HREF="#toc1">Top-level units</A>
|
||||
<LI><A HREF="#toc2">Adverbs</A>
|
||||
<LI><A HREF="#toc3">Tense, polarity, and anteriority</A>
|
||||
</UL>
|
||||
|
||||
<P></P>
|
||||
<HR NOSHADE SIZE=1>
|
||||
<P></P>
|
||||
<P>
|
||||
Produced by
|
||||
gfdoc - a rudimentary GF document generator.
|
||||
(c) Aarne Ranta (<A HREF="mailto:aarne@cs.chalmers.se">aarne@cs.chalmers.se</A>) 2002 under GNU GPL.
|
||||
</P>
|
||||
<P>
|
||||
This module defines the categories that uniformly have the linearization
|
||||
<CODE>{s : Str}</CODE> in all languages.
|
||||
Moreover, this module defines the abstract parameters of tense, polarity, and
|
||||
anteriority, which are used in <A HREF="Phrase.html"><CODE>Phrase</CODE></A> to generate different
|
||||
forms of sentences. Together they give 4 x 2 x 2 = 16 sentence forms.
|
||||
These tenses are defined for all languages in the library. More tenses
|
||||
can be defined in the language extensions, e.g. the <I>passé simple</I> of
|
||||
Romance languages in <A HREF="../romance/ExtraRomance.gf"><CODE>ExtraRomance</CODE></A>.
|
||||
</P>
|
||||
<PRE>
|
||||
abstract Common = {
|
||||
|
||||
cat
|
||||
</PRE>
|
||||
<P></P>
|
||||
<A NAME="toc1"></A>
|
||||
<H2>Top-level units</H2>
|
||||
<P>
|
||||
Constructed in <A HREF="Text.html"><CODE>Text</CODE></A>: <CODE>Text</CODE>.
|
||||
</P>
|
||||
<PRE>
|
||||
Text ; -- text consisting of several phrases e.g. "He is here. Why?"
|
||||
</PRE>
|
||||
<P></P>
|
||||
<P>
|
||||
Constructed in <A HREF="Phrase.html"><CODE>Phrase</CODE></A>:
|
||||
</P>
|
||||
<PRE>
|
||||
Phr ; -- phrase in a text e.g. "but be quiet please"
|
||||
Utt ; -- sentence, question, word... e.g. "be quiet"
|
||||
Voc ; -- vocative or "please" e.g. "my darling"
|
||||
PConj ; -- phrase-beginning conj. e.g. "therefore"
|
||||
</PRE>
|
||||
<P></P>
|
||||
<P>
|
||||
Constructed in <A HREF="Sentence.html"><CODE>Sentence</CODE></A>:
|
||||
</P>
|
||||
<PRE>
|
||||
SC ; -- embedded sentence or question e.g. "that it rains"
|
||||
</PRE>
|
||||
<P></P>
|
||||
<A NAME="toc2"></A>
|
||||
<H2>Adverbs</H2>
|
||||
<P>
|
||||
Constructed in <A HREF="Adverb.html"><CODE>Adverb</CODE></A>.
|
||||
Many adverbs are constructed in <A HREF="Structural.html"><CODE>Structural</CODE></A>.
|
||||
</P>
|
||||
<PRE>
|
||||
Adv ; -- verb-phrase-modifying adverb, e.g. "in the house"
|
||||
AdV ; -- adverb directly attached to verb e.g. "always"
|
||||
AdA ; -- adjective-modifying adverb, e.g. "very"
|
||||
AdN ; -- numeral-modifying adverb, e.g. "more than"
|
||||
IAdv ; -- interrogative adverb e.g. "why"
|
||||
CAdv ; -- comparative adverb e.g. "more"
|
||||
</PRE>
|
||||
<P></P>
|
||||
<A NAME="toc3"></A>
|
||||
<H2>Tense, polarity, and anteriority</H2>
|
||||
<PRE>
|
||||
Tense ; -- tense: present, past, future, conditional
|
||||
Pol ; -- polarity: positive, negative
|
||||
Ant ; -- anteriority: simultaneous, anterior
|
||||
|
||||
fun
|
||||
PPos, PNeg : Pol ; -- I sleep/don't sleep
|
||||
|
||||
TPres : Tense ;
|
||||
ASimul : Ant ;
|
||||
TPast, TFut, TCond : Tense ; -- I slept/will sleep/would sleep --# notpresent
|
||||
AAnter : Ant ; -- I have slept --# notpresent
|
||||
|
||||
}
|
||||
</PRE>
|
||||
<P></P>
|
||||
|
||||
<!-- html code generated by txt2tags 2.3 (http://txt2tags.sf.net) -->
|
||||
<!-- cmdline: txt2tags -thtml -\-toc abstract/Common.txt -->
|
||||
</BODY></HTML>
|
||||
@@ -1,91 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
|
||||
<TITLE> Conjunction: Coordination</TITLE>
|
||||
</HEAD><BODY BGCOLOR="white" TEXT="black">
|
||||
<P ALIGN="center"><CENTER><H1> Conjunction: Coordination</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Last update: 2006-06-22 19:17:31 CEST</I><BR>
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
<HR NOSHADE SIZE=1>
|
||||
<P></P>
|
||||
<UL>
|
||||
<LI><A HREF="#toc1">Rules</A>
|
||||
<LI><A HREF="#toc2">Categories</A>
|
||||
<LI><A HREF="#toc3">List constructors</A>
|
||||
</UL>
|
||||
|
||||
<P></P>
|
||||
<HR NOSHADE SIZE=1>
|
||||
<P></P>
|
||||
<P>
|
||||
Produced by
|
||||
gfdoc - a rudimentary GF document generator.
|
||||
(c) Aarne Ranta (<A HREF="mailto:aarne@cs.chalmers.se">aarne@cs.chalmers.se</A>) 2002 under GNU GPL.
|
||||
</P>
|
||||
<P>
|
||||
Coordination is defined for many different categories; here is
|
||||
a sample. The rules apply to <B>lists</B> of two or more elements,
|
||||
and define two general patterns:
|
||||
</P>
|
||||
<UL>
|
||||
<LI>ordinary conjunction: X,...X and X
|
||||
<LI>distributed conjunction: both X,...,X and X
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
<CODE>VP</CODE> conjunctions are not covered here, because their applicability
|
||||
depends on language. Some special cases are defined in
|
||||
<A HREF="../abstract/Extra.gf"><CODE>Extra</CODE></A>.
|
||||
</P>
|
||||
<PRE>
|
||||
abstract Conjunction = Cat ** {
|
||||
</PRE>
|
||||
<P></P>
|
||||
<A NAME="toc1"></A>
|
||||
<H2>Rules</H2>
|
||||
<PRE>
|
||||
fun
|
||||
ConjS : Conj -> [S] -> S ; -- "John walks and Mary runs"
|
||||
ConjAP : Conj -> [AP] -> AP ; -- "even and prime"
|
||||
ConjNP : Conj -> [NP] -> NP ; -- "John or Mary"
|
||||
ConjAdv : Conj -> [Adv] -> Adv ; -- "quickly or slowly"
|
||||
|
||||
DConjS : DConj -> [S] -> S ; -- "either John walks or Mary runs"
|
||||
DConjAP : DConj -> [AP] -> AP ; -- "both even and prime"
|
||||
DConjNP : DConj -> [NP] -> NP ; -- "either John or Mary"
|
||||
DConjAdv : DConj -> [Adv] -> Adv; -- "both badly and slowly"
|
||||
</PRE>
|
||||
<P></P>
|
||||
<A NAME="toc2"></A>
|
||||
<H2>Categories</H2>
|
||||
<P>
|
||||
These categories are only used in this module.
|
||||
</P>
|
||||
<PRE>
|
||||
cat
|
||||
[S]{2} ;
|
||||
[Adv]{2} ;
|
||||
[NP]{2} ;
|
||||
[AP]{2} ;
|
||||
</PRE>
|
||||
<P></P>
|
||||
<A NAME="toc3"></A>
|
||||
<H2>List constructors</H2>
|
||||
<P>
|
||||
The list constructors are derived from the list notation and therefore
|
||||
not given explicitly. But here are their type signatures:
|
||||
</P>
|
||||
<PRE>
|
||||
-- BaseC : C -> C -> [C] ; -- for C = S, AP, NP, Adv
|
||||
-- ConsC : C -> [C] -> [C] ;
|
||||
}
|
||||
</PRE>
|
||||
<P></P>
|
||||
|
||||
<!-- html code generated by txt2tags 2.3 (http://txt2tags.sf.net) -->
|
||||
<!-- cmdline: txt2tags -thtml -\-toc abstract/Conjunction.txt -->
|
||||
</BODY></HTML>
|
||||
@@ -1,150 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
|
||||
</HEAD><BODY BGCOLOR="white" TEXT="black">
|
||||
<FONT SIZE="4">
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
<HR NOSHADE SIZE=1>
|
||||
<P></P>
|
||||
<P></P>
|
||||
<HR NOSHADE SIZE=1>
|
||||
<P></P>
|
||||
<P>
|
||||
Last update: 2006-03-06 21:21:27 CET
|
||||
</P>
|
||||
<P>
|
||||
Produced by
|
||||
gfdoc - a rudimentary GF document generator.
|
||||
(c) Aarne Ranta (<A HREF="mailto:aarne@cs.chalmers.se">aarne@cs.chalmers.se</A>) 2002 under GNU GPL.
|
||||
</P>
|
||||
<PRE>
|
||||
abstract Demonstrative = Cat, PredefAbs ** {
|
||||
</PRE>
|
||||
<P></P>
|
||||
<P>
|
||||
Naming convention: <CODE>M</CODE> prepended to 'unimodal' names.
|
||||
Exceptions: lexical units, those without unimodal counterparts.
|
||||
</P>
|
||||
<PRE>
|
||||
cat
|
||||
|
||||
MS ; -- multimodal sentence or question
|
||||
MQS ; -- multimodal wh question
|
||||
MImp ; -- multimodal imperative
|
||||
MVP ; -- multimodal verb phrase
|
||||
MComp ; -- multimodal complement to copula (MAP, MNP, MAdv)
|
||||
MAP ; -- multimodal adjectival phrase
|
||||
MNP ; -- multimodal (demonstrative) noun phrase
|
||||
MAdv ; -- multimodal (demonstrative) adverbial
|
||||
|
||||
Point ; -- pointing gesture
|
||||
|
||||
fun
|
||||
</PRE>
|
||||
<P></P>
|
||||
<P>
|
||||
A pointing gesture is constructed from a string.
|
||||
</P>
|
||||
<PRE>
|
||||
MkPoint : String -> Point ;
|
||||
</PRE>
|
||||
<P></P>
|
||||
<P>
|
||||
Construction of sentences, questions, and imperatives.
|
||||
</P>
|
||||
<PRE>
|
||||
MPredVP : MNP -> MVP -> MS ; -- he flies here
|
||||
MQPredVP : MNP -> MVP -> MQS ; -- does he fly here
|
||||
|
||||
MQuestVP : IP -> MVP -> MQS ; -- who flies here
|
||||
|
||||
MImpVP : MVP -> MImp ; -- fly here!
|
||||
</PRE>
|
||||
<P></P>
|
||||
<P>
|
||||
Construction of verb phrases from verb + complements.
|
||||
</P>
|
||||
<PRE>
|
||||
MUseV : V -> MVP ; -- flies (here)
|
||||
MComplV2 : V2 -> MNP -> MVP ; -- takes this (here)
|
||||
MComplVV : VV -> MVP -> MVP ; -- wants to fly (here)
|
||||
|
||||
MUseComp : MComp -> MVP ; -- is here ; is bigger than this
|
||||
|
||||
MCompAP : MAP -> MComp ; -- bigger than this
|
||||
MCompNP : MNP -> MComp ; -- the price of this
|
||||
MCompAdv : MAdv -> MComp ; -- here
|
||||
|
||||
MPositA : A -> MAP ; -- big
|
||||
MComparA : A -> MNP -> MAP ; -- bigger than this
|
||||
</PRE>
|
||||
<P></P>
|
||||
<P>
|
||||
Adverbial modification of a verb phrase.
|
||||
</P>
|
||||
<PRE>
|
||||
MAdvVP : MVP -> MAdv -> MVP ; -- fly here
|
||||
</PRE>
|
||||
<P></P>
|
||||
<P>
|
||||
Demonstrative pronouns as NPs and determiners.
|
||||
</P>
|
||||
<PRE>
|
||||
this_MNP : Point -> MNP ; -- this
|
||||
that_MNP : Point -> MNP ; -- that
|
||||
thisDet_MNP : CN -> Point -> MNP ; -- this car
|
||||
thatDet_MNP : CN -> Point -> MNP ; -- that car
|
||||
</PRE>
|
||||
<P></P>
|
||||
<P>
|
||||
Demonstrative adverbs.
|
||||
</P>
|
||||
<PRE>
|
||||
here_MAdv : Point -> MAdv ; -- here
|
||||
here7from_MAdv : Point -> MAdv ; -- from here
|
||||
here7to_MAdv : Point -> MAdv ; -- to here
|
||||
</PRE>
|
||||
<P></P>
|
||||
<P>
|
||||
Building an adverb as prepositional phrase.
|
||||
</P>
|
||||
<PRE>
|
||||
MPrepNP : Prep -> MNP -> MAdv ; -- in this car
|
||||
</PRE>
|
||||
<P></P>
|
||||
<P>
|
||||
Using ordinary categories.
|
||||
Mounting nondemonstrative expressions.
|
||||
</P>
|
||||
<PRE>
|
||||
DemNP : NP -> MNP ;
|
||||
DemAdv : Adv -> MAdv ;
|
||||
</PRE>
|
||||
<P></P>
|
||||
<P>
|
||||
Top-level phrases.
|
||||
</P>
|
||||
<PRE>
|
||||
PhrMS : Pol -> MS -> Phr ;
|
||||
PhrMS : Pol -> MS -> Phr ;
|
||||
PhrMQS : Pol -> MQS -> Phr ;
|
||||
PhrMImp : Pol -> MImp -> Phr ;
|
||||
</PRE>
|
||||
<P></P>
|
||||
<P>
|
||||
For testing and example-based grammar writing.
|
||||
</P>
|
||||
<PRE>
|
||||
point1, point2 : Point ;
|
||||
|
||||
x_MAdv, y_MAdv : MAdv ;
|
||||
}
|
||||
</PRE>
|
||||
<P></P>
|
||||
|
||||
<!-- html code generated by txt2tags 2.3 (http://txt2tags.sf.net) -->
|
||||
<!-- cmdline: txt2tags -thtml -\-toc multimodal/Demonstrative.txt -->
|
||||
</BODY></HTML>
|
||||
@@ -1,49 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
|
||||
<TITLE> Grammar: the Main Module of the Resource Grammar</TITLE>
|
||||
</HEAD><BODY BGCOLOR="white" TEXT="black">
|
||||
<P ALIGN="center"><CENTER><H1> Grammar: the Main Module of the Resource Grammar</H1>
|
||||
<FONT SIZE="4">
|
||||
<I>Last update: 2006-06-22 19:08:55 CEST</I><BR>
|
||||
</FONT></CENTER>
|
||||
|
||||
<P></P>
|
||||
<HR NOSHADE SIZE=1>
|
||||
<P></P>
|
||||
<P></P>
|
||||
<HR NOSHADE SIZE=1>
|
||||
<P></P>
|
||||
<P>
|
||||
Produced by
|
||||
gfdoc - a rudimentary GF document generator.
|
||||
(c) Aarne Ranta (<A HREF="mailto:aarne@cs.chalmers.se">aarne@cs.chalmers.se</A>) 2002 under GNU GPL.
|
||||
</P>
|
||||
<P>
|
||||
This grammar is a collection of the different grammar modules,
|
||||
To test the resource, import <A HREF="Lang.html"><CODE>Lang</CODE></A>, which also contains
|
||||
a lexicon.
|
||||
</P>
|
||||
<PRE>
|
||||
abstract Grammar =
|
||||
Noun,
|
||||
Verb,
|
||||
Adjective,
|
||||
Adverb,
|
||||
Numeral,
|
||||
Sentence,
|
||||
Question,
|
||||
Relative,
|
||||
Conjunction,
|
||||
Phrase,
|
||||
Text,
|
||||
Structural,
|
||||
Idiom
|
||||
** {} ;
|
||||
</PRE>
|
||||
<P></P>
|
||||
|
||||
<!-- html code generated by txt2tags 2.3 (http://txt2tags.sf.net) -->
|
||||
<!-- cmdline: txt2tags -thtml -\-toc abstract/Grammar.txt -->
|
||||
</BODY></HTML>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user