albertvillanova HF staff commited on
Commit
e1bae76
1 Parent(s): b5c414f

Convert dataset to Parquet (#4)

Browse files

- Convert dataset to Parquet (cfc9bfd70f578f55307ac88a57ee52c2a13da7d7)
- Delete loading script (58270a6a3900d83b39977b435a58fdccc9949f86)

README.md CHANGED
@@ -19,6 +19,7 @@ task_ids:
19
  - multi-class-classification
20
  pretty_name: 'Swahili : News Classification Dataset'
21
  dataset_info:
 
22
  features:
23
  - name: text
24
  dtype: string
@@ -32,16 +33,23 @@ dataset_info:
32
  '3': kimataifa
33
  '4': burudani
34
  '5': afya
35
- config_name: swahili_news
36
  splits:
37
  - name: train
38
- num_bytes: 49517855
39
  num_examples: 22207
40
  - name: test
41
- num_bytes: 16093496
42
  num_examples: 7338
43
- download_size: 65618408
44
- dataset_size: 65611351
 
 
 
 
 
 
 
 
45
  ---
46
 
47
  # Dataset Card for Swahili : News Classification Dataset
 
19
  - multi-class-classification
20
  pretty_name: 'Swahili : News Classification Dataset'
21
  dataset_info:
22
+ config_name: swahili_news
23
  features:
24
  - name: text
25
  dtype: string
 
33
  '3': kimataifa
34
  '4': burudani
35
  '5': afya
 
36
  splits:
37
  - name: train
38
+ num_bytes: 49517843
39
  num_examples: 22207
40
  - name: test
41
+ num_bytes: 16093492
42
  num_examples: 7338
43
+ download_size: 38109228
44
+ dataset_size: 65611335
45
+ configs:
46
+ - config_name: swahili_news
47
+ data_files:
48
+ - split: train
49
+ path: swahili_news/train-*
50
+ - split: test
51
+ path: swahili_news/test-*
52
+ default: true
53
  ---
54
 
55
  # Dataset Card for Swahili : News Classification Dataset
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
swahili_news/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e997c51110d606b92dd7b972c53b071ac29967d1962e7466bcb237553a7d7a13
3
+ size 9362083
swahili_news/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c52ce535f7d22cf4afe979064dfa8ed528971358f3754a7eba91752f96440595
3
+ size 28747145