Datasets:
modify some dataset feature types to sequence and int
Browse files- euscrawl.py +30 -5
euscrawl.py
CHANGED
@@ -62,18 +62,18 @@ KEYS = [
|
|
62 |
"source",
|
63 |
"url",
|
64 |
"author",
|
|
|
|
|
65 |
"category",
|
66 |
"tags",
|
67 |
-
"revid",
|
68 |
"id",
|
69 |
-
"
|
70 |
"year",
|
71 |
"month",
|
72 |
"day",
|
73 |
"hour",
|
74 |
"minute",
|
75 |
"second",
|
76 |
-
"lang",
|
77 |
]
|
78 |
|
79 |
|
@@ -82,7 +82,32 @@ class EusCrawl(datasets.GeneratorBasedBuilder):
|
|
82 |
return datasets.DatasetInfo(
|
83 |
description=_DESCRIPTION,
|
84 |
features=datasets.Features(
|
85 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
),
|
87 |
supervised_keys=None,
|
88 |
homepage=_HOMEPAGE_URL,
|
@@ -104,4 +129,4 @@ class EusCrawl(datasets.GeneratorBasedBuilder):
|
|
104 |
for id, line in enumerate(file):
|
105 |
data = json.loads(line)
|
106 |
# defaut to empty string if field is missing
|
107 |
-
yield id, {key: data.get(key,
|
|
|
62 |
"source",
|
63 |
"url",
|
64 |
"author",
|
65 |
+
"type",
|
66 |
+
"lang",
|
67 |
"category",
|
68 |
"tags",
|
|
|
69 |
"id",
|
70 |
+
"revid",
|
71 |
"year",
|
72 |
"month",
|
73 |
"day",
|
74 |
"hour",
|
75 |
"minute",
|
76 |
"second",
|
|
|
77 |
]
|
78 |
|
79 |
|
|
|
82 |
return datasets.DatasetInfo(
|
83 |
description=_DESCRIPTION,
|
84 |
features=datasets.Features(
|
85 |
+
{
|
86 |
+
"title": datasets.Value("string"),
|
87 |
+
"opening": datasets.Value("string"),
|
88 |
+
"heading": datasets.Value("string"),
|
89 |
+
"text": datasets.Value("string"),
|
90 |
+
"extra": datasets.Sequence({
|
91 |
+
"title": datasets.Value("string"),
|
92 |
+
"text": datasets.Value("string"),
|
93 |
+
}),
|
94 |
+
"license": datasets.Value("string"),
|
95 |
+
"source": datasets.Value("string"),
|
96 |
+
"url": datasets.Value("string"),
|
97 |
+
"author": datasets.Value("string"),
|
98 |
+
"type": datasets.Value("string"),
|
99 |
+
"lang": datasets.Value("string"),
|
100 |
+
"category": datasets.Sequence(datasets.Value("string")),
|
101 |
+
"tags": datasets.Sequence(datasets.Value("string")),
|
102 |
+
"id": datasets.Value("int32"),
|
103 |
+
"revid": datasets.Value("int32"),
|
104 |
+
"year": datasets.Value("int32"),
|
105 |
+
"month": datasets.Value("int32"),
|
106 |
+
"day": datasets.Value("int32"),
|
107 |
+
"hour": datasets.Value("int32"),
|
108 |
+
"minute": datasets.Value("int32"),
|
109 |
+
"second": datasets.Value("int32"),
|
110 |
+
}
|
111 |
),
|
112 |
supervised_keys=None,
|
113 |
homepage=_HOMEPAGE_URL,
|
|
|
129 |
for id, line in enumerate(file):
|
130 |
data = json.loads(line)
|
131 |
# defaut to empty string if field is missing
|
132 |
+
yield id, {key: data.get(key, None) for key in KEYS}
|