Trale includes code to produce output for a Chart Display developed at the DFKI in Saarbrücken. The chart display has the following functionality:
To get the Tcl/TK code please contact Stephan Busemann
(Stephan.Busemann@dfki.de (mailto:Stephan.Busemann@dfki.de)).
The TCL/TK code has to be installed in the trale directory under chart_display/TCL.
Tcl/TK has to be installed and wish
has to be in your search path.
Specify the following in your theory.pl
:- load_cd. % loads the code for the chart display root_symbol(@root). % symbol for input that does not end with punctuation imp_symbol(@imp). % symbol for input that ends with '!' decl_symbol(@decl). % symbol for input that ends with '.' que_symbol(@que). % symbol for input that ends with '?' cont_path([synsem,loc,cont]). % the path to the semantic content :- chart_display. % switches the chart display on (default) :- nochart_display. % switches the chart display off :- english. % the commands in the Chartdisplay are English (default) :- german. % the commands in the Chartdisplay are German :- tcl_warnings. % output of warnings in a TCL window (default) :- notcl_warnings. % output of warnings to console :- mrs. % output of MRS for a parsed string :- nomrs. % no output (default) :- fs. % switches feature structure output on (default) :- nofs. % switches feature structure output offThe macros that are given as arguments to
root_symbol
,
imp_symbol
, decl_symbol
, and que_symbol
have to
be specified in your grammar.
You may customize the chart display yourself or use one of the
dot.chartdisplay files supplied in trale_home(chart_display). They
should be moved to ~/.chartdisplay
.
If you put the following line in your .emacs, the prompt of the
command go
will be recognized by SICStus Prolog and you can
type Ctrl-C Ctrl-P to get to the previous input and parse it (or call
it) again.
(setq sicstus-prompt-regexp ">>> *\\|| [ ?][- ] *")If your coursor is in the line of a priviously parsed utterance, you may simply hit return and the sentence is parsed again.
Typing go.
brings you to an interactive mode. You can type in a
sentence and you will get parsing results displayed either with grisu
or to stdout depending on whether you use grisu (strongly
recommended). If not open the chart display will pop up (after a
parse) and the chart will be displayed. The left mouse button gives
you actions you can apply to the edge you point to and the right mouse
button gives you actions you can perform on the whole chart. The rule
names at the left hand side are also clickable. Empty elements are
not clickable yet.
While in the interactive mode, you can execute simple commands
directly, provided the command does not correspond to a lexical item
in your grammar. For instance reloading of a grammar can be done in
the interactive mode by typing c.
. However, if your grammar
contains the letter c as a lexical object, it will be parsed
rather than executed.
fs
and nofs
only affect the feature structure output for
sentences parsed in the interactive mode. Parses initiated with
rec
directly are not affected by this switch.
You can use the chart display for debugging rule applications: First
select a rule by clicking at the rule and choosing the menu item
`Select rule'. Then select an edge from the chart. All goals that are
at the first position of the rule (specified with goal>
in the
rule) will be executed. Then the selected edge will be unified with
the first daughter of the rule. If the unification succeeds and the
blocked constraints that are attached to the rule and to the edge are
satisfied, the next goals specified in the rule will be executed. If
this succeeds it is checked whether there are further daughters. If
this is not the case we have a passive edge which is shown to the
user. If there are further daughters an active edge is stored. This
active edge can be displayed by clicking somewhere in the display and
pressing the right mouse button. In the following other passive edges
from the chart can be combined with the active edge. If the
combination succeeds, the rule and the successfully combined daughters
are marked green. Otherwise the edge that could not be combined is
marked red. In case of a failure another passive edge can be tested
against the active edge.
If you select another rule, the active edge is deleted.
The debugging of constraints that fire due to instantiations during a
unification is difficult. To enable the debugging of single
constraints a flag is set if the char tdisplay is used for debugging.
For instance if you want to check whether a certain constraint fires,
you may include debug information in the constraint. In the following
example the flag chart_debug/1
is tested and if its value is
on
, a debug message is printed.
undelayed_accusative([El|T1]) if prolog((chart_debug(on) -> write(user_error,'Trying to assign accusative.'), nl(user_error) ;true )), assign_acc(El), accusative(T1).Instead of printing a message you can also call the debugger or do other things. Since this constrinat may be called during the lexicon compilation as well it would be very difficult to debug without the flag, since you would enter debug modus thousand times before you loaded the grammar completely.
Chart edges can be used as input for generation. You have to specify the path in your feature structures that yields the semantic information. (SYNSEMLOCCONT is the predefined path.) The semantic contribution of a selected chart edge will be taken as input for generation and all generation results will be displayed.