Datasets:

Modalities:
Text
Formats:
parquet
Languages:
Hausa
Libraries:
Datasets
pandas
License:
albertvillanova HF staff commited on
Commit
c693e0b
·
verified ·
1 Parent(s): 991fa1b

Delete loading script

Browse files
Files changed (1) hide show
  1. hausa_voa_topics.py +0 -91
hausa_voa_topics.py DELETED
@@ -1,91 +0,0 @@
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
- """Hausa VOA News Topic Classification dataset."""
18
-
19
-
20
- import csv
21
-
22
- import datasets
23
- from datasets.tasks import TextClassification
24
-
25
-
26
- _DESCRIPTION = """\
27
- A collection of news article headlines in Hausa from VOA Hausa.
28
- Each headline is labeled with one of the following classes: Nigeria,
29
- Africa, World, Health or Politics.
30
-
31
- The dataset was presented in the paper:
32
- Hedderich, Adelani, Zhu, Alabi, Markus, Klakow: Transfer Learning and
33
- Distant Supervision for Multilingual Transformer Models: A Study on
34
- African Languages (EMNLP 2020).
35
- """
36
-
37
- _CITATION = """\
38
- @inproceedings{hedderich-etal-2020-transfer,
39
- title = "Transfer Learning and Distant Supervision for Multilingual Transformer Models: A Study on African Languages",
40
- author = "Hedderich, Michael A. and
41
- Adelani, David and
42
- Zhu, Dawei and
43
- Alabi, Jesujoba and
44
- Markus, Udia and
45
- Klakow, Dietrich",
46
- booktitle = "Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)",
47
- year = "2020",
48
- publisher = "Association for Computational Linguistics",
49
- url = "https://www.aclweb.org/anthology/2020.emnlp-main.204",
50
- doi = "10.18653/v1/2020.emnlp-main.204",
51
- }
52
- """
53
-
54
- _TRAIN_DOWNLOAD_URL = "https://raw.githubusercontent.com/uds-lsv/transfer-distant-transformer-african/master/data/hausa_newsclass/train_clean.tsv"
55
- _VALIDATION_DOWNLOAD_URL = "https://raw.githubusercontent.com/uds-lsv/transfer-distant-transformer-african/master/data/hausa_newsclass/dev.tsv"
56
- _TEST_DOWNLOAD_URL = "https://raw.githubusercontent.com/uds-lsv/transfer-distant-transformer-african/master/data/hausa_newsclass/test.tsv"
57
-
58
-
59
- class HausaVOATopics(datasets.GeneratorBasedBuilder):
60
- """Hausa VOA News Topic Classification dataset."""
61
-
62
- def _info(self):
63
- return datasets.DatasetInfo(
64
- description=_DESCRIPTION,
65
- features=datasets.Features(
66
- {
67
- "news_title": datasets.Value("string"),
68
- "label": datasets.features.ClassLabel(names=["Africa", "Health", "Nigeria", "Politics", "World"]),
69
- }
70
- ),
71
- homepage="https://github.com/uds-lsv/transfer-distant-transformer-african",
72
- citation=_CITATION,
73
- task_templates=[TextClassification(text_column="news_title", label_column="label")],
74
- )
75
-
76
- def _split_generators(self, dl_manager):
77
- train_path = dl_manager.download_and_extract(_TRAIN_DOWNLOAD_URL)
78
- validation_path = dl_manager.download_and_extract(_VALIDATION_DOWNLOAD_URL)
79
- test_path = dl_manager.download_and_extract(_TEST_DOWNLOAD_URL)
80
- return [
81
- datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}),
82
- datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": validation_path}),
83
- datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}),
84
- ]
85
-
86
- def _generate_examples(self, filepath):
87
- """Generate Hausa VOA News Topic examples."""
88
- with open(filepath, encoding="utf-8") as csv_file:
89
- csv_reader = csv.DictReader(csv_file, delimiter="\t")
90
- for id_, row in enumerate(csv_reader):
91
- yield id_, {"news_title": row["news_title"], "label": row["label"]}