Package nltk :: Package draw :: Module srparser :: Class ShiftReduceDemo
[hide private]
[frames] | no frames]

Class ShiftReduceDemo

source code

object --+
         |
        ShiftReduceDemo

A graphical tool for exploring the shift/reduce parser. The tool displays the parser's stack and the remaining text, and allows the user to control the parser's operation. In particular, the user can shift tokens onto the stack, and can perform reductions on the top elements of the stack. A "step" button simply steps through the parsing process, performing the operations that parse.ShiftReduceParser would use.

Instance Methods [hide private]
 
__init__(self, grammar, sent, trace=0)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
_init_fonts(self, root) source code
 
_init_grammar(self, parent) source code
 
_init_bindings(self) source code
 
_init_buttons(self, parent) source code
 
_init_menubar(self, parent) source code
 
_init_feedback(self, parent) source code
 
_init_canvas(self, parent) source code
 
_redraw(self) source code
 
_draw_stack_top(self, widget) source code
 
_highlight_productions(self) source code
 
destroy(self, *e) source code
 
reset(self, *e) source code
 
step(self, *e) source code
 
shift(self, *e) source code
 
reduce(self, *e) source code
 
undo(self, *e) source code
 
postscript(self, *e) source code
 
mainloop(self, *args, **kwargs)
Enter the Tkinter mainloop.
source code
 
resize(self, size=None) source code
 
help(self, *e) source code
 
about(self, *e) source code
 
edit_grammar(self, *e) source code
 
set_grammar(self, grammar) source code
 
edit_sentence(self, *e) source code
 
set_sentence(self, sentence) source code
 
_toggle_grammar(self, *e) source code
 
_prodlist_select(self, event) source code
 
_popup_reduce(self, widget) source code
 
_animate_shift(self) source code
 
_animate_shift_frame(self, frame, widget, dx) source code
 
_animate_reduce(self) source code
 
_animate_reduce_frame(self, frame, widgets, dy) source code
 
_highlight_hover(self, event) source code
 
_clear_hover(self, *event) source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, grammar, sent, trace=0)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

mainloop(self, *args, **kwargs)

source code 

Enter the Tkinter mainloop. This function must be called if this demo is created from a non-interactive program (e.g. from a secript); otherwise, the demo will close as soon as the script completes.