You are on page 1of 2

IMPLEMENTATION

Code :
from textblob import TextBlob

def get_comment_sentiment(comment):
analysis = TextBlob(comment)

if analysis.sentiment.polarity > 0:
print("positive")
elif analysis.sentiment.polarity == 0:
print("neutral")
else :
print("negative")

comment_list = []
sentiment_list = []
for comment in comments:
sentiment = get_comment_sentiment(comment)
comment_list.append(comment)
sentiment_list.append(sentiment)
print(f"{comment}:{sentiment}")

import pandas as pd
sentiment_df = pd.DataFrame({"comment":comment_list,"sentiment":sentiment_list})
print(sentiment_df)

sentiment_df.to_csv("filename.csv")

Output :

Works, thanks:positive
I dont have any friends or a computer if my iPhone freezes i am done for:neutral
I really appreciate this it was very helpful. It's works on my 14 pro max. It was not turning on and I
follow the process and now it's open,:positive
Hi I know to how to fix the iPhone:neutral
you're telling me that to this day, even the iPhone being a device of it's own, one still has to plug it to a
computer and iTunes like a frozen iPod?:positive
my phone was stuck like this for 5 days. Nothing worked and I wasn't paying thousands of dollars to
fix it; what i did was turn off the internet for all of the electronics in my house that could slow down
the internet. Then I tried to force restart a few times with no change, then I hooked it up to iTunes and
tried to do the update a few times with no success and then it just worked after about 3-4 times. Not
sure what worked but I kept trying it back to back and it just worked! Definitely worth a try!!! Or go
somewhere with great internet speed and try it there. Hope it helps you all!:positive
If you try to force restart and it does not work and you have tried to factory restart it and it does not
work. what should you do then?:neutral
Apple please start a product by making the same as the customer wants I mean start a Coustom Online
Apple product store
example like i want A14 bionic chip in iphone 14 pro max:negative
my home button is BROKEN
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA:negative
Not sure why Apple thinks when we're trying to restore our devices and it fails and need to use
recovery mode that we want the latest version when we DO NOT. Man like right now with iOS16. I
bloody hate it and want my iOS 15 back:negative
We tried all these solutions - no result. Thought we would have to buy new iPad. Then we we found
an iPhone fault - cleared history, cookies and cache and switched phone off to try to resolve. At that
point the IPad sprang back into life! Both faults occurred after latest software update.:positive
ty that helped alot good job:positive
apple sucks:negative
How to factory reset having completely forgotten the password?:positive
Can y’all Fr stop complaining:neutral
How am i going to update the damn thing if it has no storage left:neutral
iPad with Touch ID and Home Button (7th generation):neutral
It looks like it worked for alot of people but for me it said that my phone also needs to be restored, i
clicked the button 'restore and update' but it says that there is an error with restoring my phone:neutral
I don't know why I like apple support phone manuals lol, pretty helpful:positive
thanks
it works:positive

comment sentiment
0 The notification problem shouldn't exist neutral
1 Should I upgrade from 12 Pro max to op11? neutral
2 Oneplus started well but now is neither most v... positive
3 Guys I'm from South Africa I need this phone b... negative
4 Does anyone actually use wireless charging, ev... neutral
5 Believe it or not I was about to buy the phone... positive
6 В США не блокируют звонки и сотовую связь на O... neutral
7 I currently have 2 oneplus phones. Started wit... positive
8 I use Oneplus for a while now Oneplus 8 pro it... positive
9 The phone in general is crazy faster than the ... negative
10 I just got the OnePlus 11 and the charging is ... negative
11 I am currently using OnePlus 9 Pro with the ne... positive
12 Nice phone. Nice specs. Nice price. Way too bi... positive
13 Does it still slippery like the 10 Pro? I real... positive
14 i mean i kinda get the convenience of wireless... positive
15 If it had a 12mp 3x optical zoom upto 30x Tele... positive
16 Lavadagopal you neutral
17 I really like the notification swipe thing act... positive
18 My Chinese version stopped taking and making c... neutral
19 Honestly, this guy is so biased. Why do you ev... positive

You might also like