shunk031 commited on
Commit
dd6e699
1 Parent(s): 2486626

use `ds.ClassLabel` instead of `ds.Value("string")` (#7)

Browse files

* use `ds.ClassLabel` instead of `ds.Value("string")`

* change order of the elements

Files changed (1) hide show
  1. jsnli.py +4 -2
jsnli.py CHANGED
@@ -47,9 +47,11 @@ class JSNLIDataset(ds.GeneratorBasedBuilder):
47
  def _info(self) -> ds.DatasetInfo:
48
  features = ds.Features(
49
  {
50
- "label": ds.Value("string"),
51
  "premise": ds.Value("string"),
52
  "hypothesis": ds.Value("string"),
 
 
 
53
  }
54
  )
55
  return ds.DatasetInfo(
@@ -104,8 +106,8 @@ class JSNLIDataset(ds.GeneratorBasedBuilder):
104
  label, premise, hypothesis = line.replace("\n", "").split("\t")
105
 
106
  example_dict = {
107
- "label": label,
108
  "premise": premise,
109
  "hypothesis": hypothesis,
 
110
  }
111
  yield sentence_id, example_dict
 
47
  def _info(self) -> ds.DatasetInfo:
48
  features = ds.Features(
49
  {
 
50
  "premise": ds.Value("string"),
51
  "hypothesis": ds.Value("string"),
52
+ "label": ds.ClassLabel(
53
+ names=["entailment", "neutral", "contradiction"]
54
+ ),
55
  }
56
  )
57
  return ds.DatasetInfo(
 
106
  label, premise, hypothesis = line.replace("\n", "").split("\t")
107
 
108
  example_dict = {
 
109
  "premise": premise,
110
  "hypothesis": hypothesis,
111
+ "label": label,
112
  }
113
  yield sentence_id, example_dict