#NEWLINE# def _parse_token( word , chunk = 'O' , pnp = 'O' , relation = 'O' , anchor = 'O' , format = [ WORD , POS , CHUNK , PNP , REL , ANCHOR , LEMMA ] ) : #NEWLINE# #INDENT# ' Returns a list of token tags parsed from the given <word> element.\n        Tags that are not attributes in a <word> (e.g., relation) can be given as parameters.\n    ' #NEWLINE# tags = [ ] #NEWLINE# for tag in format : #NEWLINE# #INDENT# if ( tag == WORD ) : #NEWLINE# #INDENT# tags . append ( xml_decode ( word . value ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( tag == POS ) : #NEWLINE# #INDENT# tags . append ( xml_decode ( word . get ( XML_TYPE , 'O' ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( tag == CHUNK ) : #NEWLINE# #INDENT# tags . append ( chunk ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( tag == PNP ) : #NEWLINE# #INDENT# tags . append ( pnp ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( tag == REL ) : #NEWLINE# #INDENT# tags . append ( relation ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( tag == ANCHOR ) : #NEWLINE# #INDENT# tags . append ( anchor ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( tag == LEMMA ) : #NEWLINE# #INDENT# tags . append ( xml_decode ( word . get ( XML_LEMMA , '' ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# tags . append ( xml_decode ( word . get ( tag , 'O' ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return tags