Datasets:
Commit
•
52da8cb
1
Parent(s):
ffc2073
Convert dataset to Parquet (#2)
Browse files- Convert dataset to Parquet (7789b2126c311bef320d7e77d5785da1c71ff6da)
- Delete loading script (ee4cec51203f9c37a7caa297a28c743e84040577)
- README.md +9 -5
- en-me/train-00000-of-00001.parquet +3 -0
- opus_montenegrinsubs.py +0 -90
README.md
CHANGED
@@ -17,9 +17,9 @@ source_datasets:
|
|
17 |
task_categories:
|
18 |
- translation
|
19 |
task_ids: []
|
20 |
-
paperswithcode_id: null
|
21 |
pretty_name: OpusMontenegrinsubs
|
22 |
dataset_info:
|
|
|
23 |
features:
|
24 |
- name: translation
|
25 |
dtype:
|
@@ -27,13 +27,17 @@ dataset_info:
|
|
27 |
languages:
|
28 |
- en
|
29 |
- me
|
30 |
-
config_name: en-me
|
31 |
splits:
|
32 |
- name: train
|
33 |
-
num_bytes:
|
34 |
num_examples: 65043
|
35 |
-
download_size:
|
36 |
-
dataset_size:
|
|
|
|
|
|
|
|
|
|
|
37 |
---
|
38 |
|
39 |
# Dataset Card for [opus_montenegrinsubs]
|
|
|
17 |
task_categories:
|
18 |
- translation
|
19 |
task_ids: []
|
|
|
20 |
pretty_name: OpusMontenegrinsubs
|
21 |
dataset_info:
|
22 |
+
config_name: en-me
|
23 |
features:
|
24 |
- name: translation
|
25 |
dtype:
|
|
|
27 |
languages:
|
28 |
- en
|
29 |
- me
|
|
|
30 |
splits:
|
31 |
- name: train
|
32 |
+
num_bytes: 4896347
|
33 |
num_examples: 65043
|
34 |
+
download_size: 3376459
|
35 |
+
dataset_size: 4896347
|
36 |
+
configs:
|
37 |
+
- config_name: en-me
|
38 |
+
data_files:
|
39 |
+
- split: train
|
40 |
+
path: en-me/train-*
|
41 |
---
|
42 |
|
43 |
# Dataset Card for [opus_montenegrinsubs]
|
en-me/train-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2ced4c5e152b4662190dd599bd83378ef54317f94ff1352288473696a427b202
|
3 |
+
size 3376459
|
opus_montenegrinsubs.py
DELETED
@@ -1,90 +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 |
-
"""Opus MontenegrinSubs dataset for machine translation task, for language pair en-me."""
|
16 |
-
|
17 |
-
|
18 |
-
import os
|
19 |
-
|
20 |
-
import datasets
|
21 |
-
|
22 |
-
|
23 |
-
_CITATION = """\
|
24 |
-
J. Tiedemann, 2012, Parallel Data, Tools and Interfaces in OPUS. In Proceedings of the 8th International Conference \
|
25 |
-
on Language Resources and Evaluation (LREC 2012)"""
|
26 |
-
|
27 |
-
|
28 |
-
_DESCRIPTION = """\
|
29 |
-
Opus MontenegrinSubs dataset for machine translation task, for language pair en-me: english and montenegrin
|
30 |
-
"""
|
31 |
-
|
32 |
-
|
33 |
-
_HOMEPAGE = "http://opus.nlpl.eu/MontenegrinSubs.php"
|
34 |
-
|
35 |
-
|
36 |
-
_LICENSE = ""
|
37 |
-
|
38 |
-
_URLs = {"train": "https://object.pouta.csc.fi/OPUS-MontenegrinSubs/v1/moses/en-me.txt.zip"}
|
39 |
-
|
40 |
-
|
41 |
-
class OpusMontenegrinsubs(datasets.GeneratorBasedBuilder):
|
42 |
-
|
43 |
-
VERSION = datasets.Version("1.0.0")
|
44 |
-
|
45 |
-
BUILDER_CONFIGS = [datasets.BuilderConfig(name="en-me", version=VERSION)]
|
46 |
-
|
47 |
-
def _info(self):
|
48 |
-
return datasets.DatasetInfo(
|
49 |
-
description=_DESCRIPTION,
|
50 |
-
features=datasets.Features(
|
51 |
-
{"translation": datasets.features.Translation(languages=tuple(self.config.name.split("-")))}
|
52 |
-
),
|
53 |
-
supervised_keys=None,
|
54 |
-
homepage="http://opus.nlpl.eu/MontenegrinSubs.php",
|
55 |
-
citation=_CITATION,
|
56 |
-
)
|
57 |
-
|
58 |
-
def _split_generators(self, dl_manager):
|
59 |
-
"""Returns SplitGenerators."""
|
60 |
-
data_dir = dl_manager.download_and_extract(_URLs)
|
61 |
-
return [
|
62 |
-
datasets.SplitGenerator(
|
63 |
-
name=datasets.Split.TRAIN,
|
64 |
-
# These kwargs will be passed to _generate_examples
|
65 |
-
gen_kwargs={
|
66 |
-
"source_file": os.path.join(data_dir["train"], "MontenegrinSubs.en-me.en"),
|
67 |
-
"target_file": os.path.join(data_dir["train"], "MontenegrinSubs.en-me.me"),
|
68 |
-
"split": "train",
|
69 |
-
},
|
70 |
-
),
|
71 |
-
]
|
72 |
-
|
73 |
-
def _generate_examples(self, source_file, target_file, split):
|
74 |
-
"""This function returns the examples in the raw (text) form."""
|
75 |
-
with open(source_file, encoding="utf-8") as f:
|
76 |
-
source_sentences = f.read().split("\n")
|
77 |
-
with open(target_file, encoding="utf-8") as f:
|
78 |
-
target_sentences = f.read().split("\n")
|
79 |
-
|
80 |
-
assert len(target_sentences) == len(source_sentences), "Sizes do not match: %d vs %d for %s vs %s." % (
|
81 |
-
len(source_sentences),
|
82 |
-
len(target_sentences),
|
83 |
-
source_file,
|
84 |
-
target_file,
|
85 |
-
)
|
86 |
-
|
87 |
-
source, target = tuple(self.config.name.split("-"))
|
88 |
-
for idx, (l1, l2) in enumerate(zip(source_sentences, target_sentences)):
|
89 |
-
result = {"translation": {source: l1, target: l2}}
|
90 |
-
yield idx, result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|