mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-08-22 04:06:23 -06:00
Fix tables, clean popups.
Imagemap on categories is now broken, need to see how to fix
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 166 KiB |
@@ -3,7 +3,7 @@ Aarne Ranta
|
||||
|
||||
|
||||
%!Encoding:utf8
|
||||
%!style(html): ../revealpopup.css
|
||||
%!style(html): revealpopup.css
|
||||
|
||||
%!postproc(tex) : "#BECE" "begin{center}"
|
||||
%!postproc(html) : "#BECE" "<center>"
|
||||
@@ -17,26 +17,26 @@ Also available for [Chinese gf-chinese.html] [Finnish gf-finnish.html] [French g
|
||||
|
||||
#HR
|
||||
|
||||
**Digital grammars** are grammars usable by computers, so that they can mechanically perform
|
||||
**Digital grammars** are grammars usable by computers, so that they can mechanically perform
|
||||
tasks like interpreting, producing, and translating languages. The **GF Resource Grammar Library**
|
||||
(RGL) is a set of digital grammars which, at the time of writing, covers 28 languages. These grammars
|
||||
are written in GF, **Grammatical Framework**, which is a programming language designed for
|
||||
writing digital grammars.
|
||||
writing digital grammars.
|
||||
|
||||
The grammars in the RGL have been written by linguists, computer scientists, and
|
||||
programmers who know the languages thoroughly, both in practice and in theory. Almost 50 persons from
|
||||
around the world have contributed to this work, and ongoing projects are expected to give us many new
|
||||
languages soon.
|
||||
languages soon.
|
||||
|
||||
The leading idea of the RGL is that different languages share large parts of their grammars, despite
|
||||
their observed differences. One important thing that is shared are the **categories**, that is, the
|
||||
types of words and expressions. For instance, every language in RGL has a category of **nouns**, but
|
||||
types of words and expressions. For instance, every language in RGL has a category of **nouns**, but
|
||||
what exactly a noun is varies from language to language. Thus English nouns have four forms
|
||||
(singular and plural, nominative and genitive, as in //house, houses, house's, houses'//)
|
||||
(singular and plural, nominative and genitive, as in //house, houses, house's, houses'//)
|
||||
whereas French nouns have just two forms (singular and plural //maison, maisons//, "house"), but they also
|
||||
have a piece of information that English nouns don't have, namely gender (masculine and feminine).
|
||||
Chinese nouns have just one form (房子 //fangzi// "house"), which is used for both singular and plural, but in
|
||||
addition, a little bit like the French gender, they have a **classifier** (间 //jian// for the word
|
||||
addition, a little bit like the French gender, they have a **classifier** (间 //jian// for the word
|
||||
"house"). German nouns have 8 forms and a gender, Finnish nouns have 26 forms, and so on.
|
||||
|
||||
This document provides a tour of the digital grammars in the RGL. It is intended to serve at least three kinds of readers.
|
||||
@@ -50,8 +50,8 @@ The document has two main parts: **Words** and **Syntax**. Both parts have a **g
|
||||
explaining the RGL structure from a multilingual perspective, followed by a **specific section**,
|
||||
going into the details of the grammar in a particular language. The general sections are the same
|
||||
in all languages. The specific sections differ in length and detail, depending on the complexity of
|
||||
the language and on what aspects are particularly interesting or problematic for the language
|
||||
in question.
|
||||
the language and on what aspects are particularly interesting or problematic for the language
|
||||
in question.
|
||||
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ of their morphological aspects. Details of morphology for each language is given
|
||||
++Main parts of speech: content words++
|
||||
|
||||
The most important categories of words are given in the following table. More precisely, we will give the
|
||||
categories of **content words**, which, so so say, describe things and events in the real world.
|
||||
categories of **content words**, which, so so say, describe things and events in the real world.
|
||||
Content words are distinguished from **structural words**, whose purpose is to combine words into syntactic
|
||||
structures. Each category of content words may have thousands of words, and new words can be introduced
|
||||
continuously; therefore, these categories are also called **open categories**. In contrast, structural
|
||||
@@ -92,10 +92,10 @@ give us a short and precise way to state grammatical rules.
|
||||
|
||||
In addition to the names and examples, the table lists the **inflectional features** and **inherent features**
|
||||
typical of each category. Inflectional features are those that create different forms of words. For instance,
|
||||
French nouns have forms for number (singular and plural) - or, as one often says,
|
||||
French nouns have forms for number (singular and plural) - or, as one often says,
|
||||
French nouns are //inflected for number//. In contrast to number, the gender does not give rise to different forms
|
||||
of French nouns: //maison// ("house") //is// feminine, inherently, and there is no masculine form of //maison//.
|
||||
(Of course, there are some nouns that do have masculine and feminine forms, such as //étudiant, étudiante//
|
||||
(Of course, there are some nouns that do have masculine and feminine forms, such as //étudiant, étudiante//
|
||||
"male/female student", but this only applies to a minority of French nouns and shouldn't be taken as an
|
||||
indication of an inflectional gender.)
|
||||
|
||||
@@ -103,11 +103,11 @@ indication of an inflectional gender.)
|
||||
|
||||
++Syntactic implications++
|
||||
|
||||
The features given in the table are rough indications for what one can expect in different languages. Thus,
|
||||
The features given in the table are rough indications for what one can expect in different languages. Thus,
|
||||
for instance, some languages have no gender at all, and hence their nouns and adjectives won't have
|
||||
genders either. But the table is a rather good generalization from the 28 language of the RGL: we can
|
||||
safely say that, if a language //does// have gender, then nouns have an inherent gender and adjectives have
|
||||
a variable gender. This is not a coincidence but has to do with **syntax**, that is, the combination of words
|
||||
a variable gender. This is not a coincidence but has to do with **syntax**, that is, the combination of words
|
||||
into complex expressions. Thus, for instance, nouns are combined with adjectives that modify them, so that
|
||||
#BECE
|
||||
//blue// + //house// = //blue house//
|
||||
@@ -140,8 +140,8 @@ words depend on each other in combinations.
|
||||
//express logical relations, ontologies, etc//
|
||||
|
||||
The last column in the category table shows the **semantic type** corresponding to each category. This type gives an indication
|
||||
of the kind of meaning that the word of each type has. Starting from the simplest meanings, ``e`` is the type of **entities** that serve as meanings of proper names. Nouns, adjectives, and verbs have the type ``e -> t``, which means
|
||||
**functions from entities to propositions** (where the symbol ``t`` for propositions comes from **truth values**). Such a function can be **applied** to an entity to yield a proposition.
|
||||
of the kind of meaning that the word of each type has. Starting from the simplest meanings, ``e`` is the type of **entities** that serve as meanings of proper names. Nouns, adjectives, and verbs have the type ``e -> t``, which means
|
||||
**functions from entities to propositions** (where the symbol ``t`` for propositions comes from **truth values**). Such a function can be **applied** to an entity to yield a proposition.
|
||||
The type ``t`` itself is reserved for sentences, which are formed in syntax by putting words together.
|
||||
For example, the sentence //Paris is large//
|
||||
involves an application of the adjective //large// to //Paris//, and yields the value true if //large// applies to //Paris//.
|
||||
@@ -153,15 +153,15 @@ refers to an entity but an ``N`` expresses a property of an entity. Of course, t
|
||||
all distinctions of categories: nouns, verbs, and adjectives have the same semantic type, but different syntactic properties.
|
||||
We will occasionally use the **type synonyms** ``n``, ``a``, and ``v`` instead of ``e -> t``, to give a clearer structure to some semantic types. But from the semantic point of view, all these types are one and the same.
|
||||
|
||||
We should notice that the semantic types given here are quite rough and do not give a full picture of the nuances. For instance, many adjectives work in a different way than straightforwardly yielding truth values from entities. An example is
|
||||
the adjective //large//. Being a //large mouse// is different (in terms of absolute size) from being //a large elephant//,
|
||||
We should notice that the semantic types given here are quite rough and do not give a full picture of the nuances. For instance, many adjectives work in a different way than straightforwardly yielding truth values from entities. An example is
|
||||
the adjective //large//. Being a //large mouse// is different (in terms of absolute size) from being //a large elephant//,
|
||||
and a logical type for expressing this is ``n -> e -> t``, with an argument ``n`` indicating the domain of comparison (such as
|
||||
mice or elephants).
|
||||
|
||||
Another problem is that defining
|
||||
verbs as ``e -> t`` suggests that all verbs apply to all kinds of entities. But there are combinations of entities and
|
||||
verbs that make no sense semantically. For example, the verb //sleep// is only meaningful for animate entities, and
|
||||
a sentence like //this book sleeps//, if not senseless, requires some kind of a metaphorical interpretation
|
||||
a sentence like //this book sleeps//, if not senseless, requires some kind of a metaphorical interpretation
|
||||
of //sleep//.
|
||||
|
||||
The following table summarizes the most important semantic types that will be used. We use more primitive types than most traditional approaches, which reduce everything to ``e`` and ``t``. For instance, we can't see any way to reduce the top-level category ``p`` of phrases to these types. From a type-theoretical perspective, ``p`` is the category of **judgements**, whereas
|
||||
@@ -174,10 +174,10 @@ The following table summarizes the most important semantic types that will be us
|
||||
| ``t`` | proposition ("truth value") | //Paris is large// | (primitive)
|
||||
| ``q`` | question | //is Paris large// | (primitive)
|
||||
| ``p`` | top-level phrase | //Paris is large.// | (primitive)
|
||||
| ``n`` | substantive ("noun") | //man// | ``e -> t``
|
||||
| ``a`` | quality ("adjective") | //large// | ``e -> t``
|
||||
| ``v`` | action ("verb") | //sleep// | ``e -> t``
|
||||
| ``np`` | quantifier ("noun phase") | //every man// | ``(e -> t) -> t``
|
||||
| ``n`` | substantive ("noun") | //man// | ``e -> t``
|
||||
| ``a`` | quality ("adjective") | //large// | ``e -> t``
|
||||
| ``v`` | action ("verb") | //sleep// | ``e -> t``
|
||||
| ``np`` | quantifier ("noun phase") | //every man// | ``(e -> t) -> t``
|
||||
|
||||
|
||||
|
||||
@@ -187,8 +187,8 @@ In addition to the features needed for inflection and agreement, the lexicon mus
|
||||
combinations are possible with each word. For most nouns and adjective, this is simple: a noun can be modified
|
||||
by an adjective, for instance, and there is a uniform syntax rule for this. However, there are some nouns and adjectives
|
||||
that are trickier, because they don't correspond to simple things but to **relations**. For instance, //brother// is
|
||||
a **relational noun**, since its primary usage is not alone bur in phrases like //brother of this man//.
|
||||
In the same way, //similar//
|
||||
a **relational noun**, since its primary usage is not alone bur in phrases like //brother of this man//.
|
||||
In the same way, //similar//
|
||||
is a **relational adjective**, since its primary use is in phrases like //similar to this//. The additional
|
||||
term attached to these words is called its **complement**; thus //this// is the complement in //similar to this//.
|
||||
The categories of words that take complements are called **subcategories**. They are morphologically similar to
|
||||
@@ -202,11 +202,11 @@ argument places in semantic types. Thus the number of places
|
||||
is one plus the number of complements, so that the first place is reserved for the subject of a sentence
|
||||
and the rest of the places for the complements.
|
||||
|
||||
The following table shows the categories of relational nouns and adjectives in the RGL. The inflectional and
|
||||
The following table shows the categories of relational nouns and adjectives in the RGL. The inflectional and
|
||||
inherent features are the same as for one-place nouns and adjectives, but for each complement, the lexicon
|
||||
must tell what preposition, if any, is needed to attach that complement. For instance, the preposition for
|
||||
//similar// is //to//, whereas the preposition for //different// is //from//. In languages with richer case
|
||||
systems (such as German, Latin, and Finnish), the complement information also determines the case (genitive,
|
||||
systems (such as German, Latin, and Finnish), the complement information also determines the case (genitive,
|
||||
dative, ablative, and so on).
|
||||
|
||||
|
||||
@@ -220,15 +220,15 @@ dative, ablative, and so on).
|
||||
|
||||
Verbs show a particularly rich variation in subcategorization. The most familiar distinction is the one between
|
||||
**intransitive** and **transitive** verbs: intransitive verbs need only a **subject** (like //she// in //she sleeps//),
|
||||
whereas transitive verbs also need an **object** (like //him// in //she loves him//). Our category ``V`` obviously includes
|
||||
whereas transitive verbs also need an **object** (like //him// in //she loves him//). Our category ``V`` obviously includes
|
||||
intransitive verbs. But there is no category for transitive verbs in the RGL. Instead, we have a more general category of
|
||||
**two-place verbs**, which includes transitive verbs but also verbs that need a preposition (such as //at// in
|
||||
**two-place verbs**, which includes transitive verbs but also verbs that need a preposition (such as //at// in
|
||||
//she looks at him//). Just like for relational nouns and adjectives, the complement of a two-place verb has variations
|
||||
in cases and prepositions.
|
||||
|
||||
The following table shows the subcategories of verbs in the RGL. The list is long but it may still be incomplete. For
|
||||
example, there are no four-place verbs (//she paid him one million pounds for the house//). Such constructions can
|
||||
be built, as we will see later, by using for instance a ``V3`` verb with an additional adverb. But we can envisage
|
||||
be built, as we will see later, by using for instance a ``V3`` verb with an additional adverb. But we can envisage
|
||||
future additions of more subcategories for verbs.
|
||||
|
||||
|
||||
@@ -263,9 +263,9 @@ Semantically, the type ``e -> e -> v -> t`` works for both of them. However, if
|
||||
them, then the two kinds of verbs apply their argument verb to different arguments:
|
||||
- ``promise subj obj verb`` is about the proposition ``verb subj``
|
||||
- ``force subj obj verb`` is about the proposition ``verb obj``
|
||||
|
||||
|
||||
Hence it would make sense to distinguish between subject-control and object-control ``V2V``'s on the category level rather
|
||||
|
||||
Hence it would make sense to distinguish between subject-control and object-control ``V2V``'s on the category level rather
|
||||
than with a complement feature. The agreement behaviour would them become simpler to describe, and, what is more important,
|
||||
the semantic behaviour would be predictable from the category alone.
|
||||
|
||||
@@ -274,7 +274,7 @@ table, //ask// appears in both ``VQ`` and ``V2Q``. Now, these uses are related,
|
||||
the same as to //ask someone something//. But in some other cases, the meaning can be completely different. For instance,
|
||||
//walk// in ``V2`` (as in //I walk the dog//) is different from //walk// in ``V`` (as in //the dog walks//). The ``V2`` is in
|
||||
this case **causative** with respect to the ``V``: I cause the walking of the dog. From the multilingual perspective, it is
|
||||
just a coincidence that English uses the same verb for the intransitive and the causative meanings. In many other languages,
|
||||
just a coincidence that English uses the same verb for the intransitive and the causative meanings. In many other languages,
|
||||
different words would be used. And so would English do for many other verbs: one cannot say //I eat the dog// to express that I make the dog eat; the verb //feed// is used instead.
|
||||
|
||||
|
||||
@@ -287,13 +287,13 @@ We have defined the categories of content along three criteria:
|
||||
- **semantic**: words belonging to the same category must have the same semantic type
|
||||
|
||||
|
||||
Thus morphological criteria are, in most languages, enough to tell apart ``N``, ``A``, ``V``, and ``Adv``.
|
||||
Syntactic criteria are appealed to when distinguishing the subcategories of nouns, adjectives, and verbs.
|
||||
Thus morphological criteria are, in most languages, enough to tell apart ``N``, ``A``, ``V``, and ``Adv``.
|
||||
Syntactic criteria are appealed to when distinguishing the subcategories of nouns, adjectives, and verbs.
|
||||
Semantic criteria are often obeyed as well, although we have noticed that finer distinctions could be useful
|
||||
for subject vs. object control verbs and for different kinds of adjectives.
|
||||
|
||||
For structural words, following the same criteria leads to a high number of categories, higher than in many traditional
|
||||
grammars. Thus, for instance the category of **pronouns** is divided to at least,
|
||||
grammars. Thus, for instance the category of **pronouns** is divided to at least,
|
||||
personal pronouns (//he//), determiners (//this//),
|
||||
interrogative pronouns (//who//), and relative pronouns (//that//). There is no way to see all these classes as subcategories
|
||||
of a uniform class of pronouns, as we did with the verb subcategories: for verbs, there was a uniform
|
||||
@@ -317,21 +317,21 @@ i.e. on how the structural words are actually used for building structures.
|
||||
|
||||
|| GF name | text name | example | inflectional features | inherent features | semantics ||
|
||||
| ``Det`` | determiner | //every// | gender, case | number, definiteness | ``det`` = ``n -> (e -> t) -> t``
|
||||
| ``Quant`` | quantifier | //this// | gender, number, case | definiteness | ``num -> det``
|
||||
| ``Quant`` | quantifier | //this// | gender, number, case | definiteness | ``num -> det``
|
||||
| ``Predet`` | predeterminer | //only// | gender, number, case | (none) | ``np -> np``
|
||||
| ``Pron`` | personal pronoun | //he// | case, possessives | gender, number, person | ``e``
|
||||
|
||||
The most important thing to notice is the distinction between ``Det`` and ``Quant``. The latter covers determiners that have
|
||||
"two forms", for both numbers, such as //this-these// and //that-those//. The former covers determiners with a fixed number,
|
||||
such as //every// (singular).
|
||||
such as //every// (singular).
|
||||
|
||||
|
||||
|
||||
**Building number expressions**
|
||||
|
||||
|| GF name | text name | example | inflectional features | inherent features | semantics ||
|
||||
| ``Num`` | number expression | //five// | gender, case | number | ``num`` = ``det``
|
||||
| ``Card`` | cardinal number | //five// | gender, case | number | ``num`` = ``det``
|
||||
| ``Num`` | number expression | //five// | gender, case | number | ``num`` = ``det``
|
||||
| ``Card`` | cardinal number | //five// | gender, case | number | ``num`` = ``det``
|
||||
| ``Ord`` | ordinal number | //fifth// | gender, number, case | (none) | ``e -> t``
|
||||
| ``Numeral`` | verbal numeral | //five// | gender, case, card/ord | number | ``num``
|
||||
| ``Digits`` | numeral in digits | //511// | card/ord | number | ``num``
|
||||
@@ -344,7 +344,7 @@ such as //every// (singular).
|
||||
**Building interrogatives and relatives**
|
||||
|
||||
|| GF name | text name | example | inflectional features | inherent features | semantics ||
|
||||
| ``IP`` | interrogative pronoun | //who// | case | gender, number | ``(e -> t) -> q``
|
||||
| ``IP`` | interrogative pronoun | //who// | case | gender, number | ``(e -> t) -> q``
|
||||
| ``IDet`` | interrogative determiner | //how many// | gender, case | number | ``n -> (e -> t) -> q``
|
||||
| ``IQuant`` | interrogative quantifier | //which// | gender, number, case | (none) | ``num -> n -> (e -> t) -> q``
|
||||
| ``IAdv`` | interrogative adverb | //why// | (none) | (none) | ``t -> q``
|
||||
@@ -372,10 +372,8 @@ The interrogative pronoun structure replicates a part of the determiner structur
|
||||
|
||||
One more thing to be taken into account is that many of the "structural word categories" also admit of complex
|
||||
expressions and not only words. That is, the RGL has not only words in these categories but also syntactic
|
||||
rules for building more expressions. Thus for instance //these five// is a ``Det`` built from the ``Quant`` //this//
|
||||
and the ``Num`` //five//. It is also common that a "structural word" in a particular language is realized as
|
||||
rules for building more expressions. Thus for instance //these five// is a ``Det`` built from the ``Quant`` //this//
|
||||
and the ``Num`` //five//. It is also common that a "structural word" in a particular language is realized as
|
||||
a feature of the other words it combines with, rather than as a word of its own. For instance,
|
||||
the determiner //the// in Swedish just selects an inflectional form of the noun that it is applied to:
|
||||
"the" + //bil// = //bilen// ("the car").
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ LANGS=$(shell cat $(CONFIG) | cut -d',' -f1,10 | grep ',y' | cut -d',' -f1)
|
||||
SRC_FILES=$(S)/abstract/Common.gf $(S)/abstract/Cat.gf $(S)/api/Constructors.gf $(S)/abstract/Structural.gf $(patsubst %,$S/*/Paradigms%.gf,$(LANGS))
|
||||
|
||||
EXAMPLES_OUT=$(patsubst %,api-examples-%.txt,$(LANGS))
|
||||
INCLUDES=intro.txt categories-intro.txt categories-imagemap.html additional.txt browse.txt example.txt
|
||||
INCLUDES=intro.txt categories-intro.txt categories-imagemap.html categories.png additional.txt browse.txt example.txt
|
||||
|
||||
TMP=tmp.html
|
||||
TEMPLATE=template.html
|
||||
@@ -36,12 +36,13 @@ index.html: index.txt $(TEMPLATE)
|
||||
--to=html5 \
|
||||
--standalone \
|
||||
--template=$(TEMPLATE) \
|
||||
--css=synopsis.css \
|
||||
--css="synopsis.css" \
|
||||
--metadata='title:"GF Resource Grammar Library: Synopsis"' \
|
||||
--variable='rel-root:$(ROOT)/..' \
|
||||
--output=$(TMP) \
|
||||
$@
|
||||
mv $(TMP) $@
|
||||
sed -i.bak "s/<table>/<table class=\"table w-auto\">/" $@ && rm "$@.bak"
|
||||
|
||||
categories.png: categories.dot
|
||||
dot -Tpng $^ > $@
|
||||
|
||||
+12
-15
@@ -41,8 +41,6 @@ main = do
|
||||
writeFile outfile "GF Resource Grammar Library: Synopsis"
|
||||
space
|
||||
append "%!Encoding:utf-8"
|
||||
append "%!style(html): ./revealpopup.css"
|
||||
space
|
||||
append "%!postproc(html): '#divreveal' '<div class=reveal>'"
|
||||
append "%!postproc(html): '#divpopup' '<div class=popup>'"
|
||||
append "%!postproc(html): '#ediv' '</div>'"
|
||||
@@ -54,15 +52,18 @@ main = do
|
||||
append "%!postproc(tex): '#LParadigms' ''"
|
||||
delimit $ addToolTips cs
|
||||
include "intro.txt" -- TODO dynamic language list
|
||||
space
|
||||
title "Categories"
|
||||
space
|
||||
link "Source 1:" commonAPI
|
||||
space
|
||||
link "Source 2:" catAPI
|
||||
space
|
||||
append "==A hierarchic view==\n"
|
||||
stitle "A hierarchic view"
|
||||
space
|
||||
include "categories-intro.txt"
|
||||
append "==Explanations==\n"
|
||||
stitle "Explanations"
|
||||
space
|
||||
delimit $ mkCatTable cs
|
||||
space
|
||||
title "Syntax Rules and Structural Words"
|
||||
@@ -73,11 +74,8 @@ main = do
|
||||
space
|
||||
apiExx <- apiExxFiles >>= getApiExx
|
||||
rs <- getRules apiExx syntaxAPI
|
||||
--- putStrLn $ unlines ["p -cat=" ++ last (words t) ++
|
||||
--- " \"" ++ e ++ "\"" | (_,t,e) <- rs, not (null e)] ----
|
||||
rs2 <- getRules apiExx structuralAPI
|
||||
let rss = rs ++ rs2
|
||||
--- mapM_ putStrLn [f ++ " " ++ e | (f,_,e) <- rss]
|
||||
delimit $ mkSplitTables True apiExx cs rss
|
||||
space
|
||||
-- title "Structural Words"
|
||||
@@ -174,7 +172,7 @@ inChunks i f = concat . intersperse ["\n\n"] . map f . chunks i where
|
||||
-- Adds a subsection header for each table.
|
||||
mkSplitTables :: Bool -> ApiExx -> Cats -> Rules -> [String]
|
||||
mkSplitTables hasEx aexx cs = concatMap t . addLexicalCats cs . sortRules
|
||||
where t (c, xs) = [subtitle c expl] ++ tableOrLink
|
||||
where t (c, xs) = [subtitle c expl, "\n"] ++ tableOrLink
|
||||
where
|
||||
expl = case [e | (n,e,_) <- cs, n == c] of
|
||||
[] -> ""
|
||||
@@ -189,8 +187,8 @@ mkTable :: Bool -> ApiExx -> Cats -> Rules -> [String]
|
||||
mkTable hasEx aexx cs = inChunks chsize (\rs -> header : map (unwords . row) rs)
|
||||
where
|
||||
chsize = 1000
|
||||
header = if hasEx then "|| Function | Type | Example ||"
|
||||
else "|| Function | Type | Explanation ||"
|
||||
header = if hasEx then "|| Function | Type | Example |"
|
||||
else "|| Function | Type | Explanation |"
|
||||
row (name,typ,ex) =
|
||||
let ntyp = mkIdent (name ++ " : " ++ typ) in
|
||||
if hasEx then ["|", name', "|", typ', "|", ex' ntyp, "|"]
|
||||
@@ -230,7 +228,7 @@ mkIdent = concatMap unspec where
|
||||
mkCatTable :: Cats -> [String]
|
||||
mkCatTable cs = inChunks chsize (\rs -> header ++ map mk1 rs) cs
|
||||
where
|
||||
header = ["|| Category | Explanation | Example ||"]
|
||||
header = ["|| Category | Explanation | Example |"]
|
||||
chsize = 1000
|
||||
mk1 (name,expl,ex) = unwords ["|", showCat cs name, "|", expl, "|", typo ex, "|"]
|
||||
typo ex = if take 1 ex == "\"" then itf (init (tail ex)) else ex
|
||||
@@ -272,8 +270,7 @@ stitle s = append $ "==" ++ s ++ "=="
|
||||
include s = append $ "%!include: " ++ s
|
||||
space = append "\n"
|
||||
delimit ss = mapM_ append ss
|
||||
link s f = append $ s ++ " [``" ++ f ++ "`` " ++ fa ++ "]" where
|
||||
fa = "http://www.grammaticalframework.org/lib" ++ dropWhile (=='.') f
|
||||
link s f = append $ s ++ " [``" ++ f ++ "`` " ++ f ++ "]"
|
||||
|
||||
ttf s = "``" ++ s ++ "``"
|
||||
itf s = "//" ++ s ++ "//"
|
||||
@@ -337,5 +334,5 @@ readFileC cod file = do
|
||||
coding file = case language file of
|
||||
"Bul" -> "CP1251" --- "ISO-8859-1"
|
||||
_ -> "utf8"
|
||||
|
||||
language = reverse . take 3 . drop 3 . reverse
|
||||
where
|
||||
language = reverse . take 3 . drop 3 . reverse
|
||||
|
||||
@@ -10,17 +10,17 @@
|
||||
The ``Prelude`` defines commonly used utility functions, in particular for
|
||||
strings and booleans.
|
||||
|
||||
|| Oper | Type | Explanation ||
|
||||
|| 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
|
||||
| ``andB`` | ``(_,_ : Bool) -> Bool`` | conjunction
|
||||
| ``orB`` | ``(_,_ : Bool) -> Bool`` | disjunction
|
||||
| ``notB`` | ``Bool -> Bool`` | negation
|
||||
| ``if_then_else`` | ``(A:Type)->Bool->A->A->A`` | conditional
|
||||
| ``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
|
||||
@@ -30,7 +30,7 @@ strings and booleans.
|
||||
|
||||
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 ||
|
||||
|| Oper | Type | Explanation |
|
||||
| ``PBool`` | ``PType`` | ``PTrue | PFalse``
|
||||
| ``Error`` | ``Type`` | the empty type
|
||||
| ``Integer`` | ``Type`` | the type of integers
|
||||
@@ -57,7 +57,7 @@ These functions are hard-coded in GF. They are available without explicit openin
|
||||
This module is used for defining formal languages, in particular ones that
|
||||
use precedence levels and parentheses for grouping subexpressions.
|
||||
|
||||
|| Oper | Type | Explanation ||
|
||||
|| Oper | Type | Explanation |
|
||||
| ``Prec`` | ``PType`` | precedence levels 0..4
|
||||
| ``TermPrec`` | ``Type`` | string with precedence
|
||||
| ``mkPrec`` | ``Prec -> Str -> TermPrec`` | construct a ``TermPrec``
|
||||
@@ -75,7 +75,7 @@ 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 ||
|
||||
|| Function | Type | Explanation |
|
||||
| ``symb`` | ``Str -> NP`` | //x//
|
||||
| ``symb`` | ``Int -> NP`` | //23//
|
||||
| ``symb`` | ``Float -> NP`` | //0.99//
|
||||
@@ -89,10 +89,10 @@ languages.
|
||||
|
||||
==The Combinators module==
|
||||
|
||||
This module gives shortcuts for defining predicates (``pred``) and function
|
||||
This module gives shortcuts for defining predicates (``pred``) and function
|
||||
expressions (``app``). It works for all resource languages.
|
||||
|
||||
|| Function | Type | Example ||
|
||||
|| Function | Type | Explanation |
|
||||
| ``pred`` | ``V -> NP -> Cl`` | //x converges//
|
||||
| ``pred`` | ``V2 -> NP -> NP -> Cl`` | //x intersects y//
|
||||
| ``pred`` | ``V -> NP -> NP -> Cl`` | //x and y intersect//
|
||||
@@ -100,7 +100,7 @@ expressions (``app``). It works for all resource languages.
|
||||
| ``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`` | ``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//
|
||||
@@ -111,5 +111,3 @@ expressions (``app``). It works for all resource languages.
|
||||
| ``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//
|
||||
|
||||
|
||||
|
||||
@@ -8,12 +8,10 @@ of //C// that takes //D// as an argument. What the constructors exactly are,
|
||||
and what other arguments they take, is described by separate tables for
|
||||
each category.
|
||||
|
||||
| [categories.png] |
|
||||
[categories.png]
|
||||
|
||||
%!include(html): ''categories-imagemap.html''
|
||||
|
||||
|
||||
The rectangular boxes mark open lexical categories, which have constructors
|
||||
also in the ``Paradigms`` modules.
|
||||
|
||||
|
||||
|
||||
+5
-14
@@ -53,20 +53,20 @@ The main contents are:
|
||||
- [Chapter 1 #toc2]: categories, with links to the functions for
|
||||
constructing trees in them.
|
||||
- [Chapter 2 #toc5]: syntactic construction functions, with cross-links and
|
||||
examples.
|
||||
examples.
|
||||
- [Chapter 3 #toc85]: morphological paradigms.
|
||||
- [Chapter 4 #toc120]: additional libraries.
|
||||
- [Chapter 5 #toc126]: how to "browse" the library by
|
||||
- [Chapter 5 #toc126]: how to "browse" the library by
|
||||
loading the grammars into the ``gf`` command editor.
|
||||
- [Chapter 6 #toc127]: a brief example of how application grammars can
|
||||
use the resource modules.
|
||||
use the resource modules.
|
||||
- [Detailed table of contents #toc128].
|
||||
|
||||
|
||||
Other relevant documents:
|
||||
- [The RGL Status Document ./status.html]: the current status of different languages
|
||||
and the authors of each grammar
|
||||
- [The Resource Grammar Library coverage map http://www.postcrashgames.com/gf_world/]
|
||||
- [The Resource Grammar Library coverage map http://www.postcrashgames.com/gf_world/]
|
||||
- [RGL Documentation and Publications ./rgl-publications.html]: links to publications and other documentation
|
||||
- [More modules gfdoc/sources.html]: extra modules, dictionaries, and
|
||||
the internals of the resource grammar
|
||||
@@ -84,16 +84,7 @@ abstract functions and their Universal Dependency labels
|
||||
[PDF http://elanguage.net/journals/index.php/lilt/article/viewFile/214/158]
|
||||
- Paper "Grammars as Software Libraries" by A. Ranta
|
||||
(In Y. Bertot, G. Huet, J-J. Lévy, and G. Plotkin (eds.),
|
||||
//From Semantics to Computer Science//, Cambridge University Press,
|
||||
//From Semantics to Computer Science//, Cambridge University Press,
|
||||
Cambridge, pp. 281--308, 2009).
|
||||
The library from a software engineering point of view.
|
||||
[PDF http://www.cse.chalmers.se/~aarne/old/articles/libraries-kahn.pdf]
|
||||
|
||||
|
||||
Many examples in [Chapter 2 #toc5] can be seen in multiple languages by hovering the
|
||||
mouse over the example, as shown in the following screenshot:
|
||||
|
||||
[hovering.png]
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/* Quick links */
|
||||
|
||||
#quicklinks {
|
||||
line-height: 130%;
|
||||
line-height: 140%;
|
||||
}
|
||||
|
||||
#quicklinks.sidebar {
|
||||
@@ -11,3 +13,23 @@
|
||||
#quicklinks a {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Reveal popup */
|
||||
|
||||
.popup {
|
||||
display: none;
|
||||
background: #ffffccee;
|
||||
border: 1px solid #dee2e6;
|
||||
padding: 1em 1em 1em 0;
|
||||
}
|
||||
|
||||
.reveal:hover .popup {
|
||||
display: block;
|
||||
position: absolute;
|
||||
margin: 0 1em;
|
||||
}
|
||||
|
||||
/* General */
|
||||
.table td, .table th {
|
||||
padding: 0.5em .75rem;
|
||||
}
|
||||
|
||||
@@ -13,10 +13,10 @@ $if(keywords)$
|
||||
<meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" />
|
||||
$endif$
|
||||
<title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
|
||||
$for(css)$
|
||||
<link rel="stylesheet" href="$css$" />
|
||||
$endfor$
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
|
||||
$if(math)$
|
||||
$math$
|
||||
$endif$
|
||||
|
||||
Reference in New Issue
Block a user