Editor Macros
Macros for the tree editor
The tree editor should allow the user to define sequences of commonly
used actions that could be replayed at a keypress. Of course, rather
than being hardcoded to specific timepoints like the undo functions,
they should be able to adapt themselves to the tree!
Macros are required for recurring complex actions. This does not mean
fixing individual aspects of the tree such as one lexical reading;
right clicks take care of that much easier. Here are some commonly
required complex actions that I do over and over again when reviewing
automatically parsed trees:
- exchange subject and predicate (often the parser mistakes those
when the predicate is topicalized):
- move the edge mislabelled SUBJ from the finite verb to the full verb
- relabel this edge PRED
- move the edge mislabelled PRED from the full verb to the finite verb
- relabel it to SUBJ
- exchange SUBJ and OBJA: This is similar, but in addition both words
and any ATTR and DET dependents must be auto-corrected so that
their reading snaps from acc to nom or vice versa.
- fix the subordination of the sequence
[cat:CARD] [cat:NN]
.
This should almost always be CARD---ATTR--->NN
, but is often
attached as CARD<---APP---NN
(this has since been fixed in the
grammar, but the bulk of auto-heiseticker was parsed before that).
The action should be:
- find two words that violate the constraint `Zahl vor Nomen'
- take the NN and move its attachment one link up
- change its label to the label of the CARD
- change the label of the CARD to ATTR
- point the CARD to the NN
- repair overlooked auxiliary chains:
- shift the `current' (highlighted) word under the nearest word
to the left that is labelled `S'
- label it AUX
- shift any other PP, ADV, or KOM subordinations between the
current word and its new regent to modify the current word
Here is how I would like to be able to write the example macros
mentioned above:
macro Switch SUBJ/PRED
for(X.label=SUBJ & Y.label=PRED) {
exchange(X,Y)
X.label := PRED
Y.label := SUB
}
end
macro Switch SUBJ/OBJA
for(X.label=SUBJ & Y.label=OBJA) {
exchange(X,Y)
X.label := OBJA
Y.label := SUBJ
optimizeword(X%AT%)
optimizeword(Y%AT%)
optimizedaughters(X%AT%)
optimizedaughters(Y%AT%)
}
end
macro Fix CARD before NN
findconflict("Zahl vor Nomen", X, Y)
Y := X^
X := Y%AT%
Y.label := X.label
X.label = ATTR
end
macro ADV to AUX
X := current
raise(X, S)
for(Y/\X & X%AT%no > Y%AT%no & X^no < Y%AT%no & Y.label != SUBJ) {
Y := X%AT%
}
end
It is probably unrealistic to create a macro recorder which could
understand such subtle distinctions. Instead, a scripting language
needs to be created which can express all of these conditions and
actions. XCDG should be able to load .macro files and understand the
macros defined in them (via special code in XCDG's load{}, no need to
change cmdLoad() for that). Macros should carry identifiers that can
be executed via a new `Macro' menu item.
Comments