Datasets:
Mahmoud Amiri commited on
Commit ·
c2209cf
1
Parent(s): 66921df
Add flattened dataset splits
Browse files- data/test.jsonl +3 -0
- data/train.jsonl +3 -0
- data/validation.jsonl +3 -0
- lit2vec_subfield_classifier.py +43 -0
data/test.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6839c64911e18dbbd9bb108ddbf440dd1de697b8f15e69d25e6f0ef107e31186
|
| 3 |
+
size 97176168
|
data/train.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9c8dadaa0c4ecbd39e9365886eacd51a98da41b52676a18b866fa9a4a8135942
|
| 3 |
+
size 777983654
|
data/validation.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6d8bcf7abb83624331fe325307803d7dd400f98bb6e055701e3bbdc615741f05
|
| 3 |
+
size 97210255
|
lit2vec_subfield_classifier.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from datasets import DatasetInfo, GeneratorBasedBuilder, SplitGenerator, Split, Features, Value, Sequence
|
| 2 |
+
import json
|
| 3 |
+
|
| 4 |
+
class lit2vec_subfield_classifier(GeneratorBasedBuilder):
|
| 5 |
+
def _info(self):
|
| 6 |
+
return DatasetInfo(
|
| 7 |
+
description="Flattened dataset of scientific documents including metadata, text, and embeddings.",
|
| 8 |
+
features=Features({
|
| 9 |
+
"corpus_id": Value("int64"),
|
| 10 |
+
"doi": Value("string"),
|
| 11 |
+
"url": Value("string"),
|
| 12 |
+
"title": Value("string"),
|
| 13 |
+
"authors": Sequence(Value("string")),
|
| 14 |
+
"author_ids": Sequence(Value("string")),
|
| 15 |
+
"venue": Value("string"),
|
| 16 |
+
"year": Value("int32"),
|
| 17 |
+
"fields_of_study": Sequence(Value("string")),
|
| 18 |
+
"publication_date": Value("string"),
|
| 19 |
+
"journal_name": Value("string"),
|
| 20 |
+
"license_publisher": Value("string"),
|
| 21 |
+
"license": Value("string"),
|
| 22 |
+
"oa_url": Value("string"),
|
| 23 |
+
"text": Value("string"),
|
| 24 |
+
"field_classification": Sequence(Value("string")),
|
| 25 |
+
"text_type": Value("string"),
|
| 26 |
+
"embedding": Sequence(Value("float32")),
|
| 27 |
+
"label": Sequence(Value("int32"))
|
| 28 |
+
}),
|
| 29 |
+
supervised_keys=None,
|
| 30 |
+
license="cc-by",
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
def _split_generators(self, dl_manager):
|
| 34 |
+
return [
|
| 35 |
+
SplitGenerator(name=Split.TRAIN, gen_kwargs={"filepath": "data/train.jsonl"}),
|
| 36 |
+
SplitGenerator(name=Split.VALIDATION, gen_kwargs={"filepath": "data/validation.jsonl"}),
|
| 37 |
+
SplitGenerator(name=Split.TEST, gen_kwargs={"filepath": "data/test.jsonl"}),
|
| 38 |
+
]
|
| 39 |
+
|
| 40 |
+
def _generate_examples(self, filepath):
|
| 41 |
+
with open(filepath, encoding="utf-8") as f:
|
| 42 |
+
for i, line in enumerate(f):
|
| 43 |
+
yield i, json.loads(line)
|