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
Changes from 2 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
12 changes: 12 additions & 0 deletions parlai/core/teachers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1732,6 +1732,18 @@ def _get_ep_from_turns(self, xturns, yturns):
turn = {}
turn['text'] = xturn.get('text').strip()
turn['labels'] = [yturn.get('text').strip()]

# Add other fields in the original message.
other_fields = {
f: v
for f, v in xturn.items()
if f not in ['labels', 'text', 'eval_labels']
}
turn.update(other_fields)
for f in ['labels', 'eval_labels']:
if f in xturn:
turn['original_' + f] = xturn[f]

eps.append(turn)
return eps

Expand Down