class documentation

A graphical tool for exploring the regular expression based chunk parser nltk.chunk.RegexpChunkParser.

See HELP for instructional text.

Method __init__ No summary
Method about Undocumented
Method destroy Undocumented
Method load_grammar Undocumented
Method mainloop 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.
Method normalize_grammar Undocumented
Method reset Undocumented
Method resize Undocumented
Method save_grammar Undocumented
Method save_history Undocumented
Method set_devset_size Undocumented
Method show_devset Undocumented
Method show_help Undocumented
Method show_trace Undocumented
Method toggle_show_trace Undocumented
Method update Undocumented
Constant HELP Undocumented
Constant HELP_AUTOTAG Undocumented
Constant SAVE_GRAMMAR_TEMPLATE Undocumented
Constant TAGSET Undocumented
Instance Variable charnum Undocumented
Instance Variable chunker The chunker built from the grammar string
Instance Variable devset The development set -- a list of chunked sentences.
Instance Variable devset_button Undocumented
Instance Variable devset_index The index into the development set of the first instance that's currently being viewed.
Instance Variable devset_name The name of the development set (for save files).
Instance Variable devset_scroll Undocumented
Instance Variable devset_xscroll Undocumented
Instance Variable devsetbox Undocumented
Instance Variable devsetlabel Undocumented
Instance Variable evalbox Undocumented
Instance Variable grammar The unparsed grammar string
Instance Variable grammar_changed The last time() that the grammar was changed.
Instance Variable grammarbox Undocumented
Instance Variable grammarlabel Undocumented
Instance Variable helpbox Undocumented
Instance Variable helptabs Undocumented
Instance Variable linenum Undocumented
Instance Variable normalized_grammar A normalized version of self.grammar.
Instance Variable status Undocumented
Instance Variable tagset Undocumented
Instance Variable top Undocumented
Instance Variable trace_button Undocumented
Method _adaptively_modify_eval_chunk Modify _EVAL_CHUNK to try to keep the amount of time that the eval demon takes between _EVAL_DEMON_MIN and _EVAL_DEMON_MAX.
Method _chunkparse Undocumented
Method _chunks Undocumented
Method _color_chunk Undocumented
Method _devset_next Undocumented
Method _devset_prev Undocumented
Method _devset_scroll Undocumented
Method _eval_demon Undocumented
Method _eval_plot Undocumented
Method _grammarcheck Undocumented
Method _highlight_devset Undocumented
Method _history_next Undocumented
Method _history_prev Undocumented
Method _init_bindings Undocumented
Method _init_fonts Undocumented
Method _init_menubar Undocumented
Method _init_widgets Undocumented
Method _syntax_highlight_grammar Undocumented
Method _view_history Undocumented
Constant _BUTTON_PARAMS Undocumented
Constant _DEVSETBOX_PARAMS Undocumented
Constant _DRAW_LINES Undocumented
Constant _EVAL_DELAY If the user has not pressed any key for this amount of time (in seconds), and the current grammar has not been evaluated, then the eval demon will evaluate it.
Constant _EVAL_DEMON_MAX The maximum amount of time that the eval demon should take each time it runs -- if it takes more than this time, _EVAL_CHUNK will be modified downwards.
Constant _EVAL_DEMON_MIN The minimum amount of time that the eval demon should take each time it runs -- if it takes less than this time, _EVAL_CHUNK will be modified upwards.
Constant _EVAL_FREQ The frequency (in seconds) at which the eval demon is run
Constant _EVALBOX_PARAMS Undocumented
Constant _FONT_PARAMS Undocumented
Constant _FRAME_PARAMS Undocumented
Constant _GRAMMARBOX_PARAMS Undocumented
Constant _HELPBOX_PARAMS Undocumented
Constant _HELPTAB_BG_COLOR Undocumented
Constant _HELPTAB_BG_PARAMS Undocumented
Constant _HELPTAB_FG_COLOR Undocumented
Constant _HELPTAB_FG_PARAMS Undocumented
Constant _HELPTAB_SPACER Undocumented
Constant _SCALE_N Undocumented
Constant _STATUS_PARAMS Undocumented
Instance Variable _autoscale Undocumented
Instance Variable _chunk_label Undocumented
Instance Variable _devset_size Undocumented
Instance Variable _EVAL_CHUNK The number of sentences that should be evaluated by the eval demon each time it runs.
Instance Variable _eval_demon_running Undocumented
Instance Variable _eval_grammar The grammar that is being currently evaluated by the eval demon.
Instance Variable _eval_index The index of the next sentence in the development set that should be looked at by the eval demon.
Instance Variable _eval_lines Undocumented
Instance Variable _eval_normalized_grammar A normalized copy of _eval_grammar.
Instance Variable _eval_score The ChunkScore object that's used to keep track of the score of the current grammar on the development set.
Instance Variable _font Undocumented
Instance Variable _grammarcheck_errs Undocumented
Instance Variable _history A list of (grammar, precision, recall, fscore) tuples for grammars that the user has already tried.
Instance Variable _history_index When the user is scrolling through previous grammars, this is used to keep track of which grammar they're looking at.
Instance Variable _last_keypress The time() when a key was most recently pressed
Instance Variable _showing_trace Undocumented
Instance Variable _size Undocumented
Instance Variable _smallfont Undocumented
def __init__(self, devset_name='conll2000', devset=None, grammar='', chunk_label='NP', tagset=None): (source)
Parameters
devset_nameThe name of the development set; used for display & for save files. If either the name 'treebank' or the name 'conll2000' is used, and devset is None, then devset will be set automatically.
devsetA list of chunked sentences
grammarThe initial grammar to display.
chunk_labelUndocumented
tagsetDictionary from tags to string descriptions, used for the help page. Defaults to self.TAGSET.
def about(self, *e): (source)

