Thursday, September 18, 2014

Replacing Pronunciation Dictionary of Acoustic Model in Sphinx4


Lets say, We are creating a Speech Recognition system for recognising computer related words only.  Now, I will tell you, How to create pronunciation dictionary for computer related words and how to add that dictionary in acoustic model. In this example I am using WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar acoustic model.

CREATING PRONUNCIATION DICTIONARY:

Step 1 :
Create a plain text file "computer.txt", and Write down all words related to computer in that text file.



Step 2 : Now go to this link : http://www.speech.cs.cmu.edu/tools/lmtool.html

Step 3 : After Opening above link, go to "Sentence corpus file" section and then browse "computer.txt" file and then click "Compile Knowledge Base".








Step 4 : Wait for few seconds/Minutes, once the dictionary is created, click on "Dictionary" link and save that .DIC file.

 










Now pronunciation dictionary for computer related words is ready. Now We will see how to include this pronunciation dictionary in acoustic model.

ADDING PRONUNCIATION DICTIONARY TO ACOUSTIC MODEL

Step 5 : Locate WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar file in sphinx4. (Generally can be find at location /sphinx4-1.0beta6-bin/sphinx4-1.0beta6/lib).

Step 6 : Extract WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar

 Step 7 : Open "cmudict.0.6d" which is located in extracted folder /sphinx4-1.0beta6-bin/sphinx4-1.0beta6/lib/ WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz/dict/ 

Step 8 : Now copy data from .DIC file created in Step 4 and paste it into "cmudict.0.6d" file and save. 











Step 9 : Now create the JAR file and keep the extracted hierarchy back as it was and the name of JAR file should be WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar.

Now acoustic model with pronunciation dictionary of computer related words is ready.

Now, remove old "WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar" file from Project’s CLASSPATH and add newly created "WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar" file instead of it.

That’s it ! Now We are done.  Now Sphinx will recognize all computer related words which we wrote in "computer.txt" file.