Datasets:
Tasks:
Text Classification
Modalities:
Text
Sub-tasks:
multi-class-classification
Languages:
English
Size:
10K - 100K
ArXiv:
License:
Debug one_stop_english
Browse files
raft.py
CHANGED
|
@@ -17,6 +17,7 @@ import csv
|
|
| 17 |
import json
|
| 18 |
import os
|
| 19 |
from pathlib import Path
|
|
|
|
| 20 |
|
| 21 |
import datasets
|
| 22 |
|
|
@@ -404,6 +405,7 @@ class Raft(datasets.GeneratorBasedBuilder):
|
|
| 404 |
task = TASKS[self.config.name]
|
| 405 |
labels = list(task["label_columns"])
|
| 406 |
|
|
|
|
| 407 |
with open(filepath, encoding="utf-8") as f:
|
| 408 |
csv_reader = csv.reader(f, quotechar='"', delimiter=",", quoting=csv.QUOTE_ALL, skipinitialspace=True)
|
| 409 |
column_names = next(csv_reader)
|
|
@@ -415,4 +417,7 @@ class Raft(datasets.GeneratorBasedBuilder):
|
|
| 415 |
if split == "test":
|
| 416 |
row += ["Unlabeled"] * len(labels)
|
| 417 |
# dicts don't have inherent ordering in python, right??
|
| 418 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
import json
|
| 18 |
import os
|
| 19 |
from pathlib import Path
|
| 20 |
+
from collections import OrderedDict
|
| 21 |
|
| 22 |
import datasets
|
| 23 |
|
|
|
|
| 405 |
task = TASKS[self.config.name]
|
| 406 |
labels = list(task["label_columns"])
|
| 407 |
|
| 408 |
+
|
| 409 |
with open(filepath, encoding="utf-8") as f:
|
| 410 |
csv_reader = csv.reader(f, quotechar='"', delimiter=",", quoting=csv.QUOTE_ALL, skipinitialspace=True)
|
| 411 |
column_names = next(csv_reader)
|
|
|
|
| 417 |
if split == "test":
|
| 418 |
row += ["Unlabeled"] * len(labels)
|
| 419 |
# dicts don't have inherent ordering in python, right??
|
| 420 |
+
examples = OrderedDict()
|
| 421 |
+
for name, value in zip(column_names, row):
|
| 422 |
+
examples[name] = value
|
| 423 |
+
yield id_, examples
|