Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9306547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T00:11:50+00:00 2026-06-19T00:11:50+00:00

I have a bit of a problem with Sphinx 4 in java. I Implemented

  • 0

I have a bit of a problem with Sphinx 4 in java. I Implemented the code bellow:

package test.ionut;

import edu.cmu.sphinx.frontend.util.Microphone;
import edu.cmu.sphinx.recognizer.Recognizer;
import edu.cmu.sphinx.result.Result;
import edu.cmu.sphinx.util.props.ConfigurationManager;


public class Test {

    /**
     * @param args
     */
    public static void main(String[] args) {
        ConfigurationManager manager;

        if(args.length > 0){  
            manager=new ConfigurationManager(args[0]);
            }else{

            manager=new ConfigurationManager(Test.class.getResource("test.config.xml"));

        }

        Recognizer recognizer=(Recognizer)manager.lookup("recognizer");
        recognizer.allocate();
        Microphone mic=(Microphone)manager.lookup("microphone");
        if(!mic.startRecording()){

            System.out.println("Mic not identified.");
            recognizer.deallocate();
            System.out.println(1);

            System.out.println("Say: (Good morning | Hello | Hi | Welcome) (Dipayan | Paul | Philip | Rita | Will )");

            while(true){
                System.out.println("Start speaking. Press Ctrl-C to quit.\n");
                Result result = recognizer.recognize();
                if(result != null) {
                String resultText = result.getBestFinalResultNoFiller();
            //  System.out.println((new StringBuilder()).append("You said: ").append(resultText).append('\n').toString());
                System.out.println("You said: "+resultText+"...");
                } else {
                System.out.println("I can't hear what you said.\n");
                }
                }

        }


    }

}

this is the grammar file:

***#JSGF V1.0;***

***grammar hello;***

***public <greet>= (Good morning | Hello | Hi | Welcome) ( Paul | Philip | Rita | Will );***

and in the xml file i have modified so that the program knows what to do with the gram file.



Bellow is the part of the code where i modified the xml:

    <!-- ******************************************************** -->
    <!-- The Grammar  configuration                               -->
    <!-- ******************************************************** -->

    <component name="jsgfGrammar" type="edu.cmu.sphinx.jsgf.JSGFGrammar">
        <property name="dictionary" value="dictionary"/>
        <property name="grammarLocation"
             value="resource:/test/ionut/"/>
        <property name="grammarName" value="mydict"/>
    <property name="logMath" value="logMath"/>
    </component>


Any help is appreciated.

The problem is that when i compile the code, i get no error, but the console doesn’t show anything, not even the first print. If i modify the gram file by adding a word that is not in the dictionary and then hit run, the console shows me an error that the word is a known word in the dictionary. After removing the word, hit run, and again: the console shows me nothing. Also i have added additional heap memory with the -mx256m argument.

I’ve been trying all day with this, since i want to implement words from my own language with sphinx 4. But right now i’m just doing some test, getting used with it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T00:11:52+00:00Added an answer on June 19, 2026 at 12:11 am

    Are you speaking through the microphone, those words you put in the grammer file? Or just uttering random words. the system can recognize only those words which are in the Grammer file as well as in the dictionary. remember that, the .gram file is subset of the. DIC file .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bit of a problem that I can't seem to code my
I have a bit of a problem building my project. I'm getting the bellow
I have a bit of a problem with my PHP code, I am assigning
I have a bit of a problem. I have a java application and when
I have a bit of a problem in my code, and i'm beginning to
I have a bit of problem, here my log: 1. strip per-dir prefix: C:/wamp/www/web.site/projects/test/
I have a bit of problem when trying to validate my page as HTML5.
I have a bit of a problem. I am trying to do the following
I have a bit of a problem here. I have a third party ActiveX
So, I have a bit of a problem. I'm trying to convert an array

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.