LiuZeJie97 / Code-Generation-From-Flowcharts-with-Texts-A-Benchmark-Dataset-and-An-Approach

Code for the paper "Code Generation From Flowcharts with Texts: A Benchmark Dataset and An Approach"
13 stars 2 forks source link
code-generation flowchart

FC2Code

Code for the paper "Code Generation From Flowcharts with Texts: A Benchmark Dataset and An Approach". The presentation is here.

Our model is developed based on TRANX, please cite their paper if using our model.

Dataset Format

The folder "FC2Code" contains the following files:

code.txt

  We obtained 320 code from LeetCode

flowchart.txt

 We manually drew the flowchart for each code. The first part are the basic information of each node:

[node id] => [node type]: [the text contained within the node]

 The second part are the associations between nodes:

[node id] ( [yes\no\None] ) -> [node id]

 You can visit http://flowchart.js.org and translate the flowchart.txt into pictures.

mapping_relations.txt :

  The relationships between the nodes and the code snippets, can only be used in the training phase.

sequence.txt

 We sort the nodes according to the code, can only be used in the training phase.

Two-Stage Code Generation Model

Our model can be divided into 2 stages:

The First Stage

  1. convert flowchart into pseudo_code

    https://github.com/LiuZeJie97/flowchart-to-code

The Second Stage

  1. convert (pseudo_code, code) pairs into pickled files:

    model\second_stage\datasets\FC2Code\fc2code_dataset.py

  2. train or test on the pickled files:

    model\second_stage\run_batch.py