Datasets:
File size: 4,094 Bytes
c77dd91 6d66af4 c77dd91 6d66af4 c995223 c77dd91 |
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 |
---
task_categories:
- summarization
- text2text-generation
language:
- en
tags:
- code
size_categories:
- 10K<n<100K
---
# Overview
This dataset contains Python code-docstring pairs, whereas the docstrings are in Google style. A Google style docstring is structured as follows:
```
<Description of the code>
Args:
<var1> (<data-type>) : <description of var1>
<var2> (<data_type>) : <description of var2>
Returns:
<var3> (<data-type>) : <description of var3>
Raises:
<var4> (<data-type>) : <description of var4>
```
The format varies widely (like additional sections such as Examples, Notes, etc) but generally speaking, it should contain an Args/Parameters and Returns section.
# Source
The dataset was gathered from 3 different sources:
## CodeSearchNet
From their Python split of ~250k samples, ~23k samples was extracted. A less than 10% sample retention, most samples from CodeSearchNet contained informal docstrings that
only contained descriptions and no sections.
## Repositories Under Google's GitHub Organization Page
You can find the specified page here [here](https://github.com/search?q=topic%3Apython+org%3Agoogle+fork%3Atrue&type=repositories). These repos are dictated by the list:
```
repos = [
"https://github.com/google/python-fire",
"https://github.com/google/yapf",
"https://github.com/google/pytype",
"https://github.com/google/tf-quant-finance",
"https://github.com/google/budoux",
"https://github.com/google/mobly",
"https://github.com/google/temporian",
"https://github.com/google/pyglove",
"https://github.com/google/subpar",
"https://github.com/google/weather-tools",
"https://github.com/google/ci_edit",
"https://github.com/google/etils",
"https://github.com/google/pcbdl",
"https://github.com/google/starthinker",
"https://github.com/google/pytruth",
"https://github.com/google/nsscache",
"https://github.com/google/megalista",
"https://github.com/google/fhir-py",
"https://github.com/google/chatbase-python",
"https://github.com/tensorflow/tensorflow",
"https://github.com/google/project-OCEAN",
"https://github.com/google/qhbm-library",
"https://github.com/google/data-quality-monitor",
"https://github.com/google/genai-processors",
"https://github.com/google/python-proto-converter",
"https://github.com/google/sprockets",
"https://github.com/keras-team/keras",
"https://github.com/scikit-learn/scikit-learn",
"https://github.com/apache/beam",
"https://github.com/huggingface/transformers"
]
```
A total of ~11k samples was gathered from this source.
## Juraj's Python Google-style Docstrings Dataset
I found this dataset here and is made my user Juraj-juraj. You can find the dataset [here](https://huggingface.co/datasets/juraj-juraj/python_googlestyle_docstrings).
A total of ~25k samples was gathered from this source, after further preprocessing.
# Preprocessing Steps
The following cleaning, normalizing and preprocessing steps were performed:
1. Removed duplicates based on both code and docstring
2. Remove samples with empty code and docstrings
3. Remove samples with extremely short entries (<20 chars)
4. Remove samples with extremely long entries (>5000 chars)
5. Removed comments and docstring from the code
6. Removed samples where docstring isn't in English (using langdetect)
7. Removed samples where docstring contained special characters like html tags or URLS
8. Using CodeT5+ tokenizer, removed samples where docstring tokens are < 12 or > 256
9. Normalized all docstring entries by removing any indentions
# Data Structure
The data structure of the dataset is as follows:
```
<code> : <The code, removed of docstrings and comments>,
<docstring> : <The corresponding docstring of the code>,
<source> : <The source which the code came from>
```
The source is any of the following:
**CodeSearchNet** - from the CodeSearchNet dataset <br>
**github-repos** - from the repositories under Google's Organization GitHub page <br>
**juraj-google-style** - from Juraj's Python Google-style docstring dataset
|