Questions tagged [analyzer]

Questions related to the pset6 exercise: Sentiments. In particular, issues with implementing analyzer.py

Filter by
Sorted by
Tagged with
0
votes
1answer
41 views

Pset6 analyzer getting positive words from text and turning them into a string

I'm trying to get the analyzer function to work and I'm really just not fully understanding what to do and how to do it. I think I need to take each line of the text files and have put into a string. ...
0
votes
2answers
34 views

Sentiments Analyzer always neutral

Everything runs properly (no syntax errors) but when running ./smile it always displays a yellow nuetral face. And I am a bit confused about the strip() function. What is the point of removing ...
0
votes
1answer
38 views

analyzer.py cant store string in my dictionary

For some reason when i run the following python code I get the following error: Traceback (most recent call last): File "/home/ubuntu/workspace/pset6/sentiments/analyzer.py", line 20, in init ...
0
votes
1answer
104 views

PSET6/Sentiments/analyzer.py, tweets

I have been trying hard to get my mistakes for this PSET but can't find what errors have I made in implementing analyzer.py and tweets.On running ./smile word be it love, hate, Stanford I get :| in ...
0
votes
1answer
59 views

Pset6 analyzer.py not incrementing counter

I've checked over my code many times for errors, but everything looks logically sound to me. For some reason, "counter" in the analyze method will never change, which means that my conditional ...
0
votes
1answer
207 views

pset6 sentiments PYTHON analyze

Hello stack overflow I am really having trouble with sentiments as I feel like I put the write functions down but it is not working. A question that I have is can someone help me understand how the ...
1
vote
1answer
734 views

Error in pset6 API Key not set

I'm getting this error, I have been working to make it work but i can't. I followed the instructions on setting up the API_KEY value: Traceback (most recent call last): File "tweets", line 25, in ...
0
votes
1answer
179 views

PSET6 Loading Positive/Negative Words in Analyzer

I'm trying to get ./smile to work before moving on to tweets using just one word as input to check it my words are loading correctly. I structured the first function similar to how it is done in ...
0
votes
1answer
2k views

if !(line.startswith(';')):

Is there a way to use the ! symbol or another symbol with the line below? Though the following syntax is wrong, I have it here to illustrate what I am aiming for if !(line.startswith(';')): ...
0
votes
1answer
74 views

pset6-analyzer: Please, can someone help me out. Analyzer gives me this error!

Traceback (most recent call last): File "./smile", line 6, in from analyzer import Analyzer File "/home/ubuntu/workspace/sentiments/analyzer.py", line 1, in import nltk
0
votes
1answer
181 views

pset6: why is my version of the analyzer not working?

For analyzer.py, I think my code works for defining the first part: instantiation of the analyzer, but not for defining the second: analyze. Please see the failing part of my code below. Also, I have ...
0
votes
1answer
55 views

Pset6 - Analyzer.py - Says Undeclared Function

I declared a function called load_words above init() to load in the words. However, when I call my function in init(), it gives the error name 'load_words' is undefined at the lines where I call ...
1
vote
1answer
243 views

PSET6 2016 Analyzer.py - Says all is neutral

When I tested tweets after implementing Analyzer.py, I found that it said that every single tweet was neutral (The twitter account I used was @realDonaldTrump). I believe it has something to do with ...
0
votes
1answer
45 views

Analyze doesn't show colors

It always shows yellow :| import nltk class Analyzer(): """Implements sentiment analysis.""" def __init__(self, positives, negatives): """Initialize Analyzer.""" self....
0
votes
2answers
220 views

analyzer.py always returns :|

My code: import nltk negs = [] poss = [] class Analyzer(): """Implements sentiment analysis.""" def __init__(self, positives, negatives): """Initialize Analyzer.""" self....
0
votes
1answer
438 views

Pset6 Tweets output score and color different to staff version

My Tweets function can output score and tweet from Tweeter user. However, the output is a bit different to the staff version's output. I find that some words with first character capitalized are not ...
0
votes
1answer
601 views

Lost trying to figure out sentiments PSET 6 2017

I need some help with pset6 I'm basically lost trying to figure out what I should be doing. I have my analyzer code which doesn't return any errors when I run it but at the same time returns no output ...
0
votes
1answer
393 views

How to check if certain token is in the file in analyzer.py

I have implementing (in my understanding) analyzer.py. I am confused after dividing a tweet into tokens how to check them if they are available in "negative" or "positive", my question is "Is there a ...
2
votes
1answer
5k views

Why am I getting TypeError: expected string or buffer?

This is my tweets file #!/usr/bin/env python3 import os import sys from analyzer import Analyzer from termcolor import colored from helpers import get_user_timeline def ...
0
votes
1answer
547 views

Why am I getting SyntaxError: invalid syntax when I'm running ./smile?

with open("positive-words.txt") as text_file: file = text_file.read() for line in file: if not file.startswith(';') and not file.startswith(' '): self.positives.add(...
3
votes
1answer
943 views

Instance of 'Analyzer' has no 'tokenizer' member

tokens = self.tokenizer.tokenize(text) I have the same code as in the walkthrough, yet I'm getting the error in the title.