There are many different languages in the world. They are all unique and have their very own dialect. In the Hawaiian language, there are only 13 letters and each word ends in a vowel.
Even though Hawaiian words are written with the help of English alphabets, their pronunciations are very different than that of typical English. In this tutorial, we will design a python program that will help us with the pronunciation of Hawaiian words when given a specific input.
In this program, we will use Python dictionaries to map different letters and their combinations with their specific sounds and pronunciations. Let’s get into it!
Basics of Hawaiian Pronunciation
In the Hawaiian language, only 14 characters are valid(including the space) , eight consonants, namely, h,k,l,m,n,p and ‘(a single apostrophe called okina) and the 5 vowels, a,e,i,o and u.
The pronunciation of the consonants are similar to that of in English. The pronunciation of “w” is a bit tricky in Hawaiian, if it is the first letter of a word or follows an ‘o’ or an ‘u’, then it is pronounced as the normal “w”. Whereas, if it follows an a, e or an i, it’s pronounced as “v” instead.
The pronunciation of the vowels are:
- a- sounds like “ah”.
- e-sounds like “eh”.
- i-sounds like “ee”.
- o-sounds like “oh”.
- u-sounds like “oo”.

Again there are some combinations of vowels that have a distinct sound, they are:
- ai sounds like “eye”
- ae sounds like “eye”
- ao sounds like “ow”
- au sounds like “ow”
- ei sounds like “ay”
- eu sounds like “eh-oo”
- iu sounds like “ew”
- oi sounds like “oy”
- ou sounds like “ow”
- ui sounds like “ooey”
For some combinations, there exists no sound such as “oa” . In this case, the vowels are pronounced separately. If there are three vowels back to back, then the combination that has a sound is pronounced that way and the other one pronounced separately.
Last but not the least, the okina(the apostrophe) is like a “stop” in a word. It can be used to separate vowels.
Words having Hawaiian pronunciation must end in a vowel.
Suggested: Converting Base-2 Binary Number Strings to Integers in Python.
Implementing the Pronouncer
We will simplify the program by creating different functions and associate the vowel with their sounds in key and value pairs in dictionaries.
We will also take input from the user and if the input is a word that doesn’t end in a consonant, then we will display the corresponding Hawaiian pronunciation.
The dictionaries are as follows:
#initializing the dictionaries
Sing_vowels={
'a': 'ah',
'e': 'eh',
'i': 'ee',
'o': 'oh',
'u': 'oo'
}
paired_vowels={
'ai': 'eye',
'ae': 'eye',
'ao': 'ow',
'au': 'ow',
'ei': 'ay',
'eu': 'eh-oo',
'iu': 'ew',
'oi': 'oy',
'ou': 'ow',
'ui': 'ooey',
'iw': 'v',
'ew': 'v',
'aw': 'v',
'ow': 'w',
'uw': 'w'
}
The check_word function
takes an input word, converts it to lowercase, and checks if it ends with a vowel. If it does, it iterates through the input, and if a character is a vowel, it checks if the next character is also a vowel or ‘w’. If so, it finds the corresponding pronunciation for the vowel pair in the paired_vowels dictionary.
If not, it finds the corresponding pronunciation for the single vowel in the Sing_vowels dictionary. Otherwise, it adds the consonant to the output pronunciation. Finally, it prints the Hawaiian pronunciation of the input word.
Let’s create the check_word() function.
#creating the function
def check_word(inp):
hw=''
leng=len(inp)
inp=inp.lower()
if(inp[leng-1] in "aeiou"):
for i in range(leng):
if(inp[i] in "aeiou"):
if(i<leng-1 and inp[i+1] in "aeiouw"):
for key in paired_vowels:
if (key==str(inp[i]+inp[i+1])):
pronun=paired_vowels[key] + '-'
hw=hw+pronun
i+=1
else:
continue
else:
for key in Sing_vowels:
if key==inp[i]:
pronun=Sing_vowels[key]+'-'
hw=hw+pronun
else:
pronun=inp[i]
hw=hw+pronun
print("The Hawaiian pronunciation of the word is=",hw[0:len(hw)-1])
else:
print("The word doesn't have a Hawaiian pronunciation!")
#driver code
print("-"*80)
print("Welcome to Hawaiian Pronouncer!")
print("-"*80)
word=input("Enter the word in english= ")
check_word(word)
Program Output
--------------------------------------------------------------------------------
Welcome to Hawaiian Pronouncer!
--------------------------------------------------------------------------------
Enter the word in english= Aloha
The Hawaiian pronunciation of the word is= ah-loh-hah
Check out: Top 5 Python libraries for Natural language processing.
Conclusion
We’ve now learned how to create a simple yet effective Hawaiian pronouncer using Python. This program demonstrates the power of Python dictionaries and basic programming constructs like loops and conditional statements. What other languages can you think of that could benefit from a pronunciation helper like this?