#NEWLINE# def get_span_for_compound_noun( noun ) : #NEWLINE# #INDENT# '\n    Return document indexes spanning all (adjacent) tokens\n    in a compound noun.\n    ' #NEWLINE# min_i = ( noun . i - sum ( ( 1 for _ in takewhile ( ( lambda x : ( x . dep_ == 'compound' ) ) , reversed ( list ( noun . lefts ) ) ) ) ) ) #NEWLINE# return ( min_i , noun . i )