From 7fc991cd18010037213bca70a17f2f8a8b340193 Mon Sep 17 00:00:00 2001 From: aarne Date: Sun, 4 Dec 2005 20:56:33 +0000 Subject: [PATCH] alternative list syntaxes --- lib/resource-1.0/abstract/Conjunction.gf | 38 ++++++++++------ lib/resource-1.0/abstract/ListConjunction.gf | 23 ++++++++++ lib/resource-1.0/english/ConjunctionEng.gf | 26 ++++++----- .../english/ListConjunctionEng.gf | 43 +++++++++++++++++++ 4 files changed, 103 insertions(+), 27 deletions(-) create mode 100644 lib/resource-1.0/abstract/ListConjunction.gf create mode 100644 lib/resource-1.0/english/ListConjunctionEng.gf diff --git a/lib/resource-1.0/abstract/Conjunction.gf b/lib/resource-1.0/abstract/Conjunction.gf index cb817559b..c1e580b13 100644 --- a/lib/resource-1.0/abstract/Conjunction.gf +++ b/lib/resource-1.0/abstract/Conjunction.gf @@ -2,22 +2,34 @@ abstract Conjunction = Cat ** { fun - ConjS : Conj -> [S] -> S ; -- "John walks and Mary runs" - ConjAP : Conj -> [AP] -> AP ; -- "even and prime" - ConjNP : Conj -> [NP] -> NP ; -- "John or Mary" - ConjAdv : Conj -> [Adv] -> Adv ; -- "quickly or slowly" + ConjS : Conj -> SeqS -> S ; -- "John walks and Mary runs" + ConjAP : Conj -> SeqAP -> AP ; -- "even and prime" + ConjNP : Conj -> SeqNP -> NP ; -- "John or Mary" + ConjAdv : Conj -> SeqAdv -> Adv ; -- "quickly or slowly" - DConjS : DConj -> [S] -> S ; -- "either John walks or Mary runs" - DConjAP : DConj -> [AP] -> AP ; -- "both even and prime" - DConjNP : DConj -> [NP] -> NP ; -- "either John or Mary" - DConjAdv : DConj -> [Adv] -> Adv ; -- "both badly and slowly" + DConjS : DConj -> SeqS -> S ; -- "either John walks or Mary runs" + DConjAP : DConj -> SeqAP -> AP ; -- "both even and prime" + DConjNP : DConj -> SeqNP -> NP ; -- "either John or Mary" + DConjAdv : DConj -> SeqAdv -> Adv ; -- "both badly and slowly" --- These categories are internal to this module. + +-- these are rather uninteresting + + TwoS : S -> S -> SeqS ; + AddS : SeqS -> S -> SeqS ; + TwoAdv : Adv -> Adv -> SeqAdv ; + AddAdv : SeqAdv -> Adv -> SeqAdv ; + TwoNP : NP -> NP -> SeqNP ; + AddNP : SeqNP -> NP -> SeqNP ; + TwoAP : AP -> AP -> SeqAP ; + AddAP : SeqAP -> AP -> SeqAP ; + +-- we use right-associative lists instead of GF's built-in lists cat - [S]{2} ; - [Adv]{2} ; - [NP]{2} ; - [AP]{2} ; + SeqS ; + SeqAdv ; + SeqNP ; + SeqAP ; } diff --git a/lib/resource-1.0/abstract/ListConjunction.gf b/lib/resource-1.0/abstract/ListConjunction.gf new file mode 100644 index 000000000..cb817559b --- /dev/null +++ b/lib/resource-1.0/abstract/ListConjunction.gf @@ -0,0 +1,23 @@ +abstract Conjunction = Cat ** { + + fun + + ConjS : Conj -> [S] -> S ; -- "John walks and Mary runs" + ConjAP : Conj -> [AP] -> AP ; -- "even and prime" + ConjNP : Conj -> [NP] -> NP ; -- "John or Mary" + ConjAdv : Conj -> [Adv] -> Adv ; -- "quickly or slowly" + + DConjS : DConj -> [S] -> S ; -- "either John walks or Mary runs" + DConjAP : DConj -> [AP] -> AP ; -- "both even and prime" + DConjNP : DConj -> [NP] -> NP ; -- "either John or Mary" + DConjAdv : DConj -> [Adv] -> Adv ; -- "both badly and slowly" + +-- These categories are internal to this module. + + cat + [S]{2} ; + [Adv]{2} ; + [NP]{2} ; + [AP]{2} ; + +} diff --git a/lib/resource-1.0/english/ConjunctionEng.gf b/lib/resource-1.0/english/ConjunctionEng.gf index f34c42f16..1aaf12f2e 100644 --- a/lib/resource-1.0/english/ConjunctionEng.gf +++ b/lib/resource-1.0/english/ConjunctionEng.gf @@ -23,21 +23,19 @@ concrete ConjunctionEng of Conjunction = 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} ; + TwoS = twoSS ; + AddS = consSS comma ; + TwoAdv = twoSS ; + AddAdv = consSS comma ; + TwoNP x y = twoTable Case x y ** {a = conjAgr x.a y.a} ; + AddNP xs x = consTable Case comma xs x ** {a = conjAgr xs.a x.a} ; + TwoAP x y = twoTable Agr x y ** {isPre = andB x.isPre y.isPre} ; + AddAP xs x = consTable 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} ; + SeqS = {s1,s2 : Str} ; + SeqAdv = {s1,s2 : Str} ; + SeqNP = {s1,s2 : Case => Str ; a : Agr} ; + SeqAP = {s1,s2 : Agr => Str ; isPre : Bool} ; } diff --git a/lib/resource-1.0/english/ListConjunctionEng.gf b/lib/resource-1.0/english/ListConjunctionEng.gf new file mode 100644 index 000000000..f34c42f16 --- /dev/null +++ b/lib/resource-1.0/english/ListConjunctionEng.gf @@ -0,0 +1,43 @@ +concrete ConjunctionEng of Conjunction = + CatEng ** open ResEng, 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} ; + +}