morteza commited on
Commit
5386e8c
1 Parent(s): 448dc0f

Delete cogtext_old.py

Browse files
Files changed (1) hide show
  1. cogtext_old.py +0 -112
cogtext_old.py DELETED
@@ -1,112 +0,0 @@
1
-
2
- """CogText Dataset"""
3
-
4
- import datasets
5
- import pandas as pd
6
-
7
-
8
- _CITATION = """\
9
- @misc{cogtext2022,
10
- author = {Morteza Ansarinia and
11
- Paul Schrater and
12
- Pedro Cardoso-Leite},
13
- title = {Linking Theories and Methods in Cognitive Sciences via Joint Embedding of the Scientific Literature: The Example of Cognitive Control},
14
- year = {2022},
15
- url = {https://arxiv.org/abs/2203.11016}
16
- }
17
- """
18
-
19
- _DESCRIPTION = """\
20
- CogText dataset contains a collection of PubMed abstracts, along with their GPT-3 embeddings and topic embeddings.
21
- """
22
- _HOMEPAGE = "https://github.com/morteza/cogtext"
23
- _LICENSE = "CC-BY-4.0"
24
-
25
- _URLS = [
26
- "pubmed/abstracts2023.csv.gz"
27
- ]
28
-
29
-
30
- class CogText(datasets.GeneratorBasedBuilder):
31
- """S collection of PubMed abstracts, along with their GPT-3 embeddings and topic embeddings."""
32
-
33
- VERSION = datasets.Version("1.0.2023")
34
-
35
- # This is an example of a dataset with multiple configurations.
36
- # If you don't want/need to define several sub-sets in your dataset,
37
- # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
38
-
39
- # If you need to make complex sub-parts in the datasets with configurable options
40
- # You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
41
- # BUILDER_CONFIG_CLASS = MyBuilderConfig
42
-
43
- # You will be able to load one or the other configurations in the following list with
44
- # data = datasets.load_dataset('my_dataset', 'first_domain')
45
- # data = datasets.load_dataset('my_dataset', 'second_domain')
46
- # BUILDER_CONFIGS = [
47
- # datasets.BuilderConfig(name="first_domain", version=VERSION, description="This part of my dataset"),
48
- # datasets.BuilderConfig(name="second_domain", version=VERSION, description="This part of my dataset"),
49
- # ]
50
-
51
- DEFAULT_CONFIG_NAME = "abstracts" # It's not mandatory to have a default configuration.
52
-
53
- def _info(self):
54
- # This method specifies the datasets.DatasetInfo object which contains information and typings for the dataset
55
-
56
- features = datasets.Features(
57
- {
58
- "pmid": datasets.Value("int32"),
59
- "doi": datasets.Value("string"),
60
- "year": datasets.Value("int32"),
61
- "journal_title": datasets.Value("string"),
62
- "journal_iso_abbreviation": datasets.Value("string"),
63
- "title": datasets.Value("string"),
64
- "abstract": datasets.Value("string"),
65
- "category": datasets.Value("string"),
66
- "subcategory": datasets.Value("string"),
67
- }
68
- )
69
-
70
- return datasets.DatasetInfo(
71
- description=_DESCRIPTION,
72
- features=features,
73
- supervised_keys=("abstract", "subcategory"),
74
- homepage=_HOMEPAGE,
75
- license=_LICENSE,
76
- citation=_CITATION,
77
- )
78
-
79
- def _split_generators(self, dl_manager):
80
-
81
- [abstracts_path] = dl_manager.download(_URLS)
82
-
83
- return [
84
- datasets.SplitGenerator(
85
- name=datasets.Split("abstracts"),
86
- # These kwargs will be passed to _generate_examples
87
- gen_kwargs={
88
- "filepath": abstracts_path,
89
- "split": "abstracts",
90
- },
91
- )
92
- ]
93
-
94
- # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
95
- def _generate_examples(self, filepath, split):
96
- # This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
97
- # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
98
-
99
- example_df = pd.read_csv(filepath, compression="gzip")
100
-
101
- for key, row in example_df.iterrows():
102
- yield key, {
103
- "pmid": row['pmid'],
104
- "year": row['year'],
105
- "journal_title": row['journal_title'],
106
- "journal_iso_abbreviation": row['journal_iso_abbreviation'],
107
- 'category': row['category'],
108
- 'subcategory': row['subcategory'],
109
- 'doi': row['doi'],
110
- 'title': row['title'],
111
- 'abstract': row['abstract'],
112
- }