Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TUS_public
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
dsml
TUS_public
Commits
e0f5210b
Commit
e0f5210b
authored
4 years ago
by
function2
Browse files
Options
Downloads
Patches
Plain Diff
use selectedResults for missing name
parent
0ac85ac3
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
convlab2/dst/dstc9/eval_file.py
+1
-2
1 addition, 2 deletions
convlab2/dst/dstc9/eval_file.py
convlab2/dst/dstc9/utils.py
+9
-9
9 additions, 9 deletions
convlab2/dst/dstc9/utils.py
with
10 additions
and
11 deletions
convlab2/dst/dstc9/eval_file.py
+
1
−
2
View file @
e0f5210b
...
@@ -2,9 +2,8 @@
...
@@ -2,9 +2,8 @@
evaluate output file
evaluate output file
"""
"""
import
os
import
json
import
json
from
copy
import
deepcopy
import
os
from
convlab2.dst.dstc9.utils
import
prepare_data
,
extract_gt
,
eval_states
,
get_subdir
from
convlab2.dst.dstc9.utils
import
prepare_data
,
extract_gt
,
eval_states
,
get_subdir
...
...
This diff is collapsed.
Click to expand it.
convlab2/dst/dstc9/utils.py
+
9
−
9
View file @
e0f5210b
...
@@ -41,12 +41,10 @@ def prepare_data(subtask, split, data_root=DATA_ROOT):
...
@@ -41,12 +41,10 @@ def prepare_data(subtask, split, data_root=DATA_ROOT):
sys_utt
=
turns
[
i
-
1
][
'
content
'
]
if
i
else
None
sys_utt
=
turns
[
i
-
1
][
'
content
'
]
if
i
else
None
user_utt
=
turns
[
i
][
'
content
'
]
user_utt
=
turns
[
i
][
'
content
'
]
state
=
{}
state
=
{}
for
domain_name
,
domain
in
turns
[
i
+
1
][
'
sys_state_init
'
].
items
():
for
domain_name
,
domain_state
in
turns
[
i
+
1
][
'
sys_state_init
'
].
items
():
domain_state
=
{}
selected_results
=
domain_state
.
pop
(
'
selectedResults
'
)
for
slot_name
,
value
in
domain
.
items
():
if
selected_results
and
'
name
'
in
domain_state
and
not
domain_state
[
'
name
'
]:
if
slot_name
==
'
selectedResults
'
:
domain_state
[
'
name
'
]
=
selected_results
continue
domain_state
[
slot_name
]
=
value
state
[
domain_name
]
=
domain_state
state
[
domain_name
]
=
domain_state
dialog_data
.
append
((
sys_utt
,
user_utt
,
state
))
dialog_data
.
append
((
sys_utt
,
user_utt
,
state
))
data
[
dialog_id
]
=
dialog_data
data
[
dialog_id
]
=
dialog_data
...
@@ -66,14 +64,16 @@ def eval_states(gt, pred, subtask):
...
@@ -66,14 +64,16 @@ def eval_states(gt, pred, subtask):
# for unifying values with the same meaning to the same expression
# for unifying values with the same meaning to the same expression
value_unifier
=
{
value_unifier
=
{
'
multiwoz
'
:
{
'
multiwoz
'
:
{
'
未提及
'
:
''
,
},
},
'
crosswoz
'
:
{
'
crosswoz
'
:
{
'
未提及
'
:
''
,
}
}
}[
subtask
]
}[
subtask
]
def
unify_value
(
value
):
def
unify_value
(
value
):
if
isinstance
(
value
,
list
):
return
list
(
map
(
unify_value
,
value
))
return
value_unifier
.
get
(
value
,
value
)
return
value_unifier
.
get
(
value
,
value
)
def
exception
(
description
,
**
kargs
):
def
exception
(
description
,
**
kargs
):
...
@@ -110,7 +110,7 @@ def eval_states(gt, pred, subtask):
...
@@ -110,7 +110,7 @@ def eval_states(gt, pred, subtask):
gt_value
=
unify_value
(
gt_value
)
gt_value
=
unify_value
(
gt_value
)
pred_value
=
unify_value
(
pred_domain
[
slot_name
])
pred_value
=
unify_value
(
pred_domain
[
slot_name
])
slot_tot
+=
1
slot_tot
+=
1
if
gt_value
==
pred_value
:
if
gt_value
==
pred_value
or
isinstance
(
gt_value
,
list
)
and
pred_value
in
gt_value
:
slot_acc
+=
1
slot_acc
+=
1
if
gt_value
:
if
gt_value
:
tp
+=
1
tp
+=
1
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment