Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with python errors: UserName ScreenName Location TweetAt OriginalTweet Sentiment text _ review Tweet _ texts 0 1 4 4 9 5 3 NYC

Need help with python errors:
UserName ScreenName Location TweetAt OriginalTweet Sentiment text_review Tweet_texts
0144953 NYC 02-03-2020 TRENDING: New Yorkers encounter empty supermar... Extremely Negative NYC 02-03-2020 TRENDING: New Yorkers encounter... NYC 02-03-2020 TRENDING: New Yorkers encounter...
1244954 Seattle, WA 02-03-2020 When I couldn't find hand sanitizer at Fred Me... Positive Seattle, WA 02-03-2020 When I couldn't find ha... Seattle, WA 02-03-2020 When I couldn't find ha...
2344955 NaN 02-03-2020 Find out how you can protect yourself and love... Extremely Positive nan 02-03-2020 Find out how you can protect yo... nan 02-03-2020 Find out how you can protect yo...
3444956 Chicagoland 02-03-2020 #Panic buying hits #NewYork City as anxious sh... Negative Chicagoland 02-03-2020 #Panic buying hits #New... Chicagoland 02-03-2020 #Panic buying hits #New...
4544957 Melbourne, Victoria 03-03-2020 #toiletpaper #dunnypaper #coronavirus #coronav... Neutral Melbourne, Victoria 03-03-2020 #toiletpaper #d... Melbourne, Victoria 03-03-2020 #toiletpaper #d...
for token in df[:]:
print(token.text, token.lemma_, token.pos_, token.tag_, token.dep_,
token.shape_, token.is_alpha, token.is_stop)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[33], line 2
1 for token in df[:]:
---->2 print(token.text, token.lemma_, token.pos_, token.tag_, token.dep_,
3 token.shape_, token.is_alpha, token.is_stop)
AttributeError: 'str' object has no attribute 'text'
In [34]:
from spacy import displacy
nlp = spacy.load("en_core_web_sm")
doc = nlp(Tweet_texts)
displacy.render(df, style="dep", jupyter = True)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[34], line 4
1 from spacy import displacy
3 nlp = spacy.load("en_core_web_sm")
---->4 doc = nlp(Tweet_texts)
6 displacy.render(df, style="dep", jupyter = True)
NameError: name 'Tweet_texts' is not defined
In [19]:
doc = nlp(Tweet_texts)
for ent in doc.ents:
print(ent.text, ent.start_char, ent.end_char, ent.label_)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[19], line 1
---->1 doc = nlp(Tweet_texts)
3 for ent in doc.ents:
4 print(ent.text, ent.start_char, ent.end_char, ent.label_)
NameError: name 'Tweet_texts' is not defined
import spacy
nlp = spacy.load("en_core_web_sm")
# Process the texts
doc = nlp(Tweet_texts)
len([ent for ent in doc.ents if ent.label_=='MONEY'])
import spacy
nlp = spacy.load("en_core_web_sm")
# Process the texts
doc = nlp(Tweet_texts)
len([ent for ent in doc.ents if ent.label_=='QUANTITY'])
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[20], line 4
2 nlp = spacy.load("en_core_web_sm")
3 # Process the texts
---->4 doc = nlp(Tweet_texts)
5 len([ent for ent in doc.ents if ent.label_=='MONEY'])
7 import spacy
NameError: name 'Tweet_texts' is not defined

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 1 Lnai 6321

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

364215879X, 978-3642158797

More Books

Students also viewed these Databases questions