Datasets:
parquet-converter
commited on
Commit
•
5652930
1
Parent(s):
5b82b2f
Update parquet files
Browse files- README.md +0 -213
- bible/test/0000.parquet +3 -0
- bible/train/0000.parquet +3 -0
- bible/validation/0000.parquet +3 -0
- dataset_infos.json +0 -1
- um005.py +0 -149
README.md
DELETED
@@ -1,213 +0,0 @@
|
|
1 |
-
---
|
2 |
-
annotations_creators:
|
3 |
-
- no-annotation
|
4 |
-
language_creators:
|
5 |
-
- other
|
6 |
-
language:
|
7 |
-
- en
|
8 |
-
- ur
|
9 |
-
license:
|
10 |
-
- unknown
|
11 |
-
multilinguality:
|
12 |
-
- multilingual
|
13 |
-
size_categories:
|
14 |
-
- 1K<n<10K
|
15 |
-
source_datasets:
|
16 |
-
- original
|
17 |
-
task_categories:
|
18 |
-
- translation
|
19 |
-
task_ids: []
|
20 |
-
paperswithcode_id: umc005-english-urdu
|
21 |
-
pretty_name: UMC005 English-Urdu
|
22 |
-
dataset_info:
|
23 |
-
- config_name: bible
|
24 |
-
features:
|
25 |
-
- name: id
|
26 |
-
dtype: string
|
27 |
-
- name: translation
|
28 |
-
dtype:
|
29 |
-
translation:
|
30 |
-
languages:
|
31 |
-
- ur
|
32 |
-
- en
|
33 |
-
splits:
|
34 |
-
- name: train
|
35 |
-
num_bytes: 2350730
|
36 |
-
num_examples: 7400
|
37 |
-
- name: validation
|
38 |
-
num_bytes: 113476
|
39 |
-
num_examples: 300
|
40 |
-
- name: test
|
41 |
-
num_bytes: 104678
|
42 |
-
num_examples: 257
|
43 |
-
download_size: 3683565
|
44 |
-
dataset_size: 2568884
|
45 |
-
- config_name: quran
|
46 |
-
features:
|
47 |
-
- name: id
|
48 |
-
dtype: string
|
49 |
-
- name: translation
|
50 |
-
dtype:
|
51 |
-
translation:
|
52 |
-
languages:
|
53 |
-
- ur
|
54 |
-
- en
|
55 |
-
splits:
|
56 |
-
- name: train
|
57 |
-
num_bytes: 2929711
|
58 |
-
num_examples: 6000
|
59 |
-
- name: validation
|
60 |
-
num_bytes: 43499
|
61 |
-
num_examples: 214
|
62 |
-
- name: test
|
63 |
-
num_bytes: 44413
|
64 |
-
num_examples: 200
|
65 |
-
download_size: 3683565
|
66 |
-
dataset_size: 3017623
|
67 |
-
- config_name: all
|
68 |
-
features:
|
69 |
-
- name: id
|
70 |
-
dtype: string
|
71 |
-
- name: translation
|
72 |
-
dtype:
|
73 |
-
translation:
|
74 |
-
languages:
|
75 |
-
- ur
|
76 |
-
- en
|
77 |
-
splits:
|
78 |
-
- name: train
|
79 |
-
num_bytes: 5280441
|
80 |
-
num_examples: 13400
|
81 |
-
- name: validation
|
82 |
-
num_bytes: 156963
|
83 |
-
num_examples: 514
|
84 |
-
- name: test
|
85 |
-
num_bytes: 149079
|
86 |
-
num_examples: 457
|
87 |
-
download_size: 3683565
|
88 |
-
dataset_size: 5586483
|
89 |
-
---
|
90 |
-
|
91 |
-
# Dataset Card for UMC005 English-Urdu
|
92 |
-
|
93 |
-
## Table of Contents
|
94 |
-
- [Dataset Description](#dataset-description)
|
95 |
-
- [Dataset Summary](#dataset-summary)
|
96 |
-
- [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
|
97 |
-
- [Languages](#languages)
|
98 |
-
- [Dataset Structure](#dataset-structure)
|
99 |
-
- [Data Instances](#data-instances)
|
100 |
-
- [Data Fields](#data-fields)
|
101 |
-
- [Data Splits](#data-splits)
|
102 |
-
- [Dataset Creation](#dataset-creation)
|
103 |
-
- [Curation Rationale](#curation-rationale)
|
104 |
-
- [Source Data](#source-data)
|
105 |
-
- [Annotations](#annotations)
|
106 |
-
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
107 |
-
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
108 |
-
- [Social Impact of Dataset](#social-impact-of-dataset)
|
109 |
-
- [Discussion of Biases](#discussion-of-biases)
|
110 |
-
- [Other Known Limitations](#other-known-limitations)
|
111 |
-
- [Additional Information](#additional-information)
|
112 |
-
- [Dataset Curators](#dataset-curators)
|
113 |
-
- [Licensing Information](#licensing-information)
|
114 |
-
- [Citation Information](#citation-information)
|
115 |
-
- [Contributions](#contributions)
|
116 |
-
|
117 |
-
## Dataset Description
|
118 |
-
|
119 |
-
- **Homepage:** http://ufal.ms.mff.cuni.cz/umc/005-en-ur/
|
120 |
-
- **Repository:** None
|
121 |
-
- **Paper:** https://www.researchgate.net/publication/268008206_Word-Order_Issues_in_English-to-Urdu_Statistical_Machine_Translation
|
122 |
-
- **Leaderboard:** [If the dataset supports an active leaderboard, add link here]()
|
123 |
-
- **Point of Contact:** Bushra Jawaid and Daniel Zeman
|
124 |
-
|
125 |
-
### Dataset Summary
|
126 |
-
|
127 |
-
[More Information Needed]
|
128 |
-
|
129 |
-
### Supported Tasks and Leaderboards
|
130 |
-
|
131 |
-
[More Information Needed]
|
132 |
-
|
133 |
-
### Languages
|
134 |
-
|
135 |
-
[More Information Needed]
|
136 |
-
|
137 |
-
## Dataset Structure
|
138 |
-
|
139 |
-
### Data Instances
|
140 |
-
|
141 |
-
[More Information Needed]
|
142 |
-
|
143 |
-
### Data Fields
|
144 |
-
|
145 |
-
[More Information Needed]
|
146 |
-
|
147 |
-
### Data Splits
|
148 |
-
|
149 |
-
[More Information Needed]
|
150 |
-
## Dataset Creation
|
151 |
-
|
152 |
-
### Curation Rationale
|
153 |
-
|
154 |
-
[More Information Needed]
|
155 |
-
|
156 |
-
### Source Data
|
157 |
-
|
158 |
-
[More Information Needed]
|
159 |
-
|
160 |
-
#### Initial Data Collection and Normalization
|
161 |
-
|
162 |
-
[More Information Needed]
|
163 |
-
|
164 |
-
#### Who are the source language producers?
|
165 |
-
|
166 |
-
[More Information Needed]
|
167 |
-
|
168 |
-
### Annotations
|
169 |
-
|
170 |
-
[More Information Needed]
|
171 |
-
|
172 |
-
#### Annotation process
|
173 |
-
|
174 |
-
[More Information Needed]
|
175 |
-
|
176 |
-
#### Who are the annotators?
|
177 |
-
|
178 |
-
[More Information Needed]
|
179 |
-
|
180 |
-
### Personal and Sensitive Information
|
181 |
-
|
182 |
-
[More Information Needed]
|
183 |
-
|
184 |
-
## Considerations for Using the Data
|
185 |
-
|
186 |
-
### Social Impact of Dataset
|
187 |
-
|
188 |
-
[More Information Needed]
|
189 |
-
|
190 |
-
### Discussion of Biases
|
191 |
-
|
192 |
-
[More Information Needed]
|
193 |
-
|
194 |
-
### Other Known Limitations
|
195 |
-
|
196 |
-
[More Information Needed]
|
197 |
-
|
198 |
-
## Additional Information
|
199 |
-
|
200 |
-
### Dataset Curators
|
201 |
-
|
202 |
-
[More Information Needed]
|
203 |
-
|
204 |
-
### Licensing Information
|
205 |
-
|
206 |
-
[More Information Needed]
|
207 |
-
|
208 |
-
### Citation Information
|
209 |
-
|
210 |
-
[More Information Needed]
|
211 |
-
### Contributions
|
212 |
-
|
213 |
-
Thanks to [@abhishekkrthakur](https://github.com/abhishekkrthakur) for adding this dataset.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bible/test/0000.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bab87966e46e38c934f89f57a9016f390d18c1f9f3210080123a2efe97747eae
|
3 |
+
size 51924
|
bible/train/0000.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:17398c01e8f828b3a1909255fb626cc18bfc88f25acf4fcdc07ef96cd33f6d44
|
3 |
+
size 1171873
|
bible/validation/0000.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f8f44672ec813774bae5590867744767213504037effe3e9cf418f40f924b8e4
|
3 |
+
size 56167
|
dataset_infos.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"bible": {"description": "UMC005 English-Urdu is a parallel corpus of texts in English and Urdu language with sentence alignments. The corpus can be used for experiments with statistical machine translation.\n\nThe texts come from four different sources:\n- Quran\n- Bible\n- Penn Treebank (Wall Street Journal)\n- Emille corpus\n\nThe authors provide the religious texts of Quran and Bible for direct download. Because of licensing reasons, Penn and Emille texts cannot be redistributed freely. However, if you already hold a license for the original corpora, we are able to provide scripts that will recreate our data on your disk. Our modifications include but are not limited to the following:\n\n- Correction of Urdu translations and manual sentence alignment of the Emille texts.\n- Manually corrected sentence alignment of the other corpora.\n- Our data split (training-development-test) so that our published experiments can be reproduced.\n- Tokenization (optional, but needed to reproduce our experiments).\n- Normalization (optional) of e.g. European vs. Urdu numerals, European vs. Urdu punctuation, removal of Urdu diacritics.\n", "citation": "@unpublished{JaZeWordOrderIssues2011,\nauthor = {Bushra Jawaid and Daniel Zeman},\ntitle = {Word-Order Issues in {English}-to-{Urdu} Statistical Machine Translation},\nyear = {2011},\njournal = {The Prague Bulletin of Mathematical Linguistics},\nnumber = {95},\ninstitution = {Univerzita Karlova},\naddress = {Praha, Czechia},\nissn = {0032-6585},\n}\n", "homepage": "http://ufal.ms.mff.cuni.cz/umc/005-en-ur/", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["ur", "en"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "u_m005", "config_name": "bible", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 2350730, "num_examples": 7400, "dataset_name": "u_m005"}, "validation": {"name": "validation", "num_bytes": 113476, "num_examples": 300, "dataset_name": "u_m005"}, "test": {"name": "test", "num_bytes": 104678, "num_examples": 257, "dataset_name": "u_m005"}}, "download_checksums": {"http://ufal.ms.mff.cuni.cz/umc/005-en-ur/download.php?f=umc005-corpus.zip": {"num_bytes": 3683565, "checksum": "6c09c759125c513ee16f06705475140e7738eae5c01c3d7a1198582e9f5a0998"}}, "download_size": 3683565, "post_processing_size": null, "dataset_size": 2568884, "size_in_bytes": 6252449}, "quran": {"description": "UMC005 English-Urdu is a parallel corpus of texts in English and Urdu language with sentence alignments. The corpus can be used for experiments with statistical machine translation.\n\nThe texts come from four different sources:\n- Quran\n- Bible\n- Penn Treebank (Wall Street Journal)\n- Emille corpus\n\nThe authors provide the religious texts of Quran and Bible for direct download. Because of licensing reasons, Penn and Emille texts cannot be redistributed freely. However, if you already hold a license for the original corpora, we are able to provide scripts that will recreate our data on your disk. Our modifications include but are not limited to the following:\n\n- Correction of Urdu translations and manual sentence alignment of the Emille texts.\n- Manually corrected sentence alignment of the other corpora.\n- Our data split (training-development-test) so that our published experiments can be reproduced.\n- Tokenization (optional, but needed to reproduce our experiments).\n- Normalization (optional) of e.g. European vs. Urdu numerals, European vs. Urdu punctuation, removal of Urdu diacritics.\n", "citation": "@unpublished{JaZeWordOrderIssues2011,\nauthor = {Bushra Jawaid and Daniel Zeman},\ntitle = {Word-Order Issues in {English}-to-{Urdu} Statistical Machine Translation},\nyear = {2011},\njournal = {The Prague Bulletin of Mathematical Linguistics},\nnumber = {95},\ninstitution = {Univerzita Karlova},\naddress = {Praha, Czechia},\nissn = {0032-6585},\n}\n", "homepage": "http://ufal.ms.mff.cuni.cz/umc/005-en-ur/", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["ur", "en"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "u_m005", "config_name": "quran", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 2929711, "num_examples": 6000, "dataset_name": "u_m005"}, "validation": {"name": "validation", "num_bytes": 43499, "num_examples": 214, "dataset_name": "u_m005"}, "test": {"name": "test", "num_bytes": 44413, "num_examples": 200, "dataset_name": "u_m005"}}, "download_checksums": {"http://ufal.ms.mff.cuni.cz/umc/005-en-ur/download.php?f=umc005-corpus.zip": {"num_bytes": 3683565, "checksum": "6c09c759125c513ee16f06705475140e7738eae5c01c3d7a1198582e9f5a0998"}}, "download_size": 3683565, "post_processing_size": null, "dataset_size": 3017623, "size_in_bytes": 6701188}, "all": {"description": "UMC005 English-Urdu is a parallel corpus of texts in English and Urdu language with sentence alignments. The corpus can be used for experiments with statistical machine translation.\n\nThe texts come from four different sources:\n- Quran\n- Bible\n- Penn Treebank (Wall Street Journal)\n- Emille corpus\n\nThe authors provide the religious texts of Quran and Bible for direct download. Because of licensing reasons, Penn and Emille texts cannot be redistributed freely. However, if you already hold a license for the original corpora, we are able to provide scripts that will recreate our data on your disk. Our modifications include but are not limited to the following:\n\n- Correction of Urdu translations and manual sentence alignment of the Emille texts.\n- Manually corrected sentence alignment of the other corpora.\n- Our data split (training-development-test) so that our published experiments can be reproduced.\n- Tokenization (optional, but needed to reproduce our experiments).\n- Normalization (optional) of e.g. European vs. Urdu numerals, European vs. Urdu punctuation, removal of Urdu diacritics.\n", "citation": "@unpublished{JaZeWordOrderIssues2011,\nauthor = {Bushra Jawaid and Daniel Zeman},\ntitle = {Word-Order Issues in {English}-to-{Urdu} Statistical Machine Translation},\nyear = {2011},\njournal = {The Prague Bulletin of Mathematical Linguistics},\nnumber = {95},\ninstitution = {Univerzita Karlova},\naddress = {Praha, Czechia},\nissn = {0032-6585},\n}\n", "homepage": "http://ufal.ms.mff.cuni.cz/umc/005-en-ur/", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "translation": {"languages": ["ur", "en"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": null, "builder_name": "u_m005", "config_name": "all", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 5280441, "num_examples": 13400, "dataset_name": "u_m005"}, "validation": {"name": "validation", "num_bytes": 156963, "num_examples": 514, "dataset_name": "u_m005"}, "test": {"name": "test", "num_bytes": 149079, "num_examples": 457, "dataset_name": "u_m005"}}, "download_checksums": {"http://ufal.ms.mff.cuni.cz/umc/005-en-ur/download.php?f=umc005-corpus.zip": {"num_bytes": 3683565, "checksum": "6c09c759125c513ee16f06705475140e7738eae5c01c3d7a1198582e9f5a0998"}}, "download_size": 3683565, "post_processing_size": null, "dataset_size": 5586483, "size_in_bytes": 9270048}}
|
|
|
|
um005.py
DELETED
@@ -1,149 +0,0 @@
|
|
1 |
-
# coding=utf-8
|
2 |
-
# Copyright 2020 HuggingFace Datasets Authors.
|
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 |
-
# Lint as: python3
|
17 |
-
import os
|
18 |
-
|
19 |
-
import datasets
|
20 |
-
|
21 |
-
|
22 |
-
_DESCRIPTION = """\
|
23 |
-
UMC005 English-Urdu is a parallel corpus of texts in English and Urdu language with sentence alignments. The corpus can be used for experiments with statistical machine translation.
|
24 |
-
|
25 |
-
The texts come from four different sources:
|
26 |
-
- Quran
|
27 |
-
- Bible
|
28 |
-
- Penn Treebank (Wall Street Journal)
|
29 |
-
- Emille corpus
|
30 |
-
|
31 |
-
The authors provide the religious texts of Quran and Bible for direct download. Because of licensing reasons, Penn and Emille texts cannot be redistributed freely. However, if you already hold a license for the original corpora, we are able to provide scripts that will recreate our data on your disk. Our modifications include but are not limited to the following:
|
32 |
-
|
33 |
-
- Correction of Urdu translations and manual sentence alignment of the Emille texts.
|
34 |
-
- Manually corrected sentence alignment of the other corpora.
|
35 |
-
- Our data split (training-development-test) so that our published experiments can be reproduced.
|
36 |
-
- Tokenization (optional, but needed to reproduce our experiments).
|
37 |
-
- Normalization (optional) of e.g. European vs. Urdu numerals, European vs. Urdu punctuation, removal of Urdu diacritics.
|
38 |
-
"""
|
39 |
-
_HOMEPAGE_URL = "http://ufal.ms.mff.cuni.cz/umc/005-en-ur/"
|
40 |
-
_URL = "http://ufal.ms.mff.cuni.cz/umc/005-en-ur/download.php?f=umc005-corpus.zip"
|
41 |
-
_CITATION = """\
|
42 |
-
@unpublished{JaZeWordOrderIssues2011,
|
43 |
-
author = {Bushra Jawaid and Daniel Zeman},
|
44 |
-
title = {Word-Order Issues in {English}-to-{Urdu} Statistical Machine Translation},
|
45 |
-
year = {2011},
|
46 |
-
journal = {The Prague Bulletin of Mathematical Linguistics},
|
47 |
-
number = {95},
|
48 |
-
institution = {Univerzita Karlova},
|
49 |
-
address = {Praha, Czechia},
|
50 |
-
issn = {0032-6585},
|
51 |
-
}
|
52 |
-
"""
|
53 |
-
|
54 |
-
_ALL = "all"
|
55 |
-
_VERSION = "1.0.0"
|
56 |
-
_SOURCES = ["bible", "quran"]
|
57 |
-
_SOURCES_FILEPATHS = {
|
58 |
-
s: {
|
59 |
-
"train": {"urdu": "train.ur", "english": "train.en"},
|
60 |
-
"dev": {"urdu": "dev.ur", "english": "dev.en"},
|
61 |
-
"test": {"urdu": "test.ur", "english": "test.en"},
|
62 |
-
}
|
63 |
-
for s in _SOURCES
|
64 |
-
}
|
65 |
-
|
66 |
-
|
67 |
-
class UM005Config(datasets.BuilderConfig):
|
68 |
-
def __init__(self, *args, sources=None, **kwargs):
|
69 |
-
super().__init__(*args, version=datasets.Version(_VERSION, ""), **kwargs)
|
70 |
-
self.sources = sources
|
71 |
-
|
72 |
-
@property
|
73 |
-
def language_pair(self):
|
74 |
-
return ("ur", "en")
|
75 |
-
|
76 |
-
|
77 |
-
class UM005(datasets.GeneratorBasedBuilder):
|
78 |
-
BUILDER_CONFIGS = [
|
79 |
-
UM005Config(name=source, sources=[source], description=f"Source: {source}.") for source in _SOURCES
|
80 |
-
] + [
|
81 |
-
UM005Config(
|
82 |
-
name=_ALL,
|
83 |
-
sources=_SOURCES,
|
84 |
-
description="All sources included: bible, quran",
|
85 |
-
)
|
86 |
-
]
|
87 |
-
BUILDER_CONFIG_CLASS = UM005Config
|
88 |
-
DEFAULT_CONFIG_NAME = _ALL
|
89 |
-
|
90 |
-
def _info(self):
|
91 |
-
return datasets.DatasetInfo(
|
92 |
-
description=_DESCRIPTION,
|
93 |
-
features=datasets.Features(
|
94 |
-
{
|
95 |
-
"id": datasets.Value("string"),
|
96 |
-
"translation": datasets.Translation(languages=self.config.language_pair),
|
97 |
-
},
|
98 |
-
),
|
99 |
-
supervised_keys=None,
|
100 |
-
homepage=_HOMEPAGE_URL,
|
101 |
-
citation=_CITATION,
|
102 |
-
)
|
103 |
-
|
104 |
-
def _split_generators(self, dl_manager):
|
105 |
-
path = dl_manager.download_and_extract(_URL)
|
106 |
-
return [
|
107 |
-
datasets.SplitGenerator(
|
108 |
-
name=datasets.Split.TRAIN,
|
109 |
-
gen_kwargs={"datapath": path, "datatype": "train"},
|
110 |
-
),
|
111 |
-
datasets.SplitGenerator(
|
112 |
-
name=datasets.Split.VALIDATION,
|
113 |
-
gen_kwargs={"datapath": path, "datatype": "dev"},
|
114 |
-
),
|
115 |
-
datasets.SplitGenerator(
|
116 |
-
name=datasets.Split.TEST,
|
117 |
-
gen_kwargs={"datapath": path, "datatype": "test"},
|
118 |
-
),
|
119 |
-
]
|
120 |
-
|
121 |
-
def _generate_examples(self, datapath, datatype):
|
122 |
-
if datatype == "train":
|
123 |
-
ur_file = "train.ur"
|
124 |
-
en_file = "train.en"
|
125 |
-
elif datatype == "dev":
|
126 |
-
ur_file = "dev.ur"
|
127 |
-
en_file = "dev.en"
|
128 |
-
elif datatype == "test":
|
129 |
-
ur_file = "test.ur"
|
130 |
-
en_file = "test.en"
|
131 |
-
else:
|
132 |
-
raise Exception("Invalid dataype. Try one of: dev, train, test")
|
133 |
-
|
134 |
-
for source in self.config.sources:
|
135 |
-
urdu_path = os.path.join(datapath, source, ur_file)
|
136 |
-
english_path = os.path.join(datapath, source, en_file)
|
137 |
-
with open(urdu_path, encoding="utf-8") as u, open(english_path, encoding="utf-8") as e:
|
138 |
-
for sentence_counter, (x, y) in enumerate(zip(u, e)):
|
139 |
-
x = x.strip()
|
140 |
-
y = y.strip()
|
141 |
-
result = (
|
142 |
-
sentence_counter,
|
143 |
-
{
|
144 |
-
"id": str(sentence_counter),
|
145 |
-
"translation": {"ur": x, "en": y},
|
146 |
-
},
|
147 |
-
)
|
148 |
-
sentence_counter += 1
|
149 |
-
yield result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|