Datasets:
Tasks:
Text Classification
Modalities:
Text
Sub-tasks:
multi-class-classification
Size:
100K - 1M
License:
File size: 2,020 Bytes
67669b4 5c82dda 67669b4 5c82dda 67669b4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
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/resolve/main/Jemma_Properties_Methods_CMPX__Huggingface_Dataset_TRAIN.csv"
_BASE_TEST_FILE_URL = "https://huggingface.co/datasets/giganticode/java-cmpx/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(
{
"method_id": datasets.Value("string"),
"cyclomatic_complexity": datasets.Value("int32"),
"method_text": datasets.Value("string")
}
),
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_, {
"method_id": row[0],
"cyclomatic_complexity": row[1],
"method_text": row[2],
} |