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
1 answer
42 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. ...
user avatar
0 votes
2 answers
36 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 ...
user avatar
  • 115
0 votes
1 answer
45 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 ...
user avatar
  • 3
0 votes
1 answer
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 ...
user avatar
  • 302
0 votes
1 answer
66 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 ...
user avatar
  • 184
0 votes
1 answer
208 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 ...
user avatar
1 vote
1 answer
864 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 ...
user avatar
0 votes
1 answer
185 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 ...
user avatar
0 votes
1 answer
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(';')): ...
user avatar
  • 231
0 votes
1 answer
75 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
user avatar
0 votes
1 answer
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 ...
user avatar
  • 121
0 votes
1 answer
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 ...
user avatar
1 vote
1 answer
244 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 ...
user avatar
0 votes
1 answer
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....
user avatar
  • 63
0 votes
2 answers
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....
user avatar
  • 63
0 votes
1 answer
442 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 ...
user avatar
0 votes
1 answer
604 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 ...
user avatar
  • 15
0 votes
1 answer
398 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 ...
user avatar
2 votes
1 answer
7k 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 ...
user avatar
  • 117
0 votes
1 answer
599 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(...
user avatar
  • 117
3 votes
1 answer
954 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.
user avatar
  • 117