Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gfarrell/markov-writer-py

Text generator based on markov chains, implemented in python (just for fun)
https://github.com/gfarrell/markov-writer-py

flask markov-chain python shakespeare-plays text-generation

Last synced: about 19 hours ago
JSON representation

Text generator based on markov chains, implemented in python (just for fun)

Awesome Lists containing this project

README

        

# Markov Text Generator

Generates text based on some input text. Currently designed to parse Hamlet and
write like any of the characters. Downloads the text from the internet.

## Installation

Requires python3, best run inside a virtualenv.

# requires python3
# setup virtualenv
python3 -m venv ./env
# activate env
. ./env/bin/activate
# install requirements
pip install -r requirements.txt

## Usage

### Command line usage

from sources.shakespeare import load, plays
from markov import write_like_this

speeches = load(plays["hamlet"])
speech = write_like_this(speeches["HAMLET"])

### Running a server

You can run a server to generate speeches from your favourite characters! Fire
it up as follows:

python application.py

#### List plays

GET /plays

#### List characters

GET /characters/

#### Generate a speech

GET /speech//

## Sample Output

### Hamlet

> aside nay speak 'sblood there seek out at a divinity that ever the ominous horse hath made am easier to make the king's mess 'tis not shame to note that i for the death have it is fashion i' the mean my word for god's love make known now my weakness and thereabout of his visage together

### Ophelia

> could beauty my lord you now receive them

### Laertes

> think it my father comes a woodcock to my lord