title: NameError: name 'stopwords' is not defined
body: <p>I'm getting the error <code>NameError: name 'stopwords' is not defined</code> for some reason, even though I have the package installed. I'm trying to do natural language processing on some feedback reviews. The <code>dataset</code> object is a table with two columns, <code>Reviews (a sentence of feedback)</code> and target variable <code>Liked (1 or 0)</code>.  Help appreciated, thanks!</p>
  
  <hr>
  
  <p>Block 1 </p>
  
  <pre><code>import re
  import nltk
  nltk.download('stopwords')
  </code></pre>
  
  <p>Output 1 </p>
  
  <pre><code>   &gt; [nltk_data] Downloading package stopwords to
  
     &gt; [nltk_data]     /Users/user/nltk_data...
  
     &gt; [nltk_data]   Package stopwords is already up-to-date!
  
     &gt; Out[14]: True
  </code></pre>
  
  <p>Block 2 </p>
  
  <pre><code>dataset['Review'][0]
  review = re.sub('[^a-zA-Z]',' ' ,dataset['Review'][0])
  review = review.lower()
  review = review.split()
  review = [word for word in review if not word in stopwords.words('english')] **ERROR ON THIS LINE**
  </code></pre>
  
  <p>Output 2 </p>
  
  <pre><code>&gt;NameError                                 Traceback (most recent call last)
  &lt;ipython-input-16-8d0ee1fd7c7f&gt; in &lt;module&gt;()
        3 review = review.lower()
        4 review = review.split()
  ----&gt; 5 review = [word for word in review if not word in stopwords.words('english')]
  
  &gt;&lt;ipython-input-16-8d0ee1fd7c7f&gt; in &lt;listcomp&gt;(.0)
        3 review = review.lower()
        4 review = review.split()
  ----&gt; 5 review = [word for word in review if not word in stopwords.words('english')]
  
  &gt;NameError: name 'stopwords' is not defined
  </code></pre>