|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"""Indonesian Paraphrase Detection""" |
|
|
|
|
|
import csv |
|
import json |
|
import os |
|
|
|
import datasets |
|
|
|
_DESCRIPTION = """\ |
|
This dataset is built as a playground for sequence to sequence classification |
|
""" |
|
|
|
_HOMEPAGE = "https://github.com/jakartaresearch" |
|
|
|
|
|
|
|
|
|
_TRAIN_URL = "https://media.githubusercontent.com/media/jakartaresearch/hf-datasets/main/msrp/id_train.csv" |
|
_VAL_URL = "https://media.githubusercontent.com/media/jakartaresearch/hf-datasets/main/msrp/id_test.csv" |
|
|
|
|
|
|
|
class GooglePlayReview(datasets.GeneratorBasedBuilder): |
|
"""Indonesian Paraphrase Detection.""" |
|
|
|
VERSION = datasets.Version("1.0.0") |
|
|
|
def _info(self): |
|
|
|
features = datasets.Features( |
|
{ |
|
"sentence1": datasets.Value("string"), |
|
"sentence2": datasets.Value("string"), |
|
"label": datasets.Value("int8") |
|
} |
|
) |
|
|
|
return datasets.DatasetInfo( |
|
description=_DESCRIPTION, |
|
features=features, |
|
homepage=_HOMEPAGE |
|
) |
|
|
|
def _split_generators(self, dl_manager): |
|
|
|
train_path = dl_manager.download_and_extract(_TRAIN_URL) |
|
val_path = dl_manager.download_and_extract(_VAL_URL) |
|
return [ |
|
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}), |
|
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": val_path}) |
|
] |
|
|
|
|
|
def _generate_examples(self, filepath): |
|
"""Generate examples.""" |
|
with open(filepath, encoding="utf-8") as csv_file: |
|
csv_reader = csv.reader(csv_file, delimiter=",") |
|
next(csv_reader) |
|
for id_, row in enumerate(csv_reader): |
|
sentence1, sentence2, label = row |
|
yield id_, {"sentence1": sentence1, "sentence2": sentence2, "label": label} |