/baudelaire

A text generator trained over Baudelaire's poems.

Primary LanguagePythonMIT LicenseMIT

Baudelaire 📝

A text generator trained over Baudelaire's poems.

Install the package

Simply run:

pip3 install baudelaire

Usage

baudelaire --help
baudelaire train --epochs 100 --batch_size 50 -o weights.h5
baudelaire write --sequences 10 -o poem.txt -i weights.h5

Set the environment

Create a virtualenv:

python3 -m venv venv

Activate it:

. venv/bin/activate

And install the required packages:

pip3 install -r requirements.txt

Get the dataset

I fetched Baudelaire's poems from this website using scrapy.

Run

scrapy runspider scraping/poems.py -t json -o poems.json

to save the poems contents and a few metadata in a poems.json file.

Dataset description

You can find some metadata about the poems and the collections they are categorized in, in data/stats.json. This json was generated with the scraping/analyzer.py script.

Bibliography