Main Page
Namespaces
Classes
Files
File List
File Members
src
workspace
cogrob
cloud
speech
google_speech_interface.h
Go to the documentation of this file.
1
// Copyright (c) 2017, The Regents of the University of California
2
// All rights reserved.
3
//
4
// Redistribution and use in source and binary forms, with or without
5
// modification, are permitted provided that the following conditions are met:
6
// * Redistributions of source code must retain the above copyright
7
// notice, this list of conditions and the following disclaimer.
8
// * Redistributions in binary form must reproduce the above copyright
9
// notice, this list of conditions and the following disclaimer in the
10
// documentation and/or other materials provided with the distribution.
11
// * Neither the name of the University of California nor the
12
// names of its contributors may be used to endorse or promote products
13
// derived from this software without specific prior written permission.
14
//
15
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF THE UNIVERSITY OF CALIFORNIA
19
// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
// POSSIBILITY OF SUCH DAMAGE.
26
27
#ifndef COGROB_CLOUD_SPEECH_GOOGLE_SPEECH_INTERFACE_H_
28
#define COGROB_CLOUD_SPEECH_GOOGLE_SPEECH_INTERFACE_H_
29
30
#include <string>
31
#include <vector>
32
33
#include "
util/status.h
"
34
#include "
util/statusor.h
"
35
#include "
cogrob/cloud/speech/audio_sample.h
"
36
#include "cogrob/cloud/speech/proto/recognition_result.pb.h"
37
38
namespace
cogrob
{
39
namespace
cloud {
40
namespace
speech
{
41
42
class
GoogleSpeechRecognizerInterface
{
43
public
:
44
GoogleSpeechRecognizerInterface
() {}
45
virtual
~GoogleSpeechRecognizerInterface
() {}
46
47
// Starts voice recognition, non blocking, audio_queue and result_queue must
48
// be valid until Stop() is called or IsRunning() returns false.
49
virtual
util::Status
StartRecognize
(
AudioQueue
* audio_queue,
50
util::SimpleThreadSafeQueue<RecognitionResult>
* result_queue,
51
const
std::vector<std::string>& hints = {},
int
max_audio_seconds = 14,
52
int
max_wait_seconds = 17,
int
max_alternatives = 10) = 0;
53
54
// TODO(shengye): Add a StartRecognizeBlocking method
55
56
// Test whether the recognizer is still running.
57
virtual
bool
IsRunning
() = 0;
58
59
// Return the last result
60
virtual
util::StatusOr<RecognitionResult>
GetLastResult
() = 0;
61
62
// Wait until recognizer finishes
63
virtual
util::Status
Wait
() = 0;
64
65
// Stop recognition
66
virtual
util::Status
Stop
() = 0;
67
};
68
69
}
// namespace speech
70
}
// namespace cloud
71
}
// namespace cogrob
72
73
#endif // COGROB_CLOUD_SPEECH_GOOGLE_SPEECH_INTERFACE_H_
cogrob::cloud::speech::GoogleSpeechRecognizerInterface::StartRecognize
virtual util::Status StartRecognize(AudioQueue *audio_queue, util::SimpleThreadSafeQueue< RecognitionResult > *result_queue, const std::vector< std::string > &hints={}, int max_audio_seconds=14, int max_wait_seconds=17, int max_alternatives=10)=0
statusor.h
audio_sample.h
util::StatusOr< RecognitionResult >
cogrob::cloud::speech::GoogleSpeechRecognizerInterface::GoogleSpeechRecognizerInterface
GoogleSpeechRecognizerInterface()
Definition:
google_speech_interface.h:44
cogrob::cloud::speech::GoogleSpeechRecognizerInterface::Stop
virtual util::Status Stop()=0
cogrob::cloud::speech::GoogleSpeechRecognizerInterface::Wait
virtual util::Status Wait()=0
cogrob::cloud::speech::GoogleSpeechRecognizerInterface::GetLastResult
virtual util::StatusOr< RecognitionResult > GetLastResult()=0
cogrob::cloud::speech
Definition:
audio_sample.h:37
cogrob
Definition:
defaults.cc:48
cogrob::cloud::speech::GoogleSpeechRecognizerInterface
Definition:
google_speech_interface.h:42
status.h
util::SimpleThreadSafeQueue
Definition:
simple_thread_safe_queue.h:40
cogrob::cloud::speech::GoogleSpeechRecognizerInterface::IsRunning
virtual bool IsRunning()=0
cogrob::cloud::speech::GoogleSpeechRecognizerInterface::~GoogleSpeechRecognizerInterface
virtual ~GoogleSpeechRecognizerInterface()
Definition:
google_speech_interface.h:45
util::Status
Definition:
status.h:59
gcloud_speech
Author(s):
autogenerated on Mon Jun 10 2019 13:20:53