Skip to content

Instantly share code, notes, and snippets.

@aezell
Created March 13, 2017 16:10
Show Gist options
  • Save aezell/16090db1e30f4c3f42c93a85f97a1847 to your computer and use it in GitHub Desktop.
Save aezell/16090db1e30f4c3f42c93a85f97a1847 to your computer and use it in GitHub Desktop.
sentence = "I don't really know how to handle the changes that we seem to deliberate about while smiling."
words = sentence.split(" ")
vowels = ["a","e","i","o","u"]
digraphs =["bl", "br", "ch", "ck", "cl", "cr", "dr", "fl", "fr", "gh", "gl", "gr", "ng", "ph", "pl", "pr", "qu", "sc", "sh", "sk", "sl", "sm", "sn", "sp", "st", "sw", "th", "tr", "tw", "wh", "wr"]
trigraphs = ["nth", "sch", "scr", "shr", "spl", "spr", "squ", "str", "thr"]
new = []
for word in words:
if word[0].lower() in vowels:
new.append(word + "ay")
continue
if word[:3].lower() in trigraphs:
new.append(word[3:] + word[:3] + "ay")
continue
if word[:2].lower() in digraphs:
print(word)
new.append(word[2:] + word[:2] + "ay")
continue
new.append(word[1:] + word[0] + "ay")
output = " ".join(new)
print(output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment