Datasets:
zaenal
commited on
Commit
•
05bfe26
1
Parent(s):
993c030
fix py files
Browse files- .gitattributes +1 -0
- idnnews.py +3 -55
.gitattributes
CHANGED
@@ -59,3 +59,4 @@ id-news-az_small_file_20000000.txt.gz filter=lfs diff=lfs merge=lfs -text
|
|
59 |
id-news-az_small_file_30000000.txt.gz filter=lfs diff=lfs merge=lfs -text
|
60 |
id-news-az_small_file_40000000.txt.gz filter=lfs diff=lfs merge=lfs -text
|
61 |
*.txt.gz filter=lfs diff=lfs merge=lfs -text
|
|
|
|
59 |
id-news-az_small_file_30000000.txt.gz filter=lfs diff=lfs merge=lfs -text
|
60 |
id-news-az_small_file_40000000.txt.gz filter=lfs diff=lfs merge=lfs -text
|
61 |
*.txt.gz filter=lfs diff=lfs merge=lfs -text
|
62 |
+
idnnews.py filter=lfs diff=lfs merge=lfs -text
|
idnnews.py
CHANGED
@@ -1,55 +1,3 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
import glob
|
5 |
-
|
6 |
-
|
7 |
-
_DESCRIPTION = """\
|
8 |
-
An open-source of Indonesian news from various portals from Dec 2022 to Sep 2021
|
9 |
-
"""
|
10 |
-
|
11 |
-
_N_DATA_FILES = 4
|
12 |
-
|
13 |
-
|
14 |
-
_DATA_FILES = glob.glob('data/*00.txt.gz')
|
15 |
-
|
16 |
-
|
17 |
-
class IdnNewsScrap(datasets.GeneratorBasedBuilder):
|
18 |
-
"""The Indonesian News Scrap dataset."""
|
19 |
-
|
20 |
-
BUILDER_CONFIGS = [
|
21 |
-
datasets.BuilderConfig(
|
22 |
-
name="plain_text",
|
23 |
-
description="Plain text",
|
24 |
-
version=datasets.Version("1.0.0"),
|
25 |
-
)
|
26 |
-
]
|
27 |
-
|
28 |
-
def _info(self):
|
29 |
-
return datasets.DatasetInfo(
|
30 |
-
description=_DESCRIPTION,
|
31 |
-
features=datasets.Features({"text": datasets.Value("string")}),
|
32 |
-
)
|
33 |
-
|
34 |
-
def _split_generators(self, dl_manager):
|
35 |
-
archives = dl_manager.download(_DATA_FILES)
|
36 |
-
return [
|
37 |
-
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={
|
38 |
-
"archive_iterators": [
|
39 |
-
dl_manager.iter_archive(archive) for archive in archives
|
40 |
-
],
|
41 |
-
"iter_archive": dl_manager.iter_archive
|
42 |
-
}),
|
43 |
-
]
|
44 |
-
|
45 |
-
def _generate_examples(self, archive_iterators, iter_archive):
|
46 |
-
"""Yields examples."""
|
47 |
-
for archive_iterator in archive_iterators:
|
48 |
-
for xz_filepath, xz_f in archive_iterator:
|
49 |
-
if not xz_filepath.endswith(".gz"):
|
50 |
-
continue
|
51 |
-
for txt_filepath, txt_f in iter_archive(xz_f):
|
52 |
-
if not txt_filepath.endswith(".txt"):
|
53 |
-
continue
|
54 |
-
idx = f"{xz_filepath}/{txt_filepath}"
|
55 |
-
yield idx, {"text": re.sub("\n\n\n+", "\n\n", txt_f.read().decode("utf-8")).strip()}
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dcf17fa43c70e7c9b44f69a7e3320baab7e318a2148125a8d9ce88289f489662
|
3 |
+
size 1698
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|