#NEWLINE# def slice( self , start , stop ) : #NEWLINE# #INDENT# ' Returns a portion of the sentence from word start index to word stop index.\n            The returned slice is a subclass of Sentence and a deep copy.\n        ' #NEWLINE# s = Slice ( token = self . token , language = self . language ) #NEWLINE# for ( i , word ) in enumerate ( self . words [ start : stop ] ) : #NEWLINE# #INDENT# p0 = word . string #NEWLINE# p1 = word . lemma #NEWLINE# p2 = word . type #NEWLINE# p3 = ( ( ( word . chunk is not None ) and word . chunk . type ) or None ) #NEWLINE# p4 = ( ( ( word . pnp is not None ) and 'PNP' ) or None ) #NEWLINE# p5 = ( ( ( word . chunk is not None ) and unzip ( 0 , word . chunk . relations ) ) or None ) #NEWLINE# p6 = ( ( ( word . chunk is not None ) and unzip ( 1 , word . chunk . relations ) ) or None ) #NEWLINE# p7 = ( ( word . chunk and word . chunk . anchor_id ) or None ) #NEWLINE# p8 = ( ( word . chunk and ( word . chunk . start == ( start + i ) ) and BEGIN ) or None ) #NEWLINE# p9 = word . custom_tags #NEWLINE# if ( ( word . chunk is not None ) and ( word . chunk . stop > stop ) ) : #NEWLINE# #INDENT# ( p3 , p4 , p5 , p6 , p7 , p8 ) = ( None , None , None , None , None , None ) #NEWLINE# #UNINDENT# if ( ( word . pnp is not None ) and ( word . pnp . start == ( start + i ) ) ) : #NEWLINE# #INDENT# p4 = ( ( BEGIN + '-' ) + 'PNP' ) #NEWLINE# #UNINDENT# if ( ( word . pnp is not None ) and ( ( word . pnp . start < start ) or ( word . chunk . stop > stop ) ) ) : #NEWLINE# #INDENT# ( p4 , p7 ) = ( None , None ) #NEWLINE# #UNINDENT# s . append ( word = p0 , lemma = p1 , type = p2 , chunk = p3 , pnp = p4 , relation = p5 , role = p6 , anchor = p7 , iob = p8 , custom = p9 ) #NEWLINE# #UNINDENT# s . parent = self #NEWLINE# s . _start = start #NEWLINE# return s