public class DialogSystem
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
DialogSystem.DynamicEditAction |
Modifier and Type | Field and Description |
---|---|
static int |
LANGUAGE_ID_DE |
static int |
LANGUAGE_ID_EN_US |
static int |
LANGUAGE_ID_ES |
static int |
LANGUAGE_ID_FR |
static int |
LANGUAGE_ID_HK |
static int |
LANGUAGE_ID_JP |
static int |
LANGUAGE_ID_NL |
static int |
LANGUAGE_ID_PT |
static int |
LANGUAGE_ID_ZH_CN |
static int |
LANGUAGE_ID_ZH_TW |
Modifier and Type | Method and Description |
---|---|
int |
clearAppContext(java.lang.String domain)
Clear specific domain UUID in current dialog system stack.
|
int |
clearBackgroundContext(java.lang.String domain)
Clear background context
|
int |
configNextCsr(int languageType,
boolean disableSLU)
Config next CSR setting.
|
int |
deleteVoiceEnrollData(java.lang.String id)
Delete Voice Enroll Data
|
int |
dynamicEditInstance(java.lang.String domain,
DialogSystem.DynamicEditAction action,
java.lang.String entity,
org.json.JSONArray instances)
Add/Delete/Update user defined instances of an specific Entity.
|
int |
enToNumber(java.lang.String inputSentence)
Transform EN to number for inputSentence
RobotCallback.onResult(int, int, RobotErrorCode, Bundle) callback,
result bundle will have an JSON string, key is "RESULT". |
int |
jumpToPlan(java.lang.String domain,
java.lang.String plan)
Let dialog state switch to specific plan, and
set output context of this plan on top of the context stack.
|
int |
jumpToPlan(java.lang.String domain,
java.lang.String plan,
boolean crossIntent)
Let dialog state switch to specific plan, and
set output context of this plan on top of the context stack.
|
int |
queryExpressionStatus()
Query expression status
return result in
RobotCallback.onResult(int, int, RobotErrorCode, Bundle) callback,
result bundle will have an JSON string, key is "RESULT". |
int |
queryWordSimilarity(java.lang.String inputSentence,
java.lang.String[] targetSentence)
Query word similarity between input and target sentences and get data from
RobotCallback.onResult(int, int, RobotErrorCode, Bundle) callback,
result bundle will have an JSON string, key is "RESULT". |
int |
registerListenCallback(RobotCallback.Listen listen)
Register the listen callback functions for Dialog System.
|
int |
requestUtteranceCollisionCheck(java.lang.String utterance,
int languageType)
Request system to check if the utterance is exist in utterance list.
|
int |
requestVoiceEnrollList()
Get enrolled VoiceID list.
|
int |
resetListenTimeoutCounter()
Reset listen timeout counter
|
int |
resetVoiceTrigger(boolean enable)
Reset dialog system voice trigger counter and force voice trigger
enable or disable.
|
int |
resetVoiceTriggerToDefault()
Reset dialog system voice trigger to default setting.
|
int |
setBackgroundContext(java.lang.String domain,
java.lang.String plan)
Set background context
|
int |
setExpression(RobotFace face)
Set the robot expression.
|
int |
setExpression(RobotFace face,
java.lang.String sentence)
Make robot expression and speak.
|
int |
setExpression(RobotFace face,
java.lang.String sentence,
ExpressionConfig config)
Make robot expression and speak.
|
int |
setKeyTrigger(boolean enable)
Set dialog system head key trigger.
|
int |
setListenContext(java.lang.String domain,
java.lang.String context)
Force Dialog System to listen specific context in the DS Editor
|
int |
setPressOnHeadAction(boolean enable)
Set press on head action.
|
int |
setTouchOnlySignal(boolean setting)
Touch only signal
It will show "touch only" on top of screen if user trigger by "Hey Zenbo".
|
int |
setVoiceTrigger(boolean enable)
Set dialog system voice trigger.
|
int |
speak(java.lang.String sentence)
Start speaking.
|
int |
speak(java.lang.String sentence,
int languageType)
Deprecated.
|
int |
speak(java.lang.String sentence,
SpeakConfig config)
Start speaking.
|
int |
speakAndListen(java.lang.String sentence,
float timeout)
Deprecated.
|
int |
speakAndListen(java.lang.String sentence,
float timeout,
int retry)
Deprecated.
|
int |
speakAndListen(java.lang.String sentence,
SpeakConfig config)
Start speaking and listening
If sentence is an empty string (""), Zenbo will listen directly.
|
int |
startFaceSpeakAnimation()
Start face speak animation
|
int |
startListenAnimation(int type)
Start listen animation
|
int |
startVoiceEnrollProgress(java.lang.String id)
Start Voice Enroll Progress
|
int |
stopFaceSpeakAnimation()
Stop face speak animation
|
int |
stopListenAnimation()
Stop listen animation
|
int |
stopSpeak()
Stop TTS
|
int |
stopSpeakAndListen()
Stop speak and listen
|
int |
unregisterListenCallback()
Unregister listen callback
|
int |
updateDialogCorpusByServer(java.lang.String packageName,
java.lang.String serverLoc)
Automatic compare corpus data version while call the API and will trigger command set update process if needed.
|
int |
updateDialogCorpusByServer(java.lang.String domain,
java.lang.String packageName,
java.lang.String version)
Automatic compare corpus data version while call the API and will trigger command set update process if needed.
|
int |
zhToNumber(java.lang.String inputSentence)
Transform ZH to number for inputSentence
RobotCallback.onResult(int, int, RobotErrorCode, Bundle) callback,
result bundle will have an JSON string, key is "RESULT". |
public static final int LANGUAGE_ID_DE
public static final int LANGUAGE_ID_EN_US
public static final int LANGUAGE_ID_ES
public static final int LANGUAGE_ID_FR
public static final int LANGUAGE_ID_HK
public static final int LANGUAGE_ID_JP
public static final int LANGUAGE_ID_NL
public static final int LANGUAGE_ID_PT
public static final int LANGUAGE_ID_ZH_CN
public static final int LANGUAGE_ID_ZH_TW
public int clearAppContext(java.lang.String domain)
domain
- domain UUIDpublic int clearBackgroundContext(java.lang.String domain)
domain
- domain UUIDpublic int configNextCsr(int languageType, boolean disableSLU)
languageType
- LANGUAGE_ID_ZH_TW, LANGUAGE_ID_EN_US or LANGUAGE_ID_ZH_CN, etc..disableSLU
- Disable SLU report and skip questioning expressionpublic int deleteVoiceEnrollData(java.lang.String id)
id
- the specific id you assign to the user when enrollpublic int dynamicEditInstance(java.lang.String domain, DialogSystem.DynamicEditAction action, java.lang.String entity, org.json.JSONArray instances)
domain
- domain UUIDaction
- types of actionentity
- the existed entity added on the Concept page of DS Editorinstances
- the instances to be modifiedpublic int enToNumber(java.lang.String inputSentence)
RobotCallback.onResult(int, int, RobotErrorCode, Bundle)
callback,
result bundle will have an JSON string, key is "RESULT".
Example: {"input_sentence":"transform one thousand four hundred and fifty","result":"1450"}
inputSentence
- input sentencepublic int jumpToPlan(java.lang.String domain, java.lang.String plan)
domain
- domain UUIDplan
- Plan ID to be switched topublic int jumpToPlan(java.lang.String domain, java.lang.String plan, boolean crossIntent)
domain
- domain UUIDplan
- Plan ID to be switched tocrossIntent
- true
enable cross intentpublic int queryExpressionStatus()
RobotCallback.onResult(int, int, RobotErrorCode, Bundle)
callback,
result bundle will have an JSON string, key is "RESULT".
JSON object have two element, FaceID and FaceExit. FaceID is current face value,
get face value by RobotFace.getValue()
and FaceExit is an boolean
true
is currently have display expression.
Example: {"FaceID":"1","FaceExit":"false"}
public int queryWordSimilarity(java.lang.String inputSentence, java.lang.String[] targetSentence)
RobotCallback.onResult(int, int, RobotErrorCode, Bundle)
callback,
result bundle will have an JSON string, key is "RESULT".
JSON object have three element, input_sentence, target_sentence and similarity.
Example: {"input_sentence":"who are you","target_sentence":["who are you","where are you"],"similarity":[{"who are you":1.01},{"where are you":0.57}]}
inputSentence
- input sentencetargetSentence
- array for target sentencepublic int registerListenCallback(RobotCallback.Listen listen)
listen
- listen callback functionsRobotCallback.Listen
public int requestUtteranceCollisionCheck(java.lang.String utterance, int languageType)
utterance
- sentence of utterancelanguageType
- LANGUAGE_ID_ZH_TW or LANGUAGE_ID_EN_US or LANGUAGE_ID_ZH_CNpublic int requestVoiceEnrollList()
public int resetListenTimeoutCounter()
public int resetVoiceTrigger(boolean enable)
enable
- flag to enable/disable dialog system voice triggerpublic int resetVoiceTriggerToDefault()
public int setBackgroundContext(java.lang.String domain, java.lang.String plan)
domain
- domain UUIDplan
- Plan IDpublic int setExpression(RobotFace face)
face
- robot face expression IDpublic int setExpression(RobotFace face, java.lang.String sentence)
face
- robot face expression IDsentence
- sentence of text to speechpublic int setExpression(RobotFace face, java.lang.String sentence, ExpressionConfig config)
face
- robot face expression IDsentence
- sentence of text to speechconfig
- configuration for expression enginepublic int setKeyTrigger(boolean enable)
enable
- flag to enable/disable dialog system head key triggerpublic int setListenContext(java.lang.String domain, java.lang.String context)
domain
- domain UUIDcontext
- context to listen topublic int setPressOnHeadAction(boolean enable)
enable
- flag to enable/disable press on head action.public int setTouchOnlySignal(boolean setting)
setting
- enable/disable this functionpublic int setVoiceTrigger(boolean enable)
enable
- flag to enable/disable dialog system voice triggerpublic int speak(java.lang.String sentence)
sentence
- sentence of text to speech@Deprecated public int speak(java.lang.String sentence, int languageType)
sentence
- sentence of text to speechlanguageType
- LANGUAGE_ID_ZH_TW or LANGUAGE_ID_EN_USpublic int speak(java.lang.String sentence, SpeakConfig config)
sentence
- sentence of text to speechconfig
- configuration for speak engine@Deprecated public int speakAndListen(java.lang.String sentence, float timeout)
sentence
- sentence of text to speechtimeout
- CSR listening timeout setting (sec)@Deprecated public int speakAndListen(java.lang.String sentence, float timeout, int retry)
sentence
- sentence of text to speechtimeout
- CSR listening timeout setting (sec)retry
- max retry times to ask user to speak againpublic int speakAndListen(java.lang.String sentence, SpeakConfig config)
sentence
- sentence sentence of text to speechconfig
- configuration for speak enginepublic int startFaceSpeakAnimation()
public int startListenAnimation(int type)
type
- listen animation type, 0: big ear, 1: small earpublic int startVoiceEnrollProgress(java.lang.String id)
id
- the unique info to represent every userpublic int stopFaceSpeakAnimation()
public int stopListenAnimation()
public int stopSpeak()
public int stopSpeakAndListen()
public int unregisterListenCallback()
public int updateDialogCorpusByServer(java.lang.String packageName, java.lang.String serverLoc)
packageName
- package nameserverLoc
- Input target server, value: production / testingpublic int updateDialogCorpusByServer(java.lang.String domain, java.lang.String packageName, java.lang.String version)
domain
- domain UUIDpackageName
- package name on DDEversion
- versionpublic int zhToNumber(java.lang.String inputSentence)
RobotCallback.onResult(int, int, RobotErrorCode, Bundle)
callback,
result bundle will have an JSON string, key is "RESULT".
Example: {"input_sentence":"轉換數字一二三四","result":"1234"}
inputSentence
- input sentence