Menu

Using pocketsphinx with java.

Help
TheEditor
2016-07-26
2016-07-26
  • TheEditor

    TheEditor - 2016-07-26

    Can someone point me in the right direction for accessing pocketsphinx via java. I've looked at the tests on github and know that swig must be used. The only examples I can find are for android. I'm not sure how to actually build the java packages I need via swig.

     
    • Nickolay V. Shmyrev

      It depends on the OS

       
  • TheEditor

    TheEditor - 2016-07-26

    Linux. Sorry should have specified that.

     
    • Nickolay V. Shmyrev

      You can type make in pocketsphinx/swig/java, it will build the demo. make run will run it. You need to have functional pkg-config and properly set JAVA_HOME.

       
  • TheEditor

    TheEditor - 2016-07-26

    Wow that's all? So that will then build the .java packages? Sorry first time I've even heard of swig.

    import edu.cmu.pocketsphinx.Decoder;
    import edu.cmu.pocketsphinx.Config;
    import edu.cmu.pocketsphinx.Segment;
    import edu.cmu.pocketsphinx.Hypothesis;
    import edu.cmu.pocketsphinx.SegmentIterator;

     
    • Nickolay V. Shmyrev

      Wow that's all?

      Yes

      So that will then build the .java packages?

      It will build java files, you have to package them yourself if you want to.

      Sorry first time I've even heard of swig.

      It is better to read swig docs

       
      • TheEditor

        TheEditor - 2016-07-26

        Thanks for the help. I got to the point where all the .java files are created. That leaves me with one more question. Bear with me, not a programmer by trade.

        Do I simply import those .java files into my project and as long as the app is deployed on a machine with pocketsphinx installed it will work?

        I'm making that assumption based on https://github.com/cmusphinx/pocketsphinx/blob/master/swig/java/test/DecoderTest.java

        I read through the swig docs and either missed or didn't see this part.

        EDIT: Answered my own question. So I missed the created .so file. Also the loading of that library. Makes more sense now. Thanks

         

        Last edit: TheEditor 2016-07-26

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.