Renaissance translator

Overview

An important and common use for computer science ideas is for translating or converting text from one form, or one language, to another. Tools like Google Translate will convert text from one language to another. Compilers convert computer programs from one programming language to another. For this assignment, you'll create a computer translator that will take text and convert it to Renaissance speech, a form of speech used at Renaissance fairs (or perhaps I should say Renaissance Faires) that may or may not be based in historical reality.

Specifics

Your mission is to create a program to convert English to Renaissance. Here are a variety of features you can add; feel free to push this as far as you like.

  1. Replace words as follows. hello -> well met; goodbye -> fare thee well; please -> prithee; restroom -> privy; here -> hither; maybe -> perchance. Feel free to add more if you like, but embellish this later. You might want to get this working with just a few words, do the rest of the assignment, then come back to finish this for fun.

  2. Renaissance people are very enthusiastic, and have a habit of saying "Huzzah!" a lot. Get your translator to randomly insert "Huzzah!" between sentences. Anytime you encounter the end of a sentence (as denoted by a period, question mark, or exclamation point), decide with a 50/50 chance whether to insert a "Huzzah!"

  3. If a word begins with a capital letter, then when you translate it, it should also begin with a capital letter. Ignore the case of the rest of the word. In other words, translate "Hello" / "HELLO" / "HeLlO" / "HeLLO" / etc. as "Well met", but translate "hello" / "hELLO" / "hElLo" / "hEllo" / etc. as "well met". You should only output "Well met" or "well met" as a translation for any form of "hello" - none of the other letters in "Well met" or "well met" should ever be capitalized apart from possibly the first. (You should definitively not do this by testing individually for all possible ways the word "HeLlO" might appear. You'll have over 200 cases for "restroom" if you do it that way.) Similarly, the word "FrienD" should translate as "Friend".

  4. Get your program to be able to successfully change the English phrase "thank you" to the Renaissance phrase "grammercy". However, if the word "thank" appears on its own without the word "you" immediately following it, the word "thank" should remain unchanged. (Let's just ignore the truly complicated case of "thank thank you" unless you want to think hard about it.)

Here is a sample file that has all punctuation separated by spaces, which makes it easier.