Datasets:
Update cogtext.py
Browse files- cogtext.py +10 -4
cogtext.py
CHANGED
|
@@ -29,6 +29,10 @@ CogText dataset contains a collection of PubMed abstracts, along with their GPT-
|
|
| 29 |
_HOMEPAGE = "https://github.com/morteza/cogtext"
|
| 30 |
_LICENSE = "CC-BY-4.0"
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
class CogText(datasets.GeneratorBasedBuilder):
|
| 34 |
"""S collection of PubMed abstracts, along with their GPT-3 embeddings and topic embeddings."""
|
|
@@ -83,20 +87,22 @@ class CogText(datasets.GeneratorBasedBuilder):
|
|
| 83 |
citation=_CITATION,
|
| 84 |
)
|
| 85 |
|
| 86 |
-
def _split_generators(self, dl_manager):
|
| 87 |
# TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
|
| 88 |
# If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
|
| 89 |
|
| 90 |
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
|
| 91 |
# It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
|
| 92 |
# By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
|
| 93 |
-
|
|
|
|
|
|
|
| 94 |
return [
|
| 95 |
datasets.SplitGenerator(
|
| 96 |
name=datasets.Split.TRAIN,
|
| 97 |
# These kwargs will be passed to _generate_examples
|
| 98 |
gen_kwargs={
|
| 99 |
-
"filepath":
|
| 100 |
"split": "train",
|
| 101 |
},
|
| 102 |
),
|
|
@@ -104,7 +110,7 @@ class CogText(datasets.GeneratorBasedBuilder):
|
|
| 104 |
name=datasets.Split.TEST,
|
| 105 |
# These kwargs will be passed to _generate_examples
|
| 106 |
gen_kwargs={
|
| 107 |
-
"filepath":
|
| 108 |
"split": "test"
|
| 109 |
},
|
| 110 |
),
|
|
|
|
| 29 |
_HOMEPAGE = "https://github.com/morteza/cogtext"
|
| 30 |
_LICENSE = "CC-BY-4.0"
|
| 31 |
|
| 32 |
+
_URLS = [
|
| 33 |
+
"pubmed/abstracts.csv.gz"
|
| 34 |
+
]
|
| 35 |
+
|
| 36 |
|
| 37 |
class CogText(datasets.GeneratorBasedBuilder):
|
| 38 |
"""S collection of PubMed abstracts, along with their GPT-3 embeddings and topic embeddings."""
|
|
|
|
| 87 |
citation=_CITATION,
|
| 88 |
)
|
| 89 |
|
| 90 |
+
def _split_generators(self, dl_manager: datasets.download.DownloadManager):
|
| 91 |
# TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
|
| 92 |
# If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
|
| 93 |
|
| 94 |
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
|
| 95 |
# It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
|
| 96 |
# By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
|
| 97 |
+
|
| 98 |
+
[abstracts_path] = dl_manager.download(_URLS)
|
| 99 |
+
|
| 100 |
return [
|
| 101 |
datasets.SplitGenerator(
|
| 102 |
name=datasets.Split.TRAIN,
|
| 103 |
# These kwargs will be passed to _generate_examples
|
| 104 |
gen_kwargs={
|
| 105 |
+
"filepath": abstracts_path,
|
| 106 |
"split": "train",
|
| 107 |
},
|
| 108 |
),
|
|
|
|
| 110 |
name=datasets.Split.TEST,
|
| 111 |
# These kwargs will be passed to _generate_examples
|
| 112 |
gen_kwargs={
|
| 113 |
+
"filepath": abstracts_path,
|
| 114 |
"split": "test"
|
| 115 |
},
|
| 116 |
),
|