Convert dataset to Parquet

#1
by kensible - opened
README.md CHANGED
@@ -17,6 +17,37 @@ task_categories:
17
  - translation
18
  task_ids: []
19
  paperswithcode_id: iwslt-2014
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  ---
21
 
22
  # Dataset Card for IWSLT 2014
 
17
  - translation
18
  task_ids: []
19
  paperswithcode_id: iwslt-2014
20
+ configs:
21
+ - config_name: de-en
22
+ data_files:
23
+ - split: train
24
+ path: de-en/train-*
25
+ - split: test
26
+ path: de-en/test-*
27
+ - split: validation
28
+ path: de-en/validation-*
29
+ default: true
30
+ dataset_info:
31
+ config_name: de-en
32
+ features:
33
+ - name: translation
34
+ dtype:
35
+ translation:
36
+ languages:
37
+ - de
38
+ - en
39
+ splits:
40
+ - name: train
41
+ num_bytes: 33643124
42
+ num_examples: 160239
43
+ - name: test
44
+ num_bytes: 1355486
45
+ num_examples: 6750
46
+ - name: validation
47
+ num_bytes: 1520934
48
+ num_examples: 7283
49
+ download_size: 22338070
50
+ dataset_size: 36519544
51
  ---
52
 
53
  # Dataset Card for IWSLT 2014
