Update GitTables.py
Browse files- GitTables.py +18 -8
GitTables.py
CHANGED
|
@@ -25,7 +25,7 @@ _LICENSE = ""
|
|
| 25 |
|
| 26 |
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
|
| 27 |
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
| 28 |
-
_URL = "https://huggingface.co/datasets/yuansui/GitTables/resolve/main/"
|
| 29 |
_URLS = {
|
| 30 |
"dbpedia": {
|
| 31 |
"train": _URL + "dbpedia" + "_train.jsonl",
|
|
@@ -39,8 +39,10 @@ _URLS = {
|
|
| 39 |
}
|
| 40 |
}
|
| 41 |
|
|
|
|
| 42 |
class GitTablesConfig(datasets.BuilderConfig):
|
| 43 |
"""GitTablesConfig for GitTables"""
|
|
|
|
| 44 |
def __init__(self, features, data_url, citation, url, label_classes=("False", "True"), **kwargs):
|
| 45 |
"""BuilderConfig for SuperGLUE.
|
| 46 |
|
|
@@ -72,19 +74,21 @@ class GitTables(datasets.GeneratorBasedBuilder):
|
|
| 72 |
BUILDER_CONFIGS = [
|
| 73 |
GitTablesConfig(
|
| 74 |
name="dbpedia",
|
| 75 |
-
description=
|
| 76 |
-
features=["id", "table_id", "target_column", "annotation_id", "annotation_label", "table_text",
|
|
|
|
| 77 |
data_url=_URLS["dbpedia"],
|
| 78 |
citation=_CITATION,
|
| 79 |
-
url
|
| 80 |
),
|
| 81 |
GitTablesConfig(
|
| 82 |
name="schema",
|
| 83 |
description="Subsets of 1M gittables for column type classification with schema",
|
| 84 |
-
features=["id", "table_id", "target_column", "annotation_id", "annotation_label", "table_text",
|
|
|
|
| 85 |
data_url=_URLS["schema"],
|
| 86 |
citation=_CITATION,
|
| 87 |
-
url
|
| 88 |
)
|
| 89 |
]
|
| 90 |
|
|
@@ -164,7 +168,9 @@ class GitTables(datasets.GeneratorBasedBuilder):
|
|
| 164 |
"column_text": data["column_text"],
|
| 165 |
"annotation_id": data["annotation_id"],
|
| 166 |
"annotation_label": data["annotation_label"],
|
| 167 |
-
"table_text":
|
|
|
|
|
|
|
| 168 |
}
|
| 169 |
else:
|
| 170 |
yield key, {
|
|
@@ -174,5 +180,9 @@ class GitTables(datasets.GeneratorBasedBuilder):
|
|
| 174 |
"column_text": data["column_text"],
|
| 175 |
"annotation_id": data["annotation_id"],
|
| 176 |
"annotation_label": data["annotation_label"],
|
| 177 |
-
"table_text":
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
}
|
|
|
|
| 25 |
|
| 26 |
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
|
| 27 |
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
| 28 |
+
_URL = "https://huggingface.co/datasets/yuansui/GitTables/resolve/main/" # be attention to the url, use resolve instead of blob
|
| 29 |
_URLS = {
|
| 30 |
"dbpedia": {
|
| 31 |
"train": _URL + "dbpedia" + "_train.jsonl",
|
|
|
|
| 39 |
}
|
| 40 |
}
|
| 41 |
|
| 42 |
+
|
| 43 |
class GitTablesConfig(datasets.BuilderConfig):
|
| 44 |
"""GitTablesConfig for GitTables"""
|
| 45 |
+
|
| 46 |
def __init__(self, features, data_url, citation, url, label_classes=("False", "True"), **kwargs):
|
| 47 |
"""BuilderConfig for SuperGLUE.
|
| 48 |
|
|
|
|
| 74 |
BUILDER_CONFIGS = [
|
| 75 |
GitTablesConfig(
|
| 76 |
name="dbpedia",
|
| 77 |
+
description="Subsets of 1M gittables for column type classification with dbpedia",
|
| 78 |
+
features=["id", "table_id", "target_column", "annotation_id", "annotation_label", "table_text",
|
| 79 |
+
"column_text"],
|
| 80 |
data_url=_URLS["dbpedia"],
|
| 81 |
citation=_CITATION,
|
| 82 |
+
url=""
|
| 83 |
),
|
| 84 |
GitTablesConfig(
|
| 85 |
name="schema",
|
| 86 |
description="Subsets of 1M gittables for column type classification with schema",
|
| 87 |
+
features=["id", "table_id", "target_column", "annotation_id", "annotation_label", "table_text",
|
| 88 |
+
"column_text"],
|
| 89 |
data_url=_URLS["schema"],
|
| 90 |
citation=_CITATION,
|
| 91 |
+
url=""
|
| 92 |
)
|
| 93 |
]
|
| 94 |
|
|
|
|
| 168 |
"column_text": data["column_text"],
|
| 169 |
"annotation_id": data["annotation_id"],
|
| 170 |
"annotation_label": data["annotation_label"],
|
| 171 |
+
"table_text": {
|
| 172 |
+
data["table_text"].get(f"col{i}", "") for i in range(50),
|
| 173 |
+
}
|
| 174 |
}
|
| 175 |
else:
|
| 176 |
yield key, {
|
|
|
|
| 180 |
"column_text": data["column_text"],
|
| 181 |
"annotation_id": data["annotation_id"],
|
| 182 |
"annotation_label": data["annotation_label"],
|
| 183 |
+
"table_text": {
|
| 184 |
+
"table_text": {
|
| 185 |
+
data["table_text"].get(f"col{i}", "") for i in range(50),
|
| 186 |
+
}
|
| 187 |
+
}
|
| 188 |
}
|