Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to declare TextBlob var
#1
I'm trying to get this to work inside a def, it works fine if I get rid of def main(): but when I do it this way no go.
I know I need to declare sAnalyze as something, but what? Any help? Thanks in advance!


from textblob import TextBlob
from textblob import Word
import csv

sAnalyze = tuple

def main(): 
    sAnalyze = TextBlob("You did a good job, thumbs up")
#sAnalyze.sentiment()
print("Polarity" + str(sAnalyze.polarity) + "SubJectivity" + str(sAnalyze.subjectivity))

main()
Reply
#2
lines 9 and 10 need indentation
Reply
#3
Thanks, apologies for the incorrect post! Indentation corrected the exception.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Issue In Loading Textblob in jupyter Shivi_Bhatia 1 6,856 Apr-01-2019, 06:50 PM
Last Post: perfringo
  How to count value after a textblob LoliMarth 1 2,306 Mar-22-2019, 02:20 AM
Last Post: micseydel
  How to declare a dynamic class 'header' Alfalfa 3 2,953 Sep-11-2018, 02:28 PM
Last Post: Alfalfa
  Textblob issue on 3.5 Sebt1890 2 2,842 Mar-01-2018, 09:39 AM
Last Post: buran
  Fastest Way to declare this list. Kowalski 2 2,832 Feb-21-2018, 06:26 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020