RAPP Platform API
Main Page
Packages
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
SpeechRecognitionGoogle.py
Go to the documentation of this file.
1
from
RappCloud.Objects
import
(
2
File,
3
Payload)
4
5
from
Cloud
import
(
6
CloudMsg,
7
CloudRequest,
8
CloudResponse)
9
10
11
class
SpeechRecognitionGoogle
(CloudMsg):
12
""" Speech Recognition Google Cloud Message object """
13
14
class
Request
(CloudRequest):
15
""" Speech Recognition Google Cloud Request object.
16
17
SpeechRecognitionGoogle.Request
18
"""
19
def
__init__
(self, **kwargs):
20
"""!
21
Constructor
22
23
@param **kwargs - Keyword arguments. Apply values to the request attributes.
24
- @ref audio_source
25
- @ref audiofile
26
- @ref language
27
"""
28
29
## Language to use for recognition
30
self.
language
=
''
31
## Audio source data format. e.g "nao_wav_1_ch".
32
self.
audio_source
=
''
33
## Path to the audio file.
34
self.
audiofile
=
''
35
36
super(
SpeechRecognitionGoogle.Request
, self).
__init__
(**kwargs)
37
38
39
def
make_payload
(self):
40
""" Create and return the Payload of the Request. """
41
return
Payload(
42
language=self.
language
,
43
audio_source = self.
audio_source
)
44
45
46
def
make_files
(self):
47
""" Create and return Array of File objects of the Request. """
48
return
[File(self.
audiofile
, postfield=
'file'
)]
49
50
51
class
Response
(CloudResponse):
52
""" Speech Recognition Google Cloud Response object.
53
54
SpeechRecognitionGoogle.Response
55
"""
56
def
__init__
(self, **kwargs):
57
"""!
58
Constructor
59
60
@param **kwargs - Keyword arguments. Apply values to the request attributes.
61
- @ref error
62
- @ref words
63
- @ref alternatives
64
"""
65
66
## An array that contains the "words-found" with highest confidence.
67
self.
words
= []
68
## Alternative sentences.
69
# e.g. [['send', 'mail'], ['send', 'email'], ['set', 'mail']...]
70
self.
alternatives
= []
71
## Error message.
72
self.
error
=
''
73
super(
SpeechRecognitionGoogle.Response
, self).
__init__
(**kwargs)
74
75
76
def
__init__
(self, **kwargs):
77
"""!
78
Constructor
79
80
@param **kwargs - Keyword arguments. Apply values to the request attributes.
81
- @ref Request.audio_source
82
- @ref Request.audiofile
83
- @ref Request.language
84
"""
85
86
# Create and hold the Request object for this CloudMsg
87
self.
req
=
SpeechRecognitionGoogle.Request
()
88
# Create and hold the Response object for this CloudMsg
89
self.
resp
=
SpeechRecognitionGoogle.Response
()
90
super(SpeechRecognitionGoogle, self).
__init__
(
91
svcname=
'speech_detection_google'
, **kwargs)
92
93
RappCloud.CloudMsgs.SpeechRecognitionGoogle.SpeechRecognitionGoogle.Request.language
language
Language to use for recognition.
Definition:
SpeechRecognitionGoogle.py:30
RappCloud.CloudMsgs.SpeechRecognitionGoogle.SpeechRecognitionGoogle.Request.audiofile
audiofile
Path to the audio file.
Definition:
SpeechRecognitionGoogle.py:34
RappCloud.CloudMsgs.SpeechRecognitionGoogle.SpeechRecognitionGoogle.Response.__init__
def __init__
Constructor.
Definition:
SpeechRecognitionGoogle.py:56
RappCloud.Objects
Definition:
__init__.py:1
RappCloud.CloudMsgs.SpeechRecognitionGoogle.SpeechRecognitionGoogle.Response.error
error
Error message.
Definition:
SpeechRecognitionGoogle.py:72
RappCloud.CloudMsgs.SpeechRecognitionGoogle.SpeechRecognitionGoogle.Request.audio_source
audio_source
Audio source data format.
Definition:
SpeechRecognitionGoogle.py:32
RappCloud.CloudMsgs.SpeechRecognitionGoogle.SpeechRecognitionGoogle.Response
Definition:
SpeechRecognitionGoogle.py:51
RappCloud.CloudMsgs.SpeechRecognitionGoogle.SpeechRecognitionGoogle.resp
resp
Definition:
SpeechRecognitionGoogle.py:89
RappCloud.CloudMsgs.SpeechRecognitionGoogle.SpeechRecognitionGoogle.Response.words
words
An array that contains the "words-found" with highest confidence.
Definition:
SpeechRecognitionGoogle.py:67
RappCloud.CloudMsgs.SpeechRecognitionGoogle.SpeechRecognitionGoogle.Request.make_files
def make_files
Definition:
SpeechRecognitionGoogle.py:46
RappCloud.CloudMsgs.SpeechRecognitionGoogle.SpeechRecognitionGoogle.__init__
def __init__
Constructor.
Definition:
SpeechRecognitionGoogle.py:76
RappCloud.CloudMsgs.SpeechRecognitionGoogle.SpeechRecognitionGoogle.Request.__init__
def __init__
Constructor.
Definition:
SpeechRecognitionGoogle.py:19
RappCloud.CloudMsgs.SpeechRecognitionGoogle.SpeechRecognitionGoogle.Request
Definition:
SpeechRecognitionGoogle.py:14
RappCloud.CloudMsgs.SpeechRecognitionGoogle.SpeechRecognitionGoogle.Response.alternatives
alternatives
Alternative sentences.
Definition:
SpeechRecognitionGoogle.py:70
RappCloud.CloudMsgs.SpeechRecognitionGoogle.SpeechRecognitionGoogle.req
req
Definition:
SpeechRecognitionGoogle.py:87
RappCloud.CloudMsgs.SpeechRecognitionGoogle.SpeechRecognitionGoogle.Request.make_payload
def make_payload
Definition:
SpeechRecognitionGoogle.py:39
RappCloud.CloudMsgs.SpeechRecognitionGoogle.SpeechRecognitionGoogle
Definition:
SpeechRecognitionGoogle.py:11
python
RappCloud
CloudMsgs
SpeechRecognitionGoogle.py
Generated on Fri Jul 29 2016 18:45:01 for RAPP Platform API by
1.8.6