GithubHelp home page GithubHelp logo

hjpwhu / ancient-chinese-poem-generator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from clover27/ancient-chinese-poem-generator

0.0 2.0 0.0 301.36 MB

course project

License: MIT License

JavaScript 5.07% CSS 1.04% HTML 0.62% Python 93.24% Shell 0.03%

ancient-chinese-poem-generator's Introduction

Ancient-Chinese-Poem-Generator

This generator generates Chinese poem automatically when given the first sentence or the initial characters. Basically, it's a rule based sequence to character model. 2 or 3 LSTMs are stacked together and trained as a generative model. To make poem more human-written alike, tone pattern rule is also added.

This is a group project for CSCI 544, Applied Natural Language Processing.

Members:

  • Shengyu Chen
  • Shuai Zhou
  • Yizhao He
  • Zichen Yang

Live Demo

We provide a User Interface to demo our Poem Generator: http://poem.knotesapp.com/

For fast testing, type in the first sentence: 春至花海棠 , leave intial characters empty and press Generate button

UI

Requirements

  • python 3
  • numpy, scipy
  • yaml
  • HDF5 and h5py
  • TensorFlow
  • Keras

Usage

Train

python ./lstm/train.py [-m SAVE_PATH] [-d DATA_PATH] [-v]

Generate

python ./lstm/generate.py [-p PRIME] [-s SENTENCE] [-v VOCAB_PATH] [-w MODEL_WEIGHTS_PATH] [-m MODEL_STRUCT_PATH]

Sample

春至花海棠,
衰家夜有人,
一去见家悲,
今气又去禅。

Parameters

The first version is a sequence to word language model based on LSTM programmed in Python with Keras.

All poems used in training are 5-character simplified Chinese poems written in Tang dynasty.

  • data size: 16,000+ poems
  • memory units number: 256 to 700
  • dropout: 0.2
  • batch size: 64 to 256
  • epoch: 100+
  • sequence length: 6 or 8
  • number of LSTM layers: 2 to 3

Data Source

All poetry data comes from JackyGao's work, which is a great contribution for this model. Peotries are labed with tone patterns which are the rules Chinese poems need to follow.

License

MIT

ancient-chinese-poem-generator's People

Contributors

clover27 avatar dukewan avatar shuiai avatar zc-yang avatar

Watchers

 avatar  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.