GithubHelp home page GithubHelp logo

tandon-a / tolkien-bot Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 17 KB

Character Level Language Model (LSTM) to generate texts like that of J. R. R. Tolkien.

License: MIT License

Python 100.00%
char-rnn text-generation natural-language-processing lstm tensorflow

tolkien-bot's Introduction

Tolkien Bot

Character level language model implemented in tensorflow to generate text.

Prerequisites

  • Python 3.3+
  • Tensorflow 1.6+
  • Training Data

Model Architecture

The model used in this project is a 4 layer LSTM model with 512 neurons in each layer.

Usage

To train the model:

> python train.py --file_path train_file.txt --model_dir sbot_model/ --meta_dir meta_dir/
  • file_path: Path of the training text file
  • model_dir: Path of the directory where model files would be saved. (Default: "model_dir/")
  • meta_dir: Path of the directory where training file metadata would be stored. (Default: "meta_dir/")

To test the model:

> python test.py --meta_dir meta_dir/ --model_dir sbot_model/
  • meta_dir: Path of the directory where training file metadata is stored.
  • model_dir: Path of the directory where model files are stored.

Results

Trained LSTM Model on Lord of the Rings.

Model Output 1

A and of the Elves see
And the sound of the horr
And the the sale the hound of the sall And the soon of the old of the Calrow
And the soon of the ord was searing and salled and seemed to the sea
and the sear of the freen and the dark side of the sall And see the sound of the wold And tare and seen a The hair of the wold And the word of the hill
And the soot of the Countains And the sang was seared and salked aand and sell And sat the sound of the wold And talled and salk and salked And tore and slowled and set in a slade, And the song af the sall was slawe
and the dark of the dark and see and seen And the soor of the sall And the land of the word
And tared and sat in the same And the sigh was all and sended And tall and seep and salled and saiked and saled And net the sound of the door and seen

Model Output 2

shadows in the matthr of the root. It was a
splender of the trees, only that they were still and their campany speak and went along a standing shadow of the thees like a shadow of the dimrer in the trees. `Ahen as they were and said, and the south of the stream of the Lord of Lady full sun in the stream and fear the halls of the trees and the world of the Lady and the water sat and time of course, and they saw a light of the great clat mountains in the tall stars of the days that they said the wizard fingered and was still a shadow behind them. The wizard was long again, and leaping the rrand to the days of the Lady Mountains. The end of the dear was still silver of the same seemed to be his silence and heard and the dwarves was said for a white and great silver had crossed the hend of the Great Riders and the trees were green

Model Ouput 3

rodo. `I fear our foge, but I am said Bilbo. 'It is not that we will be to see almost of for a distrebate to fond of the sound of sourh. It's not forgotten it without us and cay to get to can no know that even if this is a long party return. I have seen their heart in the land,' said Bilbo. 'The doors was not snown of the elf-town. We must seem it sorth and I have gate the evil to him. I do not ind whisper: I have his dogs for my world. I have been known to tild you of the root and he was glimper and darkness, the side of Gerifn will seal it, who was a
inger it and be affer the buttles and the words of the Sun rather are that is not say out lands, and there is head trees. I think I took to talk and was Gandalf and he had to go of at least. ' `Well, Grodn and Pippin and Kili in the East Rnole as deeped from the Elves and the bridge of Lurien was a spear of green and sat the trail of half. He saw a
strange to be seen his

Experiment

Trained the model on Queen songs.

Model Output Queen

'm live mat, I'll leav your len rt wes

Whme you say to live (oon't lo e

And I'm young do is do it live is born litely love

And I love in all you'me all

Woist love is in you, live se leavino head

Whan it all you gonna los to han love

I wont it all I want it all I wan' toose no fall you

I can t beat th the sige to everything wo lo lo so e nee doh

Let me san , hoin alone and teep a d roeds, IAll naiding times and teal

I fan't live, it slw you wead tt all on time

Iell the eme of mash

Yo yo

Acknowledgement

License

This project is licensed under the MIT License - see the LICENSE file for details

Author

Abhishek Tandon/ @Tandon-A

tolkien-bot's People

Contributors

tandon-a 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.