AkashSD commited on
Commit
b66dba7
·
1 Parent(s): 461a9d1

Please update splitting in the "tweets_hate_speech_detection" dataset.

Browse files

This dataset has not been splitted to train, validation and test sets like some other datasets such as "rotten_tomatoes" are splitted.
Please update the changes made by me to make the dataset splitted to train, validation and test dataset.

Files changed (1) hide show
  1. tweets_hate_speech_detection.py +17 -4
tweets_hate_speech_detection.py CHANGED
@@ -38,7 +38,7 @@ year={2018}
38
  }
39
  """
40
 
41
- _TRAIN_DOWNLOAD_URL = (
42
  "https://raw.githubusercontent.com/sharmaroshan/Twitter-Sentiment-Analysis/master/train_tweet.csv"
43
  )
44
 
@@ -61,12 +61,25 @@ class TweetsHateSpeechDetection(datasets.GeneratorBasedBuilder):
61
  )
62
 
63
  def _split_generators(self, dl_manager):
64
- train_path = dl_manager.download_and_extract(_TRAIN_DOWNLOAD_URL)
 
65
 
66
  return [
67
- datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}),
 
 
 
 
 
 
 
 
 
 
 
68
  ]
69
-
 
70
  def _generate_examples(self, filepath):
71
  """Generate Tweet examples."""
72
  with open(filepath, encoding="utf-8") as csv_file:
 
38
  }
39
  """
40
 
41
+ TRAIN_DOWNLOAD_URL = (
42
  "https://raw.githubusercontent.com/sharmaroshan/Twitter-Sentiment-Analysis/master/train_tweet.csv"
43
  )
44
 
 
61
  )
62
 
63
  def _split_generators(self, dl_manager):
64
+
65
+ train_path = dl_manager.download_and_extract(TRAIN_DOWNLOAD_URL)
66
 
67
  return [
68
+ datasets.SplitGenerator(
69
+ name=datasets.Split.TRAIN,
70
+ gen_kwargs={"split_key": "train", "files": dl_manager.iter_TRAIN_DOWNLOAD_URL(TRAIN_DOWNLOAD_URL)},
71
+ ),
72
+ datasets.SplitGenerator(
73
+ name=datasets.Split.VALIDATION,
74
+ gen_kwargs={"split_key": "validation", "files": dl_manager.iter_TRAIN_DOWNLOAD_URL(TRAIN_DOWNLOAD_URL)},
75
+ ),
76
+ datasets.SplitGenerator(
77
+ name=datasets.Split.TEST,
78
+ gen_kwargs={"split_key": "test", "files": dl_manager.iter_TRAIN_DOWNLOAD_URL(TRAIN_DOWNLOAD_URL)},
79
+ ),
80
  ]
81
+
82
+
83
  def _generate_examples(self, filepath):
84
  """Generate Tweet examples."""
85
  with open(filepath, encoding="utf-8") as csv_file: