#NEWLINE# @ staticmethod #NEWLINE# def _parse_to_tagged( sent ) : #NEWLINE# #INDENT# '\n        Convert a chunk-parse tree to a list of tagged tokens.\n        ' #NEWLINE# toks = [ ] #NEWLINE# for child in sent : #NEWLINE# #INDENT# if isinstance ( child , Tree ) : #NEWLINE# #INDENT# if ( len ( sent ) == 0 ) : #NEWLINE# #INDENT# print ( 'Warning -- empty chunk in sentence' ) #NEWLINE# continue #NEWLINE# #UNINDENT# toks . append ( ( child [ 0 ] , ( 'B-%s' % child . label ( ) ) ) ) #NEWLINE# for tok in child [ 1 : ] : #NEWLINE# #INDENT# toks . append ( ( tok , ( 'I-%s' % child . label ( ) ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# toks . append ( ( child , 'O' ) ) #NEWLINE# #UNINDENT# #UNINDENT# return toks