starting German: nouns

This commit is contained in:
aarne
2006-01-04 13:01:05 +00:00
parent 958c754112
commit 5f1cd79b9b
29 changed files with 2437 additions and 168 deletions

View File

@@ -51,7 +51,7 @@
<P>
Resource grammar HOWTO
Author: Aarne Ranta &lt;aarne (at) cs.chalmers.se&gt;
Last update: Thu Dec 8 14:52:30 2005
Last update: Wed Jan 4 11:29:41 2006
</P>
<A NAME="toc1"></A>
<H1>HOW TO WRITE A RESOURCE GRAMMAR</H1>
@@ -59,7 +59,7 @@ Last update: Thu Dec 8 14:52:30 2005
<A HREF="http://www.cs.chalmers.se/~aarne/">Aarne Ranta</A>
</P>
<P>
20051208
20060104
</P>
<P>
The purpose of this document is to tell how to implement the GF
@@ -89,7 +89,7 @@ leaves out certain complicated but not always necessary things:
tenses and most part of the lexicon.
</P>
<P>
<IMG ALIGN="left" SRC="Test.png" BORDER="0" ALT="">
<IMG ALIGN="middle" SRC="Test.png" BORDER="0" ALT="">
</P>
<P>
The module structure is rather flat: almost every module is a direct
@@ -213,48 +213,64 @@ different languages.
Unless you are writing an instance of a parametrized implementation
(Romance or Scandinavian), which will be covered later, the most
simple way is to follow roughly the following procedure. Assume you
are building a grammar for the Dutch language. Here are the first steps.
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>dutch</CODE>.
```
cd GF/lib/resource/
mkdir dutch
cd dutch
```
<CODE>german</CODE>.
<PRE>
cd GF/lib/resource/
mkdir german
cd german
</PRE>
<P></P>
<LI>Check out the <A HREF="http://www.w3.org/WAI/ER/IG/ert/iso639.htm">ISO 639 3-letter language code</A>
for Dutch: it is <CODE>Dut</CODE>.
<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>dutch</CODE>,
<LI>Copy the <CODE>*Eng.gf</CODE> files from <CODE>english</CODE> <CODE>german</CODE>,
and rename them:
```
cp ../english/*Eng.gf .
rename 's/Eng/Dut/' *Eng.gf
```
<PRE>
cp ../english/*Eng.gf .
rename 's/Eng/Ger/' *Eng.gf
</PRE>
<P></P>
<LI>Change the <CODE>Eng</CODE> module references to <CODE>Dut</CODE> references
<LI>Change the <CODE>Eng</CODE> module references to <CODE>Ger</CODE> references
in all files:
``` sed -i 's/Eng/Dut/g' *Dut.gf
<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
``` grep Dut *.gf
<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:
``` sed -i 's/^/--/' *Dut.gf
<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 the file <CODE>TestDut.gf</CODE>, uncomment all lines except the list
<LI>In the file <CODE>TestGer.gf</CODE>, uncomment all lines except the list
of inherited modules. Now you can open the grammar in GF:
``` gf TestDut.gf
<PRE>
gf TestGer.gf
</PRE>
<P></P>
<LI>Now you will at all following steps have a valid, but incomplete
GF grammar. The GF command
``` pg -printer=missing
<PRE>
pg -printer=missing
</PRE>
tells you what exactly is missing.
</OL>
@@ -266,37 +282,38 @@ were introduced above is a natural order to proceed, even though not the
only one. So you will find yourself iterating the following steps:
</P>
<OL>
<LI>Select a phrase category module, e.g. <CODE>NounDut</CODE>, and uncomment one
linearization rule (for instance, <CODE>IndefSg</CODE>, which is
<LI>Select a phrase category module, e.g. <CODE>NounGer</CODE>, and uncomment one
linearization rule (for instance, <CODE>DefSg</CODE>, which is
not too complicated).
<P></P>
<LI>Write down some Dutch examples of this rule, in this case translations
of "a dog", "a house", "a big house", etc.
<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>CatDut</CODE>.
You may have to define some new parameter types in <CODE>ResDut</CODE>.
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>LexDut</CODE>. Again, it can be helpful to define some simple-minded
morphological paradigms in <CODE>ResDut</CODE>, in particular worst-case
in <CODE>LexGer</CODE>. Again, it can be helpful to define some simple-minded
morphological paradigms in <CODE>ResGer</CODE>, in particular worst-case
constructors corresponding to e.g.
<CODE>ResEng.mkNoun</CODE>.
<P></P>
<LI>Doing this, you may want to test the resource independently. Do this by
```
i -retain ResDut
cc mkNoun "ei" "eieren" Neutr
```
<PRE>
i -retain ResGer
cc mkNoun "Brief" "Briefe" Masc
</PRE>
<P></P>
<LI>Uncomment <CODE>NounDut</CODE> and <CODE>LexDut</CODE> in <CODE>TestDut</CODE>,
and compile <CODE>TestDut</CODE> in GF. Then test by parsing, linearization,
<LI>Uncomment <CODE>NounGer</CODE> and <CODE>LexGer</CODE> in <CODE>TestGer</CODE>,
and compile <CODE>TestGer</CODE> in GF. Then 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
```
<PRE>
gr -cat=NP -number=20 -tr | l -table
</PRE>
<P></P>
<LI>Spare some tree-linearization pairs for later regression testing.
You can do this way (!!to be completed)
@@ -319,8 +336,8 @@ very soon, keep you motivated, and reveal errors.
These modules will be written by you.
</P>
<UL>
<LI><CODE>ResDut</CODE>: parameter types and auxiliary operations
<LI><CODE>MorphoDut</CODE>: complete inflection engine; not needed for <CODE>Test</CODE>.
<LI><CODE>ResGer</CODE>: parameter types and auxiliary operations
<LI><CODE>MorphoGer</CODE>: complete inflection engine; not needed for <CODE>Test</CODE>.
</UL>
<P>
@@ -342,13 +359,13 @@ package.
<P>
When the implementation of <CODE>Test</CODE> is complete, it is time to
work out the lexicon files. The underlying machinery is provided in
<CODE>MorphoDut</CODE>, which is, in effect, your linguistic theory of
Dutch morphology. It can contain very sophisticated and complicated
<CODE>MorphoGer</CODE>, which is, in effect, your linguistic theory of
German morphology. It can contain very sophisticated and complicated
definitions, which are not necessarily suitable for actually building a
lexicon. For this purpose, you should write the module
</P>
<UL>
<LI><CODE>ParadigmsDut</CODE>: morphological paradigms for the lexicographer.
<LI><CODE>ParadigmsGer</CODE>: morphological paradigms for the lexicographer.
</UL>
<P>
@@ -364,15 +381,15 @@ the functions
<UL>
<LI><CODE>mkN</CODE>, for worst-case construction of <CODE>N</CODE>. Its type signature
has the form
```
mkN : Str -&gt; ... -&gt; Str -&gt; P -&gt; ... -&gt; Q -&gt; N
```
<PRE>
mkN : Str -&gt; ... -&gt; Str -&gt; P -&gt; ... -&gt; Q -&gt; 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:
```
regN : Str -&gt; N
```
<PRE>
regN : Str -&gt; N
</PRE>
<LI>A language-dependent (small) set of functions to handle mild irregularities
and common exceptions.
<P></P>
@@ -380,15 +397,15 @@ 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:
```
mkV2 : V -&gt; Case -&gt; Str -&gt; V2 ;
```
<PRE>
mkV2 : V -&gt; Case -&gt; Str -&gt; V2 ;
</PRE>
<LI>A language-dependent (small) set of functions to handle common special cases,
such as direct transitive verbs:
```
dirV2 : V -&gt; V2 ;
-- dirV2 v = mkV2 v accusative []
```
<PRE>
dirV2 : V -&gt; V2 ;
-- dirV2 v = mkV2 v accusative []
</PRE>
</UL>
<P>
@@ -403,33 +420,33 @@ The golden rule for the design of paradigms is that
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>ParadigmsDut</CODE> module has
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 : Case ;
nominative, accusative, genitive, dative : Case ;
</PRE>
<P>
These constants are defined in terms of parameter types and constructors
in <CODE>ResDut</CODE> and <CODE>MorphoDut</CODE>, which modules are are not
in <CODE>ResGer</CODE> and <CODE>MorphoGer</CODE>, which modules are are not
accessible to the application grammarian.
</P>
<A NAME="toc11"></A>
<H3>Lock fields</H3>
<P>
An important difference between <CODE>MorphoDut</CODE> and
<CODE>ParadigmsDut</CODE> is that the former uses "raw" record types
An important difference between <CODE>MorphoGer</CODE> and
<CODE>ParadigmsGer</CODE> is that the former uses "raw" record types
as lincats, whereas the latter used category symbols defined in
<CODE>CatDut</CODE>. When these category symbols are used to denote
record types in a resource modules, such as <CODE>ParadigmsDut</CODE>,
<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 may be the same
in <CODE>CatDut</CODE>:
in <CODE>CatGer</CODE>:
</P>
<PRE>
lincat Adv = {s : Str} ;
@@ -467,21 +484,21 @@ in her hidden definitions of constants in <CODE>Paradigms</CODE>. For instance,
<A NAME="toc12"></A>
<H3>Lexicon construction</H3>
<P>
The lexicon belonging to <CODE>LangDut</CODE> consists of two modules:
The lexicon belonging to <CODE>LangGer</CODE> consists of two modules:
</P>
<UL>
<LI><CODE>StructuralDut</CODE>, structural words, built by directly using
<CODE>MorphoDut</CODE>.
<LI><CODE>BasicDut</CODE>, content words, built by using <CODE>ParadigmsDut</CODE>.
<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>MorphoDut</CODE> has to be used in <CODE>StructuralDut</CODE>
is that <CODE>ParadigmsDut</CODE> does not contain constructors for closed
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>ParadigmsDut</CODE> for building <CODE>BasicDut</CODE> is that
recommend <CODE>ParadigmsGer</CODE> for building <CODE>BasicGer</CODE> is that
the coverage of the paradigms gets thereby tested and that the
use of the paradigms in <CODE>BasicDut</CODE> gives a good set of examples for
use of the paradigms in <CODE>BasicGer</CODE> gives a good set of examples for
those who want to build new lexica.
</P>
<A NAME="toc13"></A>
@@ -509,34 +526,31 @@ worst-case paradigms (<CODE>mkV</CODE> etc).
<P>
You can often find resources such as lists of
irregular verbs on the internet. For instance, the
<A HREF="http://www.dutchtrav.com/gram/irrverbs.html">Dutch for Travelers</A>
<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>
begrijpen begrijp begreep begrepen to understand
bijten bijt beet gebeten to bite
binden bind bond gebonden to tie
breken breek brak gebroken to break
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 : Str -&gt; Str -&gt; Str -&gt; Str -&gt; V ;
irregV : (x1,_,_,_,_,x6 : Str) -&gt; V ;
</PRE>
<P>
and a Perl or Python or Haskell script that transforms
the table to
</P>
<PRE>
begrijpen_V = irregV "begrijpen" "begrijp" "begreep" "begrepen" ;
bijten_V = irregV "bijten" "bijt" "beet" "gebeten" ;
binden_V = irregV "binden" "bind" "bond" "gebonden" ;
backen_V = irregV "backen" "bäckt" "back" "backte" "backte" "gebacken" ;
befehlen_V = irregV "befehlen" "befiehlt" "befiehl" "befahl" "beföhle" "befohlen" ;
</PRE>
<P>
(You may want to use the English translation for some purpose, as well.)
</P>
<P></P>
<P>
When using ready-made word lists, you should think about
coyright issues. Ideally, all resource grammar material should
@@ -563,7 +577,7 @@ extension modules. This chapter will deal with this issue.
<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 Dutch), that is, formally
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

View File

@@ -5,7 +5,7 @@ Last update: %%date(%c)
% NOTE: this is a txt2tags file.
% Create an html file from this file using:
% txt2tags Resource-HOWTO.txt
% txt2tags --toc -thtml Resource-HOWTO.txt
%!target:html
@@ -175,88 +175,112 @@ different languages.
Unless you are writing an instance of a parametrized implementation
(Romance or Scandinavian), which will be covered later, the most
simple way is to follow roughly the following procedure. Assume you
are building a grammar for the Dutch language. Here are the first steps.
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
``dutch``.
```
``german``.
```
cd GF/lib/resource/
mkdir dutch
cd dutch
```
mkdir german
cd german
```
+ Check out the [ISO 639 3-letter language code http://www.w3.org/WAI/ER/IG/ert/iso639.htm]
for Dutch: it is ``Dut``.
+ 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`` ``dutch``,
+ Copy the ``*Eng.gf`` files from ``english`` ``german``,
and rename them:
```
```
cp ../english/*Eng.gf .
rename 's/Eng/Dut/' *Eng.gf
```
rename 's/Eng/Ger/' *Eng.gf
```
+ Change the ``Eng`` module references to ``Dut`` references
+ Change the ``Eng`` module references to ``Ger`` references
in all files:
``` sed -i 's/Eng/Dut/g' *Dut.gf
```
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 Dut *.gf
```
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/^/--/' *Dut.gf
```
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 the file ``TestDut.gf``, uncomment all lines except the list
of inherited modules. Now you can open the grammar in GF:
``` gf TestDut.gf
+ 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 you uncommenting the first
and the last lines will actually do the job for many of the files.
+ Now you will at all following steps have a valid, but incomplete
+ Now you can open the grammar ``TestGer`` in GF:
```
gf TestGer.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
```
pg -printer=missing
```
tells you what exactly is missing.
===The develop-test cycle===
The real work starts now. The order in which the ``Phrase`` modules
were introduced above is a natural order to proceed, even though not the
only one. So you will find yourself iterating the following steps:
+ Select a phrase category module, e.g. ``NounDut``, and uncomment one
linearization rule (for instance, ``IndefSg``, which is
+ Select a phrase category module, e.g. ``NounGer``, and uncomment one
linearization rule (for instance, ``DefSg``, which is
not too complicated).
+ Write down some Dutch examples of this rule, in this case translations
of "a dog", "a house", "a big house", etc.
+ 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 ``CatDut``.
You may have to define some new parameter types in ``ResDut``.
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 ``LexDut``. Again, it can be helpful to define some simple-minded
morphological paradigms in ``ResDut``, in particular worst-case
in ``LexGer``. Again, it can be helpful to define some simple-minded
morphological paradigms in ``ResGer``, in particular worst-case
constructors corresponding to e.g.
``ResEng.mkNoun``.
+ Doing this, you may want to test the resource independently. Do this by
```
i -retain ResDut
cc mkNoun "ei" "eieren" Neutr
```
```
i -retain ResGer
cc mkNoun "Brief" "Briefe" Masc
```
+ Uncomment ``NounDut`` and ``LexDut`` in ``TestDut``,
and compile ``TestDut`` in GF. Then test by parsing, linearization,
+ Uncomment ``NounGer`` and ``LexGer`` in ``TestGer``,
and compile ``TestGer`` in GF. Then 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.
You can do this way (!!to be completed)
@@ -278,8 +302,8 @@ very soon, keep you motivated, and reveal errors.
These modules will be written by you.
- ``ResDut``: parameter types and auxiliary operations
- ``MorphoDut``: complete inflection engine; not needed for ``Test``.
- ``ResGer``: parameter types and auxiliary operations
- ``MorphoGer``: complete inflection engine; not needed for ``Test``.
These modules are language-independent and provided by the existing resource
@@ -300,12 +324,12 @@ package.
When the implementation of ``Test`` is complete, it is time to
work out the lexicon files. The underlying machinery is provided in
``MorphoDut``, which is, in effect, your linguistic theory of
Dutch morphology. It can contain very sophisticated and complicated
``MorphoGer``, which is, in effect, your linguistic theory of
German morphology. It can contain very sophisticated and complicated
definitions, which are not necessarily suitable for actually building a
lexicon. For this purpose, you should write the module
- ``ParadigmsDut``: morphological paradigms for the lexicographer.
- ``ParadigmsGer``: morphological paradigms for the lexicographer.
This module provides high-level ways to define the linearization of
@@ -320,15 +344,15 @@ 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.
@@ -336,15 +360,15 @@ 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
@@ -356,31 +380,31 @@ The golden rule for the design of paradigms is that
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 ``ParadigmsDut`` module has
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 : Case ;
nominative, accusative, genitive, dative : Case ;
```
These constants are defined in terms of parameter types and constructors
in ``ResDut`` and ``MorphoDut``, which modules are are not
in ``ResGer`` and ``MorphoGer``, which modules are are not
accessible to the application grammarian.
===Lock fields===
An important difference between ``MorphoDut`` and
``ParadigmsDut`` is that the former uses "raw" record types
An important difference between ``MorphoGer`` and
``ParadigmsGer`` is that the former uses "raw" record types
as lincats, whereas the latter used category symbols defined in
``CatDut``. When these category symbols are used to denote
record types in a resource modules, such as ``ParadigmsDut``,
``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 may be the same
in ``CatDut``:
in ``CatGer``:
```
lincat Adv = {s : Str} ;
lincat Conj = {s : Str} ;
@@ -415,19 +439,19 @@ in her hidden definitions of constants in ``Paradigms``. For instance,
===Lexicon construction===
The lexicon belonging to ``LangDut`` consists of two modules:
The lexicon belonging to ``LangGer`` consists of two modules:
- ``StructuralDut``, structural words, built by directly using
``MorphoDut``.
- ``BasicDut``, content words, built by using ``ParadigmsDut``.
- ``StructuralGer``, structural words, built by directly using
``MorphoGer``.
- ``BasicGer``, content words, built by using ``ParadigmsGer``.
The reason why ``MorphoDut`` has to be used in ``StructuralDut``
is that ``ParadigmsDut`` does not contain constructors for closed
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 ``ParadigmsDut`` for building ``BasicDut`` is that
recommend ``ParadigmsGer`` for building ``BasicGer`` is that
the coverage of the paradigms gets thereby tested and that the
use of the paradigms in ``BasicDut`` gives a good set of examples for
use of the paradigms in ``BasicGer`` gives a good set of examples for
those who want to build new lexica.
@@ -459,29 +483,25 @@ worst-case paradigms (``mkV`` etc).
You can often find resources such as lists of
irregular verbs on the internet. For instance, the
[Dutch for Travelers http://www.dutchtrav.com/gram/irrverbs.html]
[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:
```
begrijpen begrijp begreep begrepen to understand
bijten bijt beet gebeten to bite
binden bind bond gebonden to tie
breken breek brak gebroken to break
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 : Str -> Str -> Str -> Str -> V ;
irregV : (x1,_,_,_,_,x6 : Str) -> V ;
```
and a Perl or Python or Haskell script that transforms
the table to
```
begrijpen_V = irregV "begrijpen" "begrijp" "begreep" "begrepen" ;
bijten_V = irregV "bijten" "bijt" "beet" "gebeten" ;
binden_V = irregV "binden" "bind" "bond" "gebonden" ;
backen_V = irregV "backen" "bäckt" "back" "backte" "backte" "gebacken" ;
befehlen_V = irregV "befehlen" "befiehlt" "befiehl" "befahl" "beföhle" "befohlen" ;
```
(You may want to use the English translation for some purpose, as well.)
When using ready-made word lists, you should think about
coyright issues. Ideally, all resource grammar material should
@@ -510,7 +530,7 @@ extension modules. This chapter will deal with this issue.
==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 Dutch), that is, formally
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

View File

@@ -0,0 +1,42 @@
concrete AdjectiveGer of Adjective = CatGer ** open ResGer, Prelude in {
--
-- lin
--
-- PositA a = {
-- s = \\_ => a.s ! AAdj Posit ;
-- isPre = True
-- } ;
-- ComparA a np = {
-- s = \\_ => a.s ! AAdj Compar ++ "than" ++ np.s ! Nom ;
-- isPre = False
-- } ;
--
---- $SuperlA$ belongs to determiner syntax in $Noun$.
--
-- ComplA2 a np = {
-- s = \\_ => a.s ! AAdj Posit ++ a.c2 ++ np.s ! Acc ;
-- isPre = False
-- } ;
--
-- ReflA2 a = {
-- s = \\ag => a.s ! AAdj Posit ++ a.c2 ++ reflPron ! ag ;
-- isPre = False
-- } ;
--
-- SentAP ap s = {
-- s = \\a => ap.s ! a ++ conjThat ++ s.s ;
-- isPre = False
-- } ;
-- QuestAP ap qs = {
-- s = \\a => ap.s ! a ++ qs.s ! QIndir ;
-- isPre = False
-- } ;
--
-- AdAP ada ap = {
-- s = \\a => ada.s ++ ap.s ! a ;
-- isPre = ap.isPre
-- } ;
--
-- UseA2 a = a ;
--
}

View File

@@ -0,0 +1,21 @@
concrete AdverbGer of Adverb = CatGer ** open ResGer, Prelude in {
--
-- lin
-- PositAdvAdj a = {s = a.s ! AAdv} ;
-- ComparAdvAdj cadv a np = {
-- s = cadv.s ++ a.s ! AAdv ++ "than" ++ np.s ! Nom
-- } ;
-- ComparAdvAdjS cadv a s = {
-- s = cadv.s ++ a.s ! AAdv ++ "than" ++ s.s
-- } ;
--
-- PrepNP prep np = {s = prep.s ++ np.s ! Acc} ;
--
-- AdAdv = cc2 ;
--
-- SubjS = cc2 ;
-- AdvSC s = s ; --- this rule give stack overflow in ordinary parsing
--
-- AdnCAdv cadv = {s = cadv.s ++ "than"} ;
--
}

View File

@@ -0,0 +1,225 @@
----# -path=.:prelude
--
--concrete BasicGer of Basic = CatGer ** open ParadigmsGer in {
--
--flags
-- startcat=Phr ; lexer=textlit ; unlexer=text ;
-- optimize=all ;
--
--lin
-- airplane_N = regN "airplane" ;
-- answer_V2S = mkV2S (regV "answer") "to" ;
-- apartment_N = regN "apartment" ;
-- apple_N = regN "apple" ;
-- art_N = regN "art" ;
-- ask_V2Q = mkV2Q (regV "ask") [] ;
-- baby_N = regN "baby" ;
-- bad_A = regADeg "bad" ;
-- bank_N = regN "bank" ;
-- beautiful_A = regADeg "beautiful" ;
-- become_VA = mkVA (irregV "become" "became" "become") ;
-- beer_N = regN "beer" ;
-- beg_V2V = mkV2V (regDuplV "beg") [] "to" ;
-- big_A = regADeg "big" ;
-- bike_N = regN "bike" ;
-- bird_N = regN "bird" ;
-- black_A = regADeg "black" ;
-- blue_A = regADeg "blue" ;
-- boat_N = regN "boat" ;
-- book_N = regN "book" ;
-- boot_N = regN "boot" ;
-- boss_N = regN "boss" ;
-- boy_N = regN "boy" ;
-- bread_N = regN "bread" ;
-- break_V2 = dirV2 (irregV "break" "broke" "broken") ;
-- broad_A = regADeg "broad" ;
-- brother_N2 = regN2 "brother" ;
-- brown_A = regADeg "brown" ;
-- butter_N = regN "butter" ;
-- buy_V2 = dirV2 (irregV "buy" "bought" "bought") ;
-- camera_N = regN "camera" ;
-- cap_N = regN "cap" ;
-- car_N = regN "car" ;
-- carpet_N = regN "carpet" ;
-- cat_N = regN "cat" ;
-- ceiling_N = regN "ceiling" ;
-- chair_N = regN "chair" ;
-- cheese_N = regN "cheese" ;
-- child_N = mk2N "child" "children" ;
-- church_N = regN "church" ;
-- city_N = regN "city" ;
-- clean_A = regADeg "clean" ;
-- clever_A = regADeg "clever" ;
-- close_V2 = dirV2 (regV "close") ;
-- coat_N = regN "coat" ;
-- cold_A = regADeg "cold" ;
-- come_V = (irregV "come" "came" "come") ;
-- computer_N = regN "computer" ;
-- country_N = regN "country" ;
-- cousin_N = regN "cousin" ;
-- cow_N = regN "cow" ;
-- die_V = (regV "die") ;
-- dirty_A = regADeg "dirty" ;
-- distance_N3 = mkN3 (regN "distance") "from" "to" ;
-- doctor_N = regN "doctor" ;
-- dog_N = regN "dog" ;
-- door_N = regN "door" ;
-- drink_V2 = dirV2 (irregV "drink" "drank" "drunk") ;
-- easy_A2V = mkA2V (regA "easy") "for" ;
-- eat_V2 = dirV2 (irregV "eat" "ate" "eaten") ;
-- empty_A = regADeg "empty" ;
-- enemy_N = regN "enemy" ;
-- factory_N = regN "factory" ;
-- father_N2 = regN2 "father" ;
-- fear_VS = mkVS (regV "fear") ;
-- find_V2 = dirV2 (irregV "find" "found" "found") ;
-- fish_N = mk2N "fish" "fish" ;
-- floor_N = regN "floor" ;
-- forget_V2 = dirV2 (irregV "forget" "forgot" "forgotten") ;
-- fridge_N = regN "fridge" ;
-- friend_N = regN "friend" ;
-- fruit_N = regN "fruit" ;
-- fun_AV = mkAV (regA "fun") ;
-- garden_N = regN "garden" ;
-- girl_N = regN "girl" ;
-- glove_N = regN "glove" ;
-- gold_N = regN "gold" ;
-- good_A = mkADeg "good" "well" "better" "best" ;
-- go_V = (mkV "go" "goes" "went" "gone" "going") ;
-- green_A = regADeg "green" ;
-- harbour_N = regN "harbour" ;
-- hate_V2 = dirV2 (regV "hate") ;
-- hat_N = regN "hat" ;
-- have_V2 = dirV2 (mkV "have" "has" "had" "had" "having") ;
-- hear_V2 = dirV2 (irregV "hear" "heard" "heard") ;
-- hill_N = regN "hill" ;
-- hope_VS = mkVS (regV "hope") ;
-- horse_N = regN "horse" ;
-- hot_A = regADeg "hot" ;
-- house_N = regN "house" ;
-- important_A = compoundADeg (regA "important") ;
-- industry_N = regN "industry" ;
-- iron_N = regN "iron" ;
-- king_N = regN "king" ;
-- know_V2 = dirV2 (irregV "know" "knew" "known") ;
-- lake_N = regN "lake" ;
-- lamp_N = regN "lamp" ;
-- learn_V2 = dirV2 (regV "learn") ;
-- leather_N = regN "leather" ;
-- leave_V2 = dirV2 (irregV "leave" "left" "left") ;
-- like_V2 = dirV2 (regV "like") ;
-- listen_V2 = dirV2 (regV "listen") ;
-- live_V = (regV "live") ;
-- long_A = regADeg "long" ;
-- lose_V2 = dirV2 (irregV "lose" "lost" "lost") ;
-- love_N = regN "love" ;
-- love_V2 = dirV2 (regV "love") ;
-- man_N = mk2N "man" "men" ;
-- married_A2 = mkA2 (regA "married") "to" ;
-- meat_N = regN "meat" ;
-- milk_N = regN "milk" ;
-- moon_N = regN "moon" ;
-- mother_N2 = regN2 "mother" ;
-- mountain_N = regN "mountain" ;
-- music_N = regN "music" ;
-- narrow_A = regADeg "narrow" ;
-- new_A = regADeg "new" ;
-- newspaper_N = regN "newspaper" ;
-- oil_N = regN "oil" ;
-- old_A = regADeg "old" ;
-- open_V2 = dirV2 (regV "open") ;
-- paint_V2A = mkV2A (regV "paint") [] ;
-- paper_N = regN "paper" ;
-- peace_N = regN "peace" ;
-- pen_N = regN "pen" ;
-- planet_N = regN "planet" ;
-- plastic_N = regN "plastic" ;
-- play_V2 = dirV2 (regV "play") ;
-- policeman_N = regN "policeman" ;
-- priest_N = regN "priest" ;
-- probable_AS = mkAS (regA "probable") ;
-- queen_N = regN "queen" ;
-- radio_N = regN "radio" ;
-- rain_V0 = mkV0 (regV "rain") ;
-- read_V2 = dirV2 (irregV "read" "read" "read") ;
-- red_A = regADeg "red" ;
-- religion_N = regN "religion" ;
-- restaurant_N = regN "restaurant" ;
-- river_N = regN "river" ;
-- rock_N = regN "rock" ;
-- roof_N = regN "roof" ;
-- rubber_N = regN "rubber" ;
-- run_V = (irregDuplV "run" "ran" "run") ;
-- say_VS = mkVS (irregV "say" "said" "said") ;
-- school_N = regN "school" ;
-- science_N = regN "science" ;
-- sea_N = regN "sea" ;
-- seek_V2 = dirV2 (irregV "seek" "sought" "sought") ;
-- see_V2 = dirV2 (irregV "see" "saw" "seen") ;
-- sell_V3 = dirV3 (irregV "sell" "sold" "sold") "to" ;
-- send_V3 = dirV3 (irregV "send" "sent" "sent") "to" ;
-- sheep_N = mk2N "sheep" "sheep" ;
-- ship_N = regN "ship" ;
-- shirt_N = regN "shirt" ;
-- shoe_N = regN "shoe" ;
-- shop_N = regN "shop" ;
-- short_A = regADeg "short" ;
-- silver_N = regN "silver" ;
-- sister_N = regN "sister" ;
-- sleep_V = (irregV "sleep" "slept" "slept") ;
-- small_A = regADeg "small" ;
-- snake_N = regN "snake" ;
-- sock_N = regN "sock" ;
-- speak_V2 = dirV2 (irregV "speak" "spoke" "spoken") ;
-- star_N = regN "star" ;
-- steel_N = regN "steel" ;
-- stone_N = regN "stone" ;
-- stove_N = regN "stove" ;
-- student_N = regN "student" ;
-- stupid_A = regADeg "stupid" ;
-- sun_N = regN "sun" ;
-- switch8off_V2 = dirV2 (partV (regV "switch") "off") ;
-- switch8on_V2 = dirV2 (partV (regV "switch") "on") ;
-- table_N = regN "table" ;
-- talk_V3 = mkV3 (regV "talk") "to" "about" ;
-- teacher_N = regN "teacher" ;
-- teach_V2 = dirV2 (irregV "teach" "taught" "taught") ;
-- television_N = regN "television" ;
-- thick_A = regADeg "thick" ;
-- thin_A = regADeg "thin" ;
-- train_N = regN "train" ;
-- travel_V = (regDuplV "travel") ;
-- tree_N = regN "tree" ;
-- ---- trousers_N = regN "trousers" ;
-- ugly_A = regADeg "ugly" ;
-- understand_V2 = dirV2 (irregV "understand" "understood" "understood") ;
-- university_N = regN "university" ;
-- village_N = regN "village" ;
-- wait_V2 = mkV2 (regV "wait") "for" ;
-- walk_V = (regV "walk") ;
-- warm_A = regADeg "warm" ;
-- war_N = regN "war" ;
-- watch_V2 = dirV2 (regV "watch") ;
-- water_N = regN "water" ;
-- white_A = regADeg "white" ;
-- window_N = regN "window" ;
-- wine_N = regN "wine" ;
-- win_V2 = dirV2 (irregV "win" "won" "won") ;
-- woman_N = mk2N "woman" "women" ;
-- wonder_VQ = mkVQ (regV "wonder") ;
-- wood_N = regN "wood" ;
-- write_V2 = dirV2 (irregV "write" "wrote" "written") ;
-- yellow_A = regADeg "yellow" ;
-- young_A = regADeg "young" ;
--
-- do_V2 = dirV2 (mkV "do" "does" "did" "done" "doing") ;
-- now_Adv = mkAdv "now" ;
-- already_Adv = mkAdv "already" ;
-- song_N = regN "song" ;
-- add_V3 = dirV3 (regV "add") "to" ;
-- number_N = regN "number" ;
-- put_V2 = mkV2 (irregDuplV "put" "put" "put") [] ;
-- stop_V = regDuplV "stop" ;
-- jump_V = regV "jump" ;
--
--} ;

View File

@@ -0,0 +1,61 @@
concrete CatGer of Cat = open ResGer, Prelude, (R = ParamX) in {
lincat
-- Text, Phr, Utt = {s : Str} ;
--
-- Imp = {s : Polarity => Number => Str} ;
--
-- S = {s : Str} ;
-- QS = {s : QForm => Str} ;
-- RS = {s : Agr => Str} ;
--
-- Cl = {s : Tense => Anteriority => Polarity => Order => Str} ;
-- Slash = {s : Tense => Anteriority => Polarity => Order => Str} ** {c2 : Str} ;
--
-- QCl = {s : Tense => Anteriority => Polarity => QForm => Str} ;
-- RCl = {s : Tense => Anteriority => Polarity => Agr => Str} ;
--
-- VP = {
-- s : Tense => Anteriority => Polarity => Order => Agr => {fin, inf : Str} ;
-- s2 : Agr => Str
-- } ;
--
-- V, VS, VQ, VA = Verb ; -- = {s : VForm => Str} ;
-- V2, VV, V2A = Verb ** {c2 : Str} ;
-- V3 = Verb ** {c2, c3 : Str} ;
--
-- AP = {s : Agr => Str ; isPre : Bool} ;
-- Comp = {s : Agr => Str} ;
--
-- SC = {s : Str} ;
--
-- A = {s : AForm => Str} ;
-- A2 = {s : AForm => Str ; c2 : Str} ;
--
-- Adv, AdV, AdA, AdS, AdN = {s : Str} ;
-- Prep = {s : Str} ;
--
-- Det, Quant = {s : Str ; n : Number} ;
-- Predet, Num, Ord = {s : Str} ;
--
CN = {s : Adjf => Number => Case => Str ; g : Gender} ;
N = {s : Number => Case => Str ; g : Gender} ;
-- PN = {s : Case => Str} ;
-- Pron, NP = {s : Case => Str ; a : Agr} ;
-- N2 = {s : Number => Case => Str} ** {c2 : Str} ;
-- N3 = {s : Number => Case => Str} ** {c2,c3 : Str} ;
--
-- IP = {s : Case => Str ; n : Number} ;
-- IDet = {s : Str ; n : Number} ;
-- IAdv = {s : Str} ;
--
-- RP = {s : Case => Str ; a : RAgr} ;
--
-- Numeral = {s : CardOrd => Str ; n : Number} ;
--
-- CAdv = {s : Str} ;
--
-- Conj = {s : Str ; n : Number} ;
-- DConj = {s1,s2 : Str ; n : Number} ;
--
}

View File

@@ -0,0 +1,45 @@
concrete ConjunctionGer of Conjunction =
CatGer ** open ResGer, 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} ;
--
}

View File

@@ -0,0 +1,26 @@
--concrete ExtGer of ExtGerAbs = CatGer ** open ResGer 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 "have"
-- } ;
-- s2 = \\agr => infVP vp agr
-- } ;
--
-- can_Aux = {s = \\p => posneg p "can"} ; ---- cannt
-- must_Aux = {s = \\p => posneg p "must"} ;
--
--}

View File

@@ -0,0 +1,181 @@
----# -path=.:prelude:../abstract:../common
--
--concrete IrregGer of IrregGerAbs = CatGer ** open ParadigmsGer in {
--
--flags optimize=values ;
--
-- lin
-- awake_V = irregV "awake" "awoke" "awoken" ;
-- bear_V = irregV "bear" "bore" "born" ;
-- beat_V = irregV "beat" "beat" "beat" ;
-- become_V = irregV "become" "became" "become" ;
-- begin_V = irregV "begin" "began" "begun" ;
-- bend_V = irregV "bend" "bent" "bent" ;
-- beset_V = irregV "beset" "beset" "beset" ;
-- bet_V = irregDuplV "bet" "bet" "bet" ;
-- bid_V = irregDuplV "bid" (variants {"bid" ; "bade"}) (variants {"bid" ; "bidden"}) ;
-- bind_V = irregV "bind" "bound" "bound" ;
-- bite_V = irregV "bite" "bit" "bitten" ;
-- bleed_V = irregV "bleed" "bled" "bled" ;
-- blow_V = irregV "blow" "blew" "blown" ;
-- break_V = irregV "break" "broke" "broken" ;
-- breed_V = irregV "breed" "bred" "bred" ;
-- bring_V = irregV "bring" "brought" "brought" ;
-- broadcast_V = irregV "broadcast" "broadcast" "broadcast" ;
-- build_V = irregV "build" "built" "built" ;
-- burn_V = irregV "burn" (variants {"burned" ; "burnt"}) (variants {"burned" ; "burnt"}) ;
-- burst_V = irregV "burst" "burst" "burst" ;
-- buy_V = irregV "buy" "bought" "bought" ;
-- cast_V = irregV "cast" "cast" "cast" ;
-- catch_V = irregV "catch" "caught" "caught" ;
-- choose_V = irregV "choose" "chose" "chosen" ;
-- cling_V = irregV "cling" "clung" "clung" ;
-- come_V = irregV "come" "came" "come" ;
-- cost_V = irregV "cost" "cost" "cost" ;
-- creep_V = irregV "creep" "crept" "crept" ;
-- cut_V = irregDuplV "cut" "cut" "cut" ;
-- deal_V = irregV "deal" "dealt" "dealt" ;
-- dig_V = irregDuplV "dig" "dug" "dug" ;
-- dive_V = irregV "dive" (variants {"dived" ; "dove"}) "dived" ;
-- do_V = mkV "do" "does" "did" "done" "doing" ;
-- draw_V = irregV "draw" "drew" "drawn" ;
-- dream_V = irregV "dream" (variants {"dreamed" ; "dreamt"}) (variants {"dreamed" ; "dreamt"}) ;
-- drive_V = irregV "drive" "drove" "driven" ;
-- drink_V = irregV "drink" "drank" "drunk" ;
-- eat_V = irregV "eat" "ate" "eaten" ;
-- fall_V = irregV "fall" "fell" "fallen" ;
-- feed_V = irregV "feed" "fed" "fed" ;
-- feel_V = irregV "feel" "felt" "felt" ;
-- fight_V = irregV "fight" "fought" "fought" ;
-- find_V = irregV "find" "found" "found" ;
-- fit_V = irregDuplV "fit" "fit" "fit" ;
-- flee_V = irregV "flee" "fled" "fled" ;
-- fling_V = irregV "fling" "flung" "flung" ;
-- fly_V = irregV "fly" "flew" "flown" ;
-- forbid_V = irregDuplV "forbid" "forbade" "forbidden" ;
-- forget_V = irregDuplV "forget" "forgot" "forgotten" ;
-- forgive_V = irregV "forgive" "forgave" "forgiven" ;
-- forsake_V = irregV "forsake" "forsook" "forsaken" ;
-- freeze_V = irregV "freeze" "froze" "frozen" ;
-- get_V = irregDuplV "get" "got" "gotten" ;
-- give_V = irregV "give" "gave" "given" ;
-- go_V = irregV "go" "went" "gone" ;
-- grind_V = irregV "grind" "ground" "ground" ;
-- grow_V = irregV "grow" "grew" "grown" ;
-- hang_V = irregV "hang" "hung" "hung" ;
-- have_V = mkV "have" "has" "had" "had" "having" ;
-- hear_V = irregV "hear" "heard" "heard" ;
-- hide_V = irregV "hide" "hid" "hidden" ;
-- hit_V = irregDuplV "hit" "hit" "hit" ;
-- hold_V = irregV "hold" "held" "held" ;
-- hurt_V = irregV "hurt" "hurt" "hurt" ;
-- keep_V = irregV "keep" "kept" "kept" ;
-- kneel_V = irregV "kneel" "knelt" "knelt" ;
-- knit_V = irregDuplV "knit" "knit" "knit" ;
-- know_V = irregV "know" "knew" "know" ;
-- lay_V = irregV "lay" "laid" "laid" ;
-- lead_V = irregV "lead" "led" "led" ;
-- leap_V = irregV "leap" (variants {"leaped" ; "lept"}) (variants {"leaped" ; "lept"}) ;
-- learn_V = irregV "learn" (variants {"learned" ; "learnt"}) (variants {"learned" ; "learnt"}) ;
-- leave_V = irregV "leave" "left" "left" ;
-- lend_V = irregV "lend" "lent" "lent" ;
-- let_V = irregDuplV "let" "let" "let" ;
-- lie_V = irregV "lie" "lay" "lain" ;
-- light_V = irregV "light" (variants {"lighted" ; "lit"}) "lighted" ;
-- lose_V = irregV "lose" "lost" "lost" ;
-- make_V = irregV "make" "made" "made" ;
-- mean_V = irregV "mean" "meant" "meant" ;
-- meet_V = irregV "meet" "met" "met" ;
-- misspell_V = irregV "misspell" (variants {"misspelled" ; "misspelt"}) (variants {"misspelled" ; "misspelt"}) ;
-- mistake_V = irregV "mistake" "mistook" "mistaken" ;
-- mow_V = irregV "mow" "mowed" (variants {"mowed" ; "mown"}) ;
-- overcome_V = irregV "overcome" "overcame" "overcome" ;
-- overdo_V = mkV "overdo" "overdoes" "overdid" "overdone" "overdoing" ;
-- overtake_V = irregV "overtake" "overtook" "overtaken" ;
-- overthrow_V = irregV "overthrow" "overthrew" "overthrown" ;
-- pay_V = irregV "pay" "paid" "paid" ;
-- plead_V = irregV "plead" "pled" "pled" ;
-- prove_V = irregV "prove" "proved" (variants {"proved" ; "proven"}) ;
-- put_V = irregDuplV "put" "put" "put" ;
-- quit_V = irregDuplV "quit" "quit" "quit" ;
-- read_V = irregV "read" "read" "read" ;
-- rid_V = irregDuplV "rid" "rid" "rid" ;
-- ride_V = irregV "ride" "rode" "ridden" ;
-- ring_V = irregV "ring" "rang" "rung" ;
-- rise_V = irregV "rise" "rose" "risen" ;
-- run_V = irregDuplV "run" "ran" "run" ;
-- saw_V = irregV "saw" "sawed" (variants {"sawed" ; "sawn"}) ;
-- say_V = irregV "say" "said" "said" ;
-- see_V = irregV "see" "saw" "seen" ;
-- seek_V = irregV "seek" "sought" "sought" ;
-- sell_V = irregV "sell" "sold" "sold" ;
-- send_V = irregV "send" "sent" "sent" ;
-- set_V = irregDuplV "set" "set" "set" ;
-- sew_V = irregV "sew" "sewed" (variants {"sewed" ; "sewn"}) ;
-- shake_V = irregV "shake" "shook" "shaken" ;
-- shave_V = irregV "shave" "shaved" (variants {"shaved" ; "shaven"}) ;
-- shear_V = irregV "shear" "shore" "shorn" ;
-- shed_V = irregDuplV "shed" "shed" "shed" ;
-- shine_V = irregV "shine" "shone" "shone" ;
-- shoe_V = irregV "shoe" "shoed" (variants {"shoed" ; "shod"}) ;
-- shoot_V = irregV "shoot" "shot" "shot" ;
-- show_V = irregV "show" "showed" (variants {"showed" ; "shown"}) ;
-- shrink_V = irregV "shrink" "shrank" "shrunk" ;
-- shut_V = irregDuplV "shut" "shut" "shut" ;
-- sing_V = irregV "sing" "sang" "sung" ;
-- sink_V = irregV "sink" "sank" "sunk" ;
-- sit_V = irregDuplV "sit" "sat" "sat" ;
-- sleep_V = irregV "sleep" "slept" "slept" ;
-- slay_V = irregV "slay" "slew" "slain" ;
-- slide_V = irregV "slide" "slid" "slid" ;
-- sling_V = irregV "sling" "slung" "slung" ;
-- slit_V = irregDuplV "slit" "slit" "slit" ;
-- smite_V = irregV "smite" "smote" "smitten" ;
-- sow_V = irregV "sow" "sowed" (variants {"sowed" ; "sown"}) ;
-- speak_V = irregV "speak" "spoke" "spoken" ;
-- speed_V = irregV "speed" "sped" "sped" ;
-- spend_V = irregV "spend" "spent" "spent" ;
-- spill_V = irregV "spill" (variants {"spilled" ; "spilt"}) (variants {"spilled" ; "spilt"}) ;
-- spin_V = irregDuplV "spin" "spun" "spun" ;
-- spit_V = irregDuplV "spit" (variants {"spit" ; "spat"}) "spit" ;
-- split_V = irregDuplV "split" "split" "split" ;
-- spread_V = irregV "spread" "spread" "spread" ;
-- spring_V = irregV "spring" (variants {"sprang" ; "sprung"}) "sprung" ;
-- stand_V = irregV "stand" "stood" "stood" ;
-- steal_V = irregV "steal" "stole" "stolen" ;
-- stick_V = irregV "stick" "stuck" "stuck" ;
-- sting_V = irregV "sting" "stung" "stung" ;
-- stink_V = irregV "stink" "stank" "stunk" ;
-- stride_V = irregV "stride" "strod" "stridden" ;
-- strike_V = irregV "strike" "struck" "struck" ;
-- string_V = irregV "string" "strung" "strung" ;
-- strive_V = irregV "strive" "strove" "striven" ;
-- swear_V = irregV "swear" "swore" "sworn" ;
-- sweep_V = irregV "sweep" "swept" "swept" ;
-- swell_V = irregV "swell" "swelled" (variants {"swelled" ; "swollen"}) ;
-- swim_V = irregDuplV "swim" "swam" "swum" ;
-- swing_V = irregV "swing" "swung" "swung" ;
-- take_V = irregV "take" "took" "taken" ;
-- teach_V = irregV "teach" "taught" "taught" ;
-- tear_V = irregV "tear" "tore" "torn" ;
-- tell_V = irregV "tell" "told" "told" ;
-- think_V = irregV "think" "thought" "thought" ;
-- thrive_V = irregV "thrive" (variants {"thrived" ; "throve"}) "thrived" ;
-- throw_V = irregV "throw" "threw" "thrown" ;
-- thrust_V = irregV "thrust" "thrust" "thrust" ;
-- tread_V = irregV "tread" "trod" "trodden" ;
-- understand_V = irregV "understand" "understood" "understood" ;
-- uphold_V = irregV "uphold" "upheld" "upheld" ;
-- upset_V = irregDuplV "upset" "upset" "upset" ;
-- wake_V = irregV "wake" "woke" "woken" ;
-- wear_V = irregV "wear" "wore" "worn" ;
-- weave_V = irregV "weave" (variants {"weaved" ; "wove"}) (variants {"weaved" ; "woven"}) ;
-- wed_V = irregDuplV "wed" "wed" "wed" ;
-- weep_V = irregV "weep" "wept" "wept" ;
-- wind_V = irregV "wind" "wound" "wound" ;
-- win_V = irregDuplV "win" "won" "won" ;
-- withhold_V = irregV "withhold" "withheld" "withheld" ;
-- withstand_V = irregV "withstand" "withstood" "withstood" ;
-- wring_V = irregV "wring" "wrung" "wrung" ;
-- write_V = irregV "write" "wrote" "written" ;
--}

View File

@@ -0,0 +1,21 @@
----# -path=.:../abstract:../common:prelude
--
--concrete LangGer of Lang =
-- NounGer,
-- VerbGer,
-- AdjectiveGer,
-- AdverbGer,
-- NumeralGer,
-- SentenceGer,
-- QuestionGer,
-- RelativeGer,
-- ConjunctionGer,
-- PhraseGer,
-- TensedGer,
-- StructuralGer,
-- BasicGer
-- ** {
--
--flags startcat = Phr ;
--
--} ;

View File

@@ -0,0 +1,60 @@
concrete LexGer of Lex = CatGer ** open ResGer, Prelude in {
--
-- lin
-- walk_V = regV "walk" ;
-- help_V2 = regV "help" ** {c2 = []} ;
-- show_V3 = regV "show" ** {c2 = [] ; c3 = "to"} ;
-- want_VV = regV "want" ** {c2 = "to"} ;
-- claim_VS = regV "claim" ;
-- ask_VQ = regV "ask" ;
--
-- dog_N = regN "dog" ;
-- son_N2 = regN "son" ** {c2 = "of"} ;
-- way_N3 = regN "way" ** {c2 = "from" ; c3 = "to"} ;
--
-- warm_A = regA "warm" ;
-- close_A2 = regA "close" ** {c2 = "to"} ;
--
-- here_Adv = {s = "here"} ;
-- very_AdA = {s = "very"} ;
-- always_AdV = {s = "always"} ;
--
-- only_Predet = {s = "only"} ;
-- all_Predet = {s = "only"} ;
-- this_Quant = {s = "this" ; n = Sg} ;
-- these_Quant = {s = "these" ; n = Pl} ;
--
-- i_Pron = mkNP "I" "me" "my" Sg P1 ;
-- he_Pron = mkNP "he" "him" "his" Sg P3 ;
-- we_Pron = mkNP "we" "us" "our" Pl P1 ;
--
-- whoSg_IP = mkIP "who" "whom" "whose" Sg ;
-- whoPl_IP = mkIP "who" "whom" "whose" Pl ;
--
-- when_IAdv = {s = "when"} ;
-- where_IAdv = {s = "where"} ;
-- why_IAdv = {s = "why"} ;
--
-- whichSg_IDet = {s = "which" ; n = Sg} ;
-- whichPl_IDet = {s = "which" ; n = Pl} ;
--
-- one_Numeral = {s = table {NCard => "one" ; NOrd => "first"} ; n = Sg} ;
-- forty_Numeral = {s = table {NCard => "forty" ; NOrd => "fortieth"} ; n = Pl} ;
--
-- in_Prep = {s = "in"} ;
-- of_Prep = {s = "of"} ;
--
-- and_Conj = {s = "and" ; n = Pl} ;
-- either7or_DConj = {s1 = "either" ; s2 = "or" ; n = Sg} ;
--
-- if_Subj = ss "if" ;
-- because_Subj = ss "because" ;
--
-- but_PConj = {s = "but"} ;
--
-- please_Voc = {s = "," ++ "please"} ;
--
-- more_CAdv = ss "more" ;
-- less_CAdv = ss "less" ;
--
}

View File

@@ -0,0 +1,43 @@
--concrete ListConjunctionGer of Conjunction =
-- CatGer ** open ResGer, Coordination, Prelude in {
--
-- lin
--
-- ConjS conj ss = {s = conjunctX conj ss} ;
-- DConjS conj ss = {s = conjunctDistrX conj ss} ;
--
-- ConjAdv conj ss = {s = conjunctX conj ss} ;
-- DConjAdv conj ss = {s = conjunctDistrX conj ss} ;
--
-- ConjNP conj ss = conjunctTable Case conj ss ** {
-- a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p}
-- } ;
-- DConjNP conj ss = conjunctDistrTable Case conj ss ** {
-- a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p}
-- } ;
--
-- ConjAP conj ss = conjunctTable Agr conj ss ** {
-- isPre = ss.isPre
-- } ;
-- DConjAP conj ss = conjunctDistrTable Agr conj ss ** {
-- isPre = ss.isPre
-- } ;
--
---- 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} ;
--
--}

View File

@@ -0,0 +1,26 @@
--concrete MathGer of Math = CatGer ** open Prelude, ResGer in {
--
--lin
-- SymbPN i = {s = \\c => i.s ; a = agrP3 Sg} ; --- c
-- IntPN i = {s = \\c => i.s ; a = agrP3 Sg} ; --- c
-- CNIntNP cn i = {
-- s = \\c => (cn.s ! Sg ! Nom ++ i.s) ;
-- a = agrP3 Sg
-- } ;
-- CNSymbNP det cn xs = {
-- s = \\c => det.s ++ cn.s ! det.n ! c ++ xs.s ;
-- a = agrP3 det.n
-- } ;
--
--lincat
--
-- Symb, SymbList = SS ;
--
--lin
--
-- MkSymb s = s ;
--
-- BaseSymb = infixSS "and" ;
-- ConsSymb = infixSS "," ;
--
--}

View File

@@ -0,0 +1,198 @@
----# -path=.:../../prelude
--
----1 A Simple German Resource Morphology
----
---- Aarne Ranta 2002 -- 2005
----
---- This resource morphology contains definitions needed in the resource
---- syntax. To build a lexicon, it is better to use $ParadigmsGer$, which
---- gives a higher-level access to this module.
--
--resource MorphoGer = ResGer ** open Prelude, (Predef=Predef) in {
--
-- flags optimize=all ;
--
----2 Phonology
----
---- To regulate the use of endings for both nouns, adjectives, and verbs:
--
--oper
-- y2ie : Str -> Str -> Str = \fly,s ->
-- let y = last (init fly) in
-- case y of {
-- "a" => fly + s ;
-- "e" => fly + s ;
-- "o" => fly + s ;
-- "u" => fly + s ;
-- _ => init fly + "ie" + s
-- } ;
--
--
----2 Nouns
----
---- For conciseness and abstraction, we define a worst-case macro for
---- noun inflection. It is used for defining special case that
---- only need one string as argument.
--
--oper
-- CommonNoun : Type = {s : Number => Case => Str} ;
--
-- nounGen : Str -> CommonNoun = \dog -> case last dog of {
-- "y" => nounY "dog" ;
-- "s" => nounS (init "dog") ;
-- _ => nounReg "dog"
-- } ;
--
---- These are auxiliaries to $nounGen$.
--
-- nounReg : Str -> CommonNoun = \dog ->
-- mkNoun dog (dog + "s") (dog + "'s") (dog + "s'");
-- nounS : Str -> CommonNoun = \kiss ->
-- mkNoun kiss (kiss + "es") (kiss + "'s") (kiss + "es'") ;
-- nounY : Str -> CommonNoun = \fl ->
-- mkNoun (fl + "y") (fl + "ies") (fl + "y's") (fl + "ies'") ;
--
--
----3 Proper names
----
---- Regular proper names are inflected with "'s" in the genitive.
--
-- nameReg : Str -> Gender -> {s : Case => Str} = \john,g ->
-- {s = table {Gen => john + "'s" ; _ => john} ; g = g} ;
--
----2 Determiners
--
-- mkDeterminer : Number -> Str -> {s : Str ; n : Number} = \n,s ->
-- {s = s ; n = n} ;
--
----2 Pronouns
----
---- Here we define personal pronouns.
----
---- We record the form "mine" and the gender for later use.
--
-- Pronoun : Type =
-- {s : Case => Str ; a : Agr ; g : Gender} ;
--
-- mkPronoun : (_,_,_,_ : Str) -> Number -> Person -> Gender -> Pronoun =
-- \I,me,my,mine,n,p,g ->
-- {s = table {Nom => I ; Acc => me ; Gen => my} ;
-- a = {n = n ; p = p} ;
-- g = g
-- } ;
--
-- human : Gender = Masc ; --- doesn't matter
--
-- pronI = mkPronoun "I" "me" "my" "mine" Sg P1 human ;
-- pronYouSg = mkPronoun "you" "you" "your" "yours" Sg P2 human ; -- verb agr OK
-- pronHe = mkPronoun "he" "him" "his" "his" Sg P3 Masc ;
-- pronShe = mkPronoun "she" "her" "her" "hers" Sg P3 Fem ;
-- pronIt = mkPronoun "it" "it" "its" "it" Sg P3 Neutr ;
--
-- pronWe = mkPronoun "we" "us" "our" "ours" Pl P1 human ;
-- pronYouPl = mkPronoun "you" "you" "your" "yours" Pl P2 human ;
-- pronThey = mkPronoun "they" "them" "their" "theirs" Pl P3 human ; ---
--
--
----2 Adjectives
----
---- To form the adjectival and the adverbial forms, two strings are needed
---- in the worst case. (First without degrees.)
--
-- Adjective = {s : AForm => Str} ;
--
---- However, most adjectives can be inflected using the final character.
---- N.B. this is not correct for "shy", but $mkAdjective$ has to be used.
--
-- regAdjective : Str -> Adjective = \free ->
-- let
-- e = last free ;
-- fre = init free ;
-- freely = case e of {
-- "y" => fre + "ily" ;
-- _ => free + "ly"
-- } ;
-- fre = case e of {
-- "e" => fre ;
-- "y" => fre + "i" ;
-- _ => free
-- }
-- in
-- mkAdjective free (fre + "er") (fre + "est") freely ;
--
---- Many adjectives are 'inflected' by adding a comparison word.
--
-- adjDegrLong : Str -> Adjective = \ridiculous ->
-- mkAdjective
-- ridiculous
-- ("more" ++ ridiculous)
-- ("most" ++ ridiculous)
-- ((regAdjective ridiculous).s ! AAdv) ;
--
--
----3 Verbs
----
---- The worst case needs five forms. (The verb "be" is treated separately.)
--
-- mkVerb4 : (_,_,_,_: Str) -> Verb = \go,goes,went,gone ->
-- let going = case last go of {
-- "e" => init go + "ing" ;
-- _ => go + "ing"
-- }
-- in
-- mkVerb go goes went gone going ;
--
---- This is what we use to derive the irregular forms in almost all cases
--
-- mkVerbIrreg : (_,_,_ : Str) -> Verb = \bite,bit,bitten ->
-- let bites = case last bite of {
-- "y" => y2ie bite "s" ;
-- "s" => init bite + "es" ;
-- _ => bite + "s"
-- }
-- in mkVerb4 bite bites bit bitten ;
--
---- This is used to derive regular forms.
--
-- mkVerbReg : Str -> Verb = \soak ->
-- let
-- soaks = case last soak of {
-- "y" => y2ie soak "s" ;
-- "s" => init soak + "es" ;
-- _ => soak + "s"
-- } ;
-- soaked = case last soak of {
-- "e" => init soak + "s" ;
-- _ => soak + "ed"
-- }
-- in
-- mkVerb4 soak soaks soaked soaked ;
--
-- verbGen : Str -> Verb = \kill -> case last kill of {
-- "y" => verbP3y (init kill) ;
-- "e" => verbP3e (init kill) ;
-- "s" => verbP3s (init kill) ;
-- _ => regVerbP3 kill
-- } ;
--
---- These are just auxiliary to $verbGen$.
--
-- regVerbP3 : Str -> Verb = \walk ->
-- mkVerbIrreg walk (walk + "ed") (walk + "ed") ;
-- verbP3s : Str -> Verb = \kiss ->
-- mkVerb4 kiss (kiss + "es") (kiss + "ed") (kiss + "ed") ;
-- verbP3e : Str -> Verb = \love ->
-- mkVerb4 love (love + "s") (love + "d") (love + "d") ;
-- verbP3y : Str -> Verb = \cr ->
-- mkVerb4 (cr + "y") (cr + "ies") (cr + "ied") (cr + "ied") ;
--
----- The particle always appears right after the verb.
--
-- verbPart : Verb -> Str -> Verb = \v,p ->
-- {s = \\f => v.s ! f ++ p} ;
--
-- verbNoPart : Verb -> Verb = \v -> verbPart v [] ;
--
--
--} ;
--

View File

@@ -0,0 +1,50 @@
concrete NounGer of Noun = CatGer ** open ResGer, Prelude in {
--
-- flags optimize=all_subs ;
--
-- lin
-- DetCN det cn = {
-- s = \\c => det.s ++ cn.s ! det.n ! c ;
-- a = agrP3 det.n
-- } ;
-- UsePN pn = pn ** {a = agrP3 Sg} ;
-- UsePron p = p ;
--
-- MkDet pred quant num ord = {
-- s = pred.s ++ quant.s ++ num.s ++ ord.s ;
-- n = quant.n
-- } ;
--
-- PossPronSg p = {s = p.s ! Gen ; n = Sg} ;
-- PossPronPl p = {s = p.s ! Gen ; n = Pl} ;
--
-- NoPredet, NoNum, NoOrd = {s = []} ;
-- NumInt n = n ;
--
-- NumNumeral numeral = {s = numeral.s ! NCard} ;
-- OrdNumeral numeral = {s = numeral.s ! NOrd} ;
--
-- AdNum adn num = {s = adn.s ++ num.s} ;
--
-- OrdSuperl a = {s = a.s ! AAdj Superl} ;
--
-- DefSg = {s = artDef ; n = Sg} ;
-- DefPl = {s = artDef ; n = Pl} ;
--
-- IndefSg = {s = artIndef ; n = Sg} ;
-- IndefPl = {s = [] ; n = Pl} ;
--
-- ComplN2 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c} ;
-- ComplN3 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c ; c2 = f.c3} ;
--
-- AdjCN ap cn = {
-- s = \\n,c => preOrPost ap.isPre (ap.s ! agrP3 n) (cn.s ! n ! c)
-- } ;
-- RelCN cn rs = {s = \\n,c => cn.s ! n ! c ++ rs.s ! {n = n ; p = P3}} ;
--
-- SentCN cn s = {s = \\n,c => cn.s ! n ! c ++ conjThat ++ s.s} ;
-- QuestCN cn qs = {s = \\n,c => cn.s ! n ! c ++ qs.s ! QIndir} ;
--
-- UseN n = n ;
--
}

View File

@@ -0,0 +1,44 @@
--concrete NumeralGer of Numeral = CatGer ** open ResGer in {
--
--lincat
-- Digit = {s : DForm => CardOrd => Str} ;
-- Sub10 = {s : DForm => CardOrd => Str ; n : Number} ;
-- Sub100 = {s : CardOrd => Str ; n : Number} ;
-- Sub1000 = {s : CardOrd => Str ; n : Number} ;
-- Sub1000000 = {s : CardOrd => Str ; n : Number} ;
--
--lin num x = x ;
--lin n2 = let two = mkNum "two" "twelve" "twenty" "second" in
-- {s = \\f,c => case <f,c> of {
-- <teen,NOrd> => "twelfth" ;
-- _ => two.s ! f ! c
-- }
-- } ;
--
--lin n3 = mkNum "three" "thirteen" "thirty" "third" ;
--lin n4 = mkNum "four" "fourteen" "forty" "fourth" ;
--lin n5 = mkNum "five" "fifteen" "fifty" "fifth" ;
--lin n6 = regNum "six" ;
--lin n7 = regNum "seven" ;
--lin n8 = mkNum "eight" "eighteen" "eighty" "eighth" ;
--lin n9 = regNum "nine" ;
--
--lin pot01 = mkNum "one" "eleven" "ten" "first" ** {n = Sg} ;
--lin pot0 d = d ** {n = Pl} ;
--lin pot110 = regCardOrd "ten" ** {n = Pl} ;
--lin pot111 = regCardOrd "eleven" ** {n = Pl} ;
--lin pot1to19 d = {s = d.s ! teen} ** {n = Pl} ;
--lin pot0as1 n = {s = n.s ! unit} ** {n = n.n} ;
--lin pot1 d = {s = d.s ! ten} ** {n = Pl} ;
--lin pot1plus d e = {
-- s = \\c => d.s ! ten ! NCard ++ "-" ++ e.s ! unit ! c ; n = Pl} ;
--lin pot1as2 n = n ;
--lin pot2 d = {s = \\c => d.s ! unit ! NCard ++ mkCard c "hundred"} ** {n = Pl} ;
--lin pot2plus d e = {
-- s = \\c => d.s ! unit ! NCard ++ "hundred" ++ "and" ++ e.s ! c ; n = Pl} ;
--lin pot2as3 n = n ;
--lin pot3 n = {
-- s = \\c => n.s ! NCard ++ mkCard c "thousand" ; n = Pl} ;
--lin pot3plus n m = {
-- s = \\c => n.s ! NCard ++ "thousand" ++ m.s ! c ; n = Pl} ;
--}

View File

@@ -0,0 +1,455 @@
----# -path=.:../abstract:../../prelude
--
----1 German Lexical Paradigms
----
---- Aarne Ranta 2003--2005
----
---- 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 $MorphoGer.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 $IrregularGer$, which covers all irregularly inflected
---- words.
----
---- The following modules are presupposed:
--
--resource ParadigmsGer = open
-- (Predef=Predef),
-- Prelude,
-- MorphoGer,
-- CatGer
-- in {
----2 Parameters
----
---- To abstract over gender names, we define the following identifiers.
--
--oper
-- Gender : Type ;
--
-- human : Gender ;
-- nonhuman : Gender ;
-- masculine : Gender ;
-- feminite : Gender ;
--
---- To abstract over number names, we define the following.
--
-- Number : Type ;
--
-- singular : Number ;
-- plural : Number ;
--
---- To abstract over case names, we define the following.
--
-- Case : Type ;
--
-- nominative : Case ;
-- genitive : Case ;
--
---- Prepositions are used in many-argument functions for rection.
--
-- Preposition : Type ;
--
--
----2 Nouns
--
---- Worst case: give all four forms and the semantic gender.
--
-- mkN : (man,men,man's,men's : Str) -> N ;
--
---- The regular function captures the variants for nouns ending with
---- "s","sh","x","z" or "y": "kiss - kisses", "flash - flashes";
---- "fly - flies" (but "toy - toys"),
--
-- regN : Str -> N ;
--
---- In practice the worst case is just: give singular and plural nominative.
--
-- mk2N : (man,men : Str) -> N ;
--
---- All nouns created by the previous functions are marked as
---- $nonhuman$. If you want a $human$ noun, wrap it with the following
---- function:
--
-- genderN : Gender -> N -> N ;
--
----3 Compound nouns
----
---- All the functions above work quite as well to form compound nouns,
---- such as "baby boom".
--
--
----3 Relational nouns
----
---- Relational nouns ("daughter of x") need a preposition.
--
-- mkN2 : N -> Preposition -> N2 ;
--
---- The most common preposition is "of", and the following is a
---- shortcut for regular, $nonhuman$ relational nouns with "of".
--
-- regN2 : Str -> N2 ;
--
---- Use the function $mkPreposition$ or see the section on prepositions below to
---- form other prepositions.
----
---- Three-place relational nouns ("the connection from x to y") need two prepositions.
--
-- mkN3 : N -> Preposition -> Preposition -> N3 ;
--
--
----3 Relational common noun phrases
----
---- In some cases, you may want to make a complex $CN$ into a
---- relational noun (e.g. "the old town hall of").
--
-- cnN2 : CN -> Preposition -> N2 ;
-- cnN3 : CN -> Preposition -> Preposition -> N3 ;
--
----
----3 Proper names and noun phrases
----
---- Proper names, with a regular genitive, are formed as follows
--
-- regPN : Str -> Gender -> PN ; -- John, John's
--
---- Sometimes you can reuse a common noun as a proper name, e.g. "Bank".
--
-- nounPN : N -> PN ;
--
---- To form a noun phrase that can also be plural and have an irregular
---- genitive, you can use the worst-case function.
--
-- mkNP : Str -> Str -> Number -> Gender -> NP ;
--
----2 Adjectives
--
---- Non-comparison one-place adjectives need two forms: one for
---- the adjectival and one for the adverbial form ("free - freely")
--
-- mkA : (free,freely : Str) -> A ;
--
---- For regular adjectives, the adverbial form is derived. This holds
---- even for cases with the variation "happy - happily".
--
-- regA : Str -> A ;
--
----3 Two-place adjectives
----
---- Two-place adjectives need a preposition for their second argument.
--
-- mkA2 : A -> Preposition -> A2 ;
--
---- Comparison adjectives may two more forms.
--
-- ADeg : Type ;
--
-- mkADeg : (good,better,best,well : Str) -> ADeg ;
--
---- The regular pattern recognizes two common variations:
---- "-e" ("rude" - "ruder" - "rudest") and
---- "-y" ("happy - happier - happiest - happily")
--
-- regADeg : Str -> ADeg ; -- long, longer, longest
--
---- However, the duplication of the final consonant is nor predicted,
---- but a separate pattern is used:
--
-- duplADeg : Str -> ADeg ; -- fat, fatter, fattest
--
---- If comparison is formed by "more, "most", as in general for
---- long adjective, the following pattern is used:
--
-- compoundADeg : A -> ADeg ; -- -/more/most ridiculous
--
---- From a given $ADeg$, it is possible to get back to $A$.
--
-- adegA : ADeg -> A ;
--
--
----2 Adverbs
--
---- Adverbs are not inflected. Most lexical ones have position
---- after the verb. Some can be preverbal (e.g. "always").
--
-- mkAdv : Str -> Adv ;
-- mkAdV : Str -> AdV ;
--
---- Adverbs modifying adjectives and sentences can also be formed.
--
-- mkAdA : Str -> AdA ;
--
----2 Prepositions
----
---- A preposition as used for rection in the lexicon, as well as to
---- build $PP$s in the resource API, just requires a string.
--
-- mkPreposition : Str -> Preposition ;
-- mkPrep : Str -> Prep ;
--
---- (These two functions are synonyms.)
--
----2 Verbs
----
---- Except for "be", the worst case needs five forms: the infinitive and
---- the third person singular present, the past indicative, and the
---- past and present participles.
--
-- mkV : (go, goes, went, gone, going : Str) -> V ;
--
---- The regular verb function recognizes the special cases where the last
---- character is "y" ("cry - cries" but "buy - buys") or "s", "sh", "x", "z"
---- ("fix - fixes", etc).
--
-- regV : Str -> V ;
--
---- The following variant duplicates the last letter in the forms like
---- "rip - ripped - ripping".
--
-- regDuplV : Str -> V ;
--
---- There is an extensive list of irregular verbs in the module $IrregularGer$.
---- In practice, it is enough to give three forms,
---- e.g. "drink - drank - drunk", with a variant indicating consonant
---- duplication in the present participle.
--
-- irregV : (drink, drank, drunk : Str) -> V ;
-- irregDuplV : (get, got, gotten : Str) -> V ;
--
--
----3 Verbs with a particle.
----
---- The particle, such as in "switch on", is given as a string.
--
-- partV : V -> Str -> V ;
--
----3 Two-place verbs
----
---- Two-place verbs need a preposition, except the special case with direct object.
---- (transitive verbs). Notice that a particle comes from the $V$.
--
-- mkV2 : V -> Preposition -> V2 ;
--
-- dirV2 : V -> V2 ;
--
----3 Three-place verbs
----
---- Three-place (ditransitive) verbs need two prepositions, of which
---- the first one or both can be absent.
--
-- mkV3 : V -> 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 = MorphoGer.Gender ;
-- Number = MorphoGer.Number ;
-- Case = MorphoGer.Case ;
-- human = Masc ;
-- nonhuman = Neutr ;
-- masculine = Masc ;
-- feminine = Fem ;
-- singular = Sg ;
-- plural = Pl ;
-- nominative = Nom ;
-- genitive = Gen ;
--
-- Preposition = Str ;
--
-- regN = \ray ->
-- let
-- ra = Predef.tk 1 ray ;
-- y = Predef.dp 1 ray ;
-- r = Predef.tk 2 ray ;
-- ay = Predef.dp 2 ray ;
-- rays =
-- case y of {
-- "y" => y2ie ray "s" ;
-- "s" => ray + "es" ;
-- "z" => ray + "es" ;
-- "x" => ray + "es" ;
-- _ => case ay of {
-- "sh" => ray + "es" ;
-- "ch" => ray + "es" ;
-- _ => ray + "s"
-- }
-- }
-- in
-- mk2N ray rays ;
--
-- mk2N = \man,men ->
-- let mens = case last men of {
-- "s" => men + "'" ;
-- _ => men + "'s"
-- }
-- in
-- mkN man men (man + "'s") mens ;
--
-- mkN = \man,men,man's,men's ->
-- mkNoun man man's men men's ** {g = Neutr ; lock_N = <>} ;
--
-- genderN g man = {s = man.s ; g = g ; lock_N = <>} ;
--
-- mkN2 = \n,p -> n ** {lock_N2 = <> ; c2 = p} ;
-- regN2 n = mkN2 (regN n) (mkPreposition "of") ;
-- 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} ;
--
-- regPN n g = nameReg n g ** {lock_PN = <>} ;
-- nounPN n = {s = n.s ! singular ; g = n.g ; lock_PN = <>} ;
-- mkNP x y n g = {s = table {Gen => x ; _ => y} ; a = agrP3 n ;
-- lock_NP = <>} ;
--
-- 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 = <>} ;
--
-- regADeg happy =
-- let
-- happ = init happy ;
-- y = last happy ;
-- happie = case y of {
-- "y" => happ + "ie" ;
-- "e" => happy ;
-- _ => happy + "e"
-- } ;
-- happily = case y of {
-- "y" => happ + "ily" ;
-- _ => happy + "ly"
-- } ;
-- in mkADeg happy (happie + "r") (happie + "st") happily ;
--
-- duplADeg fat =
-- mkADeg fat
-- (fat + last fat + "er") (fat + last fat + "est") (fat + "ly") ;
--
-- compoundADeg a =
-- let ad = (a.s ! AAdj Posit)
-- in mkADeg ad ("more" ++ ad) ("most" ++ 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 = <>} ;
--
-- regV cry =
-- let
-- cr = init cry ;
-- y = last cry ;
-- cries = (regN cry).s ! Pl ! Nom ; -- !
-- crie = init cries ;
-- cried = case last crie of {
-- "e" => crie + "d" ;
-- _ => crie + "ed"
-- } ;
-- crying = case y of {
-- "e" => case last cr of {
-- "e" => cry + "ing" ;
-- _ => cr + "ing"
-- } ;
-- _ => cry + "ing"
-- }
-- in mkV cry cries cried cried crying ;
--
-- regDuplV fit =
-- let fitt = fit + last fit in
-- mkV fit (fit + "s") (fitt + "ed") (fitt + "ed") (fitt + "ing") ;
--
-- irregV x y z = let reg = (regV x).s in
-- mkV x (reg ! VPres) y z (reg ! VPresPart) ** {s1 = [] ; lock_V = <>} ;
--
-- irregDuplV fit y z =
-- let
-- fitting = (regDuplV fit).s ! VPresPart
-- in
-- mkV fit (fit + "s") y z fitting ;
--
-- partV v p = verbPart v p ** {lock_V = <>} ;
--
-- mkV2 v p = v ** {s = v.s ; s1 = v.s1 ; c2 = p ; lock_V2 = <>} ;
-- dirV2 v = mkV2 v [] ;
--
-- mkV3 v p q = v ** {s = v.s ; s1 = v.s1 ; c2 = p ; c3 = q ; lock_V3 = <>} ;
-- dirV3 v p = mkV3 v [] p ;
-- dirdirV3 v = dirV3 v [] ;
--
-- mkVS v = v ** {lock_VS = <>} ;
-- mkVV v = v ** {c2 = "to" ; 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 = <>} ;
--
--} ;

View File

@@ -0,0 +1,65 @@
--1 German parameters
--
-- This module defines the parameter types specific to German.
-- Some parameters, such as $Number$, are inherited from $ParamX$.
--
resource ParamGer = ParamX ** {
--2 For $Noun$
-- These are the standard four-value case and three-value gender.
param
Case = Nom | Acc | Dat | Gen ;
Gender = Masc | Fem | Neutr ;
-- Complex $CN$s, like adjectives, have strong and weak forms.
Adjf = Strong | Weak ;
---- Agreement of $NP$ is a record. We'll add $Gender$ later.
--
-- oper
-- Agr = {n : Number ; p : Person} ;
--
-- param
-- Gender = Neutr | Masc | Fem ;
--
----2 For $Verb$
--
---- Only these five forms are needed for open-lexicon verbs.
--
-- param
-- VForm = VInf | VPres | VPast | VPPart | VPresPart ;
--
---- The order of sentence is needed already in $VP$.
--
-- Order = ODir | OQuest ;
--
--
----2 For $Adjective$
--
-- AForm = AAdj Degree | AAdv ;
--
----2 For $Relative$
--
-- RAgr = RNoAg | RAg {n : Number ; p : Person} ;
--
----2 For $Numeral$
--
-- CardOrd = NCard | NOrd ;
-- DForm = unit | teen | ten ;
--
----2 Transformations between parameter types
--
-- oper
-- agrP3 : Number -> Agr = \n ->
-- {n = n ; p = P3} ;
--
-- conjAgr : Agr -> Agr -> Agr = \a,b -> {
-- n = conjNumber a.n b.n ;
-- p = conjPerson a.p b.p
-- } ;
--
}

View File

@@ -0,0 +1,23 @@
concrete PhraseGer of Phrase = CatGer, TenseX ** open ResGer in {
--
-- lin
-- PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
--
-- UttS s = s ;
-- UttQS qs = {s = qs.s ! QDir} ;
-- UttImpSg pol imp = {s = pol.s ++ imp.s ! pol.p ! Sg} ;
-- UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p ! Pl} ;
--
-- UttIP ip = {s = ip.s ! Nom} ; --- Acc also
-- UttIAdv iadv = iadv ;
-- UttNP np = {s = np.s ! Acc} ;
-- UttVP vp = {s = "to" ++ infVP vp (agrP3 Sg)} ;
-- UttAdv adv = adv ;
--
-- NoPConj = {s = []} ;
-- PConjConj conj = conj ;
--
-- NoVoc = {s = []} ;
-- VocNP np = {s = "," ++ np.s ! Nom} ;
--
}

View File

@@ -0,0 +1,54 @@
concrete QuestionGer of Question = CatGer ** open ResGer in {
--
-- flags optimize=all_subs ;
--
-- lin
--
-- QuestCl cl = {
-- s = \\t,a,p =>
-- let cls = cl.s ! t ! a ! p
-- in table {
-- QDir => cls ! OQuest ;
-- QIndir => "if" ++ cls ! ODir
-- } ---- "whether" in ExtGer
-- } ;
--
-- 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 ExtGer
-- 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
-- } ;
--
}

View File

@@ -0,0 +1,34 @@
concrete RelativeGer of Relative = CatGer ** open ResGer in {
--
-- flags optimize=all_subs ;
--
-- lin
--
-- RelCl cl = {
-- s = \\t,a,p,_ => "such" ++ "that" ++ cl.s ! t ! a ! p ! ODir
-- } ;
--
-- RelVP rp vp = {
-- s = \\t,ant,b,ag =>
-- let
-- agr = case rp.a of {
-- RNoAg => ag ;
-- RAg a => a
-- } ;
-- 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 "which" "which" "whose" Sg ** {a = RNoAg} ;
--
}

View File

@@ -0,0 +1,301 @@
--# -path=.:../abstract:../common:prelude
--1 German auxiliary operations.
--
-- This module contains operations that are needed to make the
-- resource syntax work. To define everything that is needed to
-- implement $Test$, it moreover contains regular lexical
-- patterns needed for $Lex$.
--
resource ResGer = ParamGer ** open Prelude in {
flags optimize=all ;
-- For $Lex$.
-- For conciseness and abstraction, we first define a method for
-- generating a case-dependent table from a list of four forms.
oper
caselist : (x1,_,_,x4 : Str) -> Case => Str = \n,a,d,g ->
table {
Nom => n ;
Acc => a ;
Dat => d ;
Gen => g
} ;
-- For each lexical category, here are the worst-case constructors and
-- some practical special cases.
-- More paradigms are given in $ParadigmsGer$.
-- The worst-case constructor for common nouns needs six forms: all plural forms
-- are always the same except for the dative.
Noun : Type = {s : Number => Case => Str ; g : Gender} ;
mkNoun : (x1,_,_,_,_,x6 : Str) -> Gender -> Noun =
\mann, mannen, manne, mannes, maenner, maennern, g -> {
s = table {
Sg => caselist mann mannen manne mannes ;
Pl => caselist maenner maenner maennern maenner
} ;
g = g
} ;
-- But we never need all the six forms at the same time. Often
-- we need just two or four forms.
mkNoun4 : (x1,_,_,x4 : Str) -> Gender -> Noun = \wein,weines,weine,weinen ->
mkNoun wein wein wein weines weine weinen ;
mkNoun2 : (x1,x2 : Str) -> Gender -> Noun = \frau,frauen ->
mkNoun frau frau frau frau frauen frauen ;
--
-- mkAdjective : (_,_,_,_ : Str) -> {s : AForm => Str} =
-- \good,better,best,well -> {
-- s = table {
-- AAdj Posit => good ;
-- AAdj Compar => better ;
-- AAdj Superl => best ;
-- AAdv => well
-- }
-- } ;
--
-- mkVerb : (_,_,_,_,_ : Str) -> {s : VForm => Str} =
-- \go,goes,went,gone,going -> {
-- s = table {
-- VInf => go ;
-- VPres => goes ;
-- VPast => went ;
-- VPPart => gone ;
-- VPresPart => going
-- }
-- } ;
--
-- mkIP : (i,me,my : Str) -> Number -> {s : Case => Str ; n : Number} =
-- \i,me,my,n -> let who = mkNP i me my n P3 in {s = who.s ; n = n} ;
--
-- mkNP : (i,me,my : Str) -> Number -> Person -> {s : Case => Str ; a : Agr} =
-- \i,me,my,n,p -> {
-- s = table {
-- Nom => i ;
-- Acc => me ;
-- Gen => my
-- } ;
-- a = {
-- n = n ;
-- p = p
-- }
-- } ;
--
-- These functions cover many cases; full coverage inflectional patterns are
-- in $MorphoGer$.
--
-- regN : Str -> {s : Number => Case => Str} = \car ->
-- mkNoun car (car + "'s") (car + "s") (car + "s'") ;
--
-- regA : Str -> {s : AForm => Str} = \warm ->
-- mkAdjective warm (warm + "er") (warm + "est") (warm + "ly") ;
--
-- regV : Str -> {s : VForm => Str} = \walk ->
-- mkVerb walk (walk + "s") (walk + "ed") (walk + "ed") (walk + "ing") ;
--
-- regNP : Str -> Number -> {s : Case => Str ; a : Agr} = \that,n ->
-- mkNP that that (that + "'s") n P3 ;
--
-- We have just a heuristic definition of the indefinite article.
-- There are lots of exceptions: consonantic "e" ("euphemism"), consonantic
-- "o" ("one-sided"), vocalic "u" ("umbrella").
--
-- artIndef = pre {
-- "a" ;
-- "an" / strs {"a" ; "e" ; "i" ; "o" ; "A" ; "E" ; "I" ; "O" }
-- } ;
--
-- artDef = "the" ;
--
-- For $Verb$.
--
-- Verb : Type = {
-- s : VForm => Str
-- } ;
--
-- VerbForms : Type =
-- Tense => Anteriority => Polarity => Order => Agr => {fin, inf : Str} ;
--
-- VP : Type = {
-- s : VerbForms ;
-- s2 : Agr => Str
-- } ;
--
-- predV : Verb -> VP = \verb -> {
-- s = \\t,ant,b,ord,agr =>
-- let
-- inf = verb.s ! VInf ;
-- fin = presVerb verb agr ;
-- past = verb.s ! VPast ;
-- part = verb.s ! VPPart ;
-- vf : Str -> Str -> {fin, inf : Str} = \x,y ->
-- {fin = x ; inf = y} ;
-- in
-- case <t,ant,b,ord> of {
-- <Pres,Simul,Pos,ODir> => vf fin [] ;
-- <Pres,Simul,Pos,OQuest> => vf (does agr) inf ;
-- <Pres,Simul,Neg,_> => vf (doesnt agr) inf ;
-- <Pres,Anter,Pos,_> => vf (have agr) part ;
-- <Pres,Anter,Neg,_> => vf (havent agr) part ;
-- <Past,Simul,Pos,ODir> => vf past [] ;
-- <Past,Simul,Pos,OQuest> => vf "did" inf ;
-- <Past,Simul,Neg,_> => vf "didn't" inf ;
-- <Past,Anter,Pos,_> => vf "had" part ;
-- <Past,Anter,Neg,_> => vf "hadn't" part ;
-- <Fut, Simul,Pos,_> => vf "will" inf ;
-- <Fut, Simul,Neg,_> => vf "won't" inf ;
-- <Fut, Anter,Pos,_> => vf "will" ("have" ++ part) ;
-- <Fut, Anter,Neg,_> => vf "won't" ("have" ++ part) ;
-- <Cond,Simul,Pos,_> => vf "would" inf ;
-- <Cond,Simul,Neg,_> => vf "wouldn't" inf ;
-- <Cond,Anter,Pos,_> => vf "would" ("have" ++ part) ;
-- <Cond,Anter,Neg,_> => vf "wouldn't" ("have" ++ part)
-- } ;
-- s2 = \\_ => []
-- } ;
--
-- predAux : Aux -> VP = \verb -> {
-- s = \\t,ant,b,ord,agr =>
-- let
-- inf = verb.inf ;
-- fin = verb.pres ! b ! agr ;
-- past = verb.past ! b ! agr ;
-- part = verb.ppart ;
-- vf : Str -> Str -> {fin, inf : Str} = \x,y ->
-- {fin = x ; inf = y} ;
-- in
-- case <t,ant,b,ord> of {
-- <Pres,Simul,_, _> => vf fin [] ;
-- <Pres,Anter,Pos,_> => vf (have agr) part ;
-- <Pres,Anter,Neg,_> => vf (havent agr) part ;
-- <Past,Simul,_, _> => vf past [] ;
-- <Past,Anter,Pos,_> => vf "had" part ;
-- <Past,Anter,Neg,_> => vf "hadn't" part ;
-- <Fut, Simul,Pos,_> => vf "will" inf ;
-- <Fut, Simul,Neg,_> => vf "won't" inf ;
-- <Fut, Anter,Pos,_> => vf "will" ("have" ++ part) ;
-- <Fut, Anter,Neg,_> => vf "won't" ("have" ++ part) ;
-- <Cond,Simul,Pos,_> => vf "would" inf ;
-- <Cond,Simul,Neg,_> => vf "wouldn't" inf ;
-- <Cond,Anter,Pos,_> => vf "would" ("have" ++ part) ;
-- <Cond,Anter,Neg,_> => vf "wouldn't" ("have" ++ part)
-- } ;
-- s2 = \\_ => []
-- } ;
--
-- insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> {
-- s = vp.s ;
-- s2 = \\a => vp.s2 ! a ++ obj ! a
-- } ;
--
--- This is not functional.
--
-- insertAdV : Str -> VP -> VP = \adv,vp -> {
-- s = vp.s ;
-- s2 = vp.s2
-- } ;
--
-- presVerb : {s : VForm => Str} -> Agr -> Str = \verb ->
-- agrVerb (verb.s ! VPres) (verb.s ! VInf) ;
--
-- infVP : VP -> Agr -> Str = \vp,a ->
-- (vp.s ! Fut ! Simul ! Neg ! ODir ! a).inf ++ vp.s2 ! a ;
--
-- agrVerb : Str -> Str -> Agr -> Str = \has,have,agr ->
-- case agr of {
-- {n = Sg ; p = P3} => has ;
-- _ => have
-- } ;
--
-- have = agrVerb "has" "have" ;
-- havent = agrVerb "hasn't" "haven't" ;
-- does = agrVerb "does" "do" ;
-- doesnt = agrVerb "doesn't" "don't" ;
--
-- Aux = {pres,past : Polarity => Agr => Str ; inf,ppart : Str} ;
--
-- auxBe : Aux = {
-- pres = \\b,a => case <b,a> of {
-- <Pos,{n = Sg ; p = P1}> => "am" ;
-- <Neg,{n = Sg ; p = P1}> => ["am not"] ; --- am not I
-- _ => agrVerb (posneg b "is") (posneg b "are") a
-- } ;
-- past = \\b,a => agrVerb (posneg b "was") (posneg b "were") a ;
-- inf = "be" ;
-- ppart = "been"
-- } ;
--
-- posneg : Polarity -> Str -> Str = \p,s -> case p of {
-- Pos => s ;
-- Neg => s + "n't"
-- } ;
--
-- conjThat : Str = "that" ;
--
-- reflPron : Agr => Str = table {
-- {n = Sg ; p = P1} => "myself" ;
-- {n = Sg ; p = P2} => "yourself" ;
-- {n = Sg ; p = P3} => "itself" ; --
-- {n = Pl ; p = P1} => "ourselves" ;
-- {n = Pl ; p = P2} => "yourselves" ;
-- {n = Pl ; p = P3} => "themselves"
-- } ;
--
-- For $Sentence$.
--
-- Clause : Type = {
-- s : Tense => Anteriority => Polarity => Order => Str
-- } ;
--
-- mkClause : Str -> Agr -> VP -> Clause =
-- \subj,agr,vp -> {
-- s = \\t,a,b,o =>
-- let
-- verb = vp.s ! t ! a ! b ! o ! agr ;
-- compl = vp.s2 ! agr
-- in
-- case o of {
-- ODir => subj ++ verb.fin ++ verb.inf ++ compl ;
-- OQuest => verb.fin ++ subj ++ verb.inf ++ compl
-- }
-- } ;
--
--
-- For $Numeral$.
--
-- mkNum : Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Str} =
-- \two, twelve, twenty, second ->
-- {s = table {
-- unit => table {NCard => two ; NOrd => second} ;
-- teen => \\c => mkCard c twelve ;
-- ten => \\c => mkCard c twenty
-- }
-- } ;
--
-- regNum : Str -> {s : DForm => CardOrd => Str} =
-- \six -> mkNum six (six + "teen") (six + "ty") (regOrd six) ;
--
-- regCardOrd : Str -> {s : CardOrd => Str} = \ten ->
-- {s = table {NCard => ten ; NOrd => regOrd ten}} ;
--
-- mkCard : CardOrd -> Str -> Str = \c,ten ->
-- (regCardOrd ten).s ! c ;
--
-- regOrd : Str -> Str = \ten ->
-- case last ten of {
-- "y" => init ten + "ieth" ;
-- _ => ten + "th"
-- } ;
--
}

View File

@@ -0,0 +1,37 @@
concrete SentenceGer of Sentence = CatGer ** open ResGer in {
--
-- flags optimize=all_subs ;
--
-- lin
-- PredVP np vp = mkClause (np.s ! Nom) np.a vp ;
--
-- PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp ;
--
-- ImpVP vp = {
-- s = \\pol,n =>
-- let
-- agr = {n = n ; p = P2} ;
-- verb = infVP vp agr ;
-- dont = case pol of {
-- Neg => "don't" ;
-- _ => []
-- }
-- in
-- dont ++ verb
-- } ;
--
-- SlashV2 np v2 =
-- mkClause (np.s ! Nom) np.a (predV v2) ** {c2 = v2.c2} ;
--
-- SlashVVV2 np vv v2 =
-- mkClause (np.s ! Nom) np.a (insertObj (\\_ => "to" ++ v2.s ! VInf) (predV 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} ;
--
}

View File

@@ -0,0 +1,41 @@
--concrete SeqConjunctionGer of Conjunction =
-- CatGer ** open ResGer, Coordination, Prelude in {
--
-- lin
--
-- ConjS conj ss = {s = conjunctX conj ss} ;
-- DConjS conj ss = {s = conjunctDistrX conj ss} ;
--
-- ConjAdv conj ss = {s = conjunctX conj ss} ;
-- DConjAdv conj ss = {s = conjunctDistrX conj ss} ;
--
-- ConjNP conj ss = conjunctTable Case conj ss ** {
-- a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p}
-- } ;
-- DConjNP conj ss = conjunctDistrTable Case conj ss ** {
-- a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p}
-- } ;
--
-- ConjAP conj ss = conjunctTable Agr conj ss ** {
-- isPre = ss.isPre
-- } ;
-- DConjAP conj ss = conjunctDistrTable Agr conj ss ** {
-- isPre = ss.isPre
-- } ;
--
-- TwoS = twoSS ;
-- AddS = consSS comma ;
-- TwoAdv = twoSS ;
-- AddAdv = consSS comma ;
-- TwoNP x y = twoTable Case x y ** {a = conjAgr x.a y.a} ;
-- AddNP xs x = consTable Case comma xs x ** {a = conjAgr xs.a x.a} ;
-- TwoAP x y = twoTable Agr x y ** {isPre = andB x.isPre y.isPre} ;
-- AddAP xs x = consTable Agr comma xs x ** {isPre = andB xs.isPre x.isPre} ;
--
-- lincat
-- SeqS = {s1,s2 : Str} ;
-- SeqAdv = {s1,s2 : Str} ;
-- SeqNP = {s1,s2 : Case => Str ; a : Agr} ;
-- SeqAP = {s1,s2 : Agr => Str ; isPre : Bool} ;
--
--}

View File

@@ -0,0 +1,100 @@
--concrete StructuralGer of Structural = CatGer **
-- open MorphoGer, Prelude in {
--
-- flags optimize=all ;
--
-- lin
-- above_Prep = ss "above" ;
-- after_Prep = ss "after" ;
-- all_Predet = ss "all" ;
-- almost_AdA, almost_AdN = ss "almost" ;
-- although_Subj = ss "although" ;
-- always_AdV = ss "always" ;
-- and_Conj = ss "and" ** {n = Pl} ;
-- because_Subj = ss "because" ;
-- before_Prep = ss "before" ;
-- behind_Prep = ss "behind" ;
-- between_Prep = ss "between" ;
-- both7and_DConj = sd2 "both" "and" ** {n = Pl} ;
-- but_PConj = ss "but" ;
-- by8agent_Prep = ss "by" ;
-- by8means_Prep = ss "by" ;
-- can8know_VV = verbPart (mkVerbIrreg "know" "knew" "known") "how"** {c2 = "to"} ;---
-- can_VV = verbGen "manage" ** {c2 = "to"} ; ---
-- during_Prep = ss "during" ;
-- either7or_DConj = sd2 "either" "or" ** {n = Sg} ;
-- everybody_NP = regNP "everybody" Sg ;
-- every_Det = mkDeterminer Sg "every" ;
-- everything_NP = regNP "everything" Sg ;
-- everywhere_Adv = ss "everywhere" ;
-- from_Prep = ss "from" ;
-- he_Pron = mkNP "he" "him" "his" Sg P3 ;
-- here_Adv = ss "here" ;
-- here7to_Adv = ss ["to here"] ;
-- here7from_Adv = ss ["from here"] ;
-- how_IAdv = ss "how" ;
-- how8many_IDet = mkDeterminer Pl ["how many"] ;
-- if_Subj = ss "if" ;
-- in8front_Prep = ss ["in front of"] ;
-- i_Pron = mkNP "I" "me" "my" Sg P1 ;
-- in_Prep = ss "in" ;
-- it_Pron = mkNP "it" "it" "its" Sg P3 ;
-- less_CAdv = ss "less" ;
-- many_Det = mkDeterminer Pl "many" ;
-- more_CAdv = ss "more" ;
-- most_Predet = ss "most" ;
-- much_Det = mkDeterminer Sg "much" ;
-- must_VV = mkVerb4 "have" "has" "had" "had" ** {c2 = "to"} ; ---
-- no_Phr = ss "no" ;
-- on_Prep = ss "on" ;
-- only_Predet = ss "only" ;
-- or_Conj = ss "or" ** {n = Sg} ;
-- otherwise_PConj = ss "otherwise" ;
-- part_Prep = ss "of" ;
-- please_Voc = ss "please" ;
-- possess_Prep = ss "of" ;
-- quite_Adv = ss "quite" ;
-- she_Pron = mkNP "she" "her" "her" Sg P3 ;
-- so_AdA = ss "so" ;
-- somebody_NP = regNP "somebody" Sg ;
-- someSg_Det = mkDeterminer Sg "some" ;
-- somePl_Det = mkDeterminer Pl "some" ;
-- something_NP = regNP "something" Sg ;
-- somewhere_Adv = ss "somewhere" ;
-- that_Quant = mkDeterminer Sg "that" ;
-- that_NP = regNP "that" Sg ;
-- there_Adv = ss "there" ;
-- there7to_Adv = ss "there" ;
-- there7from_Adv = ss ["from there"] ;
-- therefore_PConj = ss "therefore" ;
-- these_Quant = mkDeterminer Pl "these" ;
-- they_Pron = mkNP "they" "them" "their" Pl P3 ;
-- this_Quant = mkDeterminer Sg "this" ;
-- this_NP = regNP "this" Sg ;
-- those_Quant = mkDeterminer Pl "those" ;
-- thou_Pron = mkNP "you" "you" "your" Sg P2 ;
-- through_Prep = ss "through" ;
-- too_AdA = ss "too" ;
-- to_Prep = ss "to" ;
-- under_Prep = ss "under" ;
-- very_AdA = ss "very" ;
-- want_VV = verbGen "want" ** {c2 = "to"} ;
-- we_Pron = mkNP "we" "us" "our" Pl P1 ;
-- whatPl_IP = mkIP "what" "what" "what's" Sg ;
-- whatSg_IP = mkIP "what" "what" "what's" Sg ;
-- when_IAdv = ss "when" ;
-- when_Subj = ss "when" ;
-- where_IAdv = ss "where" ;
-- whichPl_IDet = mkDeterminer Pl ["which"] ;
-- whichSg_IDet = mkDeterminer Sg ["which"] ;
-- whoSg_IP = mkIP "who" "whom" "whose" Sg ;
-- whoPl_IP = mkIP "who" "whom" "whose" Pl ;
-- why_IAdv = ss "why" ;
-- without_Prep = ss "without" ;
-- with_Prep = ss "with" ;
-- ye_Pron = mkNP "you" "you" "your" Pl P2 ;
-- you_Pron = mkNP "you" "you" "your" Sg P2 ;
-- yes_Phr = ss "yes" ;
--
--}
--

View File

@@ -0,0 +1,10 @@
--concrete TensedGer of Tensed = CatGer, TenseX ** open ResGer in {
--
-- flags optimize=all_subs ;
--
-- lin
-- UseCl t a p cl = {s = t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! ODir} ;
-- UseQCl t a p cl = {s = \\q => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! q} ;
-- UseRCl t a p cl = {s = \\r => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! r} ;
--
--}

View File

@@ -0,0 +1,19 @@
--# -path=.:../abstract:../common:prelude
concrete TestGer of Test =
NounGer,
VerbGer,
AdjectiveGer,
AdverbGer,
-- NumeralGer,
SentenceGer,
QuestionGer,
RelativeGer,
ConjunctionGer,
PhraseGer,
UntensedGer,
-- TensedGer,
LexGer
** {
flags startcat = Phr ;
} ;

View File

@@ -0,0 +1,15 @@
concrete UntensedGer of Untensed = CatGer ** open ResGer in {
--
-- flags optimize=all_subs ;
--
-- lin
-- PosCl cl = {s = cl.s ! Pres ! Simul ! Pos ! ODir} ;
-- NegCl cl = {s = cl.s ! Pres ! Simul ! Neg ! ODir} ;
--
-- PosQCl cl = {s = cl.s ! Pres ! Simul ! Pos} ;
-- NegQCl cl = {s = cl.s ! Pres ! Simul ! Neg} ;
--
-- PosRCl cl = {s = cl.s ! Pres ! Simul ! Pos} ;
-- NegRCl cl = {s = cl.s ! Pres ! Simul ! Neg} ;
--
}

View File

@@ -0,0 +1,38 @@
concrete VerbGer of Verb = CatGer ** open ResGer in {
--
-- flags optimize=all_subs ;
--
-- lin
-- UseV = predV ;
-- ComplV2 v np = insertObj (\\_ => v.c2 ++ np.s ! Acc) (predV v) ;
-- ComplV3 v np np2 =
-- insertObj (\\_ => v.c2 ++ np.s ! Acc ++ v.c3 ++ np2.s ! Acc) (predV v) ;
--
-- ComplVV v vp = insertObj (\\a => v.c2 ++ infVP vp a) (predV v) ;
-- ComplVS v s = insertObj (\\_ => conjThat ++ s.s) (predV v) ;
-- ComplVQ v q = insertObj (\\_ => q.s ! QIndir) (predV v) ;
--
-- 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 comp = insertObj comp.s (predAux auxBe) ;
--
-- AdvVP vp adv = insertObj (\\_ => adv.s) vp ;
------ AdVVP adv vp = insertAdV adv.s vp ;
--
-- ReflV2 v = insertObj (\\a => v.c2 ++ reflPron ! a) (predV v) ;
--
-- PassV2 v = {s = \\_ => v.s ! VPPart} ;
--
-- UseVV, UseVS, UseVQ = \vv -> {s = vv.s ; c2 = []} ; -- no "to"
--
-- CompAP ap = ap ;
-- CompNP np = {s = \\_ => np.s ! Acc} ;
-- CompAdv a = {s = \\_ => a.s} ;
--
-- EmbedS s = {s = conjThat ++ s.s} ;
-- EmbedQS qs = {s = qs.s ! QIndir} ;
-- EmbedVP vp = {s = infVP vp (agrP3 Sg)} ; --- agr
--
}