From 824788e1904baedf236e2cbd895952460fd8b6f1 Mon Sep 17 00:00:00 2001 From: zqwerty <zhuq96@hotmail.com> Date: Mon, 11 Apr 2022 09:43:58 +0800 Subject: [PATCH] update delex func --- convlab2/util/unified_datasets_util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/convlab2/util/unified_datasets_util.py b/convlab2/util/unified_datasets_util.py index c7844396..f689a990 100644 --- a/convlab2/util/unified_datasets_util.py +++ b/convlab2/util/unified_datasets_util.py @@ -238,7 +238,7 @@ def create_delex_data(dataset, delex_format='[({domain})-({slot})]', ignore_valu domain, slot, value = da['domain'], da['slot'], da['value'] if value.lower() not in ignore_values: placeholder = delex_format.format(domain=domain, slot=slot, value=value) - pattern = re.compile(r'\b'+f'({value})'+r'\b', flags=re.I) + pattern = re.compile(r'\b({})\b'.format(value), flags=re.I) if delex_inplace(delex_utt, pattern): delex_vocab.add(placeholder) @@ -252,7 +252,7 @@ def create_delex_data(dataset, delex_format='[({domain})-({slot})]', ignore_valu for value in values.split('|'): if value.lower() not in ignore_values: placeholder = delex_format.format(domain=domain, slot=slot, value=value) - pattern = re.compile(r'\b'+f'({value})'+r'\b', flags=re.I) + pattern = re.compile(r'\b({})\b'.format(value), flags=re.I) if delex_inplace(delex_utt, pattern): delex_vocab.add(placeholder) -- GitLab