From 4f86a8c0b47bd8dad85f227adde2db2377d32d06 Mon Sep 17 00:00:00 2001 From: aarne Date: Fri, 1 Jul 2005 18:54:08 +0000 Subject: [PATCH] Finnish and res doc --- lib/resource/doc/Makefile | 3 + lib/resource/doc/gf-resource.html | 11 +- lib/resource/finnish/CategoriesFin.gf | 2 +- lib/resource/finnish/ClauseFin.gf | 22 ++-- lib/resource/finnish/ParadigmsFin.gf | 96 +++++++++++------- lib/resource/finnish/RulesFin.gf | 6 +- lib/resource/finnish/SyntaxFin.gf | 141 ++++++++++++++++++-------- src/GF/Shell/HelpFile.hs | 6 +- 8 files changed, 188 insertions(+), 99 deletions(-) diff --git a/lib/resource/doc/Makefile b/lib/resource/doc/Makefile index af91c3a1b..36c699f19 100644 --- a/lib/resource/doc/Makefile +++ b/lib/resource/doc/Makefile @@ -26,6 +26,9 @@ gfdoc: gfdoc ../norwegian/VerbsNor.gf ; mv ../norwegian/VerbsNor.html . gfdoc ../norwegian/BasicNor.gf ; mv ../norwegian/BasicNor.html . + gfdoc ../finnish/ParadigmsFin.gf ; mv ../finnish/ParadigmsFin.html . + gfdoc ../finnish/BasicFin.gf ; mv ../finnish/BasicFin.html . + gfdoc ../italian/ParadigmsIta.gf ; mv ../italian/ParadigmsIta.html . gfdoc ../italian/BasicIta.gf ; mv ../italian/BasicIta.html . gfdoc ../italian/BeschIta.gf ; mv ../italian/BeschIta.html . diff --git a/lib/resource/doc/gf-resource.html b/lib/resource/doc/gf-resource.html index 920d692bb..a6abe7b04 100644 --- a/lib/resource/doc/gf-resource.html +++ b/lib/resource/doc/gf-resource.html @@ -9,7 +9,7 @@

-Third Version, 22 May 2005 +Third Version, 22 May 2005. Completed 1 July.
Second Version, 1 March 2005
@@ -467,6 +467,12 @@ Alternative views on sentence formation:

+Finnish paradigms +
+example use of Finnish oaradigms + +

+ French paradigms
example use of French paradigms @@ -847,7 +853,8 @@ English:

Finnish: missing many nominal forms of verbs; -the basic lexicon has some erroneous inflectional patterns; +compiling the heuristic paradigms is slow; +the basic lexicon has some erroneous inflectional forms; possessive and interrogative suffixes have no proper lexer.

