diff --git a/lib/resource-1.0/gf/Cat.gf b/lib/resource-1.0/gf/Cat.gf index a0b7ede1c..46705d793 100644 --- a/lib/resource-1.0/gf/Cat.gf +++ b/lib/resource-1.0/gf/Cat.gf @@ -76,4 +76,5 @@ abstract Cat = { Voc ; -- vocative or "please" + } diff --git a/lib/resource-1.0/gf/CatEng.gf b/lib/resource-1.0/gf/CatEng.gf index 348a67e7b..0610e5cbc 100644 --- a/lib/resource-1.0/gf/CatEng.gf +++ b/lib/resource-1.0/gf/CatEng.gf @@ -1,4 +1,4 @@ -concrete CatEng of Cat = open ResEng, Prelude in { +concrete CatEng of Cat = open ResEng, Prelude, (R = ParamX) in { lincat Text, Phr, Utt = {s : Str} ; diff --git a/lib/resource-1.0/gf/Conjunction.gf b/lib/resource-1.0/gf/Conjunction.gf index 10317eee2..0c8ea9559 100644 --- a/lib/resource-1.0/gf/Conjunction.gf +++ b/lib/resource-1.0/gf/Conjunction.gf @@ -1,4 +1,4 @@ -abstract Conjunction = Sequence ** { +abstract Conjunction = Cat ** { fun @@ -12,4 +12,16 @@ abstract Conjunction = Sequence ** { DConjNP : DConj -> SeqNP -> NP ; -- "either John or Mary" DConjAdv : DConj -> SeqAdv -> Adv ; -- "both badly and slowly" + +-- 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 ; + } diff --git a/lib/resource-1.0/gf/ConjunctionEng.gf b/lib/resource-1.0/gf/ConjunctionEng.gf index 899c04ce8..6bc13bc58 100644 --- a/lib/resource-1.0/gf/ConjunctionEng.gf +++ b/lib/resource-1.0/gf/ConjunctionEng.gf @@ -1,5 +1,5 @@ concrete ConjunctionEng of Conjunction = - SequenceEng ** open ResEng, Coordination in { + CatEng ** open ResEng, Coordination, Prelude in { lin @@ -23,4 +23,13 @@ concrete ConjunctionEng of Conjunction = isPre = ss.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} ; + } diff --git a/lib/resource-1.0/gf/Lang.png b/lib/resource-1.0/gf/Lang.png new file mode 100644 index 000000000..9ba07002b Binary files /dev/null and b/lib/resource-1.0/gf/Lang.png differ diff --git a/lib/resource-1.0/gf/Resource-HOWTO.html b/lib/resource-1.0/gf/Resource-HOWTO.html new file mode 100644 index 000000000..845dfb1cf --- /dev/null +++ b/lib/resource-1.0/gf/Resource-HOWTO.html @@ -0,0 +1,257 @@ + +
+ ++ +Aarne Ranta +
+30 November 2005 +
+ +The purpose of this document is to tell how to implement the GF +resource grammar API for a new language. We will not cover how +to use the resource grammar, nor how to change the API. But we +will give some hints how to extend the API. + +
+ +Notice. This document concerns the API V. 1.0 which has not +yet been released. You can find the beginnings of it +in GF/lib/resource-1.0/gf, but the locations of +files are not yet final. + + +
+
++ +As usual in typeful programming, the only thing you need to know +about an object you use is its type. When writing a linearization rule +for a GF abstract syntax function, the only thing you need to know is +the linearization types of its value and argument categories. To achieve +the division of the resource grammar to several parallel phrase modules, +what we need is an underlying definition of the linearization types. This +definition is given as the implementation of +
+ +As a slight asymmetry in the module diagrams, you find the following +modules: +
+ +Another characterization of lexical is that lexical units can be added +almost ad libitum, and they cannot be defined in terms of already +given rules. The lexical modules of the resource API are thus more like +samples than complete lists. There are three such modules: +
+ +The module Lex is used in Test instead of the two +larger modules. Its purpose is to provide a quick way to test the +syntactic structures of the phrase modules without having to implement +the larger lexica. + +
+ +In the case of Basic it may come out clearer than anywhere else +in the API that it is impossible to give exact translation equivalents in +different languages on the level of a resource grammar. In other words, +application grammars are likely to use the resource in different ways for +different languages. + + + +
+ cd GF/lib/resource/ + mkdir dutch + cd dutch ++ +
+ cp ../english/*Eng.gf . + rename -n 's/Eng/Dut/' *Eng.gf ++ +
+ sed -i 's/Eng/Dut/g' *Dut.gf ++ +
+ grep Dut *.gf ++ But you will have to make lots of manual changes in all files anyway! + +
+ i -retain ResDut + cc regN "huis" ++ +
+ gr -cat=NP -number=20 -tr | l -table ++ +
+ +Of course, you don't need to complete one phrase module before starting +with the next one. Actually, a suitable subset of Noun, +Verb, and Adjective will lead to a reasonable coverage +very soon, keep you motivated, and reveal errors. + + + + diff --git a/lib/resource-1.0/gf/Sequence.gf b/lib/resource-1.0/gf/Sequence.gf deleted file mode 100644 index 715c8f08e..000000000 --- a/lib/resource-1.0/gf/Sequence.gf +++ /dev/null @@ -1,13 +0,0 @@ -abstract Sequence = Cat ** { - - fun - 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 ; - -} \ No newline at end of file diff --git a/lib/resource-1.0/gf/SequenceEng.gf b/lib/resource-1.0/gf/SequenceEng.gf deleted file mode 100644 index 844743161..000000000 --- a/lib/resource-1.0/gf/SequenceEng.gf +++ /dev/null @@ -1,15 +0,0 @@ -concrete SequenceEng of Sequence = - CatEng ** open ResEng, Coordination, Prelude in { - - lin - - 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} ; - -} diff --git a/lib/resource-1.0/gf/Test.png b/lib/resource-1.0/gf/Test.png new file mode 100644 index 000000000..0bafdc876 Binary files /dev/null and b/lib/resource-1.0/gf/Test.png differ