Package nltk :: Module align :: Class Alignment
[hide private]
[frames] | no frames]

type Alignment

source code

object --+    
         |    
 frozenset --+
             |
            Alignment

A storage class for representing alignment between two sequences, s1, s2. In general, an alignment is a set of tuples of the form (i, j, ...) representing an alignment between the i-th element of s1 and the j-th element of s2. Tuples are extensible (they might contain additional data, such as a boolean to indicate sure vs possible alignments).

Instance Methods [hide private]
 
__getitem__(self, key)
Look up the alignments that map from a given index or slice.
source code
 
invert(self)
Return an Alignment object, being the inverted mapping.
source code
 
range(self, positions=None)
Work out the range of the mapping from the given positions.
source code
 
__repr__(self)
Produce a Giza-formatted string representing the alignment.
source code
 
__str__(self)
Produce a Giza-formatted string representing the alignment.
source code
 
_build_index(self)
Build a list self._index such that self._index[i] is a list of the alignments originating from word i.
source code

Inherited from frozenset: __and__, __cmp__, __contains__, __eq__, __ge__, __getattribute__, __gt__, __hash__, __iter__, __le__, __len__, __lt__, __ne__, __or__, __rand__, __reduce__, __ror__, __rsub__, __rxor__, __sub__, __xor__, copy, difference, intersection, issubset, issuperset, symmetric_difference, union

Static Methods [hide private]
a new object with type S, a subtype of T
__new__(cls, string_or_pairs) source code
Method Details [hide private]

__new__(cls, string_or_pairs)
Static Method

source code 
Returns: a new object with type S, a subtype of T
Overrides: frozenset.__new__
(inherited documentation)

range(self, positions=None)

source code 

Work out the range of the mapping from the given positions. If no positions are specified, compute the range of the entire mapping.

__repr__(self)
(Representation operator)

source code 

Produce a Giza-formatted string representing the alignment.

Overrides: frozenset.__repr__

__str__(self)
(Informal representation operator)

source code 

Produce a Giza-formatted string representing the alignment.

Overrides: object.__str__