LuKrO's picture
Update README.md
80d91b0 verified
metadata
language:
  - en
license: cc-by-4.0
size_categories:
  - 10K<n<100K
task_categories:
  - text-classification
pretty_name: Java Code Readability Mined & Modified
tags:
  - readability
  - code
  - source code
  - code readability
  - Java
features:
  - name: code_snippet
    dtype: string
  - name: score
    dtype: float
dataset_info:
  features:
    - name: name
      dtype: string
    - name: code_snippet
      dtype: string
    - name: score
      dtype: float64
  splits:
    - name: train
      num_bytes: 48684700
      num_examples: 69276
  download_size: 21595103
  dataset_size: 48684700
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train-*

Java Code Readability Merged & Modified

This dataset contains 69276 Java code snippets along with a readability score, mined from Github and automatically processed and labelled.

You can download the dataset using Hugging Face:

from datasets import load_dataset
ds = load_dataset("se2p/code-readability-krod")

The snippets are not split into train and test (and validation) set. Thus, the whole dataset is in the train set:

ds = ds['train']
ds_as_list = ds.to_list() # Convert the dataset to whatever format suits you best

The dataset is structured as follows:

{
  "code_snippet": ...,  # Java source code snippet
  "score": ...          # Readability score
  "name": ...           # The name of the code snippet refering to its origin
}

The main goal of this repository is to train code readability classifiers for Java source code.

Dataset Details

Dataset Description

  • Curated by: Krodinger Lukas
  • Shared by: Krodinger Lukas
  • Language(s) (NLP): Java
  • License: Unknown

Uses

The dataset can be used for training Java code readability classifiers.

Dataset Structure

Each entry of the dataset consists of a code_snippet and a score (and a name). The code_snippet (string) is the code snippet that was downloaded from GitHub. Each snippet has a readability score assigned. The score is based on a five point Likert scale, with 1 being very unreadable and 5 being very readable.

Dataset Creation

Curation Rationale

To advance code readability classification, the creation of datasets in this research field is of high importance. We provide a new dataset generated with a new approach. Previous datasets for code readability classification are mostly generated by humans manually annotating the readability of code. Those datasets are relatively small, with combined size of only 421 samples. As our approach allows automation, we can provide a different scale of code snippets. We share this dataset on Hugging Face to share access and make the ease of usage easy.

Source Data

The initial source of code snippets are from 100 public GitHub which can be found at the end of this file.

Data Collection and Processing

The Data Collection and Preprocessing for this Hugging Face dataset involved two main steps. First, GitHub repositories known for high code quality were mined and labeled as highly readable. The extracted methods are labeled with a score of 3.68. Second, the code was intentionally modified to reduce readability. The resulting code was labelled with a score of 3.26. This resulted in an automatically generated training dataset for source code readability classification.

Who are the source data producers?

The source data producers are the people that wrote the used open source Java projects.

Personal and Sensitive Information

The ratings of the code snippets are automatically assigned. Thus, no personal or sensitive information is contained in this dataset.

Bias, Risks, and Limitations

The assigned labels are not accurate as they are only an average estimate based on a survey. The average score for the mined code snippets of the survey was 3.68. The average score for the modified code snippets of the survey was 3.26.

Recommendations

The dataset should be used to train Java code readability classifiers. We recommend fine-tuning and evaluation on manually labeled data.

Dataset Card Authors

Lukas Krodinger, Chair of Software Engineering II, University of Passau.

Dataset Card Contact

Feel free to contact me via E-Mail if you have any questions or remarks.

Appendix

Origin Repositories