Skip to content

Instantly share code, notes, and snippets.

@pachacamac
Created June 3, 2017 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pachacamac/8af5ea568e56f6c738a0e6b80ff5e834 to your computer and use it in GitHub Desktop.
Save pachacamac/8af5ea568e56f6c738a0e6b80ff5e834 to your computer and use it in GitHub Desktop.
pirate speech
def piratize(text)
dictionary = {"address"=>"port o' call", "admin"=>"helm", "am"=>"be", "an"=>"a", "and"=>"n'", "are"=>"be", "award"=>"prize", "bathroom"=>"head", "beer"=>"grog", "before"=>"afore", "belief"=>"creed", "between"=>"betwixt", "big"=>"vast", "bill"=>"coin", "bills"=>"coins", "boss"=>"admiral", "bourbon"=>"rum", "box"=>"barrel", "boy"=>"lad", "buddy"=>"mate", "business"=>"company", "businesses"=>"companies", "calling"=>"callin'", "canada"=>"Great North", "cash"=>"coin", "cat"=>"parrot", "cheat"=>"hornswaggle", "comes"=>"hails", "comments"=>"yer words", "cool"=>"shipshape", "country"=>"land", "dashboard"=>"shanty", "dead"=>"in Davy Jones's Locker", "disconnect"=>"keelhaul", "do"=>"d'", "dog"=>"parrot", "dollar"=>"doubloon", "dollars"=>"doubloons", "dude"=>"pirate", "employee"=>"crew", "everyone"=>"all hands", "eye"=>"eye-patch", "family"=>"kin", "fee"=>"debt", "female"=>"wench", "females"=>"wenches", "food"=>"grub", "for"=>"fer", "friend"=>"shipmate", "friends"=>"crew", "fuck"=>"shiver me timbers", "gin"=>"rum", "girl"=>"lass", "girls"=>"lassies", "go"=>"sail", "good"=>"jolly good", "grave"=>"Davy Jones's Locker", "group"=>"maties", "gun"=>"bluderbuss", "haha"=>"yo ho", "hahaha"=>"yo ho ho", "hahahaha"=>"yo ho ho ho", "hand"=>"hook", "happy"=>"grog-filled", "hello"=>"ahoy", "hey"=>"ahoy", "hi"=>"ahoy", "hotel"=>"fleebag inn", "i"=>"me", "i'm"=>"i be", "internet"=>"series o' tubes", "invalid"=>"sunk", "is"=>"be", "island"=>"isle", "isn't"=>"be not", "it's"=>"'tis", "jail"=>"brig", "kill"=>"keelhaul", "king"=>"king", "ladies"=>"lasses", "lady"=>"lass", "lawyer"=>"scurvy land lubber", "left"=>"port", "leg"=>"peg", "logout"=>"walk the plank", "lol"=>"blimey", "male"=>"pirate", "man"=>"pirate", "manager"=>"admiral", "money"=>"doubloons", "month"=>"moon", "my"=>"me", "never"=>"nary", "no"=>"nay", "not"=>"nay", "of"=>"o'", "old"=>"barnacle-covered", "omg"=>"shiver me timbers", "over"=>"o'er", "page"=>"parchment", "people"=>"scallywags", "person"=>"scurvy dog", "posted"=>"tacked to the yardarm", "president"=>"king", "prison"=>"brig", "quickly"=>"smartly", "really"=>"verily", "relative"=>"kin", "relatives"=>"kin", "religion"=>"creed", "restaurant"=>"galley", "right"=>"starboard", "rotf"=>"rollin' on the decks", "say"=>"cry", "seconds"=>"ticks o' tha clock", "shipping"=>"cargo", "shit"=>"shiver me timbers", "small"=>"puny", "snack"=>"grub", "soldier"=>"sailor", "sorry"=>"yarr", "spouse"=>"ball 'n' chain", "state"=>"land", "supervisor"=>"Cap'n", "that's"=>"that be", "the"=>"thar", "theif"=>"swoggler", "them"=>"'em", "this"=>"dis", "to"=>"t'", "together"=>"t'gether", "treasure"=>"booty", "vodka"=>"rum", "was"=>"be", "water"=>"grog", "we"=>"our jolly crew", "we're"=>"we's", "whiskey"=>"rum", "whisky"=>"rum", "wine"=>"grog", "with"=>"wit'", "woman"=>"comely wench", "women"=>"beauties", "work"=>"duty", "yah"=>"aye", "yeah"=>"aye", "yes"=>"aye", "you"=>"ye", "you're"=>"you be", "you've"=>"ye", "your"=>"yer", "yup"=>"aye"}
dictionary.default_proc = proc{|h,k| k}
out = ''
word = ''
text.chars.each do |c|
if c =~ /[a-zA-Z'-]/
word << c
else
pword = dictionary[word.downcase]
out << word == word.capitalize ? pword.capitalize : pword
out << c
word = ''
end
end
out
end
txt = <<-EOS
I can write no stately proem
As a prelude to my lay;
From a poet to a poem
I would dare to say.
For if of these fallen petals
One to you seem fair,
Love will waft it till it settles
On your hair.
And when wind and winter harden
All the loveless land,
It will whisper of the garden,
You will understand.
--- Oscar Wilde
EOS
puts piratize(txt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment