Demea9000 commited on
Commit
12597ef
1 Parent(s): 1a627cc

removed unnecessary file in TextClassifier

Browse files
Files changed (1) hide show
  1. textclassifier/TextClassifier.py +1 -15
textclassifier/TextClassifier.py CHANGED
@@ -4,19 +4,16 @@ import regex as re
4
  from twitterscraper import TwitterScraper
5
  from datetime import date
6
  import os
7
-
8
 
9
  # Set one directory up into ROOT_PATH
10
  ROOT_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
11
 
12
- from dotenv import find_dotenv, load_dotenv
13
-
14
  dotenv_path = find_dotenv()
15
  load_dotenv(dotenv_path)
16
  OPENAI_AUTHTOKEN = os.environ.get("OPENAI_AUTHTOKEN")
17
 
18
 
19
-
20
  class TextClassifier:
21
  def __init__(self, model_name="text-davinci-002", from_date='2022-01-01', to_date=str(date.today()),
22
 
@@ -48,12 +45,6 @@ class TextClassifier:
48
  # self.api_key = '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'
49
  openai.api_key = OPENAI_AUTHTOKEN
50
 
51
- def scrape_tweets(self):
52
- """
53
- Scrapes tweets from the given date range.
54
- """
55
- self.ts.scrape_tweets()
56
-
57
  @staticmethod
58
  def cleanup_sentiment_results(classification_unclean):
59
  """
@@ -220,8 +211,6 @@ class TextClassifier:
220
  df_topic['topic'] = df_topic['tweet'].apply(self.classify_topic)
221
  return df_topic
222
 
223
-
224
-
225
  @staticmethod
226
  def cleanup_topic_results(prediction_dict, text):
227
  new_item = text.replace("\n", " ")
@@ -252,7 +241,6 @@ class TextClassifier:
252
  return row
253
  return None
254
 
255
-
256
  def __repr__(self):
257
  """
258
  Gives a string that describes which user is classified
@@ -260,7 +248,6 @@ class TextClassifier:
260
  """
261
  return "Classifier for user: " + self.user_name + " with model: " + self.model_name + "."
262
 
263
-
264
  # if __name__ == "__main__":
265
  # import pandas as pd
266
  # from datetime import datetime
@@ -276,4 +263,3 @@ class TextClassifier:
276
  # print(df)
277
  # # save to csv in a folder under politweet with timestamp in name
278
  # df.to_csv(f"{datetime.now().strftime('%Y-%m-%d %H-%M-%S')}_tweets.csv")
279
-
 
4
  from twitterscraper import TwitterScraper
5
  from datetime import date
6
  import os
7
+ from dotenv import find_dotenv, load_dotenv
8
 
9
  # Set one directory up into ROOT_PATH
10
  ROOT_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
11
 
 
 
12
  dotenv_path = find_dotenv()
13
  load_dotenv(dotenv_path)
14
  OPENAI_AUTHTOKEN = os.environ.get("OPENAI_AUTHTOKEN")
15
 
16
 
 
17
  class TextClassifier:
18
  def __init__(self, model_name="text-davinci-002", from_date='2022-01-01', to_date=str(date.today()),
19
 
 
45
  # self.api_key = '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'
46
  openai.api_key = OPENAI_AUTHTOKEN
47
 
 
 
 
 
 
 
48
  @staticmethod
49
  def cleanup_sentiment_results(classification_unclean):
50
  """
 
211
  df_topic['topic'] = df_topic['tweet'].apply(self.classify_topic)
212
  return df_topic
213
 
 
 
214
  @staticmethod
215
  def cleanup_topic_results(prediction_dict, text):
216
  new_item = text.replace("\n", " ")
 
241
  return row
242
  return None
243
 
 
244
  def __repr__(self):
245
  """
246
  Gives a string that describes which user is classified
 
248
  """
249
  return "Classifier for user: " + self.user_name + " with model: " + self.model_name + "."
250
 
 
251
  # if __name__ == "__main__":
252
  # import pandas as pd
253
  # from datetime import datetime
 
263
  # print(df)
264
  # # save to csv in a folder under politweet with timestamp in name
265
  # df.to_csv(f"{datetime.now().strftime('%Y-%m-%d %H-%M-%S')}_tweets.csv")