Datasets:
Tasks:
Text Classification
Formats:
csv
Sub-tasks:
sentiment-classification
Languages:
English
Size:
10K - 100K
License:
Francisco Castillo
commited on
Commit
•
42ed38f
1
Parent(s):
4877d43
wip
Browse files- reviews_with_drift.py +12 -9
reviews_with_drift.py
CHANGED
@@ -189,12 +189,15 @@ class NewDataset(datasets.GeneratorBasedBuilder):
|
|
189 |
def _generate_examples(self, filepath, split):
|
190 |
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
191 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
192 |
-
with open(filepath, encoding="utf-8") as
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
|
|
|
|
|
|
|
189 |
def _generate_examples(self, filepath, split):
|
190 |
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
191 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
192 |
+
with open(filepath, encoding="utf-8") as csv_file:
|
193 |
+
csv_reader = csv.reader(csv_file)
|
194 |
+
for id_, row in enumerate(csv_reader):
|
195 |
+
prediction_ts,age,gender,context,text,label = row
|
196 |
+
yield id_, {
|
197 |
+
"prediction_ts":prediction_ts,
|
198 |
+
"age":age,
|
199 |
+
"gender":gender,
|
200 |
+
"context":context,
|
201 |
+
"text": text,
|
202 |
+
"label":label
|
203 |
+
}
|