Datasets:
Tasks:
Text Classification
Modalities:
Text
Sub-tasks:
entity-linking-classification
Languages:
English
Size:
< 1K
License:
Update SemEval2018Task7.py
Browse files- SemEval2018Task7.py +20 -28
SemEval2018Task7.py
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16 |
# See the License for the specific language governing permissions and
|
17 |
# limitations under the License.
|
18 |
-
"""Semeval2018Task7 is a dataset that describes
|
19 |
|
20 |
|
21 |
|
@@ -240,13 +240,10 @@ class Semeval2018Task7(datasets.GeneratorBasedBuilder):
|
|
240 |
second_half_splits = second_half.split(",")
|
241 |
size = len(second_half_splits)
|
242 |
|
243 |
-
X = second_half_splits[0]
|
244 |
-
Y = second_half_splits[1]
|
245 |
-
|
246 |
relation = {
|
247 |
"label": use_case,
|
248 |
-
"arg1":
|
249 |
-
"arg2":
|
250 |
"reverse": True if size == 3 else False
|
251 |
}
|
252 |
relations.append(relation)
|
@@ -255,31 +252,26 @@ class Semeval2018Task7(datasets.GeneratorBasedBuilder):
|
|
255 |
root = doc2.getroot()
|
256 |
|
257 |
for child in root:
|
258 |
-
if child.
|
259 |
-
text_id = child.attrib
|
260 |
-
else:
|
261 |
continue
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
child_abstract = child.find("abstract")
|
266 |
-
else:
|
267 |
continue
|
|
|
|
|
268 |
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
final_list= reading_entity_data(prev)
|
275 |
-
else:
|
276 |
-
continue
|
277 |
|
278 |
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
}
|
|
|
15 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16 |
# See the License for the specific language governing permissions and
|
17 |
# limitations under the License.
|
18 |
+
"""Semeval2018Task7 is a dataset that describes the first task on semantic relation extraction and classification in scientific paper abstracts"""
|
19 |
|
20 |
|
21 |
|
|
|
240 |
second_half_splits = second_half.split(",")
|
241 |
size = len(second_half_splits)
|
242 |
|
|
|
|
|
|
|
243 |
relation = {
|
244 |
"label": use_case,
|
245 |
+
"arg1": second_half_splits[0],
|
246 |
+
"arg2": second_half_splits[1],
|
247 |
"reverse": True if size == 3 else False
|
248 |
}
|
249 |
relations.append(relation)
|
|
|
252 |
root = doc2.getroot()
|
253 |
|
254 |
for child in root:
|
255 |
+
if child.find("title")==None:
|
|
|
|
|
256 |
continue
|
257 |
+
text_id = child.attrib
|
258 |
+
|
259 |
+
if child.find("abstract")==None:
|
|
|
|
|
260 |
continue
|
261 |
+
title = child.find("title").text
|
262 |
+
child_abstract = child.find("abstract")
|
263 |
|
264 |
+
prev=ET.tostring(child_abstract,"utf-8")
|
265 |
+
prev= prev.decode('utf8').replace("b\'","")
|
266 |
+
prev= prev.replace("<abstract>","")
|
267 |
+
prev= prev.replace("</abstract>","")
|
268 |
+
final_list= reading_entity_data(prev)
|
|
|
|
|
|
|
269 |
|
270 |
|
271 |
+
yield text_id['id'], {
|
272 |
+
"id": text_id['id'],
|
273 |
+
"title": title,
|
274 |
+
"abstract": final_list['abstract'],
|
275 |
+
"entities": final_list['entities'],
|
276 |
+
"relation": relations
|
277 |
}
|