We first describe the access to the metarules subsystem using buffers with
single metarule applications. Then we proceed by describing the application of
multiple metarules in what we call the parallel, sequential, and cumulative
modes to input tree files.
We have defined conceptually a metarule as an ordered pair of trees.
In the implementation
of the metarule subsystem it works the same: a metarule is a buffer with two
trees. The name of the metarule is the name of the buffer. The first tree that
appear in the main window under the metarule
buffer is the left hand side,
the next appearing below is the right hand side25.12.
The positional approach allows us
to have naming freedom: the tree names
are irrelevant25.13.
Since we can save buffers into text files, we can talk also about metarule
files.
The available options for applying a metarule which is in a buffer are:
For applying it to a single input tree, click in the name of the
tree in the main window, and choose the option
apply metarule to tree.
You will be prompted for the name of the metarule
to apply to the tree
which should be, as we mentioned before, the name of the buffer that
contains the metarule trees. The output trees will be generated
at the end of the buffer that contains the input tree. The names of
the trees depend of a LISP parameter *metarules-change-name* .
If the value of the parameter is false -- the default
value -- then the new trees will have the same name as the input,
otherwise, the name of the input tree followed by a dash (`-') and
the name of the right hand side of the tree25.14.
The value of the parameter can be changed by choosing Tools
at the menu bar and then either name mr output trees = input or append rhs name to mr output trees.
For applying it to all the trees of a buffer, click in the name of the
buffer that contains the trees and proceed as above. The output will
be a new buffer with all the output trees. The name of the new buffer
will be the same as the input buffer prefixed by "MR-". The names of
the trees follow the conventions above.
The other options concern application to files (instead of buffers).
Lets first define
the concepts of parallel, sequential and cumulative application of metarules.
One metarule
file can contain more than one metarule. The first two trees, i.e., the first
tree pair, form one metarule - lets call it mr0. Subsequent pairs in the
sequence of trees define additional metarules --
mr1, mr2, ..., mrn.
We say that a metarule file is applied in parallel to a tree
(see Figure B.5)
if each of the
metarules is applied independently to the input generating its particular
output trees25.15. We generalize the concept to the
application in parallel of a metarule file to a tree file (with possibly more
than one tree), generating all the trees
as if each metarule in the metarule file was applied to each tree in the
input file.
We say that a metarule file
mr0, mr1, mr2, ...,mrn is applied in
sequence to a input tree file
(see Figure B.6)
if we apply mr0 to the trees of the input file, and
for each
apply metarule mri to the trees generated as a
result of the application of mri-1.
Finally, the cumulative application is similar to the sequential,
except that the input trees at each stage are by-passed to the output together
with the newly generated ones (see Figure B.7).
Remember that in case of matching failure the output result is decided as
explained in subsection B.2.3 either to be empty or to be the
input tree. The reflex here of having the parameter set for copying the input
is that for the parallel application the output will have as many copies of
the input as matching failures. For the sequential case the decision apply
at each level, and setting the parameter for copying, in a certain sense,
guarantees for the 'pipe' not to break.
Due to its nature and unlike the two other modes, the cumulative
application is not affected by this parameter.
The options for application of metarules to files are available by clicking
at the menu item Tools and then choosing the appropriate function
among:
Apply metarule to files:
You'll be prompted for the metarule file name
which should contain one metarule25.16, and for input file names.
Each input file name inpfile will be independently submitted to
the application of the metarule generating an output file with the
name MR-inpfile.
Apply metarules in parallel to files:
You'll be prompted for the metarules file name with one or more
metarules and for input file names.
Each input file name inpfile will be independently submitted to
the application of the metarules in parallel. For each parallel
application to a file inpfile an output file with the
name MRP-inpfile will be generated.
Apply metarules in sequence to files:
The interaction is as described for the application in parallel,
except that
the application of the metarules are in sequence and that
the output files are prefixed by MRS- instead of MRP-.
Apply metarules cumulatively to files:
The interaction is as described for the applications in parallel
and in sequence, except that the mode of application is cumulative
and that the output files are prefixed by MRC-.
Finally still under the Tools menu we can change the setting of the
parameter that controls the output result on matching failure
(see Subsection B.2.3)
by choosing
either copy input on mr matching failure or
no output on mr matching failure.
Next:Lexical Organization Up:Metarules Previous:ExamplesXTAG Project 1998-09-14