Datasets:
Tasks:
Token Classification
Sub-tasks:
named-entity-recognition
Languages:
Yoruba
Multilinguality:
monolingual
Size Categories:
1K<n<10K
Language Creators:
expert-generated
Annotations Creators:
expert-generated
Source Datasets:
original
Tags:
License:
Commit
•
ff0e785
0
Parent(s):
Update files from the datasets library (from 1.2.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.2.0
- .gitattributes +27 -0
- README.md +174 -0
- dataset_infos.json +1 -0
- dummy/yoruba_gv_ner/1.0.0/dummy_data.zip +3 -0
- yoruba_gv_ner.py +161 -0
.gitattributes
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- expert-generated
|
4 |
+
language_creators:
|
5 |
+
- expert-generated
|
6 |
+
languages:
|
7 |
+
- yo
|
8 |
+
licenses:
|
9 |
+
- Creative Commons 3-0
|
10 |
+
multilinguality:
|
11 |
+
- monolingual
|
12 |
+
size_categories:
|
13 |
+
- 200<n<1k
|
14 |
+
source_datasets:
|
15 |
+
- original
|
16 |
+
task_categories:
|
17 |
+
- structure-prediction
|
18 |
+
task_ids:
|
19 |
+
- named-entity-recognition
|
20 |
+
---
|
21 |
+
|
22 |
+
# Dataset Card for Yoruba GV NER Corpus
|
23 |
+
|
24 |
+
## Table of Contents
|
25 |
+
- [Dataset Description](#dataset-description)
|
26 |
+
- [Dataset Summary](#dataset-summary)
|
27 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
28 |
+
- [Languages](#languages)
|
29 |
+
- [Dataset Structure](#dataset-structure)
|
30 |
+
- [Data Instances](#data-instances)
|
31 |
+
- [Data Fields](#data-instances)
|
32 |
+
- [Data Splits](#data-instances)
|
33 |
+
- [Dataset Creation](#dataset-creation)
|
34 |
+
- [Curation Rationale](#curation-rationale)
|
35 |
+
- [Source Data](#source-data)
|
36 |
+
- [Annotations](#annotations)
|
37 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
38 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
39 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
40 |
+
- [Discussion of Biases](#discussion-of-biases)
|
41 |
+
- [Other Known Limitations](#other-known-limitations)
|
42 |
+
- [Additional Information](#additional-information)
|
43 |
+
- [Dataset Curators](#dataset-curators)
|
44 |
+
- [Licensing Information](#licensing-information)
|
45 |
+
- [Citation Information](#citation-information)
|
46 |
+
|
47 |
+
## Dataset Description
|
48 |
+
|
49 |
+
- **Homepage:**
|
50 |
+
- **Repository:** [Yoruba GV NER](https://github.com/ajesujoba/YorubaTwi-Embedding/tree/master/Yoruba/Yoruba-NER)
|
51 |
+
- **Paper:** https://www.aclweb.org/anthology/2020.lrec-1.335/
|
52 |
+
- **Leaderboard:**
|
53 |
+
- **Point of Contact:** [David Adelani](mailto:didelani@lsv.uni-saarland.de)
|
54 |
+
|
55 |
+
### Dataset Summary
|
56 |
+
The Yoruba GV NER is a named entity recognition (NER) dataset for Yorùbá language based on the [Global Voices news](https://yo.globalvoices.org/) corpus. Global Voices (GV) is a multilingual news platform with articles contributed by journalists, translators, bloggers, and human rights activists from around the world with a coverage of over 50 languages. Most of the texts used in creating the Yoruba GV NER are translations from other languages to Yorùbá.
|
57 |
+
|
58 |
+
### Supported Tasks and Leaderboards
|
59 |
+
|
60 |
+
[More Information Needed]
|
61 |
+
|
62 |
+
### Languages
|
63 |
+
|
64 |
+
The language supported is Yorùbá.
|
65 |
+
|
66 |
+
## Dataset Structure
|
67 |
+
|
68 |
+
### Data Instances
|
69 |
+
|
70 |
+
A data point consists of sentences seperated by empty line and tab-seperated tokens and tags.
|
71 |
+
{'id': '0',
|
72 |
+
'ner_tags': [B-LOC, 0, 0, 0, 0],
|
73 |
+
'tokens': ['Tanzania', 'fi', 'Ajìjàgbara', 'Ọmọ', 'Orílẹ̀-èdèe']
|
74 |
+
}
|
75 |
+
|
76 |
+
### Data Fields
|
77 |
+
|
78 |
+
- `id`: id of the sample
|
79 |
+
- `tokens`: the tokens of the example text
|
80 |
+
- `ner_tags`: the NER tags of each token
|
81 |
+
|
82 |
+
The NER tags correspond to this list:
|
83 |
+
```
|
84 |
+
"O", "B-PER", "I-PER", "B-ORG", "I-ORG", "B-LOC", "I-LOC", "B-DATE", "I-DATE",
|
85 |
+
```
|
86 |
+
The NER tags have the same format as in the CoNLL shared task: a B denotes the first item of a phrase and an I any non-initial word. There are four types of phrases: person names (PER), organizations (ORG), locations (LOC) and dates & times (DATE). (O) is used for tokens not considered part of any named entity.
|
87 |
+
|
88 |
+
### Data Splits
|
89 |
+
|
90 |
+
Training (19,421 tokens), validation (2,695 tokens) and test split (5,235 tokens)
|
91 |
+
|
92 |
+
## Dataset Creation
|
93 |
+
|
94 |
+
### Curation Rationale
|
95 |
+
|
96 |
+
The data was created to help introduce resources to new language - Yorùbá.
|
97 |
+
|
98 |
+
[More Information Needed]
|
99 |
+
|
100 |
+
### Source Data
|
101 |
+
|
102 |
+
#### Initial Data Collection and Normalization
|
103 |
+
|
104 |
+
The dataset is based on the news domain and was crawled from [Global Voices Yorùbá news](https://yo.globalvoices.org/).
|
105 |
+
|
106 |
+
|
107 |
+
[More Information Needed]
|
108 |
+
|
109 |
+
#### Who are the source language producers?
|
110 |
+
|
111 |
+
The dataset contributed by journalists, translators, bloggers, and human rights activists from around the world. Most of the texts used in creating the Yoruba GV NER are translations from other languages to Yorùbá
|
112 |
+
[More Information Needed]
|
113 |
+
|
114 |
+
### Annotations
|
115 |
+
|
116 |
+
#### Annotation process
|
117 |
+
|
118 |
+
[More Information Needed]
|
119 |
+
|
120 |
+
#### Who are the annotators?
|
121 |
+
|
122 |
+
The data was annotated by Jesujoba Alabi and David Adelani for the paper:
|
123 |
+
[Massive vs. Curated Embeddings for Low-Resourced Languages: the case of Yorùbá and Twi](https://www.aclweb.org/anthology/2020.lrec-1.335/).
|
124 |
+
|
125 |
+
[More Information Needed]
|
126 |
+
|
127 |
+
### Personal and Sensitive Information
|
128 |
+
|
129 |
+
[More Information Needed]
|
130 |
+
|
131 |
+
## Considerations for Using the Data
|
132 |
+
|
133 |
+
### Social Impact of Dataset
|
134 |
+
|
135 |
+
[More Information Needed]
|
136 |
+
|
137 |
+
### Discussion of Biases
|
138 |
+
|
139 |
+
[More Information Needed]
|
140 |
+
|
141 |
+
### Other Known Limitations
|
142 |
+
|
143 |
+
[More Information Needed]
|
144 |
+
|
145 |
+
## Additional Information
|
146 |
+
|
147 |
+
### Dataset Curators
|
148 |
+
|
149 |
+
The annotated data sets were developed by students of Saarland University, Saarbrücken, Germany .
|
150 |
+
|
151 |
+
|
152 |
+
### Licensing Information
|
153 |
+
|
154 |
+
The data is under the [Creative Commons Attribution 3.0 ](https://creativecommons.org/licenses/by/3.0/)
|
155 |
+
|
156 |
+
### Citation Information
|
157 |
+
```
|
158 |
+
@inproceedings{alabi-etal-2020-massive,
|
159 |
+
title = "Massive vs. Curated Embeddings for Low-Resourced Languages: the Case of {Y}or{\`u}b{\'a} and {T}wi",
|
160 |
+
author = "Alabi, Jesujoba and
|
161 |
+
Amponsah-Kaakyire, Kwabena and
|
162 |
+
Adelani, David and
|
163 |
+
Espa{\~n}a-Bonet, Cristina",
|
164 |
+
booktitle = "Proceedings of the 12th Language Resources and Evaluation Conference",
|
165 |
+
month = may,
|
166 |
+
year = "2020",
|
167 |
+
address = "Marseille, France",
|
168 |
+
publisher = "European Language Resources Association",
|
169 |
+
url = "https://www.aclweb.org/anthology/2020.lrec-1.335",
|
170 |
+
pages = "2754--2762",
|
171 |
+
language = "English",
|
172 |
+
ISBN = "979-10-95546-34-4",
|
173 |
+
}
|
174 |
+
```
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
{"yoruba_gv_ner": {"description": "The Yoruba GV NER dataset is a labeled dataset for named entity recognition in Yoruba. The texts were obtained from\nYoruba Global Voices News articles https://yo.globalvoices.org/ . We concentrate on\nfour types of named entities: persons [PER], locations [LOC], organizations [ORG], and dates & time [DATE].\n\nThe Yoruba GV NER data files contain 2 columns separated by a tab ('\t'). Each word has been put on a separate line and\nthere is an empty line after each sentences i.e the CoNLL format. The first item on each line is a word, the second\nis the named entity tag. The named entity tags have the format I-TYPE which means that the word is inside a phrase\nof type TYPE. For every multi-word expression like 'New York', the first word gets a tag B-TYPE and the subsequent words\nhave tags I-TYPE, a word with tag O is not part of a phrase. The dataset is in the BIO tagging scheme.\n\nFor more details, see https://www.aclweb.org/anthology/2020.lrec-1.335/\n", "citation": "@inproceedings{alabi-etal-2020-massive,\n title = \"Massive vs. Curated Embeddings for Low-Resourced Languages: the Case of {Yor\u00f9b\u00e1} and {T}wi\",\n author = \"Alabi, Jesujoba and\n Amponsah-Kaakyire, Kwabena and\n Adelani, David and\n Espa{\\~n}a-Bonet, Cristina\",\n booktitle = \"Proceedings of the 12th Language Resources and Evaluation Conference\",\n month = may,\n year = \"2020\",\n address = \"Marseille, France\",\n publisher = \"European Language Resources Association\",\n url = \"https://www.aclweb.org/anthology/2020.lrec-1.335\",\n pages = \"2754--2762\",\n language = \"English\",\n ISBN = \"979-10-95546-34-4\",\n}\n", "homepage": "https://www.aclweb.org/anthology/2020.lrec-1.335/", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "ner_tags": {"feature": {"num_classes": 9, "names": ["O", "B-PER", "I-PER", "B-ORG", "I-ORG", "B-LOC", "I-LOC", "B-DATE", "I-DATE"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "yoruba_gv_ner", "config_name": "yoruba_gv_ner", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 358885, "num_examples": 817, "dataset_name": "yoruba_gv_ner"}, "validation": {"name": "validation", "num_bytes": 50161, "num_examples": 117, "dataset_name": "yoruba_gv_ner"}, "test": {"name": "test", "num_bytes": 96518, "num_examples": 237, "dataset_name": "yoruba_gv_ner"}}, "download_checksums": {"https://github.com/ajesujoba/YorubaTwi-Embedding/raw/master/Yoruba/Yoruba-NER/train.tsv": {"num_bytes": 180612, "checksum": "7479c7a8eb7a576b7d38bcc740c50af10c2b452e81e6d3788fe48ace1e1c94f7"}, "https://github.com/ajesujoba/YorubaTwi-Embedding/raw/master/Yoruba/Yoruba-NER/valid.tsv": {"num_bytes": 25701, "checksum": "da82cc5bbdf4084d39089b6ca381eb3f9af1639b4ec4782dffc0824e0854e6be"}, "https://github.com/ajesujoba/YorubaTwi-Embedding/raw/master/Yoruba/Yoruba-NER/test.tsv": {"num_bytes": 48034, "checksum": "d20485e56ab680ba7216c212dd680a35d91217175600d0d2aec1b03d593fffe4"}}, "download_size": 254347, "post_processing_size": null, "dataset_size": 505564, "size_in_bytes": 759911}}
|
dummy/yoruba_gv_ner/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3b38139d90e6afabee5449ad99abb18eb9c0453bab0bd73e167a3ac4d72459aa
|
3 |
+
size 614
|
yoruba_gv_ner.py
ADDED
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
|
16 |
+
"""Introduction to the Yoruba GV NER dataset: A Yoruba Global Voices (News) Named Entity Recognition Dataset"""
|
17 |
+
|
18 |
+
|
19 |
+
from __future__ import absolute_import, division, print_function
|
20 |
+
|
21 |
+
import logging
|
22 |
+
|
23 |
+
import datasets
|
24 |
+
|
25 |
+
|
26 |
+
# TODO: Add BibTeX citation
|
27 |
+
# Find for instance the citation on arxiv or on the dataset repo/website
|
28 |
+
_CITATION = """\
|
29 |
+
@inproceedings{alabi-etal-2020-massive,
|
30 |
+
title = "Massive vs. Curated Embeddings for Low-Resourced Languages: the Case of {Yorùbá} and {T}wi",
|
31 |
+
author = "Alabi, Jesujoba and
|
32 |
+
Amponsah-Kaakyire, Kwabena and
|
33 |
+
Adelani, David and
|
34 |
+
Espa{\\~n}a-Bonet, Cristina",
|
35 |
+
booktitle = "Proceedings of the 12th Language Resources and Evaluation Conference",
|
36 |
+
month = may,
|
37 |
+
year = "2020",
|
38 |
+
address = "Marseille, France",
|
39 |
+
publisher = "European Language Resources Association",
|
40 |
+
url = "https://www.aclweb.org/anthology/2020.lrec-1.335",
|
41 |
+
pages = "2754--2762",
|
42 |
+
language = "English",
|
43 |
+
ISBN = "979-10-95546-34-4",
|
44 |
+
}
|
45 |
+
"""
|
46 |
+
|
47 |
+
# TODO: Add description of the dataset here
|
48 |
+
# You can copy an official description
|
49 |
+
_DESCRIPTION = """\
|
50 |
+
The Yoruba GV NER dataset is a labeled dataset for named entity recognition in Yoruba. The texts were obtained from
|
51 |
+
Yoruba Global Voices News articles https://yo.globalvoices.org/ . We concentrate on
|
52 |
+
four types of named entities: persons [PER], locations [LOC], organizations [ORG], and dates & time [DATE].
|
53 |
+
|
54 |
+
The Yoruba GV NER data files contain 2 columns separated by a tab ('\t'). Each word has been put on a separate line and
|
55 |
+
there is an empty line after each sentences i.e the CoNLL format. The first item on each line is a word, the second
|
56 |
+
is the named entity tag. The named entity tags have the format I-TYPE which means that the word is inside a phrase
|
57 |
+
of type TYPE. For every multi-word expression like 'New York', the first word gets a tag B-TYPE and the subsequent words
|
58 |
+
have tags I-TYPE, a word with tag O is not part of a phrase. The dataset is in the BIO tagging scheme.
|
59 |
+
|
60 |
+
For more details, see https://www.aclweb.org/anthology/2020.lrec-1.335/
|
61 |
+
"""
|
62 |
+
|
63 |
+
_URL = "https://github.com/ajesujoba/YorubaTwi-Embedding/raw/master/Yoruba/Yoruba-NER/"
|
64 |
+
_TRAINING_FILE = "train.tsv"
|
65 |
+
_DEV_FILE = "valid.tsv"
|
66 |
+
_TEST_FILE = "test.tsv"
|
67 |
+
|
68 |
+
|
69 |
+
class YorubaGvNerConfig(datasets.BuilderConfig):
|
70 |
+
"""BuilderConfig for YorubaGvNer"""
|
71 |
+
|
72 |
+
def __init__(self, **kwargs):
|
73 |
+
"""BuilderConfig for YorubaGvNer.
|
74 |
+
Args:
|
75 |
+
**kwargs: keyword arguments forwarded to super.
|
76 |
+
"""
|
77 |
+
super(YorubaGvNerConfig, self).__init__(**kwargs)
|
78 |
+
|
79 |
+
|
80 |
+
class YorubaGvNer(datasets.GeneratorBasedBuilder):
|
81 |
+
"""Yoruba GV NER dataset."""
|
82 |
+
|
83 |
+
BUILDER_CONFIGS = [
|
84 |
+
YorubaGvNerConfig(
|
85 |
+
name="yoruba_gv_ner", version=datasets.Version("1.0.0"), description="Yoruba GV NER dataset"
|
86 |
+
),
|
87 |
+
]
|
88 |
+
|
89 |
+
def _info(self):
|
90 |
+
return datasets.DatasetInfo(
|
91 |
+
description=_DESCRIPTION,
|
92 |
+
features=datasets.Features(
|
93 |
+
{
|
94 |
+
"id": datasets.Value("string"),
|
95 |
+
"tokens": datasets.Sequence(datasets.Value("string")),
|
96 |
+
"ner_tags": datasets.Sequence(
|
97 |
+
datasets.features.ClassLabel(
|
98 |
+
names=[
|
99 |
+
"O",
|
100 |
+
"B-PER",
|
101 |
+
"I-PER",
|
102 |
+
"B-ORG",
|
103 |
+
"I-ORG",
|
104 |
+
"B-LOC",
|
105 |
+
"I-LOC",
|
106 |
+
"B-DATE",
|
107 |
+
"I-DATE",
|
108 |
+
]
|
109 |
+
)
|
110 |
+
),
|
111 |
+
}
|
112 |
+
),
|
113 |
+
supervised_keys=None,
|
114 |
+
homepage="https://www.aclweb.org/anthology/2020.lrec-1.335/",
|
115 |
+
citation=_CITATION,
|
116 |
+
)
|
117 |
+
|
118 |
+
def _split_generators(self, dl_manager):
|
119 |
+
"""Returns SplitGenerators."""
|
120 |
+
urls_to_download = {
|
121 |
+
"train": f"{_URL}{_TRAINING_FILE}",
|
122 |
+
"dev": f"{_URL}{_DEV_FILE}",
|
123 |
+
"test": f"{_URL}{_TEST_FILE}",
|
124 |
+
}
|
125 |
+
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
126 |
+
|
127 |
+
return [
|
128 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
|
129 |
+
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["dev"]}),
|
130 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"]}),
|
131 |
+
]
|
132 |
+
|
133 |
+
def _generate_examples(self, filepath):
|
134 |
+
logging.info("⏳ Generating examples from = %s", filepath)
|
135 |
+
with open(filepath, encoding="utf-8") as f:
|
136 |
+
guid = 0
|
137 |
+
tokens = []
|
138 |
+
ner_tags = []
|
139 |
+
for line in f:
|
140 |
+
line = line.strip()
|
141 |
+
if line.startswith("-DOCSTART-") or line == "" or line == "\n":
|
142 |
+
if tokens:
|
143 |
+
yield guid, {
|
144 |
+
"id": str(guid),
|
145 |
+
"tokens": tokens,
|
146 |
+
"ner_tags": ner_tags,
|
147 |
+
}
|
148 |
+
guid += 1
|
149 |
+
tokens = []
|
150 |
+
ner_tags = []
|
151 |
+
else:
|
152 |
+
# yoruba_gv_ner tokens are tab separated
|
153 |
+
splits = line.strip().split("\t")
|
154 |
+
tokens.append(splits[0])
|
155 |
+
ner_tags.append(splits[1].rstrip())
|
156 |
+
# last example
|
157 |
+
yield guid, {
|
158 |
+
"id": str(guid),
|
159 |
+
"tokens": tokens,
|
160 |
+
"ner_tags": ner_tags,
|
161 |
+
}
|