From 37f07952881dd2536cd0608880ce6e86220fa839 Mon Sep 17 00:00:00 2001 From: aarne Date: Sat, 17 Sep 2005 16:01:52 +0000 Subject: [PATCH] resource fixes --- lib/resource/abstract/Math.gf | 7 +- lib/resource/english/MathEng.gf | 8 +- lib/resource/english/SyntaxEng.gf | 2 +- lib/resource/finnish/ClauseFin.gf | 25 ++- lib/resource/finnish/MathFin.gf | 17 +- lib/resource/finnish/MorphoFin.gf | 27 +++ lib/resource/finnish/RulesFin.gf | 2 +- lib/resource/finnish/SyntaxFin.gf | 266 ++++-------------------- lib/resource/french/LangFre.gf | 3 +- lib/resource/italian/LangIta.gf | 3 +- lib/resource/norwegian/LangNor.gf | 3 +- lib/resource/romance/MathRomance.gf | 10 +- lib/resource/scandinavian/MathScand.gf | 10 +- lib/resource/scandinavian/RulesScand.gf | 8 - lib/resource/spanish/LangSpa.gf | 3 +- lib/resource/swedish/LangSwe.gf | 3 +- 16 files changed, 119 insertions(+), 278 deletions(-) diff --git a/lib/resource/abstract/Math.gf b/lib/resource/abstract/Math.gf index 45ebfb785..323f37bfc 100644 --- a/lib/resource/abstract/Math.gf +++ b/lib/resource/abstract/Math.gf @@ -28,10 +28,11 @@ fun --3 Special forms of expression --- These expression forms are typical of mathematical texts. +-- This expression form is typical of mathematical texts. +-- It is realized with different constructs in different languages, typically +-- some kind of 3rd person imperative of the verb "be". - LetCN : String -> CN -> Imp ; -- Let x be a number. - LetNumCN : SymbList -> Num -> CN -> Imp ; -- Let x and y be (2) numbers. + LetImp : NP -> NP -> Imp ; -- let x be a number -- This rule is slightly overgenerating: "there exists every number x". -- The problem seems to be of semantic nature. By this we avoid having many rules. diff --git a/lib/resource/english/MathEng.gf b/lib/resource/english/MathEng.gf index 037f16cbb..26cf7583b 100644 --- a/lib/resource/english/MathEng.gf +++ b/lib/resource/english/MathEng.gf @@ -24,13 +24,7 @@ lin SymbTwo = infixSS "and" ; SymbMore = infixSS "," ; - - LetCN x cn = { - s = \\_ => "let" ++ x.s ++ "be" ++ (indefNounPhrase singular cn).s ! NomP - } ; - LetNumCN x nu cn = { - s = \\_ => "let" ++ x.s ++ "be" ++ (indefNounPhraseNum plural nu cn).s ! NomP - } ; + LetImp x np = {s = \\_ => "let" ++ x.s ! NomP ++ "be" ++ np.s ! NomP} ; ExistNP np = predVerbClause (nameNounPhraseN (fromAgr np.a).n (nameReg "there" Neutr)) (regV "exist") diff --git a/lib/resource/english/SyntaxEng.gf b/lib/resource/english/SyntaxEng.gf index f31500013..1b5957233 100644 --- a/lib/resource/english/SyntaxEng.gf +++ b/lib/resource/english/SyntaxEng.gf @@ -1195,7 +1195,7 @@ oper questClause : Clause -> Question = \cl -> {s = \\b,c => table { DirQ => cl.s ! Inv ! b ! c ; - IndirQ => cl.s ! Dir ! b ! c + IndirQ => "if" ++ cl.s ! Dir ! b ! c } } ; {- --vg diff --git a/lib/resource/finnish/ClauseFin.gf b/lib/resource/finnish/ClauseFin.gf index b04777209..b7ab19cde 100644 --- a/lib/resource/finnish/ClauseFin.gf +++ b/lib/resource/finnish/ClauseFin.gf @@ -148,16 +148,18 @@ concrete ClauseFin of Clause = CategoriesFin ** ) ; -- QPredProgVP - +-} QPredAP subj adj = - sats2quest (mkSatsCopula (intNounPhrase subj) (adj.s ! AF subj.g subj.n)) ; + sats2quest (mkSatsCopula (intNounPhrase subj) (complAdjPhrase subj.n adj)) ; QPredCN subj cn = - sats2quest (mkSatsCopula (intNounPhrase subj) (indefNoun subj.n cn)) ; + sats2quest (mkSatsCopula (intNounPhrase subj) (complCommNoun subj.n cn)) ; QPredNP subj np = - sats2quest (mkSatsCopula (intNounPhrase subj) (np.s ! stressed nominative)) ; + sats2quest (mkSatsCopula (intNounPhrase subj) (np.s ! NPCase Nom)) ; QPredAdv subj adv = sats2quest (mkSatsCopula (intNounPhrase subj) adv.s) ; +{- + QPredProgVP np vp = sats2quest (progressiveSats (intNounPhrase np) vp) ; -} @@ -176,9 +178,20 @@ concrete ClauseFin of Clause = CategoriesFin ** RPredAdv subj adv = sats2rel (mkSatsCopulaRel subj adv.s) ; + IPredV v = + mkClauseInf v ; + IPredV2 verb y = + insertObjectInf (mkClauseInf verb) verb.c verb.s3 verb.p y ; + IPredV3 verb y z = + insertObjectInf + (insertObjectInf (mkClauseInf verb) verb.c verb.s3 verb.p y) + verb.c2 verb.s5 verb.p2 z ; + IPredVS verb sent = + insertComplementInf (mkClauseInf verb) sent.s ; + IPredVQ verb quest = + insertComplementInf (mkClauseInf verb) quest.s ; + {- - IPredV a v = - sats2verbPhrase a (mkSats pronImpers v) ; IPredV2 a v y = sats2verbPhrase a (mkSatsObject pronImpers v y) ; IPredAP a adj = diff --git a/lib/resource/finnish/MathFin.gf b/lib/resource/finnish/MathFin.gf index 3bf2bb9c2..59013e1a8 100644 --- a/lib/resource/finnish/MathFin.gf +++ b/lib/resource/finnish/MathFin.gf @@ -3,9 +3,9 @@ concrete MathFin of Math = CategoriesFin ** open Prelude, SyntaxFin, ParadigmsFin in { lin - SymbPN i = {s = \\c => i.s} ; --- case endings often needed - IntPN i = {s = \\c => i.s} ; - IntNP cn i = nameNounPhrase { + SymbPN i = symbProperName i.s ; --- case ending not always correct + IntPN i = symbProperName i.s ; --- case ending not always correct + IntNP cn i = nameNounPhrase { -- here the CN gets the (correct) ending s = \\c => cn.s ! False ! Sg ! c ++ i.s } ; @@ -23,14 +23,9 @@ lin SymbTwo = infixSS "ja" ; SymbMore = infixSS "," ; - - LetCN x cn = { - s = \\_ => "olkoon" ++ x.s ++ (indefNounPhrase singular cn).s ! - NPCase Nom - } ; - LetNumCN x nu cn = { - s = \\_ => "olkoot" ++ x.s ++ (nounPhraseNum False nu cn).s - ! NPCase Part + LetImp x np = { + s = \\_ => + verbOlla.s ! ImperP3 x.n ++ x.s ! NPCase Nom ++ np.s ! NPCase Nom } ; ExistNP np = diff --git a/lib/resource/finnish/MorphoFin.gf b/lib/resource/finnish/MorphoFin.gf index 5af411a71..173d67b57 100644 --- a/lib/resource/finnish/MorphoFin.gf +++ b/lib/resource/finnish/MorphoFin.gf @@ -699,6 +699,33 @@ vowelHarmony : Str -> Str = \liitin -> mkProperName : CommonNoun -> ProperName = \jussi -> {s = \\c => jussi.s ! NCase Sg c} ; +-- An ending given to a symbol cannot really be decided +-- independently. The string $a$ gives the vowel harmony. +-- Only some South-West dialects have the generally valid +-- Illative form. + + caseEnding : Str -> Case -> Str = \a,c -> case c of { + Nom => [] ; + Gen => "n" ; + Part => a ; --- + Transl => "ksi" ; + Ess => "n" + a ; + Iness => "ss" + a ; + Elat => "st" + a ; + Illat => "sse" ; --- + Adess => "ll" + a ; + Ablat => "lt" + a ; + Allat => "lle" ; + Abess => "tt" + a + } ; + + symbProperName : Str -> ProperName = \x -> + {s = table { + Nom => x ; + c => glue x (":" + caseEnding "a" c) + } + } ; + --2 Pronouns -- -- Here we define personal and relative pronouns. diff --git a/lib/resource/finnish/RulesFin.gf b/lib/resource/finnish/RulesFin.gf index 6f7529fd8..c17f035ba 100644 --- a/lib/resource/finnish/RulesFin.gf +++ b/lib/resource/finnish/RulesFin.gf @@ -147,7 +147,7 @@ lin ImperOne = imperUtterance singular ; ImperMany = imperUtterance plural ; ----- AdvCl = advClause ; + AdvCl cl adv = insertComplement cl adv.s ; ---- AdvVPI = advVerbPhrase ; AdCPhr = advSentence ; diff --git a/lib/resource/finnish/SyntaxFin.gf b/lib/resource/finnish/SyntaxFin.gf index bf351b37b..ac6f02c0e 100644 --- a/lib/resource/finnish/SyntaxFin.gf +++ b/lib/resource/finnish/SyntaxFin.gf @@ -532,77 +532,8 @@ oper Sats : Type = Clause ; sats2clause : Sats -> Clause = \sats -> sats ; - ---- -{- - Clause : Type = {s,s2 : Bool => SForm => Str ; s1 : Str} ; - - Sats : Type = {v : Bool => SForm => Str => {fin,inf : Str} ; s1 : Str} ; - sats2clause : Sats -> Clause = \sats -> { - s = \\b,sf => (sats.v ! b ! sf).fin ; - s2 = \\b,sf => (sats.v ! b ! sf).inf ; - s1 = sats.s1 - } --} - ---- -{- - Sats : Type = { - subj : Str ; - pred : Bool => SForm => { - fin : Str ; - inf : Str - } ; - obj : Bool => SVIForm => Str ; - comp : Str - } ; - - sats2clause : Sats -> Clause = \sats -> - let - subj = sats.subj ; - pred = sats.pred ; - in - {s = subj ; - s1 = \\b,sf => (pred ! b ! sf).fin ; - s2 = \\b,sf => (pred ! b ! sf).inf ++ sats.obj ! b ! (SCl sf) ; - s3 = sats.comp - } ; - - sats2verbClause : {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 -> {s = - \\st,b,sf => - let - sc = verb.sc ; - np = case sc of { - Nom => ; - _ => - } ; - su = subj.s ! NPCase sc ; - - vi = inflectVerb verb np.p1 np.p2 b sf ; - inf = vi.inf ; - fin = vi.fin ; - - in case st of { - SQuest => questPart fin ++ su ++ inf ; - _ => su ++ fin ++ inf - } - } ; --} ----- - -- This is for questions with $IP$, thus with normal word order and no "ko". @@ -664,41 +595,6 @@ oper fininf ! nsu ! psu } ; - -{- ---- - mkSats : NounPhrase -> Verb1 -> Sats = \subj,verb -> - let - sc = verb.sc ; - np = case sc of { - Nom => ; - _ => - } ; - vi = inflectVerb verb np.p1 np.p2 - in - {subj = subj.s ! NPCase sc ; -- "minusta tulee poliisi" - pred = \\b,sf => vi b (SCl sf) ; - obj = \\_,_ => [] ; - comp = [] - } ; - - 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 = \\b => { - s = \\f => let vv = vi b (SVI f) in vv.fin ++ vv.inf ; - sc = Nom - } - } ; --} mkSatsObject : NounPhrase -> TransVerb -> NounPhrase -> Sats = \subj,verb,obj -> insertObject (mkSats subj verb) verb.c verb.s3 verb.p obj ; mkSatsObjectRel : RelPron -> TransVerb -> NounPhrase -> Number -> Sats = @@ -724,27 +620,53 @@ oper comp } ; -{- - insertObject : Sats -> ComplCase -> Str -> Bool -> NounPhrase -> Sats = - \sats, c, prep, pos, obj -> - {subj = sats.subj ; - pred = \\b,sf => - let spred = sats.pred ! b ! sf in - {fin = spred.fin ; - inf = spred.inf - } ; - obj = \\b,f => sats.obj ! b ! f ++ pPosit prep pos (obj.s ! complCase b c f) ; - comp = sats.comp - } ; - insertComplement : Sats -> Str -> Sats = - \sats, comp -> - {subj = sats.subj ; - pred = sats.pred ; - obj = sats.obj ; - comp = sats.comp ++ comp +-- This is for infinitive clauses, $VCl$. + + mkClauseInf : Verb1 -> VerbClauseInf = \verb -> { + s = \\b,ant,i,n => + let + part = verb.s ! PastPartAct (AN (NCase n Nom)) ; + vi = case i of { + VIInfinit => Inf ; + VIImperat => Imper n ; + VIInf3Iness => Inf3Iness ; + VIInf3Elat => Inf3Elat ; + VIInf3Illat => Inf3Illat ; + VIInf3Adess => Inf3Adess ; + VIInf3Abess => Inf3Abess + } + in + case of { + => "älä" ++ verb.s ! Imper Sg ; + => "älkää" ++ verb.s ! ImpNegPl ; + => verb.s ! vi ; + => verbOlla.s ! vi ++ verb.s ! Inf3Abess ; + + => "älä" ++ "ole" ++ part ; + => "älkää" ++ "olko" ++ part ; + => verbOlla.s ! vi ++ part ; + => verbOlla.s ! vi ++ "olematta" ++ part } ; --} + sc = verb.sc + } ; + + insertObjectInf : + VerbClauseInf -> ComplCase -> Str -> Bool -> NounPhrase -> VerbClauseInf = + \sats, c, prep, pos, obj -> {s = + \\b,a,i,n => + sats.s ! b ! a ! i ! n ++ + pPosit prep pos (obj.s ! complCase b c (SVI i)) ; + sc = sats.sc + } ; + + insertComplementInf : VerbClauseInf -> Str -> VerbClauseInf = + \sats, comp -> {s = + \\b,a,i,n => + sats.s ! b ! a ! i ! n ++ + comp ; + sc = sats.sc + } ; complCase : Bool -> ComplCase -> SVIForm -> NPForm = \b,c,v -> case c of { CCase k => case of { @@ -760,104 +682,6 @@ oper } } ; - -{- - inflectVerb : Verb -> Number -> Person -> Bool -> SForm -> {fin, inf : Str} = - \verb,n,p,b,sf -> - let - vs : VAuxForm => Str = \\f => verb.s ! verbAuxForm f ; - olla = verbAuxOlla ; - - fei = verbAuxNegEi ! APres n p ; - - at : Tense -> VAuxForm = \t -> case t of { - Past => AImpf n p ; - Conditional => ACond n p ; - _ => ANF (APres n p) ---- inc. Present, Future - } ; - - nat : Tense -> VAuxForm = \t -> case t of { - Past => APastPart n ; - Conditional => ACond Sg P3 ; - _ => ANF (AImper Sg) - } ; - - pverb = vs ! APastPart n ; - - in - case of { - - => {fin = vs ! (at t) ; inf = []} ; - => {fin = fei ; inf = vs ! (nat t)} ; - => {fin = olla ! (at t) ; inf = pverb} ; - => {fin = fei ; inf = olla ! (nat t) ++ pverb} - - } ; - ---- - inflectVerb : Verb -> Number -> Person -> Bool -> SVIForm -> {fin, inf : Str} = - \verb,n,p,b,sf -> - let - vs : VAuxForm => Str = \\f => verb.s ! verbAuxForm f ; - olla = verbAuxOlla ; - tulla = table {ANF f => verbAuxNegTulla ! f ; _ => []} ; - eis = table {ANF f => verbAuxNegEi ! f ; _ => []} ; - part = APastPart n ; - abess = vs ! AInf3Abess ; - illat = vs ! AInf3Illat ; - ei : Anteriority -> VAuxForm -> VAuxForm -> {fin,inf : Str} = - \a,vf,neg -> case of { - => {fin = vs ! vf ; inf = []} ; - => {fin = olla ! vf ; inf = vs ! part} ; - => {fin = eis ! vf ; inf = vs ! neg} ; - => {fin = eis ! vf ; inf = olla ! neg ++ vs ! part} - } ; - fut : Anteriority -> VAuxForm -> VAuxForm -> {fin,inf : Str} = - \a,vf,neg -> case of { - => {fin = tulla ! vf ; inf = illat} ; - => {fin = olla ! vf ; inf = tulla ! part ++ illat} ; - => {fin = eis ! vf ; inf = tulla ! neg ++ illat} ; - => {fin = eis ! vf ; - inf = olla ! neg ++ tulla ! part ++ illat} - } ; - inf : VIForm -> Anteriority -> {fin,inf : Str} = - \if,a -> - let i = AInf ---- is this ever needed? -{ - - 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 ! ANF (AImper nu) ; inf = []} ; - False => {fin = eis ! ANF (AImper nu) ; - inf = vs ! case nu of { - Sg => ANF (AImper n) ; - Pl => AImpNegPl} - } - } ; - in case sf of { - SCl (VFinite Present a) => ei a (ANF (APres n p)) (ANF (AImper Sg)) ; - SCl (VFinite Past a) => ei a (AImpf n p) (part) ; - SCl (VFinite Conditional a) => ei a (ACond n p) (ACond Sg P3) ; - SCl (VFinite Future a) => fut a (ANF (APres n p)) (ANF (AImper Sg)) ; - SVI (VIImperat ) => älä n ; - SVI i => inf i Simul ---- Anter - } ; --} - --- these are the only forms needed in auxiliary positions. param diff --git a/lib/resource/french/LangFre.gf b/lib/resource/french/LangFre.gf index 552cf5d36..bc9935c10 100644 --- a/lib/resource/french/LangFre.gf +++ b/lib/resource/french/LangFre.gf @@ -6,7 +6,8 @@ concrete LangFre of Lang = StructuralFre, BasicFre, TimeFre, - CountryFre + CountryFre, + MathFre ** open Prelude, ParadigmsFre in { diff --git a/lib/resource/italian/LangIta.gf b/lib/resource/italian/LangIta.gf index c36a426e5..35c921769 100644 --- a/lib/resource/italian/LangIta.gf +++ b/lib/resource/italian/LangIta.gf @@ -6,7 +6,8 @@ concrete LangIta of Lang = StructuralIta, BasicIta, TimeIta, - CountryIta + CountryIta, + MathIta ** open Prelude, ParadigmsIta in { diff --git a/lib/resource/norwegian/LangNor.gf b/lib/resource/norwegian/LangNor.gf index 83e3a52e8..8a321fda3 100644 --- a/lib/resource/norwegian/LangNor.gf +++ b/lib/resource/norwegian/LangNor.gf @@ -6,7 +6,8 @@ concrete LangNor of Lang = StructuralNor, BasicNor, TimeNor, - CountryNor + CountryNor, + MathNor ** open Prelude, ParadigmsNor in { diff --git a/lib/resource/romance/MathRomance.gf b/lib/resource/romance/MathRomance.gf index 38ccbb21e..43c571291 100644 --- a/lib/resource/romance/MathRomance.gf +++ b/lib/resource/romance/MathRomance.gf @@ -26,13 +26,9 @@ lin SymbMore = infixSS "," ; - LetCN x cn = { - s = \\_,_ => copula.s ! VFin (VPres Con) Sg P3 ++ x.s ++ (indefNounPhrase singular cn).s ! - unstressed nominative - } ; - LetNumCN x nu cn = { - s = \\_,_ => copula.s ! VFin (VPres Con) Pl P3 ++ x.s ++ (indefNounPhraseNum nu cn).s - ! unstressed nominative + LetImp x cn = { + s = \\_,_ => copula.s ! VFin (VPres Con) x.n P3 ++ + x.s ! unstressed nominative ++ cn.s ! unstressed nominative } ; --- to be replaced by "il existe", "esiste", etc. diff --git a/lib/resource/scandinavian/MathScand.gf b/lib/resource/scandinavian/MathScand.gf index 416a72d03..bf9938461 100644 --- a/lib/resource/scandinavian/MathScand.gf +++ b/lib/resource/scandinavian/MathScand.gf @@ -26,14 +26,8 @@ lin SymbMore = infixSS "," ; - LetCN x cn = { - s = \\_ => letImp ++ x.s ++ verbVara.s ! VI (Inf Act) ++ (indefNounPhrase singular cn).s ! - PNom - } ; - LetNumCN x nu cn = { - s = \\_ => letImp ++ x.s ++ verbVara.s ! VI (Inf Act) ++ - (indefNounPhraseNum plural nu cn).s - ! PNom + LetImp x np = { + s = \\_ => letImp ++ x.s ! PNom ++ verbVara.s ! VI (Inf Act) ++ np.s ! PNom } ; --- to be replaced by "det existerar", etc. diff --git a/lib/resource/scandinavian/RulesScand.gf b/lib/resource/scandinavian/RulesScand.gf index 1e4897e23..fba633553 100644 --- a/lib/resource/scandinavian/RulesScand.gf +++ b/lib/resource/scandinavian/RulesScand.gf @@ -9,14 +9,6 @@ lin UseN = noun2CommNounPhrase ; UsePN = nameNounPhrase ; - SymbPN i = {s = \\_ => i.s ; g = NNeutr} ; - - SymbCN cn s = - {s = \\n => cn.s ! n ++ s.s ; - g = cn.g} ; - IntCN cn i = - {s = \\n => cn.s ! n ++ i.s ; - g = cn.g} ; IndefOneNP = indefNounPhrase singular ; IndefNumNP = indefNounPhraseNum plural ; diff --git a/lib/resource/spanish/LangSpa.gf b/lib/resource/spanish/LangSpa.gf index f580fd686..240497490 100644 --- a/lib/resource/spanish/LangSpa.gf +++ b/lib/resource/spanish/LangSpa.gf @@ -6,7 +6,8 @@ concrete LangSpa of Lang = StructuralSpa, BasicSpa, TimeSpa, - CountrySpa + CountrySpa, + MathSpa ** open Prelude, ParadigmsSpa in { diff --git a/lib/resource/swedish/LangSwe.gf b/lib/resource/swedish/LangSwe.gf index a90fe58c6..2cdbadb52 100644 --- a/lib/resource/swedish/LangSwe.gf +++ b/lib/resource/swedish/LangSwe.gf @@ -6,7 +6,8 @@ concrete LangSwe of Lang = StructuralSwe, BasicSwe, TimeSwe, - CountrySwe + CountrySwe, + MathSwe ** open Prelude, ResourceSwe, ParadigmsSwe in {