From 59d1b1271b93257974b1f9b5c7025f13fb563db3 Mon Sep 17 00:00:00 2001 From: aarne Date: Wed, 7 Dec 2005 22:22:29 +0000 Subject: [PATCH] Scandinavian conjunction --- lib/prelude/Coordination.gf | 8 +- lib/resource-1.0/english/ConjunctionEng.gf | 10 ++- lib/resource-1.0/english/ExtEng.gf | 2 +- .../scandinavian/ConjunctionScand.gf | 88 ++++++++++--------- lib/resource-1.0/scandinavian/ParamScand.gf | 16 +++- lib/resource-1.0/swedish/ConjunctionSwe.gf | 2 + lib/resource-1.0/swedish/TestSwe.gf | 2 +- 7 files changed, 77 insertions(+), 51 deletions(-) create mode 100644 lib/resource-1.0/swedish/ConjunctionSwe.gf diff --git a/lib/prelude/Coordination.gf b/lib/prelude/Coordination.gf index 85073da24..9e707faa1 100644 --- a/lib/prelude/Coordination.gf +++ b/lib/prelude/Coordination.gf @@ -1,4 +1,4 @@ -resource Coordination = { +resource Coordination = open Prelude in { param ListSize = TwoElem | ManyElem ; @@ -27,6 +27,12 @@ oper conjunctDistrX : ConjunctionDistr -> ListX -> Str = \or,xs -> or.s1 ++ xs.s1 ++ or.s2 ++ xs.s2 ; + conjunctSS : Conjunction -> ListX -> SS = \or,xs -> + ss (xs.s1 ++ or.s ++ xs.s2) ; + + conjunctDistrSS : ConjunctionDistr -> ListX -> SS = \or,xs -> + ss (or.s1 ++ xs.s1 ++ or.s2 ++ xs.s2) ; + -- all this lifted to tables ListTable : Type -> Type = \P -> {s1,s2 : P => Str} ; diff --git a/lib/resource-1.0/english/ConjunctionEng.gf b/lib/resource-1.0/english/ConjunctionEng.gf index f34c42f16..0723b5abd 100644 --- a/lib/resource-1.0/english/ConjunctionEng.gf +++ b/lib/resource-1.0/english/ConjunctionEng.gf @@ -1,13 +1,15 @@ concrete ConjunctionEng of Conjunction = CatEng ** open ResEng, Coordination, Prelude in { + flags optimize=all_subs ; + lin - ConjS conj ss = {s = conjunctX conj ss} ; - DConjS conj ss = {s = conjunctDistrX conj ss} ; + ConjS = conjunctSS ; + DConjS = conjunctDistrSS ; - ConjAdv conj ss = {s = conjunctX conj ss} ; - DConjAdv conj ss = {s = conjunctDistrX conj ss} ; + ConjAdv = conjunctSS ; + DConjAdv = conjunctDistrSS ; ConjNP conj ss = conjunctTable Case conj ss ** { a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p} diff --git a/lib/resource-1.0/english/ExtEng.gf b/lib/resource-1.0/english/ExtEng.gf index 70e51605b..a1aa8325d 100644 --- a/lib/resource-1.0/english/ExtEng.gf +++ b/lib/resource-1.0/english/ExtEng.gf @@ -23,4 +23,4 @@ concrete ExtEng of ExtEngAbs = CatEng ** open ResEng in { can_Aux = {s = \\p => posneg p "can"} ; ---- cannt must_Aux = {s = \\p => posneg p "must"} ; -} \ No newline at end of file +} diff --git a/lib/resource-1.0/scandinavian/ConjunctionScand.gf b/lib/resource-1.0/scandinavian/ConjunctionScand.gf index 003b8b785..25ae49a30 100644 --- a/lib/resource-1.0/scandinavian/ConjunctionScand.gf +++ b/lib/resource-1.0/scandinavian/ConjunctionScand.gf @@ -1,43 +1,45 @@ ---concrete ConjunctionScand of Conjunction = --- CatScand ** open ResScand, Coordination, Prelude in { --- --- lin --- --- ConjS conj ss = {s = conjunctX conj ss} ; --- DConjS conj ss = {s = conjunctDistrX conj ss} ; --- --- ConjAdv conj ss = {s = conjunctX conj ss} ; --- DConjAdv conj ss = {s = conjunctDistrX conj ss} ; --- --- ConjNP conj ss = conjunctTable Case conj ss ** { --- a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p} --- } ; --- DConjNP conj ss = conjunctDistrTable Case conj ss ** { --- a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p} --- } ; --- --- ConjAP conj ss = conjunctTable Agr conj ss ** { --- isPre = ss.isPre --- } ; --- DConjAP conj ss = conjunctDistrTable Agr conj ss ** { --- isPre = ss.isPre --- } ; --- ----- These fun's are generated from the list cat's. --- --- BaseS = twoSS ; --- ConsS = consrSS comma ; --- BaseAdv = twoSS ; --- ConsAdv = consrSS comma ; --- BaseNP x y = twoTable Case x y ** {a = conjAgr x.a y.a} ; --- ConsNP xs x = consrTable Case comma xs x ** {a = conjAgr xs.a x.a} ; --- BaseAP x y = twoTable Agr x y ** {isPre = andB x.isPre y.isPre} ; --- ConsAP xs x = consrTable Agr comma xs x ** {isPre = andB xs.isPre x.isPre} ; --- --- lincat --- [S] = {s1,s2 : Str} ; --- [Adv] = {s1,s2 : Str} ; --- [NP] = {s1,s2 : Case => Str ; a : Agr} ; --- [AP] = {s1,s2 : Agr => Str ; isPre : Bool} ; --- ---} +incomplete concrete ConjunctionScand of Conjunction = + CatScand ** open ResScand, Coordination, Prelude in { + + flags optimize=all_subs ; + + lin + + ConjS conj ss = conjunctTable Order conj ss ; + DConjS conj ss = conjunctDistrTable Order conj ss ; + + ConjAdv conj ss = conjunctSS conj ss ; + DConjAdv conj ss = conjunctDistrSS conj ss ; + + ConjNP conj ss = conjunctTable NPForm conj ss ** { + a = {gn = conjGenNum (gennum utrum conj.n) ss.a.gn ; p = ss.a.p} + } ; + DConjNP conj ss = conjunctDistrTable NPForm conj ss ** { + a = {gn = conjGenNum (gennum utrum conj.n) ss.a.gn ; p = ss.a.p} + } ; + + ConjAP conj ss = conjunctTable AFormPos conj ss ** { + isPre = ss.isPre + } ; + DConjAP conj ss = conjunctDistrTable AFormPos conj ss ** { + isPre = ss.isPre + } ; + +-- These fun's are generated from the list cat's. + + BaseS = twoTable Order ; + ConsS = consrTable Order comma ; + BaseAdv = twoSS ; + ConsAdv = consrSS comma ; + BaseNP x y = twoTable NPForm x y ** {a = conjAgr x.a y.a} ; + ConsNP xs x = consrTable NPForm comma xs x ** {a = conjAgr xs.a x.a} ; + BaseAP x y = twoTable AFormPos x y ** {isPre = andB x.isPre y.isPre} ; + ConsAP xs x = consrTable AFormPos comma xs x ** {isPre = andB xs.isPre x.isPre} ; + + lincat + [S] = {s1,s2 : Order => Str} ; + [Adv] = {s1,s2 : Str} ; + [NP] = {s1,s2 : NPForm => Str ; a : Agr} ; + [AP] = {s1,s2 : AFormPos => Str ; isPre : Bool} ; + +} diff --git a/lib/resource-1.0/scandinavian/ParamScand.gf b/lib/resource-1.0/scandinavian/ParamScand.gf index 38a1d3c61..c1eef796c 100644 --- a/lib/resource-1.0/scandinavian/ParamScand.gf +++ b/lib/resource-1.0/scandinavian/ParamScand.gf @@ -80,6 +80,20 @@ oper Pres => VF (VPres v) ; Past => VF (VPret v) ; _ => VI (VInfin v) --- not to be used? - } ; + } ; + +-- Used in $ConjunctionScand$. + + conjGenNum : (_,_ : GenNum) -> GenNum = \g,h -> case of { + => SgUtr ; + => Plg ; + <_, Plg> => Plg ; + _ => SgNeutr + } ; + + conjAgr : (_,_ : Agr) -> Agr = \a,b -> { + gn = conjGenNum a.gn b.gn ; + p = conjPerson a.p b.p + } ; } diff --git a/lib/resource-1.0/swedish/ConjunctionSwe.gf b/lib/resource-1.0/swedish/ConjunctionSwe.gf new file mode 100644 index 000000000..43a288df1 --- /dev/null +++ b/lib/resource-1.0/swedish/ConjunctionSwe.gf @@ -0,0 +1,2 @@ +concrete ConjunctionSwe of Conjunction = CatSwe ** ConjunctionScand with + (DiffScand = DiffSwe) ; diff --git a/lib/resource-1.0/swedish/TestSwe.gf b/lib/resource-1.0/swedish/TestSwe.gf index 67a55ad33..83a7f30a0 100644 --- a/lib/resource-1.0/swedish/TestSwe.gf +++ b/lib/resource-1.0/swedish/TestSwe.gf @@ -9,7 +9,7 @@ concrete TestSwe of Test = SentenceSwe, QuestionSwe, -- RelativeSwe, --- ConjunctionSwe, + ConjunctionSwe, PhraseSwe, UntensedSwe, -- -- TensedSwe,