Undocumented

def destroy(self, *e): (source)

Undocumented

def load_grammar(self, filename=None): (source)

Undocumented

def mainloop(self, *args, **kwargs): (source)

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.

def normalize_grammar(self, grammar): (source)

Undocumented

def reset(self): (source)

Undocumented

def resize(self, size=None): (source)

Undocumented

def save_grammar(self, filename=None): (source)

Undocumented

def save_history(self, filename=None): (source)

Undocumented

def set_devset_size(self, size=None): (source)

Undocumented

def show_devset(self, index=None): (source)

Undocumented

def show_help(self, tab): (source)

Undocumented

def show_trace(self, *e): (source)

Undocumented

def toggle_show_trace(self, *e): (source)

Undocumented

def update(self, *event): (source)

Undocumented

Undocumented

Value
[('Help',
  '20',
  '''Welcome to the regular expression chunk-parser grammar editor.  You can use
 this editor to develop and test chunk parser grammars based on NLTK\'s RegexpCh
unkParser class.

Use this box (\'Help\') to learn more about the editor; click on the tabs for he
...
HELP_AUTOTAG = (source)

Undocumented

Value
[('red', dict(foreground='#a00')),
 ('green', dict(foreground='#080')),
 ('highlight', dict(background='#ddd')),
 ('underline', dict(underline=True)),
 ('h1', dict(underline=True)),
 ('indent', dict(lmargin1=20, lmargin2=20)),
 ('hangindent', dict(lmargin1=0, lmargin2=60)),
...
SAVE_GRAMMAR_TEMPLATE: str = (source)

Undocumented

Value
'''# Regexp Chunk Parsing Grammar
# Saved %(date)s
#
# Development set: %(devset)s
#   Precision: %(precision)s
#   Recall:    %(recall)s
#   F-score:   %(fscore)s
...
TAGSET: dict[str, str] = (source)

Undocumented

Value
{'CC': 'Coordinating conjunction',
 'PRP$': 'Possessive pronoun',
 'CD': 'Cardinal number',
 'RB': 'Adverb',
 'DT': 'Determiner',
 'RBR': 'Adverb, comparative',
 'EX': 'Existential there',
...
charnum: dict = (source)

Undocumented

The chunker built from the grammar string

The development set -- a list of chunked sentences.

devset_button = (source)

Undocumented

devset_index = (source)

The index into the development set of the first instance that's currently being viewed.

devset_name = (source)

The name of the development set (for save files).

devset_scroll = (source)

Undocumented

devset_xscroll = (source)

Undocumented

devsetbox = (source)

Undocumented

devsetlabel = (source)

Undocumented

Undocumented

The unparsed grammar string

grammar_changed: int = (source)

The last time() that the grammar was changed.

grammarbox = (source)

Undocumented

grammarlabel = (source)

Undocumented

Undocumented

helptabs: dict = (source)

Undocumented

linenum: dict[int, int] = (source)

Undocumented

normalized_grammar = (source)

A normalized version of self.grammar.

Undocumented

Undocumented

Undocumented

trace_button = (source)

Undocumented

def _adaptively_modify_eval_chunk(self, t): (source)

Modify _EVAL_CHUNK to try to keep the amount of time that the eval demon takes between _EVAL_DEMON_MIN and _EVAL_DEMON_MAX.

Parameters
tThe amount of time that the eval demon took.
def _chunkparse(self, words): (source)

Undocumented

def _chunks(self, tree): (source)

Undocumented

def _color_chunk(self, sentnum, chunk, tag): (source)

Undocumented

def _devset_next(self, *e): (source)

Undocumented

def _devset_prev(self, *e): (source)

Undocumented

def _devset_scroll(self, command, *args): (source)

Undocumented

def _eval_demon(self): (source)

Undocumented

def _eval_plot(self, *e, **config): (source)

Undocumented

def _grammarcheck(self, grammar): (source)

Undocumented

def _highlight_devset(self, sample=None): (source)

Undocumented

def _history_next(self, *e): (source)

Undocumented

def _history_prev(self, *e): (source)

Undocumented

def _init_bindings(self, top): (source)

Undocumented

def _init_fonts(self, top): (source)

Undocumented

def _init_menubar(self, parent): (source)

Undocumented

def _init_widgets(self, top): (source)

Undocumented

def _syntax_highlight_grammar(self, grammar): (source)

Undocumented

def _view_history(self, index): (source)

Undocumented

_BUTTON_PARAMS = (source)

Undocumented

Value
dict(background='#777', activebackground='#777', highlightbackground='#777')
_DEVSETBOX_PARAMS = (source)

Undocumented

Value
dict(width=70,
     height=10,
     background='#eef',
     highlightbackground='#eef',
     highlightthickness=1,
     relief='groove',
     border=2,
...
_DRAW_LINES: bool = (source)

Undocumented

Value
False
_EVAL_DELAY: int = (source)

If the user has not pressed any key for this amount of time (in seconds), and the current grammar has not been evaluated, then the eval demon will evaluate it.

Value
1
_EVAL_DEMON_MAX: float = (source)

The maximum amount of time that the eval demon should take each time it runs -- if it takes more than this time, _EVAL_CHUNK will be modified downwards.

Value
0.04
_EVAL_DEMON_MIN: float = (source)

The minimum amount of time that the eval demon should take each time it runs -- if it takes less than this time, _EVAL_CHUNK will be modified upwards.

Value
0.02
_EVAL_FREQ: float = (source)

The frequency (in seconds) at which the eval demon is run

Value
0.2
_EVALBOX_PARAMS = (source)

Undocumented

Value
dict(background='#eef',
     highlightbackground='#eef',
     highlightthickness=1,
     relief='groove',
     border=2,
     width=300,
     height=280)
_FONT_PARAMS = (source)

Undocumented

Value
dict(family='helvetica', size=(-20))
_FRAME_PARAMS = (source)

Undocumented

Value
dict(background='#777', padx=2, pady=2, border=3)
_GRAMMARBOX_PARAMS = (source)

Undocumented

Value
dict(width=40,
     height=12,
     background='#efe',
     highlightbackground='#efe',
     highlightthickness=1,
     relief='groove',
     border=2,
...
_HELPBOX_PARAMS = (source)

Undocumented

Value
dict(width=15,
     height=15,
     background='#efe',
     highlightbackground='#efe',
     foreground='#555',
     highlightthickness=1,
     relief='groove',
...
_HELPTAB_BG_COLOR: str = (source)

Undocumented

Value
'#aba'
_HELPTAB_BG_PARAMS = (source)

Undocumented

Value
dict(background='#aba')
_HELPTAB_FG_COLOR: str = (source)

Undocumented

Value
'#efe'
_HELPTAB_FG_PARAMS = (source)

Undocumented

Value
dict(background='#efe')
_HELPTAB_SPACER: int = (source)

Undocumented

Value
6
_SCALE_N: int = (source)

Undocumented

Value
5
_STATUS_PARAMS = (source)

Undocumented

Value
dict(background='#9bb', relief='groove', border=2)
_autoscale = (source)

Undocumented

_chunk_label = (source)

Undocumented

_devset_size = (source)

Undocumented

_EVAL_CHUNK = (source)

The number of sentences that should be evaluated by the eval demon each time it runs.

_eval_demon_running: bool = (source)

Undocumented

_eval_grammar = (source)

The grammar that is being currently evaluated by the eval demon.

_eval_index: int = (source)

The index of the next sentence in the development set that should be looked at by the eval demon.

_eval_lines = (source)

Undocumented

_eval_normalized_grammar = (source)

A normalized copy of _eval_grammar.

_eval_score = (source)

The ChunkScore object that's used to keep track of the score of the current grammar on the development set.

Undocumented

_grammarcheck_errs: list = (source)

Undocumented

_history: list = (source)

A list of (grammar, precision, recall, fscore) tuples for grammars that the user has already tried.

_history_index: int = (source)

When the user is scrolling through previous grammars, this is used to keep track of which grammar they're looking at.

_last_keypress = (source)

The time() when a key was most recently pressed

_showing_trace: bool = (source)

Undocumented

Undocumented

_smallfont = (source)

Undocumented