diff --git a/modelscope/utils/nlp/space/db_ops.py b/modelscope/utils/nlp/space/db_ops.py index a1bd34ea..2168c079 100644 --- a/modelscope/utils/nlp/space/db_ops.py +++ b/modelscope/utils/nlp/space/db_ops.py @@ -202,7 +202,7 @@ class MultiWozDB(object): ':' ) # raise error if time value is not xx:xx format v = int(h) * 60 + int(m) - except: + except Exception: match = False break time = int(db_ent[s].split(':')[0]) * 60 + int( @@ -243,7 +243,12 @@ class MultiWozDB(object): flag = True for key, val in constraints.items(): - if val == '' or val == 'dontcare' or val == 'not mentioned' or val == "don't care" or val == 'dont care' or val == "do n't care": + if val == '' \ + or val == 'dontcare' \ + or val == 'not mentioned' \ + or val == "don't care" \ + or val == 'dont care' \ + or val == "do n't care": pass else: if flag: @@ -270,7 +275,7 @@ class MultiWozDB(object): try: # "select * from attraction where name = 'queens college'" print(sql_query) return self.sql_dbs[domain].execute(sql_query).fetchall() - except: + except Exception: return [] # TODO test it diff --git a/tests/preprocessors/nlp/test_dialog_generation.py b/tests/preprocessors/nlp/test_dialog_generation.py index ca07922b..319456d8 100644 --- a/tests/preprocessors/nlp/test_dialog_generation.py +++ b/tests/preprocessors/nlp/test_dialog_generation.py @@ -2,11 +2,10 @@ import unittest -from tests.case.nlp.dialog_generation_case import test_case - from maas_lib.preprocessors import DialogGenerationPreprocessor from maas_lib.utils.constant import Fields, InputFields from maas_lib.utils.logger import get_logger +from tests.case.nlp.dialog_generation_case import test_case logger = get_logger() diff --git a/tests/preprocessors/nlp/test_dialog_intent.py b/tests/preprocessors/nlp/test_dialog_intent.py index 3f0500b7..60fcf049 100644 --- a/tests/preprocessors/nlp/test_dialog_intent.py +++ b/tests/preprocessors/nlp/test_dialog_intent.py @@ -2,11 +2,10 @@ import unittest -from tests.case.nlp.dialog_intent_case import test_case - from maas_lib.preprocessors import DialogIntentPreprocessor from maas_lib.utils.constant import Fields, InputFields from maas_lib.utils.logger import get_logger +from tests.case.nlp.dialog_intent_case import test_case logger = get_logger()