Update labels.py
Browse files
labels.py
CHANGED
|
@@ -61,12 +61,12 @@ class AGNews(datasets.GeneratorBasedBuilder):
|
|
| 61 |
features=datasets.Features(
|
| 62 |
{
|
| 63 |
"text": datasets.Value("string"),
|
| 64 |
-
"
|
| 65 |
}
|
| 66 |
),
|
| 67 |
homepage="http://groups.di.unipi.it/~gulli/AG_corpus_of_news_articles.html",
|
| 68 |
citation=_CITATION,
|
| 69 |
-
task_templates=[TextClassification(text_column="text", label_column="
|
| 70 |
)
|
| 71 |
|
| 72 |
def _split_generators(self, dl_manager):
|
|
@@ -90,5 +90,5 @@ class AGNews(datasets.GeneratorBasedBuilder):
|
|
| 90 |
# Re-map to [0, 1, 2, 3].
|
| 91 |
label = int(label) - 1
|
| 92 |
text = " ".join((title, description))
|
| 93 |
-
yield id_, {"text": text, "
|
| 94 |
|
|
|
|
| 61 |
features=datasets.Features(
|
| 62 |
{
|
| 63 |
"text": datasets.Value("string"),
|
| 64 |
+
"labels": datasets.features.ClassLabel(names=["Society & Culture", "Science & Mathematics", "Health","Education & Reference", "Computers & Internet", "Sports", "Business & Finance", "Entertainment & Music", "Family & Relationships", "Politics & Government"]),
|
| 65 |
}
|
| 66 |
),
|
| 67 |
homepage="http://groups.di.unipi.it/~gulli/AG_corpus_of_news_articles.html",
|
| 68 |
citation=_CITATION,
|
| 69 |
+
task_templates=[TextClassification(text_column="text", label_column="labels")],
|
| 70 |
)
|
| 71 |
|
| 72 |
def _split_generators(self, dl_manager):
|
|
|
|
| 90 |
# Re-map to [0, 1, 2, 3].
|
| 91 |
label = int(label) - 1
|
| 92 |
text = " ".join((title, description))
|
| 93 |
+
yield id_, {"text": text, "labels": label}
|
| 94 |
|