punsy
A rhyming pun generator for Python
Initial POC
The POC takes in a sentence, picks out the last word, finds a random rhyming match and inserts it in place. E.g.
"Napoleon Dynamite" -> "Napoleon VEGEMITE"
To install, run:
pip install punsy
You can then run punsy with:
punsy --sentence 'napoleon dynamite'
An example run:
20:10:22 │ ☯ ~ punsy --sentence 'napoleon dynamite'
2019-08-09 00:55:24,851 punsy.punsy INFO Parsing & loading 125699 entries from CMU dictionary file
125700it [00:02, 58591.59it/s]
2019-08-09 00:55:27,005 punsy.punsy INFO Pronunciation of "DYNAMITE" is "D-AY1-N-AH0-M-AY2-T"
2019-08-09 00:55:27,005 punsy.punsy INFO Fetching rhymes, applying offset=2: "N-AH0-M-AY2-T"
2019-08-09 00:55:27,005 punsy.punsy INFO Rhymes for DYNAMITE: ['DYNAMITE']
2019-08-09 00:55:27,005 punsy.punsy INFO Generated pun for napoleon dynamite: napoleon DYNAMITE (DYNAMITE -> DYNAMITE)
2019-08-09 00:55:27,181 punsy.punsy INFO napoleon DYNAMITE
Docker
You build the docker image and run the POC with
make poc
Running interactively
- Enter the docker container with
make build shell
Option 1:
You can use the punsy/cmu.py command with the following format:
./punsy/cmu.py <cmu_file_path> <sentence> <offset>
Option 2: ipython
Then, launch the ipython command and use as follows (output omitted):
In [1]: from punsy import cmu
In [2]: poc = cmu.POC()
In [3]: poc.run('NAPOLEON DYNAMITE', offset=2)
The Suffix trie
You can experiment with the suffix trie by running it directly with
./punsy/structs/suffix_trie.py
OR, the regular trie with
./punsy/structs/trie.py
Hall of Fame
As time passes, this will hopefully fill with some legitimately funny examples! Until then, we have these :)
| command | output |
|---|---|
| 'Adventure Time' | "Adventure PART-TIME" |
| 'A Good Day To Die Hard' | "A Good Day To Die AVANT-GARDE" |
| 'The Rolling Stones' | "The Rolling CLONES" |
Metadata
Release files for punsy 0.0.4
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 | |
|---|---|---|---|---|
| punsy-0.0.4.tar.gz | 895.2 kB | Without provenance | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| punsy-0.0.4-py3.8.egg | Legacy Egg format | - | - | Details |
| punsy-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.7 MB
Release files / punsy-0.0.4.tar.gz
| Download URL | punsy-0.0.4.tar.gz |
|---|---|
| Size | 895.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c463cd798e1bab73cb67e0978485ffb73f6c5e6bf96f31d320d61eb72b210ca
|
|
BLAKE2b-256 checksum How to use checksums |
c9f327fb99051a02ef42d403e1c5bd2862cf1af71ffa65bb2b3becb6214d5b91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
|
Release files / punsy-0.0.4-py3.8.egg
| Download URL | punsy-0.0.4-py3.8.egg |
|---|---|
| Size | 906.1 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
875de35d029311cfac96b75495a19a77d6a6eee30d31cd2b9f4b02a038023825
|
|
BLAKE2b-256 checksum How to use checksums |
486c350e36d925ac063a891babac7d502554c68743427691161ca9da90dc78de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
|
Release files / punsy-0.0.4-py3-none-any.whl
| Download URL | punsy-0.0.4-py3-none-any.whl |
|---|---|
| Size | 899.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
70d1102e4e5ea4893dc928881f146a0e42d1bae85fa5328e99e8072602db40b5
|
|
BLAKE2b-256 checksum How to use checksums |
a436754fe33690a639ac3507136f7f189d76cebd87a94a986fb62d8e4e785366
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
|
Security for punsy 0.0.4
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.