Datasets:

Modalities:
Text
ArXiv:
DOI:
Libraries:
Datasets
License:
leondz commited on
Commit
ef33f28
1 Parent(s): 1fb7a3d

initial checkin

Browse files
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"ItuFaroeseDanish": {"description": "\n", "citation": "\n", "homepage": "", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "origin": {"dtype": "string", "id": null, "_type": "Value"}, "fo": {"dtype": "string", "id": null, "_type": "Value"}, "da": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "itu_faroese_danish", "config_name": "ItuFaroeseDanish", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 990565, "num_examples": 3995, "dataset_name": "itu_faroese_danish"}}, "download_checksums": {"itu_fo_da_monolithic.tsv": {"num_bytes": 1183643, "checksum": "a449fc9adaaa71a360130ea51a47846697c510b6a379e44ba00beef981a02437"}}, "download_size": 1183643, "post_processing_size": null, "dataset_size": 990565, "size_in_bytes": 2174208}}
itu_faroese_danish.py ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ """Faroese-Danish parallel corpus from ITU Copenhagen"""
18
+
19
+ import os
20
+
21
+ import datasets
22
+
23
+
24
+ logger = datasets.logging.get_logger(__name__)
25
+
26
+
27
+ _CITATION = """\
28
+
29
+ """
30
+
31
+ _DESCRIPTION = """\
32
+
33
+ """
34
+
35
+ _URL = "itu_fo_da_monolithic.tsv"
36
+
37
+
38
+ class ItuFaroeseDanishConfig(datasets.BuilderConfig):
39
+ """BuilderConfig for ItuFaroeseDanish"""
40
+
41
+ def __init__(self, **kwargs):
42
+ """BuilderConfig ItuFaroeseDanish.
43
+
44
+ Args:
45
+ **kwargs: keyword arguments forwarded to super.
46
+ """
47
+ super(ItuFaroeseDanishConfig, self).__init__(**kwargs)
48
+
49
+
50
+ class ItuFaroeseDanish(datasets.GeneratorBasedBuilder):
51
+ """ItuFaroeseDanish dataset."""
52
+
53
+ BUILDER_CONFIGS = [
54
+ ItuFaroeseDanishConfig(name="ItuFaroeseDanish", version=datasets.Version("1.0.0"), description="Faroese-Danish parallel text from ITU Copenhagen"),
55
+ ]
56
+
57
+ def _info(self):
58
+ return datasets.DatasetInfo(
59
+ description=_DESCRIPTION,
60
+ features=datasets.Features(
61
+ {
62
+ "id": datasets.Value("string"),
63
+ "origin": datasets.Value("string"),
64
+ "fo": datasets.Value("string"),
65
+ "da": datasets.Value("string"),
66
+ }
67
+ ),
68
+ supervised_keys=None,
69
+ homepage="",
70
+ citation=_CITATION,
71
+ )
72
+
73
+ def _split_generators(self, dl_manager):
74
+ """Returns SplitGenerators."""
75
+ downloaded_file = dl_manager.download_and_extract(_URL)
76
+
77
+ return [
78
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_file}),
79
+ ]
80
+
81
+ def _generate_examples(self, filepath):
82
+ logger.info("⏳ Generating examples from = %s", filepath)
83
+ texts = {"fao":{}, "dan":{}}
84
+ with open(filepath, encoding="utf-8") as f:
85
+ for line in f:
86
+ line = line.strip()
87
+ if line:
88
+ code, text = line.split("\t")
89
+ origin, language = code.split("_")
90
+ texts[language][origin] = text
91
+ if texts["fao"].keys() != texts["dan"].keys():
92
+ raise ValueError("Faroese and Danish keys don't match")
93
+ guid = 0
94
+ for origin in texts["fao"]:
95
+ yield guid, {
96
+ "id": str(guid),
97
+ "origin": origin,
98
+ "fo": texts["fao"][origin],
99
+ "da": texts["dan"][origin],
100
+ }
101
+ guid += 1
itu_fo_da_monolithic.tsv ADDED
The diff for this file is too large to render. See raw diff