Menu

how to create new dictionary?

Help
2015-05-30
2015-06-09
  • Nguyen Thanh Hung

    I am successful to following
    as http://cmusphinx.sourceforge.net/wiki/tutorialandroid
    but Now I want to add new dictinary, but I don't know how to do it?
    for example, my dictionary like:
    one
    two
    three
    four
    five
    Could you help me?? step by step?
    Thanks

     
  • Nguyen Thanh Hung

    any guys help me?
    thanks adavance!

     
  • Nguyen Thanh Hung

    Thanks you.
    I wonder as:
    1-In the android code we had

      .setAcousticModel(new File(assetsDir, "en-us-ptm"))
             .setDictionary(new File(assetsDir, "cmudict-en-us.dict"))
    

    But I want to ask you what is "cmudict-en-us.dict"?, I thought that, is it default dictionary(if that, which are words, I thought that it is so many words :))? and below code to add new dictionary?

        // Create grammar-based search for selection between demos
        File menuGrammar = new File(assetsDir, "menu.gram");
        recognizer.addGrammarSearch(MENU_SEARCH, menuGrammar);
    
        // Create grammar-based search for digit recognition
        File digitsGrammar = new File(assetsDir, "digits.gram");
        recognizer.addGrammarSearch(DIGITS_SEARCH, digitsGrammar);
    
        // Create language model search
        File languageModel = new File(assetsDir, "weather.dmp");
        recognizer.addNgramSearch(FORECAST_SEARCH, languageModel);
    
        // Phonetic search
        File phoneticModel = new File(assetsDir, "en-phone.dmp");
        recognizer.addAllphoneSearch(PHONE_SEARCH, phoneticModel);
    

    Now If i want to add my own dictionay, for Ex my dictionary like (it is saved to the mytest.txt):

    one
    hello
    goodbye
    

    2.1 I will using http://www.speech.cs.cmu.edu/tools/lmtool-new.html to generate dictionary
    2.2 Generate the CMU binary form (DMP)(convert from .lm->.dmp)
    sphinx_lm_convert -i 1234.lm -o 1234.dmp
    2.3 then add copy 1234.dmp to asse dicrectory , and what about 1234.dic? I don't know how to use it, I think it must be use
    2.4 then do as example code.
    And I failed, I don't know why? I think I failed because I don't use 1234.dic? if that how to use 1234.dic?
    thanks

     

    Last edit: Nickolay V. Shmyrev 2015-06-02
    • Nickolay V. Shmyrev

      what is "cmudict-en-us.dict"?,

      A default dictionary

      below code to add new dictionary?

      No, the code is used to configure searches with language models and grammars

      and what about 1234.dic?

      Put it into assets directory instead of default dictionary and use it with setDictionary instead of default dictionary.

       
  • Nguyen Thanh Hung

    Thanks
    But I still failed!
    and I had a question, how to use default dictionary?

     
    • bic-user

      bic-user - 2015-06-08

      default dictionary is used in default demo application:

      .setDictionary(new File(assetsDir, "cmudict-en-us.dict"))

      It's unclear what you failed in.

       
  • Nguyen Thanh Hung

    I failed in creating new dictionary!
    But, I want to ask you, how many words in the defaulted dictionary?

     
  • bic-user

    bic-user - 2015-06-09

    I failed in creating new dictionary!

    follow tutorial carefully. it's quite simple.

    how many words in the defaulted dictionary?

    You can open it and check. Smth like 130k

     
    • Nickolay V. Shmyrev

      Also, you can provide logcat output to get help on this issue. It is available inside your IDE, you can cut it and paste here.

       

Log in to post a comment.