0

Why neutral starts from 100.0, why not 0 like positive and negative

positive, negative, neutral = 0.0, 0.0, 100.0

and is this right?

for tweet in tweets:
    score = analyzer.analyze(tweet.lower())
    if score > 0.0:
        positive += 1
    elif score < 0.0:
        negative += 1
    else:
        neutral += 1

Thanks for any help.

1

That default value for neutral is merely a placeholder at the start. When you run application.py without implementing it, you see a graph that is 100% neutral. You should initialize those values differently once you begin filling in the appropriate code there.

As for your for loop, the logic is there for the variables, but there is one way of handling case differently. In order to use .lower() only once, I might suggest using it in analyzer.py since you will want everything to be in lowercase for comparing against self.positives and self.negatives whether you are running smile, tweets, or application.py.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .