NLTK sentiment vader: ordering results
<p>I've just run the Vader sentiment analysis on my dataset: </p>

<pre><code>from nltk.sentiment.vader import SentimentIntensityAnalyzer
from nltk import tokenize
sid = SentimentIntensityAnalyzer()
for sentence in filtered_lines2:
    print(sentence)
    ss = sid.polarity_scores(sentence)
    for k in sorted(ss):
        print('{0}: {1}, '.format(k, ss[k]), )
        print()
</code></pre>

<p>Here a sample of my results:</p>

<pre><code>Are these guests on Samsung and Google event mostly Chinese Wow Theyre
boring 

Google Samsung 

('compound: 0.3612, ',)

()

('neg: 0.12, ',)

()


('neu: 0.681, ',)


()


('pos: 0.199, ',)


()

 Adobe lose 135bn to piracy Report 


('compound: -0.4019, ',)


()


('neg: 0.31, ',)


()


('neu: 0.69, ',)


()


('pos: 0.0, ',)


()

Samsung Galaxy Nexus announced

('compound: 0.0, ',)

()

('neg: 0.0, ',)

()

('neu: 1.0, ',)

()

('pos: 0.0, ',)

()
</code></pre>

<p>I want to know how many times "compound" is equal, greater or less than zero.</p>

<p>I know that probably it is very easy but I'm really new to Python and coding in general.
I've tried in a lot of different ways to create what I need but I can't find any solution. </p>

<p>(please edit my question if the "sample of results" is incorrect, because i don't know the right way to write it)</p>

<p>You can use a simple counter for each of the classes:</p>

<pre><code>positive, negative, neutral = 0, 0, 0
</code></pre>

<p>Then, inside the sentence loop, test the compound value and increase the corresponding counter:</p>

<pre><code>    ...
    if ss['compound'] &gt; 0:
        positive += 1
    elif ss['compound'] == 0:
        neutral += 1
    elif ...
</code></pre>

<p>etc.</p>

python python-3.x nltk