#NEWLINE# def test_apply_stoplist( self ) : #NEWLINE# #INDENT# from vsm.corpus.util.corpusbuilders import random_corpus , corpus_fromlist #NEWLINE# c = random_corpus ( 1000 , 50 , 0 , 20 , context_type = 'sentence' , metadata = True ) #NEWLINE# new_c = apply_stoplist ( c , nltk_stop = False , add_stop = [ '0' , '1' ] , freq = 0 , in_place = False ) #NEWLINE# li = [ [ ] , [ 'he' , 'said' ] , [ 'he' , 'said' , 'bar' ] , [ 'bar' , 'ate' ] , [ 'I' , 'foo' ] ] #NEWLINE# wc = corpus_fromlist ( li , context_type = 'sentence' ) #NEWLINE# new_wc = apply_stoplist ( wc , nltk_stop = True , freq = 1 , in_place = False ) #NEWLINE# self . assertTrue ( ( '0' in c . words ) ) #NEWLINE# self . assertTrue ( ( '1' in c . words ) ) #NEWLINE# self . assertFalse ( ( '0' in new_c . words ) ) #NEWLINE# self . assertFalse ( ( '1' in new_c . words ) ) #NEWLINE# self . assertTrue ( ( 'said' in new_wc . words ) ) #NEWLINE# self . assertTrue ( ( 'bar' in new_wc . words ) ) #NEWLINE# self . assertFalse ( ( 'he' in new_wc . words ) ) #NEWLINE# self . assertFalse ( ( 'foo' in new_wc . words ) ) #NEWLINE# self . assertFalse ( ( 'ate' in new_wc . words ) )