#NEWLINE# def test_compute_average_probability_of_words( self ) : #NEWLINE# #INDENT# summarizer = self . _build_summarizer ( self . EMPTY_STOP_WORDS ) #NEWLINE# word_freq = { #NEWLINE# #INDENT# 'one' : ( 1 / 6 ) , #NEWLINE# 'two' : ( 2 / 6 ) , #NEWLINE# 'three' : ( 3 / 6 ) , #NEWLINE# #UNINDENT# } #NEWLINE# s0 = [ ] #NEWLINE# s1 = [ 'one' ] #NEWLINE# s2 = [ 'two' , 'three' ] #NEWLINE# s3 = [ 'two' , 'three' , 'three' ] #NEWLINE# EPS = 0.0001 #NEWLINE# self . assertTrue ( ( abs ( ( summarizer . _compute_average_probability_of_words ( word_freq , s0 ) - 0 ) ) < EPS ) ) #NEWLINE# self . assertTrue ( ( abs ( ( summarizer . _compute_average_probability_of_words ( word_freq , s1 ) - ( 1 / 6 ) ) ) < EPS ) ) #NEWLINE# self . assertTrue ( ( abs ( ( summarizer . _compute_average_probability_of_words ( word_freq , s2 ) - ( 5 / 12 ) ) ) < EPS ) ) #NEWLINE# self . assertTrue ( ( abs ( ( summarizer . _compute_average_probability_of_words ( word_freq , s3 ) - ( 8 / 18 ) ) ) < EPS ) )