NLTK sentiment vader: polarity_scores(text) not working
<p>I am trying to use <code>polarity_scores()</code> from the Vader sentiment analysis in NLTK, but it gives me error: </p>

<blockquote>
  <p>polarity_scores() missing 1 required positional argument: 'text'</p>
</blockquote>

<p>I am totally a beginner in Python. Appreciate your help! </p>

<pre><code>from nltk.sentiment.vader import SentimentIntensityAnalyzer as sid
sentences=["hello","why is it not working?!"]
for sentence in sentences:
    ss = sid.polarity_scores(sentence) 
</code></pre>

<p><code>SentimentIntensityAnalyzer</code> is a class. You need to initialize an object of <code>SentimentIntensityAnalyzer</code> and call the <code>polarity_scores()</code> method on that.</p>

<pre><code>from nltk.sentiment.vader import SentimentIntensityAnalyzer as SIA
sentences=["hello","why is it not working?!"]
sid = SIA()
for sentence in sentences:
    ss = sid.polarity_scores(sentence) 
</code></pre>

<p>You may have to download the lexicon file if you haven't already</p>

<pre><code>&gt;&gt;&gt; import nltk
&gt;&gt;&gt; nltk.download()
---------------------------------------------------------------------------
d) Download   l) List    u) Update   c) Config   h) Help   q) Quit
---------------------------------------------------------------------------
Downloader&gt; d vader_lexicon
Downloader&gt; q
</code></pre>

python nltk sentiment-analysis