Git Product home page Git Product logo

code-snippets-dataset's Introduction

code-snippets-dataset

Dataset builder for Code Snippets Dataset

Prerequisites

  1. Make sure that you have Java installed (suggested version jdk-11.0.2)
  2. Download and extract the SourceMeter tool from this website
  3. Download and extract the Readability tool from this website (direct link available here)
  4. Download and extract the CodeSearchNet Java corpus snippets from this repo (direct link available here)
  5. Edit file properties.py to set the path of Java, the path to SourceMeterJava.exe and rsm.jar, the path to the dataset, the path of the results folder, and a directory to be used as temporary directory.

Building the dataset

  1. Execute the script 1_run_all_metrics.py and the results folder will be populated with the metrics in CSV format.
  2. Execute the script 2_run_asts.py in order to create the files that contain the AST representations within the results folder.
  3. Execute the script 3_preclustering.py to split the code snippets into smaller groups, with respect to their cyclomatic complexity and number of operators.
  4. Execute the script 4_distance_matrices.py, which calculates the distance matrices between the snippets of each file and stores the results.
  5. Execute the script 5_clustering.py in order to make use of the generate distance matrices and perform the hierarchical clustering.

Migrating to MongoDB

  1. Create the file mongo/.env based on the file mongo/.env.sample to set the MongoDB uri and the path to the results folder, the path to the dataset, the path to the ASTs folder and the path to the generated clusters folder.
  2. Execute the nodejs script mongo/upload-metrics.js in order to parse all the generated files of the analysis and migrate the results to a MongoDB instance.

code-snippets-dataset's People

Contributors

karanikiotis avatar thdiaman avatar

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.