Commit ·
2080da3
1
Parent(s): 97bd0d8
Update mind.py
Browse files
mind.py
CHANGED
|
@@ -1,41 +1,7 @@
|
|
| 1 |
-
# coding=utf-8
|
| 2 |
-
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
|
| 3 |
-
#
|
| 4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
-
# you may not use this file except in compliance with the License.
|
| 6 |
-
# You may obtain a copy of the License at
|
| 7 |
-
#
|
| 8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
-
#
|
| 10 |
-
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
-
# See the License for the specific language governing permissions and
|
| 14 |
-
# limitations under the License.
|
| 15 |
-
|
| 16 |
-
# Lint as: python3
|
| 17 |
-
"""MIND dataset."""
|
| 18 |
-
|
| 19 |
-
|
| 20 |
import csv
|
| 21 |
-
|
| 22 |
import datasets
|
| 23 |
from datasets.tasks import TextClassification
|
| 24 |
|
| 25 |
-
|
| 26 |
-
_DESCRIPTION = """\
|
| 27 |
-
MIND
|
| 28 |
-
"""
|
| 29 |
-
|
| 30 |
-
_CITATION = """\
|
| 31 |
-
@inproceedings{Zhang2015CharacterlevelCN,
|
| 32 |
-
title={Character-level Convolutional Networks for Text Classification},
|
| 33 |
-
author={Xiang Zhang and Junbo Jake Zhao and Yann LeCun},
|
| 34 |
-
booktitle={NIPS},
|
| 35 |
-
year={2015}
|
| 36 |
-
}
|
| 37 |
-
"""
|
| 38 |
-
|
| 39 |
_TRAIN_DOWNLOAD_URL = "https://huggingface.co/datasets/linxinyuan/mind/resolve/main/train.csv"
|
| 40 |
_TEST_DOWNLOAD_URL = "https://huggingface.co/datasets/linxinyuan/mind/resolve/main/test.csv"
|
| 41 |
|
|
@@ -45,22 +11,16 @@ class mind(datasets.GeneratorBasedBuilder):
|
|
| 45 |
|
| 46 |
def _info(self):
|
| 47 |
return datasets.DatasetInfo(
|
| 48 |
-
description=
|
| 49 |
features=datasets.Features(
|
| 50 |
{
|
| 51 |
-
"
|
| 52 |
-
"
|
| 53 |
-
"SubCategory": datasets.Value("string"),
|
| 54 |
-
"Title": datasets.Value("string"),
|
| 55 |
-
"Abstract": datasets.Value("string"),
|
| 56 |
-
"URL": datasets.Value("string"),
|
| 57 |
-
"TitleEntities": datasets.Value("string"),
|
| 58 |
-
"AbstractEntites": datasets.Value("string"),
|
| 59 |
}
|
| 60 |
),
|
| 61 |
homepage="http://groups.di.unipi.it/~gulli/AG_corpus_of_news_articles.html",
|
| 62 |
-
citation=
|
| 63 |
-
task_templates=[TextClassification(text_column="
|
| 64 |
)
|
| 65 |
|
| 66 |
def _split_generators(self, dl_manager):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import csv
|
|
|
|
| 2 |
import datasets
|
| 3 |
from datasets.tasks import TextClassification
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
_TRAIN_DOWNLOAD_URL = "https://huggingface.co/datasets/linxinyuan/mind/resolve/main/train.csv"
|
| 6 |
_TEST_DOWNLOAD_URL = "https://huggingface.co/datasets/linxinyuan/mind/resolve/main/test.csv"
|
| 7 |
|
|
|
|
| 11 |
|
| 12 |
def _info(self):
|
| 13 |
return datasets.DatasetInfo(
|
| 14 |
+
description="MIND",
|
| 15 |
features=datasets.Features(
|
| 16 |
{
|
| 17 |
+
"label": datasets.features.ClassLabel(names=['foodanddrink', 'games', 'lifestyle', 'weather', 'kids', 'entertainment', 'middleeast', 'news', 'autos', 'video', 'travel', 'music', 'northamerica', 'movies', 'finance', 'health', 'sports', 'tv']),
|
| 18 |
+
"text": datasets.Value("string")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
}
|
| 20 |
),
|
| 21 |
homepage="http://groups.di.unipi.it/~gulli/AG_corpus_of_news_articles.html",
|
| 22 |
+
citation="",
|
| 23 |
+
task_templates=[TextClassification(text_column="text", label_column="label")],
|
| 24 |
)
|
| 25 |
|
| 26 |
def _split_generators(self, dl_manager):
|