diff --git a/convlab2/dialog_agent/agent.py b/convlab2/dialog_agent/agent.py index a5e437c277547f09522fd9bffa35019c1afc552c..a937957400e17c95e18df095fe0277d9d228d4e8 100755 --- a/convlab2/dialog_agent/agent.py +++ b/convlab2/dialog_agent/agent.py @@ -99,7 +99,6 @@ class PipelineAgent(Agent): self.agent_saves = [] self.history = [] self.turn = 0 - self.cur_domain = None #logging.info("Pipeline Agent info_dict check") if hasattr(self.nlu, 'info_dict') == False: @@ -184,20 +183,11 @@ class PipelineAgent(Agent): self.dst.state['history'].append([self.name, model_response]) if self.name == 'sys': self.dst.state['system_action'] = self.output_action - # If system takes booking action add booking info to the 'book-booked' section of the belief state - if type(self.input_action) != list: - self.input_action = self.dst.state['user_action'] - if type(self.input_action) == list: - for intent, domain, slot, value in self.input_action: - if domain.lower() not in ['booking', 'general']: - self.cur_domain = domain if type(self.output_action) == list: for intent, domain, slot, value in self.output_action: - if domain.lower() not in ['general', 'booking']: - self.cur_domain = domain if intent == "book": - self.dst.state['booked'][domain] = [{slot.lower(): value}] + self.dst.state['booked'][domain] = [{slot: value}] else: self.dst.state['user_action'] = self.output_action # user dst is also updated by itself @@ -244,7 +234,6 @@ class PipelineAgent(Agent): def init_session(self, **kwargs): """Init the attributes of DST and Policy module.""" - self.cur_domain = None if self.nlu is not None: self.nlu.init_session() if self.dst is not None: @@ -328,7 +317,6 @@ class DialogueAgent(Agent): "user_id": None, "timestamp": None, "dialogue_info": [], "dialogue_info_fundamental": []} self.initTime = int(time.time()) self.lastUpdate = int(time.time()) - self.cur_domain = None logging.info("Dialogue Agent info_dict check") if not hasattr(self.nlu, 'info_dict'): @@ -401,10 +389,8 @@ class DialogueAgent(Agent): # If system takes booking action add booking info to the 'book-booked' section of the belief state if type(self.output_action) == list: for intent, domain, slot, value in self.output_action: - if domain.lower() not in ['general', 'booking']: - self.cur_domain = domain if intent == "book": - self.dst.state['booked'][domain] = [{slot.lower(): value}] + self.dst.state['booked'][domain] = [{slot: value}] self.history.append([self.name, model_response]) self.turn += 1 @@ -448,7 +434,6 @@ class DialogueAgent(Agent): def init_session(self): """Init the attributes of DST and Policy module.""" - self.cur_domain = None if self.nlu is not None: self.nlu.init_session() if self.dst is not None: diff --git a/convlab2/dialog_agent/env.py b/convlab2/dialog_agent/env.py index 1fd190d26c0a7baac3f84499e7daa3b41f584bdd..dc345786ab154d028e1c569a347fabcc9c5a5def 100755 --- a/convlab2/dialog_agent/env.py +++ b/convlab2/dialog_agent/env.py @@ -17,12 +17,10 @@ class Environment(): self.sys_dst = sys_dst self.evaluator = evaluator self.use_semantic_acts = use_semantic_acts - self.cur_domain = None def reset(self): self.usr.init_session() self.sys_dst.init_session() - self.cur_domain = None if self.evaluator: self.evaluator.add_goal(self.usr.policy.get_goal()) s, r, t = self.step([]) @@ -38,7 +36,7 @@ class Environment(): if type(action) == list: for intent, domain, slot, value in action: if intent == "book": - self.sys_dst.state['booked'][domain] = [{slot.lower(): value}] + self.sys_dst.state['booked'][domain] = [{slot: value}] observation = self.usr.response(model_response) if self.evaluator: