Example #1
0
    def __init__( self, feature_type_list, skype_contacts_dict=None ): 

        # --- COMMON --- #
        # These internal state you probably want in any dialog manager
        self._processed_nbest_event_handler_list = []
        self._processed_audio_event_handler_list = []
        self._operate_phone_event_handler_list = []
        self.feature_type_list = feature_type_list
        
        # --- CUSTOM --- #
        # These internal state are specific to this dialog manager
        self.system_state = 'sleeping'
        self.window_size = 50;
        self.audio_power_list = [];

        # For our simple dialog system, we have a confirmation buffer
        # the user needs to confirm in order to complete the above action
        self.confirmation_buffer = None
        
        if skype_contacts_dict != None: 
            self.skype_contacts_dict = skype_contacts_dict
        else:
            self.skype_contacts_dict = None

        
        # --- CUSTOM --- # 
        # This is for the POMDP dialog manager
        dialog_data = tbh_pomdp_util.get_matlab_dialog_data( DIALOG_DATA_PATH )
        self.pomdp = tbh_pomdp_util.get_pomdp( dialog_data )       
        self.Q = tbh_pomdp_util.get_Q( dialog_data )


        self.pomdp.belief = self.pomdp.start_dist[ :, 0 ]

        self.machine_action = None
    def __init__( self, feature_type_list, dialog_data_path = DIALOG_DATA_PATH, \
                      skype_contacts_dict=None, \
                      high_confidence_histogram = None, \
                      low_confidence_histogram = None ): 

        # --- COMMON --- #
        # These internal state you probably want in any dialog manager
        self._processed_nbest_event_handler_list = []
        self._processed_audio_event_handler_list = []
        self._operate_phone_event_handler_list = []
        self.feature_type_list = feature_type_list


        # --- FOR EXPERIMENTS --- #
        self._experiment_event_handler_list = []

        # --- CUSTOM --- #
        # These internal state are specific to this dialog manager
        self.system_state = 'sleeping'
        self.window_size = 50;
        self.audio_power_list = [];
        
        # for confidence modeling
        self.high_confidence_histogram = high_confidence_histogram
        self.low_confidence_histogram = low_confidence_histogram

        # For our simple dialog system, we have a confirmation buffer
        # the user needs to confirm in order to complete the above action
        self.confirmation_buffer = None
        
        if skype_contacts_dict != None: 
            self.skype_contacts_dict = skype_contacts_dict
        else:
            self.skype_contacts_dict = None
        
        # --- CUSTOM --- # 
        # This is for the POMDP dialog manager
        dialog_data = tbh_pomdp_util.get_matlab_dialog_data( dialog_data_path )
        self.pomdp = tbh_pomdp_util.get_pomdp( dialog_data )       
        self.Q = tbh_pomdp_util.get_Q( dialog_data )
        self.machine_action = None

        # FOR EXPERIMENTS
        self.experiment_controller = \
            tbh_experiment_controller.experiment_controller()

        self.current_experiment_log = None

        """
    def __init__( self, feature_type_list, dialog_data_path = DIALOG_DATA_PATH, skype_contacts_dict=None ): 

        # --- COMMON --- #
        # These internal state you probably want in any dialog manager
        self._processed_nbest_event_handler_list = []
        self._processed_audio_event_handler_list = []
        self._operate_phone_event_handler_list = []
        self.feature_type_list = feature_type_list
        
        # --- CUSTOM --- #
        # These internal state are specific to this dialog manager
        self.system_state = 'sleeping'
        self.window_size = 50;
        self.audio_power_list = [];

        # For our simple dialog system, we have a confirmation buffer
        # the user needs to confirm in order to complete the above action
        self.confirmation_buffer = None
        
        if skype_contacts_dict != None: 
            self.skype_contacts_dict = skype_contacts_dict
        else:
            self.skype_contacts_dict = None

        
        # --- CUSTOM --- # 
        # This is for the POMDP dialog manager
        dialog_data = tbh_pomdp_util.get_matlab_dialog_data( dialog_data_path )


        self.pomdp = tbh_pomdp_util.get_pomdp( dialog_data )       


        if USE_DATA_OBSERVATION_FUNCTION:
            #print "#### USING DATA OBSERVATION FUNCTION ####"
            #print self.pomdp.nrObservations[[0]] 
            #print int( self.pomdp.nrGeneralActions )
            states = range( pomdp.nrStates )
            actions = range( pomdp.nrActions )

            states = range(0,96)
            actions = range(0,101)

            import pickle
            f = open( '../../dialog_system_tools/src/observation_model.pkl', 'r' )
            normalized_final_model = pickle.load( f )

            for s in states:
                for a in actions:
                    self.pomdp.observation[s][a] = normalized_final_model[s]

        else:
            pass

            






        #print "#### ENTIRE OBSERVATION FUNCTION ###"
        #print self.pomdp.observation


        self.Q = tbh_pomdp_util.get_Q( dialog_data )

        self.machine_action = None