Update labels.py
Browse files
labels.py
CHANGED
|
@@ -103,11 +103,11 @@ class YahooAnswersTopics(datasets.GeneratorBasedBuilder):
|
|
| 103 |
|
| 104 |
def _generate_examples(self, filepath):
|
| 105 |
"""Generate AG News examples."""
|
| 106 |
-
with open(filepath, encoding="utf-8") as
|
| 107 |
-
|
| 108 |
-
|
| 109 |
)
|
| 110 |
-
for id_, row in enumerate(
|
| 111 |
label, title, description = row
|
| 112 |
# Original labels are [1, 2, 3, 4] ->
|
| 113 |
# ['World', 'Sports', 'Business', 'Sci/Tech']
|
|
|
|
| 103 |
|
| 104 |
def _generate_examples(self, filepath):
|
| 105 |
"""Generate AG News examples."""
|
| 106 |
+
with open(filepath, encoding="utf-8") as f:
|
| 107 |
+
rows = csv.reader(
|
| 108 |
+
f, quotechar='"', delimiter=",", quoting=csv.QUOTE_ALL, skipinitialspace=True
|
| 109 |
)
|
| 110 |
+
for id_, row in enumerate(rows):
|
| 111 |
label, title, description = row
|
| 112 |
# Original labels are [1, 2, 3, 4] ->
|
| 113 |
# ['World', 'Sports', 'Business', 'Sci/Tech']
|