fixed preprocessing, added exception to split gen
Browse files- process/tweet_hate.py +1 -1
- super_tweet_eval.py +7 -2
process/tweet_hate.py
CHANGED
@@ -38,7 +38,7 @@ def clean_text(text):
|
|
38 |
for t in text.split():
|
39 |
# MAKE SURE to check lowercase
|
40 |
t = '@user' if t.startswith('@') and len(t) > 1 and t.replace('@','').lower() not in verified_users else t
|
41 |
-
t = '{URL}' if t.startswith('http') else t
|
42 |
new_text.append(t)
|
43 |
|
44 |
return ' '.join(new_text)
|
|
|
38 |
for t in text.split():
|
39 |
# MAKE SURE to check lowercase
|
40 |
t = '@user' if t.startswith('@') and len(t) > 1 and t.replace('@','').lower() not in verified_users else t
|
41 |
+
t = '\{URL\}' if t.startswith('http') else t
|
42 |
new_text.append(t)
|
43 |
|
44 |
return ' '.join(new_text)
|
super_tweet_eval.py
CHANGED
@@ -259,8 +259,13 @@ class SuperTweetEval(datasets.GeneratorBasedBuilder):
|
|
259 |
)
|
260 |
|
261 |
def _split_generators(self, dl_manager):
|
262 |
-
|
263 |
-
|
|
|
|
|
|
|
|
|
|
|
264 |
|
265 |
def _generate_examples(self, filepath):
|
266 |
_key = 0
|
|
|
259 |
)
|
260 |
|
261 |
def _split_generators(self, dl_manager):
|
262 |
+
# TODO: temporary check until we have all splits online
|
263 |
+
if self.config.name == 'tweet_disambiguation':
|
264 |
+
splits = ['validation']
|
265 |
+
else:
|
266 |
+
splits = ['train', 'test', 'validation']
|
267 |
+
downloaded_file = dl_manager.download_and_extract({s: f"{self.config.data_url}/{s}.jsonl" for s in splits})
|
268 |
+
return [datasets.SplitGenerator(name=s, gen_kwargs={"filepath": downloaded_file[s]}) for s in splits]
|
269 |
|
270 |
def _generate_examples(self, filepath):
|
271 |
_key = 0
|