Hello Everyone,
Today I’m going to tell you how to expand dictionary of acoustic model for Sphinx4. In simple words, This tutorial will tell you how you can add more words in Sphinx’s words database (Dictionary) and let it recognize those words, which are not available in default acoustic models provided by CMU Sphinx. This tutorial is based on “HelloWorld” example provided by CMU Sphinx.
Important Files in this example :
1 ) HelloWorld.java
2) hello.gram
3) helloworld.config.xml
Acoustic Model used in this example :
WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar
Lets say, We are creating a SR system for ABC National airlines. Everything will go fine and Sphinx will recognize most of the words except the name of cities and states of India. Now, I will tell you, How to add name of cities and states in dictionary.
PART ONE
Step 1 : Create a txt file “words.txt”, Write all the names of cities and states in it and save.
Step 2 : Open this link : http://www.speech.cs.cmu.edu/tools/lmtool.html
Step 3 : On that page, go to “Sentence corpus file:” section, Browse to “words.txt” file and click “Compile Knowledge Base”.
Step 4 : On next page, Click on “Dictionary” link and save that .DIC file.
PART TWO
Step 1 : Extract WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar file.
Step 2 : Go to edu\cmu\sphinx\model\acoustic\WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz\dict folder.
Step 3 : Open “cmudict.0.6d” file in that folder.
Step 4 : Copy data from .DIC file, you have downloaded in PART ONE, paste it in “cmudict.0.6d” file and save.
Step 5 : Go to command prompt & travel to sphinx4-1.0beta5\lib folder
run following command
jar -cf WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz
Step 6 : Refresh Project in eclipse & run project
Reference : For this valuable tutorial i would like to thanks Mr. Puneet Kalra for his guidance provided on his website.
Hey Ashish,
ReplyDeleteThanks mate, Video shared on my facebook page.
~Puneet Kalra
Thanx man, is this also for pocketsphinx??
ReplyDeleteThanx for your tutorial. I did expanded my acoustic model to recognize extra words. But my problem is that i cant run the project. the displayed errors are:
ReplyDeleteException in thread "main" java.lang.NullPointerException
at edu.cmu.sphinx.util.props.SaxLoader.load(SaxLoader.java:74)
at edu.cmu.sphinx.util.props.ConfigurationManager.(ConfigurationManager.java:58)
at edu.cmu.sphinx.demo.helloworld.HelloWorld.main(HelloWorld.java:33)
I didn't included the HelloWorld.jar in sphinx library,If I did the application only recognizes the words 'hello will' etc as in the demo. Please help me with this its very important for my academics
heyyy ashish m not able to expand my acoustic model to recognize extra words,my problem is that whn i can run the project its giving me d followng error....
ReplyDeleteMissing word: facebook in edu.cmu.sphinx.linguist.dictionary.FastDictionary:getWord-dictionary
07:09.100 WARNING jsgfGrammar Can't find pronunciation for FACEBOOK .......plzz help...waitng for ur reply...
hi, tks for your sharing, i seem helpful.
ReplyDeleteI am an Vietnamese , i am wondering how to create a Vietnamese acoustic model.
By the way, i use the demo in the sphinx source file, could you please tell me how to make this work in that, because i got the error : Exception in thread "main" java.lang.NullPointerException
at edu.cmu.sphinx.util.props.SaxLoader.load(SaxLoader.java:74)
at edu.cmu.sphinx.util.props.ConfigurationManager.(ConfigurationManager.java:58)
just like Niphin, please help!
Hello Eveyone,
ReplyDeleteI am trying to add some german words to the dictionary but i am not yet successful. I tried doing it in traditional way of using english words and my system works but the efficiency is not so good. So i was thinking to reduce the dictionary size to only 50 words.. Does anyone knows how to do it ? I am new to ASR and hence your reply is truly helpful.
Thanks and Merry Xmas ahead .)
hey plz help I m getting the following error
ReplyDeleteclass not found !java.lang.ClassNotFoundException: edu.cmu.sphinx.model.acoustic.WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.Model
Exception in thread "main" Property Exception component:'flatLinguist' property:'acousticModel' - mandatory property is not set!
edu.cmu.sphinx.util.props.InternalConfigurationException
at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:292)
at edu.cmu.sphinx.linguist.flat.FlatLinguist.setupAcousticModel(FlatLinguist.java:207)
at edu.cmu.sphinx.linguist.flat.FlatLinguist.newProperties(FlatLinguist.java:171)
at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:430)
at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:280)
at edu.cmu.sphinx.decoder.search.SimpleBreadthFirstSearchManager.newProperties(SimpleBreadthFirstSearchManager.java:145)
at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:430)
at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:280)
at edu.cmu.sphinx.decoder.AbstractDecoder.newProperties(AbstractDecoder.java:52)
at edu.cmu.sphinx.decoder.Decoder.newProperties(Decoder.java:31)
at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:430)
at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:280)
at edu.cmu.sphinx.recognizer.Recognizer.newProperties(Recognizer.java:78)
at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:430)
at edu.cmu.sphinx.util.props.ConfigurationManager.lookup(ConfigurationManager.java:163)
at edu.cmu.sphinx.demo.helloworld.HelloWorld.main(HelloWorld.java:36)
Is it bcz I m using beta 3 instead of beta 5
bhai chal nhi rha
ReplyDeleteapni .jar de do