Example #1
0
    def __init__(self, database, constants):
        """
        The constructor of StateTracker.

        The constructor of StateTracker which creates a DB query object, creates necessary state rep. dicts, etc. and
        calls reset.

        Parameters:
            database (dict): The database with format dict(long: dict)
            constants (dict): Loaded constants in dict

        """
        # db查找工具
        self.db_helper = DBQuery(database)
        # 整个对话的目标key,默认为'ticket'
        self.match_key = usersim_default_key
        # intents的dict,key为intent,value为序号
        self.intents_dict = convert_list_to_dict(all_intents)
        # intents个数
        self.num_intents = len(all_intents)
        # slots的dict,key为slot,value为序号
        self.slots_dict = convert_list_to_dict(all_slots)
        # slots个数
        self.num_slots = len(all_slots)
        # 所允许的最长对话回合数,超过此回合则对话失败
        self.max_round_num = constants['run']['max_round_num']
        # 对话状态中的零状态,即什么信息也没有
        self.none_state = np.zeros(self.get_state_size())
        # 初始化StateTracker
        self.reset()
Example #2
0
 def __init__(self):
     self.actions_dict = convert_list_to_dict(all_actions)
     self.num_actions = len(self.actions_dict)  # 15
     self.slots_dict = convert_list_to_dict(required_slots)
     self.num_slots = len(self.slots_dict)  # 4
     self.max_round_num = max_round  # 15
     self.none_state = np.zeros(self.get_state_size())  # 36
     self.required_slots = required_slots
    def __init__(self, constants, global_context):

        self.match_key = user_sim_default_request
        self.intents_dict = convert_list_to_dict(all_intents)
        self.num_intents = len(all_intents)
        self.slots_dict = convert_list_to_dict(all_slots)
        self.num_slots = len(all_slots)
        self.max_round_num = constants['run']['max_round_num']
        self.none_state = np.zeros(self.get_state_size())
        self.reset()
Example #4
0
    def __init__(self, database, max_round_num):

        self.db_helper = DBQuery(database)
        self.match_key = usersim_default_key
        self.intents_dict = convert_list_to_dict(all_intents)
        self.num_intents = len(all_intents)
        self.slots_dict = convert_list_to_dict(all_slots)
        self.num_slots = len(all_slots)
        self.max_round_num = max_round_num
        self.none_state = np.zeros(self.get_state_size())
        self.reset()
    def __init__(self, database, constants):
        """
        The constructor of StateTracker.
        The constructor of StateTracker which creates a DB query object, creates necessary state rep. dicts, etc. and
        calls reset.
        Parameters:
            database (dict): The database with format dict(long: dict)
            constants (dict): Loaded constants in dict
        """

        self.db_helper = DBQuery(database)
        self.match_key = usersim_default_key
        self.intents_dict = convert_list_to_dict(all_intents)
        self.num_intents = len(all_intents)
        self.slots_dict = convert_list_to_dict(all_slots)
        self.num_slots = len(all_slots)
        self.max_round_num = constants['run']['max_round_num']
        self.none_state = np.zeros(self.get_state_size())
        self.reset()