https://github.com/juliendoutre/baudelaire
A text generator trained over Baudelaire's poems.
https://github.com/juliendoutre/baudelaire
baudelaire-poems nlp python tensorflow
Last synced: about 2 months ago
JSON representation
A text generator trained over Baudelaire's poems.
- Host: GitHub
- URL: https://github.com/juliendoutre/baudelaire
- Owner: juliendoutre
- License: mit
- Created: 2019-11-29T20:04:18.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-05-22T22:34:18.000Z (about 3 years ago)
- Last Synced: 2025-02-02T11:32:51.209Z (over 1 year ago)
- Topics: baudelaire-poems, nlp, python, tensorflow
- Language: Python
- Homepage:
- Size: 47.8 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Baudelaire 📝
A text generator trained over Baudelaire's poems.
## Install the package
Simply run:
```shell
pip3 install baudelaire
```
## Usage
```shell
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:
```shell
python3 -m venv venv
```
Activate it:
```shell
. venv/bin/activate
```
And install the required packages:
```shell
pip3 install -r requirements.txt
```
## Get the dataset
I fetched Baudelaire's poems from this [website](https://www.poesie-francaise.fr/poemes-charles-baudelaire/) using [scrapy](https://scrapy.org/).
Run
```shell
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
- https://www.digitalocean.com/community/tutorials/how-to-crawl-a-web-page-with-scrapy-and-python-3
- https://www.analyticsvidhya.com/blog/2018/03/text-generation-using-python-nlp/