diff --git a/convlab/policy/vector/vector_base.py b/convlab/policy/vector/vector_base.py index 5d0a42b3331160c1efe604bbc965eba01e9860ae..0bc3351aae8bcb769983b58a5e6601607e3f5f98 100644 --- a/convlab/policy/vector/vector_base.py +++ b/convlab/policy/vector/vector_base.py @@ -83,7 +83,8 @@ class VectorBase(Vector): if self.da_voc[0][0] != "[": # if act is not a list, we still have the old action dict self.load_actions_from_data() - self.da_voc = [tuple(json.loads(act)) for act in self.da_voc] + else: + self.da_voc = [tuple(json.loads(act)) for act in self.da_voc] with open(os.path.join(dir_path, "user_da_voc.txt")) as f: self.da_voc_opp = f.read().splitlines() self.da_voc_opp = [tuple(json.loads(act)) for act in self.da_voc_opp] @@ -355,10 +356,11 @@ class VectorBase(Vector): def action_vectorize(self, action): action = delexicalize_da(action, self.requestable) - action = flat_da(action) + #action = flat_da(action) act_vec = np.zeros(self.da_dim) for da in action: + da = tuple(da) if da in self.act2vec: act_vec[self.act2vec[da]] = 1. return act_vec