license:mit region:us
---
license: mit
Programminglanguage: "python"
version: "N/A"
Date: "Codesearchnet(Jun 2020 - paper release date)"
Contaminated: "Very Likely"
Size: "Standard Tokenizer (TreeSitter)"
---

### Dataset is imported from CodeXGLUE and pre-processed using their script.

# Where to find in Semeru:
The dataset can be found at /nfs/semeru/semeru_datasets/code_xglue/code-to-code/Method-Generation/dataset/codexglue_method_generation in Semeru


# CodeXGLUE -- Method Generation

Here is the introduction and pipeline for method generation task.

## Task Definition

Method generation is the prediction of a method body implementation conditioned on a signature, a docstring, and any more context. 

## Dataset

We use CodeSearchNet Python dataset. The CodeSearchNet repositories are re-downloaded to extract all the methods, including their signatures, docstrings and bodies. We remove the methods that don't have docstrings and whose name contains 'test'. We preserve the context around this method for auxiliary information since it is really a difficult task to generator the method body only based on its signature/docstring. We also apply literal normalization for better user experience.



### Data Format

The data format of each line in `train/dev/test.jsonl` is:
```json
{
    "signature": "def do_transform(self, v=<NUM_LIT:1>):",
    "body": "if not self.transform:<EOL><INDENT>return<EOL><DEDENT>try:<EOL><INDENT>self.latest_value = utils.Transform ...",
    "docstring": "Apply the transformation (if it exists) to the latest_value",
    "id": "f19:c4:m1"
}
```
The `id` indicts where you can find this method in the raw data. In this instance, it means the 2nd method in the 2nd class in the 19th file. We apply literal normalization to function signature and body, replace `\n` with `<EOL>` and keep track in INDENT and DEDENT.


### Data Statistics

Data statistics are shown in the below table.

| Data Split  |  #Instances |
| ----------- | :---------: |
|    Train    |   893,538   |
|     Dev     |    20,000   |
|    Test     |    20,000   |

## Reference



<pre><code>@article{clement2021long,
  title={Long-Range Modeling of Source Code Files with eWASH: Extended Window Access by Syntax Hierarchy},
  author={Clement, Colin B and Lu, Shuai and Liu, Xiaoyu and Tufano, Michele and Drain, Dawn and Duan, Nan and Sundaresan, Neel and Svyatkovskiy, Alexey},
  journal={arXiv preprint arXiv:2109.08780},
  year={2021}
}</code></pre>
