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=.:../scandinavian:../abstract:../../prelude
--# -path=.:../scandinavian:../common:../abstract:../../prelude
--1 Sanish Lexical Paradigms
--1 Danish Lexical Paradigms
--
-- Aarne Ranta 2003
-- Aarne Ranta 2005 - 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,17 @@
-- 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 [``IrregDan`` ../../danish/IrregDan.gf],
-- which haves a list of irregular verbs.
resource ParadigmsDan =
open (Predef=Predef), Prelude, TypesDan, MorphoDan, SyntaxDan, CategoriesDan in {
open
(Predef=Predef),
Prelude,
CommonScand,
ResDan,
MorphoDan,
CatDan in {
--2 Parameters
--
@@ -55,56 +59,68 @@ oper
-- Prepositions used in many-argument functions are just strings.
Preposition : Type = Str ;
mkPrep : Str -> Prep ;
noPrep : Prep ; -- empty string
--2 Nouns
-- Worst case: give all four forms. The gender is computed from the
-- last letter of the second form (if "n", then $utrum$, otherwise $neutrum$).
mkN : (dreng,drengen,drenger,drengene : Str) -> N ;
mkN : (dreng,drengen,drenge,drengene : Str) -> N ;
-- The regular function takes the singular indefinite form and the gender,
-- and computes the other forms by a heuristic.
-- If in doubt, use the $cc$ command to test!
-- The regular function takes the singular indefinite form
-- and computes the other forms and the gender by a heuristic.
-- The heuristic is that all nouns are $utrum$ with the
-- plural ending "er" or "r".
regN : Str -> Gender -> N ;
regN : Str -> N ;
-- Giving gender manually makes the heuristic more reliable.
regGenN : Str -> Gender -> N ;
-- This function takes the singular indefinite and definite forms; the
-- gender is computed from the definite form.
mk2N : (bil,bilen : Str) -> N ;
-- This function takes the singular indefinite and definite and the plural
-- indefinite
mk3N : (bil,bilen,biler : Str) -> N ;
--3 Compound nouns
--
-- All the functions above work quite as well to form compound nouns,
-- such as "fotboll".
-- such as "fodbold".
--3 Relational nouns
--
-- Relational nouns ("daughter of x") need a preposition.
-- Relational nouns ("datter til x") need a preposition.
mkN2 : N -> Preposition -> N2 ;
mkN2 : N -> Prep -> N2 ;
-- The most common preposition is "av", and the following is a
-- shortcut for regular, $nonhuman$ relational nouns with "av".
-- The most common preposition is "af", and the following is a
-- shortcut for regular relational nouns with "af".
regN2 : Str -> Gender -> N2 ;
-- Use the function $mkPreposition$ or see the section on prepositions below to
-- Use the function $mkPrep$ or see the section on prepositions below to
-- form other prepositions.
--
-- Three-place relational nouns ("the connection from x to y") need two prepositions.
-- Three-place relational nouns ("forbindelse fra x til 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. "tidligere kone til"). However, $N2$ and
-- $N3$ are purely lexical categories. But you can use the $AdvCN$
-- and $PrepNP$ constructions to build phrases like this.
@@ -113,7 +129,8 @@ oper
--
-- Proper names, with a regular genitive, are formed as follows
regPN : Str -> Gender -> PN ; -- John, John's
mkPN : Str -> Gender -> PN ; -- Paris neutrum
regPN : Str -> PN ; -- utrum gender
-- Sometimes you can reuse a common noun as a proper name, e.g. "Bank".
@@ -142,40 +159,37 @@ oper
--
-- Two-place adjectives need a preposition for their second argument.
mkA2 : A -> Preposition -> A2 ;
mkA2 : A -> Prep -> A2 ;
-- Comparison adjectives may need as many as five forms.
mkADeg : (stor,stort,store,storre,storst : Str) -> ADeg ;
mkADeg : (stor,stort,store,storre,storst : Str) -> A ;
-- The regular pattern works for many adjectives, e.g. those ending
-- with "ig".
regADeg : Str -> ADeg ;
regADeg : Str -> A ;
-- Just the comparison forms can be irregular.
irregADeg : (tung,tyngre,tyngst : Str) -> ADeg ;
irregADeg : (tung,tyngre,tyngst : Str) -> A ;
-- Sometimes just the positive forms are irregular.
mk3ADeg : (galen,galet,galna : Str) -> ADeg ;
mk2ADeg : (bred,bredt : Str) -> ADeg ;
mk3ADeg : (galen,galet,galna : Str) -> A ;
mk2ADeg : (bred,bredt : Str) -> A ;
-- If comparison is formed by "mer, "mest", as in general for
-- If comparison is formed by "mer", "mest", as in general for
-- long adjective, the following pattern is used:
compoundADeg : A -> ADeg ; -- -/mer/mest norsk
-- From a given $ADeg$, it is possible to get back to $A$.
adegA : ADeg -> A ;
compoundA : A -> A ; -- -/mer/mest norsk
--2 Adverbs
-- Adverbs are not inflected. Most lexical ones have position
-- after the verb. Some can be preverbal (e.g. "always").
-- after the verb. Some can be close to the verb like the negation
-- "ikke" (e.g. "altid").
mkAdv : Str -> Adv ;
mkAdV : Str -> AdV ;
@@ -184,11 +198,6 @@ oper
mkAdA : Str -> AdA ;
--2 Prepositions
--
-- A preposition is just a string.
mkPreposition : Str -> Preposition ;
--2 Verbs
--
@@ -204,30 +213,42 @@ oper
mk2V : (leve,levde : Str) -> V ;
-- There is an extensive list of irregular verbs in the module $IrregularSwe$.
-- There is an extensive list of irregular verbs in the module $IrregDan$.
-- In practice, it is enough to give three forms, as in school books.
irregV : (drikke, drakk, drukket : Str) -> V ;
irregV : (drikke, drak, drukket : Str) -> V ;
--3 Verbs with a particle.
--3 Verbs with 'være' as auxiliary
--
-- The particle, such as in "switch on", is given as a string.
-- By default, the auxiliary is "have". This function changes it to "være".
vaereV : V -> V ;
--3 Verbs with a particle
--
-- The particle, such as in "passe på", is given as a string.
partV : V -> Str -> V ;
--3 Deponent verbs.
--3 Deponent verbs
--
-- Some words are used in passive forms only, e.g. "hoppas".
-- Some words are used in passive forms only, e.g. "undres", some as
-- reflexive e.g. "forestille sig".
depV : 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$.
mkV2 : V -> Preposition -> V2 ;
mkV2 : V -> Prep -> V2 ;
dirV2 : V -> V2 ;
@@ -236,8 +257,8 @@ oper
-- Three-place (ditransitive) verbs need two prepositions, of which
-- the first one or both can be absent.
mkV3 : V -> Str -> Str -> V3 ; -- speak, with, about
dirV3 : V -> Str -> V3 ; -- give,_,to
mkV3 : V -> Prep -> Prep -> V3 ; -- snakke, med, om
dirV3 : V -> Prep -> V3 ; -- give,_,til
dirdirV3 : V -> V3 ; -- give,_,_
--3 Other complement patterns
@@ -247,124 +268,189 @@ oper
mkV0 : V -> V0 ;
mkVS : V -> VS ;
mkV2S : V -> Str -> V2S ;
mkV2S : V -> Prep -> V2S ;
mkVV : V -> VV ;
mkV2V : V -> Str -> Str -> V2V ;
mkV2V : V -> Prep -> Prep -> V2V ;
mkVA : V -> VA ;
mkV2A : V -> Str -> V2A ;
mkV2A : V -> Prep -> V2A ;
mkVQ : V -> VQ ;
mkV2Q : V -> Str -> V2Q ;
mkV2Q : V -> Prep -> V2Q ;
mkAS : A -> AS ;
mkA2S : A -> Str -> A2S ;
mkA2S : A -> Prep -> A2S ;
mkAV : A -> AV ;
mkA2V : A -> Str -> A2V ;
mkA2V : A -> Prep -> 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 the paradigms
--
-- The definitions should not bother the user of the API. So they are
-- hidden from the document.
--.
Gender = SyntaxDan.NounGender ;
Number = TypesDan.Number ;
Case = TypesDan.Case ;
utrum = NUtr ;
neutrum = NNeutr ;
Gender = MorphoDan.Gender ;
Number = MorphoDan.Number ;
Case = MorphoDan.Case ;
utrum = Utr ;
neutrum = Neutr ;
singular = Sg ;
plural = Pl ;
nominative = Nom ;
genitive = Gen ;
mkN x y z u = let sb = mkSubstantive x y z u
in {s = \\n,b,c => sb.s ! SF n b c ; g = extNGen y ; lock_N = <>} ;
regN x g = case last x of {
Preposition : Type = Str ; -- obsolete
mkPreposition : Str -> Prep ; -- obsolete
mkPreposition = mkPrep ;
mkPrep p = {s = p ; lock_Prep = <>} ;
noPrep = mkPrep [] ;
mkN x y z u = mkSubstantive x y z u ** {g = extNGen y ; lock_N = <>} ;
regN x = regGenN x Utr ;
regGenN x g = case last x of {
"e" => case g of {
NUtr => mkN x (x + "n") (x + "r") (x + "rne") ;
NNeutr => mkN x (x + "t") (x + "r") (init x + "ene")
Utr => mkN x (x + "n") (x + "r") (x + "rne") ;
Neutr => mkN x (x + "t") (x + "r") (init x + "ene")
} ;
_ => case g of {
NUtr => mkN x (x + "en") (x + "er") (x + "rene") ;
NNeutr => mkN x (x + "et") (x + "") (x + "ene")
Utr => mkN x (x + "en") (x + "er") (x + "erne") ;
Neutr => mkN x (x + "et") (x + "") (x + "ene")
}
} ;
mk2N x y = case last y of {
"n" => regN x utrum ;
_ => regN x neutrum
} ;
mk2N x y = case last y of {
"n" => mk3N x y (init y + "r") ;
_ => mk3N x y x
} ;
mkN2 = \n,p -> n ** {lock_N2 = <> ; s2 = p} ;
regN2 n g = mkN2 (regN n g) (mkPreposition "av") ;
mkN3 = \n,p,q -> n ** {lock_N3 = <> ; s2 = p ; s3 = q} ;
mk3N x y z = let u = ifTok Str x z "ene" "ne" in mkN x y z (z + u) ;
regPN n g = {s = \\c => mkCase n ! c ; g = g} ** {lock_PN = <>} ;
mkN2 = \n,p -> n ** {lock_N2 = <> ; c2 = p.s} ;
regN2 n g = mkN2 (regGenN n g) (mkPreposition "av") ;
mkN3 = \n,p,q -> n ** {lock_N3 = <> ; c2 = p.s ; c3 = q.s} ;
mkPN n g = {s = \\c => mkCase c n ; g = g} ** {lock_PN = <>} ;
regPN n = mkPN n utrum ;
nounPN n = {s = n.s ! singular ! Indef ; g = n.g ; lock_PN = <>} ;
mkNP x y n g =
{s = table {PGen _ => x ; _ => y} ; g = genNoun g ; n = n ; p = P3 ;
{s = table {NPPoss _ => x ; _ => y} ; a = agrP3 g n ;
lock_NP = <>} ;
mkA a b c = extractPositive (mkAdjective a b c [] []) ** {lock_A = <>} ;
mkA = mk3ADeg ;
mk2A a b = mkA a b (a + "e") ;
regA a = extractPositive (regADeg a) ** {lock_A = <>} ;
regA a = (regADeg a) ** {lock_A = <>} ;
mkA2 a p = a ** {s2 = p ; lock_A2 = <>} ;
mkA2 a p = a ** {c2 = p.s ; lock_A2 = <>} ;
mkADeg a b c d e = mkAdject a b c d e ** {isComp = False ; lock_A = <>} ;
mkADeg a b c d e = mkAdjective a b c d e ** {lock_ADeg = <>} ;
regADeg a = case Predef.dp 2 a of {
---- "ig" => aBillig a ;
"sk" => aRask a ;
_ => case last a of {
"t" => aAbstrakt a ;
_ => aRod a
}} ** {lock_ADeg = <>} ;
irregADeg a b c = mkAdjective a (a + "t") (a + "e") b c ** {lock_ADeg = <>} ;
mk3ADeg a b c = mkAdjective a b c (a + "ere") (a + "est") ** {lock_ADeg = <>} ;
mk2ADeg a b = mkAdjective a b (a + "e") (a + "ere") (a + "est") ** {lock_ADeg = <>} ;
}} ** {isComp = False ; lock_A = <>} ;
irregADeg a b c = mkAdject a (a + "t") (a + "e") b c **
{isComp = False ; lock_A = <>} ;
mk3ADeg a b c = mkAdject a b c (c + "re") (c + "st") **
{isComp = False ; lock_A = <>} ;
mk2ADeg a b = mkAdject a b (a + "e") (a + "ere") (a + "est") **
{isComp = False ; lock_A = <>} ;
compoundA adj = {s = adj.s ; isComp = True ; lock_A = <>} ;
mkAdv x = ss x ** {lock_Adv = <>} ;
mkAdV x = ss x ** {lock_AdV = <>} ;
mkAdA x = ss x ** {lock_AdA = <>} ;
mkPreposition p = p ;
mkV a b c d e f = mkVerb a b c d e f ** {s1 = [] ; lock_V = <>} ;
mkV a b c d e f = mkVerb6 a b c d e f **
{part = [] ; vtype = VAct ; lock_V = <> ; isVaere = False} ;
regV a = case last a of {
"e" => vHusk (init a) ;
_ => vBo a
} ** {s1 = [] ; lock_V = <>} ;
} ** {part = [] ; vtype = VAct ; isVaere = False ; lock_V = <>} ;
mk2V a b = regVerb a b ** {s1 = [] ; lock_V = <>} ;
mk2V a b = regVerb a b **
{part = [] ; vtype = VAct ; isVaere = False ; lock_V = <>} ;
irregV x y z = irregVerb x y z
** {s1 = [] ; lock_V = <>} ;
irregV =
\drikke,drakk,drukket ->
let
drikk = case last drikke of {
"e" => init drikke ;
_ => drikke
} ;
drikker = case last (init drikke) of {
"r" => init drikke ;
_ => drikke + "r"
}
in
mkV drikke drikker (drikke + "s") drakk drukket (mkImper drikk) ;
partV v p = {s = v.s ; s1 = p ; lock_V = <>} ;
depV v = deponentVerb v ** {lock_V = <>} ;
vaereV v = {
s = v.s ;
part = [] ;
vtype = v.vtype ;
isVaere = True ;
lock_V = <>
} ;
mkV2 v p = v ** {s = v.s ; s1 = v.s1 ; s2 = p ; lock_V2 = <>} ;
dirV2 v = mkV2 v [] ;
partV v p = {
s = v.s ;
part = p ;
vtype = v.vtype ;
isVaere = v.isVaere ;
lock_V = <>
} ;
mkV3 v p q = v ** {s = v.s ; s1 = v.s1 ; s2 = p ; s3 = q ; lock_V3 = <>} ;
dirV3 v p = mkV3 v [] p ;
dirdirV3 v = dirV3 v [] ;
depV v = {
s = v.s ; part = v.part ; vtype = VPass ; isVaere = False ; lock_V = <>
} ;
reflV v = {
s = v.s ; part = v.part ; vtype = VRefl ; isVaere = False ; lock_V = <>
} ;
mkV2 v p = v ** {c2 = p.s ; lock_V2 = <>} ;
dirV2 v = mkV2 v (mkPrep []) ;
mkV3 v p q = v ** {c2 = p.s ; c3 = q.s ; lock_V3 = <>} ;
dirV3 v p = mkV3 v noPrep p ;
dirdirV3 v = dirV3 v noPrep ;
mkV0 v = v ** {lock_V0 = <>} ;
mkVS v = v ** {lock_VS = <>} ;
mkV2S v p = mkV2 v p ** {lock_V2S = <>} ;
mkVV v = v ** {isAux = False ; lock_VV = <>} ;
mkVV v = v ** {c2 = "å" ; lock_VV = <>} ;
mkV2V v p t = mkV2 v p ** {s3 = t ; lock_V2V = <>} ;
mkVA v = v ** {lock_VA = <>} ;
mkV2A v p = mkV2 v p ** {lock_V2A = <>} ;
mkVQ v = v ** {lock_VQ = <>} ;
mkV2Q v p = mkV2 v p ** {lock_V2Q = <>} ;
mkAS v = v ** {lock_AS = <>} ;
mkA2S v p = mkA2 v p ** {lock_A2S = <>} ;
mkAV v = v ** {lock_AV = <>} ;
mkA2V v p = mkA2 v p ** {lock_A2V = <>} ;
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_A = <>} ;
V0 : Type = V ;
V2S, V2V, V2Q, V2A : Type = V2 ;
AS, A2S, AV : Type = A ;
A2V : Type = A2 ;
} ;