#NEWLINE# def chunked( sentence ) : #NEWLINE# #INDENT# ' Returns a list of Chunk and Chink objects from the given sentence.\n        Chink is a subclass of Chunk used for words that have Word.chunk == None\n        (e.g., punctuation marks, conjunctions).\n    ' #NEWLINE# chunks = [ ] #NEWLINE# for word in sentence : #NEWLINE# #INDENT# if ( word . chunk is not None ) : #NEWLINE# #INDENT# if ( ( len ( word ) == 0 ) or ( chunks [ ( - 1 ) ] != word . chunk ) ) : #NEWLINE# #INDENT# chunks . append ( word . chunk ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# ch = Chink ( sentence ) #NEWLINE# ch . append ( word . copy ( ch ) ) #NEWLINE# chunks . append ( ch ) #NEWLINE# #UNINDENT# #UNINDENT# return chunks