Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
parquet
Sub-tasks:
multi-class-classification
Languages:
Swahili
Size:
10K - 100K
License:
Update files from the datasets library (from 1.17.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.17.0
- README.md +16 -14
- dataset_infos.json +1 -1
- dummy/swahili_news/{1.0.0 → 0.2.0}/dummy_data.zip +2 -2
- swahili_news.py +16 -30
README.md
CHANGED
@@ -18,6 +18,7 @@ task_categories:
|
|
18 |
task_ids:
|
19 |
- multi-class-classification
|
20 |
paperswithcode_id: null
|
|
|
21 |
---
|
22 |
|
23 |
# Dataset Card for Swahili : News Classification Dataset
|
@@ -48,7 +49,7 @@ paperswithcode_id: null
|
|
48 |
|
49 |
## Dataset Description
|
50 |
|
51 |
-
- **Homepage:** [Homepage for Swahili News classification dataset](https://
|
52 |
- **Repository:**
|
53 |
- **Paper:**
|
54 |
- **Leaderboard:**
|
@@ -77,23 +78,21 @@ The language used is Swahili
|
|
77 |
|
78 |
### Data Instances
|
79 |
|
80 |
-
A data
|
81 |
```
|
82 |
-
{
|
83 |
-
|
84 |
-
|
85 |
}
|
86 |
```
|
87 |
|
88 |
### Data Fields
|
89 |
-
|
90 |
-
- `id`: id of the sample
|
91 |
-
- `content`: the news articles
|
92 |
- `label`: the label of the news article
|
93 |
|
94 |
### Data Splits
|
95 |
|
96 |
-
|
97 |
|
98 |
## Dataset Creation
|
99 |
|
@@ -151,17 +150,20 @@ Creative Commons Attribution 4.0 International
|
|
151 |
|
152 |
### Citation Information
|
153 |
|
154 |
-
|
|
|
155 |
author = {Davis David},
|
156 |
title = {Swahili : News Classification Dataset},
|
157 |
month = dec,
|
158 |
year = 2020,
|
|
|
159 |
publisher = {Zenodo},
|
160 |
-
version = {0.
|
161 |
-
doi = {10.5281/zenodo.
|
162 |
-
url = {https://doi.org/10.5281/zenodo.
|
163 |
}
|
|
|
164 |
|
165 |
### Contributions
|
166 |
|
167 |
-
Thanks to [@yvonnegitau](https://github.com/yvonnegitau) for adding this dataset.
|
|
|
18 |
task_ids:
|
19 |
- multi-class-classification
|
20 |
paperswithcode_id: null
|
21 |
+
pretty_name: "Swahili : News Classification Dataset"
|
22 |
---
|
23 |
|
24 |
# Dataset Card for Swahili : News Classification Dataset
|
|
|
49 |
|
50 |
## Dataset Description
|
51 |
|
52 |
+
- **Homepage:** [Homepage for Swahili News classification dataset](https://doi.org/10.5281/zenodo.4300293)
|
53 |
- **Repository:**
|
54 |
- **Paper:**
|
55 |
- **Leaderboard:**
|
|
|
78 |
|
79 |
### Data Instances
|
80 |
|
81 |
+
A data instance:
|
82 |
```
|
83 |
+
{
|
84 |
+
'text': ' Bodi ya Utalii Tanzania (TTB) imesema, itafanya misafara ya kutangaza utalii kwenye miji minne nchini China kati ya Juni 19 hadi Juni 26 mwaka huu.Misafara hiyo itatembelea miji ya Beijing Juni 19, Shanghai Juni 21, Nanjig Juni 24 na Changsha Juni 26.Mwenyekiti wa bodi TTB, Jaji Mstaafu Thomas Mihayo ameyasema hayo kwenye mkutano na waandishi wa habari jijini Dar es Salaam.“Tunafanya jitihada kuhakikisha tunavuna watalii wengi zaidi kutoka China hasa tukizingatia umuhimu wa soko la sekta ya utalii nchini,” amesema Jaji Mihayo.Novemba 2018 TTB ilifanya ziara kwenye miji ya Beijing, Shanghai, Chengdu, Guangzhou na Hong Kong kutangaza vivutio vya utalii sanjari kuzitangaza safari za ndege za Air Tanzania.Ziara hiyo inaelezwa kuzaa matunda ikiwa ni pamoja na watalii zaidi ya 300 kuja nchini Mei mwaka huu kutembelea vivutio vya utalii.',
|
85 |
+
'label': 0
|
86 |
}
|
87 |
```
|
88 |
|
89 |
### Data Fields
|
90 |
+
- `text`: the news articles
|
|
|
|
|
91 |
- `label`: the label of the news article
|
92 |
|
93 |
### Data Splits
|
94 |
|
95 |
+
Dataset contains train and test splits.
|
96 |
|
97 |
## Dataset Creation
|
98 |
|
|
|
150 |
|
151 |
### Citation Information
|
152 |
|
153 |
+
```
|
154 |
+
@dataset{davis_david_2020_5514203,
|
155 |
author = {Davis David},
|
156 |
title = {Swahili : News Classification Dataset},
|
157 |
month = dec,
|
158 |
year = 2020,
|
159 |
+
note = {{The news version contains both train and test sets.}},
|
160 |
publisher = {Zenodo},
|
161 |
+
version = {0.2},
|
162 |
+
doi = {10.5281/zenodo.5514203},
|
163 |
+
url = {https://doi.org/10.5281/zenodo.5514203}
|
164 |
}
|
165 |
+
```
|
166 |
|
167 |
### Contributions
|
168 |
|
169 |
+
Thanks to [@yvonnegitau](https://github.com/yvonnegitau) for adding this dataset.
|
dataset_infos.json
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"swahili_news": {"description": "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.\n\nNews 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.\n\
|
|
|
1 |
+
{"swahili_news": {"description": "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.\n\nNews 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.\n\nThe 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.\n\nThe 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.\n", "citation": "@dataset{davis_david_2020_5514203,\n author = {Davis David},\n title = {Swahili : News Classification Dataset},\n month = dec,\n year = 2020,\n note = {{The news version contains both train and test \n sets.}},\n publisher = {Zenodo},\n version = {0.2},\n doi = {10.5281/zenodo.5514203},\n url = {https://doi.org/10.5281/zenodo.5514203}\n}\n", "homepage": "https://zenodo.org/record/4300294#.X84BQdgzZPb", "license": "Creative Commons Attribution 4.0 International", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 6, "names": ["uchumi", "kitaifa", "michezo", "kimataifa", "burudani", "afya"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "swahili_news", "config_name": "swahili_news", "version": {"version_str": "0.2.0", "description": null, "major": 0, "minor": 2, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 49517855, "num_examples": 22207, "dataset_name": "swahili_news"}, "test": {"name": "test", "num_bytes": 16093496, "num_examples": 7338, "dataset_name": "swahili_news"}}, "download_checksums": {"https://zenodo.org/record/5514203/files/train_v0.2.csv?download=1": {"num_bytes": 49523159, "checksum": "645eb2d6cd3e5d5daae531d44cf2a5c3733c18ccd7ab3e75456c80126f2b6520"}, "https://zenodo.org/record/5514203/files/test_v0.2.csv?download=1": {"num_bytes": 16095249, "checksum": "3380ab85f2398e926354faea04f4361b288b519cb9fee98dc522a8a4f1565f3b"}}, "download_size": 65618408, "post_processing_size": null, "dataset_size": 65611351, "size_in_bytes": 131229759}}
|
dummy/swahili_news/{1.0.0 → 0.2.0}/dummy_data.zip
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:28fd98d85c46606c07342c347317b79ba43c698ddba459ea74eb31f3c6a87703
|
3 |
+
size 7430
|
swahili_news.py
CHANGED
@@ -14,55 +14,50 @@
|
|
14 |
# limitations under the License.
|
15 |
"""Swahili : News Classification Dataset"""
|
16 |
|
17 |
-
|
18 |
import csv
|
19 |
|
20 |
import datasets
|
21 |
|
22 |
|
23 |
-
# TODO: Add BibTeX citation
|
24 |
-
# Find for instance the citation on arxiv or on the dataset repo/website
|
25 |
_CITATION = """\
|
26 |
-
@dataset{
|
27 |
author = {Davis David},
|
28 |
title = {Swahili : News Classification Dataset},
|
29 |
month = dec,
|
30 |
year = 2020,
|
|
|
31 |
publisher = {Zenodo},
|
32 |
-
version = {0.
|
33 |
-
doi = {10.5281/zenodo.
|
34 |
-
url = {https://doi.org/10.5281/zenodo.
|
35 |
}
|
36 |
"""
|
37 |
|
38 |
-
# TODO: Add description of the dataset here
|
39 |
-
# You can copy an official description
|
40 |
_DESCRIPTION = """\
|
41 |
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.
|
42 |
|
43 |
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.
|
44 |
|
45 |
-
|
46 |
|
47 |
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.
|
48 |
"""
|
49 |
|
50 |
-
|
51 |
_HOMEPAGE = "https://zenodo.org/record/4300294#.X84BQdgzZPb"
|
52 |
|
53 |
-
|
54 |
_LICENSE = "Creative Commons Attribution 4.0 International"
|
55 |
|
56 |
-
# The HuggingFace
|
57 |
-
|
58 |
-
|
|
|
|
|
59 |
|
60 |
|
61 |
-
# TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
|
62 |
class SwahiliNews(datasets.GeneratorBasedBuilder):
|
63 |
"""Swahili : News Classification Dataset"""
|
64 |
|
65 |
-
VERSION = datasets.Version("
|
66 |
|
67 |
BUILDER_CONFIGS = [
|
68 |
datasets.BuilderConfig(
|
@@ -73,14 +68,10 @@ class SwahiliNews(datasets.GeneratorBasedBuilder):
|
|
73 |
]
|
74 |
|
75 |
def _info(self):
|
76 |
-
|
77 |
return datasets.DatasetInfo(
|
78 |
-
# This is the description that will appear on the datasets page.
|
79 |
description=_DESCRIPTION,
|
80 |
-
# This defines the different columns of the dataset and their types
|
81 |
features=datasets.Features(
|
82 |
{
|
83 |
-
"id": datasets.Value("string"),
|
84 |
"text": datasets.Value("string"),
|
85 |
"label": datasets.features.ClassLabel(
|
86 |
names=["uchumi", "kitaifa", "michezo", "kimataifa", "burudani", "afya"]
|
@@ -88,27 +79,22 @@ class SwahiliNews(datasets.GeneratorBasedBuilder):
|
|
88 |
}
|
89 |
),
|
90 |
supervised_keys=None,
|
91 |
-
# Homepage of the dataset for documentation
|
92 |
homepage=_HOMEPAGE,
|
93 |
-
# License for the dataset if available
|
94 |
license=_LICENSE,
|
95 |
-
# Citation for the dataset
|
96 |
citation=_CITATION,
|
97 |
)
|
98 |
|
99 |
def _split_generators(self, dl_manager):
|
100 |
-
|
101 |
-
train_path = dl_manager.download_and_extract(_URL)
|
102 |
-
|
103 |
return [
|
104 |
-
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath":
|
|
|
105 |
]
|
106 |
|
107 |
def _generate_examples(self, filepath):
|
108 |
-
|
109 |
with open(filepath, encoding="utf-8") as csv_file:
|
110 |
csv_reader = csv.DictReader(
|
111 |
csv_file, quotechar='"', delimiter=",", quoting=csv.QUOTE_ALL, skipinitialspace=True
|
112 |
)
|
113 |
for id_, row in enumerate(csv_reader):
|
114 |
-
yield id_,
|
|
|
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(
|
|
|
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"]
|
|
|
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
|