#NEWLINE# def assert_classifier_correct( algorithm ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# classifier = classify . MaxentClassifier . train ( TRAIN , algorithm , trace = 0 , max_iter = 1000 ) #NEWLINE# #UNINDENT# except ( LookupError , AttributeError ) as e : #NEWLINE# #INDENT# raise SkipTest ( str ( e ) ) #NEWLINE# #UNINDENT# for ( ( px , py ) , featureset ) in zip ( RESULTS , TEST ) : #NEWLINE# #INDENT# pdist = classifier . prob_classify ( featureset ) #NEWLINE# assert ( abs ( ( pdist . prob ( 'x' ) - px ) ) < 0.01 ) , ( pdist . prob ( 'x' ) , pdist ) #NEWLINE# assert ( abs ( ( pdist . prob ( 'y' ) - py ) ) < 0.01 ) , ( pdist . prob ( 'y' ) , py )