Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
dialogflow_ros.dialogflow_client.DialogflowClient Class Reference
Inheritance diagram for dialogflow_ros.dialogflow_client.DialogflowClient:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self, language_code='en-US', last_contexts=None)
 
def detect_intent_stream (self, return_result=False)
 
def detect_intent_text (self, msg)
 
def event_intent (self, event)
 
def exit (self)
 
def get_language_code (self)
 
def set_language_code (self, language_code)
 
def start (self)
 

Public Attributes

 audio
 
 CHANNELS
 
 CHUNK
 
 DEBUG
 
 FORMAT
 
 last_contexts
 
 phrase_hints
 
 PLAY_AUDIO
 
 RATE
 
 stream_out
 
 USE_AUDIO_SERVER
 

Private Member Functions

def _create_audio_output (self)
 
def _event_request_cb (self, msg)
 
def _generator (self)
 
def _msg_request_cb (self, msg)
 
def _play_stream (self, data)
 
def _signal_handler (self, signal, frame)
 
def _text_event_cb (self, msg)
 
def _text_request_cb (self, msg)
 

Private Attributes

 _audio_config
 
 _language_code
 
 _output_audio_config
 
 _port
 
 _results_pub
 
 _server_name
 
 _session
 
 _session_cli
 

Detailed Description

Definition at line 31 of file dialogflow_client.py.

Constructor & Destructor Documentation

def dialogflow_ros.dialogflow_client.DialogflowClient.__init__ (   self,
  language_code = 'en-US',
  last_contexts = None 
)
Initialize all params and load data
Constants and params 

Definition at line 32 of file dialogflow_client.py.

Member Function Documentation

def dialogflow_ros.dialogflow_client.DialogflowClient._create_audio_output (   self)
private
Creates a PyAudio output stream.

Definition at line 162 of file dialogflow_client.py.

def dialogflow_ros.dialogflow_client.DialogflowClient._event_request_cb (   self,
  msg 
)
private
:param msg: DialogflowEvent Message
:type msg: DialogflowEvent

Definition at line 128 of file dialogflow_client.py.

def dialogflow_ros.dialogflow_client.DialogflowClient._generator (   self)
private
Generator function that continuously yields audio chunks from the
buffer. Used to stream data to the Google Speech API Asynchronously.
:return A streaming request with the audio data.
First request carries config data per Dialogflow docs.
:rtype: Iterator[:class:`StreamingDetectIntentRequest`]

Definition at line 183 of file dialogflow_client.py.

def dialogflow_ros.dialogflow_client.DialogflowClient._msg_request_cb (   self,
  msg 
)
private
ROS Callback that sends text received from a topic to Dialogflow,
:param msg: A DialogflowRequest message.
:type msg: DialogflowRequest

Definition at line 120 of file dialogflow_client.py.

def dialogflow_ros.dialogflow_client.DialogflowClient._play_stream (   self,
  data 
)
private
Simple function to play a the output Dialogflow response.
:param data: Audio in bytes.

Definition at line 170 of file dialogflow_client.py.

def dialogflow_ros.dialogflow_client.DialogflowClient._signal_handler (   self,
  signal,
  frame 
)
private

Definition at line 154 of file dialogflow_client.py.

def dialogflow_ros.dialogflow_client.DialogflowClient._text_event_cb (   self,
  msg 
)
private

Definition at line 135 of file dialogflow_client.py.

def dialogflow_ros.dialogflow_client.DialogflowClient._text_request_cb (   self,
  msg 
)
private
ROS Callback that sends text received from a topic to Dialogflow,
:param msg: A String message.
:type msg: String

Definition at line 111 of file dialogflow_client.py.

def dialogflow_ros.dialogflow_client.DialogflowClient.detect_intent_stream (   self,
  return_result = False 
)
Gets data from an audio generator (mic) and streams it to Dialogflow.
We use a stream for VAD and single utterance detection.

Definition at line 257 of file dialogflow_client.py.

