Demea9000 commited on
Commit
ca6da9d
1 Parent(s): da62f8f

made some checks in TextClassifier

Browse files
Files changed (1) hide show
  1. textclassifier/TextClassifier.py +8 -0
textclassifier/TextClassifier.py CHANGED
@@ -22,6 +22,14 @@ class TextClassifier:
22
  :param to_date: string of the format 'YYYY-MM-DD'.
23
  :param num_tweets: integer value of the maximum number of tweets to be scraped.
24
  """
 
 
 
 
 
 
 
 
25
 
26
  self.model_name = model_name
27
  self.from_date = from_date
 
22
  :param to_date: string of the format 'YYYY-MM-DD'.
23
  :param num_tweets: integer value of the maximum number of tweets to be scraped.
24
  """
25
+ # Make sure to_date is later than from_date
26
+ assert from_date < to_date, "from_date must be earlier than to_date"
27
+ # Make sure the dates are in the correct format
28
+ assert re.match(r'^\d{4}-\d{2}-\d{2}$', from_date) is not None, "from_date must be in the format YYYY-MM-DD"
29
+ # Make sure user_name is not empty
30
+ assert user_name is not None, "user_name cannot be empty"
31
+ # Make sure num_tweets is a positive integer
32
+ assert num_tweets > 0, "num_tweets must be a positive integer"
33
 
34
  self.model_name = model_name
35
  self.from_date = from_date