Demea9000 commited on
Commit
da62f8f
1 Parent(s): 53e2d8d

changed __repr__

Browse files
.idea/politweet.iml CHANGED
@@ -3,7 +3,6 @@
3
  <component name="NewModuleRootManager">
4
  <content url="file://$MODULE_DIR$">
5
  <excludeFolder url="file://$MODULE_DIR$/politweet-environment" />
6
- <excludeFolder url="file://$MODULE_DIR$/venv" />
7
  </content>
8
  <orderEntry type="inheritedJdk" />
9
  <orderEntry type="sourceFolder" forTests="false" />
 
3
  <component name="NewModuleRootManager">
4
  <content url="file://$MODULE_DIR$">
5
  <excludeFolder url="file://$MODULE_DIR$/politweet-environment" />
 
6
  </content>
7
  <orderEntry type="inheritedJdk" />
8
  <orderEntry type="sourceFolder" forTests="false" />
textclassifier/TextClassifier.py CHANGED
@@ -184,14 +184,14 @@ class TextClassifier:
184
  "\nTransportation,\nWorld.\nTOPIC="
185
 
186
  response = openai.Completion.create(
187
- model=self.model_name,
188
- prompt=prompt_string,
189
- temperature=0,
190
- max_tokens=892,
191
- top_p=1,
192
- frequency_penalty=0,
193
- presence_penalty=0,
194
- )
195
  classification_unclean = response.choices[0]['text']
196
  classification_clean = self.cleanup_topic_results(classification_unclean)
197
 
@@ -207,14 +207,16 @@ class TextClassifier:
207
 
208
  @staticmethod
209
  def cleanup_topic_results(text):
210
- new_item = text.replace("\n", " ")
211
- new_item = new_item.replace(" ", " ")
212
- return new_item
213
 
214
  def __repr__(self):
215
- return "TwitterScraper(from_date={}, to_date={}, num_tweets={})".format(self.from_date, self.to_date,
216
- self.num_tweets)
217
-
 
 
218
 
219
 
220
  # if __name__ == "__main__":
@@ -232,4 +234,3 @@ class TextClassifier:
232
  # print(df)
233
  # # save to csv in a folder under politweet with timestamp in name
234
  # df.to_csv(f"{datetime.now().strftime('%Y-%m-%d %H-%M-%S')}_tweets.csv")
235
-
 
184
  "\nTransportation,\nWorld.\nTOPIC="
185
 
186
  response = openai.Completion.create(
187
+ model=self.model_name,
188
+ prompt=prompt_string,
189
+ temperature=0,
190
+ max_tokens=892,
191
+ top_p=1,
192
+ frequency_penalty=0,
193
+ presence_penalty=0,
194
+ )
195
  classification_unclean = response.choices[0]['text']
196
  classification_clean = self.cleanup_topic_results(classification_unclean)
197
 
 
207
 
208
  @staticmethod
209
  def cleanup_topic_results(text):
210
+ new_item = text.replace("\n", " ")
211
+ new_item = new_item.replace(" ", " ")
212
+ return new_item
213
 
214
  def __repr__(self):
215
+ """
216
+ Gives a string that describes which user is classified
217
+ :return:
218
+ """
219
+ return "Classifier for user: " + self.user_name + " with model: " + self.model_name + "."
220
 
221
 
222
  # if __name__ == "__main__":
 
234
  # print(df)
235
  # # save to csv in a folder under politweet with timestamp in name
236
  # df.to_csv(f"{datetime.now().strftime('%Y-%m-%d %H-%M-%S')}_tweets.csv")