diff --git a/lib/resource/french/RulesFre.gf b/lib/resource/french/RulesFre.gf index 380ea82f9..b0f983bd4 100644 --- a/lib/resource/french/RulesFre.gf +++ b/lib/resource/french/RulesFre.gf @@ -1,4 +1,4 @@ ---# -path=.:../romance:../oldabstract:../abstract:../../prelude +--# -path=.:../romance:../abstract:../../prelude concrete RulesFre of Rules = CategoriesFre ** RulesRomance with (SyntaxRomance=SyntaxFre) ; diff --git a/lib/resource/french/StructuralFre.gf b/lib/resource/french/StructuralFre.gf index 1cdfc1af6..8a9d70cb3 100644 --- a/lib/resource/french/StructuralFre.gf +++ b/lib/resource/french/StructuralFre.gf @@ -1,113 +1,95 @@ --# -path=.:../romance:../abstract:../../prelude -concrete StructuralFre of Structural = CategoriesFre, NumeralsFre ** - open SyntaxFre, MorphoFre, Prelude in { +concrete StructuralFre of Structural = + CategoriesFre, NumeralsFre ** + open SyntaxFre, MorphoFre, Prelude in { lin - INP = pronNounPhrase pronJe ; - ThouNP = pronNounPhrase pronTu ; - HeNP = pronNounPhrase pronIl ; - SheNP = pronNounPhrase pronElle ; - WeNumNP n = pronNounPhrase (pronWithNum pronNous n) ; - YeNumNP 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 ["ceci"] Masc ; - ThatNP = mkNameNounPhrase ["ça"] Masc ; - TheseNumNP n = mkNameNounPhrase ("ceux" ++ n.s ! Masc ++ "ci") Masc ; - ThoseNumNP n = mkNameNounPhrase ("ceux" ++ n.s ! Masc ++ "là") Masc ; UseNumeral n = {s = \\_ => n.s} ; ---- gender - ItNP = pronNounPhrase pronIl ; + above_Prep = {s = ["au dessus"] ; c = genitive} ; + after_Prep = justPrep "après" ; + all8mass_Det = toutDet ; + all_NDet = mkDeterminerNum ["tous les"] ["toutes les"] ; + almost_Adv = ss "presque" ; + although_Subj = ss ("bien" ++ elisQue) ** {m = Con} ; + and_Conj = etConj ; + because_Subj = ss ("parce" ++ elisQue) ** {m = Ind} ; + before_Prep = justPrep "avant" ; + behind_Prep = justPrep "derrière" ; + between_Prep = justPrep "entre" ; + both_AndConjD = etetConj ; + by8agent_Prep = justPrep "par" ; + by8means_Prep = justPrep "par" ; + can8know_VV = mkVerbVerbDir (verbPres (conj3savoir "savoir") AHabere) ; + can_VV = mkVerbVerbDir (verbPres (conj3pouvoir "pouvoir") AHabere) ; + during_Prep = justPrep "pendant" ; + either8or_ConjD = ououConj ; + everybody_NP = mkNameNounPhrase ["tout le monde"] Masc ; + every_Det = chaqueDet ; + everything_NP = mkNameNounPhrase ["tout"] Masc ; + everywhere_Adv = ss "partout" ; + from_Prep = justCase genitive ; --- + he_NP = pronNounPhrase pronIl ; + how_IAdv = commentAdv ; + how8many_IDet = {s = \\_ => "combien" ++ elisDe ; n = Pl} ; + if_Subj = siSubj ; + in8front_Prep = justPrep "devant" ; + i_NP = pronNounPhrase pronJe ; + in_Prep = justPrep "dans" ; + it_NP = pronNounPhrase pronIl ; + many_Det = mkDeterminer1 plural "plusieurs" ; + most8many_Det = plupartDet ; + most_Det = mkDeterminer1 singular (["la plupart"] ++ elisDe) ; --- de + much_Det = mkDeterminer1 singular ("beaucoup" ++ elisDe) ; --- de + must_VV = mkVerbVerbDir (verbPres (conj3devoir "devoir") AHabere) ; + no_Phr = nonPhr ; --- and also Si! + on_Prep = justPrep "sur" ; + or_Conj = ouConj ; + otherwise_Adv = ss "autrement" ; + part_Prep = justCase genitive ; --- + possess_Prep = justCase genitive ; + quite_Adv = ss "assez" ; + she_NP = pronNounPhrase pronElle ; + so_Adv = ss "si" ; + somebody_NP = mkNameNounPhrase ["quelqu'un"] Masc ; + some_Det = mkDeterminer1 singular "quelque" ; + some_NDet = mkDeterminerNum "quelques" "quelques" ; + something_NP = mkNameNounPhrase ["quelque chose"] Masc ; + somewhere_Adv = ss ["quelque part"] ; --- ne - pas + that_Det = mkDeterminer singular (pre {"ce" ; "cet" / voyelle}) "cette" ; --- là + that_NP = mkNameNounPhrase ["ça"] Masc ; + therefore_Adv = ss "donc" ; + these_NDet = mkDeterminerNum "ces" "ces" ; --- ci + they_NP = pronNounPhrase pronIls ; + they8fem_NP = pronNounPhrase pronElles ; + this_Det = mkDeterminer singular (pre {"ce" ; "cet" / voyelle}) "cette" ; --- ci + this_NP = mkNameNounPhrase ["ceci"] Masc ; + those_NDet = mkDeterminerNum "ces" "ces" ; --- là + thou_NP = pronNounPhrase pronTu ; + through_Prep = justPrep "par" ; + too_Adv = ss "trop" ; + to_Prep = justCase dative ; --- + under_Prep = justPrep "sous" ; + very_Adv = ss "très" ; + want_VV = mkVerbVerbDir (verbPres (conj3vouloir "vouloir") AHabere) ; + we_NP = pronNounPhrase pronNous ; + what8one_IP = intPronWhat singular ; + what8many_IP = intPronWhat plural ; + when_IAdv = quandAdv ; + when_Subj = quandSubj ; + where_IAdv = ouAdv ; + which8many_IDet = mkDeterminerNum "quels" "quelles" ** {n = Pl} ; + which8one_IDet = quelDet ; + who8one_IP = intPronWho singular ; + who8many_IP = intPronWho plural ; + why_IAdv = pourquoiAdv ; + without_Prep = justPrep "sans" ; + with_Prep = justPrep "avec" ; + ye_NP = pronNounPhrase pronVous ; + yes_Phr = ouiPhr ; + you_NP = pronNounPhrase pronVous ; - EveryDet = chaqueDet ; - AllMassDet = toutDet ; - AllNumDet = tousDet ; - WhichDet = quelDet ; - WhichNumDet = mkDeterminerNum plural "quels" "quelles" ; - MostsDet = plupartDet ; - MostDet = mkDeterminer1 singular (["la plupart"] ++ elisDe) ; --- de - SomeDet = mkDeterminer1 singular "quelque" ; - SomeNumDet = mkDeterminerNum plural "quelques" "quelques" ; - NoDet = mkDeterminer singular "aucun" "aucune" ; --- ne - NoNumDet = mkDeterminerNum plural ("aucun" ++ "des") ("aucune" ++ "des") ; --- ne - AnyDet = mkDeterminer1 singular "quelque" ; --- - AnyNumDet = 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à - TheseNumDet = mkDeterminerNum plural "ces" "ces" ; --- ci - ThoseNumDet = mkDeterminerNum plural "ces" "ces" ; --- là - - 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 "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") AHabere) ; - CanKnowVV = mkVerbVerbDir (verbPres (conj3savoir "savoir") AHabere) ; - MustVV = mkVerbVerbDir (verbPres (conj3devoir "devoir") AHabere) ; - WantVV = mkVerbVerbDir (verbPres (conj3vouloir "vouloir") AHabere) ; - - 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" ; - PossessPrep = justCase genitive ; - PartPrep = justCase genitive ; --- - AgentPrep = justPrep "par" ; } diff --git a/lib/resource/french/SyntaxFre.gf b/lib/resource/french/SyntaxFre.gf index 080fc2bf2..f1e4d92c2 100644 --- a/lib/resource/french/SyntaxFre.gf +++ b/lib/resource/french/SyntaxFre.gf @@ -88,8 +88,7 @@ oper negVerb = \va -> elisNe ++ va ++ "pas" ; - copula = \b,w -> let etre = (predVerb verbEtre).s in - etre ! b ! Masc ! w ; + copula = verbEtre ; isClitCase = \c -> case c of { Acc => True ; @@ -161,7 +160,7 @@ oper } ; -- Questions - +{- ---- questVerbPhrase = \jean,dort -> {s = table { DirQ => optStr (estCeQue Acc) ++ (predVerbPhrase jean dort).s ! Ind ; @@ -211,7 +210,7 @@ oper IndirQ => quand.s ++ jeandort } } ; - +-} ----- moved from Morpho --2 Articles diff --git a/lib/resource/french/TestResourceFre.gf b/lib/resource/french/TestResourceFre.gf index caa75d88a..7738f0619 100644 --- a/lib/resource/french/TestResourceFre.gf +++ b/lib/resource/french/TestResourceFre.gf @@ -1,6 +1,10 @@ ---# -path=.:../romance:../oldabstract:../abstract:../../prelude +--# -path=.:../romance:../abstract:../../prelude -concrete TestResourceFre of TestResource = RulesFre, StructuralFre ** +concrete TestResourceFre of TestResource = + RulesFre, + ClauseFre, + StructuralFre + ** open Prelude, TypesFre, MorphoFre, SyntaxFre in { flags startcat=Phr ; lexer=text ; parser=chart ; unlexer=text ; diff --git a/lib/resource/romance/CategoriesRomance.gf b/lib/resource/romance/CategoriesRomance.gf index 6b1ebbf0a..341c05484 100644 --- a/lib/resource/romance/CategoriesRomance.gf +++ b/lib/resource/romance/CategoriesRomance.gf @@ -35,49 +35,76 @@ lincat n : Number ; p : Person ; c : ClitType} ; PN = {s : Str ; g : Gender} ; Det = {s : Gender => Str ; n : Number} ; - A = Adjective ; - -- = {s : AForm => Str ; p : Bool} ; - A2 = Adjective ** {s2 : Preposition ; c : CaseA} ; - ADeg = {s : Degree => AForm => Str ; p : Bool} ; - AP = Adjective ; + NDet = {s : Gender => Str} ; N2 = Function ; -- = CommNoun ** {s2 : Preposition ; c : CaseA} ; N3 = Function ** {s3 : Preposition ; c3 : CaseA} ; Prep = {s : Preposition ; c : CaseA} ; Num = {s : Gender => Str} ; + A = Adjective ; + -- = {s : AForm => Str ; p : Bool} ; + A2 = Adjective ** {s2 : Preposition ; c : CaseA} ; + ADeg = {s : Degree => AForm => Str ; p : Bool} ; + AP = Adjective ; + AS = Adjective ** {mp,mn : Mode} ; --- "more difficult for him to come than..." + A2S = Adjective ** {s2 : Preposition} ; + AV = Adjective ; + A2V = Adjective ** {s2 : Preposition} ; + V = Verb ; -- = {s : VF => Str} ; - VG = {s : Bool => Gender => VPForm => Str} ; - VP = {s : Gender => VPForm => Str} ; + VP = {s : Bool => Gender => VPForm => Str} ; + VPI = {s : Gender => Number => Person => Str} ; V2 = TransVerb ; -- = Verb ** {s2 : Preposition ; c : CaseA} ; V3 = TransVerb ** {s3 : Preposition ; c3 : CaseA} ; VS = Verb ** {mp,mn : Mode} ; VV = Verb ** {c : CaseA} ; + VA = Verb ; + + V2S = TransVerb ; + V2Q = TransVerb ; + V2V = TransVerb ** {s3 : Preposition ; c3 : CaseA} ; + V2A = TransVerb ; + V0 = Verb ; + + TP = {s : Str ; b : Bool ; t : Tense ; a : Anteriority} ; --- the Str field is dummy + Tense = {s : Str ; t : Tense} ; + Ant = {s : Str ; a : Anteriority} ; + Adv = {s : Str} ; + AdV = {s : Str} ; + AdA = {s : Str} ; + AdC = {s : Str} ; PP = {s : Str} ; S = Sentence ; -- = {s : Mode => Str} ; - Slash = Sentence ** {s2 : Preposition ; c : CaseA} ; Cl = Clause ; -- = {s : Bool => ClForm => Str} ; + Slash = Sentence ** {s2 : Preposition ; c : CaseA} ; RP = {s : RelForm => Str ; g : RelGen} ; - RC = {s : Mode => Gender => Number => Str} ; + RS = {s : Mode => Gender => Number => Person => Str} ; + RCl = {s : Bool => ClForm => Gender => Number => Person => Str} ; IP = {s : CaseA => Str ; g : Gender ; n : Number} ; - Qu = {s : QuestForm => Str} ; + IDet = {s : Gender => Str ; n : Number} ; + QS = {s : QuestForm => Str} ; + QCl = {s : Bool => ClForm => QuestForm => Str} ; Imp = {s : Gender => Number => Str} ; + Phr = {s : Str} ; Conj = {s : Str ; n : Number} ; ConjD = {s1,s2 : Str ; n : Number} ; - ListS = {s1,s2 : Mode => Str} ; - ListAP = {s1,s2 : AForm => Str ; p : Bool} ; - ListNP = {s1,s2 : CaseA => Str ; g : PronGen ; n : Number ; p : Person} ; + ListS = {s1,s2 : Mode => Str} ; + ListAP = {s1,s2 : AForm => Str ; p : Bool} ; + ListNP = {s1,s2 : CaseA => Str ; g : PronGen ; n : Number ; p : Person} ; + ListAdv = {s1,s2 : Str} ; + + Subj = {s : Str ; m : Mode} ; - Subj = {s : Str ; m : Mode} ; } diff --git a/lib/resource/romance/RulesRomance.gf b/lib/resource/romance/RulesRomance.gf index 21623c904..4790274dc 100644 --- a/lib/resource/romance/RulesRomance.gf +++ b/lib/resource/romance/RulesRomance.gf @@ -5,27 +5,7 @@ incomplete concrete RulesRomance of Rules = CategoriesRomance ** lin UseN = noun2CommNounPhrase ; - ModAP = modCommNounPhrase ; - ModGenOne = npGenDet singular ; - ModGenNum = npGenDetNum ; UsePN = nameNounPhrase ; - UseN2 = funAsCommNounPhrase ; -- [SyntaxFra.noun2CommNounPhrase] - AppN2 = appFunComm ; - AppN3 = appFun2 ; - UseA = adj2adjPhrase ; - ComplA2 = complAdj ; - PositADeg = positAdjPhrase ; - ComparADeg = comparAdjPhrase ; - SuperlNP = superlNounPhrase ; - - DetNP = detNounPhrase ; - IndefOneNP = indefNounPhrase singular ; - IndefNumNP = indefNounPhraseNum ; - DefOneNP = defNounPhrase singular ; - DefNumNP = defNounPhraseNum ; - MassNP = partitiveNounPhrase singular ; - UseInt i = {s = \\_ => i.s} ; - NoNum = noNum ; SymbPN i = {s = i.s ; g = Masc} ; --- cannot know gender SymbCN cn s = @@ -35,71 +15,106 @@ lin {s = \\n => cn.s ! n ++ i.s ; g = cn.g} ; + IndefOneNP = indefNounPhrase singular ; + IndefNumNP = indefNounPhraseNum ; + DefOneNP = defNounPhrase singular ; + DefNumNP = defNounPhraseNum ; + + DetNP = detNounPhrase ; + MassNP = partitiveNounPhrase singular ; + + AppN2 = appFunComm ; + AppN3 = appFun2 ; + UseN2 = funAsCommNounPhrase ; -- [SyntaxFra.noun2CommNounPhrase] + + ModAP = modCommNounPhrase ; CNthatS = nounThatSentence ; - PredVP = predVerbPhrase ; - PosVG = predVerbGroup True ; - NegVG = predVerbGroup False ; + ModGenOne = npGenDet singular ; + ModGenNum = npGenDetNum ; - PredVG = predVerbGroupClause ; + UseInt i = {s = \\_ => i.s} ; + NoNum = noNum ; - PredV = predVerb ; - PredAP = predAdjective ; - PredSuperl a = predAdjective (superlAdjDegr a) ; - PredCN = predCommNoun ; - PredV2 = complTransVerb ; - PredV3 = complDitransVerb ; - PredNP = predNounPhrase ; - PredPP = predAdverb ; - PredVS = complSentVerb ; - PredVV = complVerbVerb ; - PredPassV = predPassVerb ; - VTrans = transAsVerb ; + UseA = adj2adjPhrase ; + ComplA2 = complAdj ; + + PositADeg = positAdjPhrase ; + ComparADeg = comparAdjPhrase ; + SuperlNP = superlNounPhrase ; + + UseV2 = transAsVerb ; + +-- Formation of infinitival phrases. +{- ---- + UseCl tp cl = {s = \\o => tp.s ++ cl.s ! tp.b ! ClFinite tp.t tp.a o} ; + UseRCl tp cl = + {s = \\gn,p => tp.s ++ cl.s ! tp.b ! VFinite tp.t tp.a ! gn ! p} ; + UseQCl tp cl = {s = \\q => tp.s ++ cl.s ! tp.b ! VFinite tp.t tp.a ! q} ; +-} + + PosTP t a = {s = t.s ++ a.s ; b = True ; t = t.t ; a = a.a} ; + NegTP t a = {s = t.s ++ a.s ; b = False ; t = t.t ; a = a.a} ; + + TPresent = {s = [] ; t = Present} ; + TPast = {s = [] ; t = Past} ; + TFuture = {s = [] ; t = Future} ; + TConditional = {s = [] ; t = Condit} ; + + ASimul = {s = [] ; a = Simul} ; + AAnter = {s = [] ; a = Anter} ; + +-- Adverbs. AdjAdv a = {s = a.s ! AA} ; - AdvVP = adVerbPhrase ; +---- AdvVP = adVerbPhrase ; AdvPP p = p ; + PrepNP = prepNounPhrase ; + AdvCN = advCommNounPhrase ; AdvAP = advAdjPhrase ; + AdvAdv = cc2 ; - ThereNP = existNounPhrase ; +{- +--3 Sentences and relative clauses +-- - PosSlashV2 = slashTransVerb True ; - NegSlashV2 = slashTransVerb False ; - OneVP = predVerbPhrase nounPhraseOn ; + SlashV2 = slashTransVerb ; + SlashVV2 = slashVerbVerb ; + SlashAdv cl p = slashAdverb cl p.s ; + --PosSlashV2 = slashTransVerb True ; + --NegSlashV2 = slashTransVerb False ; +-} IdRP = identRelPron ; FunRP = funRelPron ; - RelVP = relVerbPhrase ; - RelSlash = relSlash ; - ModRC = modRelClause ; - RelSuch = relSuch ; +---- RelSlash = relSlash ; +---- ModRS = modRelClause ; +---- RelCl = relSuch ; - WhoOne = intPronWho singular ; - WhoMany = intPronWho plural ; - WhatOne = intPronWhat singular ; - WhatMany = intPronWhat plural ; +--! +--3 Questions and imperatives +-- + +---- IDetCN d n = detNounPhrase d n ; FunIP = funIntPron ; - NounIPOne = nounIntPron singular ; - NounIPMany = nounIntPron plural ; - QuestVP = questVerbPhrase ; - IntVP = intVerbPhrase ; - IntSlash = intSlash ; - QuestAdv = questAdverbial ; - IsThereNP = existNounPhraseQuest ; +---- QuestCl = questClause ; +---- IntSlash = intSlash ; +---- QuestAdv = questAdverbial ; - ImperVP = imperVerbPhrase ; +---- PosImpVP = imperVerbPhrase True ; +---- NegImpVP = imperVerbPhrase False ; IndicPhrase = indicUtt ; QuestPhrase = interrogUtt ; ImperOne = imperUtterance singular ; ImperMany = imperUtterance plural ; - PrepS p = p ; - AdvS = advSentence ; +----- PrepS p = p ; +----- AdvS = advSentence ; TwoS = twoSentence ; ConsS = consSentence ; @@ -118,8 +133,8 @@ lin SubjS = subjunctSentence ; -- stack SubjImper = subjunctImperative ; - SubjQu = subjunctQuestion ; - SubjVP = subjunctVerbPhrase ; + SubjQS = subjunctQuestion ; + ----- SubjVP = subjunctVerbPhrase ; PhrNP = useNounPhrase ; PhrOneCN = useCommonNounPhrase singular ; @@ -129,4 +144,20 @@ lin OnePhr p = p ; ConsPhr = cc2 ; + +----------------------- +-- special constructions + + OneNP = nounPhraseOn ; + + +{- ---- + ExistCN A = predVerbGroupClause npDet + (complTransVerb (mkDirectVerb (deponentVerb verbFinnas)) + (indefNounPhrase singular A)) ; + ExistNumCN nu A = predVerbGroupClause npDet + (complTransVerb (mkDirectVerb (deponentVerb verbFinnas)) + (indefNounPhraseNum plural nu A)) ; +-} + } diff --git a/lib/resource/romance/SyntaxRomance.gf b/lib/resource/romance/SyntaxRomance.gf index 9f957c9a8..286d647dc 100644 --- a/lib/resource/romance/SyntaxRomance.gf +++ b/lib/resource/romance/SyntaxRomance.gf @@ -81,6 +81,7 @@ oper -- The determiner determines the number of the argument noun. Determiner : Type = {s : Gender => Str ; n : Number} ; + NumDeterminer : Type = {s : Gender => Str} ; detNounPhrase : Determiner -> CommNoun -> NounPhrase = \tout, homme -> normalNounPhrase @@ -97,9 +98,9 @@ oper mkDeterminer1 : Number -> Str -> Determiner = \n,chaque -> mkDeterminer n chaque chaque ; - mkDeterminerNum : Number -> Str -> Str -> Numeral -> Determiner = - \n,tous,toutes,nu -> - {s = \\g => genForms tous toutes ! g ++ nu.s ! g ; n = n} ; + mkDeterminerNum : Str -> Str -> NumDeterminer = + \tous,toutes -> + {s = \\g => genForms tous toutes ! g} ; -- Indefinite and definite noun phrases are treated separately, @@ -261,7 +262,7 @@ oper mec.g Sg ; - superlAdjDegr : AdjDegr -> AdjPhrase = \bon -> + superlAdjPhrase : AdjDegr -> AdjPhrase = \bon -> {s = \\a => artDef (genAForm a) (numAForm a) nominative ++ bon.s ! Sup ! a ; p = bon.p } ; @@ -385,9 +386,6 @@ oper -- (It is not quite sure, though, whether this -- will suffice in French for examples like "je n'*y* vais pas": one may want to -- add "y" to "ne vais pas" instead of "ne - pas" to "y vais".) --- --- So far we restrict the syntax to present-tense verbs, even though --- morphology has complete conjugations. param VPForm = VPF Anteriority VF ; @@ -397,8 +395,8 @@ oper VerbPhrase = {s : Gender => VPForm => Str} ; VerbGroup = {s : Bool => Gender => VPForm => Str} ; - predVerbGroup : Bool -> VerbGroup -> VerbPhrase = \b,vg -> { - s = vg.s ! b + vpf2vf : VPForm -> VF = \vpf -> case vpf of { + VPF _ vf => vf } ; auxVerb : Verb -> Verb ; -- gives the auxiliary @@ -414,21 +412,32 @@ oper -- Predication is language-dependent in the negative case. + complVerb : Verb -> Complemnt = \verb -> + mkCompl verb (\\_,_,_ => []) ; + + mkCompl : Verb -> (Gender => Number => Person => Str) -> Complemnt = + \verb,comp -> complNoClit ( + \\g,n,p => VPart g n ; + AHabere => VPart Masc Sg + }), + comp ! g ! n ! p + >) ; + + complNoClit : (Gender => Number => Person => (Str*Str)) -> Complemnt = + \comp -> \\g,n,p => + let com = comp ! g ! n ! p in + {clit = [] ; part = com.p1 ; compl = com.p2} ; + + complCopula : (Gender => Number => Person => Str) -> Complemnt = + mkCompl copula ; + + predCopula : NounPhrase -> Complemnt -> Clause = \np,co -> + predVerbClause np copula co ; + +{- predVerb : Verb -> VerbGroup = \aller -> - {s = \\b,g => table { - VPF Simul v => if_then_Str b (aller.s ! v) (negVerb (aller.s ! v)) ; - VPF Anter v => - let - part = case aller.aux of { - AEsse => VPart g (nombreVerb v) ; - AHabere => VPart Masc Sg - } ; - allee = aller.s ! part ; - est = (auxVerb aller).s ! v - in - if_then_Str b est (negVerb est) ++ allee - } - } ; + {s = \\b,g,v => "foo"} ; formVerb : Verb -> Bool -> Gender -> VPForm -> Str = \aller,b,g,vf -> (predVerb aller).s ! b ! g ! vf ; @@ -454,6 +463,7 @@ oper }} } } ; +-} negVerb : Str -> Str ; @@ -461,27 +471,27 @@ oper -- common nouns ("est un homme"), and noun phrases ("est Jean"). -- We need a copula, which is of course language-dependent. - copula : Bool -> VPForm -> Str ; + copula : Verb ; -- The third rule is overgenerating: "est chaque homme" has to be ruled out -- on semantic grounds. - predAdjective : AdjPhrase -> VerbGroup = \bon -> - {s = \\b,g,v => copula b v ++ bon.s ! AF g (nombreVerbPhrase v)} ; + complAdjective : AdjPhrase -> Complemnt = \bon -> + complCopula (\\g,n,_ => bon.s ! AF g n) ; - predCommNoun : CommNounPhrase -> VerbGroup = \homme -> - {s = \\b,g,v => copula b v ++ indefNoun (nombreVerbPhrase v) homme} ; + complCommNoun : CommNounPhrase -> Complemnt = \homme -> + complCopula (\\_,n,_ => indefNoun n homme) ; - predNounPhrase : NounPhrase -> VerbGroup = \jean -> - {s = \\b,g,v => copula b v ++ jean.s ! stressed nominative} ; + complNounPhrase : NounPhrase -> Complemnt = \jean -> + complCopula (\\_,_,_ => jean.s ! stressed nominative) ; - predAdverb : Adverb -> VerbGroup = \dehors -> - {s = \\b,g,v => copula b v ++ dehors.s} ; + complAdverb : Adverb -> Complemnt = \dehors -> + complCopula (\\_,_,_ => dehors.s) ; -- Passivization is like adjectival predication. - predPassVerb : Verb -> VerbGroup = \aimer -> - {s = \\b,g,v => copula b v ++ aimer.s ! VPart g (nombreVerbPhrase v)} ; + passVerb : Verb -> Complemnt = \aimer -> + complCopula (\\g,n,_ => aimer.s ! VPart g n) ; -- complement a verb with noun phrase and optional preposition @@ -519,21 +529,18 @@ oper -- "aime Jean" ; "n'aime pas Jean" ; "l'aime" ; "ne l'aime pas". -- More will be needed when we add ditransitive verbs. - complTransVerb : TransVerb -> NounPhrase -> VerbGroup = \aime,jean -> - {s = \\b,g,w => ---- BUG: v gives stack overflow - let - Jean = jean.s ! (case2pformClit aime.c) ; - AAime = formVerb2 aime g w ; - A = AAime.verb ; - clit = (andB (isNounPhraseClit jean) (andB (isTransVerbClit aime) (isNotImperative w))) ; - Aime = if_then_Str clit - (AAime.part ! pgen2gen jean.g ! jean.n) - (AAime.part ! Masc ! Sg) - in - if_then_Str clit - (posNeg b (Jean ++ A) Aime) - (posNeg b A (Aime ++ Jean)) - } ; + complTransVerb : TransVerb -> NounPhrase -> Complemnt = \aime,jean -> + let + clit = andB (isNounPhraseClit jean) (isTransVerbClit aime) ; + Jean = jean.s ! (case2pformClit aime.c) ; + aimee = if_then_Str clit + (aime.s ! VPart (pgen2gen jean.g) jean.n) + (aime.s ! VPart Masc Sg) + in + \\_,_,_ => case clit of { + True => {clit = Jean ; part = aimee ; compl = []} ; + False => {clit = [] ; part = aimee ; compl = Jean} + } ; mkTransVerb : Verb -> Preposition -> CaseA -> TransVerb = \v,p,c -> v ** {s2 = p ; c = c} ; @@ -567,6 +574,7 @@ oper --- This must be completed to account for the order of the clitics. +{- ---- complDitransVerb : DitransVerb -> NounPhrase -> NounPhrase -> VerbGroup = \donner,jean,vin -> {s = \\b,g,w => @@ -588,7 +596,7 @@ oper in posNeg b (te ++ lui ++ a) (donne ++ aJean ++ 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, @@ -649,21 +657,32 @@ oper -- This is the traditional $S -> NP VP$ rule. It takes care of both -- mode and agreement. - predVerbPhrase : NounPhrase -> VerbPhrase -> Sentence = \jean,dort -> - {s = \\m => jean.s ! unstressed nominative ++ - dort.s ! pgen2gen jean.g ! VPF Simul (VFin (VPres m) jean.n jean.p) - } ; - param + Tense = Present | Past | Future | Condit ; + ClForm = ClPres Anteriority Mode | ClImperf Anteriority Mode | ClPasse Anteriority | ClFut Anteriority | ClCondit Anteriority ----- | ClInfinit Anteriority -- "naked infinitive" clauses + | ClInfinit Anteriority -- "naked infinitive" clauses ; +oper + Clause = {s : Bool => ClForm => Str} ; + +{- + predVerbPhrase : NounPhrase -> VerbPhrase -> Sentence = \jean,dort -> + {s = \\m => jean.s ! unstressed nominative ++ + dort.s ! pgen2gen jean.g ! VPF Simul (VFin (VPres m) jean.n jean.p) + } ; + + predVerbGroup : Bool -> VerbGroup -> VerbPhrase = \b,vg -> { + s = vg.s ! b + } ; + + oper cl2vp : ClForm -> Number -> Person -> VPForm = \c,n,p -> case c of { ClPres a m => VPF a (VFin (VPres m) n p) ; @@ -671,17 +690,48 @@ oper ClPasse a => VPF a (VFin VPasse n p) ; ClFut a => VPF a (VFin VFut n p) ; ClCondit a => VPF a (VFin VCondit n p) + ClInfinit a => VPF a VInfin } ; - Clause = {s : Bool => ClForm => Str} ; - predVerbGroupClause : NounPhrase -> VerbGroup -> Clause = \jean,dort -> {s = \\b,c => jean.s ! unstressed nominative ++ dort.s ! b ! pgen2gen jean.g ! cl2vp c jean.n jean.p } ; +-} + Complemnt = Gender => Number => Person => {clit, part, compl : Str} ; ---- ment + predVerbClause : NounPhrase -> Verb -> Complemnt -> Clause = \np,verb,comp -> + let nv = predVerbClauseGen np verb comp in + {s = \\b,cl => let nvg = nv ! b ! cl in nvg.p1 ++ nvg.p2} ; + predVerbClauseGen : NounPhrase -> Verb -> Complemnt -> + (Bool => ClForm => (Str * Str)) = \np,verb,comp -> + let + jean = np.s ! unstressed nominative ; + co = comp ! pgen2gen np.g ! np.n ! np.p ; + la = co.clit ; + ici = co.compl ; + aime : TMode -> Str = \t -> verb.s ! (VFin t np.n np.p) ; + avoir : TMode -> Str = \t -> (auxVerb verb).s ! (VFin t np.n np.p) ; + aimee = co.part ; + aimer = verb.s ! VInfin ; + avoirr = (auxVerb verb).s ! VInfin + in + \\b => table { + ClPres Simul m => ; + ClPres a m => ; + ClImperf Simul m => ; + ClImperf a m => ; + ClPasse Simul => ; + ClPasse a => ; + ClFut Simul => ; + ClFut a => ; + ClCondit Simul => ; + ClCondit a => ; + ClInfinit Simul => ; + ClInfinit a => + } ; --3 Sentence-complement verbs -- @@ -692,11 +742,12 @@ oper SentenceVerb : Type = Verb ** {mp, mn : Mode} ; +{- ----- complSentVerb : SentenceVerb -> Sentence -> VerbGroup = \croire,jeanboit -> {s = \\b,g,w => let {m = if_then_else Mode b croire.mp croire.mn} in (predVerb croire).s ! b ! g ! w ++ (embedConj ++ jeanboit.s ! m)} ; ----w - +-} verbSent : Verb -> Mode -> Mode -> SentenceVerb = \v,mp,mn -> v ** {mp = mp ; mn = mn} ; @@ -711,12 +762,12 @@ oper -- 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 => formVerb devoir b g v ++ prepCase devoir.c ++ nager.s ! True ! g ! VPF Simul VInfin ---- anter } ; - +-} mkVerbVerbDir : Verb -> VerbVerb = \v -> v ** {c = accusative} ; @@ -732,11 +783,12 @@ oper SentenceSlashNounPhrase = Sentence ** Complement ; +{- ---- slashTransVerb : Bool -> NounPhrase -> TransVerb -> SentenceSlashNounPhrase = \b,jean,aimer -> predVerbPhrase jean (predVerbGroup b (predVerb (verbOfTransVerb aimer))) ** complementOfTransVerb aimer ; - +-} --2 Relative pronouns and relative clauses -- @@ -1148,5 +1200,4 @@ oper siSubj, quandSubj : Subjunction ; ouiPhr, noPhr : Utterance ; - } diff --git a/lib/resource/scandinavian/CategoriesScand.gf b/lib/resource/scandinavian/CategoriesScand.gf index 3b530b0e8..678d6869c 100644 --- a/lib/resource/scandinavian/CategoriesScand.gf +++ b/lib/resource/scandinavian/CategoriesScand.gf @@ -43,7 +43,7 @@ lincat VS = Verb ; VQ = Verb ; - VV = Verb ** {s3 : Str} ; + VV = Verb ** {isAux : Bool} ; VA = Verb ; V2S = TransVerb ; @@ -69,9 +69,11 @@ lincat Cl = Clause ; -- = {s : Bool => SForm => Order => Str} ; Slash = Clause ** {s2 : Preposition} ; + RP = {s : RelCase => GenNum => Str ; g : RelGender} ; RS = {s : GenNum => Person => Str} ; RCl = {s : Bool => SForm => GenNum => Person => Str} ; + IP = NounPhrase ; IDet = {s : NounGender => Str ; n : Number ; b : SpeciesP} ; QS = {s : QuestForm => Str} ; @@ -88,4 +90,6 @@ lincat ListNP = {s1,s2 : NPForm => Str ; g : Gender ; n : Number ; p : Person} ; ListAdv = {s1,s2 : Str} ; + Subj = {s : Str} ; + } diff --git a/lib/resource/scandinavian/RulesScand.gf b/lib/resource/scandinavian/RulesScand.gf index 5ec458826..b4e043837 100644 --- a/lib/resource/scandinavian/RulesScand.gf +++ b/lib/resource/scandinavian/RulesScand.gf @@ -51,7 +51,7 @@ lin ComparADeg = comparAdjPhrase ; SuperlNP = superlNounPhrase ; --- verbs and verb phrases +-- verbs and verb phrases mostly in $Clause$ PredAS = predAdjSent ; PredV0 = predVerb0 ; @@ -65,7 +65,7 @@ lin AdjPart = adjPastPart ; - UseV2V x = x ; + UseV2V x = x ** {isAux = False} ; UseV2S x = x ; UseV2Q x = x ; UseA2S x = x ; @@ -119,12 +119,6 @@ lin IDetCN d n = detNounPhrase d n ; FunIP = funIntPron ; --- NounIPOne = nounIntPron singular ; --- NounIPMany = nounIntPron plural ; --- WhoOne = intPronWho singular ; --- WhoMany = intPronWho plural ; --- WhatOne = intPronWhat singular ; --- WhatMany = intPronWhat plural ; QuestCl = questClause ; IntSlash = intSlash ; diff --git a/lib/resource/scandinavian/SyntaxScand.gf b/lib/resource/scandinavian/SyntaxScand.gf index 4ba7428b9..b22f22f1f 100644 --- a/lib/resource/scandinavian/SyntaxScand.gf +++ b/lib/resource/scandinavian/SyntaxScand.gf @@ -855,18 +855,19 @@ oper -- ("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. - VerbVerb : Type = Verb ** {s3 : Str} ; + VerbVerb : Type = Verb ** {isAux : Bool} ; complVerbVerb : VerbVerb -> VerbPhrase -> VerbGroup = \vilja, simma -> useVerb vilja (\\g,n,p => vilja.s1 ++ - vilja.s3 ++ + if_then_Str vilja.isAux [] "att" ++ ---- vilja.s3 ++ simma.s ! VIInfinit ! g ! n ! p) ; transVerbVerb : VerbVerb -> TransVerb -> TransVerb = \vilja,hitta -> {s = vilja.s ; - s1 = vilja.s1 ++ vilja.s3 ++ + s1 = vilja.s1 ++ + if_then_Str vilja.isAux [] "att" ++ ---- vilja.s3 ++ hitta.s ! VI (Inf Act) ++ hitta.s1 ; s2 = hitta.s2 } ; @@ -927,7 +928,7 @@ oper \jag,vilja,se -> predVerbGroupClause jag (useVerb vilja (\\g,n,p => vilja.s1 ++ - vilja.s3 ++ + if_then_Str vilja.isAux [] "att" ++ ---- vilja.s3 ++ se.s ! VI (Inf Act)) ) ** {s2 = se.s2} ; diff --git a/lib/resource/swedish/ParadigmsSwe.gf b/lib/resource/swedish/ParadigmsSwe.gf index 84a8a36f2..35f15f87f 100644 --- a/lib/resource/swedish/ParadigmsSwe.gf +++ b/lib/resource/swedish/ParadigmsSwe.gf @@ -335,7 +335,7 @@ oper mkV0 v = v ** {lock_V0 = <>} ; mkVS v = v ** {lock_VS = <>} ; mkV2S v p = mkV2 v p ** {lock_V2S = <>} ; - mkVV v = v ** {s3 = "att" ; lock_VV = <>} ; + mkVV v = v ** {isAux = False ; lock_VV = <>} ; mkV2V v p t = mkV2 v p ** {s3 = t ; lock_V2V = <>} ; mkVA v = v ** {lock_VA = <>} ; mkV2A v p = mkV2 v p ** {lock_V2A = <>} ; diff --git a/lib/resource/swedish/StructuralSwe.gf b/lib/resource/swedish/StructuralSwe.gf index 794323557..a403c3641 100644 --- a/lib/resource/swedish/StructuralSwe.gf +++ b/lib/resource/swedish/StructuralSwe.gf @@ -5,7 +5,8 @@ -- Aarne Ranta 2002 -- 2004 -- concrete StructuralSwe of Structural = - CategoriesSwe, NumeralsSwe ** open Prelude, MorphoSwe, SyntaxSwe in { + CategoriesSwe, NumeralsSwe ** + open Prelude, MorphoSwe, SyntaxSwe in { flags optimize=values ; @@ -27,8 +28,10 @@ concrete StructuralSwe of Structural = between_Prep = ss "mellan" ; both_AndConjD = sd2 "både" "och" ** {n = Pl} ; by8means_Prep = ss "med" ; - can8know_VV = mkVerb "kunna" "kan" "kunn" "kunde" "kunnat" "kunnen" ** {s3 = []} ; - can_VV = mkVerb "kunna" "kan" "kunn" "kunde" "kunnat" "kunnen" ** {s3 = []} ; + can8know_VV = mkVerb "kunna" "kan" "kunn" "kunde" "kunnat" "kunnen" + ** {isAux = True} ; + can_VV = mkVerb "kunna" "kan" "kunn" "kunde" "kunnat" "kunnen" + ** {isAux = True} ; during_Prep = ss "under" ; either8or_ConjD = sd2 "antingen" "eller" ** {n = Sg} ; everybody_NP = let alla = table {Nom => "alla" ; Gen => "allas"} in @@ -50,7 +53,7 @@ concrete StructuralSwe of Structural = most_Det = mkDeterminerSgGender2 ["den mesta"] ["det mesta"] (DefP Def) ; most8many_Det = flestaDet ; much_Det = mkDeterminerSg (detSgInvar "mycket") IndefP ; - must_VV = mkVerb "få" "måste" "få" "fick" "måst" "måst" ** {s3 = []} ; + must_VV = mkVerb "få" "måste" "få" "fick" "måst" "måst" ** {isAux = True} ; no_Phr = ss ["Nej ."] ; on_Prep = ss "på" ; or_Conj = ss "eller" ** {n = Sg} ; @@ -80,7 +83,7 @@ concrete StructuralSwe of Structural = to_Prep = ss "till" ; under_Prep = ss "under" ; very_Adv = ss "mycket" ; - want_VV = mkVerb "vilja" "vill" "vilj" "ville" "velat" "velad" ** {s3 = []} ; + want_VV = mkVerb "vilja" "vill" "vilj" "ville" "velat" "velad" ** {isAux = True} ; we_NP = pronNounPhrase (vi_36) ; what8many_IP = intPronWhat plural ; what8one_IP = intPronWhat singular ; diff --git a/lib/resource/swedish/SyntaxSwe.gf b/lib/resource/swedish/SyntaxSwe.gf index 7dbd17369..3ece4e873 100644 --- a/lib/resource/swedish/SyntaxSwe.gf +++ b/lib/resource/swedish/SyntaxSwe.gf @@ -118,14 +118,14 @@ instance SyntaxSwe of SyntaxScand = TypesSwe ** progressiveVerbPhrase : VerbGroup -> VerbGroup = \verb -> complVerbVerb (mkVerb "hålla" "håller" "håll" "höll" "hållit" "hållen" ** - {s3 = ["på att"]}) + {isAux = False}) ---- ;{s3 = ["på att"]}) (predVerbGroup True Simul verb) ; progressiveClause : NounPhrase -> VerbPhrase -> Clause = \np,vp -> predVerbGroupClause np (complVerbVerb (mkVerb "hålla" "håller" "håll" "höll" "hållit" "hållen" ** - {s3 = ["på att"]}) + {isAux = False}) ---- ;{s3 = ["på att"]}) vp) ; strPrep : ComplPrep -> Str = \p -> case p of { diff --git a/lib/resource/swedish/TestResourceSwe.gf b/lib/resource/swedish/TestResourceSwe.gf index b5220e8fc..68df61d25 100644 --- a/lib/resource/swedish/TestResourceSwe.gf +++ b/lib/resource/swedish/TestResourceSwe.gf @@ -67,7 +67,7 @@ lin Tell = extTransVerb (vNopart (vTala "berätt")) [] ; Look = extTransVerb (mkVerbPart "se" "ser" "se" "såg" "sett" "sedd" "ut") [] ; - Try = extTransVerb (vNopart (vLeka "försök")) [] ** {s3 = "att"} ; + Try = extTransVerb (vNopart (vLeka "försök")) [] ** {isAux=False} ; Important = extAdjective (aFin "viktig") ** {s2 = "för"} ; Probable = extAdjective (aFin "sannolik") ; Easy = extAdjective (aAbstrakt "lätt") ** {s2 = "för"} ;