data/de-en.zip → de-en/test-00000-of-00001.parquet RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:f8a123c4ca711f82326f03b95acffe7eee52293700e1558213ea894c6e6e35bd
3
- size 12611900
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bd7812be67b8f48f355674032bf33e1eafd1944f55857982bad6b5d60477d0fc
3
+ size 817700
de-en/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:20d74869deef6aa1d82c605c72a9e6e5c4fb8a82960b1f404a866c70ef487ef6
3
+ size 20505746
de-en/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0b7e2c29620edc716e2993005c84ac72710088ad96ddcde4e6553180043b902d
3
+ size 1014624
iwslt14-de-en.py DELETED
@@ -1,183 +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
- """IWSLT 2017 dataset """
16
-
17
-
18
- import os
19
-
20
- import datasets
21
-
22
-
23
- _HOMEPAGE = "https://sites.google.com/site/iwsltevaluation2017/TED-tasks"
24
-
25
- _DESCRIPTION = """\
26
- The IWSLT 2017 Multilingual Task addresses text translation, including zero-shot translation, with a single MT system across all directions including English, German, Dutch, Italian and Romanian. As unofficial task, conventional bilingual text translation is offered between English and Arabic, French, Japanese, Chinese, German and Korean.
27
- """
28
-
29
- _CITATION = """\
30
- @inproceedings{cettolo-etal-2017-overview,
31
- title = "Overview of the {IWSLT} 2017 Evaluation Campaign",
32
- author = {Cettolo, Mauro and
33
- Federico, Marcello and
34
- Bentivogli, Luisa and
35
- Niehues, Jan and
36
- St{\\"u}ker, Sebastian and
37
- Sudoh, Katsuhito and
38
- Yoshino, Koichiro and
39
- Federmann, Christian},
40
- booktitle = "Proceedings of the 14th International Conference on Spoken Language Translation",
41
- month = dec # " 14-15",
42
- year = "2017",
43
- address = "Tokyo, Japan",
44
- publisher = "International Workshop on Spoken Language Translation",
45
- url = "https://aclanthology.org/2017.iwslt-1.1",
46
- pages = "2--14",
47
- }
48
- """
49
-
50
- REPO_URL = "https://huggingface.co/datasets/bbaaaa/iwslt14-de-en/resolve/main/"
51
- URL = REPO_URL + "data/de-en.zip"
52
-
53
-
54
- class IWSLT2017Config(datasets.BuilderConfig):
55
- """BuilderConfig for NewDataset"""
56
-
57
- def __init__(self, pair, **kwargs):
58
- """
59
-
60
- Args:
61
- pair: the language pair to consider
62
- is_multilingual: Is this pair in the multilingual dataset (download source is different)
63
- **kwargs: keyword arguments forwarded to super.
64
- """
65
- self.pair = pair
66
- super().__init__(**kwargs)
67
-
68
-
69
- class IWSLT2017(datasets.GeneratorBasedBuilder):
70
- """The IWSLT 2017 Evaluation Campaign includes a multilingual TED Talks MT task."""
71
-
72
- VERSION = datasets.Version("1.0.0")
73
-
74
- # This is an example of a dataset with multiple configurations.
75
- # If you don't want/need to define several sub-sets in your dataset,
76
- # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
77
- BUILDER_CONFIG_CLASS = IWSLT2017Config
78
- BUILDER_CONFIGS = [
79
- IWSLT2017Config(
80
- name="de-en",
81
- description="A small dataset",
82
- version=datasets.Version("1.0.0"),
83
- pair='de-en',
84
- )
85
- ]
86
-
87
- def _info(self):
88
- return datasets.DatasetInfo(
89
- description=_DESCRIPTION,
90
- features=datasets.Features(
91
- {"translation": datasets.features.Translation(languages=self.config.pair.split("-"))}
92
- ),
93
- homepage=_HOMEPAGE,
94
- citation=_CITATION,
95
- )
96
-
97
- def _split_generators(self, dl_manager):
98
- """Returns SplitGenerators."""
99
- source, target = self.config.pair.split("-")
100
- bi_url = URL
101
- dl_dir = dl_manager.download_and_extract(bi_url)
102
- data_dir = os.path.join(dl_dir, f"{source}-{target}")
103
- return [
104
- datasets.SplitGenerator(
105
- name=datasets.Split.TRAIN,
106
- gen_kwargs={
107
- "source_files": [
108
- os.path.join(
109
- data_dir,
110
- f"train.{source}",
111
- )
112
- ],
113
- "target_files": [
114
- os.path.join(
115
- data_dir,
116
- f"train.{target}",
117
- )
118
- ],
119
- },
120
- ),
121
- datasets.SplitGenerator(
122
- name=datasets.Split.TEST,
123
- gen_kwargs={
124
- "source_files": [
125
- os.path.join(
126
- data_dir,
127
- f"test.{source}",
128
- )
129
- ],
130
- "target_files": [
131
- os.path.join(
132
- data_dir,
133
- f"test.{target}",
134
- )
135
- ],
136
- },
137
- ),
138
- datasets.SplitGenerator(
139
- name=datasets.Split.VALIDATION,
140
- gen_kwargs={
141
- "source_files": [
142
- os.path.join(
143
- data_dir,
144
- f"valid.{source}",
145
- )
146
- ],
147
- "target_files": [
148
- os.path.join(
149
- data_dir,
150
- f"valid.{target}",
151
- )
152
- ],
153
- },
154
- ),
155
- ]
156
-
157
- def _generate_examples(self, source_files, target_files):
158
- """Yields examples."""
159
- id_ = 0
160
- source, target = self.config.pair.split("-")
161
- for source_file, target_file in zip(source_files, target_files):
162
- with open(source_file, "r", encoding="utf-8") as sf:
163
- with open(target_file, "r", encoding="utf-8") as tf:
164
- for source_row, target_row in zip(sf, tf):
165
- source_row = source_row.strip()
166
- target_row = target_row.strip()
167
-
168
- if source_row.startswith("<"):
169
- if source_row.startswith("<seg"):
170
- # Remove <seg id="1">.....</seg>
171
- # Very simple code instead of regex or xml parsing
172
- part1 = source_row.split(">")[1]
173
- source_row = part1.split("<")[0]
174
- part1 = target_row.split(">")[1]
175
- target_row = part1.split("<")[0]
176
-
177
- source_row = source_row.strip()
178
- target_row = target_row.strip()
179
- else:
180
- continue
181
-
182
- yield id_, {"translation": {source: source_row, target: target_row}}
183
- id_ += 1