Spaces:
Runtime error
Runtime error
Fixed time before analyze sentiment
Browse files- .idea/misc.xml +1 -1
- .idea/politweet.iml +1 -1
- textclassifier/TextClassifier.py +8 -1
.idea/misc.xml
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<project version="4">
|
3 |
-
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.
|
4 |
</project>
|
|
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<project version="4">
|
3 |
+
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (politweet)" project-jdk-type="Python SDK" />
|
4 |
</project>
|
.idea/politweet.iml
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
<excludeFolder url="file://$MODULE_DIR$/politweet-environment" />
|
6 |
<excludeFolder url="file://$MODULE_DIR$/env" />
|
7 |
</content>
|
8 |
-
<orderEntry type="
|
9 |
<orderEntry type="sourceFolder" forTests="false" />
|
10 |
</component>
|
11 |
<component name="PyNamespacePackagesService">
|
|
|
5 |
<excludeFolder url="file://$MODULE_DIR$/politweet-environment" />
|
6 |
<excludeFolder url="file://$MODULE_DIR$/env" />
|
7 |
</content>
|
8 |
+
<orderEntry type="inheritedJdk" />
|
9 |
<orderEntry type="sourceFolder" forTests="false" />
|
10 |
</component>
|
11 |
<component name="PyNamespacePackagesService">
|
textclassifier/TextClassifier.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import openai
|
2 |
import csv
|
3 |
import regex as re
|
@@ -289,6 +291,9 @@ class TextClassifier:
|
|
289 |
self.df = self.classify_topics_of_tweets()
|
290 |
print("Classifying sentiment of {} tweets...".format(self.df.shape[0]))
|
291 |
self.df = self.classify_sentiment_of_tweets()
|
|
|
|
|
|
|
292 |
print("Writing to csv...")
|
293 |
self.df_to_csv(filename)
|
294 |
# Concatenate temp_df and self.df
|
@@ -301,7 +306,9 @@ class TextClassifier:
|
|
301 |
self.df = self.classify_topics_of_tweets()
|
302 |
print("Classifying sentiments...")
|
303 |
self.df = self.classify_sentiment_of_tweets()
|
304 |
-
|
|
|
|
|
305 |
print("Writing to csv file...")
|
306 |
self.df_to_csv(filename)
|
307 |
print("Created {}.".format(filename))
|
|
|
1 |
+
import time
|
2 |
+
|
3 |
import openai
|
4 |
import csv
|
5 |
import regex as re
|
|
|
291 |
self.df = self.classify_topics_of_tweets()
|
292 |
print("Classifying sentiment of {} tweets...".format(self.df.shape[0]))
|
293 |
self.df = self.classify_sentiment_of_tweets()
|
294 |
+
print("Waiting for 1 minute... before analyzing targets...")
|
295 |
+
time.sleep(65)
|
296 |
+
self.df = self.analyze_sentiment_of_tweets()
|
297 |
print("Writing to csv...")
|
298 |
self.df_to_csv(filename)
|
299 |
# Concatenate temp_df and self.df
|
|
|
306 |
self.df = self.classify_topics_of_tweets()
|
307 |
print("Classifying sentiments...")
|
308 |
self.df = self.classify_sentiment_of_tweets()
|
309 |
+
print("Waiting for 1 minute... before analyzing targets...")
|
310 |
+
time.sleep(65)
|
311 |
+
self.df = self.analyze_sentiment_of_tweets()
|
312 |
print("Writing to csv file...")
|
313 |
self.df_to_csv(filename)
|
314 |
print("Created {}.".format(filename))
|