French: diff --git a/lib/resource/finnish/CategoriesFin.gf b/lib/resource/finnish/CategoriesFin.gf index 6694e6395..67a48d20c 100644 --- a/lib/resource/finnish/CategoriesFin.gf +++ b/lib/resource/finnish/CategoriesFin.gf @@ -48,7 +48,7 @@ lincat V = Verb1 ; -- = {s : VForm => Str} ---- VP = {s,s2 : Bool => SForm => Agr => Str ; isAux : Bool} ; - VPI = {s : VIForm => Str} ; + VPI = {s : Bool => VIForm => Str ; sc : Case} ; ----- VP = Verb ** {s2 : VForm => Str ; c : ComplCase} ; ---- VG = {s,s2 : Bool => VForm => Str ; c : ComplCase} ; V2 = TransVerb ; diff --git a/lib/resource/finnish/ClauseFin.gf b/lib/resource/finnish/ClauseFin.gf index a80a8c0b3..2b2c8eaf0 100644 --- a/lib/resource/finnish/ClauseFin.gf +++ b/lib/resource/finnish/ClauseFin.gf @@ -51,23 +51,22 @@ concrete ClauseFin of Clause = CategoriesFin ** sats2clause ( insertComplement (mkSats subj verb) - (vp.s ! VIInfinit) + (vp.s ! True ! VIInfinit Simul) ) ; SPredObjV2V subj verb obj vp = sats2clause ( insertComplement (mkSatsObject subj verb obj) - (vp.s ! VIInfinit) + (vp.s ! True ! VIInfinit Simul) ) ; SPredSubjV2V subj verb obj vp = sats2clause ( insertComplement (mkSatsObject subj verb obj) - (vp.s ! VIInfinit) + (vp.s ! True ! VIInfinit Simul) ) ; -{- + SPredProgVP np vp = sats2clause (progressiveSats np vp) ; --} SPredAP subj adj = sats2clause (mkSatsCopula subj (complAdjPhrase subj.n adj)) ; @@ -154,7 +153,7 @@ concrete ClauseFin of Clause = CategoriesFin ** sats2quest (mkSatsCopula (intNounPhrase subj) adv.s) ; QPredProgVP np vp = sats2quest (progressiveSats (intNounPhrase np) vp) ; - +-} ----- gender and number of Adj @@ -163,11 +162,14 @@ concrete ClauseFin of Clause = CategoriesFin ** IPredV2 a v y = sats2verbPhrase a (mkSatsObject pronImpers v y) ; IPredAP a adj = - sats2verbPhrase a (mkSatsCopula pronImpers (adj.s ! AF Masc Sg)) ; - IPredPassV a v = - sats2verbPhrase a (mkSatsCopula pronImpers (v.s ! VPart (pgen2gen pronImpers.g) pronImpers.n)) ; + sats2verbPhrase a (mkSatsCopula pronImpers (complAdjPhrase Sg adj)) ; --- IPredV3 a verb obj1 obj2 = - sats2verbPhrase a (insertObject (mkSatsObject pronImpers verb obj1) verb.c3 verb.s3 obj2) ; + sats2verbPhrase a (insertObject (mkSatsObject pronImpers verb obj1) verb.c2 verb.s5 verb.p obj2) ; + +{- + IPredPassV a v = + sats2verbPhrase a (mkSatsCopula pronImpers (v.s ! VPart (pgen2gen + pronImpers.g) pronImpers.n)) ; IPredReflV2 a verb = sats2verbPhrase a ( mkSatsObject pronImpers diff --git a/lib/resource/finnish/ParadigmsFin.gf b/lib/resource/finnish/ParadigmsFin.gf index 24b974d64..253b6fd08 100644 --- a/lib/resource/finnish/ParadigmsFin.gf +++ b/lib/resource/finnish/ParadigmsFin.gf @@ -9,9 +9,10 @@ -- expressions of basic categories: nouns, adjectives, verbs. -- -- Closed categories (determiners, pronouns, conjunctions) are --- accessed through the resource syntax API, $Structural.gf$. +-- accessed through the resource syntax API, $Structural$. -- --- The main difference with $MorphoFin.gf$ is that the types +-- The low-level definitions of inflectional patterns are in +-- $MorphoFin$. The main difference with that module is that here the types -- referred to are compiled resource grammar types. We have moreover -- had the design principle of always having existing forms, not -- stems, as string arguments of the paradigms, not stems. @@ -26,7 +27,9 @@ resource ParadigmsFin = --2 Parameters -- -- To abstract over gender, number, and (some) case names, --- we define the following identifiers. +-- we define the following identifiers. The application programmer +-- should always use these constants instead of their definitions +-- in $TypesInf$. oper Gender : Type; @@ -39,44 +42,65 @@ oper singular : Number ; plural : Number ; - Case : Type ; - nominative : Case ; - genitive : Case ; - partitive : Case ; + Case : Type ; + nominative : Case ; + genitive : Case ; + partitive : Case ; translative : Case ; - inessive : Case ; - elative : Case ; - illative : Case ; - adessive : Case ; - ablative : Case ; - allative : Case ; + inessive : Case ; + elative : Case ; + illative : Case ; + adessive : Case ; + ablative : Case ; + allative : Case ; + +-- The following type is used for defining *rection*, i.e. complements +-- of many-place verbs and adjective. A complement can be defined by +-- just a case, or a pre/postposition and a case. PPosition : Type ; - prepP : Case -> Str -> PPosition ; - postpP : Case -> Str -> PPosition ; - caseP : Case -> PPosition ; + + prepP : Case -> Str -> PPosition ; + postpP : Case -> Str -> PPosition ; + caseP : Case -> PPosition ; accusative : PPosition ; --2 Nouns --- Worst case: give ten forms and the semantic gender. +-- The worst case gives ten forms and the semantic gender. -- In practice just a couple of forms are needed, to define the different -- stems, vowel alternation, and vowel harmony. oper - mkN : - (talo,talon,talona,taloa,taloon,taloina,taloissa,talojen,taloja,taloihin - : Str) -> Gender -> N ; + mkN : (talo, talon, talona, taloa, taloon, + taloina,taloissa,talojen,taloja,taloihin : Str) -> Gender -> N ; --- The regular noun heuristic takes just one form and analyses its suffixes. +-- The regular noun heuristic takes just one form (singular +-- nominative) and analyses it to pick the correct paradigm. +-- It does automatic grade alternation, and is hence not usable +-- for words like "auto" (whose genitive would become "audon"). regN : (talo : Str) -> N ; --- The almost-regular heuristics analyse two or three forms. +-- If $regN$ does not give the correct result, one can try and give +-- two or three forms as follows. Examples of the use of these +-- functions are given in $BasicFin$. Most notably, $reg2N$ is used +-- for nouns like "kivi - kiviä", which would otherwise become like +-- "rivi - rivejä". $regN3$ is used e.g. for +-- "sydän - sydämen - sydämiä", which would otherwise become +-- "sydän - sytämen". reg2N : (savi,savia : Str) -> N ; reg3N : (vesi,veden,vesiä : Str) -> N ; +-- Some nouns have an unexpected singular partitive, e.g. "meri", "lumi". + + sgpartN : (meri : N) -> (merta : Str) -> N ; + nMeri : (meri : Str) -> N ; + +-- The rest of the noun paradigms are mostly covered by the three +-- heuristics. +-- -- Nouns with partitive "a"/"ä" are a large group. -- To determine for grade and vowel alternation, three forms are usually needed: -- singular nominative and genitive, and plural partitive. @@ -163,11 +187,6 @@ oper nNauris : (naurista : Str) -> N ; --- Some nouns have an unexpected singular partitive, e.g. "meri", "juuri". - - sgpartN : N -> Str -> N ; - nMeri : Str -> N ; - -- Separately-written compound nouns, like "sambal oelek", "Urho Kekkonen", -- have only their last part inflected. @@ -203,23 +222,29 @@ oper mkADeg : (kiva : N) -> (kivempaa,kivinta : Str) -> ADeg ; --- Without $optimize=noexpand$, this function would expands to enormous size. +-- The regular adjectives are based on $regN$ in the positive. + + regADeg : (punainen : Str) -> ADeg ; - regADeg : (suuri : Str) -> ADeg ; --2 Verbs -- --- The fragment only has present tense so far, but in all persons. +-- The grammar does not cover the potential mood and some nominal +-- forms. One way to see the coverage is to linearize a verb to +-- a table. -- The worst case needs twelve forms, as shown in the following. mkV : (tulla,tulee,tulen,tulevat,tulkaa,tullaan, tuli,tulin,tulisi,tullut,tultu,tullun : Str) -> V ; + +-- The following heuristics cover more and more verbs. + regV : (soutaa : Str) -> V ; reg2V : (soutaa,souti : Str) -> V ; reg3V : (soutaa,soudan,souti : Str) -> V ; --- A simple special case is the one with just one stem and no grade alternation. --- It covers e.g. "sanoa", "valua", "kysyä". +-- The rest of the paradigms are special cases mostly covered by the heuristics. +-- A simple special case is the one with just one stem and without grade alternation. vValua : (valua : Str) -> V ; @@ -253,19 +278,20 @@ oper vEi : V ; -- Two-place verbs need a case, and can have a pre- or postposition. --- At least one of the latter is empty, $[]$. mkV2 : V -> PPosition -> V2 ; --- If both are empty, the following special function can be used. +-- If the complement needs just a case, the following special function can be used. caseV2 : V -> Case -> V2 ; -- Verbs with a direct (accusative) object -- are special, since their complement case is finally decided in syntax. +-- But this is taken care of by $ClauseFin$. dirV2 : V -> V2 ; + --3 Three-place verbs -- -- Three-place (ditransitive) verbs need two prepositions, of which @@ -275,6 +301,7 @@ oper dirV3 : V -> Case -> V3 ; -- give,_,to dirdirV3 : V -> V3 ; -- acc, allat + --3 Other complement patterns -- -- Verbs and adjectives can take complements such as sentences, @@ -295,7 +322,6 @@ oper mkAV : A -> AV ; mkA2V : A2 -> A2V ; - -- The definitions should not bother the user of the API. So they are -- hidden from the document. --. diff --git a/lib/resource/finnish/RulesFin.gf b/lib/resource/finnish/RulesFin.gf index 97c9d6398..6b5934e63 100644 --- a/lib/resource/finnish/RulesFin.gf +++ b/lib/resource/finnish/RulesFin.gf @@ -58,9 +58,9 @@ lin UseA = adj2adjPhrase ; ComplA2 = complAdj ; - ComplAV av vpi = {s = \\_,a => av.s ! a ++ vpi.s ! VIInfinit} ; - ComplObjA2V av obj vpi = {s = \\_,a => av.s ! a ++ obj.s ! complCase - True av.c VImperat ++ vpi.s ! VIInfinit} ; +---- ComplAV av vpi = {s = \\_,a => av.s ! a ++ vpi.s ! VIInfinit} ; +---- ComplObjA2V av obj vpi = {s = \\_,a => av.s ! a ++ obj.s ! complCase +---- True av.c (SVI VIInf3Iness) ++ vpi.s ! VIInfinit} ; PositADeg = positAdjPhrase ; ComparADeg = comparAdjPhrase ; diff --git a/lib/resource/finnish/SyntaxFin.gf b/lib/resource/finnish/SyntaxFin.gf index 104e611bb..47760815a 100644 --- a/lib/resource/finnish/SyntaxFin.gf +++ b/lib/resource/finnish/SyntaxFin.gf @@ -106,6 +106,7 @@ oper {s = \\f => jussi.s ! npForm2Case Sg f ; n = Sg ; p = NP3} ; impersNounPhrase : NounPhrase = nameNounPhrase {s = \\_ => []} ; + pronImpers = impersNounPhrase ; singularNounPhrase : CommNounPhrase -> NounPhrase = \cn -> {s = \\f => cn.s ! False ! Sg ! (npForm2Case Sg f) ; n = Sg ; p = NP3} ; @@ -375,7 +376,7 @@ oper complAdj : AdjCompl -> NounPhrase -> AdjPhrase = \hyva,paini -> let hyvat : AForm => Str = \\a => hyva.s ! a ; - c : NPForm = complCase True hyva.c VImperat ; + c : NPForm = complCase True hyva.c (SVI VIInf3Iness) ; painissa : Str = paini.s ! c in {s = table { @@ -493,35 +494,36 @@ oper Tense = Present | Past | Future | Conditional ; Anteriority = Simul | Anter ; - SForm = - VFinite SType Tense Anteriority - | VInfinit Anteriority - | VImperat - ; + SForm = VFinite SType Tense Anteriority ; SType = SDecl | SQuest ; VIForm = - VIInfinit - | VIImperat Bool Number + VIInfinit Anteriority + | VIImperat Number | VIInf3Iness | VIInf3Elat | VIInf3Illat | VIInf3Adess | VIInf3Abess ; +-- This is an auxiliary. + + SVIForm = SCl SForm | SVI VIForm ; + oper Clause : Type = {s : Bool => SForm => Str} ; - VerbPhraseInf : Type = {s : VIForm => Str} ; + VerbPhraseInf : Type = {s : Bool => VIForm => Str ; sc : Case} ; Sats : Type = { subj : Str ; pred : Bool => SForm => { fin : Str ; - inf : Str ; - obj : Str -- object case depends on both + inf : Str } ; - comp : Str + obj : Bool => SVIForm => Str ; + comp : Str ; + vpi : VerbPhraseInf } ; sats2clause : Sats -> Clause = \sats -> @@ -531,7 +533,7 @@ oper pred = sats.pred ! b ! sf ; fin = pred.fin ; inf = pred.inf ; - obj = pred.obj ; + obj = sats.obj ! b ! (SCl sf) ; comp = sats.comp in case sf of { @@ -540,19 +542,54 @@ oper } } ; + sats2verbPhrase : {s : Str ; a : Anteriority} -> Sats -> VerbPhraseInf = \a,sats -> + {s = \\b,vi => + let + inf = sats.vpi.s ! b ! vi ; + obj = sats.obj ! b ! (SVI vi) ; + comp = sats.comp + in + a.s ++ inf ++ obj ++ comp ; + sc = sats.vpi.sc + } ; + questPart : Str -> Str = \s -> glueParticle s "ko" ; --- "kö" mkSats : NounPhrase -> Verb1 -> Sats = \subj,verb -> let - np = case verb.sc of { + sc = verb.sc ; + np = case sc of { Nom => ; _ => - } + } ; + vi = inflectVerb verb np.p1 np.p2 in - {subj = subj.s ! NPCase verb.sc ; -- "minusta tulee poliisi" - pred = \\b,sf => - inflectVerb verb np.p1 np.p2 b sf ** {obj = []} ; - comp = [] + {subj = subj.s ! NPCase sc ; -- "minusta tulee poliisi" + pred = \\b,sf => vi b (SCl sf) ; + obj = \\_,_ => [] ; + comp = [] ; + vpi = { + s = \\b,f => let vp = vi b (SVI f) in vp.fin ++ vp.inf ; + sc = sc + } + } ; + + progressiveSats : NounPhrase -> VerbPhraseInf -> Sats = \subj,vp -> + let + np = case vp.sc of { + Nom => ; + _ => + } ; + vi = inflectVerb verbOlla np.p1 np.p2 + in + {subj = subj.s ! NPCase vp.sc ; -- "minusta on tulossa poliisi" + pred = \\b,sf => vi b (SCl sf) ; + obj = \\_,_ => [] ; + comp = vp.s ! True ! VIInf3Iness ; + vpi = { + s = \\b,f => let vv = vi b (SVI f) in vv.fin ++ vv.inf ; + sc = Nom + } } ; mkSatsObject : NounPhrase -> TransVerb -> NounPhrase -> Sats = \subj,verb,obj -> @@ -567,31 +604,34 @@ oper pred = \\b,sf => let spred = sats.pred ! b ! sf in {fin = spred.fin ; - inf = spred.inf ; - obj = spred.obj ++ pPosit prep pos (obj.s ! complCase b c sf) + inf = spred.inf } ; - comp = sats.comp + obj = \\b,f => sats.obj ! b ! f ++ pPosit prep pos (obj.s ! complCase b c f) ; + comp = sats.comp ; + vpi = sats.vpi } ; insertComplement : Sats -> Str -> Sats = \sats, comp -> {subj = sats.subj ; pred = sats.pred ; - comp = sats.comp ++ comp + obj = sats.obj ; + comp = sats.comp ++ comp ; + vpi = sats.vpi } ; - complCase : Bool -> ComplCase -> SForm -> NPForm = \b,c,v -> case c of { + complCase : Bool -> ComplCase -> SVIForm -> NPForm = \b,c,v -> case c of { CCase k => NPCase k ; CAcc => case b of { True => case v of { - VFinite _ _ _ => NPAccGen ; + SCl _ => NPAccGen ; _ => NPAccNom } ; _ => NPCase Part } } ; - inflectVerb : Verb -> Number -> Person -> Bool -> SForm -> {fin, inf : Str} = + inflectVerb : Verb -> Number -> Person -> Bool -> SVIForm -> {fin, inf : Str} = \verb,n,p,b,sf -> let vs = verb.s ; @@ -608,13 +648,6 @@ oper => {fin = eis ! vf ; inf = vs ! neg} ; => {fin = eis ! vf ; inf = olla ! neg ++ vs ! part} } ; - inf : Anteriority -> {fin,inf : Str} = - \a -> case of { - => {fin = vs ! Inf ; inf = []} ; - => {fin = olla ! Inf ; inf = vs ! part} ; - => {fin = olla ! Inf ; inf = abess} ; - => {fin = olla ! Inf ; inf = olla ! part ++ abess} - } ; fut : Anteriority -> VForm -> VForm -> {fin,inf : Str} = \a,vf,neg -> case of { => {fin = tulla ! vf ; inf = illat} ; @@ -623,21 +656,39 @@ oper => {fin = eis ! vf ; inf = olla ! neg ++ tulla ! part ++ illat} } ; - älä = case b of { - True => {fin = vs ! Imper n ; inf = []} ; - False => {fin = eis ! Imper n ; - inf = vs ! case n of { + inf : VIForm -> Anteriority -> {fin,inf : Str} = + \if,a -> + let i = case if of { + VIInf3Iness => Inf3Iness ; + VIInf3Elat => Inf3Elat ; + VIInf3Illat => Inf3Illat ; + VIInf3Adess => Inf3Adess ; + VIInf3Abess => Inf3Abess ; + _ => Inf --- not used for imperative + } + in + case of { + => {fin = vs ! i ; inf = []} ; + => {fin = olla ! i ; inf = vs ! part} ; + => {fin = olla ! i ; inf = abess} ; + => {fin = olla ! i ; inf = olla ! part ++ abess} + } ; + älä : Number -> {fin,inf : Str} = + \nu -> case b of { + True => {fin = vs ! Imper nu ; inf = []} ; + False => {fin = eis ! Imper nu ; + inf = vs ! case nu of { Sg => Imper n ; Pl => ImpNegPl} - } + } } ; in case sf of { - VFinite _ Past a => ei a (Impf n p) (part) ; - VFinite _ Conditional a => ei a (Cond n p) (Cond Sg P3) ; - VFinite _ Present a => ei a (Pres n p) (Imper Sg) ; - VFinite _ Future a => fut a (Pres n p) (Imper Sg) ; - VInfinit a => inf a ; - VImperat => älä + SCl (VFinite _ Past a) => ei a (Impf n p) (part) ; + SCl (VFinite _ Conditional a) => ei a (Cond n p) (Cond Sg P3) ; + SCl (VFinite _ Present a) => ei a (Pres n p) (Imper Sg) ; + SCl (VFinite _ Future a) => fut a (Pres n p) (Imper Sg) ; + SVI (VIImperat n ) => älä n ; + SVI i => inf i Simul ---- Anter } ; @@ -1069,7 +1120,7 @@ oper Imperative = SS1 Number ; imperVerbPhrase : Bool -> VerbPhraseInf -> Imperative = \b,ui -> - {s = \\n => ui.s ! VIImperat b n} ; + {s = \\n => ui.s ! b ! VIImperat n} ; imperUtterance : Number -> Imperative -> Utterance = \n,I -> ss (I.s ! n ++ exclPunct) ; diff --git a/src/GF/Shell/HelpFile.hs b/src/GF/Shell/HelpFile.hs index 5ef11d2a4..8d427753a 100644 --- a/src/GF/Shell/HelpFile.hs +++ b/src/GF/Shell/HelpFile.hs @@ -5,9 +5,9 @@ -- Stability : (stable) -- Portability : (portable) -- --- > CVS $Date: 2005/07/01 17:14:26 $ --- > CVS $Author: peb $ --- > CVS $Revision: 1.8 $ +-- > CVS $Date: 2005/07/01 19:54:09 $ +-- > CVS $Author: aarne $ +-- > CVS $Revision: 1.9 $ -- -- Help on shell commands. Generated from HelpFile by 'make help'. -- PLEASE DON'T EDIT THIS FILE.