Skip to content
Snippets Groups Projects
Unverified Commit 6a051c28 authored by zhuqi's avatar zhuqi Committed by GitHub
Browse files

Merge pull request #70 from ConvLab/clean_code

update TemplateNLG to accept flatten dialog acts in unified format
parents b71aea12 d85e9c0d
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,7 @@ from convlab.nlg import NLG ...@@ -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.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.multiwoz.multiwoz_slot_trans import REF_SYS_DA
from convlab.util import relative_import_module_from_unified_datasets 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') reverse_da = relative_import_module_from_unified_datasets('multiwoz21', 'preprocess.py', 'reverse_da')
...@@ -166,9 +167,9 @@ class TemplateNLG(NLG): ...@@ -166,9 +167,9 @@ class TemplateNLG(NLG):
Returns: Returns:
generated sentence generated sentence
""" """
if isinstance(dialog_acts, dict): dialog_acts = unified_format(dialog_acts)
# dialog acts are in the unified format
dialog_acts = reverse_da(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 = self.noisy_dialog_acts(
dialog_acts) if self.is_user else dialog_acts dialog_acts) if self.is_user else dialog_acts
dialog_acts = self.sorted_dialog_act(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