diff --git a/lib/resource-0.6/french/MorphoFre.gf b/lib/resource-0.6/french/MorphoFre.gf index c766860ed..9306d82ba 100644 --- a/lib/resource-0.6/french/MorphoFre.gf +++ b/lib/resource-0.6/french/MorphoFre.gf @@ -80,10 +80,11 @@ oper -- Adjectives are conveniently seen as gender-dependent nouns. -- Here are some patterns. First one that describes the worst case. - mkAdj : (_,_,_ : Str) -> Adj = \vieux,vieuxs,vieille -> + mkAdj : (_,_,_,_ : Str) -> Adj = \vieux,vieuxs,vieille,vieillement -> {s = table { - Masc => numForms vieux vieuxs ; - Fem => nomReg vieille + AF Masc n => numForms vieux vieuxs ! n ; + AF Fem n => nomReg vieille ! n ; + AA => vieillement } } ; @@ -100,24 +101,29 @@ oper -- Adjectives themselves are records. Here the most common cases: adjGrand : Str -> Adj = \grand -> - {s = adjReg grand} ; + mkAdj grand (grand + "s") (grand + "e") (grand + "ement") ; + +-- Masculine form used for adverbial; also covers "carré". + + adjJoli : Str -> Adj = \joli -> + mkAdj joli (joli + "s") (joli + "e") (joli + "ment") ; adjHeureux : Str -> Adj = \heureux -> let {heureu = Predef.tk 1 heureux} in - mkAdj heureux heureu (heureu+"se") ; + mkAdj heureux heureu (heureu+"se") (heureu+"sement") ; adjJeune : Str -> Adj = \jeune -> - mkAdj jeune (jeune+"s") jeune ; + mkAdj jeune (jeune+"s") jeune (jeune+"ment") ; adjIndien : Str -> Adj = \indien -> - mkAdj indien (indien+"s") (indien+"ne") ; + mkAdj indien (indien+"s") (indien+"ne") (indien+"nement") ; adjFrancais : Str -> Adj = \francais -> - mkAdj francais francais (francais+"e") ; + mkAdj francais francais (francais+"e") (francais+"ement") ; adjCher : Str -> Adj = \cher -> let {ch = Predef.tk 2 cher} in - mkAdj cher (cher + "s") (ch + "ère") ; + mkAdj cher (cher + "s") (ch + "ère") (ch + "èrement") ; diff --git a/lib/resource-0.6/french/StructuralFre.gf b/lib/resource-0.6/french/StructuralFre.gf index 820591f16..750ae4baa 100644 --- a/lib/resource-0.6/french/StructuralFre.gf +++ b/lib/resource-0.6/french/StructuralFre.gf @@ -1,6 +1,7 @@ --# -path=.:../romance:../abstract:../../prelude -concrete StructuralFre of Structural = CombinationsFre ** open SyntaxFre in { +concrete StructuralFre of Structural = CombinationsFre ** + open SyntaxFre, MorphoFre, Prelude in { lin INP = pronNounPhrase pronJe ; @@ -18,10 +19,32 @@ lin --- TheyNP = pronNounPhrase (variants {pronIls ; pronElles}) ; + ThisNP = mkNameNounPhrase ["ceci"] Masc ; + ThatNP = mkNameNounPhrase ["ça"] Masc ; + TheseNP n = mkNameNounPhrase ("ceux" ++ n.s ! Masc ++ "ci") Masc ; + ThoseNP n = mkNameNounPhrase ("ceux" ++ n.s ! Masc ++ "là") Masc ; + + ItNP = pronNounPhrase pronIl ; + EveryDet = chaqueDet ; ----- AllDet = tousDet ; + AllDet = toutDet ; + AllsDet = tousDet ; WhichDet = quelDet ; - MostDet = plupartDet ; + WhichsDet = mkDeterminerNum plural "quels" "quelles" ; + MostsDet = plupartDet ; + MostDet = mkDeterminer1 singular (["la plupart"] ++ elisDe) ; --- de + SomeDet = mkDeterminer1 singular "quelque" ; + SomesDet = mkDeterminerNum plural "quelques" "quelques" ; + NoDet = mkDeterminer singular "aucun" "aucune" ; --- ne + NosDet = mkDeterminerNum plural ("aucun" ++ "des") ("aucune" ++ "des") ; --- ne + AnyDet = mkDeterminer1 singular "quelque" ; --- + AnysDet = mkDeterminerNum plural "quelques" "quelques" ; --- + ManyDet = mkDeterminer1 plural "plusieurs" ; + MuchDet = mkDeterminer1 singular ("beaucoup" ++ elisDe) ; --- de + ThisDet = mkDeterminer singular (pre {"ce" ; "cet" / voyelle}) "cette" ; --- ci + ThatDet = mkDeterminer singular (pre {"ce" ; "cet" / voyelle}) "cette" ; --- là + TheseDet = mkDeterminerNum plural "ces" "ces" ; --- ci + ThoseDet = mkDeterminerNum plural "ces" "ces" ; --- là HowIAdv = commentAdv ; WhenIAdv = quandAdv ; @@ -38,4 +61,50 @@ lin PhrYes = ouiPhr ; PhrNo = nonPhr ; --- and also Si! + + VeryAdv = ss "très" ; + TooAdv = ss "trop" ; + OtherwiseAdv = ss "autrement" ; + ThereforeAdv = ss "donc" ; + + EverybodyNP = mkNameNounPhrase ["tout le monde"] Masc ; + SomebodyNP = mkNameNounPhrase ["quelqu'un"] Masc ; + NobodyNP = mkNameNounPhrase ["personne"] Masc ; --- ne + EverythingNP = mkNameNounPhrase ["tout"] Masc ; + SomethingNP = mkNameNounPhrase ["quelque chose"] Masc ; + NothingNP = mkNameNounPhrase ["rien"] Masc ; --- ne + + CanVV = mkVerbVerbDir (verbPres (conj3pouvoir "pouvoir")) ; + CanKnowVV = mkVerbVerbDir (verbPres (conj3savoir "savoir")) ; + MustVV = mkVerbVerbDir (verbPres (conj3devoir "devoir")) ; + WantVV = mkVerbVerbDir (verbPres (conj3vouloir "vouloir")) ; + + EverywhereNP = ss "partout" ; + SomewhereNP = ss ["quelque part"] ; --- ne - pas + NowhereNP = ss ["nulle part"] ; + + AlthoughSubj = ss ("bien" ++ elisQue) ** {m = Con} ; + + AlmostAdv = ss "presque" ; + QuiteAdv = ss "assez" ; + + InPrep = justPrep "dans" ; + OnPrep = justPrep "sur" ; + ToPrep = justCase dative ; --- + ThroughPrep = justPrep "par" ; + AbovePrep = {s = ["au dessus"] ; c = genitive} ; + UnderPrep = justPrep "sous" ; + InFrontPrep = justPrep "devant" ; + BehindPrep = justPrep "derrière" ; + BetweenPrep = justPrep "entre" ; + FromPrep = justCase genitive ; --- + BeforePrep = justPrep "avant" ; + DuringPrep = justPrep "pendant" ; + AfterPrep = justPrep "après" ; + WithPrep = justPrep "avec" ; + WithoutPrep = justPrep "sans" ; + ByMeansPrep = justPrep "par" ; + PartPrep = justCase genitive ; --- + AgentPrep = justPrep "par" ; + } diff --git a/lib/resource-0.6/french/SyntaxFre.gf b/lib/resource-0.6/french/SyntaxFre.gf index d7a8f384b..8e4576b1e 100644 --- a/lib/resource-0.6/french/SyntaxFre.gf +++ b/lib/resource-0.6/french/SyntaxFre.gf @@ -9,8 +9,27 @@ oper jean.g Sg ; + partitiveNounPhrase = \n,vin -> + normalNounPhrase + (table { + Gen => elisDe ++ vin.s ! n ; + c => prepCase c ++ artDef vin.g n Gen ++ vin.s ! n + } + ) + vin.g + n ; + chaqueDet = mkDeterminer1 Sg "chaque" ; - tousDet = mkDeterminer Pl ["tous les"] ["toutes les"] ; + + toutDet : Determiner = + {s = \\g => genForms "tout" "toute" ! g ++ artDef g Sg nominative ; + n = Pl + } ; + tousDet : Numeral -> Determiner = \nu -> + {s = \\g => genForms "tous" "toutes" ! g ++ artDef g Pl nominative ++ nu.s ! g ; + n = Pl + } ; + plupartDet = mkDeterminer1 Pl ["la plupart des"] ; unDet = mkDeterminer Sg "un" "une" ; plDet = mkDeterminer1 Pl "des" ; --- @@ -21,6 +40,17 @@ oper npGenPoss = \n,ton,mec -> \\c => prepCase c ++ ton.s ! Poss n mec.g ++ mec.s ! n ; + npGenPossNum = \nu,ton,mec -> + \\c => prepCase c ++ ton.s ! Poss Pl mec.g ++ nu.s ! mec.g ++ mec.s ! Pl ; + + existNounPhrase = \duvin -> { + s = \\m => + case m of { + Ind => ["il y a"] ; + Con => ["il y ait"] + } ++ duvin.s ! stressed accusative --- il y en a ; have to define "y" + } ; + mkAdjReg : Str -> Bool -> Adjective = \adj,p -> mkAdjective (adjGrand adj) p ; @@ -130,6 +160,15 @@ oper } } ; + existNounPhraseQuest = \duvin -> { + s = \\m => + case m of { + DirQ => optStr (estCeQue Acc) ++ ["il y a"] ; + IndirQ => elisSi ++ ["il y a"] + } + ++ duvin.s ! stressed accusative --- il y en a ; have to define "y" + } ; + intVerbPhrase = \qui, dort -> {s = table { DirQ => qui.s ! Nom ++ optStr (estCeQue Nom) ++ @@ -283,8 +322,8 @@ oper etetConj = sd2 "et" "et" ** {n = Pl} ; ououConj = sd2 "ou" "ou" ** {n = Sg} ; niniConj = sd2 "ni" "ni" ** {n = Sg} ; --- requires ne ! - siSubj = ss elisSi ; - quandSubj = ss "quand" ; + siSubj = ss elisSi ** {m = Ind} ; + quandSubj = ss "quand" ** {m = Ind} ; ouiPhr = ss ["Oui ."] ; nonPhr = ss ["Non ."] ; --- and also Si! diff --git a/lib/resource-0.6/french/TestResourceFre.gf b/lib/resource-0.6/french/TestResourceFre.gf index 14703c57e..19760dfbd 100644 --- a/lib/resource-0.6/french/TestResourceFre.gf +++ b/lib/resource-0.6/french/TestResourceFre.gf @@ -6,25 +6,37 @@ flags startcat=Phr ; lexer=text ; parser=chart ; unlexer=text ; lin Big = mkAdjDegrReg "grand" adjPre ; + American = mkAdjective (adjGrand "américain") adjPost ; + Finnish = mkAdjective (adjGrand "finlandais") adjPost ; + Married = mkAdjCompl (adjJoli "marié") adjPost (complementCas dative) ; Small = mkAdjDegrReg "petit" adjPre ; - Old = mkAdjDegrLong (mkAdj "vieux" "vieux" "vieille") adjPre ; + Old = mkAdjDegrLong (mkAdj "vieux" "vieux" "vieille" "vieillement") adjPre ; Young = mkAdjDegrLong (adjJeune "jeune") adjPre ; + Happy = mkAdjDegrLong (adjHeureux "heureux") adjPre ; + Wine = mkCNomReg "vin" Masc ; + Bar = mkCNomReg "bar" Masc ; Man = mkCNomReg "homme" Masc ; Woman = mkCNomReg "femme" Fem ; Car = mkCNomReg "voiture" Fem ; Light = mkCNomReg "lumière" Fem ; House = mkCNomReg "maison" Fem ; + Bottle = mkCNomReg "bouteille" Fem ; Walk = verbPres (conj1aimer "marcher") ; Run = verbPres (conj3courir "courir") ; Send = mkTransVerbDir (verbPres (conj1envoyer "envoyer")) ; Love = mkTransVerbDir (verbPres (conj1aimer "aimer")) ; + Drink = mkTransVerbDir (verbPres (conj3boire "boire")) ; Wait = mkTransVerbDir (verbPres (conj3rendre "attendre")) ; + Give = mkDitransVerb (verbPres (conj1aimer "donner")) [] dative [] accusative ; + Prefer = mkDitransVerb (verbPres (conj1aimer "preférer")) [] accusative [] dative ; Say = verbSent (verbPres (conj3dire "dire")) Ind Ind ; Prove = verbSent (verbPres (conj1aimer "démontrer")) Ind Ind ; SwitchOn = mkTransVerbDir (verbPres (conj1aimer "allumer")) ; SwitchOff = mkTransVerbDir (verbPres (conj3peindre "éteindre")) ; Mother = funDe (mkCNomReg "mère" Fem) ; Uncle = funDe (mkCNomReg "oncle" Masc) ; + Connection = mkCNomReg "connection" Fem ** + {s2 = [] ; c = genitive ; s3 = [] ; c3 = dative} ; Well = ss "bien" ; Always = ss "toujours" ; diff --git a/lib/resource-0.6/french/TypesFre.gf b/lib/resource-0.6/french/TypesFre.gf index 58a6406c0..2fcb2e3ae 100644 --- a/lib/resource-0.6/french/TypesFre.gf +++ b/lib/resource-0.6/french/TypesFre.gf @@ -24,6 +24,7 @@ oper accusative = Acc ; genitive = Gen ; dative = Dat ; + prepositional = accusative ; stressed = Ton ; unstressed = Aton ; @@ -91,12 +92,12 @@ oper adjCompLong : Adj -> AdjComp = \cher -> mkAdjComp cher.s - (\\g,n => "plus" ++ cher.s ! g ! n) ; + (\\a => "plus" ++ cher.s ! a) ; -- Comparative adjectives are only sometimes formed morphologically -- (actually: by different morphemes). - mkAdjComp : (_,_ : Gender => Number => Str) -> AdjComp = + mkAdjComp : (_,_ : AForm => Str) -> AdjComp = \bon, meilleur -> {s = table {Pos => bon ; _ => meilleur}} ; @@ -137,7 +138,8 @@ oper VInfin => aller ! Inf ; VFin Ind n p => aller ! Indic Pres n p ; VFin Sub n p => aller ! Subjo SPres n p ; - VImper np => aller ! Imper np + VImper np => aller ! Imper np ; + VPart g n => aller ! Part (PPasse g n) }} ; -- The full conjunction is a table on $VForm$: diff --git a/lib/resource-0.6/italian/CombinationsIta.gf b/lib/resource-0.6/italian/CombinationsIta.gf new file mode 100644 index 000000000..1f1328779 --- /dev/null +++ b/lib/resource-0.6/italian/CombinationsIta.gf @@ -0,0 +1,4 @@ +--# -path=.:../romance:../abstract:../../prelude + +concrete CombinationsIta of Combinations = + CombinationsRomance with (SyntaxRomance=SyntaxIta) ; diff --git a/lib/resource-0.6/italian/MorphoIta.gf b/lib/resource-0.6/italian/MorphoIta.gf new file mode 100644 index 000000000..1b9d0caa9 --- /dev/null +++ b/lib/resource-0.6/italian/MorphoIta.gf @@ -0,0 +1,295 @@ +--# -path=.:../romance:../../prelude + +--1 A Simple Italian Resource Morphology +-- +-- Aarne Ranta 2002--2003 +-- +-- This resource morphology contains definitions needed in the resource +-- syntax. It moreover contains the most usual inflectional patterns. +-- The patterns for verbs contain the complete "Bescherelle" conjugation +-- tables. +-- +-- We use the parameter types and word classes defined in $TypesIta.gf$. + +resource MorphoIta = open (Predef=Predef), Prelude, TypesIta in { + +--2 Some phonology +-- +--3 Elision +-- +-- The phonological rule of *elision* can be defined as follows in GF. +-- In Italian it includes both vowels and the *impure 's'*. + +oper + vocale : Strs = strs { + "a" ; "e" ; "h" ; "i" ; "o" ; "u" + } ; + + sImpuro : Strs = strs { + "z" ; "sb" ; "sc" ; "sd" ; "sf" ; "sm" ; "sp" ; "sq" ; "sr" ; "st" ; "sv" + } ; + + elision : (_,_,_ : Str) -> Str = \il, l', lo -> + pre {il ; l' / vocale ; lo / sImpuro} ; + + elisQue = "che" ; --- no elision in Italian + elisDe = "de" ; + +--2 Nouns +-- +-- The following macro is useful for creating the forms of number-dependent +-- tables, such as common nouns. + + numForms : (_,_ : Str) -> Number => Str = \vino, vini -> + table {Sg => vino ; Pl => vini} ; + +-- For example: + + nomVino : Str -> Number => Str = \vino -> let {vin = Predef.tk 1 vino} in + numForms vino (vin + "i") ; + + nomRana : Str -> Number => Str = \rana -> let {ran = Predef.tk 1 rana} in + numForms rana (ran + "e") ; + + nomSale : Str -> Number => Str = \sale -> let {sal = Predef.tk 1 sale} in + numForms sale (sal + "i") ; + + nomTram : Str -> Number => Str = \tram -> + numForms tram tram ; + +-- Common nouns are inflected in number and have an inherent gender. + + mkCNom : (Number => Str) -> Gender -> CNom = \mecmecs,gen -> + {s = mecmecs ; g = gen} ; + + mkCNomIrreg : Str -> Str -> Gender -> CNom = \mec,mecs -> + mkCNom (numForms mec mecs) ; + + + +--2 Adjectives +-- +-- Adjectives are conveniently seen as gender-dependent nouns. +-- Here are some patterns. First one that describes the worst case. + + mkAdj : (_,_,_,_,_ : Str) -> Adj = \solo,sola,soli,sole,solamente -> + {s = table { + AF Masc n => numForms solo soli ! n ; + AF Fem n => numForms sola sole ! n ; + AA => solamente + } + } ; + +-- Then the regular and invariant patterns. + + 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") ; + + adjBlu : Str -> Adj = \blu -> + mkAdj blu blu blu blu blu ; --- + + +--2 Personal pronouns +-- +-- All the eight personal pronouns can be built by the following macro. +-- The use of "ne" as atonic genitive is debatable. +-- We follow the rule that the atonic nominative is empty. + + mkPronoun : (_,_,_,_,_,_,_,_ : Str) -> + PronGen -> Number -> Person -> ClitType -> Pronoun = + \il,le,lui,Lui,son,sa,ses,see,g,n,p,c -> + {s = table { + Ton Nom => il ; + Ton x => prepCase x ++ Lui ; + Aton Nom => il ; ---- [] ; + Aton Acc => le ; + Aton (CPrep P_di) => "ne" ; --- hmm + Aton (CPrep P_a) => lui ; + Aton (CPrep q) => strPrep q ++ Lui ; ---- GF bug with c or p! + Poss Sg Masc => son ; + Poss Sg Fem => sa ; + Poss Pl Masc => ses ; + Poss Pl Fem => see + } ; + g = g ; + n = n ; + p = p ; + c = c + } ; + + +--2 Reflexive pronouns +-- +-- It is simply a function depending on number and person. + + pronRefl : Number -> Person -> Str = \n,p -> case of { + => "mi" ; + => "ti" ; + <_, P3> => "si" ; + => "ci" ; + => "vi" + } ; + + +--2 Determiners +-- +-- Determiners, traditionally called indefinite pronouns, are inflected +-- in gender and number, like adjectives. + + pronForms : Adj -> Gender -> Number -> Str = \tale,g,n -> tale.s ! AF g n ; + + qualPron : Gender -> Number -> Str = pronForms (adjTale "quale") ; + + talPron : Gender -> Number -> Str = pronForms (adjTale "tale") ; + + tuttoPron : Gender -> Number -> Str = pronForms (adjSolo "tutto") ; + +--2 Articles +-- +-- The definite article has quite some variation: three parameters and +-- elision. This is the simples definition we have been able to find. + + artDefTable : Gender => Number => Case => Str = \\g,n,c => case of { + <_, _, CPrep P_di> => prepArt g n "de" ; + <_, _, CPrep P_da> => prepArt g n "da" ; + <_, _, CPrep P_a> => prepArt g n "a" ; + <_, _, CPrep P_in> => prepArt g n "ne" ; + <_, _, CPrep P_su> => prepArt g n "su" ; + <_, _, CPrep P_con> => prepArt g n "co" ; + => elision "il" "l'" "lo" ; + => elision "il" "l'" "lo" ; + + => elision "la" "l'" "la" ; + => elision "i" "gli" "gli" ; + => "le" + } ; + +-- This auxiliary expresses the uniform rule. + + prepArt : Gender -> Number -> Tok -> Tok = \g,n,de -> case of { + => elision (de + "l") (de + "ll'") (de + "llo") ; + => elision (de + "i") (de + "gli") (de + "gli") ; + => elision (de + "lla") (de + "ll'") (de + "lla") ; + => de + "lle" + } ; + +--2 Verbs +-- +--3 The present tense +-- +-- We first define some macros for the special case of present tense. +-- +-- The verb "essere" is often used in syntax. + + verbEssere = verbPres essere ; + +-- We very often form the verb stem by dropping out the infinitive ending. + + troncVerb : Tok -> Tok = Predef.tk 3 ; + +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 + in + {s = table { + VFin Ind Sg P1 => veng + "o" ; + VFin Ind Sg P2 => vien + "i" ; + VFin Ind Sg P3 => viene ; + VFin Ind Pl P1 => ven + "iamo" ; + VFin Ind Pl P2 => venite ; + VFin Ind Pl P3 => vengono ; + VFin Con Sg _ => venga ; + VFin Con Pl P1 => ven + "iamo" ; + VFin Con Pl P2 => ven + "iate" ; + VFin Con Pl P3 => venga + "no" ; + VImper SgP2 => vieni ; + VImper PlP1 => ven + "iamo" ; + VImper PlP2 => venite ; + VInfin => venire ; + VPart g n => venut ! AF g n + } + } ; + +-- The four main conjugations. + + verbAmare : Str -> VerbPres = \amare -> + let {am = troncVerb amare ; ama = am + "a"} in + mkVerbPres + am ama am (ama + "te") (ama + "no") + (am+"i") ama amare (ama + "to") ; + + verbDormire : Str -> VerbPres = \dormire -> + let {dorm = troncVerb dormire} in + mkVerbPres + dorm (dorm + "e") dorm (dorm + "ite") (dorm + "ino") (dorm+"a") + (dorm + "i") dormire (dorm + "ito") ; + + verbFinire : Str -> VerbPres = \finire -> + let {fin = troncVerb finire ; fini = fin + "i" ; finisc = fini + "sc"} in + mkVerbPres + finisc (finisc + "e") fin (fini + "te") (finisc + "ono") + (finisc + "a") (finisc + "i") finire (fini + "to") ; + + verbCorrere : Str -> Str -> VerbPres = \correre,corso -> + let {corr = troncVerb correre ; corre = corr + "e"} in + mkVerbPres corr corre corr (corre + "te") (corr + "ono") (corr+"a") (corr+"i") + correre corso ; + +-- Some irregular verbs. + + verbPresSpegnere : VerbPres = + mkVerbPres "speng" "spegne" "spegn" "spegnete" "spengono" + "spenga" "spegni" "spegnere" "spento" ; + + verbPresDire : VerbPres = + mkVerbPres "dic" "dice" "dic" "dite" "dicono" + "dica" "di" "dire" "detto" ; + + +essere = {s = table { + Inf => "essere" ; + Indi Pres Sg P1 => "sono" ; + Indi Pres Sg P2 => "sei" ; + Indi Pres Sg P3 => "è" ; + Indi Pres Pl P1 => "siamo" ; + Indi Pres Pl P2 => "siete" ; + Indi Pres Pl P3 => "sono" ; + Cong Pres Sg P1 => "sia" ; + Cong Pres Sg P2 => "sia" ; + Cong Pres Sg P3 => "sia" ; + Cong Pres Pl P1 => "siamo" ; + Cong Pres Pl P2 => "siate" ; + Cong Pres Pl P3 => "siano" ; + Imper SgP2 => "sii" ; + Imper PlP1 => "siamo" ; + Imper PlP2 => "siate" ; + _ => "essere" --- we just don't care + }} ; + + + avere = {s = table { + Inf => "avere" ; + Indi Pres Sg P1 => "ho" ; + Indi Pres Sg P2 => "hai" ; + Indi Pres Sg P3 => "ha" ; + Indi Pres Pl P1 => "abbiamo" ; + Indi Pres Pl P2 => "avete" ; + Indi Pres Pl P3 => "hanno" ; + Cong Pres Sg P1 => "abbia" ; + Cong Pres Sg P2 => "abbia" ; + Cong Pres Sg P3 => "abbia" ; + Cong Pres Pl P1 => "abbiamo" ; + Cong Pres Pl P2 => "abbiate" ; + Cong Pres Pl P3 => "abbiano" ; + Imper SgP2 => "abbi" ; + Imper PlP1 => "abbiamo" ; + Imper PlP2 => "abbiate" ; + _ => "avere" --- we just don't care + }} ; + +} diff --git a/lib/resource-0.6/italian/StructuralIta.gf b/lib/resource-0.6/italian/StructuralIta.gf new file mode 100644 index 000000000..617b92294 --- /dev/null +++ b/lib/resource-0.6/italian/StructuralIta.gf @@ -0,0 +1,114 @@ +--# -path=.:../romance:../abstract:../../prelude + +concrete StructuralIta of Structural = CombinationsIta ** + open SyntaxIta, MorphoIta, Prelude in { + +lin + INP = pronNounPhrase pronJe ; + ThouNP = pronNounPhrase pronTu ; + HeNP = pronNounPhrase pronIl ; + SheNP = pronNounPhrase pronElle ; + WeNP n = pronNounPhrase (pronWithNum pronNous n) ; + YeNP n = pronNounPhrase (pronWithNum pronVous n) ; + YouNP = pronNounPhrase pronVous ; + TheyNP = pronNounPhrase pronIls ; + +-- Here is a point where the API is really inadequate for French, +-- which distinguishes between masculine and feminine "they". +-- The following solution is not attractive. + +--- TheyNP = pronNounPhrase (variants {pronIls ; pronElles}) ; + + ThisNP = mkNameNounPhrase ["questo"] Masc ; + ThatNP = mkNameNounPhrase ["quello"] Masc ; + TheseNP n = mkNameNounPhrase ("questi" ++ n.s ! Masc) Masc ; + ThoseNP n = mkNameNounPhrase ("quelli" ++ n.s ! Masc) Masc ; + + ItNP = pronNounPhrase pronIl ; + + EveryDet = chaqueDet ; + AllDet = mkDeterminer singular "tutto" "tutta" ; + AllsDet = mkDeterminerNum plural ["tutti i"] ["tutte le"] ; --- gli + WhichDet = quelDet ; + WhichsDet = mkDeterminerNum plural "quali" "quali" ; + MostsDet = plupartDet ; + MostDet = mkDeterminer1 singular (["la maggior parte"] ++ elisDe) ; --- de + SomeDet = mkDeterminer1 singular "qualche" ; + SomesDet = mkDeterminerNum plural "alcuni" "alcune" ; + NoDet = mkDeterminer singular "nessuno" "nessuna" ; --- non + NosDet = mkDeterminerNum plural "nessuni" "nessune" ; ---- ?? + AnyDet = mkDeterminer1 singular "qualche" ; --- + AnysDet = mkDeterminerNum plural "alcuni" "alcune" ; --- + ManyDet = mkDeterminer plural "molti" "molte" ; + MuchDet = mkDeterminer1 singular "molto" ; + ThisDet = mkDeterminer singular "questo" "questa" ; + ThatDet = mkDeterminer singular "quello" "quella" ; + TheseDet = mkDeterminerNum plural "questi" "queste" ; --- ci + ThoseDet = mkDeterminerNum plural "quelli" "quelle" ; --- quegli + + HowIAdv = commentAdv ; + WhenIAdv = quandAdv ; + WhereIAdv = ouAdv ; + WhyIAdv = pourquoiAdv ; + + AndConj = etConj ; + OrConj = ouConj ; + BothAnd = etetConj ; + EitherOr = ououConj ; + NeitherNor = niniConj ; --- requires ne ! + IfSubj = siSubj ; + WhenSubj = quandSubj ; + + PhrYes = ouiPhr ; + PhrNo = nonPhr ; --- and also Si! + + VeryAdv = ss "molto" ; + TooAdv = ss "troppo" ; + OtherwiseAdv = ss "altramente" ; + ThereforeAdv = ss "quindi" ; + + EverybodyNP = mkNameNounPhrase ["tutti"] Masc ; + SomebodyNP = mkNameNounPhrase ["qualcuno"] Masc ; + NobodyNP = mkNameNounPhrase ["nessuno"] Masc ; --- ne + EverythingNP = mkNameNounPhrase ["tutto"] Masc ; + SomethingNP = mkNameNounPhrase ["qualche cosa"] Masc ; + NothingNP = mkNameNounPhrase ["niente"] Masc ; --- ne + + CanVV = mkVerbVerbDir (mkVerbPres + "poss" "può" "poss" "potete" "possono" "possa" "puoi" "potere" "potuto") ; + CanKnowVV = mkVerbVerbDir (mkVerbPres + "s" "sa" "sapp" "sapete" "sanno" "sappia" "sai" "sapere" "saputo") ; + MustVV = mkVerbVerbDir (mkVerbPres + "dev" "deve" "dobb" "dovete" "devono" "debba" "devi" "dovere" "dovuto") ; + WantVV = mkVerbVerbDir (mkVerbPres + "vogli" "vuole" "vogl" "volete" "vogliono" "voglia" "vuoi" "volere" "voluto") ; + + EverywhereNP = ss "dappertutto" ; + SomewhereNP = ss ["qualche parte"] ; --- ne - pas + NowhereNP = ss ["nessun parte"] ; + + AlthoughSubj = ss "benché" ** {m = Con} ; + + AlmostAdv = ss "quasi" ; + QuiteAdv = ss "assai" ; + + InPrep = justCase (CPrep P_in) ; + OnPrep = justCase (CPrep P_su) ; + ToPrep = justCase dative ; --- + ThroughPrep = justPrep "per" ; + AbovePrep = justPrep "sopra" ; + UnderPrep = justPrep "sotto" ; + InFrontPrep = justPrep "davanti" ; + BehindPrep = justPrep "dietro" ; + BetweenPrep = justPrep "tra" ; + FromPrep = justCase (CPrep P_da) ; + BeforePrep = justPrep "prima" ; + DuringPrep = justPrep "durante" ; + AfterPrep = justPrep "dopo" ; + WithPrep = justCase (CPrep P_con) ; + WithoutPrep = justPrep "senza" ; + ByMeansPrep = justPrep "per" ; + PartPrep = justCase genitive ; --- + AgentPrep = justCase (CPrep P_da) ; + +} diff --git a/lib/resource-0.6/italian/SyntaxIta.gf b/lib/resource-0.6/italian/SyntaxIta.gf new file mode 100644 index 000000000..d9b57ec23 --- /dev/null +++ b/lib/resource-0.6/italian/SyntaxIta.gf @@ -0,0 +1,310 @@ +--# -path=.:../romance:../../prelude + +instance SyntaxIta of SyntaxRomance = + TypesIta ** open Prelude, (CO=Coordination), MorphoIta in { +oper + nameNounPhrase = \jean -> + normalNounPhrase + (\\c => prepCase c ++ jean.s) + jean.g + Sg ; + + partitiveNounPhrase = \n,vino -> + normalNounPhrase + (table { + CPrep P_di => elisDe ++ vino.s ! n ; + c => prepCase c ++ artDef vino.g n (CPrep P_di) ++ vino.s ! n + } + ) + vino.g + n ; + + chaqueDet = mkDeterminer1 Sg "ogni" ; + tousDet = mkDeterminer Pl ["tutti i"] ["tutte le"] ; --- gli + plupartDet = mkDeterminer1 Pl ["la maggior parte di"] ; --- dei, degli, delle + unDet = mkDeterminer Sg artUno artUna ; + plDet = mkDeterminer1 Pl [] ; --- dei, degli, delle + + quelDet = mkDeterminer1 Sg "quale" ; + + npGenPoss = \n,ton,mec -> + \\c => artDef mec.g n c ++ ton.s ! Poss n mec.g ++ mec.s ! n ; --- mia madre + + npGenPossNum = \nu,ton,mec -> + \\c => artDef mec.g Pl c ++ ton.s ! Poss Pl mec.g ++ nu.s ! mec.g ++ mec.s ! Pl ; + + existNounPhrase = \delvino -> { + s = \\m => + case m of { + Ind => case delvino.n of {Sg => "c'è" ; Pl => ["ci sono"]} ; + Con => case delvino.n of {Sg => ["ci sia"] ; Pl => ["ci siano"]} + } ++ delvino.s ! stressed accusative --- ce ne sono ; have to define "ci" + } ; + + mkAdjSolo : Str -> Bool -> Adjective = \adj,p -> + mkAdjective (adjSolo adj) p ; + + mkAdjTale : Str -> Bool -> Adjective = \adj,p -> + mkAdjective (adjTale adj) p ; + + mkAdjDegrSolo : Str -> Bool -> AdjDegr = \adj,p -> + mkAdjDegrLong (adjSolo adj) p ; + + mkAdjDegrTale : Str -> Bool -> AdjDegr = \adj,p -> + mkAdjDegrLong (adjTale adj) p ; + + comparConj = variants {"di" ; "che"} ; + +-- The commonest case for functions is common noun + "di". + + funDi : CommNounPhrase -> Function = \mere -> + mere ** complementCas genitive ; + +-- Chains of "cui" - "cui" do not arise. + + funRelPron = \mere,lequel -> + {s = table { + RComplex g n c => variants { + case mere.c of { + CPrep P_di => artDef mere.g n c ++ + lequel.s ! RSimple dative ++ mere.s ! n ; + _ => nonExist} ; + artDef mere.g n c ++ mere.s ! n ++ + mere.s2 ++ lequel.s ! RComplex g n mere.c + } ; + _ => nonExist + } ; + g = RG mere.g + } ; + +-- Verbs + + negVerb = \va -> "non" ++ va ; + + copula = \b -> \\v => (if_then_else Str b [] "non") ++ verbEssere.s ! v ; + + isTransVerbClit = \v -> case v.c of { + Acc => True ; + _ => False --- hmmm + } ; + +-- The negation of a verb. + + posNeg = \b,v,c -> + if_then_else Str b + (v ++ c) + ("non" ++ v ++ c) ; + + embedConj = "che" ; + +-- Relative pronouns + + identRelPron = { + s = table { + RSimple c => relPronForms ! c ; + RComplex g n c => composRelPron g n c + } ; + g = RNoGen + } ; + + suchPron = talPron ; + + composRelPron = ilqualPron ; + + allRelForms = \lequel,g,n,c -> + variants { + lequel.s ! RSimple c ; + lequel.s ! RComplex g n c + } ; + +-- Interrogative pronouns + + nounIntPron = \n, mec -> + {s = \\c => prepCase c ++ qualPron mec.g n ++ mec.s ! n ; + g = mec.g ; + n = n + } ; + + intPronWho = \num -> { + s = \\c => prepCase c ++ "chi" ; + g = Masc ; --- can we decide this? + n = num + } ; + + intPronWhat = \num -> { + s = table { + c => prepCase c ++ "che" ++ optStr "cosa" + } ; + g = Masc ; --- can we decide this? + n = num + } ; + +-- Questions + + questVerbPhrase = \jean,dort -> + {s = table { + DirQ => (predVerbPhrase jean dort).s ! Ind ; + IndirQ => "se" ++ (predVerbPhrase jean dort).s ! Ind + } + } ; + + existNounPhraseQuest = \delvino -> + let cedelvino = (existNounPhrase delvino).s ! Ind + in { + s = \\m => case m of {DirQ => [] ; _ => "se"} ++ cedelvino + } ; + + intVerbPhrase = \qui, dort -> + {s = table { + DirQ => qui.s ! Nom ++ + dort.s ! qui.g ! VFin Ind qui.n P3 ; + IndirQ => qui.s ! Nom ++ dort.s ! qui.g ! VFin Ind qui.n P3 + } + } ; + + intSlash = \Qui, Tuvois -> + let {qui = Tuvois.s2 ++ Qui.s ! Tuvois.c ; tuvois = Tuvois.s ! Ind} in + {s = table { + DirQ => qui ++ tuvois ; + IndirQ => ifCe Tuvois.c ++ qui ++ tuvois + } + } ; + +-- An auxiliary to distinguish between +-- "je ne sais pas" ("ce qui dort" / "ce que tu veux" / "à qui tu penses"). + + ifCe : Case -> Str = \c -> case c of { --- + Nom => "ciò" ; + Acc => "ciò" ; + _ => [] + } ; + + questAdverbial = \quand, jean, dort -> + let {jeandort = (predVerbPhrase jean dort).s ! Ind} in + {s = table { + DirQ => quand.s ++ jeandort ; --- inversion? + IndirQ => quand.s ++ jeandort + } + } ; + +---- moved from MorphoIta + +-- A macro for defining gender-dependent tables will be useful. +-- Its first application is in the indefinite article. + + genForms = \matto, matta -> + table {Masc => matto ; Fem => matta} ; + + artUno : Str = elision "un" "un" "uno" ; + artUna : Str = elision "una" "un'" "una" ; + + artIndef = \g,n,c -> case n of { + Sg => prepCase c ++ genForms artUno artUna ! g ; + _ => prepCase c ++ [] + } ; + + artDef = \g,n,c -> artDefTable ! g ! n ! c ; + +-- The composable pronoun "il quale" is inflected by varying the definite +-- article and the determiner "quale" in the expected way. + + ilqualPron : Gender -> Number -> Case -> Str = \g,n,c -> + artDef g n c ++ qualPron g n ; + + pronJe = mkPronoun + "io" + "mi" + "mi" + "me" + "mio" "mia" "miei" "mie" + PNoGen -- gender cannot be known from pronoun alone + Sg + P1 + Clit1 ; + + pronTu = mkPronoun + "tu" + "ti" + "ti" + "te" + "tuo" "tua" "tuoi" "tue" + PNoGen + Sg + P2 + Clit1 ; + + pronIl = mkPronoun + "lui" + "lo" + "gli" + "lui" + "suo" "sua" "suoi" "sue" + (PGen Masc) + Sg + P3 + Clit2 ; + + pronElle = mkPronoun + "lei" + "la" + "le" + "lei" + "suo" "sua" "suoi" "sue" + (PGen Fem) + Sg + P3 + Clit2 ; + + pronNous = mkPronoun + "noi" + "ci" + "ci" + "noi" + "nostro" "nostra" "nostri" "nostre" + PNoGen + Pl + P1 + Clit3 ; + + pronVous = mkPronoun + "voi" + "vi" + "vi" + "voi" + "vostro" "vostra" "vostri" "vostre" + PNoGen + Pl --- depends! + P2 + Clit3 ; + + pronIls = mkPronoun + "loro" + "loro" + "li" --- le ! + "loro" + "loro" "loro" "loro" "loro" + PNoGen + Pl + P3 + Clit1 ; + +-- moved from ResIta + + commentAdv = ss "comme" ; + quandAdv = ss "quando" ; + ouAdv = ss "o" ; + pourquoiAdv = ss "perché" ; + + etConj = ss "e" ** {n = Pl} ; + ouConj = ss "o" ** {n = Sg} ; + etetConj = sd2 "e" "e" ** {n = Pl} ; + ououConj = sd2 "o" "o" ** {n = Sg} ; + niniConj = sd2 "né" "né" ** {n = Sg} ; --- requires ne ! + siSubj = ss "se" ** {m = Ind} ; + quandSubj = ss "quando" ** {m = Ind} ; + + ouiPhr = ss ["Sì ."] ; + nonPhr = ss ["No ."] ; + +} + diff --git a/lib/resource-0.6/italian/TestResourceIta.gf b/lib/resource-0.6/italian/TestResourceIta.gf new file mode 100644 index 000000000..4b36f8deb --- /dev/null +++ b/lib/resource-0.6/italian/TestResourceIta.gf @@ -0,0 +1,51 @@ +--# -path=.:../romance:../abstract:../../prelude + +concrete TestResourceIta of TestResource = + StructuralIta ** open Prelude, TypesIta, MorphoIta, SyntaxIta in { + +flags startcat=Phr ; lexer=text ; parser=chart ; unlexer=text ; + +lin + Big = mkAdjDegrTale "grande" adjPre ; + Small = mkAdjDegrSolo "piccolo" adjPre ; + Old = mkAdjDegrLong (mkAdj "vecchio" "vecchia" "vecchi" "vecchie" "vecchiamente") + adjPre ; + Young = mkAdjDegrTale "giovane" adjPre ; + Happy = mkAdjDegrTale "felice" adjPost ; + American = mkAdjective (adjSolo "americano") adjPost ; + Finnish = mkAdjective (adjTale "finlandese") adjPost ; + Married = mkAdjCompl (adjSolo "sposato") adjPost {s2 = [] ; c = dative} ; + Man = mkCNom (numForms "uomo" "uomini") Masc ; + Woman = mkCNom (nomRana "donna") Fem ; + Car = mkCNom (nomRana "macchina") Fem ; + Light = mkCNom (nomSale "luce") Fem ; + House = mkCNom (nomRana "casa") Fem ; + Wine = mkCNom (nomVino "vino") Masc ; + Bottle = mkCNom (nomRana "bottiglia") Fem ; + Bar = mkCNom (nomTram "bar") Masc ; + Walk = verbAmare "camminare" ; + Run = verbCorrere "correre" "corso" ; + Send = mkTransVerbDir (verbAmare "mandare") ; + Love = mkTransVerbDir (verbAmare "amare") ; + Wait = mkTransVerbCas (verbAmare "aspettare") dative ; + Drink = mkTransVerbDir (mkVerbPres + "bev" "beve" "bev" "bevete" "bevono" "beva" "bevi" "bere" "bevuto") ; + Give = mkDitransVerb (mkVerbPres + "d" "da" "d" "date" "danno" "dia" "dà" "dare" "dato") + [] dative [] accusative ; + Prefer = mkDitransVerb (verbFinire "preferire") [] accusative [] dative ; + Say = verbSent verbPresDire Ind Ind ; + 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) ; + Connection = mkCNom (nomSale "connessione") Fem ** + {s2 = [] ; c = CPrep P_da ; s3 = [] ; c3 = dative} ; + + Well = ss "bene" ; + Always = ss "sempre" ; + + John = mkProperName "Giovanni" Masc ; + Mary = mkProperName "Maria" Fem ; +} diff --git a/lib/resource-0.6/italian/TypesIta.gf b/lib/resource-0.6/italian/TypesIta.gf new file mode 100644 index 000000000..761df4f61 --- /dev/null +++ b/lib/resource-0.6/italian/TypesIta.gf @@ -0,0 +1,132 @@ +--1 Italian Word Classes and Morphological Parameters +-- +-- This is a resource module for Italian morphology, defining the +-- morphological parameters and word classes of Italian. +-- The morphology is so far only +-- complete w.r.t. the syntax part of the resource grammar. +-- It does not include those parameters that are not needed for +-- analysing individual words: such parameters are defined in syntax modules. + +instance TypesIta of TypesRomance = { + +-- First we give values to the abstract types. + +param + Case = Nom | Acc | CPrep Prep ; + + Prep = P_di | P_a | P_da | P_in | P_su | P_con ; + + NPForm = Ton Case | Aton Case | Poss Number Gender ; + +--2 Prepositions +-- +-- The type $Case$ in $types.Ita.gf$ has the dative and genitive +-- cases, which are relevant for pronouns and the definite article, +-- but which are otherwise expressed by prepositions. + +oper + prepCase = \c -> case c of { + Nom => [] ; + Acc => [] ; + CPrep p => strPrep p + } ; + + strPrep : Prep -> Str = \p -> case p of { + P_di => "di" ; + P_a => "a" ; + P_da => "da" ; + P_in => "in" ; + P_su => "su" ; + P_con => "con" + } ; + +oper + CaseA = Case ; + NPFormA = NPForm ; + + nominative = Nom ; + accusative = Acc ; + genitive = CPrep P_di ; + dative = CPrep P_a ; + + stressed = Ton ; + unstressed = Aton ; + +oper + pform2case = \p -> case p of { + Ton x => x ; + Aton x => x ; + Poss _ _ => genitive + } ; + + case2pform = \c -> case c of { + Nom => Aton Nom ; + Acc => Aton Acc ; + _ => Ton c + } ; + +-- Comparative adjectives are only sometimes formed morphologically +-- (actually: by different morphemes). + + mkAdjComp : (_,_ : AForm => Str) -> AdjComp = + \buono, migliore -> + {s = table {Pos => buono ; _ => migliore}} ; + +-- Usually the comparison forms are built by prefixing the word +-- "più". The definite article needed in the superlative is provided in +-- $syntax.Ita.gf$. + + adjCompLong : Adj -> AdjComp = \caro -> + mkAdjComp + caro.s + (\\gn => "più" ++ caro.s ! gn) ; + + +-- Relative pronouns: the case-dependent parameter type. + + param RelForm = RSimple Case | RComplex Gender Number Case ; + + oper RelFormA = RelForm ; + +--2 Relative pronouns +-- +-- The simple (atonic) relative pronoun shows genuine variation in all of the +-- cases. + + relPronForms = table { + Nom => "che" ; + Acc => "che" ; + CPrep P_a => "cui" ; --- variant a cui + CPrep p => strPrep p ++ "cui" + } ; + +-- Verbs: conversion from full verbs to present-tense verbs. + + verbPres = \amare -> {s = table { + VInfin => amare.s ! Inf ; + VFin Ind n p => amare.s ! Indi Pres n p ; + VFin Con n p => amare.s ! Cong Pres n p ; + VImper np => amare.s ! Imper np ; + VPart g n => amare.s ! Part PresP g n + }} ; + +-- The full conjunction is a table on $VForm$: + +param + Tempo = Pres | Imperf ; + TempoP = PresP | PassP ; + VForm = + Inf + | Indi Tempo Number Person + | Pass Number Person + | Fut Number Person + | Cong Tempo Number Person + | Cond Number Person + | Imper NumPersI + | Ger + | Part TempoP Gender Number ; + +-- This is the full verb type. + +oper Verbum = {s : VForm => Str} ; +} diff --git a/lib/resource-0.6/romance/CombinationsRomance.gf b/lib/resource-0.6/romance/CombinationsRomance.gf index ebf0b7716..e4b414a6c 100644 --- a/lib/resource-0.6/romance/CombinationsRomance.gf +++ b/lib/resource-0.6/romance/CombinationsRomance.gf @@ -36,11 +36,13 @@ lincat PN = {s : Str ; g : Gender} ; Det = {s : Gender => Str ; n : Number} ; Adj1 = Adjective ; - -- = {s : Gender => Number => Str ; p : Bool} ; + -- = {s : AForm => Str ; p : Bool} ; Adj2 = Adjective ** {s2 : Preposition ; c : CaseA} ; - AdjDeg = {s : Degree => Gender => Number => Str ; p : Bool} ; + AdjDeg = {s : Degree => AForm => Str ; p : Bool} ; AP = Adjective ; - Fun = CommNoun ** {s2 : Preposition ; c : CaseA} ; + Fun = Function ; + -- = CommNoun ** {s2 : Preposition ; c : CaseA} ; + Fun2 = Function ** {s3 : Preposition ; c3 : CaseA} ; Prep = {s : Preposition ; c : CaseA} ; Num = {s : Gender => Str} ; @@ -48,8 +50,11 @@ lincat -- = {s : VF => Str} ; VG = {s : Bool => Gender => VF => Str} ; VP = {s : Gender => VF => Str} ; - TV = Verb ** {s2 : Preposition ; c : CaseA} ; + TV = TransVerb ; + -- = Verb ** {s2 : Preposition ; c : CaseA} ; + V3 = TransVerb ** {s3 : Preposition ; c3 : CaseA} ; VS = Verb ** {mp,mn : Mode} ; + VV = Verb ** {c : CaseA} ; AdV = {s : Str} ; S = Sentence ; @@ -68,19 +73,21 @@ lincat ConjD = {s1,s2 : Str ; n : Number} ; ListS = {s1,s2 : Mode => Str} ; - ListAP = {s1,s2 : Gender => Number => Str ; p : Bool} ; + ListAP = {s1,s2 : AForm => Str ; p : Bool} ; ListNP = {s1,s2 : CaseA => Str ; g : PronGen ; n : Number ; p : Person} ; + Subj = {s : Str ; m : Mode} ; --. lin UseN = noun2CommNounPhrase ; ModAdj = modCommNounPhrase ; ModGenOne = npGenDet singular ; ----- ModGenMany = npGenDet plural ; + ModGenMany = npGenDetNum ; UsePN = nameNounPhrase ; UseFun = funAsCommNounPhrase ; -- [SyntaxFra.noun2CommNounPhrase] AppFun = appFunComm ; + AppFun2 = appFun2 ; AdjP1 = adj2adjPhrase ; ComplAdj = complAdj ; PositAdjP = positAdjPhrase ; @@ -89,24 +96,43 @@ lin DetNP = detNounPhrase ; IndefOneNP = indefNounPhrase singular ; ----- IndefManyNP = indefNounPhrase plural ; + IndefManyNP = indefNounPhraseNum ; DefOneNP = defNounPhrase singular ; ----- DefManyNP = defNounPhrase plural ; + DefManyNP = defNounPhraseNum ; + MassNP = partitiveNounPhrase singular ; + UseInt i = {s = \\_ => i.s} ; + NoNum = noNum ; + + CNthatS = nounThatSentence ; PredVP = predVerbPhrase ; + PosVG = predVerbGroup True ; + NegVG = predVerbGroup False ; + PredV = predVerb ; PredAP = predAdjective ; PredCN = predCommNoun ; PredTV = complTransVerb ; + PredV3 = complDitransVerb ; PredNP = predNounPhrase ; + PredAdV = predAdverb ; PredVS = complSentVerb ; + PredVV = complVerbVerb ; + PredPassV = predPassVerb ; + VTrans = transAsVerb ; + AdjAdv a = {s = a.s ! AA} ; AdvVP = adVerbPhrase ; PrepNP = prepNounPhrase ; AdvCN = advCommNounPhrase ; + AdvAP = advAdjPhrase ; + + ThereNP = existNounPhrase ; PosSlashTV = slashTransVerb True ; NegSlashTV = slashTransVerb False ; + OneVP = predVerbPhrase nounPhraseOn ; + IdRP = identRelPron ; FunRP = funRelPron ; @@ -116,17 +142,18 @@ lin RelSuch = relSuch ; WhoOne = intPronWho singular ; ----- WhoMany = intPronWho plural ; + WhoMany = intPronWho plural ; WhatOne = intPronWhat singular ; ----- WhatMany = intPronWhat plural ; + WhatMany = intPronWhat plural ; FunIP = funIntPron ; NounIPOne = nounIntPron singular ; ----- NounIPMany = nounIntPron plural ; + NounIPMany = nounIntPron plural ; QuestVP = questVerbPhrase ; IntVP = intVerbPhrase ; IntSlash = intSlash ; QuestAdv = questAdverbial ; + IsThereNP = existNounPhraseQuest ; ImperVP = imperVerbPhrase ; @@ -135,6 +162,8 @@ lin ImperOne = imperUtterance singular ; ImperMany = imperUtterance plural ; + AdvS = advSentence ; + TwoS = twoSentence ; ConsS = consSentence ; ConjS = conjunctSentence ; @@ -153,10 +182,14 @@ lin SubjS = subjunctSentence ; -- stack SubjImper = subjunctImperative ; SubjQu = subjunctQuestion ; + SubjVP = subjunctVerbPhrase ; PhrNP = useNounPhrase ; PhrOneCN = useCommonNounPhrase singular ; PhrManyCN = useCommonNounPhrase plural ; PhrIP ip = ip ; PhrIAdv ia = ia ; + + OnePhr p = p ; + ConsPhr = cc2 ; } diff --git a/lib/resource-0.6/romance/SyntaxRomance.gf b/lib/resource-0.6/romance/SyntaxRomance.gf index 1f100f6ae..23cf65bdf 100644 --- a/lib/resource-0.6/romance/SyntaxRomance.gf +++ b/lib/resource-0.6/romance/SyntaxRomance.gf @@ -47,6 +47,8 @@ oper mkNameNounPhrase : Str -> Gender -> NounPhrase = \jean,m -> nameNounPhrase (mkProperName jean m) ; + nounPhraseOn = mkNameNounPhrase "on" Masc ; + normalNounPhrase : (CaseA => Str) -> Gender -> Number -> NounPhrase = \cs,g,n -> {s = \\p => cs ! (pform2case p) ; g = PGen g ; @@ -173,6 +175,26 @@ oper npGenPossNum : Numeral -> NounPhrase -> CommNounPhrase -> CaseA => Str ; +-- Constructions like "l'idée que la terre est ronde" are formed at the +-- first place as common nouns, so that one can also have "la suggestion que...". + + nounThatSentence : CommNounPhrase -> Sentence -> CommNounPhrase = \idee,x -> + {s = \\n => idee.s ! n ++ elisQue ++ x.s ! Ind ; + g = idee.g + } ; + +-- The existence construction "il y a", "c'è / ci sono" is defined separately, +-- and ad hoc, in each language. + + existNounPhrase : NounPhrase -> Sentence ; + +-- The partitive noun phrase has special nominative and accusative, which look like +-- genitives ("du vin, avec du vin", as well as genitive form, where the definite +-- article contracts away ("de vin"). + + partitiveNounPhrase : Number -> CommNounPhrase -> NounPhrase ; + + --2 Adjectives -- -- Adjectives have a parameter $p$ telling if postposition is @@ -219,7 +241,7 @@ oper -- variants "che" and "di". comparAdjPhrase : AdjDegr -> NounPhrase -> AdjPhrase = \bon, toi -> - {s = \\g,n => bon.s ! Comp ! g ! n ++ comparConj ++ + {s = \\a => bon.s ! Comp ! a ++ comparConj ++ toi.s ! stressed accusative ; p = False } ; @@ -233,8 +255,8 @@ oper superlNounPhrase : AdjDegr -> CommNoun -> NounPhrase = \bon, mec -> normalNounPhrase (\\c => artDef mec.g Sg c ++ if_then_else Str bon.p - (bon.s ! Sup ! mec.g ! Sg ++ mec.s ! Sg) - (mec.s ! Sg ++ artDef mec.g Sg nominative ++ bon.s ! Sup ! mec.g ! Sg) + (bon.s ! Sup ! AF mec.g Sg ++ mec.s ! Sg) + (mec.s ! Sg ++ artDef mec.g Sg nominative ++ bon.s ! Sup ! AF mec.g Sg) ) mec.g Sg ; @@ -272,7 +294,7 @@ oper mkAdjective adj p ** c ; complAdj : AdjCompl -> NounPhrase -> AdjPhrase = \relie,jean -> - {s = \\g,n => relie.s ! g ! n ++ relie.s2 ++ jean.s ! case2pform relie.c ; + {s = \\a => relie.s ! a ++ relie.s2 ++ jean.s ! case2pform relie.c ; p = False } ; @@ -288,8 +310,8 @@ oper modCommNounPhrase : AdjPhrase -> CommNounPhrase -> CommNounPhrase = \bon,mec -> {s = \\n => if_then_else Str bon.p - (bon.s ! mec.g ! n ++ mec.s ! n) - (mec.s ! n ++ bon.s ! mec.g ! n) ; + (bon.s ! AF mec.g n ++ mec.s ! n) + (mec.s ! n ++ bon.s ! AF mec.g n) ; g = mec.g } ; @@ -310,24 +332,38 @@ oper -- of the readings is meaningful. appFunComm : Function -> NounPhrase -> CommNounPhrase = \mere,jean -> - noun2CommNounPhrase - {s = \\n => mere.s ! n ++ mere.s2 ++ jean.s ! case2pform mere.c ; - g = mere.g - } ; + {s = \\n => mere.s ! n ++ mere.s2 ++ jean.s ! case2pform mere.c ; + g = mere.g + } ; + +-- Two-place functions add one argument place. + + Function2 = Function ** {s3 : Preposition ; c3 : CaseA} ; + +-- There application starts by filling the first place. + + appFun2 : Function2 -> NounPhrase -> Function = \vol, paris -> + {s = \\n => vol.s ! n ++ vol.s2 ++ paris.s ! case2pform vol.c ; + g = vol.g ; + s2 = vol.s3 ; + c = vol.c3 + } ; + -- It is possible to use a function word as a common noun; the semantics is -- often existential or indexical. - funAsCommNounPhrase : Function -> CommNounPhrase = - noun2CommNounPhrase ; + funAsCommNounPhrase : Function -> CommNounPhrase = \x -> x ; -- The following is an aggregate corresponding to the original function application -- producing "ma mère" and "la mère de Jean". It does not appear in the -- resource grammar API any longer. appFun : Bool -> Function -> NounPhrase -> NounPhrase = \coll, mere, jean -> - let {n = jean.n ; g = mere.g ; nf = if_then_else Number coll Sg n} in - variants { + let + n = jean.n ; + g = mere.g ; nf = if_then_else Number coll Sg n + in variants { defNounPhrase nf (appFunComm mere jean) ; npGenDet nf jean mere } ; @@ -374,7 +410,7 @@ oper -- on semantic grounds. predAdjective : AdjPhrase -> VerbGroup = \bon -> - {s = \\b,g,v => copula b ! v ++ bon.s ! g ! nombreVerb v} ; + {s = \\b,g,v => copula b ! v ++ bon.s ! AF g (nombreVerb v)} ; predCommNoun : CommNounPhrase -> VerbGroup = \homme -> {s = \\b,g,v => copula b ! v ++ indefNoun (nombreVerb v) homme} ; @@ -382,6 +418,13 @@ oper predNounPhrase : NounPhrase -> VerbGroup = \jean -> {s = \\b,g,v => copula b ! v ++ jean.s ! stressed nominative} ; + predAdverb : Adverb -> VerbGroup = \dehors -> + {s = \\b,g,v => copula b ! v ++ dehors.s} ; + +-- Passivization is like adjectival predication. + + predPassVerb : Verb -> VerbGroup = \aimer -> + {s = \\b,g,v => copula b ! v ++ aimer.s ! VPart g (nombreVerb v)} ; -- complement a verb with noun phrase and optional preposition @@ -434,6 +477,38 @@ oper mkTransVerbDir : Verb -> TransVerb = \aimer -> mkTransVerbCas aimer accusative ; +-- Transitive verbs can be used elliptically as verbs. The semantics +-- is left to applications. The definition is trivial, due to record +-- subtyping. + + transAsVerb : TransVerb -> Verb = \love -> + love ; + +-- *Ditransitive verbs* are verbs with three argument places. +-- We treat so far only the rule in which the ditransitive +-- verb takes both complements to form a verb phrase. + + DitransVerb = TransVerb ** {s3 : Preposition ; c3 : CaseA} ; + + mkDitransVerb : Verb -> Preposition -> CaseA -> Preposition -> CaseA -> DitransVerb = + \v,p1,c1,p2,c2 -> + v ** {s2 = p1 ; c = c1 ; s3 = p2 ; c3 = c2} ; + +--- This must be completed to account for the cliticization of the second object. + + complDitransVerb : + DitransVerb -> NounPhrase -> NounPhrase -> VerbGroup = \donner,jean,vin -> + {s = \\b,g,w => + let + donne = donner.s ! w ; + Jean = jean.s ! (case2pform donner.c) ; + duvin = vin.s ! (case2pform donner.c3) ; + in + if_then_Str (andB (isNounPhraseClit jean) (isTransVerbClit donner)) + (posNeg b (Jean ++ donne) duvin) + (posNeg b donne (Jean ++ duvin)) + } ; + -- The following macro builds the "ne - pas" or "non" negation. The second -- string argument is used for the complement of a verb phrase. In Italian, -- one string argument would actually be enough. @@ -459,10 +534,15 @@ oper -- treated as cases. Therefore, both a preposition and a case are needed -- as arguments. - prepNounPhrase : {s : Preposition ; c : CaseA} -> NounPhrase -> Adverb = - \dans,jean -> + prepNounPhrase : {s : Preposition ; c : CaseA} -> NounPhrase -> Adverb = \dans,jean -> {s = dans.s ++ jean.s ! Ton dans.c} ; + justPrep : Preposition -> {s : Preposition ; c : CaseA} = \sans -> + {s = sans ; c = prepositional} ; + + justCase : CaseA -> {s : Preposition ; c : CaseA} = \nom -> + {s = [] ; c = nom} ; + -- This is a source of the "homme avec un téléscope" ambiguity, and may produce -- strange things, like "les voitures toujours". -- Semantics will have to make finer distinctions among adverbials. @@ -473,6 +553,11 @@ oper g = mec.g } ; + advAdjPhrase : Adverb -> AdjPhrase -> AdjPhrase = \trop,lent -> + {s = \\a => trop.s ++ lent.s ! a ; + p = lent.p + } ; + --2 Sentences -- -- Sentences depend on a *mode parameter* selecting between @@ -511,6 +596,21 @@ oper embedConj : Str ; +--3 Verb-complement verbs +-- +-- Verb-complement verbs take verb phrases as complements. +-- They can need an oblique case ("à", "de"), but they work like ordinary verbs. + + VerbVerb : Type = Verb ** {c : CaseA} ; + + complVerbVerb : VerbVerb -> VerbGroup -> VerbGroup = \devoir, nager -> + {s = \\b,g,v => if_then_Str b (devoir.s ! v) (negVerb (devoir.s ! v)) ++ + prepCase devoir.c ++ nager.s ! True ! g ! VInfin + } ; + + mkVerbVerbDir : Verb -> VerbVerb = \v -> v ** {c = accusative} ; + + --2 Sentences missing noun phrases -- -- This is one instance of Gazdar's *slash categories*, corresponding to his @@ -669,6 +769,10 @@ oper questVerbPhrase : NounPhrase -> VerbPhrase -> Question ; +-- The existence question is treated separately. + + existNounPhraseQuest : NounPhrase -> Question ; + --3 Wh-questions -- -- Wh-questions are of two kinds: ones that are like $NP - VP$ sentences, @@ -715,6 +819,13 @@ oper imperUtterance : Number -> Imperative -> Utterance = \n,I -> ss (I.s ! Masc ! n ++ "!") ; +--2 Sentence adverbials +-- +-- This class covers adverbials such as "autrement", "donc", which are prefixed +-- to a sentence to form a phrase. + + advSentence : SS -> Sentence -> Utterance = \donc,ildort -> + ss (donc.s ++ ildort.s ! Ind ++ ".") ; --2 Coordination @@ -770,19 +881,19 @@ oper -- if and only if all elements are prefix. ListAdjPhrase : Type = - {s1,s2 : Gender => Number => Str ; p : Bool} ; + {s1,s2 : AForm => Str ; p : Bool} ; twoAdjPhrase : (_,_ : AdjPhrase) -> ListAdjPhrase = \x,y -> - CO.twoTable2 Gender Number x y ** {p = andB x.p y.p} ; + CO.twoTable AForm x y ** {p = andB x.p y.p} ; consAdjPhrase : ListAdjPhrase -> AdjPhrase -> ListAdjPhrase = \xs,x -> - CO.consTable2 Gender Number CO.comma xs x ** {p = andB xs.p x.p} ; + CO.consTable AForm CO.comma xs x ** {p = andB xs.p x.p} ; conjunctAdjPhrase : Conjunction -> ListAdjPhrase -> AdjPhrase = \c,xs -> - CO.conjunctTable2 Gender Number c xs ** {p = xs.p} ; + CO.conjunctTable AForm c xs ** {p = xs.p} ; conjunctDistrAdjPhrase : ConjunctionDistr -> ListAdjPhrase -> AdjPhrase = \c,xs -> - CO.conjunctDistrTable2 Gender Number c xs ** {p = xs.p} ; + CO.conjunctDistrTable AForm c xs ** {p = xs.p} ; --3 Coordinating noun phrases @@ -850,9 +961,10 @@ oper -- Subjunctions ("si", "quand", etc) -- are a different way to combine sentences than conjunctions. -- The main clause can be a sentences, an imperatives, or a question, --- but the subjoined clause must be a sentence. +-- but the subjoined clause must be a sentence. The inherent mood can be +-- indicative ("si", "quand") or subjunctive ("bien que"). - Subjunction = SS ; + Subjunction = {s : Str ; m : Mode} ; subjunctSentence : Subjunction -> Sentence -> Sentence -> Sentence = \si,A,B -> {s = \\m => subjunctVariants si A (B.s ! m) @@ -872,12 +984,17 @@ oper -- and "je m'en vais si tu fume". subjunctVariants : Subjunction -> Sentence -> Str -> Str = \si,A,B -> - let {As = A.s ! Ind} in + let {As = A.s ! si.m} in variants { si.s ++ As ++ B ; B ++ si.s ++ As } ; + subjunctVerbPhrase : VerbPhrase -> Subjunction -> Sentence -> VerbPhrase = + \V, si, A -> + adVerbPhrase V (ss (si.s ++ A.s ! si.m)) ; + + --2 One-word utterances -- -- An utterance can consist of one phrase of almost any category, @@ -912,7 +1029,7 @@ oper pronJe, pronTu, pronIl, pronElle, pronNous, pronVous, pronIls, pronElles : Pronoun ; - chaqueDet, tousDet, quelDet, plupartDet : Determiner ; + chaqueDet, quelDet, plupartDet : Determiner ; commentAdv, quandAdv, ouAdv, pourquoiAdv : Adverb ; @@ -921,5 +1038,5 @@ oper siSubj, quandSubj : Subjunction ; ouiPhr, noPhr : Utterance ; - + } diff --git a/lib/resource-0.6/romance/TypesRomance.gf b/lib/resource-0.6/romance/TypesRomance.gf index e15f453f6..facac8843 100644 --- a/lib/resource-0.6/romance/TypesRomance.gf +++ b/lib/resource-0.6/romance/TypesRomance.gf @@ -36,6 +36,7 @@ oper accusative : CaseA ; genitive : CaseA ; dative : CaseA ; + prepositional : CaseA ; stressed : CaseA -> NPFormA ; unstressed : CaseA -> NPFormA ; @@ -121,12 +122,17 @@ oper --3 Adjectives -- --- Adjectives are inflected in gender and number. +-- Adjectives are inflected in gender and number, and there is also an adverbial form +-- (e.g. "infiniment"), which has different paradigms and can even be irregular ("bien"). -- Comparative adjectives are moreover inflected in degree -- (which in French and Italian is usually syntactic, though). - Adj : Type = {s : Gender => Number => Str} ; - AdjComp : Type = {s : Degree => Gender => Number => Str} ; +param + AForm = AF Gender Number | AA ; + +oper + Adj : Type = {s : AForm => Str} ; + AdjComp : Type = {s : Degree => AForm => Str} ; --3 Verbs @@ -145,6 +151,7 @@ param VF = VFin Mode Number Person | VImper NumPersI + | VPart Gender Number | VInfin ; diff --git a/lib/resource-0.6/swedish/StructuralSwe.gf b/lib/resource-0.6/swedish/StructuralSwe.gf index 87bf89c6b..0c78f308b 100644 --- a/lib/resource-0.6/swedish/StructuralSwe.gf +++ b/lib/resource-0.6/swedish/StructuralSwe.gf @@ -67,33 +67,6 @@ concrete StructuralSwe of Structural = OtherwiseAdv = ss "annars" ; ThereforeAdv = ss "därför" ; -{- - EveryDet = everyDet ; - AllDet = mkDeterminer Sg "all" ; --- all the missing - AllsDet = mkDeterminerNum Pl "all" ; - WhichDet = whichDet ; - WhichsDet = mkDeterminerNum Pl "which" ; - MostsDet = mostDet ; - MostDet = mkDeterminer Sg "most" ; - SomeDet = mkDeterminer Sg "some" ; - SomesDet = mkDeterminerNum Pl "some" ; - AnyDet = mkDeterminer Sg "any" ; - AnysDet = mkDeterminerNum Pl "any" ; - NoDet = mkDeterminer Sg "no" ; - NosDet = mkDeterminerNum Pl "no" ; - ManyDet = mkDeterminer Sg "many" ; - MuchDet = mkDeterminer Sg ["a lot of"] ; --- - ThisDet = mkDeterminer Sg "this" ; - TheseDet = mkDeterminerNum Pl "these" ; - ThatDet = mkDeterminer Sg "that" ; - ThoseDet = mkDeterminerNum Pl "those" ; - - ThisNP = nameNounPhrase (nameReg "this") ; - ThatNP = nameNounPhrase (nameReg "that") ; - TheseNP n = nameNounPhrase {s = \\c => "these" ++ n.s ! c} ; - ThoseNP n = nameNounPhrase {s = \\c => "those" ++ n.s ! c} ; --} - EverybodyNP = nameNounPhrase (mkProperName "alleman" Utr Masc) ; SomebodyNP = nameNounPhrase (mkProperName "någon" Utr Masc) ; NobodyNP = nameNounPhrase (mkProperName "ingen" Utr Masc) ; diff --git a/lib/resource-0.6/swedish/SyntaxSwe.gf b/lib/resource-0.6/swedish/SyntaxSwe.gf index 991ddaa4a..57ed85a09 100644 --- a/lib/resource-0.6/swedish/SyntaxSwe.gf +++ b/lib/resource-0.6/swedish/SyntaxSwe.gf @@ -428,7 +428,7 @@ oper Function2 = Function ** {s3 : Preposition} ; --- There application starts by filling the first place. +-- Their application starts by filling the first place. appFun2 : Function2 -> NounPhrase -> Function = \flyg, paris -> {s = \\n,d,c => flyg.s ! n ! d ! c ++ flyg.s2 ++ paris.s ! PAcc ; @@ -660,7 +660,7 @@ oper --3 Verb-complement verbs -- --- Sentence-complement verbs take verb phrases as complements. +-- Verb-complement verbs take verb phrases as complements. -- They can be auxiliaries ("kan", "måste") or ordinary verbs -- ("försöka"); this distinction cannot be done in the multilingual -- API and leads to some anomalies in Swedish, but less so than in English.