Merge branch 'main' of https://huggingface.co/datasets/zeusfsx/ukrainian-news
Browse files- ukrainian-news.py +11 -9
- ukranian-news-1.json +0 -3
- ukranian-news-2.json +0 -3
- ukranian-news-3.json +0 -3
- ukranian-news-4.json +0 -3
- ukranian-news-5.json +0 -3
ukrainian-news.py
CHANGED
@@ -12,6 +12,7 @@ Ukrainian News Dataset
|
|
12 |
This is a dataset of news articles downloaded from various Ukrainian websites. The dataset contains approximately 10 569 428 JSON objects (news)
|
13 |
"""
|
14 |
|
|
|
15 |
_URLS = [
|
16 |
"ukrainian-news-1.json",
|
17 |
"ukrainian-news-2.json",
|
@@ -44,18 +45,19 @@ class UkrainianNews(datasets.GeneratorBasedBuilder):
|
|
44 |
)
|
45 |
|
46 |
def _split_generators(self, dl_manager):
|
47 |
-
downloaded_files = dl_manager.
|
48 |
|
49 |
return [
|
50 |
-
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"
|
51 |
]
|
52 |
|
53 |
-
def _generate_examples(self,
|
54 |
"""This function returns the examples in the raw (text) form."""
|
55 |
-
logger.info("generating examples from = %s",
|
56 |
key = 0
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
12 |
This is a dataset of news articles downloaded from various Ukrainian websites. The dataset contains approximately 10 569 428 JSON objects (news)
|
13 |
"""
|
14 |
|
15 |
+
|
16 |
_URLS = [
|
17 |
"ukrainian-news-1.json",
|
18 |
"ukrainian-news-2.json",
|
|
|
45 |
)
|
46 |
|
47 |
def _split_generators(self, dl_manager):
|
48 |
+
downloaded_files = dl_manager.download(_URLS)
|
49 |
|
50 |
return [
|
51 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepaths": downloaded_files})
|
52 |
]
|
53 |
|
54 |
+
def _generate_examples(self, filepaths):
|
55 |
"""This function returns the examples in the raw (text) form."""
|
56 |
+
logger.info("generating examples from = %s", filepaths)
|
57 |
key = 0
|
58 |
+
for path in filepaths:
|
59 |
+
with open(path, encoding="utf-8") as f:
|
60 |
+
news = json.load(f)
|
61 |
+
for article in news:
|
62 |
+
yield key, article
|
63 |
+
key += 1
|
ukranian-news-1.json
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:25ec2307acf7ef02390cc0f885b3a57446436d2cef15ae56bda20ab990790d14
|
3 |
-
size 5543193896
|
|
|
|
|
|
|
|
ukranian-news-2.json
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:223f5e98966e0ce84c349f26553ef028c0c29ddd9e97a1d6139dfcb64c579bd8
|
3 |
-
size 16975821112
|
|
|
|
|
|
|
|
ukranian-news-3.json
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:171172f3a2a1030691fbc9ddfcdd8dbfba6bacbcac8cde2a13d4ba3e07baed3c
|
3 |
-
size 13557843454
|
|
|
|
|
|
|
|
ukranian-news-4.json
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:8386beaab0161c67b7fc1d0b125867ccf127622fe6e9744e1e930bb5fdf45ee3
|
3 |
-
size 21062046497
|
|
|
|
|
|
|
|
ukranian-news-5.json
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:f01825aaa142b45c50082158cc3ae19c8d30bb6f098f46026dc2a07663689c10
|
3 |
-
size 34368079367
|
|
|
|
|
|
|
|