updated Synopsis with Afrikaans, Punjabi, and additional modules

This commit is contained in:
aarne
2011-05-06 09:00:07 +00:00
parent f0bd6dc69f
commit 6028088291
6 changed files with 1692 additions and 586 deletions

View File

@@ -17,6 +17,7 @@ abstract:
exx-script:
runghc MkExx.hs <api-examples.txt >api-examples.gfs
exx: exx-script
gf -retain -s ../alltenses/TryAfr.gfo <api-examples.gfs >api-examples-Afr.txt
gf -retain -s ../alltenses/TryBul.gfo <api-examples.gfs >api-examples-Bul.txt
gf -retain -s ../alltenses/TryCat.gfo <api-examples.gfs >api-examples-Cat.txt
gf -retain -s ../alltenses/TryDan.gfo <api-examples.gfs >api-examples-Dan.txt
@@ -27,6 +28,7 @@ exx: exx-script
gf -retain -s ../alltenses/TryGer.gfo <api-examples.gfs >api-examples-Ger.txt
gf -retain -s ../alltenses/TryIta.gfo <api-examples.gfs >api-examples-Ita.txt
gf -retain -s ../alltenses/TryNor.gfo <api-examples.gfs >api-examples-Nor.txt
gf -retain -s ../alltenses/TryPnb.gfo <api-examples.gfs >api-examples-Pnb.txt
gf -retain -s ../alltenses/TryPol.gfo <api-examples.gfs >api-examples-Pol.txt
gf -retain -s ../alltenses/TryRon.gfo <api-examples.gfs >api-examples-Ron.txt
gf -retain -s ../alltenses/TryRus.gfo <api-examples.gfs >api-examples-Rus.txt

View File

@@ -17,7 +17,7 @@ revealedLang = "Eng"
-- all languages shown
apiExxFiles = ["api-examples-" ++ lang ++ ".txt" | lang <- words
"Bul Cat Dan Dut Eng Fin Fre Ger Ita Nor Pol Ron Rus Spa Swe Urd"]
"Afr Bul Cat Dan Dut Eng Fin Fre Ger Ita Nor Pnb Pol Ron Rus Spa Swe Urd"]
main = do
xx <- getArgs
@@ -80,6 +80,8 @@ main = do
title "Lexical Paradigms"
mapM_ (putParadigms isLatex cs) paradigmFiles
space
include "synopsis-additional.txt"
space
include "synopsis-browse.txt"
space
title "An Example of Usage"
@@ -234,6 +236,7 @@ catAPI = srcPath "/abstract/Cat.gf"
syntaxAPI = srcPath "/api/Constructors.gf"
structuralAPI = srcPath "/abstract/Structural.gf"
paradigmFiles = [
("Afrikaans", srcPath "/afrikaans/ParadigmsAfr.gf"),
("Bulgarian", srcPath "/bulgarian/ParadigmsBul.gf"),
("Catalan", srcPath "/catalan/ParadigmsCat.gf"),
("Danish", srcPath "/danish/ParadigmsDan.gf"),
@@ -246,6 +249,7 @@ paradigmFiles = [
("Italian", srcPath "/italian/ParadigmsIta.gf"),
("Norwegian", srcPath "/norwegian/ParadigmsNor.gf"),
("Polish", srcPath "/polish/ParadigmsPol.gf"),
("Punjabi", srcPath "/punjabi/ParadigmsPnb.gf"),
("Romanian", srcPath "/romanian/ParadigmsRon.gf"),
("Russian", srcPath "/russian/ParadigmsRus.gf"),
("Spanish", srcPath "/spanish/ParadigmsSpa.gf"),

View File

@@ -0,0 +1,115 @@
=Additional Libraries=
==The Prelude module==
The ``Prelude`` defines commonly used utility functions, in particular for
strings and booleans.
|| Oper | Type | Explanation ||
| ``SS`` | ``Type`` | the type ``{s : Str}``
| ``ss`` | ``Str -> SS`` | record from string
| ``nonExist`` | ``Str`` | missing form
| ``optStr`` | ``Str -> Str`` | optional string
| ``bothWays`` | ``(x,y : Str) -> Str`` | either ``x ++ y`` or ``y ++ x``
| ``Bool`` | ``PType`` | values ``True`` and ``False``
| ``andB`` | ``(_,_ : Bool) -> Bool`` | conjunction
| ``orB`` | ``(_,_ : Bool) -> Bool`` | disjunction
| ``notB`` | ``Bool -> Bool`` | negation
| ``if_then_else`` | ``(A:Type)->Bool->A->A->A`` | conditional
| ``init`` | ``Str -> Str`` | drop last character
| ``last`` | ``Str -> Str`` | return last character
| ``glue`` | ``Str -> Str -> Str`` | glue tokens together
==The Predefined module==
These functions are hard-coded in GF. They are available without explicit opening, by the used of qualified names, e.g. ``Predef.tk``.
|| operation | type | explanation ||
| ``PBool`` | ``PType`` | ``PTrue | PFalse``
| ``Error`` | ``Type`` | the empty type
| ``Integer`` | ``Type`` | the type of integers
| ``Ints`` | ``Integer -> Type`` | integers from 0 to n
| ``error`` | ``Str -> Error`` | forms error message
| ``length`` | ``Str -> Int`` | length of string
| ``drop`` | ``Integer -> Str -> Str`` | drop prefix of length
| ``take`` | ``Integer -> Str -> Str`` | take prefix of length
| ``tk`` | ``Integer -> Str -> Str`` | drop suffix of length
| ``dp`` | ``Integer -> Str -> Str`` | take suffix of length
| ``eqInt`` | ``Integer -> Integer -> PBool`` | test if equal integers
| ``lessInt`` | ``Integer -> Integer -> PBool`` | test order of integers
| ``plus`` | ``Integer -> Integer -> Integer`` | add integers
| ``eqStr`` | ``Str -> Str -> PBool`` | test if equal strings
| ``occur`` | ``Str -> Str -> PBool`` | test if occurs as substring
| ``occurs`` | ``Str -> Str -> PBool`` | test if any char occurs
| ``show`` | ``(P : Type) -> P -> Str`` | convert param to string
| ``toStr`` | ``(L : Type) -> L -> Str`` | find the "first" string
==The Formal module==
This module is used for defining formal languages, in particular ones that
use precedence levels and parentheses for grouping subexpressions.
|| Oper | Type | Explanation ||
| ``Prec`` | ``PType`` | precedence levels 0..4
| ``TermPrec`` | ``Type`` | string with precedence
| ``mkPrec`` | ``Prec -> Str -> TermPrec`` | construct a ``TermPrec``
| ``top`` | ``TermPrec -> Str`` | top term (lowest prec.)
| ``constant`` | ``Str -> TermPrec`` | atomic (highest prec.)
| ``infixl`` | ``Prec->Str->(_,_:TermPrec)->TermPrec`` | left-assoc. infix
| ``infixr`` | ``Prec->Str->(_,_:TermPrec)->TermPrec`` | right-assoc. infix
| ``infixn`` | ``Prec->Str->(_,_:TermPrec)->TermPrec`` | non-assoc. infix
| ``usePrec`` | ``Prec -> TermPrec -> Str`` | use term on given level
==The Symbolic module==
This module is used for embedding symbolic notation in natural-language
text constructed by the resource grammar API. It works for all resource
languages.
|| Function | Type | Example ||
| ``symb`` | ``Str -> NP`` | //x//
| ``symb`` | ``Int -> NP`` | //23//
| ``symb`` | ``Float -> NP`` | //0.99//
| ``symb`` | ``CN -> Numeral -> NP`` | //level four//
| ``symb`` | ``Det -> N+ -> Numeral -> NP`` | //the level four//
| ``symb`` | ``Det -> CN -> [Symb] -> NP`` | //the levels i, j and k//
| ``symb`` | ``Symb -> S`` | //A// (formula)
| ``symb`` | ``Symb -> Card`` | //n// (number)
| ``mkSymb`` | ``Str -> Symb`` | //x//
==The Combinators module==
This module gives shortcuts for defining predicates (``pred``) and function
expressions (``app``). It works for all resource languages.
|| Function | Type | Example ||
| ``pred`` | ``V -> NP -> Cl`` | //x converges//
| ``pred`` | ``V2 -> NP -> NP -> Cl`` | //x intersects y//
| ``pred`` | ``V -> NP -> NP -> Cl`` | //x and y intersect//
| ``pred`` | ``A -> NP -> Cl`` | //x is even//
| ``pred`` | ``A2 -> NP -> NP -> Cl`` | //x is divisible by y//
| ``pred`` | ``A -> NP -> NP -> Cl`` | //x and y are equal//
| ``pred`` | ``N -> NP -> Cl`` | //x is a maximum//
| ``pred`` | ``N -> NP -> NP -> Cl`` | //x and y are inverses//
| ``pred`` | ``Adv -> NP -> Cl`` | //x is in scope//
| ``pred`` | ``Prep -> NP -> NP -> Cl`` | //x is outside y//
| ``app`` | ``N -> NP`` | //the bottom//
| ``app`` | ``N2 -> NP -> NP`` | //the successor of x//
| ``app`` | ``N3 -> NP -> NP -> NP`` | //the distance from x to y//
| ``app`` | ``N2 -> NP -> NP -> NP`` | //the sum of x and y//
| ``app`` | ``N2 -> N -> CN`` | //set of integers//
| ``app`` | ``N2 -> NP -> CN`` | //divisor of x//
| ``app`` | ``N3 -> NP -> NP -> CN`` | //path from x to y//
| ``app`` | ``N2 -> NP -> NP -> CN`` | //path between x and y//

View File

@@ -7,28 +7,17 @@
**New**: Browsing by syntax editor
[directly on the web ../../../demos/resource-api/editor.html].
All of the following assume
```
cd $GF_LIB_PATH
```
All of the following assume that
``GF_LIB_PATH`` points to the directory ``GF/lib`` with compiled libraries.
To try out inflection paradigms:
```
> i -path=alltenses -retain alltenses/ParadigmsGer.gfo
> i -retain alltenses/ParadigmsGer.gfo
> cc mkN "Farbe"
```
To try out overloaded syntax, test lexicon, and inflection paradigms:
```
> i -path=alltenses -retain alltenses/TryGer.gfo
> i -retain alltenses/TryGer.gfo
> cc mkCl (mkNP this_Quant (mkN "Farbe")) (mkA "dunkel")
```
% To look for a syntax tree in the overload API by parsing:
% ```
% > i -path=alltenses alltenses/OverLangEng.gf
% > p -cat=S -overload "this grammar is too big"
% ```
% To view linearizations in all languages by parsing from English:
% ```
% > i alltenses/langs.gfcm
% > p -cat=S -lang=LangEng "this grammar is too big" | tb
% ```

View File

@@ -23,11 +23,12 @@ constructing trees in them.
- [Chapter 2 #toc5]: syntactic construction functions, with cross-links and
examples.
- [Chapter 3 #toc83]: morphological paradigms.
- [Chapter 4 #toc100]: how to "browse" the library by
- [Chapter 4 #toc102]: additional libraries.
- [Chapter 5 #toc108]: how to "browse" the library by
loading the grammars into the ``gf`` command editor.
- [Chapter 5 #toc101]: a brief example of how application grammars can
- [Chapter 6 #toc109]: a brief example of how application grammars can
use the resource modules.
- [Detailed table of contents #toc102].
- [Detailed table of contents #toc110].
Many examples in [Chapter 2 #toc5] can be seen in multiple languages by hovering the

File diff suppressed because it is too large Load Diff