#NEWLINE# def specificity( classify = ( lambda document : False ) , documents = [ ] ) : #NEWLINE# #INDENT# ' Returns the percentage of negative cases correctly classified as negative.\n    ' #NEWLINE# ( TP , TN , FP , FN ) = confusion_matrix ( classify , documents ) #NEWLINE# return ( float ( TN ) / ( ( TN + TP ) or 1 ) )