Commit
•
d76df86
0
Parent(s):
Update files from the datasets library (from 1.5.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.5.0
- .gitattributes +27 -0
- README.md +147 -0
- dataset_infos.json +1 -0
- dummy/ro_sts_parallel/1.0.0/dummy_data.zip +3 -0
- ro_sts_parallel.py +117 -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,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators: []
|
3 |
+
language_creators:
|
4 |
+
- crowdsourced
|
5 |
+
languages:
|
6 |
+
- ro
|
7 |
+
- en
|
8 |
+
licenses:
|
9 |
+
- cc-by-4-0
|
10 |
+
multilinguality:
|
11 |
+
- multilingual
|
12 |
+
size_categories:
|
13 |
+
- 10K<n<100K
|
14 |
+
source_datasets:
|
15 |
+
- extended|other-sts-b
|
16 |
+
task_categories:
|
17 |
+
- conditional-text-generation
|
18 |
+
task_ids:
|
19 |
+
- machine-translation
|
20 |
+
---
|
21 |
+
|
22 |
+
# Dataset Card for RO-STS-Parallel
|
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 |
+
- [Contributions](#contributions)
|
47 |
+
|
48 |
+
## Dataset Description
|
49 |
+
|
50 |
+
- **Homepage:** [GitHub](https://github.com/dumitrescustefan/RO-STS)
|
51 |
+
- **Repository:** [GitHub](https://github.com/dumitrescustefan/RO-STS)
|
52 |
+
- **Paper:** [Needs More Information]
|
53 |
+
- **Leaderboard:** [Needs More Information]
|
54 |
+
- **Point of Contact:** [email protected]
|
55 |
+
|
56 |
+
### Dataset Summary
|
57 |
+
|
58 |
+
We present RO-STS-Parallel - a Parallel Romanian-English dataset obtained by translating the [STS English dataset](https://ixa2.si.ehu.eus/stswiki/index.php/STSbenchmark) dataset into Romanian. It contains 17256 sentences in Romanian and English.
|
59 |
+
|
60 |
+
### Supported Tasks and Leaderboards
|
61 |
+
|
62 |
+
[Needs More Information]
|
63 |
+
|
64 |
+
### Languages
|
65 |
+
|
66 |
+
The text dataset is in Romanian and English (`ro`, `en`)
|
67 |
+
|
68 |
+
## Dataset Structure
|
69 |
+
|
70 |
+
### Data Instances
|
71 |
+
|
72 |
+
An example looks like this:
|
73 |
+
|
74 |
+
```
|
75 |
+
{
|
76 |
+
'translation': {
|
77 |
+
'ro': 'Problema e si mai simpla.',
|
78 |
+
'en': 'The problem is simpler than that.'
|
79 |
+
}
|
80 |
+
}
|
81 |
+
```
|
82 |
+
|
83 |
+
### Data Fields
|
84 |
+
|
85 |
+
- translation:
|
86 |
+
- ro: text in Romanian
|
87 |
+
- en: text in English
|
88 |
+
|
89 |
+
### Data Splits
|
90 |
+
|
91 |
+
The train/validation/test split contain 11,498/3,000/2,758 sentence pairs.
|
92 |
+
|
93 |
+
## Dataset Creation
|
94 |
+
|
95 |
+
### Curation Rationale
|
96 |
+
|
97 |
+
### Source Data
|
98 |
+
|
99 |
+
#### Initial Data Collection and Normalization
|
100 |
+
|
101 |
+
*To construct the dataset, we first obtained automatic translations using Google's translation engine. These were then manually checked, corrected, and cross-validated by human volunteers. *
|
102 |
+
|
103 |
+
#### Who are the source language producers?
|
104 |
+
|
105 |
+
[Needs More Information]
|
106 |
+
|
107 |
+
### Annotations
|
108 |
+
|
109 |
+
#### Annotation process
|
110 |
+
|
111 |
+
#### Who are the annotators?
|
112 |
+
|
113 |
+
### Personal and Sensitive Information
|
114 |
+
|
115 |
+
[Needs More Information]
|
116 |
+
|
117 |
+
## Considerations for Using the Data
|
118 |
+
|
119 |
+
### Social Impact of Dataset
|
120 |
+
|
121 |
+
[Needs More Information]
|
122 |
+
|
123 |
+
### Discussion of Biases
|
124 |
+
|
125 |
+
[Needs More Information]
|
126 |
+
|
127 |
+
### Other Known Limitations
|
128 |
+
|
129 |
+
[Needs More Information]
|
130 |
+
|
131 |
+
## Additional Information
|
132 |
+
|
133 |
+
### Dataset Curators
|
134 |
+
|
135 |
+
[Needs More Information]
|
136 |
+
|
137 |
+
### Licensing Information
|
138 |
+
|
139 |
+
CC BY-SA 4.0 License
|
140 |
+
|
141 |
+
### Citation Information
|
142 |
+
|
143 |
+
[Needs More Information]
|
144 |
+
|
145 |
+
### Contributions
|
146 |
+
|
147 |
+
Thanks to [@lorinczb](https://github.com/lorinczb) for adding this dataset.
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"ro_sts_parallel": {"description": "The RO-STS-Parallel (a Parallel Romanian English dataset - translation of the Semantic Textual Similarity) contains 17256 sentences in Romanian and English. It is a high-quality translation of the English STS benchmark dataset into Romanian.\n", "citation": "Article under review\n", "homepage": "https://github.com/dumitrescustefan/RO-STS/", "license": "", "features": {"translation": {"languages": ["ro", "en"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": {"input": "ro", "output": "en"}, "builder_name": "ro_sts_parallel", "config_name": "ro_sts_parallel", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1563909, "num_examples": 11499, "dataset_name": "ro_sts_parallel"}, "validation": {"name": "validation", "num_bytes": 443787, "num_examples": 3001, "dataset_name": "ro_sts_parallel"}, "test": {"name": "test", "num_bytes": 347590, "num_examples": 2759, "dataset_name": "ro_sts_parallel"}}, "download_checksums": {"https://raw.githubusercontent.com/dumitrescustefan/RO-STS/master/dataset/ro-en/RO-STS.train.ro": {"num_bytes": 820856, "checksum": "ea7ca3d0ca6c2c0ffa70413a2fe006a0aca55c9f467c6f30a4b6dcc731307838"}, "https://raw.githubusercontent.com/dumitrescustefan/RO-STS/master/dataset/ro-en/RO-STS.train.en": {"num_bytes": 674041, "checksum": "4f977090eb8beeb61a76876b1ba60462104633979f2c13f439fb1134a43648a8"}, "https://raw.githubusercontent.com/dumitrescustefan/RO-STS/master/dataset/ro-en/RO-STS.dev.ro": {"num_bytes": 230730, "checksum": "04be055b3b073483b5d36be54d86b3809c14edd707b16e909e23a98098b760c0"}, "https://raw.githubusercontent.com/dumitrescustefan/RO-STS/master/dataset/ro-en/RO-STS.dev.en": {"num_bytes": 195041, "checksum": "219fa6df88e71a829cb31bc40f7cde7258e86c532d43ed7e0b1e2aaec5281ebc"}, "https://raw.githubusercontent.com/dumitrescustefan/RO-STS/master/dataset/ro-en/RO-STS.test.ro": {"num_bytes": 180359, "checksum": "81df186cfe2763d21d05a8be6f5a9146ed3eaac9c6080b5a630309036e23c529"}, "https://raw.githubusercontent.com/dumitrescustefan/RO-STS/master/dataset/ro-en/RO-STS.test.en": {"num_bytes": 150667, "checksum": "9088e52b259c5daf91ae830369ab51c3de0a1e377dd5ae17af6a3e75e1f81ff0"}}, "download_size": 2251694, "post_processing_size": null, "dataset_size": 2355286, "size_in_bytes": 4606980}, "rosts-parallel-en-ro": {"description": "The RO-STS-Parallel (a Parallel Romanian English dataset - translation of the Semantic Textual Similarity) contains 17256 sentences in Romanian and English. It is a high-quality translation of the English STS benchmark dataset into Romanian.\n", "citation": "Article under review\n", "homepage": "https://github.com/dumitrescustefan/RO-STS/", "license": "", "features": {"translation": {"languages": ["en", "ro"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": {"input": "en", "output": "ro"}, "builder_name": "rosts_parallel", "config_name": "rosts-parallel-en-ro", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1563909, "num_examples": 11499, "dataset_name": "rosts_parallel"}, "validation": {"name": "validation", "num_bytes": 443787, "num_examples": 3001, "dataset_name": "rosts_parallel"}, "test": {"name": "test", "num_bytes": 347590, "num_examples": 2759, "dataset_name": "rosts_parallel"}}, "download_checksums": {"https://raw.githubusercontent.com/dumitrescustefan/RO-STS/master/dataset/ro-en/RO-STS.train.en": {"num_bytes": 674041, "checksum": "4f977090eb8beeb61a76876b1ba60462104633979f2c13f439fb1134a43648a8"}, "https://raw.githubusercontent.com/dumitrescustefan/RO-STS/master/dataset/ro-en/RO-STS.train.ro": {"num_bytes": 820856, "checksum": "ea7ca3d0ca6c2c0ffa70413a2fe006a0aca55c9f467c6f30a4b6dcc731307838"}, "https://raw.githubusercontent.com/dumitrescustefan/RO-STS/master/dataset/ro-en/RO-STS.dev.en": {"num_bytes": 195041, "checksum": "219fa6df88e71a829cb31bc40f7cde7258e86c532d43ed7e0b1e2aaec5281ebc"}, "https://raw.githubusercontent.com/dumitrescustefan/RO-STS/master/dataset/ro-en/RO-STS.dev.ro": {"num_bytes": 230730, "checksum": "04be055b3b073483b5d36be54d86b3809c14edd707b16e909e23a98098b760c0"}, "https://raw.githubusercontent.com/dumitrescustefan/RO-STS/master/dataset/ro-en/RO-STS.test.en": {"num_bytes": 150667, "checksum": "9088e52b259c5daf91ae830369ab51c3de0a1e377dd5ae17af6a3e75e1f81ff0"}, "https://raw.githubusercontent.com/dumitrescustefan/RO-STS/master/dataset/ro-en/RO-STS.test.ro": {"num_bytes": 180359, "checksum": "81df186cfe2763d21d05a8be6f5a9146ed3eaac9c6080b5a630309036e23c529"}}, "download_size": 2251694, "post_processing_size": null, "dataset_size": 2355286, "size_in_bytes": 4606980}, "ro_sts_parallel": {"description": "The RO-STS-Parallel (a Parallel Romanian English dataset - translation of the Semantic Textual Similarity) contains 17256 sentences in Romanian and English. It is a high-quality translation of the English STS benchmark dataset into Romanian.\n", "citation": "Article under review\n", "homepage": "https://github.com/dumitrescustefan/RO-STS", "license": "CC BY-SA 4.0 License", "features": {"translation": {"languages": ["ro", "en"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": {"input": "ro", "output": "en"}, "builder_name": "ro_sts_parallel", "config_name": "ro_sts_parallel", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1563909, "num_examples": 11499, "dataset_name": "ro_sts_parallel"}, "validation": {"name": "validation", "num_bytes": 443787, "num_examples": 3001, "dataset_name": "ro_sts_parallel"}, "test": {"name": "test", "num_bytes": 347590, "num_examples": 2759, "dataset_name": "ro_sts_parallel"}}, "download_checksums": {"https://raw.githubusercontent.com/dumitrescustefan/RO-STS/master/dataset/ro-en/RO-STS.train.ro": {"num_bytes": 820856, "checksum": "ea7ca3d0ca6c2c0ffa70413a2fe006a0aca55c9f467c6f30a4b6dcc731307838"}, "https://raw.githubusercontent.com/dumitrescustefan/RO-STS/master/dataset/ro-en/RO-STS.train.en": {"num_bytes": 674041, "checksum": "4f977090eb8beeb61a76876b1ba60462104633979f2c13f439fb1134a43648a8"}, "https://raw.githubusercontent.com/dumitrescustefan/RO-STS/master/dataset/ro-en/RO-STS.dev.ro": {"num_bytes": 230730, "checksum": "04be055b3b073483b5d36be54d86b3809c14edd707b16e909e23a98098b760c0"}, "https://raw.githubusercontent.com/dumitrescustefan/RO-STS/master/dataset/ro-en/RO-STS.dev.en": {"num_bytes": 195041, "checksum": "219fa6df88e71a829cb31bc40f7cde7258e86c532d43ed7e0b1e2aaec5281ebc"}, "https://raw.githubusercontent.com/dumitrescustefan/RO-STS/master/dataset/ro-en/RO-STS.test.ro": {"num_bytes": 180359, "checksum": "81df186cfe2763d21d05a8be6f5a9146ed3eaac9c6080b5a630309036e23c529"}, "https://raw.githubusercontent.com/dumitrescustefan/RO-STS/master/dataset/ro-en/RO-STS.test.en": {"num_bytes": 150667, "checksum": "9088e52b259c5daf91ae830369ab51c3de0a1e377dd5ae17af6a3e75e1f81ff0"}}, "download_size": 2251694, "post_processing_size": null, "dataset_size": 2355286, "size_in_bytes": 4606980}}
|
dummy/ro_sts_parallel/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:13d1c065a9c7c81015b4c551155234980edaa9a5ec7f38ee49c1bde3f87a8e3f
|
3 |
+
size 1886
|
ro_sts_parallel.py
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2021 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 |
+
"""RO-STS-Parallel: a Parallel English-Romanian Dataset by translating the Semantic Textual Similarity dataset"""
|
16 |
+
|
17 |
+
from __future__ import absolute_import, division, print_function
|
18 |
+
|
19 |
+
import datasets
|
20 |
+
|
21 |
+
|
22 |
+
# Find for instance the citation on arxiv or on the dataset repo/website
|
23 |
+
_CITATION = """\
|
24 |
+
Article under review
|
25 |
+
"""
|
26 |
+
|
27 |
+
# You can copy an official description
|
28 |
+
_DESCRIPTION = """\
|
29 |
+
The RO-STS-Parallel (a Parallel Romanian English dataset - translation of the Semantic Textual Similarity) contains 17256 sentences in Romanian and English. It is a high-quality translation of the English STS benchmark dataset into Romanian.
|
30 |
+
"""
|
31 |
+
|
32 |
+
_HOMEPAGE = "https://github.com/dumitrescustefan/RO-STS"
|
33 |
+
|
34 |
+
_LICENSE = "CC BY-SA 4.0 License"
|
35 |
+
|
36 |
+
# The HuggingFace dataset library don't host the datasets but only point to the original files
|
37 |
+
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
38 |
+
_URL = "https://github.com/dumitrescustefan/RO-STS/tree/master/dataset/ro-en"
|
39 |
+
# _TRAINING_FILE_RO = "RO-STS.train.ro"
|
40 |
+
# _TRAINING_FILE_EN = "RO-STS.train.en"
|
41 |
+
# _TEST_FILE_RO = "RO-STS.test.ro"
|
42 |
+
# _TEST_FILE_EN = "RO-STS.test.en"
|
43 |
+
# _DEV_FILE_RO = "RO-STS.dev.ro"
|
44 |
+
# _DEV_FILE_EN = "RO-STS.dev.en"
|
45 |
+
_DATA_URL = "https://raw.githubusercontent.com/dumitrescustefan/RO-STS/master/dataset/ro-en/RO-STS.{}.{}"
|
46 |
+
|
47 |
+
|
48 |
+
class ROSTSParallelConfig(datasets.BuilderConfig):
|
49 |
+
"""BuilderConfig for RO-STS-Parallel dataset"""
|
50 |
+
|
51 |
+
def __init__(self, language_pair=(None, None), **kwargs):
|
52 |
+
|
53 |
+
# description = ("RO-STS Parallel dataset, translation from %s to %s") % (language_pair[0], language_pair[1])
|
54 |
+
super(ROSTSParallelConfig, self).__init__(**kwargs)
|
55 |
+
self.language_pair = language_pair
|
56 |
+
|
57 |
+
|
58 |
+
class RoStsParallel(datasets.GeneratorBasedBuilder):
|
59 |
+
"""RO-STS-Parallel dataset"""
|
60 |
+
|
61 |
+
VERSION = datasets.Version("1.0.0")
|
62 |
+
BUILDER_CONFIGS = [
|
63 |
+
ROSTSParallelConfig(
|
64 |
+
name="ro_sts_parallel", version=VERSION, description="RO-STS Parallel dataset", language_pair=("ro", "en")
|
65 |
+
)
|
66 |
+
]
|
67 |
+
|
68 |
+
def _info(self):
|
69 |
+
|
70 |
+
source, target = self.config.language_pair
|
71 |
+
return datasets.DatasetInfo(
|
72 |
+
description=_DESCRIPTION,
|
73 |
+
features=datasets.Features(
|
74 |
+
{"translation": datasets.features.Translation(languages=self.config.language_pair)}
|
75 |
+
),
|
76 |
+
supervised_keys=(source, target),
|
77 |
+
homepage=_HOMEPAGE,
|
78 |
+
license=_LICENSE,
|
79 |
+
citation=_CITATION,
|
80 |
+
)
|
81 |
+
|
82 |
+
def _split_generators(self, dl_manager):
|
83 |
+
"""Returns SplitGenerators."""
|
84 |
+
|
85 |
+
source, target = self.config.language_pair
|
86 |
+
|
87 |
+
files = {}
|
88 |
+
for split in ("train", "dev", "test"):
|
89 |
+
if split == "train":
|
90 |
+
dl_dir_src = dl_manager.download_and_extract(_DATA_URL.format("train", source))
|
91 |
+
dl_dir_tar = dl_manager.download_and_extract(_DATA_URL.format("train", target))
|
92 |
+
if split == "dev":
|
93 |
+
dl_dir_src = dl_manager.download_and_extract(_DATA_URL.format("dev", source))
|
94 |
+
dl_dir_tar = dl_manager.download_and_extract(_DATA_URL.format("dev", target))
|
95 |
+
if split == "test":
|
96 |
+
dl_dir_src = dl_manager.download_and_extract(_DATA_URL.format("test", source))
|
97 |
+
dl_dir_tar = dl_manager.download_and_extract(_DATA_URL.format("test", target))
|
98 |
+
|
99 |
+
files[split] = {"source_file": dl_dir_src, "target_file": dl_dir_tar}
|
100 |
+
|
101 |
+
return [
|
102 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs=files["train"]),
|
103 |
+
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs=files["dev"]),
|
104 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs=files["test"]),
|
105 |
+
]
|
106 |
+
|
107 |
+
def _generate_examples(self, source_file, target_file):
|
108 |
+
"""This function returns the examples in the raw (text) form."""
|
109 |
+
with open(source_file, encoding="utf-8") as f:
|
110 |
+
source_sentences = f.read().split("\n")
|
111 |
+
with open(target_file, encoding="utf-8") as f:
|
112 |
+
target_sentences = f.read().split("\n")
|
113 |
+
|
114 |
+
source, target = self.config.language_pair
|
115 |
+
for idx, (l1, l2) in enumerate(zip(source_sentences, target_sentences)):
|
116 |
+
result = {"translation": {source: l1, target: l2}}
|
117 |
+
yield idx, result
|