|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.regulus.RegClient
Class that interfaces to the regserver process.
The RegClient class offers basic functionality for recognition, interpretation and playback.
On object creation a new regserver instance is started, which initiates the recognition engine. After the regserver has initialized it listens for incoming requests.
The RegClient object connects to the regserver. After that recognition/playback related functions are available.
The library assumes that the 'regulus' variable is set (i.e. on the java command line -Djava=${REGULUS}). Default configuration values for the regserver process are defined in ${REGULUS}/RegulusSpeechServer/runtime/regulus.properties
Field Summary | |
static java.util.logging.Logger |
logger
|
int |
PARAM_TYPE_FLOAT
|
int |
PARAM_TYPE_INT
|
int |
PARAM_TYPE_STRING
|
Constructor Summary | |
RegClient(int port,
java.lang.String recognitionPackageAndConfigParams)
Starts up a regulus client library along with the regserver |
|
RegClient(int serverPort,
java.lang.String regClientConfig,
java.lang.String regulusServerCommand,
long regulusServerTimeout)
Deprecated. use Regclient(String) instead |
|
RegClient(java.lang.String recognitionPackageAndConfigParams)
Starts up a regulus client library along with the regserver |
|
RegClient(java.lang.String serverHost,
int serverPort,
java.lang.String regClientConfig,
java.lang.String regulusServerCommand,
long regulusServerTimeout)
Deprecated. use Regclient(String) instead |
Method Summary | |
void |
abortPlayback()
Abort an ongoing playback action |
void |
abortRecognition()
Abort an ongoing recognition action |
float |
getFloatParameter(java.lang.String paramName)
|
int |
getIntParameter(java.lang.String paramName)
|
java.lang.Object |
getParameter(java.lang.String paramName)
|
java.lang.String |
getRegulusBaseDirectory()
|
java.lang.String |
getStringParameter(java.lang.String paramName)
|
RegResult |
interpret(java.lang.String grammar,
java.lang.String text)
Perform Natural Language (NL) interpretation. |
void |
play(java.lang.String fileOrTTS)
Initiate a playback action. |
void |
playList(java.lang.String[] fileOrTTSList)
Initiate a playback action. |
RegResult |
recognize(java.lang.String grammar)
Perform a recognition action. |
RegResult |
recognizeFile(java.lang.String file,
java.lang.String grammar)
Perform a recognition action on a prerecorded file. |
void |
setEncoding(java.lang.String newEncoding)
Sets the encoding to be used when communicating with the server. |
boolean |
setParameter(java.lang.String param,
java.lang.String value)
Sets a Nuance parameter. |
void |
shutdown()
Exit regserver process, and release held resources. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static java.util.logging.Logger logger
public int PARAM_TYPE_INT
public int PARAM_TYPE_FLOAT
public int PARAM_TYPE_STRING
Constructor Detail |
public RegClient(java.lang.String serverHost, int serverPort, java.lang.String regClientConfig, java.lang.String regulusServerCommand, long regulusServerTimeout) throws java.lang.Exception
serverHost
- The name (or IP address) of the host where regserver is runningserverPort
- The port the regserver is waiting for connectionsregClientConfig
- Parameters that get passed to the regserver (Nuance recognition client parameters)regulusServerCommand
- Path to the regserver executableregulusServerTimeout
- How long to wait for regserver to start up
java.lang.Exception
- Connection to the regserver failed.public RegClient(int serverPort, java.lang.String regClientConfig, java.lang.String regulusServerCommand, long regulusServerTimeout) throws java.lang.Exception
serverPort
- The name (or IP address) of the host where regserver is runningregClientConfig
- Parameters that get passed to the regserver (Nuance recognition client parameters)regulusServerCommand
- Path to the regserver executableregulusServerTimeout
- How long (in msecs) to wait for regserver to start up
java.lang.Exception
- Connection to the regserver failed.public RegClient(int port, java.lang.String recognitionPackageAndConfigParams) throws java.lang.Exception
port
- - portnumber of the regserver process.recognitionPackageAndConfigParams
- - Starts with the recognition package to load. May be followed by one or more nuance configuration parameters.
May be followed by one or more nuance configuration parameterspublic RegClient(java.lang.String recognitionPackageAndConfigParams) throws RegClientException, java.io.IOException, RegClientException
recognitionPackageAndConfigParams
- - Starts with the recognition package to load. May be followed by one or more nuance configuration parameters.
May be followed by one or more nuance configuration parametersMethod Detail |
public void setEncoding(java.lang.String newEncoding)
newEncoding
- public void shutdown() throws java.io.IOException
regserver
process, and release held resources.
java.io.IOException
public boolean setParameter(java.lang.String param, java.lang.String value) throws java.io.IOException
param
- value
-
java.io.IOException
public void play(java.lang.String fileOrTTS) throws java.io.IOException
fileOrTTS
- If the parameter is a path to a file, it is played directly, otherwise if the string starts with +TTS it is submitted to a speech synthesis engine.
java.io.IOException
public void playList(java.lang.String[] fileOrTTSList) throws java.io.IOException
fileOrTTSList
- If the item is a path to a file, it is played directly, otherwise if the string starts with +TTS it is submitted to a speech synthesis engine.
java.io.IOException
public float getFloatParameter(java.lang.String paramName) throws java.io.IOException, RegClientException
java.io.IOException
RegClientException
public int getIntParameter(java.lang.String paramName) throws java.io.IOException, RegClientException
java.io.IOException
RegClientException
public java.lang.String getStringParameter(java.lang.String paramName) throws java.io.IOException, RegClientException
java.io.IOException
RegClientException
public java.lang.Object getParameter(java.lang.String paramName) throws java.io.IOException, RegClientException
java.io.IOException
RegClientException
public RegResult recognize(java.lang.String grammar) throws java.io.IOException
grammar
- Recognition grammar used.
java.io.IOException
public RegResult interpret(java.lang.String grammar, java.lang.String text) throws java.io.IOException
grammar
- The grammar context the input text will be parsed withtext
- Input text we want to get interpreted
java.io.IOException
public RegResult recognizeFile(java.lang.String file, java.lang.String grammar) throws java.io.IOException
file
- Prerecorded filegrammar
-
java.io.IOException
recognize(String)
public void abortRecognition() throws java.io.IOException
java.io.IOException
public void abortPlayback() throws java.io.IOException
java.io.IOException
public java.lang.String getRegulusBaseDirectory()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |