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., split it up into a list
of words) with code like:
tokenizer = nltk.tokenize.TweetTokenizer()
tokens = tokenizer.tokenize(tweet)
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 for word in the arrays, or change the test(s) from if token in self.positives: to if token.lower() in self.positives:
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() instead to remove all kinds of whitespace at both ends.
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 that apply.
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 python to see the difference.
Python 3.4.3 (default, Jul 28 2015, 18:20:59)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more ...
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 objects).
Program is trying to find a list of words in a list of words here if tokens in self.positives:. You want to test each word in tokens individually; you'...
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, be sure to define it as an "instance variable" inside of [__init__]. For instance, if you were to define
self.n = 42
inside of __init__, then self.n ...