RAPP Platform API
Main Page
Packages
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
SpeechRecognitionSphinx.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
SpeechRecognitionSphinx
(CloudMsg):
12
""" Speech Recognition Sphinx4 Cloud Message object """
13
14
class
Request
(CloudRequest):
15
""" Speech Recognition Sphinx4 Cloud Request object.
16
SpeechRecognitionSphinx.Request
17
"""
18
def
__init__
(self, **kwargs):
19
"""!
20
Constructor
21
22
@param **kwargs - Keyword arguments. Apply values to the request attributes.
23
- @ref audio_source
24
- @ref audiofile
25
- @ref language
26
- @ref words
27
- @ref sentences
28
- @ref grammar
29
"""
30
31
## Language to use for recognition
32
self.
language
=
''
33
## Audio source data format. e.g "nao_wav_1_ch".
34
self.
audio_source
=
''
35
## A vector that carries the words to recognize.
36
self.
words
= []
37
## The under consideration sentences.
38
self.
sentences
= []
39
## Grammar to use
40
self.
grammar
= []
41
## Path to the audio file.
42
self.
audiofile
=
''
43
44
super(
SpeechRecognitionSphinx.Request
, self).
__init__
(**kwargs)
45
46
47
def
make_payload
(self):
48
""" Create and return the Payload of the Request. """
49
return
Payload(
50
language=self.
language
,
51
audio_source = self.
audio_source
,
52
words=self.
words
,
53
sentences=self.
sentences
,
54
grammar=self.
grammar
)
55
56
57
def
make_files
(self):
58
""" Create and return Array of File objects of the Request. """
59
return
[File(self.
audiofile
, postfield=
'file'
)]
60
61
62
class
Response
(CloudResponse):
63
""" Speech Recognition Sphinx4 Cloud Response object.
64
SpeechRecognitionSphinx.Response
65
"""
66
def
__init__
(self, **kwargs):
67
"""!
68
Constructor
69
70
@param **kwargs - Keyword arguments. Apply values to the request attributes.
71
- @ref error
72
- @ref words
73
"""
74
75
## Recognized words.
76
self.
words
= []
77
## Error message.
78
self.
error
=
''
79
super(
SpeechRecognitionSphinx.Response
, self).
__init__
(**kwargs)
80
81
82
def
__init__
(self, **kwargs):
83
"""!
84
Constructor
85
86
@param **kwargs - Keyword arguments. Apply values to the request attributes.
87
- @ref Request.audio_source
88
- @ref Request.audiofile
89
- @ref Request.language
90
- @ref Request.words
91
- @ref Request.sentences
92
- @ref Request.grammar
93
"""
94
95
# Create and hold the Request object for this CloudMsg
96
self.
req
=
SpeechRecognitionSphinx.Request
()
97
# Create and hold the Response object for this CloudMsg
98
self.
resp
=
SpeechRecognitionSphinx.Response
()
99
super(SpeechRecognitionSphinx, self).
__init__
(
100
svcname=
'speech_detection_sphinx4'
, **kwargs)
101
102
RappCloud.CloudMsgs.SpeechRecognitionSphinx.SpeechRecognitionSphinx
Definition:
SpeechRecognitionSphinx.py:11
RappCloud.CloudMsgs.SpeechRecognitionSphinx.SpeechRecognitionSphinx.Request.sentences
sentences
The under consideration sentences.
Definition:
SpeechRecognitionSphinx.py:38
RappCloud.CloudMsgs.SpeechRecognitionSphinx.SpeechRecognitionSphinx.Request.language
language
Language to use for recognition.
Definition:
SpeechRecognitionSphinx.py:32
RappCloud.Objects
Definition:
__init__.py:1
RappCloud.CloudMsgs.SpeechRecognitionSphinx.SpeechRecognitionSphinx.Response
Definition:
SpeechRecognitionSphinx.py:62
RappCloud.CloudMsgs.SpeechRecognitionSphinx.SpeechRecognitionSphinx.__init__
def __init__
Constructor.
Definition:
SpeechRecognitionSphinx.py:82
RappCloud.CloudMsgs.SpeechRecognitionSphinx.SpeechRecognitionSphinx.Request.make_files
def make_files
Definition:
SpeechRecognitionSphinx.py:57
RappCloud.CloudMsgs.SpeechRecognitionSphinx.SpeechRecognitionSphinx.Request.make_payload
def make_payload
Definition:
SpeechRecognitionSphinx.py:47
RappCloud.CloudMsgs.SpeechRecognitionSphinx.SpeechRecognitionSphinx.Response.error
error
Error message.
Definition:
SpeechRecognitionSphinx.py:78
RappCloud.CloudMsgs.SpeechRecognitionSphinx.SpeechRecognitionSphinx.Request
Definition:
SpeechRecognitionSphinx.py:14
RappCloud.CloudMsgs.SpeechRecognitionSphinx.SpeechRecognitionSphinx.req
req
Definition:
SpeechRecognitionSphinx.py:96
RappCloud.CloudMsgs.SpeechRecognitionSphinx.SpeechRecognitionSphinx.Request.__init__
def __init__
Constructor.
Definition:
SpeechRecognitionSphinx.py:18
RappCloud.CloudMsgs.SpeechRecognitionSphinx.SpeechRecognitionSphinx.Response.words
words
Recognized words.
Definition:
SpeechRecognitionSphinx.py:76
RappCloud.CloudMsgs.SpeechRecognitionSphinx.SpeechRecognitionSphinx.Request.words
words
A vector that carries the words to recognize.
Definition:
SpeechRecognitionSphinx.py:36
RappCloud.CloudMsgs.SpeechRecognitionSphinx.SpeechRecognitionSphinx.Response.__init__
def __init__
Constructor.
Definition:
SpeechRecognitionSphinx.py:66
RappCloud.CloudMsgs.SpeechRecognitionSphinx.SpeechRecognitionSphinx.Request.audio_source
audio_source
Audio source data format.
Definition:
SpeechRecognitionSphinx.py:34
RappCloud.CloudMsgs.SpeechRecognitionSphinx.SpeechRecognitionSphinx.Request.audiofile
audiofile
Path to the audio file.
Definition:
SpeechRecognitionSphinx.py:42
RappCloud.CloudMsgs.SpeechRecognitionSphinx.SpeechRecognitionSphinx.Request.grammar
grammar
Grammar to use.
Definition:
SpeechRecognitionSphinx.py:40
RappCloud.CloudMsgs.SpeechRecognitionSphinx.SpeechRecognitionSphinx.resp
resp
Definition:
SpeechRecognitionSphinx.py:98
python
RappCloud
CloudMsgs
SpeechRecognitionSphinx.py
Generated on Fri Jul 29 2016 18:45:01 for RAPP Platform API by
1.8.6