albertvillanova HF staff commited on
Commit
58270a6
1 Parent(s): cfc9bfd

Delete loading script

Browse files
Files changed (1) hide show
  1. swahili_news.py +0 -100
swahili_news.py DELETED
@@ -1,100 +0,0 @@
1
- # coding=utf-8
2
- # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
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
- """Swahili : News Classification Dataset"""
16
-
17
- import csv
18
-
19
- import datasets
20
-
21
-
22
- _CITATION = """\
23
- @dataset{davis_david_2020_5514203,
24
- author = {Davis David},
25
- title = {Swahili : News Classification Dataset},
26
- month = dec,
27
- year = 2020,
28
- note = {{The news version contains both train and test sets.}},
29
- publisher = {Zenodo},
30
- version = {0.2},
31
- doi = {10.5281/zenodo.5514203},
32
- url = {https://doi.org/10.5281/zenodo.5514203}
33
- }
34
- """
35
-
36
- _DESCRIPTION = """\
37
- Swahili is spoken by 100-150 million people across East Africa. In Tanzania, it is one of two national languages (the other is English) and it is the official language of instruction in all schools. News in Swahili is an important part of the media sphere in Tanzania.
38
-
39
- News contributes to education, technology, and the economic growth of a country, and news in local languages plays an important cultural role in many Africa countries. In the modern age, African languages in news and other spheres are at risk of being lost as English becomes the dominant language in online spaces.
40
-
41
- The Swahili news dataset was created to reduce the gap of using the Swahili language to create NLP technologies and help AI practitioners in Tanzania and across Africa continent to practice their NLP skills to solve different problems in organizations or societies related to Swahili language. Swahili News were collected from different websites that provide news in the Swahili language. I was able to find some websites that provide news in Swahili only and others in different languages including Swahili.
42
-
43
- The dataset was created for a specific task of text classification, this means each news content can be categorized into six different topics (Local news, International news , Finance news, Health news, Sports news, and Entertainment news). The dataset comes with a specified train/test split. The train set contains 75% of the dataset and test set contains 25% of the dataset.
44
- """
45
-
46
- _HOMEPAGE = "https://zenodo.org/record/4300294#.X84BQdgzZPb"
47
-
48
- _LICENSE = "Creative Commons Attribution 4.0 International"
49
-
50
- # The HuggingFace Datasets library don't host the datasets but only point to the original files
51
- _URLS = {
52
- "train": "https://zenodo.org/record/5514203/files/train_v0.2.csv?download=1",
53
- "test": "https://zenodo.org/record/5514203/files/test_v0.2.csv?download=1",
54
- }
55
-
56
-
57
- class SwahiliNews(datasets.GeneratorBasedBuilder):
58
- """Swahili : News Classification Dataset"""
59
-
60
- VERSION = datasets.Version("0.2.0")
61
-
62
- BUILDER_CONFIGS = [
63
- datasets.BuilderConfig(
64
- name="swahili_news",
65
- version=VERSION,
66
- description="Swahili : News Classification Dataset",
67
- )
68
- ]
69
-
70
- def _info(self):
71
- return datasets.DatasetInfo(
72
- description=_DESCRIPTION,
73
- features=datasets.Features(
74
- {
75
- "text": datasets.Value("string"),
76
- "label": datasets.features.ClassLabel(
77
- names=["uchumi", "kitaifa", "michezo", "kimataifa", "burudani", "afya"]
78
- ),
79
- }
80
- ),
81
- supervised_keys=None,
82
- homepage=_HOMEPAGE,
83
- license=_LICENSE,
84
- citation=_CITATION,
85
- )
86
-
87
- def _split_generators(self, dl_manager):
88
- paths = dl_manager.download_and_extract(_URLS)
89
- return [
90
- datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": paths["train"]}),
91
- datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": paths["test"]}),
92
- ]
93
-
94
- def _generate_examples(self, filepath):
95
- with open(filepath, encoding="utf-8") as csv_file:
96
- csv_reader = csv.DictReader(
97
- csv_file, quotechar='"', delimiter=",", quoting=csv.QUOTE_ALL, skipinitialspace=True
98
- )
99
- for id_, row in enumerate(csv_reader):
100
- yield id_, row