diff --git a/lib/resource-0.6/french/ParadigmsFre.gf b/lib/resource-0.6/french/ParadigmsFre.gf new file mode 100644 index 000000000..48d1f14a4 --- /dev/null +++ b/lib/resource-0.6/french/ParadigmsFre.gf @@ -0,0 +1,203 @@ +--# -path=.:../romance:../abstract:../../prelude + +--1 French Lexical Paradigms +-- +-- Aarne Ranta 2003 +-- +-- This is an API to the user of the resource grammar +-- for adding lexical items. It give shortcuts for forming +-- expressions of basic categories: nouns, adjectives, verbs. +-- +-- Closed categories (determiners, pronouns, conjunctions) are +-- accessed through the resource syntax API, $resource.Abs.gf$. +-- +-- The main difference with $MorphoFre.gf$ is that the types +-- referred to are compiled resource grammar types. We have moreover +-- had the design principle of always having existing forms as string +-- arguments of the paradigms, not stems. +-- +-- The following modules are presupposed: + +resource ParadigmsFre = + open (Predef=Predef), Prelude, (Types = TypesFre), SyntaxFre, MorphoFre, + ResourceFre in { + +--2 Parameters +-- +-- To abstract over gender names, we define the following identifiers. + +oper + masculine : Gender ; + feminine : Gender ; + +-- To abstract over case names, we define the following. + + nominative : Case ; + accusative : Case ; + dative : Case ; + genitive : Case ; + +-- To abstract over number names, we define the following. + + singular : Number ; + plural : Number ; + + +--2 Nouns + +-- Worst case: two forms (singular + plural), +-- and the gender. + + mkN : (_,_ : Str) -> Gender -> N ; -- oeil, yeux, masculine + +-- Often it is enough with one form. Some of them have a typical gender. + + nReg : Str -> Gender -> N ; -- regular, e.g. maison, (maisons,) feminine + nEau : Str -> Gender -> N ; -- eau, (eaux,) feminine + nCas : Str -> Gender -> N ; -- cas, (cas,) masculine + nCheval : Str -> N ; -- cheval, (chevaux, masculine) + +-- Nouns used as functions need a case and a preposition. The most common is "de". + + funPrep : N -> Preposition -> Fun ; + funCase : N -> Case -> Fun ; + funDe : N -> Fun ; + +-- Proper names, with their gender. + + mkPN : Str -> Gender -> PN ; -- Jean, masculine + +-- On the top level, it is maybe $CN$ that is used rather than $N$, and +-- $NP$ rather than $PN$. + + mkCN : N -> CN ; + mkNP : Str -> Gender -> NP ; + + +--2 Adjectives + +-- Non-comparison one-place adjectives need three forms in the worst case. +-- A parameter tells if they are pre- or postpositions in modification. + + Position : Type ; + prepos : Position ; + postpos : Position ; + + mkAdj1 : (bon, bonne, bons, bien : Str) -> Position -> Adj1 ; + +-- Usually it is enough to give the two singular forms. Fully regular adjectives +-- only need the masculine singular form. + + adj1Reg : Str -> Position -> Adj1 ; + adj1Cher : (cher, chère : Str) -> Position -> Adj1 ; + +-- Two-place adjectives need a preposition and a case as extra arguments. + + mkAdj2 : Adj1 -> Preposition -> Case -> Adj2 ; -- divisible par + +-- Comparison adjectives may need two adjectives, corresponding to the +-- positive and other forms. + + mkAdjDeg : (bon, meilleur : Adj1) -> AdjDeg ; + +-- In the completely regular case, the comparison forms are constructed by +-- the particle "plus". + + aReg : Str -> Position -> AdjDeg ; -- lent (, plus lent) + +-- On top level, there are adjectival phrases. The most common case is +-- just to use a one-place adjective. + + apReg : Str -> Position -> AP ; + + +--2 Verbs +-- +-- The fragment only has present tense so far, but in all persons. +-- These are examples of standard conjugations are available. The full list +-- of Bescherelle conjugations is given in $morpho.Fra.gf$, with all forms +-- (their type is $Verbum$). The present-tense forms can be extracted by the +-- function $extractVerb$. + + vAimer : Str -> V ; + vFinir : Str -> V ; + vDormir : Str -> V ; + vCourir : Str -> V ; + vVenir : Str -> V ; + + extractVerb : Verbum -> V ; + +-- The verbs 'be' and 'have' are special. + + vEtre : V ; + vAvoir : V ; + +-- Two-place verbs, and the special case with direct object. Notice that +-- a particle can be included in a $V$. + + mkTV : V -> Preposition -> Case -> TV ; + tvDir : V -> TV ; + +-- The idiom with "avoir" and an invariable noun, such as "peur", "faim", +-- and a two-place variant with "de" + complement. + + avoirChose : Str -> V ; + avoirChoseDe : Str -> TV ; + +-- The definitions should not bother the user of the API. So they are +-- hidden from the document. +--. + + masculine = Types.Masc ; + feminine = Types.Fem ; + + nominative = Types.nominative ; + accusative = Types.accusative ; + genitive = Types.genitive ; + dative = Types.dative ; + + singular = Types.singular ; + plural = Types.plural ; + + mkN a b c = mkCNomIrreg a b c ** {lock_N = <>} ; + + nEau = \eau -> mkN eau (eau + "z") ; + nCas = \cas -> mkN cas cas ; + nCheval = \cheval -> mkN cheval (Predef.tk 1 cheval + "ux") masculine ; + + funPrep = \n,p -> n ** complement p ** {lock_Fun = <>} ; + funCase = \n,p -> n ** complementCas p ** {lock_Fun = <>} ; + funDe x = funCase x genitive ; + mkPN s g = mkProperName s g ** {lock_PN = <>} ; + mkCN = UseN ; + mkNP s g = UsePN (mkPN s g) ; + + Position = Bool ; + prepos = adjPre ; + postpos = adjPost ; + mkAdj1 = \x,y,z,u,p -> mkAdjective (mkAdj x y z u) p ** {lock_Adj1 = <>} ; + adj1Reg = \lent -> mkAdj1 lent (lent+"e") (lent+"s") (lent+"ement") ; + adj1Cher = \cher,chere -> mkAdj1 cher chere (cher+"s") (chere + "ment") ; + + mkAdj2 = \a,p,c -> mkAdjCompl a postpos {s2 = p ; c = c} ** {lock_Adj2 = <>} ; + mkAdjDeg = \b,m -> mkAdjDegr (mkAdjComp b.s m.s) b.p ** {lock_AdjDeg = <>} ; + aReg = \a,p -> mkAdjDegrLong (adj1Reg a p) p ** {lock_AdjDeg = <>} ; + apReg a p = adj1Reg a p ** {lock_AP = <>} ; + + vAimer = \s -> verbPres (conj1aimer s) ** {lock_V = <>} ; + vFinir = \s -> verbPres (conj2finir s) ** {lock_V = <>} ; + vDormir = \s -> verbPres (conj3dormir s) ** {lock_V = <>} ; + vCourir = \s -> verbPres (conj3courir s) ** {lock_V = <>} ; + vVenir = \s -> verbPres (conj3tenir s) ** {lock_V = <>} ; + extractVerb v = verbPres v ** {lock_V = <>} ; + vEtre = verbEtre ** {lock_V = <>} ; + vAvoir = verbPres (conjAvoir "avoir") ** {lock_V = <>} ; + + mkTV v p c = mkTransVerb v p c ** {lock_TV = <>} ; + tvDir v = mkTransVerbDir v ** {lock_TV = <>} ; + + avoirChose = \faim -> + {s = let {avoir = vAvoir.s} in \\v => avoir ! v ++ faim} ** {lock_V = <>} ; + avoirChoseDe = \faim -> mkTV (avoirChose faim) [] genitive ** {lock_TV = <>} ; + +} diff --git a/lib/resource-0.6/french/ResourceFre.gf b/lib/resource-0.6/french/ResourceFre.gf new file mode 100644 index 000000000..46b1f92f2 --- /dev/null +++ b/lib/resource-0.6/french/ResourceFre.gf @@ -0,0 +1,3 @@ +--# -path=.:../romance:../abstract:../../prelude + +resource ResourceFre = reuse StructuralFre ; diff --git a/lib/resource-0.6/italian/MorphoIta.gf b/lib/resource-0.6/italian/MorphoIta.gf index 1b9d0caa9..a8440dfc2 100644 --- a/lib/resource-0.6/italian/MorphoIta.gf +++ b/lib/resource-0.6/italian/MorphoIta.gf @@ -82,11 +82,19 @@ oper -- Then the regular and invariant patterns. - adjSolo : Str -> Adj = \solo -> let {sol = Predef.tk 1 solo} in + adjSolo : Str -> Adj = \solo -> + let + sol = Predef.tk 1 solo + in mkAdj solo (sol + "a") (sol + "i") (sol + "e") (sol + "amente") ; - adjTale : Str -> Adj = \tale -> let {tali = Predef.tk 1 tale + "i"} in - mkAdj tale tale tali tali (Predef.tk 1 tale + "mente") ; + adjTale : Str -> Adj = \tale -> + let + tal = Predef.tk 1 tale ; + tali = tal + "i" ; + tala = if_then_Str (pbool2bool (Predef.occur (Predef.dp 1 tal) "lr")) tal tale + in + mkAdj tale tale tali tali (tala + "mente") ; adjBlu : Str -> Adj = \blu -> mkAdj blu blu blu blu blu ; --- @@ -194,7 +202,7 @@ oper mkVerbPres : (_,_,_,_,_,_,_,_,_ : Str) -> VerbPres = \veng, viene, ven, venite, vengono, venga, vieni, venire, venuto -> let vien = Predef.tk 1 vieni ; - venut = (adjSolo (Predef.tk 1 venuto)).s + venut = (adjSolo venuto).s in {s = table { VFin Ind Sg P1 => veng + "o" ; diff --git a/lib/resource-0.6/italian/ParadigmsIta.gf b/lib/resource-0.6/italian/ParadigmsIta.gf new file mode 100644 index 000000000..42109e5ed --- /dev/null +++ b/lib/resource-0.6/italian/ParadigmsIta.gf @@ -0,0 +1,230 @@ +--# -path=.:../romance:../abstract:../../prelude + +--1 Italian Lexical Paradigms +-- +-- Aarne Ranta 2003 +-- +-- This is an API to the user of the resource grammar +-- for adding lexical items. It give shortcuts for forming +-- expressions of basic categories: nouns, adjectives, verbs. +-- +-- Closed categories (determiners, pronouns, conjunctions) are +-- accessed through the resource syntax API, $resource.Abs.gf$. +-- +-- The main difference with $MorphoIta.gf$ is that the types +-- referred to are compiled resource grammar types. We have moreover +-- had the design principle of always having existing forms as string +-- arguments of the paradigms, not stems. +-- +-- The following modules are presupposed: + +resource ParadigmsIta = + open (Predef=Predef), Prelude, (Types = TypesIta), SyntaxIta, MorphoIta, + ResourceIta in { + +--2 Parameters +-- +-- To abstract over gender names, we define the following identifiers. + +oper + masculine : Gender ; + feminine : Gender ; + +-- To abstract over case names, we define the following. + + nominative : Case ; + accusative : Case ; + dative : Case ; + genitive : Case ; + + prep_a : Case ; + prep_di : Case ; + prep_da : Case ; + prep_in : Case ; + prep_su : Case ; + prep_con : Case ; + +-- To abstract over number names, we define the following. + + singular : Number ; + plural : Number ; + +--2 Nouns + +-- Worst case: two forms (singular + plural), +-- and the gender. + + mkN : (_,_ : Str) -> Gender -> N ; -- uomo, uomini, masculine + +-- Often it is enough with one form. If it ends with +-- "o" or "a", no gender is needed; if with something else, +-- the gender must be given. + + nVino : Str -> N ; -- vino (, vini, masculine) + nRana : Str -> N ; -- rana (, rane, feminine) + nSale : Str -> Gender -> N ; -- sale (, sali), masculine + nTram : Str -> Gender -> N ; -- tram (, tram), masculine + +-- Nouns used as functions need a case and a preposition. The most common is "di". +-- Recall that the prepositions "a", "di", "da", "in", "su", "con" are treated +-- as part of the case (cf. above). + + funPrep : N -> Preposition -> Fun ; + funCase : N -> Case -> Fun ; + funDi : N -> Fun ; + +-- Proper names, with their gender. + + mkPN : Str -> Gender -> PN ; -- Giovanni, masculine + +-- On the top level, it is maybe $CN$ that is used rather than $N$, and +-- $NP$ rather than $PN$. + + mkCN : N -> CN ; + mkNP : Str -> Gender -> NP ; + + +--2 Adjectives + +-- Non-comparison one-place adjectives need four forms in the worst case. +-- A parameter tells if they are pre- or postpositions in modification. + + Position : Type ; + prepos : Position ; + postpos : Position ; + + mkAdj1 : (solo,sola,soli,sole,solamente : Str) -> Position -> Adj1 ; + +-- Adjectives ending with "o" and "e", and invariable adjectives, +-- are the most important regular patterns. + + adj1Solo : (solo : Str) -> Bool -> Adj1 ; + adj1Tale : (tale : Str) -> Bool -> Adj1 ; + adj1Blu : (blu : Str) -> Bool -> Adj1 ; + + +-- Two-place adjectives need a preposition and a case as extra arguments. + + mkAdj2 : Adj1 -> Preposition -> Case -> Adj2 ; -- divisibile per + +-- Comparison adjectives may need two adjectives, corresponding to the +-- positive and other forms. + + mkAdjDeg : (buono, migliore : Adj1) -> AdjDeg ; + +-- In the completely regular case, the comparison forms are constructed by +-- the particle "più". + + aSolo : Str -> Position -> AdjDeg ; -- lento (, più lento) + aTale : Str -> Position -> AdjDeg ; -- grave (, più grave) + aBlu : Str -> Position -> AdjDeg ; -- blu (, più blu) + +-- On top level, there are adjectival phrases. The most common case is +-- just to use a one-place adjective. + + apSolo : Str -> Position -> AP ; + apTale : Str -> Position -> AP ; + apBlu : Str -> Position -> AP ; + + +--2 Verbs +-- +-- The fragment only has present tense so far, but in all persons. +-- The worst case needs nine forms (and is not very user-friendly). + + mkV : (_,_,_,_,_,_,_,_,_ : Str) -> V ; + +-- These are examples of standard conjugations. Other conjugations +-- can be extracted from the Italian functional morphology, which has full +-- "Bescherelle" tables. + + vAmare : Str -> V ; + vDormire : Str -> V ; + vFinire : Str -> V ; + vCorrere : (_,_ : Str) -> V ; + +-- The verbs 'be' and 'have' are special. + + vEssere : V ; + vAvere : V ; + +-- Two-place verbs, and the special case with direct object. Notice that +-- a particle can be included in a $V$. + + mkTV : V -> Preposition -> Case -> TV ; + tvDir : V -> TV ; + +-- The idiom with "avere" and an invariable noun, such as "paura", "fame", +-- and a two-place variant with "di" + complement. + + averCosa : Str -> V ; + averCosaDi : Str -> TV ; + +-- The definitions should not bother the user of the API. So they are +-- hidden from the document. +--. + + masculine = Masc ; + feminine = Fem ; + nominative = Types.nominative ; + accusative = Types.accusative ; + genitive = Types.genitive ; + dative = Types.dative ; + + singular = Types.singular ; + plural = Types.plural ; + prep_a = Types.CPrep P_a ; + prep_di = Types.CPrep Types.P_di ; + prep_da = Types.CPrep Types.P_da ; + prep_in = Types.CPrep Types.P_in ; + prep_su = Types.CPrep Types.P_su ; + prep_con = Types.CPrep Types.P_con ; + + singular = Types.singular ; + plural = Types.plural ; + + mkN a b g = mkCNomIrreg a b g ** {lock_N = <>} ; + + nVino = \vino -> mkCNom (nomVino vino) masculine ** {lock_N = <>} ; + nRana = \rana -> mkCNom (nomRana rana) feminine ** {lock_N = <>} ; + nSale = \sale,g -> mkCNom (nomSale sale) g ** {lock_N = <>} ; + nTram = \tram,g -> mkCNom (nomTram tram) g ** {lock_N = <>} ; + + funPrep = \n,p -> n ** complement p ** {lock_Fun = <>} ; + funCase = \n,p -> n ** complementCas p ** {lock_Fun = <>} ; + funDi a = funGen a ** {lock_Fun = <>} ; + mkPN s g = mkProperName s g ** {lock_PN = <>} ; + mkCN = UseN ; + mkNP s g = UsePN (mkPN s g) ; + + Position = Bool ; + prepos = adjPre ; + postpos = adjPost ; + mkAdj1 = \x,y,z,u,v,p -> mkAdjective (mkAdj x y z u v) p ** {lock_Adj1 = <>} ; + adj1Solo = \a,p -> mkAdjective (adjSolo a) p ** {lock_Adj1 = <>} ; + adj1Tale = \a,p -> mkAdjective (adjTale a) p ** {lock_Adj1 = <>} ; + adj1Blu = \a,p -> mkAdjective (adjBlu a) p ** {lock_Adj1 = <>} ; + mkAdj2 = \a,p,c -> mkAdjCompl a postpos {s2 = p ; c = c} ** {lock_Adj2 = <>} ; + mkAdjDeg = \b,m -> mkAdjDegr (mkAdjComp b.s m.s) b.p ** {lock_AdjDeg = <>} ; + aSolo = \a,p -> mkAdjDegrLong (adjSolo a) p ** {lock_AdjDeg = <>} ; + aTale = \a,p -> mkAdjDegrLong (adjTale a) p ** {lock_AdjDeg = <>} ; + aBlu = \a,p -> mkAdjDegrLong (adjBlu a) p ** {lock_AdjDeg = <>} ; + apSolo a p = adj1Solo a p ** {lock_AP = <>} ; + apTale a p = adj1Tale a p ** {lock_AP = <>} ; + apBlu a p = adj1Blu a p ** {lock_AP = <>} ; + + mkV a b c d e f g h i = mkVerbPres a b c d e f g h i ** {lock_V = <>} ; + vAmare x = verbAmare x ** {lock_V = <>} ; + vDormire x = verbDormire x ** {lock_V = <>} ; + vFinire x = verbFinire x ** {lock_V = <>} ; + vCorrere x y = verbCorrere x y ** {lock_V = <>} ; + vEssere = verbEssere ** {lock_V = <>} ; + vAvere = verbPres avere ** {lock_V = <>} ; + mkTV a b c = mkTransVerb a b c ** {lock_TV = <>} ; + tvDir c = mkTransVerbDir c ** {lock_TV = <>} ; + + averCosa = \fame -> + {s = let {aver = vAvere.s} in \\v => aver ! v ++ fame} ** {lock_V = <>} ; + averCosaDi = \fame -> mkTV (averCosa fame) [] prep_di ** {lock_TV = <>} ; + +} diff --git a/lib/resource-0.6/italian/ResourceIta.gf b/lib/resource-0.6/italian/ResourceIta.gf new file mode 100644 index 000000000..2ce3010ac --- /dev/null +++ b/lib/resource-0.6/italian/ResourceIta.gf @@ -0,0 +1,3 @@ +--# -path=.:../romance:../abstract:../../prelude + +resource ResourceIta = reuse StructuralIta ; diff --git a/lib/resource-0.6/italian/SyntaxIta.gf b/lib/resource-0.6/italian/SyntaxIta.gf index a676dab62..db1352774 100644 --- a/lib/resource-0.6/italian/SyntaxIta.gf +++ b/lib/resource-0.6/italian/SyntaxIta.gf @@ -59,7 +59,7 @@ oper -- The commonest case for functions is common noun + "di". - funDi : CommNounPhrase -> Function = \mere -> + funGen : CommNounPhrase -> Function = \mere -> mere ** complementCas genitive ; -- Chains of "cui" - "cui" do not arise. diff --git a/lib/resource-0.6/italian/TestResourceIta.gf b/lib/resource-0.6/italian/TestResourceIta.gf index 4b36f8deb..83109584b 100644 --- a/lib/resource-0.6/italian/TestResourceIta.gf +++ b/lib/resource-0.6/italian/TestResourceIta.gf @@ -38,8 +38,8 @@ lin Prove = verbSent (verbAmare "dimostrare") Ind Ind ; SwitchOn = mkTransVerbDir (verbAmare "allumare") ; SwitchOff = mkTransVerbDir verbPresSpegnere ; - Mother = funDi (mkCNom (nomSale "madre") Fem) ; - Uncle = funDi (mkCNom (nomVino "zio") Masc) ; + Mother = funGen (mkCNom (nomSale "madre") Fem) ; + Uncle = funGen (mkCNom (nomVino "zio") Masc) ; Connection = mkCNom (nomSale "connessione") Fem ** {s2 = [] ; c = CPrep P_da ; s3 = [] ; c3 = dative} ;