hpprc commited on
Commit
981aa06
1 Parent(s): 6c10c7f

update default config

Browse files
Files changed (1) hide show
  1. janli.py +49 -11
janli.py CHANGED
@@ -24,18 +24,47 @@ _DOWNLOAD_URL = "https://raw.githubusercontent.com/verypluming/JaNLI/main/janli.
24
  class JaNLIDataset(ds.GeneratorBasedBuilder):
25
  VERSION = ds.Version("1.0.0")
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  def _info(self) -> ds.DatasetInfo:
28
- features = ds.Features(
29
- {
30
- "id": ds.Value("int64"),
31
- "sentence_A_Ja": ds.Value("string"),
32
- "sentence_B_Ja": ds.Value("string"),
33
- "entailment_label_Ja": ds.ClassLabel(names=["entailment", "non-entailment"]),
34
- "heuristics": ds.Value("string"),
35
- "number_of_NPs": ds.Value("int32"),
36
- "semtag": ds.Value("string"),
37
- }
38
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  return ds.DatasetInfo(
40
  description=_DESCRIPTION,
41
  citation=_CITATION,
@@ -49,6 +78,15 @@ class JaNLIDataset(ds.GeneratorBasedBuilder):
49
  df: pd.DataFrame = pd.read_table(data_path, header=0, sep="\t", index_col=0)
50
  df["id"] = df.index
51
 
 
 
 
 
 
 
 
 
 
52
  return [
53
  ds.SplitGenerator(
54
  name=ds.Split.TRAIN,
 
24
  class JaNLIDataset(ds.GeneratorBasedBuilder):
25
  VERSION = ds.Version("1.0.0")
26
 
27
+ DEFAULT_CONFIG_NAME = "base"
28
+
29
+ BUILDER_CONFIGS = [
30
+ ds.BuilderConfig(
31
+ name="base",
32
+ version=VERSION,
33
+ description="hoge",
34
+ ),
35
+ ds.BuilderConfig(
36
+ name="original",
37
+ version=VERSION,
38
+ description="hoge",
39
+ ),
40
+ ]
41
+
42
  def _info(self) -> ds.DatasetInfo:
43
+ if self.config.name == "base":
44
+ features = ds.Features(
45
+ {
46
+ "id": ds.Value("int64"),
47
+ "premise": ds.Value("string"),
48
+ "hypothesis": ds.Value("string"),
49
+ "label": ds.ClassLabel(names=["entailment", "non-entailment"]),
50
+ "heuristics": ds.Value("string"),
51
+ "number_of_NPs": ds.Value("int32"),
52
+ "semtag": ds.Value("string"),
53
+ }
54
+ )
55
+ elif self.config.name == "original":
56
+ features = ds.Features(
57
+ {
58
+ "id": ds.Value("int64"),
59
+ "sentence_A_Ja": ds.Value("string"),
60
+ "sentence_B_Ja": ds.Value("string"),
61
+ "entailment_label_Ja": ds.ClassLabel(names=["entailment", "non-entailment"]),
62
+ "heuristics": ds.Value("string"),
63
+ "number_of_NPs": ds.Value("int32"),
64
+ "semtag": ds.Value("string"),
65
+ }
66
+ )
67
+
68
  return ds.DatasetInfo(
69
  description=_DESCRIPTION,
70
  citation=_CITATION,
 
78
  df: pd.DataFrame = pd.read_table(data_path, header=0, sep="\t", index_col=0)
79
  df["id"] = df.index
80
 
81
+ if self.config.name == "base":
82
+ df = df.rename(
83
+ columns={
84
+ "sentence_A_Ja": "premise",
85
+ "sentence_B_Ja": "hypothesis",
86
+ "entailment_label_Ja": "label",
87
+ }
88
+ )
89
+
90
  return [
91
  ds.SplitGenerator(
92
  name=ds.Split.TRAIN,