File size: 4,151 Bytes
0da4f25
21ccf4a
 
748367f
21ccf4a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0da4f25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21ccf4a
 
 
 
 
 
 
 
6bcfd33
21ccf4a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5d7591c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
---
language:
- en
license: cc-by-4.0
size_categories:
- 10K<n<100K
task_categories:
- text-classification
pretty_name: Java Code Readability Krod
tags:
- readability
- code
- source code
- code readability
- Java
features:
- name: code_snippet
  dtype: string
- name: score
  dtype: float
dataset_info:
  features:
  - name: code_snippet
    dtype: string
  - name: score
    dtype: float64
  splits:
  - name: train
    num_bytes: 43914782
    num_examples: 63460
  download_size: 15905551
  dataset_size: 43914782
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
---

# Java Code Readability Krod

This dataset contains **63460 Java code snippets** along with a **readability score**, mined from [Github](https://github.com/) and automatically processed and labelled.

You can download the dataset using Hugging Face:

```python
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:
```python
ds = ds['train']
ds_as_list = ds.to_list() # Convert the dataset to whatever format suits you best

```

The dataset is structured as follows:

```json
{
  "code_snippet": ...,  # Java source code snippet
  "score": ...          # Readability score
}
```

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**. 
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 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 various public GitHub repositories:
TODO: Add repos


#### 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 downloaded and labeled as highly readable. The extracted methods are labeled with a score of 4.5.
Second, the code was intentionally manipulated to reduce readability. The resulting code was labelled with a score of 1.5.
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 estimation. 

### Recommendations

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

## Dataset Card Authors
Lukas Krodinger, [Chair of Software Engineering II](https://www.fim.uni-passau.de/en/chair-for-software-engineering-ii), [University of Passau](https://www.uni-passau.de/en/).

## Dataset Card Contact
Feel free to contact me via [E-Mail](mailto:[email protected]) if you have any questions or remarks.