Mir-2002 commited on
Commit
2b035e4
·
verified ·
1 Parent(s): 095b108

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +29 -47
README.md CHANGED
@@ -12,7 +12,7 @@ size_categories:
12
 
13
  # Overview
14
 
15
- This dataset contains 18,219 rows of code-docstring-ast data along with additional metadata. Data was gathered from various Python libraries and frameworks and their
16
  publicly available GitHub repos. This dataset was created for the purpose of training the [CodeT5+](https://arxiv.org/abs/2305.07922) transformer on AST-enhanced code-to-doc tasks.
17
 
18
  # Sources
@@ -57,11 +57,10 @@ An instance of the dataset is as follows:
57
  {
58
  <library> : <The library from which the source code came from>,
59
  <name> : <The name of the function/class/method>,
60
- <source code> : <The raw source code itself>,
61
  <docstring> : <The corresponding docstring of the code>,
62
  <type> : <Whether it's a function, method, or class>,
63
  <file_path> : <The relative path of the file containing the function>,
64
- <line_number> : <The line number of the function, method, or class within the file>,
65
  <ast_sequence> : <The ast sequence of the raw source code. Scroll down for more info about this>
66
  }
67
  ```
@@ -114,60 +113,43 @@ FunctionDef:calculate_area
114
 
115
  # Preprocessing
116
 
117
- The following preprocessing steps were applied:
118
 
119
- ## Text Cleaning
 
 
 
 
 
120
 
121
- - Removed comments
122
- - Filtering unusual/control characters
123
- - Removed trailing whitespaces
124
- - Converts all whitespace into a single spaces
125
- - Removed tags from docstrings
126
-
127
- ## AST Cleaning
128
-
129
- - Removed noise using a custom blacklist
130
- - Removed abnormally long nodes (>100)
131
- - Stripped blank AST entries
132
- - Ensured ASTs start with the proper root nodes (FunctionDef or ClassDef)
133
-
134
- ## Language Filtering
135
-
136
- - Removed non-English documentations
137
- - Keeps an item if detection fails
138
-
139
- ## Similarity Filtering
140
-
141
- - Removed entries where similarity exceeds threshold (0.7)
142
-
143
- # Split
144
-
145
- - Dataset was split into a 70/15/15 ratio
146
 
147
  # Final Statistics
148
 
149
- The final statistics of the dataset before and after preprocessing are as follows:
 
 
150
 
151
- **Original Count**: 25,480
152
 
153
- **After Preprocessing**: 18,219
154
 
155
- **Retention Rate**: 72%
156
 
157
- **Average Docstring Length**: 272
158
 
159
- **Average Source Code Length**: 1219
160
 
161
- **Average AST Sequence Length**: 91
162
 
163
- **Type Distribution**:
164
- - Methods: 9,135 (50.1%)
165
- - Functions: 6,322 (34.7%)
166
- - Classes: 2, 762 (15.2%)
167
 
168
- **Top Contributors**:
169
- - pytorch: 4,330 (23.8%)
170
- - tensorflow: 3,972 (21.8%)
171
- - django: 1,778 (9.8%)
172
- - matplotlib: 1,454 (8%)
173
- - pandas: 903 (5%)
 
12
 
13
  # Overview
14
 
15
+ This dataset contains 25,000+ rows of code-docstring-ast data along with additional metadata. Data was gathered from various Python libraries and frameworks and their
16
  publicly available GitHub repos. This dataset was created for the purpose of training the [CodeT5+](https://arxiv.org/abs/2305.07922) transformer on AST-enhanced code-to-doc tasks.
17
 
18
  # Sources
 
57
  {
58
  <library> : <The library from which the source code came from>,
59
  <name> : <The name of the function/class/method>,
60
+ <source_code> : <The raw source code itself stripped of its docstrings and comments>,
61
  <docstring> : <The corresponding docstring of the code>,
62
  <type> : <Whether it's a function, method, or class>,
63
  <file_path> : <The relative path of the file containing the function>,
 
64
  <ast_sequence> : <The ast sequence of the raw source code. Scroll down for more info about this>
65
  }
66
  ```
 
113
 
114
  # Preprocessing
115
 
116
+ The dataset generally follows CodeSearchNet's code2nl dataset cleaning standards which are as follows:
117
 
118
+ - Removed comments from the code
119
+ - Removed examples where code cannot be parsed into an AST
120
+ - Remove examples that codes cannot be parsed into an abstract syntax tree.
121
+ - Remove examples where the number of tokens of documents is < 3 or >256
122
+ - Remove examples that documents contain special tokens (e.g. <img ...> or https:...)
123
+ - Remove examples that documents are not English
124
 
125
+ Furthermore, the following cleaning steps specific to this dataset were applied:
126
+ - Docstrings from source codes was stripped
127
+ - Standard text cleaning procedures (normalized whitespaces and special characters)
128
+ - Removed abnormally long AST sequences (>100)
129
+ - Structural pruning of the AST sequence (removing irrelevant or shallow identifiers/nodes)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
 
131
  # Final Statistics
132
 
133
+ ### Final Count : 25,489
134
+
135
+ ### Average Docstring Length : 51
136
 
137
+ ### Average Source Code Length : 591
138
 
139
+ ### Average AST Sequence Length : 72
140
 
141
+ ## Type Distribution
142
 
143
+ **Methods: 13,149(52.1%)**
144
 
145
+ **Functions: 8,671(34.3%)**
146
 
147
+ **Classes: 3,444(13.6%)**
148
 
149
+ ## Major Contributors
 
 
 
150
 
151
+ **TensorFlow (5,455)**
152
+ **PyTorch (5,448)**
153
+ **Matplotlib (2,190)**
154
+ **Django (2,138)**
155
+ **Scipy (1,715)**