bookgen
A python library using nltk to analyse two books and generate a new one.
Installation
pip install bookgen
Usage
from bookgen import BookGen
book = BookGen("word_base_book.txt", "sentence_base_book.txt")
# book.download() will download the nltk extras required, only needed once
print(book.run())
Explanation
BookGen will parse word classes from the first specified book, looking like this:
{"NOUN": ["Mountain", "Valley"], "VERB": ["take", "went"]}
These are sorted by the nltk universal tagset.
The second book serves as sentence base. It will be parsed into a list of word types that represent the whole book.
["NOUN", "VERB", "PREP", "NOUN", "CONJ", "VERB", "."]
Then, it generates a list of words from the words of the first book based on the second book.
["Nathan", "went", "to", "Valley", "and", "peed", "."]
This is joined with some capitalization fixes and returned.
Metadata
Release files for bookgen 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bookgen-1.0.0.tar.gz | 2.7 kB | Without provenance | Details for bookgen-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bookgen-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for bookgen-1.0.0-py3-none-any.whl |
Total release size: 6.6 kB
Release files / bookgen-1.0.0.tar.gz
| Download URL | bookgen-1.0.0.tar.gz |
|---|---|
| Size | 2.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
326b5ec5b16c8e7884a98ef324fee3c8a3721164867a9baaf0fdcd1d7a524a48
|
|
BLAKE2b-256 checksum How to use checksums |
373e54cf3dfe2241bb65137b72bb280bbb33799daa20652362ea2fe05b3e7223
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/3.6.6
|
Release files / bookgen-1.0.0-py3-none-any.whl
| Download URL | bookgen-1.0.0-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7a031905b168bc6050bc7f3f10e43940b537b8c1f0c53a8605ccb22e62226805
|
|
BLAKE2b-256 checksum How to use checksums |
9be2da6c8dbbc666724e6d523f2dabf9546ae3ccc409ee4ab5b682173a3b1b62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/3.6.6
|
Security for bookgen 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.