A module and command to turn English into Pirate speak.
Arrr.py - Pirate Speak for Python
A simple script / module to turn plain English into Pirate speak. Arrr.
Someone mentioned something called “Pirate Python”, I idly wondered if anyone had made an English to Pirate-ish module/command written in Python (they hadn’t), I realised I had a burning desire to make one, and things got out of hand. :-)
To install simply type:
$ pip install arrr
…and the package will download from PyPI. If you wish to upgrade to the latest version, use the following command:
$ pip install --no-cache --upgrade arrr
Once installed, you’ll find you have a pirate command to use in your shell.
To read the (non-Pirate friendly) help, simply type:
$ pirate --help
$ pirate -h
To translate plain English into something Pirate-ish simply call the command followed by some English sentence:
$ pirate hello there. how are you today? Ahoy there. Weigh anchor and hoist the mizzen! How are ye today?
The pirate command will reply with a Pirate-ish equivalent (as shown above).
This software misbehaves like a Pirate.
Sometimes, the pirate command will not only translate English to Pirate-ish, but will also interject with Pirate sayings (such as, “Weigh anchor and hoist the mizzen!” as shown above).
This is entirely normal and perfectly Piratical behaviour. What else were you expecting..?
Using the API
The arrr module’s API is fully documented below. All you really need is to import the translate function and use that to return Pirate-ish sentences from a given input in English:
from arrr import translate english = "Hello there. How are you?" pirate = translate(english) print(pirate)
The script above will print output similar to that for the command-line usage example shown above.
The source code is hosted in GitHub. Please feel free to fork the repository and contribute. Assuming you have Git installed you can download the code from the canonical repository with the following command:
$ git clone https://github.com/ntoll/arrr.git
Ensure you have the correct dependencies for development installed by creating a virtualenv and running:
$ pip install -r requirements.txt
Pull requests are most welcome! Honestly, the arrr module was cobbled together in about 5 minutes and I went overboard (geddit?) with creating a simple yet well packaged and documented project so arrr can act as a good example for beginner developers.
If you find any bugs, submit a new issue.
- Plundered more piratical phrases from t’interwebz.
- A more piratical handling of exceptions.
- More salty seadog parlay vocabulary.
- Minor additions to the vocabulary.
- Black (spot) formatted.
- Better arrrg parsing contributed by Tony “buccaneer baloney” Shaw.
- Corrections of speeling mistaiks by Esteve “make mine an Aranjuez” Fernandez.
- Major code optimizations by old salty sea dog Terry Jones.
- A more terrifying logo by Cap’n Steve “Inkspot” Hawkes.
- Addition of a code of mis-conduct (for Pirates) by terror of the seas, Tim “No beard” Golden.
- Minor documentation fixes.
- Minor corrections in the code.
- Initial release.
- Very simple implementation.
- No tests.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size arrr-1.0.2-py3-none-any.whl (6.7 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
|Filename, size arrr-1.0.2.tar.gz (6.7 kB)||File type Source||Python version None||Upload date||Hashes View|