danmaps / spooner

programmatic spoonerisms
MIT License
5 stars 2 forks source link
natural-language-processing nlp python rhyme-analysis

Documentation Status PyPI version codecov Build Status Code style: black

spooner

Generates spoonerisms based on sounds in words.

STANDARD DISCLAIMER: Spoonerisms made by this program are not guaranteed to be funny, but they are technically spoonerisms.

Inspired by a great podcast episode, I created this to learn about packaging, flit, tox, pytest, and coverage. I also threw in a few learning experiences related to Azure pipelines and black. It went surprisingly well, so now I have a thing that lives on the internet. Anyone can install and play with it! Neat!

Installation

pip install spooner

Usage

Use it like this:

>>> import spooner as sp
>>> sp.phonemes("trail")
['T', 'R', 'EY1', 'L']
>>> sp.spoon("trail snacks")
{'trail': ['snail'], 'snacks': ['tracks', 'trax']}
>>> sp.sentence("let's eat trail snacks")
["let's treat ail snacks", "let's treat ale snacks", "let's eat snail tracks", "let's eat snail trax"]