17 #ifndef __NUGU_ASR_INTERFACE_H__
18 #define __NUGU_ASR_INTERFACE_H__
25 namespace NuguCapability {
27 using namespace NuguClientKit;
41 #define NUGU_ASR_EPD_TYPE "CLIENT"
42 #define NUGU_ASR_ENCODING "COMPLETE"
43 #define NUGU_SERVER_RESPONSE_TIMEOUT_SEC 10
114 virtual void onNone(
const std::string& dialog_id) = 0;
121 virtual void onPartial(
const std::string& text,
const std::string& dialog_id) = 0;
128 virtual void onComplete(
const std::string& text,
const std::string& dialog_id) = 0;
136 virtual void onError(
ASRError error,
const std::string& dialog_id,
bool listen_timeout_fail_beep =
true) = 0;
142 virtual void onCancel(
const std::string& dialog_id) = 0;
ASR handler interface.
Definition: asr_interface.hh:149
virtual void stopRecognition(bool cancel=false)=0
Turn off the microphone and stop speech recognition.
virtual void addListener(IASRListener *listener)=0
Add the Listener object.
virtual void finishRecognition()=0
Finish audio recording and request recognition by a user.
virtual void setAttribute(ASRAttribute &&attribute)=0
Set attribute about speech recognition.
virtual EpdAttribute getEpdAttribute()=0
Get EPD attribute.
virtual void startRecognition(ASRInitiator initiator=ASRInitiator::TAP, AsrRecognizeCallback callback=nullptr)=0
Turn on the microphone and start speech recognition.
std::function< void(const std::string &dialog_id)> AsrRecognizeCallback
ASR recognize callback for user request and response mapping.
Definition: asr_interface.hh:155
virtual void removeListener(IASRListener *listener)=0
Remove the Listener object.
virtual void startRecognition(float power_noise, float power_speech, ASRInitiator initiator=ASRInitiator::TAP, AsrRecognizeCallback callback=nullptr)=0
Turn on the microphone and start speech recognition (support multi-wakeup)
virtual void setEpdAttribute(EpdAttribute &&attribute)=0
Set EPD attribute.
ASR listener interface.
Definition: asr_interface.hh:96
virtual void onError(ASRError error, const std::string &dialog_id, bool listen_timeout_fail_beep=true)=0
Report an error occurred during speech recognition to the user.
virtual void onPartial(const std::string &text, const std::string &dialog_id)=0
The result of recognizing the user's speech in real time.
virtual void onNone(const std::string &dialog_id)=0
No speech recognition results.
virtual void onComplete(const std::string &text, const std::string &dialog_id)=0
Speech recognition results which are reported naturally in situations based on the entire speech.
virtual void onState(ASRState state, const std::string &dialog_id, ASRInitiator initiator)=0
Report to the user asr state changed.
virtual void onCancel(const std::string &dialog_id)=0
Speech recognition is canceled.
capability interface
Definition: capability_interface.hh:82
capability listener interface
Definition: capability_interface.hh:60
ASRInitiator
ASR initiator list.
Definition: asr_interface.hh:61
struct NuguCapability::_ASRAttribute ASRAttribute
Attributes for setting ASR options.
ASRError
ASR error list.
Definition: asr_interface.hh:73
ASRState
ASR state list.
Definition: asr_interface.hh:49
Attributes for setting ASR options.
Definition: asr_interface.hh:85
int response_timeout
Definition: asr_interface.hh:89
std::string asr_encoding
Definition: asr_interface.hh:88
std::string epd_type
Definition: asr_interface.hh:87
std::string model_path
Definition: asr_interface.hh:86
Attributes about epd.
Definition: speech_recognizer_interface.hh:53