From d669e538d646d210e047b77863816cba007e5370 Mon Sep 17 00:00:00 2001 From: aarne Date: Wed, 23 Feb 2005 20:13:54 +0000 Subject: [PATCH] extending romance, bug fixes in scandinavian --- lib/resource/danish/SyntaxDan.gf | 2 - lib/resource/french/MorphoFre.gf | 12 ++++ lib/resource/french/SyntaxFre.gf | 32 +++++---- lib/resource/norwegian/SyntaxNor.gf | 2 - lib/resource/romance/RulesRomance.gf | 29 ++++---- lib/resource/romance/SyntaxRomance.gf | 84 +++++++++++++----------- lib/resource/scandinavian/SyntaxScand.gf | 8 +-- lib/resource/swedish/SyntaxSwe.gf | 10 +-- lib/resource/swedish/TestResourceSwe.gf | 4 +- 9 files changed, 90 insertions(+), 93 deletions(-) diff --git a/lib/resource/danish/SyntaxDan.gf b/lib/resource/danish/SyntaxDan.gf index 6cde31053..8030b304d 100644 --- a/lib/resource/danish/SyntaxDan.gf +++ b/lib/resource/danish/SyntaxDan.gf @@ -10,8 +10,6 @@ instance SyntaxDan of SyntaxScand = TypesDan ** -- When common nouns are extracted from lexicon, the composite noun form is ignored. - extCommonNounMasc = extCommNoun ; - npMan : NounPhrase = nameNounPhrase (mkProperName "man" NUtr) ; npDet : NounPhrase = nameNounPhrase (mkProperName "det" NNeutr) ; diff --git a/lib/resource/french/MorphoFre.gf b/lib/resource/french/MorphoFre.gf index 29c40da80..4c33ded89 100644 --- a/lib/resource/french/MorphoFre.gf +++ b/lib/resource/french/MorphoFre.gf @@ -223,6 +223,18 @@ oper P3 Clit2 ; +---- A hack to get the dative form "y". + pronY = mkPronoun + "il" + (elision "l") + "y" + "lui" + "en" "en" "en" + (PGen Masc) + Sg + P3 + Clit2 ; + pronElle = mkPronoun "elle" elisLa diff --git a/lib/resource/french/SyntaxFre.gf b/lib/resource/french/SyntaxFre.gf index d8e1f0385..92878dc81 100644 --- a/lib/resource/french/SyntaxFre.gf +++ b/lib/resource/french/SyntaxFre.gf @@ -14,6 +14,8 @@ oper nounPhraseOn = mkNameNounPhrase "on" Masc ; + pronImpers : NounPhrase = pronNounPhrase pronIl ; + partitiveNounPhrase = \n,vin -> normalNounPhrase (table { @@ -48,14 +50,19 @@ oper 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" - } ; +---- We miss "il y en a" + existNounPhrase = \unemaison -> + predVerbGroupClause + pronImpers + (predClauseGroup + verbAvoir + (complTransVerbGen + (mkTransVerbCas verbAvoir dative) + pronY + (\\_,_,_ => unemaison.s ! Ton Acc) + ) + ) ; reflPron : Number => Person => NPFormA => Str = \\n,p => case p of { @@ -183,16 +190,7 @@ oper } ; -- Questions -{- ---- - 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" - } ; --} + intSlash = \Qui, Tuvois -> {s = \\b,cl => let diff --git a/lib/resource/norwegian/SyntaxNor.gf b/lib/resource/norwegian/SyntaxNor.gf index 5eaf4f1ae..4faa4273f 100644 --- a/lib/resource/norwegian/SyntaxNor.gf +++ b/lib/resource/norwegian/SyntaxNor.gf @@ -11,8 +11,6 @@ instance SyntaxNor of SyntaxScand = TypesNor ** -- When common nouns are extracted from lexicon, the composite noun form is ignored. - extCommonNounMasc = extCommNoun ; - npMan : NounPhrase = nameNounPhrase (mkProperName "man" (NUtr Masc)) ; npDet : NounPhrase = nameNounPhrase (mkProperName "det" NNeutr) ; diff --git a/lib/resource/romance/RulesRomance.gf b/lib/resource/romance/RulesRomance.gf index 36a08eca9..a9f228e97 100644 --- a/lib/resource/romance/RulesRomance.gf +++ b/lib/resource/romance/RulesRomance.gf @@ -45,19 +45,18 @@ lin ComparADeg = comparAdjPhrase ; SuperlNP = superlNounPhrase ; ----- PredAS = predAdjSent ; ----- PredV0 rain = predVerbClause (pronNounPhrase pronIt) rain (complVerb rain) ; + PredAS = predAdjSent ; + PredV0 rain = predVerbClause (pronNounPhrase pronImpers) rain (complVerb rain) ; -- Partial saturation. ----- UseV2 = transAsVerb ; + UseV2 = transAsVerb ; ---- ComplV3 = complDitransVerb ; ----- ComplA2S = predAdjSent2 ; - ----- AdjPart = adjPastPart ; + ComplA2S = predAdjSent2 ; ---- clitics get lost + AdjPart = adjPastPart ; UseV2V x = x ** {isAux = False} ; UseV2S x = x ; @@ -129,11 +128,11 @@ lin ImperOne = imperUtterance singular ; ImperMany = imperUtterance plural ; ----- AdvCl = advClause ; ----- AdvVPI = advVerbPhrase ; + AdvCl = advClause ; + AdvVPI = advVerbPhrase ; ----- AdCPhr = advSentence ; ----- AdvPhr = advSentence ; + AdCPhr = advSentence ; + AdvPhr = advSentence ; TwoS = twoSentence ; ConsS = consSentence ; @@ -175,14 +174,8 @@ lin OneNP = nounPhraseOn ; + ExistCN A = existNounPhrase (indefNounPhrase Sg A) ; -{- ---- - ExistCN A = predVerbGroupClause npDet - (complTransVerb (mkDirectVerb (deponentVerb verbFinnas)) - (indefNounPhrase singular A)) ; - ExistNumCN nu A = predVerbGroupClause npDet - (complTransVerb (mkDirectVerb (deponentVerb verbFinnas)) - (indefNounPhraseNum plural nu A)) ; --} + ExistNumCN nu A = existNounPhrase (indefNounPhraseNum nu A) ; } diff --git a/lib/resource/romance/SyntaxRomance.gf b/lib/resource/romance/SyntaxRomance.gf index f480b2af0..5c7022b12 100644 --- a/lib/resource/romance/SyntaxRomance.gf +++ b/lib/resource/romance/SyntaxRomance.gf @@ -74,6 +74,11 @@ oper noNum : Numeral = {s = \\_ => []} ; +-- The existence construction "il y a", "c'è / ci sono" is defined separately, +-- and ad hoc, in each language. + + existNounPhrase : NounPhrase -> Clause ; + --2 Determiners -- @@ -201,10 +206,6 @@ oper 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 @@ -284,6 +285,25 @@ oper p = bon.p } ; +-- Sentence-complement adjectives. +---- Need proper mode in the negative case. + + predAdjSent : (Adjective ** {mp,mn : Mode}) -> Sentence -> Clause = + \probable,ildort -> + predCopula pronImpers + (complCopula + (\\_,_,_ => probable.s ! AF Masc Sg ++ elisQue ++ ildort.s ! probable.mp)) ; + +---- This rule in abstract syntax misses clitics. + + predAdjSent2 : (AdjCompl ** {mp,mn : Mode}) -> NounPhrase -> + ( Adjective ** {mp,mn : Mode}) = \facile,jean -> + complAdj facile jean ** {mp = facile.mp ; mn = facile.mn} ; + + pronImpers : NounPhrase ; + +-- $pronImpers = pronNounPhrase pronIl$ in French, empty in Italian +-- and Spanish. --3 Prepositions and complements -- @@ -457,36 +477,6 @@ oper predCopula : NounPhrase -> Complemnt -> Clause = \np,co -> predVerbClause np copula co ; -{- - predVerb : Verb -> VerbGroup = \aller -> - {s = \\b,g,v => "foo"} ; - - formVerb : Verb -> Bool -> Gender -> VPForm -> Str = \aller,b,g,vf -> - (predVerb aller).s ! b ! g ! vf ; - --- This is needed to take apart the auxiliary ("avoir" or "être") and --- the participle, to form correct order of negation and clitique. - - formVerb2 : Verb -> Gender -> VPForm -> - {verb : Str ; part : Gender => Number => Str} = \aller,g,vf -> - case vf of { - VPF Simul v => { - verb = aller.s ! v ; - part = \\_,_ => [] - } ; - VPF Anter v => { - verb = (auxVerb aller).s ! v ; - part = --\\gen,num => --- cannot infer type - table Gender {gen => table Number {num => - aller.s ! case aller.aux of { - AEsse => VPart g (nombreVerb v) ; - AHabere => VPart gen num - } - }} - } - } ; --} - negVerb : Str -> Str ; -- Verb phrases can also be formed from adjectives ("est bon"), @@ -604,6 +594,16 @@ oper reflPron : Number => Person => NPFormA => Str ; +---- There is no adverbial form for the past participle. + + adjPastPart : Verb -> Adjective = \verb -> { + s = table { + AF g n => verb.s ! VPart g n ; + AA => verb.s ! VPart Masc Sg + } ; + p = False + } ; + mkTransVerb : Verb -> Preposition -> CaseA -> TransVerb = \v,p,c -> v ** {s2 = p ; c = c} ; @@ -700,6 +700,9 @@ oper adVerbPhrase : VerbGroup -> Adverb -> VerbGroup = \chante, bien -> {s = \\b,g,v => chante.s ! b ! g ! v ++ bien.s} ; + advVerbPhrase : VerbPhrase -> Adverb -> VerbPhrase = \chante, bien -> + {s = \\v,g,n,p => chante.s ! v ! g ! n ! p ++ bien.s} ; + -- Adverbs are typically generated by prefixing prepositions. -- The rule for prepositional phrases also comprises the use of prepositions -- treated as cases. Therefore, both a preposition and a case are needed @@ -1076,10 +1079,6 @@ 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, @@ -1143,7 +1142,13 @@ oper --2 Sentence adverbials -- --- This class covers adverbials such as "autrement", "donc", which are prefixed +-- Sentence adverbs is the largest class and open for +-- e.g. prepositional phrases. + + advClause : Clause -> Adverb -> Clause = \yousing,well -> + {s = \\b,c => yousing.s ! b ! c ++ well.s} ; + +-- Another class covers adverbials such as "autrement", "donc", which are prefixed -- to a sentence to form a phrase. advSentence : SS -> Sentence -> Utterance = \donc,ildort -> @@ -1276,6 +1281,7 @@ oper <_,P1> => P1 ; _ => P2 } ; + --3 Coordinating adverbs -- -- We need a category of lists of adverbs. It is a discontinuous diff --git a/lib/resource/scandinavian/SyntaxScand.gf b/lib/resource/scandinavian/SyntaxScand.gf index 12510f0a1..b570561a3 100644 --- a/lib/resource/scandinavian/SyntaxScand.gf +++ b/lib/resource/scandinavian/SyntaxScand.gf @@ -26,8 +26,6 @@ oper g = gen2nounGen sb.h1 } ; - extCommNounMasc : Subst -> CommNoun ; - -- These constants are used for data abstraction over the parameter type $Num$. singular = Sg ; plural = Pl ; @@ -863,13 +861,13 @@ oper useVerb vilja (\\g,n,p => vilja.s1 ++ - if_then_Str vilja.isAux [] "att" ++ ---- vilja.s3 ++ + if_then_Str vilja.isAux [] infinAtt ++ ---- vilja.s3 ++ simma.s ! VIInfinit ! g ! n ! p) ; transVerbVerb : VerbVerb -> TransVerb -> TransVerb = \vilja,hitta -> {s = vilja.s ; s1 = vilja.s1 ++ - if_then_Str vilja.isAux [] "att" ++ ---- vilja.s3 ++ + if_then_Str vilja.isAux [] infinAtt ++ ---- vilja.s3 ++ hitta.s ! VI (Inf Act) ++ hitta.s1 ; s2 = hitta.s2 } ; @@ -930,7 +928,7 @@ oper \jag,vilja,se -> predVerbGroupClause jag (useVerb vilja (\\g,n,p => vilja.s1 ++ - if_then_Str vilja.isAux [] "att" ++ ---- vilja.s3 ++ + if_then_Str vilja.isAux [] infinAtt ++ ---- vilja.s3 ++ se.s ! VI (Inf Act)) ) ** {s2 = se.s2} ; diff --git a/lib/resource/swedish/SyntaxSwe.gf b/lib/resource/swedish/SyntaxSwe.gf index feda99b6b..9b478e81c 100644 --- a/lib/resource/swedish/SyntaxSwe.gf +++ b/lib/resource/swedish/SyntaxSwe.gf @@ -11,15 +11,9 @@ instance SyntaxSwe of SyntaxScand = TypesSwe ** oper - extCommNounMasc : Subst -> CommNoun = \sb -> - {s = \\n,b,c => sb.s ! SF n b c ; - g = NUtr Masc - } ; - npMan : NounPhrase = nameNounPhrase (mkProperName "man" (NUtr Masc)) ; npDet : NounPhrase = nameNounPhrase (mkProperName "det" NNeutr) ; - mkAdjForm : Species -> Number -> NounGender -> AdjFormPos = \b,n,g -> case of { => Strong (ASg (genNoun g)) ; @@ -119,13 +113,13 @@ instance SyntaxSwe of SyntaxScand = TypesSwe ** progressiveVerbPhrase : VerbPhrase -> VerbGroup = complVerbVerb - (mkVerb "hålla" "håller" "håll" "höll" "hållit" "hållen" ** + (mkVerbPart "hålla" "håller" "håll" "höll" "hållit" "hållen" "på" ** {isAux = False}) ; progressiveClause : NounPhrase -> VerbPhrase -> Clause = \np,vp -> predVerbGroupClause np (complVerbVerb - (mkVerb "hålla" "håller" "håll" "höll" "hållit" "hållen" ** + (mkVerbPart "hålla" "håller" "håll" "höll" "hållit" "hållen" "på" ** {isAux = False}) ---- ;{s3 = ["på att"]}) vp) ; diff --git a/lib/resource/swedish/TestResourceSwe.gf b/lib/resource/swedish/TestResourceSwe.gf index 68df61d25..803faad02 100644 --- a/lib/resource/swedish/TestResourceSwe.gf +++ b/lib/resource/swedish/TestResourceSwe.gf @@ -20,7 +20,7 @@ lin Finnish = extAdjective (aFin "finsk") ; Happy = aFin "lycklig" ; Married = extAdjective (aAbstrakt "gift") ** {s2 = "med"} ; - Man = extCommNounMasc man_1144 ; + Man = extCommNoun man_1144 ; Bar = extCommNoun (sSak "bar") ; Bottle = extCommNoun (sApa "flask") ; Woman = extCommNoun (sApa "kvinn") ; @@ -44,7 +44,7 @@ lin SwitchOff = mkDirectVerb (vLeka "stäng" ** {s1 = "av"}) ; Mother = mkFun (extCommNoun mor_1) "till" ; - Uncle = mkFun (extCommNounMasc farbror_8) "till" ; + Uncle = mkFun (extCommNoun farbror_8) "till" ; Connection = mkFun (extCommNoun (sVarelse "förbindelse")) "från" ** {s3 = "till"} ;