1
0
forked from GitHub/gf-core

resource = resource-1.0

This commit is contained in:
aarne
2006-06-22 22:25:55 +00:00
parent 7e5584b1ab
commit 251bc4c738
881 changed files with 31130 additions and 31130 deletions

View File

@@ -1,10 +1,10 @@
--# -path=.:../romance:../abstract:../../prelude
--# -path=.:../romance:../common:../abstract:../../prelude
--1 French Lexical Paradigms
--
-- Aarne Ranta 2003
-- Aarne Ranta 2001 - 2006
--
-- This is an API to the user of the resource grammar
-- This is an API for the user of the resource grammar
-- for adding lexical items. It gives functions for forming
-- expressions of open categories: nouns, adjectives, verbs.
--
@@ -21,13 +21,19 @@
-- 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:
-- separate module [``IrregFre`` ../../french/IrregFre.gf],
-- which covers all irregularly inflected verbs.
resource ParadigmsFre =
open (Predef=Predef), Prelude, TypesFre, MorphoFre, SyntaxFre, RulesFre in {
open
(Predef=Predef),
Prelude,
CommonRomance,
ResFre,
MorphoFre,
CatFre in {
flags optimize=all ;
--2 Parameters
--
@@ -51,13 +57,11 @@ oper
-- amalgamate with the following word (the 'genitive' "de" and the
-- 'dative' "à").
Preposition : Type ;
accusative : Prep ;
genitive : Prep ;
dative : Prep ;
accusative : Preposition ;
genitive : Preposition ;
dative : Preposition ;
mkPreposition : Str -> Preposition ;
mkPrep : Str -> Prep ;
--2 Nouns
@@ -66,13 +70,20 @@ oper
mkN : (oeil,yeux : Str) -> Gender -> N ;
-- The regular function takes the singular form and the gender,
-- and computes the plural by a heuristic. The heuristic currently
-- The regular function takes the singular form,
-- and computes the plural and the gender by a heuristic. The plural
-- heuristic currently
-- covers the cases "pas-pas", "prix-prix", "nez-nez",
-- "bijou-bijoux", "cheveu-cheveux", "plateau-plateaux", "cheval-chevaux".
-- The gender heuristic is less reliable: it treats as feminine all
-- nouns ending with "e" and "ion", all others as masculine.
-- If in doubt, use the $cc$ command to test!
regN : Str -> Gender -> N ;
regN : Str -> N ;
-- Adding gender information widens the scope of the foregoing function.
regGenN : Str -> Gender -> N ;
--3 Compound nouns
@@ -89,7 +100,7 @@ oper
--
-- Relational nouns ("fille de x") need a case and a preposition.
mkN2 : N -> Preposition -> N2 ;
mkN2 : N -> Prep -> N2 ;
-- The most common cases are the genitive "de" and the dative "à",
-- with the empty preposition.
@@ -99,13 +110,13 @@ oper
-- Three-place relational nouns ("la connection de x à y") need two prepositions.
mkN3 : N -> Preposition -> Preposition -> N3 ;
mkN3 : N -> Prep -> Prep -> N3 ;
--3 Relational common noun phrases
--
-- In some cases, you may want to make a complex $CN$ into a
-- relational noun (e.g. "the old town hall of"). However, $N2$ and
-- relational noun (e.g. "la vieille église de"). However, $N2$ and
-- $N3$ are purely lexical categories. But you can use the $AdvCN$
-- and $PrepNP$ constructions to build phrases like this.
@@ -114,7 +125,10 @@ oper
--
-- Proper names need a string and a gender.
mkPN : Str -> Gender -> PN ; -- Jean
mkPN : Str -> Gender -> PN ; -- Jean
regPN : Str -> PN ; -- feminine if "-e", masculine otherwise
-- To form a noun phrase that can also be plural,
-- you can use the worst-case function.
@@ -147,33 +161,24 @@ oper
--
-- Two-place adjectives need a preposition for their second argument.
mkA2 : A -> Preposition -> A2 ;
mkA2 : A -> Prep -> A2 ;
--3 Comparison adjectives
-- Comparison adjectives are in the worst case put up from two
-- adjectives: the positive ("bon"), and the comparative ("meilleure").
mkADeg : A -> A -> ADeg ;
mkADeg : A -> A -> A ;
-- If comparison is formed by "plus", as usual in French,
-- the following pattern is used:
compADeg : A -> ADeg ;
-- The regular pattern is the same as $regA$ for plain adjectives,
-- with comparison by "plus".
regADeg : Str -> ADeg ;
-- From a given $ADeg$, it is possible to get back to $A$.
adegA : ADeg -> A ;
compADeg : A -> A ;
-- For prefixed adjectives, the following function is
-- provided.
prefADeg : ADeg -> ADeg ;
prefA : A -> A ;
--2 Adverbs
@@ -213,16 +218,17 @@ oper
reg3V : (jeter,jette,jettera : Str) -> V ;
-- The function $regV$ gives all verbs the compound auxiliary "avoir".
-- To change it to "être", use the following function.
-- To change it to "être", use the following function. Reflexive implies "être".
etreV : V -> V ;
reflV : V -> V ;
--3 Two-place verbs
--
-- Two-place verbs need a preposition, except the special case with direct object.
-- (transitive verbs). Notice that a particle comes from the $V$.
-- (transitive verbs).
mkV2 : V -> Preposition -> V2 ;
mkV2 : V -> Prep -> V2 ;
dirV2 : V -> V2 ;
@@ -235,9 +241,9 @@ oper
-- Three-place (ditransitive) verbs need two prepositions, of which
-- the first one or both can be absent.
mkV3 : V -> Preposition -> Preposition -> V3 ; -- parler, à, de
dirV3 : V -> Preposition -> V3 ; -- donner,_,à
dirdirV3 : V -> V3 ; -- donner,_,_
mkV3 : V -> Prep -> Prep -> V3 ; -- parler, à, de
dirV3 : V -> Prep -> V3 ; -- donner,_,à
dirdirV3 : V -> V3 ; -- donner,_,_
--3 Other complement patterns
--
@@ -246,100 +252,129 @@ oper
mkV0 : V -> V0 ;
mkVS : V -> VS ;
mkV2S : V -> Preposition -> V2S ;
mkV2S : V -> Prep -> V2S ;
mkVV : V -> VV ; -- plain infinitive: "je veux parler"
deVV : V -> VV ; -- "j'essaie de parler"
aVV : V -> VV ; -- "j'arrive à parler"
mkV2V : V -> Preposition -> Preposition -> V2V ;
mkV2V : V -> Prep -> Prep -> V2V ;
mkVA : V -> VA ;
mkV2A : V -> Preposition -> V2A ;
mkV2A : V -> Prep -> Prep -> V2A ;
mkVQ : V -> VQ ;
mkV2Q : V -> Preposition -> V2Q ;
mkV2Q : V -> Prep -> V2Q ;
mkAS : A -> AS ;
subjAS : A -> AS ;
mkA2S : A -> Preposition -> A2S ;
mkAV : A -> Preposition -> AV ;
mkA2V : A -> Preposition -> Preposition -> A2V ;
mkAS : A -> AS ;
mkA2S : A -> Prep -> A2S ;
mkAV : A -> Prep -> AV ;
mkA2V : A -> Prep -> Prep -> A2V ;
-- Notice: categories $V2S, V2V, 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, V2Q : Type ;
AS, A2S, AV, A2V : Type ;
--.
--2 Definitions of the paradigms
--
-- The definitions should not bother the user of the API. So they are
-- hidden from the document.
--.
Gender = SyntaxFre.Gender ;
Number = TypesFre.Number ;
Gender = MorphoFre.Gender ;
Number = MorphoFre.Number ;
masculine = Masc ;
feminine = Fem ;
singular = Sg ;
plural = Pl ;
Preposition = Case * Str ;
accusative = <Acc,[]> ;
genitive = <Gen,[]> ;
dative = <Dat,[]> ;
mkPreposition p = <Acc,p> ;
Preposition = Compl ;
accusative = complAcc ** {lock_Prep = <>} ;
genitive = complGen ** {lock_Prep = <>} ;
dative = complDat ** {lock_Prep = <>} ;
mkPrep p = {s = p ; c = Acc ; isDir = False ; lock_Prep = <>} ;
--- obsolete
Preposition : Type ;
mkPreposition : Str -> Preposition ;
mkPreposition = mkPrep ;
mkN x y g = mkCNomIrreg x y g ** {lock_N = <>} ;
regN x g = mkNomReg x g ** {lock_N = <>} ;
regN x = regGenN x g where {
g = case <x : Str> of {
_ + ("e" | "ion") => Fem ;
_ => Masc
}
} ;
regGenN x g = mkNomReg x g ** {lock_N = <>} ;
compN x y = {s = \\n => x.s ! n ++ y ; g = x.g ; lock_N = <>} ;
mkN2 = \n,p -> n ** {lock_N2 = <> ; c = p.p1 ; s2 = p.p2} ;
mkN2 = \n,p -> n ** {lock_N2 = <> ; c2 = p} ;
deN2 n = mkN2 n genitive ;
aN2 n = mkN2 n dative ;
mkN3 = \n,p,q -> n ** {lock_N3 = <> ; c = p.p1 ; s2 = p.p2 ; c3 = q.p1 ; s3 = q.p2} ;
mkN3 = \n,p,q -> n ** {lock_N3 = <> ; c2 = p ; c3 = q} ;
regPN x = mkPN x g where {
g = case last x of {
"e" => feminine ;
_ => masculine
}
} ;
mkPN x g = {s = x ; g = g} ** {lock_PN = <>} ;
mkNP x g n = let np = mkNameNounPhrase x g in
{s = np.s ; g = np.g ; p = np.p ; c = np.c ; n = n ; lock_NP = <>} ;
mkNP x g n = {s = (pn2np (mkPN x g)).s; a = agrP3 g n ; hasClit = False} ** {lock_NP = <>} ;
mkA a b c d = mkAdj a c b d ** {p = False ; lock_A = <>} ;
regA a = mkAdjReg a ** {p = False ; lock_A = <>} ;
prefA a = {s = a.s ; p = True ; lock_A = <>} ;
mkA a b c d = compADeg {s = \\_ => (mkAdj a c b d).s ; isPre = False ; lock_A = <>} ;
regA a = compADeg {s = \\_ => (mkAdjReg a).s ; isPre = False ; lock_A = <>} ;
prefA a = {s = a.s ; isPre = True ; lock_A = <>} ;
mkA2 a p = a ** {c = p.p1 ; s2 = p.p2 ; lock_A2 = <>} ;
mkA2 a p = a ** {c2 = p ; lock_A2 = <>} ;
mkADeg a b = {s = table {Pos => a.s ; _ => b.s} ; p = a.p ; lock_ADeg = <>} ;
compADeg a = {s = table {Pos => a.s ; _ => \\f => "plus" ++ a.s ! f} ; p = a.p ;
lock_ADeg = <>} ;
regADeg a = compADeg (regA a) ;
prefADeg a = {s = a.s ; p = True ; lock_ADeg = <>} ;
mkADeg a b =
{s = table {Posit => a.s ! Posit ; _ => b.s ! Posit} ; isPre = a.isPre ; lock_A = <>} ;
compADeg a =
{s = table {Posit => a.s ! Posit ; _ => \\f => "plus" ++ a.s ! Posit ! f} ;
isPre = a.isPre ;
lock_A = <>} ;
prefA a = {s = a.s ; isPre = True ; lock_A = <>} ;
adegA a = {s = a.s ! Pos ; p = a.p ; lock_A = <>} ;
mkAdv x = ss x ** {lock_Adv = <>} ;
mkAdV x = ss x ** {lock_AdV = <>} ;
mkAdA x = ss x ** {lock_AdA = <>} ;
regV x = let v = (mkVerbReg x) in verbPres v AHabere ** {aux = AHabere ; lock_V = <>} ;
reg3V x y z = let v = (mkVerb3Reg x y z) in verbPres v AHabere ** {aux = AHabere ; lock_V = <>} ;
etreV v = {s = v.s ; aux = AEsse ; lock_V = <>} ;
regV x = let v = vvf (mkVerbReg x) in {s = v ; vtyp = VHabere ; lock_V = <>} ;
reg3V x y z = let v = vvf (mkVerb3Reg x y z) in {s = v ; vtyp = VHabere ; lock_V = <>} ;
etreV v = {s = v.s ; vtyp = VEsse ; lock_V = <>} ;
reflV v = {s = v.s ; vtyp = VRefl ; lock_V = <>} ;
mkV2 v p = {s = v.s ; aux = v.aux ; s2 = p.p2 ; c = p.p1 ; lock_V2 = <>} ;
mkV2 v p = v ** {c2 = p ; lock_V2 = <>} ;
dirV2 v = mkV2 v accusative ;
v2V v = v ** {lock_V = <>} ;
mkV3 v p q = {s = v.s ; aux = v.aux ;
s2 = p.p2 ; s3 = q.p2 ; c = p.p1 ; c3 = q.p1 ; lock_V3 = <>} ;
mkV3 v p q = v ** {c2 = p ; c3 = q ; lock_V3 = <>} ;
dirV3 v p = mkV3 v accusative p ;
dirdirV3 v = dirV3 v dative ;
V0 : Type = V ;
V2S, V2V, V2Q : Type = V2 ;
AS, AV : Type = A ;
A2S, A2V : Type = A2 ;
mkV0 v = v ** {lock_V0 = <>} ;
mkVS v = v ** {mn,mp = Ind ; lock_VS = <>} ; ---- more moods
mkV2S v p = mkV2 v p ** {mn,mp = Ind ; lock_V2S = <>} ;
mkVV v = v ** {c = accusative.p1 ; lock_VV = <>} ;
deVV v = v ** {c = genitive.p1 ; lock_VV = <>} ;
aVV v = v ** {c = dative.p1 ; lock_VV = <>} ;
mkVS v = v ** {m = \\_ => Indic ; lock_VS = <>} ; ---- more moods
mkV2S v p = mkV2 v p ** {mn,mp = Indic ; lock_V2S = <>} ;
mkVV v = v ** {c2 = complAcc ; lock_VV = <>} ;
deVV v = v ** {c2 = complGen ; lock_VV = <>} ;
aVV v = v ** {c2 = complDat ; lock_VV = <>} ;
mkV2V v p t = mkV2 v p ** {c3 = t.p1 ; s3 = p.p2 ; lock_V2V = <>} ;
mkVA v = v ** {lock_VA = <>} ;
mkV2A v p = mkV2 v p ** {lock_V2A = <>} ;
mkV2A v p q = mkV3 v p q ** {lock_V2A = <>} ;
mkVQ v = v ** {lock_VQ = <>} ;
mkV2Q v p = mkV2 v p ** {lock_V2Q = <>} ;
mkAS v = v ** {mn,mp = Ind ; lock_AS = <>} ; ---- more moods
mkA2S v p = mkA2 v p ** {mn,mp = Ind ; lock_A2S = <>} ;
mkAS v = v ** {lock_AS = <>} ; ---- more moods
mkA2S v p = mkA2 v p ** {lock_A2S = <>} ;
mkAV v p = v ** {c = p.p1 ; s2 = p.p2 ; lock_AV = <>} ;
mkA2V v p q = mkA2 v p ** {s3 = q.p2 ; c3 = q.p1 ; lock_A2V = <>} ;