Package nltk :: Package parse :: Module projectivedependencyparser :: Class DependencySpan
[hide private]
[frames] | no frames]

type DependencySpan

source code

object --+
         |
        DependencySpan

A contiguous span over some part of the input string representing dependency (head -> modifier) relationships amongst words. An atomic span corresponds to only one word so it isn't a 'span' in the conventional sense, as its _start_index = _end_index = _head_index for concatenation purposes. All other spans are assumed to have arcs between all nodes within the start and end indexes of the span, and one head index corresponding to the head word for the entire span. This is the same as the root node if the dependency structure were depicted as a graph.

Instance Methods [hide private]
 
__init__(self, start_index, end_index, head_index, arcs, tags) source code
int.
head_index(self)
Returns: An value indexing the head of the entire DependencySpan.
source code
string.
__repr__(self)
Returns: A concise string representatino of the DependencySpan.
source code
string.
__str__(self)
Returns: A verbose string representation of the DependencySpan.
source code
boolean.
__eq__(self, other)
Returns: true if this DependencySpan is equal to other.
source code
boolean
__ne__(self, other)
Returns: false if this DependencySpan is equal to other
source code
int
__cmp__(self, other)
Returns: -1 if args are of different class.
source code
 
__hash__(self)
Returns: The hash value of this DependencySpan.
source code
Method Details [hide private]

__init__(self, start_index, end_index, head_index, arcs, tags)
(Constructor)

source code 
Overrides: object.__init__
(inherited documentation)

head_index(self)

source code 
Returns: int.
An value indexing the head of the entire DependencySpan.

__repr__(self)
(Representation operator)

source code 
Returns: string.
A concise string representatino of the DependencySpan.
Overrides: object.__repr__

__str__(self)
(Informal representation operator)

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

__eq__(self, other)
(Equality operator)

source code 
Returns: boolean.
true if this DependencySpan is equal to other.

__ne__(self, other)

source code 
Returns: boolean
false if this DependencySpan is equal to other

__cmp__(self, other)
(Comparison operator)

source code 
Returns: int
-1 if args are of different class. Otherwise returns the cmp() of the two sets of spans.

__hash__(self)
(Hashing function)

source code 
Returns:
The hash value of this DependencySpan.
Overrides: object.__hash__