Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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)
- Host: GitHub
- URL: https://github.com/gfarrell/markov-writer-py
- Owner: gfarrell
- Created: 2018-08-16T22:57:15.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T02:46:37.000Z (about 2 years ago)
- Last Synced: 2024-11-16T14:11:39.934Z (2 months ago)
- Topics: flask, markov-chain, python, shakespeare-plays, text-generation
- Language: Python
- Homepage: http://shakespeare.gtf.io
- Size: 13.7 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
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_thisspeeches = 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