znx_mishra Ответов: 1

Как я могу установить путь акустической модели ?


package voicerecognizer;

import edu.cmu.sphinx.api.Configuration;
import edu.cmu.sphinx.api.LiveSpeechRecognizer;
import edu.cmu.sphinx.api.SpeechResult;
import edu.cmu.sphinx.util.props.ConfigurationManager;
import java.io.IOException;

/**
 *
 * @author User
 */
public class Voicerecognizer {

    /**
     * @param args the command line arguments
     * @throws java.io.IOException
     */
    public static void main(String[] args) throws IOException {
        Configuration confi = new Configuration();
        confi.setAcousticModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us");
        confi.setDictionaryPath("file:F:\\voicerecognizer\\src\\voicereco\\resoureses\\3030.dic");
        confi.setLanguageModelPath("filr:F:\\voicerecognizer\\src\\voicereco\\resoureses\\3030.lm");
        LiveSpeechRecognizer recognizer =new LiveSpeechRecognizer(confi);
        recognizer.startRecognition(true);
        SpeechResult speech;
        while((speech= recognizer.getResult()) !=null)
        {
            String command=speech.getHypothesis();
            System.out.println(command);
        }
    }
    
}


Что я уже пробовал:

the errors are:
<pre>Exception in thread "main" Property exception component:'simpleNGramModel' property:'location' - Bad URL filr:F:\voicerecognizer\src\voicereco\resoureses\3030.lmunknown protocol: filr
edu.cmu.sphinx.util.props.InternalConfigurationException: Bad URL filr:F:\voicerecognizer\src\voicereco\resoureses\3030.lmunknown protocol: filr
	at edu.cmu.sphinx.util.props.ConfigurationManagerUtils.getResource(ConfigurationManagerUtils.java:472)
	at edu.cmu.sphinx.linguist.language.ngram.SimpleNGramModel.newProperties(SimpleNGramModel.java:99)
	at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:518)
	at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:296)
	at edu.cmu.sphinx.linguist.lextree.LexTreeLinguist.newProperties(LexTreeLinguist.java:305)
	at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:518)
	at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:296)
	at edu.cmu.sphinx.decoder.search.WordPruningBreadthFirstSearchManager.newProperties(WordPruningBreadthFirstSearchManager.java:211)
	at edu.cmu.sphinx.decoder.search.WordPruningBreadthFirstLookaheadSearchManager.newProperties(WordPruningBreadthFirstLookaheadSearchManager.java:156)
	at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:518)
	at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:296)
	at edu.cmu.sphinx.decoder.AbstractDecoder.newProperties(AbstractDecoder.java:81)
	at edu.cmu.sphinx.decoder.Decoder.newProperties(Decoder.java:36)
	at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:518)
	at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:296)
	at edu.cmu.sphinx.recognizer.Recognizer.newProperties(Recognizer.java:86)
	at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:518)
	at edu.cmu.sphinx.util.props.ConfigurationManager.lookup(ConfigurationManager.java:163)
	at edu.cmu.sphinx.api.Context.<init>(Context.java:73)
	at edu.cmu.sphinx.api.Context.<init>(Context.java:45)
	at edu.cmu.sphinx.api.AbstractSpeechRecognizer.<init>(AbstractSpeechRecognizer.java:44)
	at edu.cmu.sphinx.api.LiveSpeechRecognizer.<init>(LiveSpeechRecognizer.java:34)
	at voicerecognizer.Voicerecognizer.main(Voicerecognizer.java:29)
Caused by: java.net.MalformedURLException: unknown protocol: filr
	at java.net.URL.<init>(URL.java:617)
	at java.net.URL.<init>(URL.java:507)
	at java.net.URL.<init>(URL.java:456)
	at edu.cmu.sphinx.util.props.ConfigurationManagerUtils.resourceToURL(ConfigurationManagerUtils.java:488)
	at edu.cmu.sphinx.util.props.ConfigurationManagerUtils.getResource(ConfigurationManagerUtils.java:465)
	... 22 more
C:\Users\User\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 0 seconds)

1 Ответов

Рейтинг:
2

Richard MacCutchan

Вы неправильно написали "файл" как "filr". Пожалуйста, прочтите сообщения об ошибках.