#NEWLINE# def test_train( self ) : #NEWLINE# #INDENT# sentences = _read_tagged ( _wsj_train ) #NEWLINE# nr_iter = 5 #NEWLINE# self . tagger . train ( sentences , nr_iter = nr_iter ) #NEWLINE# nr_words = sum ( ( len ( words ) for ( words , tags ) in sentences ) ) #NEWLINE# assert_equal ( ( nr_words * nr_iter ) , self . tagger . model . i ) #NEWLINE# tag_set = set ( ) #NEWLINE# for ( _ , tags ) in sentences : #NEWLINE# #INDENT# tag_set . update ( tags ) #NEWLINE# #UNINDENT# assert_equal ( len ( tag_set ) , len ( self . tagger . model . classes ) ) #NEWLINE# for tag in tag_set : #NEWLINE# #INDENT# assert_true ( ( tag in self . tagger . model . classes ) )