Package nltk_lite :: Package parse :: Module cfg :: Class Grammar
[show private | hide private]
[frames | no frames]

Type Grammar

object --+
         |
        Grammar

Known Subclasses:
Grammar

A context-free grammar. A Grammar consists of a start state and a set of productions. The set of terminals and nonterminals is implicitly specified by the productions.

If you need efficient key-based access to productions, you can use a subclass to implement it.
Method Summary
  __init__(self, start, productions)
Create a new context-free grammar, from the given start state and set of Productions.
  __repr__(self)
  __str__(self)
  productions(self, lhs, rhs)
  start(self)
Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Method Details

__init__(self, start, productions)
(Constructor)

Create a new context-free grammar, from the given start state and set of Productions.
Parameters:
start - The start symbol
           (type=Nonterminal)
productions - The list of productions that defines the grammar
           (type=list of Production)
Overrides:
__builtin__.object.__init__

Generated by Epydoc 2.1 on Tue Sep 5 09:37:21 2006 http://epydoc.sf.net