7 votes
Accepted

Instance of 'Analyzer' has no 'tokenizer' member

You don't have a "thing" named tokenizer. Review the hints section of the spec: Odds are you’ll find nltk.tokenize.casual.TweetTokenizer of interest, which can be used to tokenize a tweet (i.e., ...
user avatar
4 votes

Error in pset6 API Key not set

Make sure you're running flask in the same terminal window in which you exported the keys.
user avatar
2 votes
Accepted

Pset6 Tweets output score and color different to staff version

This line token.lower() does not change token to lower case, it returns a copy of token in lower case. You can either set something to that return value (as with word = token.lower()) and then test ...
user avatar
2 votes
Accepted

PSET6 2016 Analyzer.py - Says all is neutral

In analyze, shouldn't you use self.positives, and not open the files again? Now to the real problems: .lstrip(" ") does not remove the line break at the end of the line, you could use .strip() ...
user avatar
  • 20.7k
1 vote

Sentiments Analyzer always neutral

if words.lower is not actually doing anything. Be very careful when you call a method that you don't forget the (): if words.lower() will work.
user avatar
  • 18.4k
1 vote

PSET6/Sentiments/analyzer.py, tweets

This syntax if word.lower() in self.positives == True: is the problem. Use if word.lower() in self.positives (without the equality). I don't remember the exact evaluation/operator precedence rules ...
user avatar
1 vote
Accepted

Pset6 analyzer.py not incrementing counter

One problem is here self.positives.add(line.strip). line.strip returns the method whereas line.strip() returns the result of the method. (Ditto negatives). You could do a quick test in command-line ...
user avatar
1 vote
Accepted

pset6 sentiments PYTHON analyze

As per the spec [emphasis added]: ...among whose features is a tokenizer that you can use to split a tweet (which is maximally a 140-character str object) into a list of words (i.e., shorter str ...
user avatar
1 vote

PSET6 Loading Positive/Negative Words in Analyzer

Figured out myself... removed the == True comparison and it worked fine.
user avatar
1 vote

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

Maybe you skipped some points in Getting Started?
user avatar
  • 20.7k
1 vote
Accepted

Pset6 - Analyzer.py - Says Undeclared Function

Based on how you write that, I assume both load_words and __init__ to be methods. As you made load_words a method, you'd have to call it like self.load_words instead of just load_words.
user avatar
  • 20.7k
1 vote
Accepted

Analyze doesn't show colors

poss and negs are not instance variables, so they are not available to analyze. From the Hints section of the spec: If you would like a variable to be accessible from both __init__ and analyze, ...
user avatar
1 vote
Accepted

Why am I getting TypeError: expected string or buffer?

The problem is get_user_timeline because it returns a list of strings i.e you can't just pass it to the tokenize function. Instead you have to iterate over the strings and tokenize them seperatly.
user avatar
1 vote
Accepted

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

Do you mean to be checking if file starts with? or if the line starts with? You have if not file.startswith ... so you are not checking the individual line.
user avatar
  • 18.4k

Only top scored, non community-wiki answers of a minimum length are eligible