Datasets:

Multilinguality:
translation
Size Categories:
10K<n<100K
Language Creators:
found
Annotations Creators:
found
Source Datasets:
original
Tags:
License:
albertvillanova HF staff commited on
Commit
ee4cec5
1 Parent(s): 7789b21

Delete loading script

Browse files
Files changed (1) hide show
  1. opus_montenegrinsubs.py +0 -90
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