#NEWLINE# def match( self , sentence , start = 0 , _v = None , _u = None ) : #NEWLINE# #INDENT# ' Returns the first match found in the given sentence, or None.\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# return find ( ( lambda m : ( m is not None ) ) , ( self . match ( s , start , _v ) for s in sentence ) ) #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# for sequence in ( ( ( _v is not None ) and _v ) or self . _variations ( ) ) : #NEWLINE# #INDENT# if ( ( _u is not None ) and ( id ( sequence ) in _u ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# m = self . _match ( sequence , sentence , start ) #NEWLINE# if ( m is not None ) : #NEWLINE# #INDENT# a . append ( ( m . words [ 0 ] . index , len ( m . words ) , m ) ) #NEWLINE# #UNINDENT# if ( ( m is not None ) and ( m . words [ 0 ] . index == start ) ) : #NEWLINE# #INDENT# return m #NEWLINE# #UNINDENT# if ( ( m is None ) and ( _u is not None ) ) : #NEWLINE# #INDENT# _u [ id ( sequence ) ] = False #NEWLINE# #UNINDENT# #UNINDENT# if ( len ( a ) > 0 ) : #NEWLINE# #INDENT# return sorted ( a ) [ 0 ] [ ( - 1 ) ]