nltk.draw.cfg module

Visualization tools for CFGs.

class nltk.draw.cfg.CFGDemo[source]

Bases: object

__init__(grammar, text)[source]
destroy(*args)[source]
mainloop(*args, **kwargs)[source]
reset_workspace()[source]
workspace_markprod(production)[source]
class nltk.draw.cfg.CFGEditor[source]

Bases: object

A dialog window for creating and editing context free grammars. CFGEditor imposes the following restrictions:

  • All nonterminals must be strings consisting of word characters.

  • All terminals must be strings consisting of word characters and space characters.

ARROW = 'Þ'
__init__(parent, cfg=None, set_cfg_callback=None)[source]
class nltk.draw.cfg.ProductionList[source]

Bases: ColorizedList

ARROW = 'Þ'
nltk.draw.cfg.demo()[source]
nltk.draw.cfg.demo2()[source]
nltk.draw.cfg.demo3()[source]