Package nltk :: Module grammar :: Class DependencyGrammar
[hide private]
[frames] | no frames]

type DependencyGrammar

source code

object --+
         |
        DependencyGrammar

A dependency grammar. A DependencyGrammar consists of a set of productions. Each production specifies a head/modifier relationship between a pair of words.

Instance Methods [hide private]
 
__init__(self, productions)
Create a new dependency grammar, from the set of Productions.
source code
boolean.
contains(self, head, mod)
Returns: true if this DependencyGrammar contains a DependencyProduction mapping 'head' to 'mod'.
source code
boolean.
__contains__(self, head, mod)
Returns: true if this DependencyGrammar contains a DependencyProduction mapping 'head' to 'mod'.
source code
string
__str__(self)
Returns: A verbose string representation of the DependencyGrammar
source code
 
__repr__(self)
Returns: A concise string representation of the DependencyGrammar
source code
Method Details [hide private]

__init__(self, productions)
(Constructor)

source code 

Create a new dependency grammar, from the set of Productions.

Parameters:
  • productions (list of Production) - The list of productions that defines the grammar
Overrides: object.__init__

contains(self, head, mod)

source code 
Parameters:
  • head (string.) - A head word.
  • mod (string.) - A mod word, to test as a modifier of 'head'.
Returns: boolean.
true if this DependencyGrammar contains a DependencyProduction mapping 'head' to 'mod'.

__contains__(self, head, mod)
(In operator)

source code 
Parameters:
  • head (string.) - A head word.
  • mod (string.) - A mod word, to test as a modifier of 'head'.
Returns: boolean.
true if this DependencyGrammar contains a DependencyProduction mapping 'head' to 'mod'.

__str__(self)
(Informal representation operator)

source code 
Returns: string
A verbose string representation of the DependencyGrammar
Overrides: object.__str__

__repr__(self)
(Representation operator)

source code 
Returns:
A concise string representation of the DependencyGrammar
Overrides: object.__repr__