Spaces:
Runtime error
Runtime error
smaller changes
Browse files
textclassifier/TextClassifier.py
CHANGED
@@ -42,18 +42,13 @@ class TextClassifier:
|
|
42 |
self.num_tweets = num_tweets
|
43 |
self.user_name = user_name
|
44 |
self.ts = TwitterScraper.TwitterScraper(from_date, to_date, num_tweets)
|
|
|
45 |
self.df = self.ts.scrape_by_user(user_name)
|
46 |
# Make id as type int64
|
47 |
self.df['id'] = self.df['id'].copy().astype(int)
|
48 |
# self.api_key = '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'
|
49 |
openai.api_key = OPENAI_AUTHTOKEN
|
50 |
|
51 |
-
def classify_topic_and_sentiment(self):
|
52 |
-
self.classify_topic_of_tweets()
|
53 |
-
self.classify_sentiment_of_tweets()
|
54 |
-
|
55 |
-
# save the dataframe to a csv file
|
56 |
-
|
57 |
@staticmethod
|
58 |
def cleanup_sentiment_results(classification_unclean):
|
59 |
"""
|
@@ -307,7 +302,6 @@ class TextClassifier:
|
|
307 |
print("Created {}.".format(filename))
|
308 |
return None
|
309 |
|
310 |
-
|
311 |
def __repr__(self):
|
312 |
"""
|
313 |
Gives a string that describes which user is classified
|
|
|
42 |
self.num_tweets = num_tweets
|
43 |
self.user_name = user_name
|
44 |
self.ts = TwitterScraper.TwitterScraper(from_date, to_date, num_tweets)
|
45 |
+
|
46 |
self.df = self.ts.scrape_by_user(user_name)
|
47 |
# Make id as type int64
|
48 |
self.df['id'] = self.df['id'].copy().astype(int)
|
49 |
# self.api_key = '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'
|
50 |
openai.api_key = OPENAI_AUTHTOKEN
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
@staticmethod
|
53 |
def cleanup_sentiment_results(classification_unclean):
|
54 |
"""
|
|
|
302 |
print("Created {}.".format(filename))
|
303 |
return None
|
304 |
|
|
|
305 |
def __repr__(self):
|
306 |
"""
|
307 |
Gives a string that describes which user is classified
|