rajeshradhakrishnan
commited on
Commit
·
7d5fd1c
1
Parent(s):
766c521
fix for file path
Browse files- malayalam_wiki.py +5 -5
malayalam_wiki.py
CHANGED
@@ -82,7 +82,8 @@ class MalayalamWiki(datasets.GeneratorBasedBuilder):
|
|
82 |
files = sorted(os.listdir(os.path.join(dl_path["malayalam_wiki_1"],"malayalam_filtered_html_body")))
|
83 |
file_paths = [os.path.join(dl_path["malayalam_wiki_1"], "malayalam_filtered_html_body" , file) for file in files]
|
84 |
files = sorted(os.listdir(os.path.join(dl_path["malayalam_wiki_2"],"unfiltered_heading_and_para")))
|
85 |
-
|
|
|
86 |
filepaths_splice = self.partition(file_paths,3)
|
87 |
return [
|
88 |
datasets.SplitGenerator(
|
@@ -110,7 +111,6 @@ class MalayalamWiki(datasets.GeneratorBasedBuilder):
|
|
110 |
|
111 |
def _generate_examples(self, filepath, split):
|
112 |
for file_id, file in enumerate(filepath):
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
yield f"{file_id}_{row_id}", {"text": self.remove_special_characters(row)}
|
|
|
82 |
files = sorted(os.listdir(os.path.join(dl_path["malayalam_wiki_1"],"malayalam_filtered_html_body")))
|
83 |
file_paths = [os.path.join(dl_path["malayalam_wiki_1"], "malayalam_filtered_html_body" , file) for file in files]
|
84 |
files = sorted(os.listdir(os.path.join(dl_path["malayalam_wiki_2"],"unfiltered_heading_and_para")))
|
85 |
+
wiki_2 = [os.path.join(dl_path["malayalam_wiki_2"],"unfiltered_heading_and_para", file) for file in files]
|
86 |
+
file_paths.extend(wiki_2)
|
87 |
filepaths_splice = self.partition(file_paths,3)
|
88 |
return [
|
89 |
datasets.SplitGenerator(
|
|
|
111 |
|
112 |
def _generate_examples(self, filepath, split):
|
113 |
for file_id, file in enumerate(filepath):
|
114 |
+
with open(file, encoding="utf-8") as f:
|
115 |
+
for row_id, row in enumerate(f):
|
116 |
+
yield f"{file_id}_{row_id}", {"text": self.remove_special_characters(row)}
|
|