You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

vpr

Beginner

  • "vpr" is male
  • "vpr" started this thread

Posts: 30

Date of registration: May 21st 2014

  • Send private message

1

Tuesday, November 3rd 2015, 5:15pm

Constructor/Declarations Question (Sphinx)

Hi,

I have a question that relates to me trying to get Sphinx working with Jabaco. However, my query is less specific than that. I'm looking at the tutorial here:

http://cmusphinx.sourceforge.net/wiki/tutorialsphinx4


My question is to do with using constructors. Say I have this code:



Dim config As New Configuration


' Set path To acoustic model.
config.setAcousticModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us")
' Set path To dictionary.
config.setDictionaryPath("resource:/edu/cmu/sphinx/models/en-us/cmudict-en-us.dict")
' Set language model.
config.setLanguageModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us.lm.bin")


Dim recognizer As New LiveSpeechRecognizer(config)


' Start recognition process pruning previously cached data.
recognizer.startRecognition(True)


Dim result As SpeechResult= recognizer.getResult()


'Pause recognition process. It can be resumed Then With startRecognition(False).
recognizer.stopRecognition()


deubug.print(result.getHypothesis())

I want to keep the declarations in general declarations, so that I can access things like result.getHypothesis from anywhere in my code.

However, I can't put Dim recognizer As New LiveSpeechRecognizer(config) in general declarations because I need to invoke the .setAcousticModelPath .setDictionaryPath and .setLanguageModelPath methods as part of the construction of config (which can't be done in general declarations).

How would I get around this?

Rate this thread
WoltLab Burning Board