#NEWLINE# @ staticmethod #NEWLINE# def review_to_wordlist( review , remove_stopwords = False ) : #NEWLINE# #INDENT# review_text = BeautifulSoup ( review ) . get_text ( ) #NEWLINE# review_text = re . sub ( '[^a-zA-Z]' , ' ' , review_text ) #NEWLINE# words = review_text . lower ( ) . split ( ) #NEWLINE# if remove_stopwords : #NEWLINE# #INDENT# stops = set ( stopwords . words ( 'english' ) ) #NEWLINE# words = [ w for w in words if ( not ( w in stops ) ) ] #NEWLINE# #UNINDENT# return words