theyorubayesian
commited on
Commit
•
cbaa143
1
Parent(s):
21e7529
add translated dataset
Browse files
.gitattributes
CHANGED
@@ -58,3 +58,7 @@ passages-v1.0/yoruba_passages.jsonl filter=lfs diff=lfs merge=lfs -text
|
|
58 |
passages-v1.0/hausa_passages.jsonl filter=lfs diff=lfs merge=lfs -text
|
59 |
passages-v1.0/somali_passages.jsonl filter=lfs diff=lfs merge=lfs -text
|
60 |
passages-v1.0/swahili_passages.jsonl filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
58 |
passages-v1.0/hausa_passages.jsonl filter=lfs diff=lfs merge=lfs -text
|
59 |
passages-v1.0/somali_passages.jsonl filter=lfs diff=lfs merge=lfs -text
|
60 |
passages-v1.0/swahili_passages.jsonl filter=lfs diff=lfs merge=lfs -text
|
61 |
+
translated-passages-v1.0/hausa_passages.jsonl filter=lfs diff=lfs merge=lfs -text
|
62 |
+
translated-passages-v1.0/somali_passages.jsonl filter=lfs diff=lfs merge=lfs -text
|
63 |
+
translated-passages-v1.0/swahili_passages.jsonl filter=lfs diff=lfs merge=lfs -text
|
64 |
+
translated-passages-v1.0/yoruba_passages.jsonl filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
@@ -45,6 +45,16 @@ language = "hausa"
|
|
45 |
dataset = load_dataset("ciral/ciral-corpus", language)
|
46 |
```
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
## Citation
|
49 |
|
50 |
...
|
|
|
45 |
dataset = load_dataset("ciral/ciral-corpus", language)
|
46 |
```
|
47 |
|
48 |
+
## Translated Dataset
|
49 |
+
|
50 |
+
We also include a translated version of the dataset for all the languages. Translation was done using Google Machine Translation (GMT).
|
51 |
+
|
52 |
+
```python
|
53 |
+
language = "hausa"
|
54 |
+
|
55 |
+
dataset = load_dataset("ciral/ciral-corpus", language, translated=True)
|
56 |
+
```
|
57 |
+
|
58 |
## Citation
|
59 |
|
60 |
...
|
ciral-corpus.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import json
|
|
|
2 |
from string import Template
|
3 |
|
4 |
import datasets
|
@@ -18,12 +19,27 @@ _LANGUAGES = [
|
|
18 |
"yoruba",
|
19 |
"combined"
|
20 |
]
|
21 |
-
_DATASET_URL = Template("
|
22 |
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
class CiralPassages(datasets.GeneratorBasedBuilder):
|
25 |
BUILDER_CONFIGS = [
|
26 |
-
|
27 |
version=datasets.Version(_VERSION),
|
28 |
name=language,
|
29 |
description=f"CIRAL passages for language: {language}"
|
@@ -49,7 +65,7 @@ class CiralPassages(datasets.GeneratorBasedBuilder):
|
|
49 |
language = self.config.name
|
50 |
if language == "combined":
|
51 |
language_file = dl_manager.download_and_extract({
|
52 |
-
_language:
|
53 |
for _language in _LANGUAGES[:-1]
|
54 |
})
|
55 |
|
@@ -58,10 +74,9 @@ class CiralPassages(datasets.GeneratorBasedBuilder):
|
|
58 |
name=_language, gen_kwargs={"filepath": language_file[_language]}
|
59 |
) for _language in _LANGUAGES[:-1]
|
60 |
]
|
61 |
-
return splits
|
62 |
else:
|
63 |
language_file = dl_manager.download_and_extract(
|
64 |
-
|
65 |
|
66 |
splits = [
|
67 |
datasets.SplitGenerator(
|
@@ -69,7 +84,8 @@ class CiralPassages(datasets.GeneratorBasedBuilder):
|
|
69 |
gen_kwargs={"filepath": language_file}
|
70 |
)
|
71 |
]
|
72 |
-
|
|
|
73 |
|
74 |
def _generate_examples(self, filepath: str):
|
75 |
with open(filepath, encoding="utf-8") as f:
|
|
|
1 |
import json
|
2 |
+
from dataclasses import dataclass
|
3 |
from string import Template
|
4 |
|
5 |
import datasets
|
|
|
19 |
"yoruba",
|
20 |
"combined"
|
21 |
]
|
22 |
+
_DATASET_URL = Template("./${mode}passages-v1.0/${language}_passages.jsonl")
|
23 |
|
24 |
|
25 |
+
@dataclass
|
26 |
+
class CiralConfig(datasets.BuilderConfig):
|
27 |
+
translated: bool = False
|
28 |
+
file_stub_dict = {
|
29 |
+
None: "",
|
30 |
+
True: "translated-",
|
31 |
+
False: ""
|
32 |
+
}
|
33 |
+
|
34 |
+
def get_file_url(self, language: str) -> str:
|
35 |
+
return _DATASET_URL.substitute(
|
36 |
+
mode=self.file_stub_dict.get(self.translated),
|
37 |
+
language=language
|
38 |
+
)
|
39 |
+
|
40 |
class CiralPassages(datasets.GeneratorBasedBuilder):
|
41 |
BUILDER_CONFIGS = [
|
42 |
+
CiralConfig(
|
43 |
version=datasets.Version(_VERSION),
|
44 |
name=language,
|
45 |
description=f"CIRAL passages for language: {language}"
|
|
|
65 |
language = self.config.name
|
66 |
if language == "combined":
|
67 |
language_file = dl_manager.download_and_extract({
|
68 |
+
_language: self.config.get_file_url(language=_language)
|
69 |
for _language in _LANGUAGES[:-1]
|
70 |
})
|
71 |
|
|
|
74 |
name=_language, gen_kwargs={"filepath": language_file[_language]}
|
75 |
) for _language in _LANGUAGES[:-1]
|
76 |
]
|
|
|
77 |
else:
|
78 |
language_file = dl_manager.download_and_extract(
|
79 |
+
self.config.get_file_url(language=language))
|
80 |
|
81 |
splits = [
|
82 |
datasets.SplitGenerator(
|
|
|
84 |
gen_kwargs={"filepath": language_file}
|
85 |
)
|
86 |
]
|
87 |
+
|
88 |
+
return splits
|
89 |
|
90 |
def _generate_examples(self, filepath: str):
|
91 |
with open(filepath, encoding="utf-8") as f:
|
translated-passages-v1.0/hausa_passages.jsonl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e9c32f6f5d45557fb141dd34fdd0a6ffdf1b2a46d3d38e7cb2a63c7d35ab9737
|
3 |
+
size 600720600
|
translated-passages-v1.0/somali_passages.jsonl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:95ef93c66e93d71e724ee633339f0829cf21d059705ec2353d4ec9b065701ed8
|
3 |
+
size 731277640
|
translated-passages-v1.0/swahili_passages.jsonl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7d3f13d4f0c4e5b231325f5ccb96c9c87d9df137803fabce98a65136c9ac9ade
|
3 |
+
size 860356926
|
translated-passages-v1.0/yoruba_passages.jsonl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:723033805f1bdde16d217efa23d489fd6622c251cb3f34a2f5ff6fb460abaaca
|
3 |
+
size 73743549
|