Git Product home page Git Product logo

rnnpg's Introduction

Chinese Poetry Generation with Recurrent Neural Networks

This project includes the code/model for the paper

Chinese Poetry Generation with Recurrent Neural Networks

@InProceedings{zhang-lapata:2014:EMNLP2014,
  author    = {Zhang, Xingxing  and  Lapata, Mirella},
  title     = {Chinese Poetry Generation with Recurrent Neural Networks},
  booktitle = {Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP)},
  month     = {October},
  year      = {2014},
  address   = {Doha, Qatar},
  publisher = {Association for Computational Linguistics},
  pages     = {670--680},
  url       = {http://www.aclweb.org/anthology/D14-1074}
}

Acknowledgement

Our implementation is greatly inspired by Tomas Mikolov's rnnlm toolkit. We would like to thank Tomas Mikolov for making his code public available.

Dataset

Download the complete dataset from here

Dependencies

  • KenLM
  • G++ (4.4.7)
  • Java (1.8.0_51, 1.6 or 1.7 should also be fine)
  • Python (2.7)

Installation

  1. Install KenLM. Also remember to add kenlm to your LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/afs/inf.ed.ac.uk/user/s12/s1270921/usr/kenlm/lib
  1. Go to rnnpg folder and modify the Makefile (see below). Direct INCLUDES and LDFLAGS to your KenLM library. Also modify the Makefiles in rnnpg-decoder and rnnpg-generator.

  2. Make everything by ./INSTALL.sh

OUT_EXEC = rnnpg 
OBJS = $(patsubst %.cpp, %.o, $(wildcard *.cpp))

CC = g++
CPPFLAGS = -O3 -funroll-loops -ffast-math -finline-functions -Wall -Winline -pipe -DKENLM_MAX_ORDER=6

INCLUDES = -I/afs/inf.ed.ac.uk/user/s12/s1270921/usr/kenlm
LDFLAGS = -L/afs/inf.ed.ac.uk/user/s12/s1270921/usr/kenlm/lib -lkenlm

all : $(OUT_EXEC)
	rm *.o

$(OUT_EXEC) : $(OBJS)
	$(CC) -o $@ $^ $(INCLUDES) $(LDFLAGS)

%.o : %.cpp
	$(CC) $(CPPFLAGS) -c $< -o $@ $(INCLUDES)

clean:
	rm -f *.o
	rm -f $(OUT_EXEC)

Run Experiments

Download data/model from here

# move MISC.tar.bz2 to the root folder of this project, then
tar jxvf MISC.tar.bz2

1. Perplexity

cd experiments
./ppl.sh

2. Generation

cd experiments
./generation.sh

Enjoy the generated poems!

3. BLEU

Download from here

tar jxvf BLEU2-final.tar.bz2 
cd BLEU2-final
cd MERT_channel-1_RNN-CB-POS-LM-Eval-BLEU2
python showBLEU.py .

rnnpg's People

Contributors

xingxingzhang avatar

Watchers

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