Datasets:
Convert dataset to Parquet
#4
by
davzoku
- opened
- README.md +16 -7
- data/test-00000-of-00001.parquet +3 -0
- data/train-00000-of-00001.parquet +3 -0
- data/validation-00000-of-00001.parquet +3 -0
- dataset_infos.json +0 -1
- scicite.py +0 -154
README.md
CHANGED
|
@@ -72,17 +72,26 @@ dataset_info:
|
|
| 72 |
- name: id
|
| 73 |
dtype: string
|
| 74 |
splits:
|
| 75 |
-
- name: test
|
| 76 |
-
num_bytes: 870809
|
| 77 |
-
num_examples: 1859
|
| 78 |
- name: train
|
| 79 |
-
num_bytes:
|
| 80 |
num_examples: 8194
|
| 81 |
- name: validation
|
| 82 |
-
num_bytes:
|
| 83 |
num_examples: 916
|
| 84 |
-
|
| 85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
---
|
| 87 |
|
| 88 |
# Dataset Card for "scicite"
|
|
|
|
| 72 |
- name: id
|
| 73 |
dtype: string
|
| 74 |
splits:
|
|
|
|
|
|
|
|
|
|
| 75 |
- name: train
|
| 76 |
+
num_bytes: 3828509
|
| 77 |
num_examples: 8194
|
| 78 |
- name: validation
|
| 79 |
+
num_bytes: 428551
|
| 80 |
num_examples: 916
|
| 81 |
+
- name: test
|
| 82 |
+
num_bytes: 867294
|
| 83 |
+
num_examples: 1859
|
| 84 |
+
download_size: 3561554
|
| 85 |
+
dataset_size: 5124354
|
| 86 |
+
configs:
|
| 87 |
+
- config_name: default
|
| 88 |
+
data_files:
|
| 89 |
+
- split: train
|
| 90 |
+
path: data/train-*
|
| 91 |
+
- split: validation
|
| 92 |
+
path: data/validation-*
|
| 93 |
+
- split: test
|
| 94 |
+
path: data/test-*
|
| 95 |
---
|
| 96 |
|
| 97 |
# Dataset Card for "scicite"
|
data/test-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c43b73ca4544d5aabd57145ca734108e88d817c47746bc9e096090896bd60a58
|
| 3 |
+
size 625439
|
data/train-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:515531960693e29ae248e21f2568cc6a542ed9d1d42c98e0572859d65b59144b
|
| 3 |
+
size 2637978
|
data/validation-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fac10c6583d69c3a7646950754c4b8b582ca2b45378722699675e10dab225d78
|
| 3 |
+
size 298137
|
dataset_infos.json
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
{"default": {"description": "\nThis is a dataset for classifying citation intents in academic papers.\nThe main citation intent label for each Json object is specified with the label\nkey while the citation context is specified in with a context key. Example:\n{\n 'string': 'In chacma baboons, male-infant relationships can be linked to both\n formation of friendships and paternity success [30,31].'\n 'sectionName': 'Introduction',\n 'label': 'background',\n 'citingPaperId': '7a6b2d4b405439',\n 'citedPaperId': '9d1abadc55b5e0',\n ...\n }\nYou may obtain the full information about the paper using the provided paper ids\nwith the Semantic Scholar API (https://api.semanticscholar.org/).\nThe labels are:\nMethod, Background, Result\n", "citation": "\n@InProceedings{Cohan2019Structural,\n author={Arman Cohan and Waleed Ammar and Madeleine Van Zuylen and Field Cady},\n title={Structural Scaffolds for Citation Intent Classification in Scientific Publications},\n booktitle=\"NAACL\",\n year=\"2019\"\n}\n", "homepage": "https://github.com/allenai/scicite", "license": "", "features": {"string": {"dtype": "string", "id": null, "_type": "Value"}, "sectionName": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 3, "names": ["method", "background", "result"], "names_file": null, "id": null, "_type": "ClassLabel"}, "citingPaperId": {"dtype": "string", "id": null, "_type": "Value"}, "citedPaperId": {"dtype": "string", "id": null, "_type": "Value"}, "excerpt_index": {"dtype": "int32", "id": null, "_type": "Value"}, "isKeyCitation": {"dtype": "bool", "id": null, "_type": "Value"}, "label2": {"num_classes": 4, "names": ["supportive", "not_supportive", "cant_determine", "none"], "names_file": null, "id": null, "_type": "ClassLabel"}, "citeEnd": {"dtype": "int64", "id": null, "_type": "Value"}, "citeStart": {"dtype": "int64", "id": null, "_type": "Value"}, "source": {"num_classes": 7, "names": ["properNoun", "andPhrase", "acronym", "etAlPhrase", "explicit", "acronymParen", "nan"], "names_file": null, "id": null, "_type": "ClassLabel"}, "label_confidence": {"dtype": "float32", "id": null, "_type": "Value"}, "label2_confidence": {"dtype": "float32", "id": null, "_type": "Value"}, "id": {"dtype": "string", "id": null, "_type": "Value"}}, "supervised_keys": null, "builder_name": "scicite", "config_name": "default", "version": {"version_str": "1.0.0", "description": null, "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 870809, "num_examples": 1859, "dataset_name": "scicite"}, "train": {"name": "train", "num_bytes": 3843904, "num_examples": 8194, "dataset_name": "scicite"}, "validation": {"name": "validation", "num_bytes": 430296, "num_examples": 916, "dataset_name": "scicite"}}, "download_checksums": {"https://s3-us-west-2.amazonaws.com/ai2-s2-research/scicite/scicite.tar.gz": {"num_bytes": 23189911, "checksum": "711ece2c4e61d116c8ae5bb07e9fbb2ee9ff7bba004b4cab7fbd0ac3af499193"}}, "download_size": 23189911, "dataset_size": 5145009, "size_in_bytes": 28334920}}
|
|
|
|
|
|
scicite.py
DELETED
|
@@ -1,154 +0,0 @@
|
|
| 1 |
-
# coding=utf-8
|
| 2 |
-
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
|
| 3 |
-
#
|
| 4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
-
# you may not use this file except in compliance with the License.
|
| 6 |
-
# You may obtain a copy of the License at
|
| 7 |
-
#
|
| 8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
-
#
|
| 10 |
-
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
-
# See the License for the specific language governing permissions and
|
| 14 |
-
# limitations under the License.
|
| 15 |
-
|
| 16 |
-
# Lint as: python3
|
| 17 |
-
"""TODO(scicite): Add a description here."""
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
import json
|
| 21 |
-
|
| 22 |
-
import datasets
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
_CITATION = """
|
| 26 |
-
@InProceedings{Cohan2019Structural,
|
| 27 |
-
author={Arman Cohan and Waleed Ammar and Madeleine Van Zuylen and Field Cady},
|
| 28 |
-
title={Structural Scaffolds for Citation Intent Classification in Scientific Publications},
|
| 29 |
-
booktitle={NAACL},
|
| 30 |
-
year={2019}
|
| 31 |
-
}
|
| 32 |
-
"""
|
| 33 |
-
|
| 34 |
-
_DESCRIPTION = """
|
| 35 |
-
This is a dataset for classifying citation intents in academic papers.
|
| 36 |
-
The main citation intent label for each Json object is specified with the label
|
| 37 |
-
key while the citation context is specified in with a context key. Example:
|
| 38 |
-
{
|
| 39 |
-
'string': 'In chacma baboons, male-infant relationships can be linked to both
|
| 40 |
-
formation of friendships and paternity success [30,31].'
|
| 41 |
-
'sectionName': 'Introduction',
|
| 42 |
-
'label': 'background',
|
| 43 |
-
'citingPaperId': '7a6b2d4b405439',
|
| 44 |
-
'citedPaperId': '9d1abadc55b5e0',
|
| 45 |
-
...
|
| 46 |
-
}
|
| 47 |
-
You may obtain the full information about the paper using the provided paper ids
|
| 48 |
-
with the Semantic Scholar API (https://api.semanticscholar.org/).
|
| 49 |
-
The labels are:
|
| 50 |
-
Method, Background, Result
|
| 51 |
-
"""
|
| 52 |
-
|
| 53 |
-
_SOURCE_NAMES = ["properNoun", "andPhrase", "acronym", "etAlPhrase", "explicit", "acronymParen", "nan"]
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
class Scicite(datasets.GeneratorBasedBuilder):
|
| 57 |
-
"""This is a dataset for classifying citation intents in academic papers."""
|
| 58 |
-
|
| 59 |
-
VERSION = datasets.Version("1.0.0")
|
| 60 |
-
|
| 61 |
-
def _info(self):
|
| 62 |
-
return datasets.DatasetInfo(
|
| 63 |
-
# This is the description that will appear on the datasets page.
|
| 64 |
-
description=_DESCRIPTION,
|
| 65 |
-
# datasets.features.FeatureConnectors
|
| 66 |
-
features=datasets.Features(
|
| 67 |
-
{
|
| 68 |
-
"string": datasets.Value("string"),
|
| 69 |
-
"sectionName": datasets.Value("string"),
|
| 70 |
-
"label": datasets.features.ClassLabel(names=["method", "background", "result"]),
|
| 71 |
-
"citingPaperId": datasets.Value("string"),
|
| 72 |
-
"citedPaperId": datasets.Value("string"),
|
| 73 |
-
"excerpt_index": datasets.Value("int32"),
|
| 74 |
-
"isKeyCitation": datasets.Value("bool"),
|
| 75 |
-
"label2": datasets.features.ClassLabel(
|
| 76 |
-
names=["supportive", "not_supportive", "cant_determine", "none"]
|
| 77 |
-
),
|
| 78 |
-
"citeEnd": datasets.Value("int64"),
|
| 79 |
-
"citeStart": datasets.Value("int64"),
|
| 80 |
-
"source": datasets.features.ClassLabel(names=_SOURCE_NAMES),
|
| 81 |
-
"label_confidence": datasets.Value("float32"),
|
| 82 |
-
"label2_confidence": datasets.Value("float32"),
|
| 83 |
-
"id": datasets.Value("string"),
|
| 84 |
-
}
|
| 85 |
-
),
|
| 86 |
-
# If there's a common (input, target) tuple from the features,
|
| 87 |
-
# specify them here. They'll be used if as_supervised=True in
|
| 88 |
-
# builder.as_dataset.
|
| 89 |
-
supervised_keys=None,
|
| 90 |
-
# Homepage of the dataset for documentation
|
| 91 |
-
homepage="https://github.com/allenai/scicite",
|
| 92 |
-
citation=_CITATION,
|
| 93 |
-
)
|
| 94 |
-
|
| 95 |
-
def _split_generators(self, dl_manager):
|
| 96 |
-
"""Returns SplitGenerators."""
|
| 97 |
-
archive = dl_manager.download("https://s3-us-west-2.amazonaws.com/ai2-s2-research/scicite/scicite.tar.gz")
|
| 98 |
-
return [
|
| 99 |
-
datasets.SplitGenerator(
|
| 100 |
-
name=datasets.Split.TRAIN,
|
| 101 |
-
gen_kwargs={
|
| 102 |
-
"filepath": "/".join(["scicite", "train.jsonl"]),
|
| 103 |
-
"files": dl_manager.iter_archive(archive),
|
| 104 |
-
},
|
| 105 |
-
),
|
| 106 |
-
datasets.SplitGenerator(
|
| 107 |
-
name=datasets.Split.VALIDATION,
|
| 108 |
-
gen_kwargs={"filepath": "/".join(["scicite", "dev.jsonl"]), "files": dl_manager.iter_archive(archive)},
|
| 109 |
-
),
|
| 110 |
-
datasets.SplitGenerator(
|
| 111 |
-
name=datasets.Split.TEST,
|
| 112 |
-
gen_kwargs={
|
| 113 |
-
"filepath": "/".join(["scicite", "test.jsonl"]),
|
| 114 |
-
"files": dl_manager.iter_archive(archive),
|
| 115 |
-
},
|
| 116 |
-
),
|
| 117 |
-
]
|
| 118 |
-
|
| 119 |
-
def _generate_examples(self, filepath, files):
|
| 120 |
-
"""Yields examples."""
|
| 121 |
-
for path, f in files:
|
| 122 |
-
if path == filepath:
|
| 123 |
-
unique_ids = {}
|
| 124 |
-
for line in f:
|
| 125 |
-
d = json.loads(line.decode("utf-8"))
|
| 126 |
-
unique_id = str(d["unique_id"])
|
| 127 |
-
if unique_id in unique_ids:
|
| 128 |
-
continue
|
| 129 |
-
unique_ids[unique_id] = True
|
| 130 |
-
yield unique_id, {
|
| 131 |
-
"string": d["string"],
|
| 132 |
-
"label": str(d["label"]),
|
| 133 |
-
"sectionName": str(d["sectionName"]),
|
| 134 |
-
"citingPaperId": str(d["citingPaperId"]),
|
| 135 |
-
"citedPaperId": str(d["citedPaperId"]),
|
| 136 |
-
"excerpt_index": int(d["excerpt_index"]),
|
| 137 |
-
"isKeyCitation": bool(d["isKeyCitation"]),
|
| 138 |
-
"label2": str(d.get("label2", "none")),
|
| 139 |
-
"citeEnd": _safe_int(d["citeEnd"]),
|
| 140 |
-
"citeStart": _safe_int(d["citeStart"]),
|
| 141 |
-
"source": str(d["source"]),
|
| 142 |
-
"label_confidence": float(d.get("label_confidence", 0.0)),
|
| 143 |
-
"label2_confidence": float(d.get("label2_confidence", 0.0)),
|
| 144 |
-
"id": str(d["id"]),
|
| 145 |
-
}
|
| 146 |
-
break
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
def _safe_int(a):
|
| 150 |
-
try:
|
| 151 |
-
# skip NaNs
|
| 152 |
-
return int(a)
|
| 153 |
-
except ValueError:
|
| 154 |
-
return -1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|