def dialogflow_ros.dialogflow_client.DialogflowClient.detect_intent_text (   self,
  msg 
)
Use the Dialogflow API to detect a user's intent. Goto the Dialogflow
console to define intents and params.
:param msg: DialogflowRequest msg
:return query_result: Dialogflow's query_result with action parameters
:rtype: DialogflowResult

Definition at line 218 of file dialogflow_client.py.

def dialogflow_ros.dialogflow_client.DialogflowClient.event_intent (   self,
  event 
)
Send an event message to Dialogflow
:param event: The ROS event message
:type event: DialogflowEvent
:return: The result from dialogflow as a ROS msg
:rtype: DialogflowResult

Definition at line 302 of file dialogflow_client.py.

def dialogflow_ros.dialogflow_client.DialogflowClient.exit (   self)
Close as cleanly as possible

Definition at line 335 of file dialogflow_client.py.

def dialogflow_ros.dialogflow_client.DialogflowClient.get_language_code (   self)

Definition at line 143 of file dialogflow_client.py.

def dialogflow_ros.dialogflow_client.DialogflowClient.set_language_code (   self,
  language_code 
)

Definition at line 146 of file dialogflow_client.py.

def dialogflow_ros.dialogflow_client.DialogflowClient.start (   self)
Start the dialogflow client

Definition at line 330 of file dialogflow_client.py.

Member Data Documentation

dialogflow_ros.dialogflow_client.DialogflowClient._audio_config
private

Definition at line 65 of file dialogflow_client.py.

dialogflow_ros.dialogflow_client.DialogflowClient._language_code
private

Definition at line 60 of file dialogflow_client.py.

dialogflow_ros.dialogflow_client.DialogflowClient._output_audio_config
private

Definition at line 70 of file dialogflow_client.py.

dialogflow_ros.dialogflow_client.DialogflowClient._port
private

Definition at line 99 of file dialogflow_client.py.

dialogflow_ros.dialogflow_client.DialogflowClient._results_pub
private

Definition at line 87 of file dialogflow_client.py.

dialogflow_ros.dialogflow_client.DialogflowClient._server_name
private

Definition at line 97 of file dialogflow_client.py.

dialogflow_ros.dialogflow_client.DialogflowClient._session
private

Definition at line 75 of file dialogflow_client.py.

dialogflow_ros.dialogflow_client.DialogflowClient._session_cli
private

Definition at line 74 of file dialogflow_client.py.

dialogflow_ros.dialogflow_client.DialogflowClient.audio

Definition at line 96 of file dialogflow_client.py.

dialogflow_ros.dialogflow_client.DialogflowClient.CHANNELS

Definition at line 37 of file dialogflow_client.py.

dialogflow_ros.dialogflow_client.DialogflowClient.CHUNK

Definition at line 35 of file dialogflow_client.py.

dialogflow_ros.dialogflow_client.DialogflowClient.DEBUG

Definition at line 41 of file dialogflow_client.py.

dialogflow_ros.dialogflow_client.DialogflowClient.FORMAT

Definition at line 36 of file dialogflow_client.py.

dialogflow_ros.dialogflow_client.DialogflowClient.last_contexts

Definition at line 61 of file dialogflow_client.py.

dialogflow_ros.dialogflow_client.DialogflowClient.phrase_hints

Definition at line 52 of file dialogflow_client.py.

dialogflow_ros.dialogflow_client.DialogflowClient.PLAY_AUDIO

Definition at line 40 of file dialogflow_client.py.

dialogflow_ros.dialogflow_client.DialogflowClient.RATE

Definition at line 38 of file dialogflow_client.py.

dialogflow_ros.dialogflow_client.DialogflowClient.stream_out

Definition at line 165 of file dialogflow_client.py.

dialogflow_ros.dialogflow_client.DialogflowClient.USE_AUDIO_SERVER

Definition at line 39 of file dialogflow_client.py.


The documentation for this class was generated from the following file:


dialogflow_ros
Author(s): Anas Abou Allaban
autogenerated on Mon Jun 10 2019 13:02:59