Giter Club home page Giter Club logo

grammarcnn's Introduction

GrammarCNN

Usage

To train new model

In folder model/, train new model

python3 run.py train [train|dev|test] [tree|var|func]

tree for nonterminal nodes, var for variable nodes, and func for function nodes.

train, dev and test denote the evaluation set.

To predict

After tree, var, and func are trained.

In folder predict/

python3 run.py [pre|eval]

Dependenices

  • NLTK 3.2.1
  • Tensorflow 1.3.1
  • Python 3.5
  • Ubuntu 16.04
  • Java 1.8

Examples

We successly generated.

class BootyBayBodyguard(MinionCard ) : 
   def __init__ (self) :
       super().__init__("Booty Bay Bodyguard", 5, CHARACTER_CLASS.ALL, CARD_RARITY.COMMON)
   def create_minion (self, player) :
       return Minion(5, 4, taunt = True)

Example Code:

class BootyBayBodyguard(MinionCard ) : 
    def __init__ (self) :
        super().__init__("Booty Bay Bodyguard", 5, CHARACTER_CLASS.ALL, CARD_RARITY.COMMON)
    def create_minion (self, player) :
        return Minion(5, 4, taunt = True)

Our model tends to generate a structrual correct code, which leads to a higher StrAcc but a similar BLEU compared with previous works.

Code we generated.

class AnnoyoTron(MinionCard ) : 
    def __init__ (self) :
        super().__init__("Annoy-o-Tron", 2, CHARACTER_CLASS.ALL, CARD_RARITY.COMMON, minion_type = MINION_TYPE.MECH, divine_shield = True)
    def create_minion (self, player) :
        return Minion(1, 2, taunt = True, divine_shield = True)

Example Code:

class AnnoyoTron(MinionCard ) : 
    def __init__ (self) :
        super().__init__("Annoy-o-Tron", 2, CHARACTER_CLASS.ALL, CARD_RARITY.COMMON, minion_type = MINION_TYPE.MECH)
    def create_minion (self, player) :
        return Minion(1, 2, divine_shield = True, taunt = True)

grammarcnn's People

Contributors

anonymous15432 avatar

Watchers

James Cloos 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.