Author: Last update: Fri Jan 20 18:01:40 2006
Produced by gfdoc - a rudimentary GF document generator. (c) Aarne Ranta (aarne@cs.chalmers.se) 2002 under GNU GPL.
==
# -path=.:../abstract:../../prelude
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 MorphoEng.gf is that the types
referred to are compiled resource grammar types. We have moreover
had the design principle of always having existing forms, rather
than stems, as string arguments of the paradigms.
The structure of functions for each word class C is the following:
first we give a handful of patterns that aim to cover all
regular cases. Then we give a worst-case function mkC, which serves as an
escape to construct the most irregular words of type C.
However, this function should only seldom be needed: we have a
separate module IrregularEng, which covers all irregularly inflected
words.
The following modules are presupposed:
resource ParadigmsEng = open
(Predef=Predef),
Prelude,
MorphoEng,
CatEng
in {
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 ;
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 ;
All the functions above work quite as well to form compound nouns, such as baby boom.
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 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 ;
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 ;
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 ;
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 ;
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 ;
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 ;
A preposition as used for rection in the lexicon, as well as to
build PPs in the resource API, just requires a string.
mkPreposition : Str -> Preposition ;
mkPrep : Str -> Prep ;
(These two functions are synonyms.)
Except for be, the worst case needs five forms: the infinitive and the third person singular present, the past indicative, and the past and present participles.
mkV : (go, goes, went, gone, going : Str) -> V ;
The regular verb function recognizes the special cases where the last character is y (cry - cries but buy - buys) or s, sh, x, z (fix - fixes, etc).
regV : Str -> V ;
The following variant duplicates the last letter in the forms like rip - ripped - ripping.
regDuplV : Str -> V ;
There is an extensive list of irregular verbs in the module IrregularEng.
In practice, it is enough to give three forms,
e.g. drink - drank - drunk, with a variant indicating consonant
duplication in the present participle.
irregV : (drink, drank, drunk : Str) -> V ;
irregDuplV : (get, got, gotten : Str) -> V ;
The particle, such as in switch on, is given as a string.
partV : V -> Str -> V ;
By default, verbs are not reflexive; this function makes them that.
reflV : V -> V ;
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 ;
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,_,_
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 ;
The definitions should not bother the user of the API. So they are hidden from the document.