NUGU SDK Linux  1.7.5
speech_recognizer_aggregator_interface.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 SK Telecom Co., Ltd. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __SPEECH_RECOGNIZER_AGGREGATOR_INTERFACE_H__
18 #define __SPEECH_RECOGNIZER_AGGREGATOR_INTERFACE_H__
19 
20 #include <memory>
21 
24 
25 namespace NuguClientKit {
26 
27 using namespace NuguCapability;
28 
45 typedef struct _RecognitionResult {
49  enum class Status {
50  None,
51  Partial,
52  Complete,
53  Cancel,
54  Error
55  };
56 
58  std::string recognized_text;
62 
68 public:
69  virtual ~ISpeechRecognizerAggregatorListener() = default;
70 
77  virtual void onWakeupState(WakeupDetectState state, float power_noise, float power_speech) = 0;
78 
85  virtual void onASRState(ASRState state, const std::string& dialog_id, ASRInitiator initiator) = 0;
86 
92  virtual void onResult(const RecognitionResult& result, const std::string& dialog_id) = 0;
93 };
94 
100 public:
101  virtual ~ISpeechRecognizerAggregator() = default;
102 
108 
114 
119  virtual void setWakeupHandler(const std::shared_ptr<IWakeupHandler>& wakeup_handler) = 0;
120 
126  virtual bool setWakeupModel(const WakeupModelFile& model_file) = 0;
127 
131  virtual void startListeningWithTrigger() = 0;
132 
139  virtual void startListening(float power_noise = 0, float power_speech = 0, ASRInitiator initiator = ASRInitiator::TAP) = 0;
140 
145  virtual void stopListening(bool cancel = false) = 0;
146 };
147 
148 } // NuguClientKit
149 
154 #endif /* __SPEECH_RECOGNIZER_AGGREGATOR_INTERFACE_H__ */
SpeechRecognizerAggregator listener interface.
Definition: speech_recognizer_aggregator_interface.hh:67
SpeechRecognizerAggregator interface.
Definition: speech_recognizer_aggregator_interface.hh:99
ASRInitiator
ASR initiator list.
Definition: asr_interface.hh:59
ASRError
ASR error list.
Definition: asr_interface.hh:71
ASRState
ASR state list.
Definition: asr_interface.hh:47
virtual void addListener(ISpeechRecognizerAggregatorListener *listener)=0
Add the ISpeechRecognizerAggregatorListener object.
Status
Result status.
Definition: speech_recognizer_aggregator_interface.hh:49
virtual void startListeningWithTrigger()=0
Start detecting wakeup and progress recognizing speech after wakeup detected.
std::string recognized_text
Definition: speech_recognizer_aggregator_interface.hh:58
Status status
Definition: speech_recognizer_aggregator_interface.hh:57
struct NuguClientKit::_RecognitionResult RecognitionResult
Model for holding recognition result.
virtual void stopListening(bool cancel=false)=0
Stop both recognizing speech and detecting wakeup.
virtual void onWakeupState(WakeupDetectState state, float power_noise, float power_speech)=0
Notify to user the wakeup detection state changed.
virtual void onASRState(ASRState state, const std::string &dialog_id, ASRInitiator initiator)=0
Notify to user the asr state changed.
ASRError error
Definition: speech_recognizer_aggregator_interface.hh:59
virtual void onResult(const RecognitionResult &result, const std::string &dialog_id)=0
Notify to user the recognition result.
virtual bool setWakeupModel(const WakeupModelFile &model_file)=0
Set wakeup model file.
virtual void startListening(float power_noise=0, float power_speech=0, ASRInitiator initiator=ASRInitiator::TAP)=0
Start recognizing speech.
virtual void setWakeupHandler(const std::shared_ptr< IWakeupHandler > &wakeup_handler)=0
Set the IWakeupHandler object.
virtual void removeListener(ISpeechRecognizerAggregatorListener *listener)=0
Remove the ISpeechRecognizerAggregatorListener object.
bool listen_timeout_fail_beep
Definition: speech_recognizer_aggregator_interface.hh:60
WakeupDetectState
WakeupDetectState.
Definition: wakeup_interface.hh:38
Model for holding recognition result.
Definition: speech_recognizer_aggregator_interface.hh:45
Model for holding Wakeup model file info.
Definition: wakeup_interface.hh:49