Skip to content

Commit fe87200

Browse files
sharannarangcopybara-github
authored andcommitted
Incorporate additional explanations in dev/test sets.
PiperOrigin-RevId: 282425993
1 parent d49f3a2 commit fe87200

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pairID,gold_label,Sentence1,Sentence2,Explanation_1,WorkerId,Sentence1_marked_1,Sentence2_marked_1,Sentence1_Highlighted_1,Sentence2_Highlighted_1
2-
1d,entailment,A woman smiles at the child.,A woman is present.,A woman must be present to smile.,xyz,A woman *smiles* at the child.,A woman is *present*,{},"1,2,3"
1+
pairID,gold_label,Sentence1,Sentence2,Explanation_1,Sentence1_marked_1,Sentence2_marked_1,Sentence1_Highlighted_1,Sentence2_Highlighted_1,Explanation_2,Sentence1_marked_2,Sentence2_marked_2,Sentence1_Highlighted_2,Sentence2_Highlighted_2,Explanation_3,Sentence1_marked_3,Sentence2_marked_3,Sentence1_Highlighted_3,Sentence2_Highlighted_3
2+
1d,entailment,A woman smiles at the child.,A woman is present.,A woman must be present to smile.,A woman *smiles* at the child.,A woman is *present*,{},"1,2,3",A woman smiling implies that she is present.,A woman *smiles* at the child.,A woman is *present*,{},"1,2,3",A smiling woman is also present.,A woman *smiles* at the child.,A woman is *present*,{},"1,2,3"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pairID,gold_label,Sentence1,Sentence2,Explanation_1,WorkerId,Sentence1_marked_1,Sentence2_marked_1,Sentence1_Highlighted_1,Sentence2_Highlighted_1
2-
1t,neutral,A woman looks at the child.,A woman is smiling.,Smiling and looking at the child are independent.,xyz,A woman *smiles* at the child.,A woman is *present*,{},"1,2,3"
1+
pairID,gold_label,Sentence1,Sentence2,Explanation_1,Sentence1_marked_1,Sentence2_marked_1,Sentence1_Highlighted_1,Sentence2_Highlighted_1,Explanation_2,Sentence1_marked_2,Sentence2_marked_2,Sentence1_Highlighted_2,Sentence2_Highlighted_2,Explanation_3,Sentence1_marked_3,Sentence2_marked_3,Sentence1_Highlighted_3,Sentence2_Highlighted_3
2+
1t,neutral,A woman looks at the child.,A woman is smiling.,Smiling and looking at the child are independent.,A woman *smiles* at the child.,A woman is *present*,{},"1,2,3",Smiling and looking at the child are independent.,A woman *smiles* at the child.,A woman is *present*,{},"1,2,3",Smiling and looking at the child are independent.,A woman *smiles* at the child.,A woman is *present*,{},"1,2,3"

tensorflow_datasets/text/esnli.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,14 @@
4949
class Esnli(tfds.core.GeneratorBasedBuilder):
5050
"""e-SNLI: Natural Language Inference with Natural Language Explanations corpus."""
5151

52+
# Version History
53+
# 0.0.2 Added explanation_2, explanation_3 fields which exist in the dev/test
54+
# splits only.
55+
# 0.0.1 Initial version
5256
BUILDER_CONFIGS = [
5357
tfds.core.BuilderConfig(
5458
name='plain_text',
55-
version=tfds.core.Version('0.0.1'),
59+
version=tfds.core.Version('0.0.2'),
5660
description='Plain text import of e-SNLI',
5761
)
5862
]
@@ -69,7 +73,11 @@ def _info(self):
6973
'label':
7074
tfds.features.ClassLabel(
7175
names=['entailment', 'neutral', 'contradiction']),
72-
'explanation':
76+
'explanation_1':
77+
tfds.features.Text(),
78+
'explanation_2':
79+
tfds.features.Text(),
80+
'explanation_3':
7381
tfds.features.Text(),
7482
}),
7583
supervised_keys=None,
@@ -112,5 +120,7 @@ def _generate_examples(self, files):
112120
'premise': row['Sentence1'],
113121
'hypothesis': row['Sentence2'],
114122
'label': row['gold_label'],
115-
'explanation': row['Explanation_1']
123+
'explanation_1': row['Explanation_1'],
124+
'explanation_2': row.get('Explanation_2', ''),
125+
'explanation_3': row.get('Explanation_3', ''),
116126
}

0 commit comments

Comments
 (0)