NUGU SDK Linux  1.7.6
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 #include <nugu.h>
25 
26 namespace NuguClientKit {
27 
28 using namespace NuguCapability;
29 
46 typedef struct _RecognitionResult {
50  enum class Status {
51  None,
52  Partial,
53  Complete,
54  Cancel,
55  Error
56  };
57 
59  std::string recognized_text;
63 
69 public:
70  virtual ~ISpeechRecognizerAggregatorListener() = default;
71 
78  virtual void onWakeupState(WakeupDetectState state, float power_noise, float power_speech) = 0;
79 
86  virtual void onASRState(ASRState state, const std::string& dialog_id, ASRInitiator initiator) = 0;
87 
93  virtual void onResult(const RecognitionResult& result, const std::string& dialog_id) = 0;
94 };
95 
101 public:
102  virtual ~ISpeechRecognizerAggregator() = default;
103 
109 
115 
120  virtual void setWakeupHandler(const std::shared_ptr<IWakeupHandler>& wakeup_handler) = 0;
121 
127  virtual bool setWakeupModel(const WakeupModelFile& model_file) = 0;
128 
132  virtual void startListeningWithTrigger() = 0;
133 
140  virtual void startListening(float power_noise = 0, float power_speech = 0, ASRInitiator initiator = ASRInitiator::TAP) = 0;
141 
146  virtual void stopListening(bool cancel = false) = 0;
147 
151  virtual void finishListening() = 0;
152 };
153 
154 } // NuguClientKit
155 
160 #endif /* __SPEECH_RECOGNIZER_AGGREGATOR_INTERFACE_H__ */
SpeechRecognizerAggregator listener interface.
Definition: speech_recognizer_aggregator_interface.hh:68
SpeechRecognizerAggregator interface.
Definition: speech_recognizer_aggregator_interface.hh:100
ASRInitiator
ASR initiator list.
Definition: asr_interface.hh:61
ASRError
ASR error list.
Definition: asr_interface.hh:73
ASRState
ASR state list.
Definition: asr_interface.hh:49
virtual void addListener(ISpeechRecognizerAggregatorListener *listener)=0
Add the ISpeechRecognizerAggregatorListener object.
Status
Result status.
Definition: speech_recognizer_aggregator_interface.hh:50
virtual void startListeningWithTrigger()=0
Start detecting wakeup and progress recognizing speech after wakeup detected.
std::string recognized_text
Definition: speech_recognizer_aggregator_interface.hh:59
Status status
Definition: speech_recognizer_aggregator_interface.hh:58
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:60
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 finishListening()=0
finish listening 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:61
WakeupDetectState
WakeupDetectState.
Definition: wakeup_interface.hh:40
Model for holding recognition result.
Definition: speech_recognizer_aggregator_interface.hh:46
Model for holding Wakeup model file info.
Definition: wakeup_interface.hh:51