Pierre Lepagnol
commited on
Commit
•
dcf22df
1
Parent(s):
4fa2464
Add and check other datasets
Browse files
README.md
CHANGED
@@ -71,60 +71,72 @@ dataset_info:
|
|
71 |
dtype: string
|
72 |
- name: label
|
73 |
dtype: int8
|
|
|
|
|
|
|
|
|
74 |
- name: weak_labels
|
75 |
sequence: int8
|
76 |
splits:
|
77 |
- name: train
|
78 |
-
num_bytes:
|
79 |
num_examples: 8430
|
80 |
- name: validation
|
81 |
-
num_bytes:
|
82 |
num_examples: 920
|
83 |
- name: test
|
84 |
-
num_bytes:
|
85 |
num_examples: 4673
|
86 |
download_size: 11036213
|
87 |
-
dataset_size:
|
88 |
- config_name: chemprot
|
89 |
features:
|
90 |
- name: text
|
91 |
dtype: string
|
92 |
- name: label
|
93 |
dtype: int8
|
|
|
|
|
|
|
|
|
94 |
- name: weak_labels
|
95 |
sequence: int8
|
96 |
splits:
|
97 |
- name: train
|
98 |
-
num_bytes:
|
99 |
num_examples: 12861
|
100 |
- name: validation
|
101 |
-
num_bytes:
|
102 |
num_examples: 1607
|
103 |
- name: test
|
104 |
-
num_bytes:
|
105 |
num_examples: 1607
|
106 |
download_size: 15743249
|
107 |
-
dataset_size:
|
108 |
- config_name: semeval
|
109 |
features:
|
110 |
- name: text
|
111 |
dtype: string
|
112 |
- name: label
|
113 |
dtype: int8
|
|
|
|
|
|
|
|
|
114 |
- name: weak_labels
|
115 |
sequence: int8
|
116 |
splits:
|
117 |
- name: train
|
118 |
-
num_bytes:
|
119 |
num_examples: 1749
|
120 |
- name: validation
|
121 |
-
num_bytes:
|
122 |
num_examples: 178
|
123 |
- name: test
|
124 |
-
num_bytes:
|
125 |
num_examples: 600
|
126 |
download_size: 2295058
|
127 |
-
dataset_size:
|
128 |
- config_name: sms
|
129 |
features:
|
130 |
- name: text
|
@@ -179,16 +191,16 @@ dataset_info:
|
|
179 |
sequence: int8
|
180 |
splits:
|
181 |
- name: train
|
182 |
-
num_bytes:
|
183 |
num_examples: 4965
|
184 |
- name: validation
|
185 |
-
num_bytes:
|
186 |
num_examples: 500
|
187 |
- name: test
|
188 |
-
num_bytes:
|
189 |
num_examples: 500
|
190 |
download_size: 2277067
|
191 |
-
dataset_size:
|
192 |
- config_name: youtube
|
193 |
features:
|
194 |
- name: text
|
|
|
71 |
dtype: string
|
72 |
- name: label
|
73 |
dtype: int8
|
74 |
+
- name: entity1
|
75 |
+
dtype: string
|
76 |
+
- name: entity2
|
77 |
+
dtype: string
|
78 |
- name: weak_labels
|
79 |
sequence: int8
|
80 |
splits:
|
81 |
- name: train
|
82 |
+
num_bytes: 2318545
|
83 |
num_examples: 8430
|
84 |
- name: validation
|
85 |
+
num_bytes: 246252
|
86 |
num_examples: 920
|
87 |
- name: test
|
88 |
+
num_bytes: 1229627
|
89 |
num_examples: 4673
|
90 |
download_size: 11036213
|
91 |
+
dataset_size: 3794424
|
92 |
- config_name: chemprot
|
93 |
features:
|
94 |
- name: text
|
95 |
dtype: string
|
96 |
- name: label
|
97 |
dtype: int8
|
98 |
+
- name: entity1
|
99 |
+
dtype: string
|
100 |
+
- name: entity2
|
101 |
+
dtype: string
|
102 |
- name: weak_labels
|
103 |
sequence: int8
|
104 |
splits:
|
105 |
- name: train
|
106 |
+
num_bytes: 3474637
|
107 |
num_examples: 12861
|
108 |
- name: validation
|
109 |
+
num_bytes: 435850
|
110 |
num_examples: 1607
|
111 |
- name: test
|
112 |
+
num_bytes: 434031
|
113 |
num_examples: 1607
|
114 |
download_size: 15743249
|
115 |
+
dataset_size: 4344518
|
116 |
- config_name: semeval
|
117 |
features:
|
118 |
- name: text
|
119 |
dtype: string
|
120 |
- name: label
|
121 |
dtype: int8
|
122 |
+
- name: entity1
|
123 |
+
dtype: string
|
124 |
+
- name: entity2
|
125 |
+
dtype: string
|
126 |
- name: weak_labels
|
127 |
sequence: int8
|
128 |
splits:
|
129 |
- name: train
|
130 |
+
num_bytes: 532785
|
131 |
num_examples: 1749
|
132 |
- name: validation
|
133 |
+
num_bytes: 54373
|
134 |
num_examples: 178
|
135 |
- name: test
|
136 |
+
num_bytes: 184826
|
137 |
num_examples: 600
|
138 |
download_size: 2295058
|
139 |
+
dataset_size: 771984
|
140 |
- config_name: sms
|
141 |
features:
|
142 |
- name: text
|
|
|
191 |
sequence: int8
|
192 |
splits:
|
193 |
- name: train
|
194 |
+
num_bytes: 610244
|
195 |
num_examples: 4965
|
196 |
- name: validation
|
197 |
+
num_bytes: 61048
|
198 |
num_examples: 500
|
199 |
- name: test
|
200 |
+
num_bytes: 56479
|
201 |
num_examples: 500
|
202 |
download_size: 2277067
|
203 |
+
dataset_size: 727771
|
204 |
- config_name: youtube
|
205 |
features:
|
206 |
- name: text
|
WRENCH.py
CHANGED
@@ -24,6 +24,8 @@ class WrenchSequenceTaggingConfig(datasets.BuilderConfig):
|
|
24 |
class Wrench(datasets.GeneratorBasedBuilder):
|
25 |
"""WRENCH classification dataset."""
|
26 |
|
|
|
|
|
27 |
SEQUENCETAGGING_DATASET = [
|
28 |
{"name": "conll", "dataset_path": "./conll"},
|
29 |
{"name": "laptopreview", "dataset_path": "./laptopreview"},
|
@@ -47,10 +49,7 @@ class Wrench(datasets.GeneratorBasedBuilder):
|
|
47 |
{"name": "yelp", "dataset_path": "./yelp"},
|
48 |
{"name": "youtube", "dataset_path": "./youtube"},
|
49 |
]
|
50 |
-
|
51 |
-
# WrenchSequenceTaggingConfig(name=i["name"], dataset_path=i["dataset_path"])
|
52 |
-
# for i in SEQUENCETAGGING_DATASET
|
53 |
-
# ]
|
54 |
configs_clf = [
|
55 |
WrenchClassifConfig(name=i["name"], dataset_path=i["dataset_path"]) for i in CLASSIF_DATASETS
|
56 |
]
|
@@ -58,7 +57,7 @@ class Wrench(datasets.GeneratorBasedBuilder):
|
|
58 |
|
59 |
def _info(self):
|
60 |
name = self.config.name
|
61 |
-
if name
|
62 |
return datasets.DatasetInfo(
|
63 |
features=datasets.Features(
|
64 |
{
|
@@ -105,7 +104,7 @@ class Wrench(datasets.GeneratorBasedBuilder):
|
|
105 |
with open(filepath, encoding="utf-8") as f:
|
106 |
json_data = json.load(f)
|
107 |
|
108 |
-
if name
|
109 |
for idx in json_data:
|
110 |
data = json_data[idx]
|
111 |
|
@@ -123,16 +122,29 @@ class Wrench(datasets.GeneratorBasedBuilder):
|
|
123 |
"weak_labels": weak_labels,
|
124 |
}
|
125 |
else:
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
class Wrench(datasets.GeneratorBasedBuilder):
|
25 |
"""WRENCH classification dataset."""
|
26 |
|
27 |
+
ENTITY_RELATED_DATASETS = ["spouse", "cdr", "semeval", "chemprot"]
|
28 |
+
|
29 |
SEQUENCETAGGING_DATASET = [
|
30 |
{"name": "conll", "dataset_path": "./conll"},
|
31 |
{"name": "laptopreview", "dataset_path": "./laptopreview"},
|
|
|
49 |
{"name": "yelp", "dataset_path": "./yelp"},
|
50 |
{"name": "youtube", "dataset_path": "./youtube"},
|
51 |
]
|
52 |
+
|
|
|
|
|
|
|
53 |
configs_clf = [
|
54 |
WrenchClassifConfig(name=i["name"], dataset_path=i["dataset_path"]) for i in CLASSIF_DATASETS
|
55 |
]
|
|
|
57 |
|
58 |
def _info(self):
|
59 |
name = self.config.name
|
60 |
+
if name in self.ENTITY_RELATED_DATASETS:
|
61 |
return datasets.DatasetInfo(
|
62 |
features=datasets.Features(
|
63 |
{
|
|
|
104 |
with open(filepath, encoding="utf-8") as f:
|
105 |
json_data = json.load(f)
|
106 |
|
107 |
+
if name in self.ENTITY_RELATED_DATASETS:
|
108 |
for idx in json_data:
|
109 |
data = json_data[idx]
|
110 |
|
|
|
122 |
"weak_labels": weak_labels,
|
123 |
}
|
124 |
else:
|
125 |
+
if name == "trec":
|
126 |
+
for idx in json_data:
|
127 |
+
data = json_data[idx]
|
128 |
+
text = " ".join(data["data"]["text"].split(" ")[1:])
|
129 |
+
weak_labels = data["weak_labels"]
|
130 |
+
label = data["label"]
|
131 |
+
|
132 |
+
yield int(idx), {
|
133 |
+
"text": text,
|
134 |
+
"label": label,
|
135 |
+
"weak_labels": weak_labels,
|
136 |
+
}
|
137 |
+
else:
|
138 |
+
for idx in json_data:
|
139 |
+
# print(json_data[idx])
|
140 |
+
data = json_data[idx]
|
141 |
+
|
142 |
+
text = data["data"]["text"]
|
143 |
+
weak_labels = data["weak_labels"]
|
144 |
+
label = data["label"]
|
145 |
+
|
146 |
+
yield int(idx), {
|
147 |
+
"text": text,
|
148 |
+
"label": label,
|
149 |
+
"weak_labels": weak_labels,
|
150 |
+
}
|