Commit ·
9bd6140
1
Parent(s): 73acaf0
Update mind.py
Browse files
mind.py
CHANGED
|
@@ -74,14 +74,8 @@ class mind(datasets.GeneratorBasedBuilder):
|
|
| 74 |
def _generate_examples(self, filepath):
|
| 75 |
with open(filepath, encoding="utf-8") as csv_file:
|
| 76 |
csv_reader = csv.reader(
|
| 77 |
-
csv_file, quotechar='"', delimiter="
|
| 78 |
)
|
| 79 |
for id_, row in enumerate(csv_reader):
|
| 80 |
-
|
| 81 |
-
# Original labels are [1, 2, 3, 4] ->
|
| 82 |
-
# ['World', 'Sports', 'Business', 'Sci/Tech']
|
| 83 |
-
# Re-map to [0, 1, 2, 3].
|
| 84 |
-
label = int(label) - 1
|
| 85 |
-
text = " ".join((title, description))
|
| 86 |
-
yield id_, {"text": text, "label": label}
|
| 87 |
|
|
|
|
| 74 |
def _generate_examples(self, filepath):
|
| 75 |
with open(filepath, encoding="utf-8") as csv_file:
|
| 76 |
csv_reader = csv.reader(
|
| 77 |
+
csv_file, quotechar='"', delimiter="\t", quoting=csv.QUOTE_ALL, skipinitialspace=True
|
| 78 |
)
|
| 79 |
for id_, row in enumerate(csv_reader):
|
| 80 |
+
yield id_, {"text": row[3], "label": row[1]}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
|