#NEWLINE# def indexof( self , value , tag = WORD ) : #NEWLINE# #INDENT# ' Returns the indices of tokens in the sentence where the given token tag equals the string.\n            The string can contain a wildcard "*" at the end (this way "NN*" will match "NN" and "NNS").\n            The tag can be WORD, LEMMA, POS, CHUNK, PNP, RELATION, ROLE, ANCHOR or a custom word tag.\n            For example: Sentence.indexof("VP", tag=CHUNK) \n            returns the indices of all the words that are part of a VP chunk.\n        ' #NEWLINE# match = ( lambda a , b : ( ( a . endswith ( '*' ) and b . startswith ( a [ : ( - 1 ) ] ) ) or ( a == b ) ) ) #NEWLINE# indices = [ ] #NEWLINE# for i in range ( len ( self . words ) ) : #NEWLINE# #INDENT# if match ( value , unicode ( self . get ( i , tag ) ) ) : #NEWLINE# #INDENT# indices . append ( i ) #NEWLINE# #UNINDENT# #UNINDENT# return indices