Datasets:
Tasks:
Summarization
Modalities:
Text
Sub-tasks:
news-articles-summarization
Languages:
Hebrew
Size:
100K - 1M
License:
imvladikon
commited on
Commit
•
d7212a4
1
Parent(s):
bf7093c
Update hebrew_news.py
Browse files- hebrew_news.py +17 -16
hebrew_news.py
CHANGED
@@ -55,25 +55,26 @@ class HebrewNews(datasets.GeneratorBasedBuilder):
|
|
55 |
def _split_generators(self, dl_manager):
|
56 |
"""Returns SplitGenerators."""
|
57 |
urls_to_download = "data/news.tar.gz"
|
58 |
-
|
59 |
-
filepath = os.path.join(downloaded_files, "news.csv")
|
60 |
return [
|
61 |
datasets.SplitGenerator(
|
62 |
name=datasets.Split.TRAIN,
|
63 |
-
gen_kwargs={"
|
64 |
),
|
65 |
]
|
66 |
|
67 |
-
def _generate_examples(self,
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
|
|
|
|
|
55 |
def _split_generators(self, dl_manager):
|
56 |
"""Returns SplitGenerators."""
|
57 |
urls_to_download = "data/news.tar.gz"
|
58 |
+
archive_iter = dl_manager.iter_archive(urls_to_download)
|
|
|
59 |
return [
|
60 |
datasets.SplitGenerator(
|
61 |
name=datasets.Split.TRAIN,
|
62 |
+
gen_kwargs={"archive_iter":archive_iter },
|
63 |
),
|
64 |
]
|
65 |
|
66 |
+
def _generate_examples(self, archive_iter):
|
67 |
+
for path, f in archive_iter:
|
68 |
+
##with open(filepath, encoding="utf-8") as f:
|
69 |
+
fieldnames = ["articleBody", "description", "headline", "title"]
|
70 |
+
reader = csv.DictReader(f, delimiter=",", fieldnames=fieldnames)
|
71 |
+
next(reader)
|
72 |
+
for idx, row in enumerate(reader):
|
73 |
+
yield idx, {
|
74 |
+
"id": idx,
|
75 |
+
"articleBody": row["articleBody"],
|
76 |
+
"description": row["description"],
|
77 |
+
"headline": row["headline"],
|
78 |
+
"title": row["title"],
|
79 |
+
}
|
80 |
+
|