gatenlp.impl.sortedintvls module¶
A simple class that represents a collection of sorted intervals and allows for some basic interval-based operations. Internally this stores the intervals using standard sorted lists. This is not optimal and my incur a O(n) overhead on some operations depending on the result set. It also may incur a significant overhead for creating and maintaning the sorted lists. NOTE: this stores a tuple (start, end, object) in the sorted list and uses a key function that returns the offset for sorting.
-
class
gatenlp.impl.sortedintvls.
SortedIntvls
[source]¶ Bases:
object
-
at
(start, end)[source]¶ Return iterable of tuples where start==start and end==end :param start: :param end: :return:
-
covering
(start, end)[source]¶ Intervals that contain the given range :param start: :param end: :return:
-
ending_after
(offset)[source]¶ Intervals the end after the given offset NOTE: the result is sorted by end offset! :param offset: :return:
-
ending_at
(offset)[source]¶ Return an iterable of (start, end, data) tuples where end==offset :param offset: the ending offset :return:
-
ending_to
(offset)[source]¶ Intervals that end before or at the given end offset. NOTE: the result is sorted by end offset, not start offset! :param offset: :return:
-
firsts
()[source]¶ Return an iterator of all intervals at the minimum start offset that exists. :return:
-
lasts
()[source]¶ Return an iterator of all intervals at the maximum start offset that exists. :return:
-
overlapping
(start, end)[source]¶ Intervals that overlap with the given range. :param start: :param end: :return:
-