public class Context
extends java.lang.Object
| Constructor and Description |
|---|
Context(Configuration config)
Constructs builder that uses default XML configuration.
|
Context(java.lang.String path,
Configuration config)
Constructs builder using user-supplied XML configuration.
|
| Modifier and Type | Method and Description |
|---|---|
<C extends Configurable> |
getInstance(java.lang.Class<C> clazz)
Returns instance of the XML configuration by its class.
|
Loader |
getLoader()
Returns the Loader object used for loading the acoustic model.
|
void |
setAcousticModel(java.lang.String path)
Sets acoustic model location.
|
void |
setDictionary(java.lang.String path)
Sets dictionary.
|
void |
setGlobalProperty(java.lang.String name,
java.lang.Object value)
Sets property of a top-level "property" tag.
|
void |
setGrammar(java.lang.String path,
java.lang.String name)
Sets path to the grammar files.
|
void |
setLanguageModel(java.lang.String path)
Sets path to the language model.
|
void |
setLocalProperty(java.lang.String name,
java.lang.Object value)
Sets property within a "component" tag in configuration.
|
void |
setSampleRate(int sampleRate)
Sets sampleRate.
|
void |
setSpeechSource(java.io.InputStream stream)
Sets byte stream as the speech source.
|
void |
setSpeechSource(java.io.InputStream stream,
TimeFrame timeFrame) |
public Context(Configuration config) throws java.io.IOException, java.net.MalformedURLException
config - configurationjava.net.MalformedURLException - if failed to load configuration filejava.io.IOExceptionpublic Context(java.lang.String path,
Configuration config)
throws java.io.IOException,
java.net.MalformedURLException
path - path to XML-resource with configurationconfig - configurationjava.net.MalformedURLException - if failed to load configuration filejava.io.IOException - if failed to load configuration filepublic void setAcousticModel(java.lang.String path)
throws java.io.IOException
MelFrequencyFilterBank2 instance.path - path to directory with acoustic model filesjava.io.IOException - if failed to read feat.paramspublic void setDictionary(java.lang.String path)
path - path to directory with dictionary filespublic void setSampleRate(int sampleRate)
sampleRate - sample rate of the input stream.public void setGrammar(java.lang.String path,
java.lang.String name)
path - path to the grammar filesname - name of the main grammar to usesetLanguageModel(String)public void setLanguageModel(java.lang.String path)
path - path to the language model filejava.lang.IllegalArgumentException - if path ends with unsupported extensionsetGrammar(String, String)public void setSpeechSource(java.io.InputStream stream,
TimeFrame timeFrame)
public void setSpeechSource(java.io.InputStream stream)
stream - stream to processpublic void setLocalProperty(java.lang.String name,
java.lang.Object value)
name - property namevalue - property valuesetGlobalProperty(String, Object)public void setGlobalProperty(java.lang.String name,
java.lang.Object value)
name - property namevalue - property valuesetLocalProperty(String, Object)public <C extends Configurable> C getInstance(java.lang.Class<C> clazz)
C - genericclazz - class to look uppublic Loader getLoader()