Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
csv
Sub-tasks:
natural-language-inference
Languages:
Indonesian
Size:
10K - 100K
License:
# 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. | |
"""TODO: Add a description here.""" | |
import json | |
import csv | |
import datasets | |
# TODO: Add BibTeX citation | |
# Find for instance the citation on arxiv or on the dataset repo/website | |
_CITATION = """\ | |
""" | |
# TODO: Add description of the dataset here | |
# You can copy an official description | |
_DESCRIPTION = """\ | |
The IDKMRC-NLI dataset is derived from the IDKMRC question answering dataset, utilizing named entity recognition (NER), chunking tags, Regex, and embedding similarity techniques to determine its contradiction sets. | |
Collected through this process, the dataset comprises various columns beyond premise, hypothesis, and label, including properties aligned with NER and chunking tags. | |
This dataset is designed to facilitate Natural Language Inference (NLI) tasks and contains information extracted from diverse sources to provide comprehensive coverage. | |
Each data instance encapsulates premise, hypothesis, label, and additional properties pertinent to NLI evaluation. | |
""" | |
# TODO: Add a link to an official homepage for the dataset here | |
_HOMEPAGE = "https://huggingface.co/datasets/muhammadravi251001/idkmrc-nli" | |
# TODO: Add the licence for the dataset here if you can find it | |
_LICENSE = """ | |
""" | |
_TRAIN_DOWNLOAD_URL = "https://huggingface.co/datasets/muhammadravi251001/idkmrc-nli/resolve/main/idk-mrc_nli_train_df.csv?download=true" | |
_VALID_DOWNLOAD_URL = "https://huggingface.co/datasets/muhammadravi251001/idkmrc-nli/raw/main/idk-mrc_nli_val_df.csv" | |
_TEST_DOWNLOAD_URL = "https://huggingface.co/datasets/muhammadravi251001/idkmrc-nli/raw/main/idk-mrc_nli_test_df.csv" | |
class IDKMRCNLIConfig(datasets.BuilderConfig): | |
"""BuilderConfig for IDKMRC-NLI Config""" | |
def __init__(self, **kwargs): | |
"""BuilderConfig for IDKMRC-NLI Config. | |
Args: | |
**kwargs: keyword arguments forwarded to super. | |
""" | |
super(IDKMRCNLIConfig, self).__init__(**kwargs) | |
class IDKMRCNLI(datasets.GeneratorBasedBuilder): | |
"""IDKMRC-NLI dataset -- Syntethic NLI dataset derived from QA dataset | |
utilizing named entity recognition (NER), chunking tags, Regex, and embedding similarity | |
techniques to determine its contradiction sets""" | |
BUILDER_CONFIGS = [ | |
IDKMRCNLIConfig( | |
name="idkmrc-nli", | |
version=datasets.Version("1.1.0"), | |
description="IDKMRC-NLI: Syntethic NLI dataset derived from QA dataset utilizing named entity recognition (NER), chunking tags, Regex, and embedding similarity techniques to determine its contradiction sets", | |
), | |
] | |
def _info(self): | |
return datasets.DatasetInfo( | |
description=_DESCRIPTION, | |
features=datasets.Features( | |
{ | |
"premise": datasets.Value("string"), | |
"hypothesis": datasets.Value("string"), | |
"label": datasets.ClassLabel(names=["entailment", "neutral", "contradiction"]), | |
} | |
), | |
supervised_keys=None, | |
homepage=_HOMEPAGE, | |
license=_LICENSE, | |
citation=_CITATION, | |
) | |
def _split_generators(self, dl_manager): | |
"""Returns SplitGenerators.""" | |
train_path = dl_manager.download_and_extract(_TRAIN_DOWNLOAD_URL) | |
valid_path = dl_manager.download_and_extract(_VALID_DOWNLOAD_URL) | |
test_path = dl_manager.download_and_extract(_TEST_DOWNLOAD_URL) | |
return [ | |
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}), | |
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": valid_path}), | |
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}), | |
] | |
def _generate_examples(self, filepath): | |
"""Yields examples.""" | |
with open(filepath, encoding="utf-8") as csv_file: | |
csv_reader = csv.DictReader(csv_file) | |
for id_, row in enumerate(csv_reader): | |
yield id_, { | |
"premise": row["premise"], | |
"hypothesis": row["hypothesis"], | |
"label": {"e": "entailment", "n": "neutral", "c": "contradiction"}[row["label"]], | |
} | |