Skip to content
Snippets Groups Projects
Commit cb509941 authored by function2's avatar function2
Browse files

Merge branch 'master' of github.com:thu-coai/ConvLab-2

parents e0ee065c 8b4464c5
Branches
No related tags found
No related merge requests found
import os
import json import json
import os
import zipfile import zipfile
from copy import deepcopy
from convlab2 import DATA_ROOT from convlab2 import DATA_ROOT
...@@ -79,12 +78,6 @@ def extract_gt(test_data): ...@@ -79,12 +78,6 @@ def extract_gt(test_data):
# for unifying values with the same meaning to the same expression # for unifying values with the same meaning to the same expression
def unify_value(value, subtask): def unify_value(value, subtask):
if isinstance(value, list):
ret = deepcopy(value)
for i, v in enumerate(ret):
ret[i] = unify_value(v, subtask)
return ret
value = value.lower() value = value.lower()
value = { value = {
'multiwoz': { 'multiwoz': {
...@@ -139,7 +132,7 @@ def eval_states(gt, pred, subtask): ...@@ -139,7 +132,7 @@ def eval_states(gt, pred, subtask):
pred_value = unify_value(pred_domain[slot_name], subtask) pred_value = unify_value(pred_domain[slot_name], subtask)
slot_tot += 1 slot_tot += 1
if gt_value == pred_value or isinstance(gt_value, list) and pred_value in gt_value: if gt_value == pred_value:
slot_acc += 1 slot_acc += 1
if gt_value: if gt_value:
tp += 1 tp += 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment