diff --git a/resource/doc/example/QuestionsI.gf b/resource/doc/example/QuestionsI.gf index 18174443f..0e09af13f 100644 --- a/resource/doc/example/QuestionsI.gf +++ b/resource/doc/example/QuestionsI.gf @@ -1,6 +1,6 @@ --# -resource=../../english/LangEng.gf --- to compile: gf -makeconcrete QuestionsI.gfe +-- to compile: gf -examples QuestionsI.gfe incomplete concrete QuestionsI of Questions = open Resource in { lincat diff --git a/resource/doc/example/QuestionsI.gfe b/resource/doc/example/QuestionsI.gfe index 557afe259..71110475b 100644 --- a/resource/doc/example/QuestionsI.gfe +++ b/resource/doc/example/QuestionsI.gfe @@ -1,6 +1,6 @@ --# -resource=../../english/LangEng.gf --- to compile: gf -makeconcrete QuestionsI.gfe +-- to compile: gf -examples QuestionsI.gfe incomplete concrete QuestionsI of Questions = open Resource in { lincat diff --git a/resource/doc/gf-resource.html b/resource/doc/gf-resource.html index 580d424f8..f761d7972 100644 --- a/resource/doc/gf-resource.html +++ b/resource/doc/gf-resource.html @@ -710,7 +710,7 @@ generates QuestionsI.gf, when you execute the command
- gf -makeconcrete QuestionsI.gfe + gf -examples QuestionsI.gfeOf course, the grammar of any language can be created by parsing any language, as long as they have a common resource API. @@ -718,6 +718,74 @@ The use of English resource is generally recommended, because it is smaller and faster to parse than the other languages. + +
+ lin Who love_V2 man_N = in Phr "who loves men ?" ; ++uses as argument variables constants for words that can be found in +the lexicon. It is due to this that the example can be parsed. +When the resulting rule, +
+ lin Who love_V2 man_N = + QuestPhrase (UseQCl (PosTP TPresent ASimul) + (QPredV2 who8one_IP love_V2 (IndefNumNP NoNum (UseN man_N)))) ; ++is read by the GF compiler, the identifiers love_V2 and +man_N are not treated as constants, but, following +the normal binding rules of functional languages, as bound variables. +This is what gives the example method the generality that is needed. + +
+ +To write linearization rules by examples one thus has to know at +least one abstract syntax constant for each category for which +one needs a variable. + + + + +
+ lin Pope = in NP "the man" {man_N = regN "pope"} ;
+
+The resulting linearization rule is initially
++ lin Pope = DefOneNP (UseN man_N) ; ++but the substitution changes this to +
+ lin Pope = DefOneNP (UseN (regN "pope")) ; ++In this way, you do not have to extend the resource lexicon, but you +need to open the Paradigms module to compile the resulting term. + +
+ +Of course, the substituted expressions may come from another language +than the main language of the example: +
+ lin Pope = in NP "the man" {man_N = regN "pape" masculine} ;
+
+If many substitutions are needed, semicolons are used as separators:
+
+ {man_N = regN "pope" ; walk_N = regV "pray"} ;
+
+
+