I am trying to convert words of english dictionary into simple phoneme using python. I am using python 3.5 while all the examples are for python 2 +.
For example in the text below of file test.txt:
what a joke
is your name
this fall summer singer
well what do I call this thing mister
Here firstly I want to extract each word then convert them to phoneme. This is the result I want
what WH AT
a AE
joke JOH K
is ES
....and so on
This is my code for python but its too early and too less . Could you please suggest me more as to convert what to WH AT i need to first find if there are letters wh then replace it with WH
with open ('test.txt',mode='r',encoding='utf8')as f:
for line in f:
for word in line.split():
phenome = word.replace('what', word + ' WH AT')
print (phenome)