print "Welcome to the English to Pig Latin Translator!"
import sys
pyg = "ay"
vowel = "a","e","i","o","u"
v_sound = "hour","heir","honor","honest" # complete???
consonant = "b","c","d","f","g","h","j","k","l","m","n","p","q","r","s","t","v","w","x","y","z"
c_four = "chth","phth","schl","schm","schn","schr","scht","schw","sphr"
c_three = "chr","chl","cht","ngw","phl","phr","psh","sch","scl","scr","sgr","shk","shl","shm","shn","shr","sht","sph","spl","spr","sth","str","tch","thr","thw","tsk"
c_two = "ch"
c_sound = "uni" # complete???
def PygLatin():
def Translate():
c_message = "Your entry %s begins with a consonant sound, so the consonant sound with appended \"-%s\" will be moved to the end. Translated to Pig Latin, your entry is:" %(word,pyg)
confirm = raw_input(word+"\nIs this the word you entered?[Y/N] ")
if confirm in ["y","yes"] :
if word.startswith(vowel) or word.startswith(v_sound) : # Begins with a vowel or vowel sound
print "Your entry \"%s\" begins with a vowel sound, so \"-%s\" will simply be appended at the end. Translated to Pig Latin, your entry is:" %(word,pyg)
pig = "%s-%s" %(word,pyg)
print pig
TryAgain()
# elif len(word) > 100 : # Entirely consonants???
# print "Your entry \"%s\" is entirely consonants, so \"-%s\" will simply be appended at the end. Translated to Pig Latin, your entry is:" %(word,pyg)
# print "%s-%s" %(word,pyg)
# TryAgain()
elif word.startswith(c_four) : # Begins with four consonants
print c_message
pig = "%s-%s%s" %(word[4:],word[0:4],pyg)
print pig
TryAgain()
elif word.startswith(c_three) : # Begins with three consonants
print c_message
pig = "%s-%s%s" %(word[3:],word[0:3],pyg)
print pig
TryAgain()
elif word.startswith(c_two) : # Begins with two consonants
print c_message
pig = "%s-%s%s" %(word[2:],word[0:2],pyg)
print pig
TryAgain()
elif word.startswith(consonant) or word.startswith(c_sound) : # Begins with a consonant or consonant sound
print c_message
pig = "%s-%s%s" %(word[1:],word[0],pyg)
print pig
TryAgain()
else:
print "Either your entry is not English or the Pig Latin Translator has not yet figured out how to translate your word. Sorry!"
TryAgain()
if confirm in ["n","no"]:
TryAgain()
else:
Translate()
word = raw_input("Enter an English word to be translated to Pig Latin: ").lower()
if len(word) > 0 and word.isalpha():
Translate()
elif word.isalpha() :
print "There was something wrong with your entry. Try again using only alphabetic characters."
TryAgain()
else:
PygLatin()
def TryAgain():
repeat = raw_input("\nStart over?[Y/N] ").lower()
if repeat in ["y","yes"] :
print "OK.\n"
PygLatin()
elif repeat in ["n","no"] :
raw_input("\nPress ENTER to exit the English to Pig Latin Translator.")
sys.exit()
else:
TryAgain()
PygLatin()