title: Faster way to remove stop words in Python
body: <p>I am trying to remove stopwords from a string of text:</p>
  
  <pre><code>from nltk.corpus import stopwords
  text = 'hello bye the the hi'
  text = ' '.join([word for word in text.split() if word not in (stopwords.words('english'))])
  </code></pre>
  
  <p>I am processing 6 mil of such strings so speed is important.  Profiling my code, the slowest part is the lines above, is there a better way to do this?  I'm thinking of using something like regex's <code>re.sub</code> but I don't know how to write the pattern for a set of words.  Can someone give me a hand and I'm also happy to hear other possibly faster methods.</p>
  
  <p>Note:  I tried someone's suggest of wrapping <code>stopwords.words('english')</code> with <code>set()</code> but that made no difference.</p>
  
  <p>Thank you.</p>