Datasets:
Convert dataset to Parquet
#2
by albertvillanova HF Staff - opened
Files changed (12)
- README.md+82-42
- de-en/train-00000-of-00001.parquetAdded+3
- de-es/train-00000-of-00001.parquetAdded+3
- de-fr/train-00000-of-00001.parquetAdded+3
- de-sv/train-00000-of-00001.parquetAdded+3
- en-es/train-00000-of-00001.parquetAdded+3
- en-fr/train-00000-of-00001.parquetAdded+3
- en-sv/train-00000-of-00001.parquetAdded+3
- es-fr/train-00000-of-00001.parquetAdded+3
- es-sv/train-00000-of-00001.parquetAdded+3
- fr-sv/train-00000-of-00001.parquetAdded+3
- opus_rf.pyDeleted-139
19 unmodified lines202122232324252627282930313233343536377 unmodified lines454647384849404150515253546 unmodified lines616263546465565766676869706 unmodified lines777879708081727382838485866 unmodified lines939495869697888998991001011026 unmodified lines1091101111021121131041051141151161171186 unmodified lines1251261271181281291201211301311321331346 unmodified lines1411421431341441451361371461471481491506 unmodified lines1571581591501601611521531621631641651666 unmodified lines1731741751661761771681691781791801811826 unmodified lines18919019118219219318418518618718818919019119219319419519619419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823919 unmodified linestask_categories:- translationtask_ids: []paperswithcode_id: nullpretty_name: OpusRfconfig_names:- de-en- de-es- de-fr- de-sv- en-es- en-fr- en-sv- es-fr- es-sv- fr-svdataset_info:- config_name: de-en features:7 unmodified lines - en splits: - name: train num_bytes: 38683 num_bytes: 38671 num_examples: 177 download_size: 16029 dataset_size: 38683 download_size: 25572 dataset_size: 38671- config_name: de-es features: - name: id6 unmodified lines - es splits: - name: train num_bytes: 2316 num_bytes: 2304 num_examples: 24 download_size: 2403 dataset_size: 2316 download_size: 3690 dataset_size: 2304- config_name: de-fr features: - name: id6 unmodified lines - fr splits: - name: train num_bytes: 41300 num_bytes: 41288 num_examples: 173 download_size: 16720 dataset_size: 41300 download_size: 26724 dataset_size: 41288- config_name: de-sv features: - name: id6 unmodified lines - sv splits: - name: train num_bytes: 37414 num_bytes: 37402 num_examples: 178 download_size: 15749 dataset_size: 37414 download_size: 25101 dataset_size: 37402- config_name: en-es features: - name: id6 unmodified lines - es splits: - name: train num_bytes: 2600 num_bytes: 2588 num_examples: 25 download_size: 2485 dataset_size: 2600 download_size: 3865 dataset_size: 2588- config_name: en-fr features: - name: id6 unmodified lines - fr splits: - name: train num_bytes: 39503 num_bytes: 39491 num_examples: 175 download_size: 16038 dataset_size: 39503 download_size: 25966 dataset_size: 39491- config_name: en-sv features: - name: id6 unmodified lines - sv splits: - name: train num_bytes: 35778 num_bytes: 35766 num_examples: 180 download_size: 15147 dataset_size: 35778 download_size: 24513 dataset_size: 35766- config_name: es-fr features: - name: id6 unmodified lines - fr splits: - name: train num_bytes: 2519 num_bytes: 2507 num_examples: 21 download_size: 2469 dataset_size: 2519 download_size: 3789 dataset_size: 2507- config_name: es-sv features: - name: id6 unmodified lines - sv splits: - name: train num_bytes: 3110 num_bytes: 3098 num_examples: 28 download_size: 2726 dataset_size: 3110 download_size: 4227 dataset_size: 3098- config_name: fr-sv features: - name: id6 unmodified lines - sv splits: - name: train num_bytes: 38627 num_bytes: 38615 num_examples: 175 download_size: 15937 dataset_size: 38627config_names:- de-en- de-es- de-fr- de-sv- en-es- en-fr- en-sv- es-fr- es-sv- fr-sv download_size: 25822 dataset_size: 38615configs:- config_name: de-en data_files: - split: train path: de-en/train-*- config_name: de-es data_files: - split: train path: de-es/train-*- config_name: de-fr data_files: - split: train path: de-fr/train-*- config_name: de-sv data_files: - split: train path: de-sv/train-*- config_name: en-es data_files: - split: train path: en-es/train-*- config_name: en-fr data_files: - split: train path: en-fr/train-*- config_name: en-sv data_files: - split: train path: en-sv/train-*- config_name: es-fr data_files: - split: train path: es-fr/train-*- config_name: es-sv data_files: - split: train path: es-sv/train-*- config_name: fr-sv data_files: - split: train path: fr-sv/train-*---
# Dataset Card for [Dataset Name]123version https://git-lfs.github.com/spec/v1oid sha256:486dc31e644104f0e77a8a226b8027cf414b170244d6382ef1f2cdcc4f60aa43size 25572123version https://git-lfs.github.com/spec/v1oid sha256:0e7ed65cda31725a47ef0e4802b010d1a25cf83ac68efb13a1368ca7e2cf4f9dsize 3690123version https://git-lfs.github.com/spec/v1oid sha256:31b40e78b3510ffc453ee0f617a638da1eaa57b4aec9ddba7fe11591536b0e36size 26724123version https://git-lfs.github.com/spec/v1oid sha256:7a5d33665aff0984e4e3b62900683acd59ab360a7fec510a1a4474c0e7cf3f76size 25101123version https://git-lfs.github.com/spec/v1oid sha256:de1311edea8ad3b71c948671edcb3e3ac6aa97bca7fcd576a9f6ccc26e96af84size 3865123version https://git-lfs.github.com/spec/v1oid sha256:69123d88a3e6f110d5a98d989c05e70a3f7f37a9aef01da046386c7aee5a35d8size 25966123version https://git-lfs.github.com/spec/v1oid sha256:5fa0b3a8142f997c06b534dd0dad44a6504a58b7410b57510e6d8efc0d608934size 24513123version https://git-lfs.github.com/spec/v1oid sha256:e855aa057aa26776fa029c649f7e32fd794febd79e9278dabdfa872ca3e45d38size 3789123version https://git-lfs.github.com/spec/v1oid sha256:fdf3fd4ead2942887b8a71df18eeb2b031d4ea0d9600c855caf9f598657515c4size 4227123version https://git-lfs.github.com/spec/v1oid sha256:7da0b69fcf0a000604e981ef6f47b2cf710e85f3306a37b536fc9748984ebcbasize 25822123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139# coding=utf-8# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License."""RF is a tiny parallel corpus of the Declarations of the Swedish Government and its translations.
5 languages, 10 bitextstotal number of files: 11total number of tokens: 19.74ktotal number of sentence fragments: 0.86k"""
import os
import datasets
_CITATION = """\@InProceedings{TIEDEMANN12.463, author = {J{\"o}rg Tiedemann}, title = {Parallel Data, Tools and Interfaces in OPUS}, booktitle = {Proceedings of the Eight International Conference on Language Resources and Evaluation (LREC'12)}, year = {2012}, month = {may}, date = {23-25}, address = {Istanbul, Turkey}, editor = {Nicoletta Calzolari (Conference Chair) and Khalid Choukri and Thierry Declerck and Mehmet Ugur Dogan and Bente Maegaard and Joseph Mariani and Jan Odijk and Stelios Piperidis}, publisher = {European Language Resources Association (ELRA)}, isbn = {978-2-9517408-7-7}, language = {english} }"""
_DESCRIPTION = """\RF is a tiny parallel corpus of the Declarations of the Swedish Government and its translations."""
_HOMEPAGE = "http://opus.nlpl.eu/RF.php"
_VERSION = "1.0.0"_BASE_NAME = "RF.{}.{}"_BASE_URL = "https://object.pouta.csc.fi/OPUS-RF/v1/moses/{}-{}.txt.zip"
_LANGUAGE_PAIRS = [ ("de", "en"), ("de", "es"), ("de", "fr"), ("de", "sv"), ("en", "es"), ("en", "fr"), ("en", "sv"), ("es", "fr"), ("es", "sv"), ("fr", "sv"),]
class OpusRFTranslationsConfig(datasets.BuilderConfig): def __init__(self, *args, lang1=None, lang2=None, **kwargs): super().__init__( *args, name=f"{lang1}-{lang2}", **kwargs, ) self.lang1 = lang1 self.lang2 = lang2
class OpusRF(datasets.GeneratorBasedBuilder): """RF is a tiny parallel corpus of the Declarations of the Swedish Government and its translations."""
BUILDER_CONFIGS = [ OpusRFTranslationsConfig( lang1=lang1, lang2=lang2, description=f"Translating {lang1} to {lang2} or vice versa", version=datasets.Version(_VERSION), ) for lang1, lang2 in _LANGUAGE_PAIRS ] BUILDER_CONFIG_CLASS = OpusRFTranslationsConfig
def _info(self): return datasets.DatasetInfo( description=_DESCRIPTION, features=datasets.Features( { "id": datasets.Value("string"), "translation": datasets.Translation(languages=(self.config.lang1, self.config.lang2)), } ), supervised_keys=None, homepage=_HOMEPAGE, citation=_CITATION, )
def _split_generators(self, dl_manager): """Returns SplitGenerators.""" download_url = _BASE_URL.format(self.config.lang1, self.config.lang2) path = dl_manager.download_and_extract(download_url) return [ datasets.SplitGenerator( name=datasets.Split.TRAIN, gen_kwargs={"datapath": path}, ) ]
def _generate_examples(self, datapath): """Yields examples.""" l1, l2 = self.config.lang1, self.config.lang2 folder = l1 + "-" + l2 l1_file = _BASE_NAME.format(folder, l1) l2_file = _BASE_NAME.format(folder, l2) l1_path = os.path.join(datapath, l1_file) l2_path = os.path.join(datapath, l2_file) with open(l1_path, encoding="utf-8") as f1, open(l2_path, encoding="utf-8") as f2: for sentence_counter, (x, y) in enumerate(zip(f1, f2)): x = x.strip() y = y.strip() result = ( sentence_counter, { "id": str(sentence_counter), "translation": {l1: x, l2: y}, }, ) yield resultREADME.md+82-42
de-en/train-00000-of-00001.parquetAdded+3
de-es/train-00000-of-00001.parquetAdded+3
de-fr/train-00000-of-00001.parquetAdded+3
de-sv/train-00000-of-00001.parquetAdded+3
en-es/train-00000-of-00001.parquetAdded+3
en-fr/train-00000-of-00001.parquetAdded+3
en-sv/train-00000-of-00001.parquetAdded+3
es-fr/train-00000-of-00001.parquetAdded+3
es-sv/train-00000-of-00001.parquetAdded+3
fr-sv/train-00000-of-00001.parquetAdded+3
opus_rf.pyDeleted-139