#NEWLINE# def test_group( self ) : #NEWLINE# #INDENT# s = Sentence ( parse ( 'the big black cat eats a tasty fish' ) ) #NEWLINE# m = search . search ( 'DT {JJ+} NN' , s ) #NEWLINE# self . assertEqual ( m [ 0 ] . group ( 1 ) . string , 'big black' ) #NEWLINE# self . assertEqual ( m [ 1 ] . group ( 1 ) . string , 'tasty' ) #NEWLINE# m = search . search ( 'DT { JJ { JJ { NN }}}' , s ) #NEWLINE# self . assertEqual ( m [ 0 ] . group ( 1 ) . string , 'big black cat' ) #NEWLINE# self . assertEqual ( m [ 0 ] . group ( 2 ) . string , 'black cat' ) #NEWLINE# self . assertEqual ( m [ 0 ] . group ( 3 ) . string , 'cat' ) #NEWLINE# m = search . search ( 'NP {VP NP}' , s ) #NEWLINE# v = m [ 0 ] . group ( 1 , chunked = True ) #NEWLINE# self . assertEqual ( self [ 0 ] . string , 'eats' ) #NEWLINE# self . assertEqual ( v [ 1 ] . string , 'a tasty fish' ) #NEWLINE# print ( 'pattern.search.Match.group()' )