Questions tagged [sentiments]

The tag has no usage guidance.

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

sentiments.zip Not Found

I'm working on pset6 version of the year 2016. I can't download source file "sentiments.zip". I receive error message "ERROR 404: Not Found." when I try to execute "wget https://github.com/cs50/...
0
votes
1answer
43 views

Tokenizer adds space before text

When I tokenize my text, it is adding a space before it, and I am unable to strip it. tokenizer = nltk.tokenize.TweetTokenizer() tokens = tokenizer.tokenize(text) x = 0 for i in tokens: token = ...
0
votes
1answer
30 views

Tokenizer changing text

When I try to tokenise some text to check its sentiment, the tokeniser automatically adds [''] around it. So if my text says good, when I tokenize it and print it, it says ['good']. Please can you ...
0
votes
1answer
69 views

Pset 6 sentiments init function

I'm working on the init function is sentiments and I'm struggling a bit on what to put in the for loop. This is what I have so far, can someone tell me if this is correct or how to fix it? def ...
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
1answer
37 views

Sentiments "tweets" elif statement error

Trying to run this, but getting an error at the very bottom "elif" statement while trying to set the colour saying it is invalid syntax. I don't know why. Also, am I doing this problem correctly? I ...
0
votes
2answers
35 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
33 views

Using open.readlines, why won't it return the list?

My understanding of this part of sentiments is that I need to open the positive words file and make it all into a list, I thought I could do this with open.readlines, but it isn't working. Can someone ...
0
votes
1answer
29 views

pset6 sentiments init help

I just started working on the sentiments, at the moment I'm loading the positive words into a list and printing them out at a test. I'm having trouble with the for loops for getting each word into the ...
0
votes
1answer
40 views

Starting pset6, sentiments

I'm really not completely understanding how to get started on sentiments. I think I need to load the positive and negative words into the memory of analyze, but I don't really understand how I go ...
1
vote
1answer
148 views

Confused by NLTK

I'm a little unsure of what's going on with the syntax when using the NLTK to tokenize strings. In the tips for the pset this code is shown initially: nltk.tokenize.casual.TweetTokenizer Then they ...
0
votes
0answers
77 views

Pset6 2017 Sentiments WebServer running problem

I have a problem running Pset6. I'm following instructions. I have set access rights, run flask and then click "CS50 IDE" -> "Web Server" in the left top corner and have an exception "Error opening ...
0
votes
2answers
60 views

Some basics of python

what is the meaning of "" double quotation mark in python like in helpers.py of sentiments link to sentiments I have one more doubt that is how to deal with the array of integers in python Answer ...
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
117 views

A simple question in application.py sentiments

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()) ...
0
votes
1answer
77 views

Smile/Analyzer always return 0

I've been on this for a while and can't figure out the mistakes. Please correct me if i am mistaken. On running the code, the returned value is always 0. (2) When I use the 'startwith' function i'm ...
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
183 views

When I run ./tweets @user_name, I get API_KEY not set and when do flask run ,I get this e What could be wrong?

builtins.SyntaxError File "/home/ubuntu/workspace/pset6/sentiments/application.py", line 26 return redirect (url_for("index")) ^ SyntaxError: 'return' outside function
0
votes
0answers
27 views

Pset6 Tweets - Installed pip3 install --user -r requirements.txt and it ruined my code :( [duplicate]

Trying to built tweets on pset6 and am encountering some errors, is it due to bad installation? What caused that error message? Should i have not used the import functions and i Here is my code: #!...
1
vote
1answer
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 ...
0
votes
1answer
1k views

CS50 2017 Pset6 Sentiments tweets

I need some help with tweets. Or just help me get what inspiration to get from smile for it, as per the specs. Here's my code: #!/usr/bin/env python3 import os import sys import nltk from ...
0
votes
1answer
509 views

Pset6 2017 application.py Sentiments

I can't tell how to get the correct scores for positive, negative and neutral under the "TODO" in application.py, here: # TODO positive, negative, neutral = 0.0, 0.0, 100.0 That isn't all we have ...
0
votes
1answer
4k views

sentiments - tokenize() missing 1 required positional argument: 'text'

I'm trying to test what I've written in analyze by running smile with a word and I'm getting this error msg and I don't understand it! It seems to indicate I need to provide the argument 'text' to ...
0
votes
1answer
214 views

Tweets.py - Need help with code that retrieves tweets

I need to know if I am using the following code correctly. tweets = helpers.get_user_timeline(sys.argv[1], 50) Immediately after this line of code, I check to make sure I found tweets with: if ...
0
votes
1answer
602 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
0answers
34 views

Cannot import helpers in sentiments, pset6 [duplicate]

Question is identified as possible duplicate of IndexError in initial state of pset6 Sentiments, however, that question refers to an issue that's seen after running flask on unmodified distribution ...
2
votes
1answer
402 views

IndexError in initial state of pset6 Sentiments

I am working on Pset 6, Sentiments and followed the steps to create my app on twitter. I added keys, installed requirements.txt and did everything in order, but when I type "flask run" and visit the ...
2
votes
1answer
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 ...
0
votes
1answer
506 views

tweets error in PSET6

Hi I am working on pset6 sentiments. I am not quite sure where goes wrong in my codes because all I get is the error message on the stage of getting tweets. appreciate if someone could give me an idea ...