Commit
•
a8c412e
1
Parent(s):
ee4d48c
Upload id_stance.py with huggingface_hub
Browse files- id_stance.py +11 -11
id_stance.py
CHANGED
@@ -5,9 +5,9 @@ from typing import List
|
|
5 |
import datasets
|
6 |
import pandas as pd
|
7 |
|
8 |
-
from
|
9 |
-
from
|
10 |
-
from
|
11 |
|
12 |
_CITATION = """\
|
13 |
@INPROCEEDINGS{8629144,
|
@@ -40,7 +40,7 @@ _URLs = {
|
|
40 |
}
|
41 |
_SUPPORTED_TASKS = [Tasks.TEXTUAL_ENTAILMENT]
|
42 |
_SOURCE_VERSION = "1.0.0"
|
43 |
-
|
44 |
|
45 |
|
46 |
def parse_list(content):
|
@@ -56,18 +56,18 @@ class IdStance(datasets.GeneratorBasedBuilder):
|
|
56 |
"""The ID Stance dataset is annotated with a label whether the article is in favor of the person in the context of the event"""
|
57 |
|
58 |
BUILDER_CONFIGS = [
|
59 |
-
|
60 |
name="id_stance_source",
|
61 |
version=datasets.Version(_SOURCE_VERSION),
|
62 |
description="IdStance source schema",
|
63 |
schema="source",
|
64 |
subset_id="id_stance",
|
65 |
),
|
66 |
-
|
67 |
-
name="
|
68 |
-
version=datasets.Version(
|
69 |
description="IdStance Nusantara schema",
|
70 |
-
schema="
|
71 |
subset_id="id_stance",
|
72 |
),
|
73 |
]
|
@@ -85,7 +85,7 @@ class IdStance(datasets.GeneratorBasedBuilder):
|
|
85 |
"stance_final": datasets.Value("string"),
|
86 |
}
|
87 |
)
|
88 |
-
elif self.config.schema == "
|
89 |
features = schemas.pairs_features(["for", "against", "no"])
|
90 |
|
91 |
return datasets.DatasetInfo(
|
@@ -124,7 +124,7 @@ class IdStance(datasets.GeneratorBasedBuilder):
|
|
124 |
"stance_final": row.stance_final
|
125 |
}
|
126 |
yield row.id, ex
|
127 |
-
elif self.config.schema == "
|
128 |
for row in df.itertuples():
|
129 |
ex = {
|
130 |
"id": row.id,
|
|
|
5 |
import datasets
|
6 |
import pandas as pd
|
7 |
|
8 |
+
from seacrowd.utils import schemas
|
9 |
+
from seacrowd.utils.configs import SEACrowdConfig
|
10 |
+
from seacrowd.utils.constants import Tasks
|
11 |
|
12 |
_CITATION = """\
|
13 |
@INPROCEEDINGS{8629144,
|
|
|
40 |
}
|
41 |
_SUPPORTED_TASKS = [Tasks.TEXTUAL_ENTAILMENT]
|
42 |
_SOURCE_VERSION = "1.0.0"
|
43 |
+
_SEACROWD_VERSION = "2024.06.20"
|
44 |
|
45 |
|
46 |
def parse_list(content):
|
|
|
56 |
"""The ID Stance dataset is annotated with a label whether the article is in favor of the person in the context of the event"""
|
57 |
|
58 |
BUILDER_CONFIGS = [
|
59 |
+
SEACrowdConfig(
|
60 |
name="id_stance_source",
|
61 |
version=datasets.Version(_SOURCE_VERSION),
|
62 |
description="IdStance source schema",
|
63 |
schema="source",
|
64 |
subset_id="id_stance",
|
65 |
),
|
66 |
+
SEACrowdConfig(
|
67 |
+
name="id_stance_seacrowd_pairs",
|
68 |
+
version=datasets.Version(_SEACROWD_VERSION),
|
69 |
description="IdStance Nusantara schema",
|
70 |
+
schema="seacrowd_pairs",
|
71 |
subset_id="id_stance",
|
72 |
),
|
73 |
]
|
|
|
85 |
"stance_final": datasets.Value("string"),
|
86 |
}
|
87 |
)
|
88 |
+
elif self.config.schema == "seacrowd_pairs":
|
89 |
features = schemas.pairs_features(["for", "against", "no"])
|
90 |
|
91 |
return datasets.DatasetInfo(
|
|
|
124 |
"stance_final": row.stance_final
|
125 |
}
|
126 |
yield row.id, ex
|
127 |
+
elif self.config.schema == "seacrowd_pairs":
|
128 |
for row in df.itertuples():
|
129 |
ex = {
|
130 |
"id": row.id,
|