Update sarcasm.py
Browse files- sarcasm.py +7 -6
sarcasm.py
CHANGED
@@ -40,25 +40,26 @@ class Sarcasm(GeneratorBasedBuilder):
|
|
40 |
)
|
41 |
|
42 |
def _split_generators(self, dl_manager):
|
43 |
-
|
44 |
-
|
|
|
45 |
num_examples = pd.read_csv(data_file_path).shape[0]
|
46 |
train_size = int(0.6 * num_examples)
|
47 |
val_size = int(0.2 * num_examples)
|
48 |
test_size = num_examples - train_size - val_size
|
49 |
-
|
50 |
return [
|
51 |
SplitGenerator(
|
52 |
name=Split.TRAIN,
|
53 |
-
gen_kwargs={"data_file_path": data_file_path
|
54 |
),
|
55 |
SplitGenerator(
|
56 |
name=Split.VALIDATION,
|
57 |
-
gen_kwargs={"data_file_path": data_file_path
|
58 |
),
|
59 |
SplitGenerator(
|
60 |
name=Split.TEST,
|
61 |
-
gen_kwargs={"data_file_path": data_file_path
|
62 |
),
|
63 |
]
|
64 |
|
|
|
40 |
)
|
41 |
|
42 |
def _split_generators(self, dl_manager):
|
43 |
+
downloaded_files = dl_manager.download_and_extract(_URLS)
|
44 |
+
data_file_path = downloaded_files["csv_file"]
|
45 |
+
|
46 |
num_examples = pd.read_csv(data_file_path).shape[0]
|
47 |
train_size = int(0.6 * num_examples)
|
48 |
val_size = int(0.2 * num_examples)
|
49 |
test_size = num_examples - train_size - val_size
|
50 |
+
|
51 |
return [
|
52 |
SplitGenerator(
|
53 |
name=Split.TRAIN,
|
54 |
+
gen_kwargs={"data_file_path": data_file_path, "split": Split.TRAIN, "size": train_size}
|
55 |
),
|
56 |
SplitGenerator(
|
57 |
name=Split.VALIDATION,
|
58 |
+
gen_kwargs={"data_file_path": data_file_path, "split": Split.VALIDATION, "size": val_size}
|
59 |
),
|
60 |
SplitGenerator(
|
61 |
name=Split.TEST,
|
62 |
+
gen_kwargs={"data_file_path": data_file_path, "split": Split.TEST, "size": test_size}
|
63 |
),
|
64 |
]
|
65 |
|