#NEWLINE# def _get_srl_spans( self , grid ) : #NEWLINE# #INDENT# '\n        list of list of (start, end), tag) tuples\n        ' #NEWLINE# if self . _srl_includes_roleset : #NEWLINE# #INDENT# predicates = self . _get_column ( grid , ( self . _colmap [ 'srl' ] + 1 ) ) #NEWLINE# start_col = ( self . _colmap [ 'srl' ] + 2 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# predicates = self . _get_column ( grid , self . _colmap [ 'srl' ] ) #NEWLINE# start_col = ( self . _colmap [ 'srl' ] + 1 ) #NEWLINE# #UNINDENT# num_preds = len ( [ p for p in predicates if ( p != '-' ) ] ) #NEWLINE# spanlists = [ ] #NEWLINE# for i in range ( num_preds ) : #NEWLINE# #INDENT# col = self . _get_column ( grid , ( start_col + i ) ) #NEWLINE# spanlist = [ ] #NEWLINE# stack = [ ] #NEWLINE# for ( wordnum , srl_tag ) in enumerate ( col ) : #NEWLINE# #INDENT# ( left , right ) = srl_tag . split ( '*' ) #NEWLINE# for tag in left . split ( '(' ) : #NEWLINE# #INDENT# if tag : #NEWLINE# #INDENT# stack . append ( ( tag , wordnum ) ) #NEWLINE# #UNINDENT# #UNINDENT# for i in range ( right . count ( ')' ) ) : #NEWLINE# #INDENT# ( tag , start ) = stack . pop ( ) #NEWLINE# spanlist . append ( ( ( start , ( wordnum + 1 ) ) , tag ) ) #NEWLINE# #UNINDENT# #UNINDENT# spanlists . append ( spanlist ) #NEWLINE# #UNINDENT# return i