Specify the location of a feature along a sequence.
This attempts to deal with fuzziness of position ends, but also
make it easy to get the start and end in the normal case (no
fuzziness).
You should access the start and end attributes with
your_location.start and your_location.end. If the start and
end are exact, this will return the positions, if not, we'll return
the approriate Fuzzy class with info about the position and fuzziness.
Methods
|
|
__getattr__
__init__
__str__
|
|
__getattr__
|
__getattr__ ( self, attr )
Make it easy to get non-fuzzy starts and ends.
We override get_attribute here so that in non-fuzzy cases we
can just return the start and end position without any hassle.
To get fuzzy start and ends, just ask for item.start and
item.end. To get non-fuzzy attributes (ie. the position only)
ask for item.nofuzzy_start , item.nofuzzy_end . These should return
the largest range of the fuzzy position. So something like:
(10.20)..(30.40) should return 10 for start, and 40 for end.
Exceptions
|
|
AttributeError( "Cannot evaluate attribute %s." % attr )
|
|
|
__init__
|
__init__ (
self,
start,
end,
)
Specify the start and end of a sequence feature.
start and end arguments specify the values where the feature begins
and ends. These can either by any of the *Position objects that
inherit from AbstractPosition, or can just be integers specifying the
position. In the case of integers, the values are assumed to be
exact and are converted in ExactPosition arguments. This is meant
to make it easy to deal with non-fuzzy ends.
|
|
__str__
|
__str__ ( self )
|
|