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 lines20212223242526277 unmodified lines353637383940414243446 unmodified lines515253545556575859606 unmodified lines676869707172737475766 unmodified lines838485868788899091926 unmodified lines991001011021031041051061071086 unmodified lines1151161171181191201211221231246 unmodified lines1311321331341351361371381391406 unmodified lines1471481491501511521531541551566 unmodified lines1631641651661671681691701711726 unmodified lines17918018118218318418518618718818919019119219319419519619719819919 unmodified linestask_categories:- translationtask_ids: []paperswithcode_id: nullpretty_name: OpusRfdataset_info:- config_name: de-enfeatures:7 unmodified lines- ensplits:- name: trainnum_bytes: 38683num_examples: 177download_size: 16029dataset_size: 38683- config_name: de-esfeatures:- name: id6 unmodified lines- essplits:- name: trainnum_bytes: 2316num_examples: 24download_size: 2403dataset_size: 2316- config_name: de-frfeatures:- name: id6 unmodified lines- frsplits:- name: trainnum_bytes: 41300num_examples: 173download_size: 16720dataset_size: 41300- config_name: de-svfeatures:- name: id6 unmodified lines- svsplits:- name: trainnum_bytes: 37414num_examples: 178download_size: 15749dataset_size: 37414- config_name: en-esfeatures:- name: id6 unmodified lines- essplits:- name: trainnum_bytes: 2600num_examples: 25download_size: 2485dataset_size: 2600- config_name: en-frfeatures:- name: id6 unmodified lines- frsplits:- name: trainnum_bytes: 39503num_examples: 175download_size: 16038dataset_size: 39503- config_name: en-svfeatures:- name: id6 unmodified lines- svsplits:- name: trainnum_bytes: 35778num_examples: 180download_size: 15147dataset_size: 35778- config_name: es-frfeatures:- name: id6 unmodified lines- frsplits:- name: trainnum_bytes: 2519num_examples: 21download_size: 2469dataset_size: 2519- config_name: es-svfeatures:- name: id6 unmodified lines- svsplits:- name: trainnum_bytes: 3110num_examples: 28download_size: 2726dataset_size: 3110- config_name: fr-svfeatures:- name: id6 unmodified lines- svsplits:- name: trainnum_bytes: 38627num_examples: 175download_size: 15937dataset_size: 38627config_names:- de-en- de-es- de-fr- de-sv- en-es- en-fr- en-sv- es-fr- es-sv- fr-sv---# Dataset Card for [Dataset Name]19 unmodified lines2021222324252627282930313233343536377 unmodified lines454647484950515253546 unmodified lines616263646566676869706 unmodified lines777879808182838485866 unmodified lines939495969798991001011026 unmodified lines1091101111121131141151161171186 unmodified lines1251261271281291301311321331346 unmodified lines1411421431441451461471481491506 unmodified lines1571581591601611621631641651666 unmodified lines1731741751761771781791801811826 unmodified lines18919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823919 unmodified linestask_categories:- translationtask_ids: []pretty_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-enfeatures:7 unmodified lines- ensplits:- name: trainnum_bytes: 38671num_examples: 177download_size: 25572dataset_size: 38671- config_name: de-esfeatures:- name: id6 unmodified lines- essplits:- name: trainnum_bytes: 2304num_examples: 24download_size: 3690dataset_size: 2304- config_name: de-frfeatures:- name: id6 unmodified lines- frsplits:- name: trainnum_bytes: 41288num_examples: 173download_size: 26724dataset_size: 41288- config_name: de-svfeatures:- name: id6 unmodified lines- svsplits:- name: trainnum_bytes: 37402num_examples: 178download_size: 25101dataset_size: 37402- config_name: en-esfeatures:- name: id6 unmodified lines- essplits:- name: trainnum_bytes: 2588num_examples: 25download_size: 3865dataset_size: 2588- config_name: en-frfeatures:- name: id6 unmodified lines- frsplits:- name: trainnum_bytes: 39491num_examples: 175download_size: 25966dataset_size: 39491- config_name: en-svfeatures:- name: id6 unmodified lines- svsplits:- name: trainnum_bytes: 35766num_examples: 180download_size: 24513dataset_size: 35766- config_name: es-frfeatures:- name: id6 unmodified lines- frsplits:- name: trainnum_bytes: 2507num_examples: 21download_size: 3789dataset_size: 2507- config_name: es-svfeatures:- name: id6 unmodified lines- svsplits:- name: trainnum_bytes: 3098num_examples: 28download_size: 4227dataset_size: 3098- config_name: fr-svfeatures:- name: id6 unmodified lines- svsplits:- name: trainnum_bytes: 38615num_examples: 175download_size: 25822dataset_size: 38615configs:- config_name: de-endata_files:- split: trainpath: de-en/train-*- config_name: de-esdata_files:- split: trainpath: de-es/train-*- config_name: de-frdata_files:- split: trainpath: de-fr/train-*- config_name: de-svdata_files:- split: trainpath: de-sv/train-*- config_name: en-esdata_files:- split: trainpath: en-es/train-*- config_name: en-frdata_files:- split: trainpath: en-fr/train-*- config_name: en-svdata_files:- split: trainpath: en-sv/train-*- config_name: es-frdata_files:- split: trainpath: es-fr/train-*- config_name: es-svdata_files:- split: trainpath: es-sv/train-*- config_name: fr-svdata_files:- split: trainpath: 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