Code Monkey home page Code Monkey logo

msrc-dpu-learning-to-represent-edits's Introduction

Learning to Represent Edits

This repo contains scripts to extract the Github code edits datasets used in "Learning to Represent Edits" by Yin et al., 2018.

Usage

First, create a conda environment that includes all required libraries.

conda env create -f environment.yml

source activate github_edits  # activate the environment

You also need to install dotnet core 2.1.

Run the script run.sh in the repo's root folder

./run.sh

This script will (1) crawl the Github to clone repos listed in sampled_repos.txt, (2) extract commits using DumpCommitData/extract_commits.py; (3) filter the extracted commits and perform cannonicalization, and extract the Abstract Syntax Tree of the previous and updated code in a commit (e.g., renaming locally defined variables)

The final output file DumpCommitData/github_commits.dataset.jsonl is a jsonl file, with each line consisting of a json-serialized entry. The format is:

Field Description
Id Id of the entry, format is `{ProjectName}
PrevCodeChunk Untokenized previous code (i.e., code before editing)
UpdatedCodeChunk Untokenized updated code (i.e., code after editing)
PrevCodeChunkTokens Tokenized previous code
UpdatedCodeChunkTokens Tokenized updated code
PrevCodeAST Json-serialized Abstract Syntax Tree of the previous code
UpdatedCodeAST Json-serialized Abstract Syntax Tree of the updated code
PrecedingContext Tokenized 3 lines of code before the edit
SucceedingContext Tokenized 3 lines of code after the edit

Citing

If you use this extractor in an academic work, please consider citing


@article{yin2018learning,
   author = {{Yin}, P. and {Neubig}, G. and {Allamanis}, M. and {Brockschmidt}, M. and {Gaunt}, A.~L.},
   title = "{Learning to Represent Edits}",
   journal = {ArXiv e-prints},
   archivePrefix = "arXiv",
   eprint = {1810.13337},
   year = 2018,
   month = oct,
}

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

msrc-dpu-learning-to-represent-edits's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

msrc-dpu-learning-to-represent-edits's Issues

Lack of comparison with state-of-art in SE field

It is not a new research question in SE to learn edit script from some example changes and automatically apply the edit script to other code, which is called systematic edits. IMO, the aim of learning representation of source code changes is similar with systematic edits, and some methods like LASE [1] and Rase [2] should be compared.

[1] Meng, N., Kim, M., & McKinley, K. S. (2013). LASE: Locating and Applying Systematic Edits by Learning from Examples. In Proceedings of the 2013 International Conference on Software Engineering (pp. 502โ€“511). Retrieved from http://dl.acm.org/citation.cfm?id=2486788.2486855
[2] Meng, N., Hua, L., Kim, M., & McKinley, K. S. (2015). Does Automated Refactoring Obviate Systematic Editing? In Proceedings of the 37th International Conference on Software Engineering - Volume 1 (pp. 392โ€“402). Retrieved from http://dl.acm.org/citation.cfm?id=2818754.2818804

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.