Ejemplo n.º 1
0
    def __init__( self ):

        """
        Start the GUI and the asynchronous threads. We are in the main
        (original) thread of the application, which will later be used by
        the GUI. We spawn a new thread for the worker.
        """

        # Create the queue
        self.queue = Queue.Queue()

        # Set up the GUI part
        self.gui_manager = tbh_gui_manager( self.queue, self.endApplication )
        self.gui_manager.show()
        
        self.data_viz_queue = Queue.Queue()
        
        self.pomdp_data_viz = tbh_pomdp_data_viz.tbh_pomdp_data_viz_t( \
            self.queue, self.endApplication )
        self.pomdp_data_viz.show()
        #self.gui.console.show()

        # A timer to periodically call periodicCall :-)
        self.queue_timer = PyQt4.QtCore.QTimer()

        # Start the timer -- this replaces the initial call 
        # to periodicCall
        self.queue_timer.start(100)
        PyQt4.QtCore.QObject.connect(self.queue_timer, PyQt4.QtCore.SIGNAL("timeout()"), \
                                         self.periodicCall)



        # Set up the thread to do asynchronous I/O
        # More can be made if necessary
        self.running = 1
        
    	self.thread = threading.Thread( target=self.worker_thread )
        self.thread.start()

        # Start the periodic call in the GUI to check if the queue contains
        # anything
        self.periodicCall()
Ejemplo n.º 2
0
feature_type_list = [ 'tbh_keyword' , 'tbh_first_word' , 'tbh_keyword_sequence', 'score_statistic', 'tbh_digits', 'tbh_skype_contact' ]
dm = tbh_dialog_manager.tbh_dialog_manager_t( feature_type_list = feature_type_list, \
                                                  skype_contacts_dict = \
                                                  skype_contacts_dict )

# Initialize speech recognizer
sr = tbh_speech_recognizer.tbh_speech_recognizer_t( \
    starting_grammar = 'full', default_grammar = 'full' )

# Initialize Skype manager
# Pass in the text file containing the contact names
sm = tbh_skype_interface.tbh_skype_interface_t( contacts_file = skype_contacts_dict )


# Initialize POMDP data visualization
pdv = tbh_pomdp_data_viz.tbh_pomdp_data_viz_t()


# Initialize the audio listener, has its own thread
al = tbh_audio_listener.tbh_audio_listener_t( \
    microphone_name = 'icicle', temp_audio_storage_path = \
        '../../tbh_top_level/audio_files' )

al_thread = threading.Thread( target=al.run )
al_thread.start()

# Initialize the storage module
ds = tbh_data_storage.tbh_data_storage_t( '../logfiles' )

# ---- SET UP CALLBACKS ---- #
# 1. Once the audio listener has created an utterance, it passes an