Datasets:

Multilinguality:
translation
Size Categories:
1M<n<10M
Language Creators:
expert-generated
Annotations Creators:
no-annotation
Source Datasets:
original
Tags:
License:
albertvillanova HF staff commited on
Commit
095a1f2
1 Parent(s): afa83c6

Convert dataset to Parquet (#4)

Browse files

- Convert dataset to Parquet (0eec2a26cb446a8269a130fad494c560a134d2dd)
- Delete loading script (1eab1dfba00644cdc3b67984e4dcc8988fb38b5a)

README.md CHANGED
@@ -32,8 +32,14 @@ dataset_info:
32
  - name: train
33
  num_bytes: 1258920648
34
  num_examples: 4763575
35
- download_size: 331724078
36
  dataset_size: 1258920648
 
 
 
 
 
 
37
  ---
38
 
39
  # Dataset Card for OPUS DOGC
32
  - name: train
33
  num_bytes: 1258920648
34
  num_examples: 4763575
35
+ download_size: 599902063
36
  dataset_size: 1258920648
37
+ configs:
38
+ - config_name: tmx
39
+ data_files:
40
+ - split: train
41
+ path: tmx/train-*
42
+ default: true
43
  ---
44
 
45
  # Dataset Card for OPUS DOGC
opus_dogc.py DELETED
@@ -1,102 +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 DOGC dataset."""
16
-
17
- import xml.etree.ElementTree as ET
18
-
19
- import datasets
20
-
21
-
22
- _DESCRIPTION = """\
23
- This is a collection of documents from the Official Journal of the Government of Catalonia, in Catalan and Spanish \
24
- languages, provided by Antoni Oliver Gonzalez from the Universitat Oberta de Catalunya.
25
- """
26
-
27
- _CITATION = """\
28
- @inproceedings{tiedemann-2012-parallel,
29
- title = "Parallel Data, Tools and Interfaces in {OPUS}",
30
- author = {Tiedemann, J{\"o}rg},
31
- booktitle = "Proceedings of the Eighth International Conference on Language Resources and Evaluation ({LREC}'12)",
32
- month = may,
33
- year = "2012",
34
- address = "Istanbul, Turkey",
35
- publisher = "European Language Resources Association (ELRA)",
36
- url = "http://www.lrec-conf.org/proceedings/lrec2012/pdf/463_Paper.pdf",
37
- pages = "2214--2218",
38
- abstract = "This paper presents the current status of OPUS, a growing language resource of parallel corpora and related tools. The focus in OPUS is to provide freely available data sets in various formats together with basic annotation to be useful for applications in computational linguistics, translation studies and cross-linguistic corpus studies. In this paper, we report about new data sets and their features, additional annotation tools and models provided from the website and essential interfaces and on-line services included in the project.",
39
- }
40
- """
41
-
42
- _URL = "https://opus.nlpl.eu/DOGC/corpus/version/DOGC"
43
- _FILE_FORMATS = ["tmx"]
44
- _URLS = {"tmx": "https://object.pouta.csc.fi/OPUS-DOGC/v2/tmx/ca-es.tmx.gz"}
45
-
46
-
47
- class OpusDogcConfig(datasets.BuilderConfig):
48
- """BuilderConfig for OpusDogcConfig."""
49
-
50
- def __init__(self, file_format=None, **kwargs):
51
- """
52
-
53
- Args:
54
- file_format: language of the subdataset.
55
- **kwargs: keyword arguments forwarded to super.
56
- """
57
- super().__init__(
58
- name=file_format, description=f"OPUS DOGC dataset from source file format {file_format}.", **kwargs
59
- )
60
- self.file_format = file_format
61
-
62
-
63
- class OpusDogc(datasets.GeneratorBasedBuilder):
64
- """OPUS DOGC dataset."""
65
-
66
- BUILDER_CONFIG_CLASS = OpusDogcConfig
67
- BUILDER_CONFIGS = [OpusDogcConfig(file_format=file_format) for file_format in _FILE_FORMATS]
68
-
69
- def _info(self):
70
- return datasets.DatasetInfo(
71
- description=_DESCRIPTION,
72
- features=datasets.Features({"translation": datasets.features.Translation(languages=("ca", "es"))}),
73
- supervised_keys=("ca", "es"),
74
- homepage=_URL,
75
- citation=_CITATION,
76
- )
77
-
78
- def _split_generators(self, dl_manager):
79
- url_to_download = _URLS[self.config.file_format]
80
- downloaded_file = dl_manager.download_and_extract(url_to_download)
81
- return [
82
- datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_file}),
83
- ]
84
-
85
- def _generate_examples(self, filepath):
86
- xml_lang = "{http://www.w3.org/XML/1998/namespace}lang"
87
- with open(filepath, encoding="utf-8") as f:
88
- id_ = 0
89
- for _, elem in ET.iterparse(f):
90
- if elem.tag == "tuv":
91
- language = elem.attrib[xml_lang]
92
- sentence = elem.find("seg").text
93
- if language == "ca":
94
- ca_sentence = sentence
95
- elif language == "es":
96
- es_sentence = sentence
97
- elif elem.tag == "tu":
98
- yield id_, {
99
- "translation": {"ca": ca_sentence, "es": es_sentence},
100
- }
101
- id_ += 1
102
- elem.clear()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tmx/train-00000-of-00003.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:97f9fa05bda1f12bf1656e587fab977506f41b8d6cc24fe7686a91902d42a96f
3
+ size 186985463
tmx/train-00001-of-00003.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e72e89c90e47e0146087188476e11d517d535470a31b250ce3e60477c7ba3836
3
+ size 199395291
tmx/train-00002-of-00003.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:07bf48ce95ec9b953c1e62b2f1223bd3fd5ef00d06314fd3ac8ae9235f0507b5
3
+ size 213521309