Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

jsonfile retains original fields #5033

Merged
merged 3 commits into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions parlai/core/teachers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1730,8 +1730,12 @@ def _get_ep_from_turns(self, xturns, yturns):
eps = []
for xturn, yturn in zip(xturns, yturns):
turn = {}
turn['text'] = xturn.get('text').strip()
turn['labels'] = [yturn.get('text').strip()]
turn['text'] = xturn.get('text')
turn['labels'] = [yturn.get('text')]

turn['x_turn'] = xturn
turn['y_turn'] = yturn

eps.append(turn)
return eps

Expand Down
5 changes: 4 additions & 1 deletion parlai/scripts/display_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ def simple_display(opt, world, turn):
text = act.get('text', '[no text field]')
print(colorize(text.encode('utf-16', 'surrogatepass').decode('utf-16'), 'text'))
labels = act.get('labels', act.get('eval_labels', ['[no labels field]']))
labels = '|'.join(labels)
if len(labels) == 1 and labels[0] is None:
labels = str(labels)
else:
labels = '|'.join(labels)
print(' ' + colorize(labels, 'labels'))


Expand Down