Datasets:
Tasks:
Text Classification
Modalities:
Text
Sub-tasks:
multi-class-classification
Size:
100K - 1M
License:
| import os | |
| import sys | |
| import csv | |
| import datasets | |
| csv.field_size_limit(sys.maxsize) | |
| _DESCRIPTION = "JEMMA Java CMPX" | |
| _CITATION = "NOT AVAILABLE" | |
| _HOMEPAGE = "NOT AVAILABLE" | |
| _LICENSE = "MIT" | |
| _BASE_TRAIN_FILE_URL = "https://huggingface.co/datasets/giganticode/java-cmpx-v1/resolve/main/Jemma_Properties_Methods_CMPX__Huggingface_Dataset_TRAIN.csv" | |
| _BASE_TEST_FILE_URL = "https://huggingface.co/datasets/giganticode/java-cmpx-v1/resolve/main/Jemma_Properties_Methods_CMPX__Huggingface_Dataset_TEST.csv" | |
| _URLS = { | |
| "train": _BASE_TRAIN_FILE_URL, | |
| "test": _BASE_TEST_FILE_URL | |
| } | |
| class JavaCMPX(datasets.GeneratorBasedBuilder): | |
| """Java CMPX""" | |
| def _info(self): | |
| """Returns Info""" | |
| return datasets.DatasetInfo( | |
| description=_DESCRIPTION, | |
| features=datasets.Features( | |
| { | |
| "text": datasets.Value("string"), | |
| "label": datasets.Value("int32"), | |
| } | |
| ), | |
| homepage=_HOMEPAGE, | |
| license=_LICENSE, | |
| citation=_CITATION, | |
| ) | |
| def _split_generators(self, dl_manager): | |
| """Returns SplitGenerators""" | |
| data_file = dl_manager.download(_URLS) | |
| return [ | |
| datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_file["train"]}), | |
| datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": data_file["test"]}), | |
| ] | |
| def _generate_examples(self, filepath): | |
| """Yields Examples""" | |
| with open(filepath, encoding="utf-8") as f: | |
| reader = csv.reader(f) | |
| for id_, row in enumerate(reader): | |
| if id_ == 0: | |
| continue | |
| yield id_, { | |
| "text": row[0], | |
| "label": row[1], | |
| } |