'list of list of (start, end), tag) tuples'

def _get_srl_spans(self, grid):

    if self._srl_includes_roleset:
        predicates = self._get_column(grid, (self._colmap[u'srl'] + 1))
        start_col = (self._colmap[u'srl'] + 2)
    else:
        predicates = self._get_column(grid, self._colmap[u'srl'])
        start_col = (self._colmap[u'srl'] + 1)
    num_preds = len([p for p in predicates if (p != u'-')])
    spanlists = []
    for i in range(num_preds):
        col = self._get_column(grid, (start_col + i))
        spanlist = []
        stack = []
        for (wordnum, srl_tag) in enumerate(col):
            (left, right) = srl_tag.split(u'*')
            for tag in left.split(u'('):
                if tag:
                    stack.append((tag, wordnum))
            for i in range(right.count(u')')):
                (tag, start) = stack.pop()
                spanlist.append(((start, (wordnum + 1)), tag))
        spanlists.append(spanlist)
    return spanlists
