Datasets:
Size:
10K - 100K
License:
alter default config
Browse files
jsick.py
CHANGED
|
@@ -40,6 +40,11 @@ class JSICKDataset(ds.GeneratorBasedBuilder):
|
|
| 40 |
version=VERSION,
|
| 41 |
description="hoge",
|
| 42 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
ds.BuilderConfig(
|
| 44 |
name="stress",
|
| 45 |
version=VERSION,
|
|
@@ -50,6 +55,26 @@ class JSICKDataset(ds.GeneratorBasedBuilder):
|
|
| 50 |
def _info(self) -> ds.DatasetInfo:
|
| 51 |
labels = ds.ClassLabel(names=["entailment", "neutral", "contradiction"])
|
| 52 |
if self.config.name == "base":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
features = ds.Features(
|
| 54 |
{
|
| 55 |
"pair_ID": ds.Value("int32"),
|
|
@@ -99,6 +124,17 @@ class JSICKDataset(ds.GeneratorBasedBuilder):
|
|
| 99 |
df: pd.DataFrame = pd.read_table(data_path, sep="\t", header=0)
|
| 100 |
|
| 101 |
if self.config.name == "base":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
return [
|
| 103 |
ds.SplitGenerator(
|
| 104 |
name=ds.Split.TRAIN,
|
|
|
|
| 40 |
version=VERSION,
|
| 41 |
description="hoge",
|
| 42 |
),
|
| 43 |
+
ds.BuilderConfig(
|
| 44 |
+
name="original",
|
| 45 |
+
version=VERSION,
|
| 46 |
+
description="hoge",
|
| 47 |
+
),
|
| 48 |
ds.BuilderConfig(
|
| 49 |
name="stress",
|
| 50 |
version=VERSION,
|
|
|
|
| 55 |
def _info(self) -> ds.DatasetInfo:
|
| 56 |
labels = ds.ClassLabel(names=["entailment", "neutral", "contradiction"])
|
| 57 |
if self.config.name == "base":
|
| 58 |
+
features = ds.Features(
|
| 59 |
+
{
|
| 60 |
+
"id": ds.Value("int32"),
|
| 61 |
+
"premise": ds.Value("string"),
|
| 62 |
+
"hypothesis": ds.Value("string"),
|
| 63 |
+
"label": labels,
|
| 64 |
+
"score": ds.Value("float32"),
|
| 65 |
+
"sentence_A_En": ds.Value("string"),
|
| 66 |
+
"sentence_B_En": ds.Value("string"),
|
| 67 |
+
"entailment_label_En": labels,
|
| 68 |
+
"relatedness_score_En": ds.Value("float32"),
|
| 69 |
+
"corr_entailment_labelAB_En": ds.Value("string"),
|
| 70 |
+
"corr_entailment_labelBA_En": ds.Value("string"),
|
| 71 |
+
"image_ID": ds.Value("string"),
|
| 72 |
+
"original_caption": ds.Value("string"),
|
| 73 |
+
"semtag_short": ds.Value("string"),
|
| 74 |
+
"semtag_long": ds.Value("string"),
|
| 75 |
+
}
|
| 76 |
+
)
|
| 77 |
+
elif self.config.name == "original":
|
| 78 |
features = ds.Features(
|
| 79 |
{
|
| 80 |
"pair_ID": ds.Value("int32"),
|
|
|
|
| 124 |
df: pd.DataFrame = pd.read_table(data_path, sep="\t", header=0)
|
| 125 |
|
| 126 |
if self.config.name == "base":
|
| 127 |
+
df = df.rename(
|
| 128 |
+
columns={
|
| 129 |
+
"pair_ID": "id",
|
| 130 |
+
"sentence_A_Ja": "premise",
|
| 131 |
+
"sentence_B_Ja": "hypothesis",
|
| 132 |
+
"entailment_label_Ja": "label",
|
| 133 |
+
"relatedness_score_Ja": "score",
|
| 134 |
+
}
|
| 135 |
+
)
|
| 136 |
+
|
| 137 |
+
if self.config.name in ["base", "original"]:
|
| 138 |
return [
|
| 139 |
ds.SplitGenerator(
|
| 140 |
name=ds.Split.TRAIN,
|