A rhyming pun generator.
Project description
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" |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file punsy-0.0.4.tar.gz.
File metadata
- Download URL: punsy-0.0.4.tar.gz
- Upload date:
- Size: 895.2 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c463cd798e1bab73cb67e0978485ffb73f6c5e6bf96f31d320d61eb72b210ca
|
|
| MD5 |
8123a5c829916c6c51b3c1ca6a27ead0
|
|
| BLAKE2b-256 |
c9f327fb99051a02ef42d403e1c5bd2862cf1af71ffa65bb2b3becb6214d5b91
|
File details
Details for the file punsy-0.0.4-py3.8.egg.
File metadata
- Download URL: punsy-0.0.4-py3.8.egg
- Upload date:
- Size: 906.1 kB
- Tags: Egg
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
875de35d029311cfac96b75495a19a77d6a6eee30d31cd2b9f4b02a038023825
|
|
| MD5 |
f7391a709fc33012526ca0a471a0f2f9
|
|
| BLAKE2b-256 |
486c350e36d925ac063a891babac7d502554c68743427691161ca9da90dc78de
|
File details
Details for the file punsy-0.0.4-py3-none-any.whl.
File metadata
- Download URL: punsy-0.0.4-py3-none-any.whl
- Upload date:
- Size: 899.0 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70d1102e4e5ea4893dc928881f146a0e42d1bae85fa5328e99e8072602db40b5
|
|
| MD5 |
71393038a4e69179d42977352777c201
|
|
| BLAKE2b-256 |
a436754fe33690a639ac3507136f7f189d76cebd87a94a986fb62d8e4e785366
|