Datasets:
Tasks:
Text2Text Generation
Languages:
Bengali
Multilinguality:
monolingual
Size Categories:
100k<n<1M
Language Creators:
found
Annotations Creators:
found
Source Datasets:
original
ArXiv:
License:
import json | |
import os | |
import datasets | |
_CITATION = """ | |
to be added | |
""" | |
_DESCRIPTION = """\ | |
We present a high quality bangla paraphrase dataset containing about 466k paraphrase pairs. The paraphrases ensures high quality by being semantically coherent and syntactically diverse. | |
""" | |
_HOMEPAGE = "https://github.com/csebuetnlp/banglaparaphrase" | |
_LICENSE = "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (CC BY-NC-SA 4.0)" | |
_URL = "https://huggingface.co/datasets/csebuetnlp/BanglaParaphrase/resolve/main/data/BanglaParaphrase.zip" | |
_LANGUAGES = [ | |
"bn" | |
] | |
class IndicParaphrase(datasets.GeneratorBasedBuilder): | |
VERSION = datasets.Version("1.0.0") | |
BUILDER_CONFIGS = [ | |
datasets.BuilderConfig( | |
name="bn", | |
version=datasets.Version("1.0.0") | |
) | |
] | |
def _info(self): | |
return datasets.DatasetInfo( | |
description=_DESCRIPTION, | |
features=datasets.Features( | |
{ | |
"source": datasets.Value("string"), | |
"target": datasets.Value("string") | |
} | |
), | |
supervised_keys=None, | |
homepage=_HOMEPAGE, | |
citation=_CITATION, | |
license=_LICENSE, | |
version=self.VERSION, | |
) | |
def _split_generators(self, dl_manager): | |
"""Returns SplitGenerators.""" | |
url = _URL | |
data_dir = dl_manager.download_and_extract(url) | |
return [ | |
datasets.SplitGenerator( | |
name=datasets.Split.TRAIN, | |
gen_kwargs={ | |
"filepath": os.path.join(data_dir, "BanglaParaphrase/train.jsonl"), | |
}, | |
), | |
datasets.SplitGenerator( | |
name=datasets.Split.TEST, | |
gen_kwargs={ | |
"filepath": os.path.join(data_dir, "BanglaParaphrase/test.jsonl"), | |
}, | |
), | |
datasets.SplitGenerator( | |
name=datasets.Split.VALIDATION, | |
gen_kwargs={ | |
"filepath": os.path.join(data_dir, "BanglaParaphrase/validation.jsonl"), | |
}, | |
), | |
] | |
def _generate_examples(self, filepath): | |
"""Yields examples as (key, example) tuples.""" | |
with open(filepath, encoding="utf-8") as f: | |
for idx_, row in enumerate(f): | |
data = json.loads(row) | |
yield idx_, { | |
"source": data["source"], | |
"target": data["target"], | |
} |