15,919,028 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 13647869 (Top 50 by date)
Member 13647869
21-Jun-18 6:17am
View
hahah, i really hope so!
Member 13647869
21-Jun-18 6:08am
View
wow! that's how you become experts?! congrats Maciej Los =)
Member 13647869
21-Jun-18 5:31am
View
the words datime.datime, why are they added? like is this the format of a date?
Member 13647869
21-Jun-18 3:57am
View
ok i got it. it chnages but i get this,
[datetime.datetime(2009, 8, 31, 23, 58, 9), 1]
[datetime.datetime(2009, 8, 31, 23, 58, 9), 1]
[datetime.datetime(2009, 8, 31, 23, 58, 9), 1]
is there any way to remove the datetime? or is that like a standard outcome?
Member 13647869
21-Jun-18 3:55am
View
it is the exact format
Member 13647869
21-Jun-18 3:46am
View
i have put that space, or do i have to remove that?
Member 13647869
21-Jun-18 3:43am
View
i changed it to this:
word[0]=datetime.strptime(word[0],'%Y-%m-%d %H:%M:%S')
and got this:
ValueError: unconverted data remains:
Member 13647869
21-Jun-18 2:32am
View
sorry, it seems that I have put a wrong sample of the text file I changed it
Member 13647869
21-Jun-18 2:30am
View
i tried it i got this error:
ValueError: time data '2009-04-02 22:50:06 ' does not match format '%y-%m-%d %H:%M:%S'
plus, i need to index the element of each list, because each list has a different date string in the first element
Member 13647869
19-Jun-18 4:30am
View
ok i got this <class 'str'>. Any idea how I can change the sentiment value to an integer and the date to timestamp?
Member 13647869
19-Jun-18 1:03am
View
The first two columns that I am plotting are numerical. Do you guys mean that I have to change the date from 2009-06-11 to another format? The second column is 1 and 0 so its already in a numerical form
Member 13647869
10-Jun-18 1:42am
View
sorry but i only took one line from StackOverflow, so that does not mean i reply to the StackOverflow message
Member 13647869
27-May-18 5:32am
View
I am sorry, I am very confused about this topic
Member 13647869
27-May-18 5:31am
View
but how can combine the lines? do I use .join?
Member 13647869
24-May-18 4:13am
View
Let me try to explain further. Originaly the file looks like this:
T 2009-06-25 21:15:29
U http://twitter.com/mujiang
W No Post Title
T 2009-06-26 16:20:35
U http://twitter.com/mujiang
W No Post Title
T 2009-06-26 21:04:20
U http://twitter.com/mujiang
W No Post Title
T 2009-06-27 17:50:59
U http://twitter.com/mujiang
W No Post Title
T 2009-06-27 17:56:09
U http://twitter.com/mujiang
W No Post Title
T 2009-06-28 00:00:10
U http://twitter.com/mujiang
W No Post Title
And so on. But because I need to do some sentiment analysis on this file, and every three lines are linked, I need to group them. so every three lines become one line
Member 13647869
15-Feb-18 6:47am
View
As far as I understand the relationship between the location and keyword is an OR relationship. the solution is to go to the module that allows you to stream and change the relationship to AND.Just letting this out there
Member 13647869
11-Feb-18 2:16am
View
I tried that, but it gives me the tweets from the location. I need the tweets with the keyword 'Cat' from the users in the location
Member 13647869
8-Feb-18 2:57am
View
I knew that there are answers on google. ok
Member 13647869
8-Feb-18 1:10am
View
I know that. I have been googling for the past two days, but every time i get a method it doesn't work, its ok though thanks
Member 13647869
1-Feb-18 8:06am
View
Not to be rude, but if you have been doing such a project you would understand what I am talking about
Member 13647869
1-Feb-18 0:31am
View
with all my due respect, as far as I know, this website works this way: I have an issue I post my question, whoever WANTS to, helps...you don't have to do anything if you don't want to
Member 13647869
31-Jan-18 5:55am
View
search it trust me its interesting
Member 13647869
31-Jan-18 5:45am
View
they don't, but i used that format so i can somewhat see the tweets and if they are correct
Member 13647869
31-Jan-18 5:08am
View
I am receiving tweets from Twitter using their API
Member 13647869
31-Jan-18 5:00am
View
what is returned in json.loads is the live twitter stream of a keyword that I am searching for, i can see the outcome as tweets, and some of which are being repeated and i do not want that to happen
Member 13647869
31-Jan-18 4:44am
View
This part:
def on_data(self, data):
all_data = json.loads(data)
tweet = all_data["text"]
sentiment_value, confidence = s.sentiment(tweet)
tweets= open("tweets.txt","a",encoding="utf-8")
tweets.write(tweet)
tweets.write('\n\n\n')
tweets.close()
is getting the tweets, saving them in a txt file and printing them, so the loop should be before that?
Member 13647869
31-Jan-18 0:27am
View
It has happened before with the same exact error. when I restarted my computer the next day, I tried to download the nltk package and it worked... so
Member 13647869
29-Jan-18 4:13am
View
Yh the thing is I don't understand what it's telling me. there are not iterations in the code as far as I can tell. Could you please explain whats going on?
Member 13647869
28-Jan-18 8:20am
View
ok....
Member 13647869
28-Jan-18 8:19am
View
I think my encoding was not correct, or my python version was causing this
Member 13647869
28-Jan-18 8:16am
View
Thank you for your feedback MacCutchan, but it turns out that i had another problem that was causing this problem!
Member 13647869
28-Jan-18 7:39am
View
Thank you, Peter, for your help!!!!!!
Member 13647869
28-Jan-18 7:39am
View
THANK YOU VERY MUCH. I AM VERY GRATEFUL!
Member 13647869
28-Jan-18 7:32am
View
I was not sure if the code was correct, let me try and see
Member 13647869
28-Jan-18 7:07am
View
https://www.dropbox.com/sh/qrrzdnt6aayphlh/AADQVUpymD75qReuaIGL7MUGa?dl=0
Member 13647869
28-Jan-18 7:06am
View
Perfect! While I share the negative.txt file, could you please advice me how to change my code to accommodate the encoding of utf-8? I am using python 3.6.4
Member 13647869
28-Jan-18 6:36am
View
Data:
https://www.dropbox.com/sh/qrrzdnt6aayphlh/AADQVUpymD75qReuaIGL7MUGa?dl=0
Code:
https://www.dropbox.com/sh/4qmj43g3ub2of9g/AAB-gLeE2EkpckG8-qbXqpVoa?dl=0
Member 13647869
28-Jan-18 6:26am
View
ok, just give me a few minutes! i will create one for the full code, and one for the data
Member 13647869
28-Jan-18 6:23am
View
EXACTLY! That file, should I create it? or because its pickled the code would do that?
Member 13647869
28-Jan-18 6:19am
View
What if i post the file, as in part of it?
Member 13647869
28-Jan-18 6:17am
View
That was my original assumption, which is why in the code its reading the file, r (short_pos = open("positive.txt","r").read()), but then the ascii gave me that error.
I am very confused. As every person I ask gives me a different answer.
Member 13647869
28-Jan-18 6:13am
View
ok, so my problem is, that line is not doing what its supposed to be doing
Member 13647869
28-Jan-18 6:09am
View
the files were given to me, as in I do not know what encoding that is used. I changed the positive just to see if the difference, as in compare my assumption with the original one. I wanted to see what would happen if I encode positve.txt with utf-8 would it work? so I left negative.txt the same
Member 13647869
28-Jan-18 6:05am
View
Ok hold on, let me check if we are on the same page. This file, 'pickled_algos/documents.pickle', should be created by me? As in I go to my documents, create a new file, and name it save_documents? Or does the code create it? From the examples I have seen, the code creates it. Sorry for all the questions and confusion, as i said this is all very new to me
Member 13647869
28-Jan-18 6:02am
View
It's not just text, as I said it contains text AND numbers. What i am trying to do is use this file to create classifiers for a sentiment analysis
Member 13647869
28-Jan-18 5:59am
View
Ok, please bare with me, I am new to all of this =z so as you said I have to use the encode parameter, but the thing is I thought I should encode it using utf-8, but it didn't work:
i wrote this:
short_pos = open("positive.txt", "r",encoding='utf-8').read()
short_neg = open("negative.txt","r",encoding='utf-8').read()
and got this error:
short_neg = open("negative.txt","r",encoding='utf-8').read()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x97 in position 3118: invalid start byte
Member 13647869
28-Jan-18 5:42am
View
That's the problem, the file isn't opening
Member 13647869
28-Jan-18 5:38am
View
The file contains text and numbers, so if I read it as binary data, it wouldn't work, would it? As in, i cant use the split lines function and so on
Member 13647869
28-Jan-18 5:21am
View
I am not quite sure what your question means. Could you please explain?
Member 13647869
28-Jan-18 4:13am
View
so if I create the file save-documents in my documents folder, that should do it?
Show More