Migrate from GitHub to SourceForge with this tool. Check out all of SourceForge's recent improvements.

How to check if word in pocketsphinx dictionary?

  • Anders Weinstein

    Pocketsphinx has an API to add a word to the dictionary, but I did not see any API to simply check at runtime if a word is already in the dictionary. Is there a way this can be done? I see the dict.h/dict.c source files but these appear to be internals. Also it is not obvious how I would even fetch a pointer to the loaded dictionary. And ultimately I will need something accessible via the Java bindings for use in an Android app.

    [The reason: our app generates fsg language models for user-authored texts at runtime. We need to ensure all the words in the text are in the dictionary. For any words that are not -- often proper names -- we fall back to generating a plausible pronunciation via rules and adding it to the dictionary. But this is a last resort and we only want to do this for words not already in the dictionary. ]


    • Nickolay V. Shmyrev

      Dear Andres

      I've just added an API method to lookup word in the dictionary to pocketsphinx and swig bindings. Please checkout latest version from subversion or from github.

  • Anders Weinstein

    Thanks so much, that is just great!

    When you get a chance, can you also update the pocketsphinx-android libs? I am not set up to build the native libraries. (I would be happy to, but I work primarily on Windows. Do you know if the Android libs can be built under cygwin?)


    • bic-user

      bic-user - 2014-06-19

      There is no proplem to build android libs from windows console. Configure environment properly (set up swig and ant), substitute "ndk-build" with "ndk-build.cmd" in ant's build.xml and follow tutorial.


Log in to post a comment.