Datasets:
Tasks:
Text Classification
Formats:
csv
Sub-tasks:
sentiment-classification
Languages:
English
Size:
10K - 100K
License:
Francisco Castillo
commited on
Commit
·
f1b48da
1
Parent(s):
40398d7
wip
Browse files- reviews_with_drift.py +2 -1
reviews_with_drift.py
CHANGED
@@ -151,6 +151,7 @@ class ReviewsWithDrift(datasets.GeneratorBasedBuilder):
|
|
151 |
def _generate_examples(self, filepath):
|
152 |
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
153 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
|
|
154 |
with open(filepath, encoding="utf-8") as csv_file:
|
155 |
csv_reader = csv.reader(csv_file)
|
156 |
for id_, row in enumerate(csv_reader):
|
@@ -164,5 +165,5 @@ class ReviewsWithDrift(datasets.GeneratorBasedBuilder):
|
|
164 |
"gender":gender,
|
165 |
"context":context,
|
166 |
"text": text,
|
167 |
-
"label":label
|
168 |
}
|
|
|
151 |
def _generate_examples(self, filepath):
|
152 |
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
153 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
154 |
+
label_mapping = {"Positive": 1, "Negative": 0}
|
155 |
with open(filepath, encoding="utf-8") as csv_file:
|
156 |
csv_reader = csv.reader(csv_file)
|
157 |
for id_, row in enumerate(csv_reader):
|
|
|
165 |
"gender":gender,
|
166 |
"context":context,
|
167 |
"text": text,
|
168 |
+
"label":label_mapping[label]
|
169 |
}
|