def apply(self, context):
    offsets = context.char_offsets
    L = len(offsets)
    seen = set()
    for l in range(1, (self.n_max + 1))[::(- 1)]:
        for i in range(((L - l) + 1)):
            w = context.words[((i + l) - 1)]
            start = offsets[i]
            end = ((offsets[((i + l) - 1)] + len(w)) - 1)
            ts = TemporarySpan(char_start=start, char_end=end, sentence=context)
            if (ts not in seen):
                seen.add(ts)
                (yield ts)
            if ((l == 1) and (self.split_rgx is not None) and ((end - start) > 0)):
                m = re.search(self.split_rgx, context.text[(start - offsets[0]):((end - offsets[0]) + 1)])
                if ((m is not None) and (l < (self.n_max + 1))):
                    ts1 = TemporarySpan(char_start=start, char_end=((start + m.start(1)) - 1), sentence=context)
                    if (ts1 not in seen):
                        seen.add(ts1)
                        (yield ts)
                    ts2 = TemporarySpan(char_start=(start + m.end(1)), char_end=end, sentence=context)
                    if (ts2 not in seen):
                        seen.add(ts2)
                        (yield ts2)
def apply(self, context):
    offsets = context.char_offsets
    L = len(offsets)
    seen = set()
    for l in range(1, (self.n_max + 1))[::(- 1)]:
        for i in range(((L - l) + 1)):
            w = context.words[((i + l) - 1)]
            start = offsets[i]
            end = ((offsets[((i + l) - 1)] + len(w)) - 1)
            ts = TemporarySpan(char_start=start, char_end=end, sentence=context)
            if (ts not in seen):
                seen.add(ts)
                (yield ts)
            if ((l == 1) and (self.split_rgx is not None) and ((end - start) > 0)):
                m = re.search(self.split_rgx, context.text[(start - offsets[0]):((end - offsets[0]) + 1)])
                if ((m is not None) and (l < (self.n_max + 1))):
                    ts1 = TemporarySpan(char_start=start, char_end=((start + m.start(1)) - 1), sentence=context)
                    if (ts1 not in seen):
                        seen.add(ts1)
                        (yield ts)
                    ts2 = TemporarySpan(char_start=(start + m.end(1)), char_end=end, sentence=context)
                    if (ts2 not in seen):
                        seen.add(ts2)
                        (yield ts2)