title: Python Text Cleaning
body: <p>I am working on cleansing some text data and have one function that cleans out any non-english/jibberish words. It does a good job, however, there are a few words that are product names that are not recognized as real words so they get eliminated. I am trying to come up with a way to keep certain words in the text</p>
  <p>Here is the code I have so far:</p>
  <pre><code>    def clean_non_eng(text):
         words = set(nltk.corpus.words.words())
         text = &quot; &quot;.join(w for w in nltk.wordpunct_tokenize(text) if w.lower() in words or not 
         w.isalpha())
         return text
  </code></pre>
  <p>What I am thinking is having some kind of list containing words to keep, and incorporating this into my function to avoid eliminating them</p>
  <pre><code>    words_to_keep = ('wordtokeep1', 'wordtokeep2', 'wordtokeep3')
  </code></pre>
  <p>Is there a way I can incorporate another 'or' statement like &quot;or not in words_to_keep&quot; ? I have tried a few different ways but have not been successful so far</p>
  <p>as of now, if I call the function it will look something like this</p>
  <p>clean_non_eng('hello, this is a test of wordtokeep')</p>
  <p>it will return: 'hello, this is a test of'</p>