Skip to content
Snippets Groups Projects
Commit d85e9c0d authored by zqwerty's avatar zqwerty
Browse files

update TemplateNLG to accept flatten dialog acts in unified format

parent bf8e5f0f
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,7 @@ from convlab.nlg import NLG
from convlab.nlg.template.multiwoz.noise_functions import delete_random_token, random_token_permutation, spelling_noise
from convlab.util.multiwoz.multiwoz_slot_trans import REF_SYS_DA
from convlab.util import relative_import_module_from_unified_datasets
from convlab.policy.rule.multiwoz.policy_agenda_multiwoz import unified_format, act_dict_to_flat_tuple
reverse_da = relative_import_module_from_unified_datasets('multiwoz21', 'preprocess.py', 'reverse_da')
......@@ -166,9 +167,9 @@ class TemplateNLG(NLG):
Returns:
generated sentence
"""
if isinstance(dialog_acts, dict):
# dialog acts are in the unified format
dialog_acts = unified_format(dialog_acts)
dialog_acts = reverse_da(dialog_acts)
dialog_acts = act_dict_to_flat_tuple(dialog_acts)
dialog_acts = self.noisy_dialog_acts(
dialog_acts) if self.is_user else dialog_acts
dialog_acts = self.sorted_dialog_act(dialog_acts)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment