Browse Source

update

master
ly119399 3 years ago
parent
commit
c400684327
3 changed files with 10 additions and 7 deletions
  1. +8
    -3
      modelscope/utils/nlp/space/db_ops.py
  2. +1
    -2
      tests/preprocessors/nlp/test_dialog_generation.py
  3. +1
    -2
      tests/preprocessors/nlp/test_dialog_intent.py

+ 8
- 3
modelscope/utils/nlp/space/db_ops.py View File

@@ -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




+ 1
- 2
tests/preprocessors/nlp/test_dialog_generation.py View File

@@ -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()



+ 1
- 2
tests/preprocessors/nlp/test_dialog_intent.py View File

@@ -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()



Loading…
Cancel
Save