#NEWLINE# def search( self , sentence ) : #NEWLINE# #INDENT# ' Returns a list of all matches found in the given sentence.\n        ' #NEWLINE# if ( sentence . __class__ . __name__ == 'Sentence' ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( isinstance ( sentence , list ) or ( sentence . __class__ . __name__ == 'Text' ) ) : #NEWLINE# #INDENT# a = [ ] #NEWLINE# [ a . extend ( self . search ( s ) ) for s in sentence ] #NEWLINE# return a #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( sentence , basestring ) : #NEWLINE# #INDENT# sentence = Sentence ( sentence ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( isinstance ( sentence , Match ) and ( len ( sentence ) > 0 ) ) : #NEWLINE# #INDENT# sentence = sentence [ 0 ] . sentence . slice ( sentence [ 0 ] . index , ( sentence [ ( - 1 ) ] . index + 1 ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# a = [ ] #NEWLINE# v = self . _variations ( ) #NEWLINE# u = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# m = self . match ( sentence , _v = v ) #NEWLINE# while m : #NEWLINE# #INDENT# a . append ( m ) #NEWLINE# m = self . match ( sentence , start = ( m . words [ ( - 1 ) ] . index + 1 ) , _v = v , _u = u ) #NEWLINE# #UNINDENT# return a