Datasets:
Tasks:
Text Classification
Sub-tasks:
sentiment-classification
Languages:
English
Size:
10K<n<100K
License:
Francisco Castillo
commited on
Commit
·
695bec7
1
Parent(s):
a8b61e4
Update loading script
Browse files
ecommerce_reviews_language_drift.py
CHANGED
@@ -89,7 +89,7 @@ class ReviewsWithDrift(datasets.GeneratorBasedBuilder):
|
|
89 |
DEFAULT_CONFIG_NAME = "default" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
90 |
|
91 |
def _info(self):
|
92 |
-
class_names = ["negative", "positive"]
|
93 |
# This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
|
94 |
features = datasets.Features(
|
95 |
# These are the features of your dataset like images, labels ...
|
@@ -156,18 +156,18 @@ class ReviewsWithDrift(datasets.GeneratorBasedBuilder):
|
|
156 |
def _generate_examples(self, filepath):
|
157 |
# This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
158 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
159 |
-
label_mapping = {"positive": 1, "negative": 0}
|
160 |
with open(filepath) as csv_file:
|
161 |
csv_reader = csv.reader(csv_file)
|
162 |
for id_, row in enumerate(csv_reader):
|
163 |
-
prediction_ts,age,gender,
|
164 |
if id_==0:
|
165 |
continue
|
166 |
yield id_, {
|
167 |
"prediction_ts":prediction_ts,
|
168 |
-
"
|
169 |
-
"
|
170 |
-
"
|
|
|
171 |
"text": text,
|
172 |
"label":label,
|
173 |
}
|
|
|
89 |
DEFAULT_CONFIG_NAME = "default" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
90 |
|
91 |
def _info(self):
|
92 |
+
class_names = ["very negative", "negative", "neutral", "positive", "very positive"]
|
93 |
# This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
|
94 |
features = datasets.Features(
|
95 |
# These are the features of your dataset like images, labels ...
|
|
|
156 |
def _generate_examples(self, filepath):
|
157 |
# This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
158 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
|
|
159 |
with open(filepath) as csv_file:
|
160 |
csv_reader = csv.reader(csv_file)
|
161 |
for id_, row in enumerate(csv_reader):
|
162 |
+
prediction_ts,age,gender,category,language,text,label = row
|
163 |
if id_==0:
|
164 |
continue
|
165 |
yield id_, {
|
166 |
"prediction_ts":prediction_ts,
|
167 |
+
"reviewer_age":age,
|
168 |
+
"reviewer_gender":gender,
|
169 |
+
"product_category":category,
|
170 |
+
"language":language,
|
171 |
"text": text,
|
172 |
"label":label,
|
173 |
}
|