Commit
·
e1c7fe6
1
Parent(s):
aa73407
First version of the malayalam_wiki dataset.
Browse files- .gitattributes +1 -0
- README.md +0 -0
- dataset_infos.json +56 -0
- malayalam_news.py +96 -0
.gitattributes
CHANGED
|
@@ -25,3 +25,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 25 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 26 |
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
| 27 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 25 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 26 |
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
| 27 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.txt filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
Binary files a/README.md and b/README.md differ
|
|
|
dataset_infos.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"default": {
|
| 3 |
+
"description": "Useful tools to extract malayalam text from the Common Crawl Datasets.\n",
|
| 4 |
+
"citation": "@article{qburst,\n title={Common Crawl - Malayalam},\n journal={arXiv preprint arXiv:2005.00085},\n year={2020}\n}\n",
|
| 5 |
+
"homepage": "https://github.com/qburst/common-crawl-malayalam",
|
| 6 |
+
"license": "",
|
| 7 |
+
"features": {
|
| 8 |
+
"text": {
|
| 9 |
+
"dtype": "string",
|
| 10 |
+
"id": null,
|
| 11 |
+
"_type": "Value"
|
| 12 |
+
}
|
| 13 |
+
},
|
| 14 |
+
"post_processed": null,
|
| 15 |
+
"supervised_keys": null,
|
| 16 |
+
"builder_name": "malayalam_wiki",
|
| 17 |
+
"config_name": "default",
|
| 18 |
+
"version": {
|
| 19 |
+
"version_str": "0.0.0",
|
| 20 |
+
"description": null,
|
| 21 |
+
"major": 0,
|
| 22 |
+
"minor": 0,
|
| 23 |
+
"patch": 0
|
| 24 |
+
},
|
| 25 |
+
"splits": {
|
| 26 |
+
"train": {
|
| 27 |
+
"name": "train",
|
| 28 |
+
"num_bytes": 15384,
|
| 29 |
+
"num_examples": 4800,
|
| 30 |
+
"dataset_name": "malayalam_wiki"
|
| 31 |
+
},
|
| 32 |
+
"validation": {
|
| 33 |
+
"name": "validation",
|
| 34 |
+
"num_bytes": 1943,
|
| 35 |
+
"num_examples": 600,
|
| 36 |
+
"dataset_name": "malayalam_wiki"
|
| 37 |
+
},
|
| 38 |
+
"test": {
|
| 39 |
+
"name": "test",
|
| 40 |
+
"num_bytes": 1959,
|
| 41 |
+
"num_examples": 600,
|
| 42 |
+
"dataset_name": "malayalam_wiki"
|
| 43 |
+
}
|
| 44 |
+
},
|
| 45 |
+
"download_checksums": {
|
| 46 |
+
"https://storage.googleapis.com/ai4bharat-public-indic-nlp-corpora/evaluations/classification/indicnlp-news-articles.tgz": {
|
| 47 |
+
"num_bytes": 36486362,
|
| 48 |
+
"checksum": ""
|
| 49 |
+
}
|
| 50 |
+
},
|
| 51 |
+
"download_size": null,
|
| 52 |
+
"post_processing_size": null,
|
| 53 |
+
"dataset_size": null,
|
| 54 |
+
"size_in_bytes": null
|
| 55 |
+
}
|
| 56 |
+
}
|
malayalam_news.py
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import csv
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
import datasets
|
| 5 |
+
|
| 6 |
+
from datasets.tasks import TextClassification
|
| 7 |
+
|
| 8 |
+
_DESCRIPTION = """\
|
| 9 |
+
Common Crawl - Malayalam.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
_CITATION = """\
|
| 13 |
+
@article{qburst,
|
| 14 |
+
title={Common Crawl - Malayalam},
|
| 15 |
+
author={n.d},
|
| 16 |
+
year={2020},
|
| 17 |
+
journal={n.d},
|
| 18 |
+
}
|
| 19 |
+
"""
|
| 20 |
+
|
| 21 |
+
_URLs = {
|
| 22 |
+
"malayalam_wiki_1": "https://calicut.qburst.in/commoncrawl/malayalam/2020-10/malayalam_filtered_html_body.tar.gz",
|
| 23 |
+
"malayalam_wiki_2": "https://calicut.qburst.in/commoncrawl/malayalam/2020-10/unfiltered_heading_and_para.tar.gz"
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
class MalayalamWikiConfig(datasets.BuilderConfig):
|
| 27 |
+
"""BuilderConfig for MalayalamWiki."""
|
| 28 |
+
|
| 29 |
+
def __init__(self, **kwargs):
|
| 30 |
+
"""BuilderConfig for MalayalamWiki.
|
| 31 |
+
|
| 32 |
+
Args:
|
| 33 |
+
**kwargs: keyword arguments forwarded to super.
|
| 34 |
+
"""
|
| 35 |
+
super(MalayalamWikiConfig, self).__init__(**kwargs)
|
| 36 |
+
|
| 37 |
+
class MalayalamWiki(datasets.GeneratorBasedBuilder):
|
| 38 |
+
"""Malayalam News topic classification dataset."""
|
| 39 |
+
|
| 40 |
+
VERSION = datasets.Version("1.0.0")
|
| 41 |
+
|
| 42 |
+
BUILDER_CONFIGS = [
|
| 43 |
+
MalayalamWikiConfig(
|
| 44 |
+
name="malayalam_wiki", version=VERSION, description="Common Crawl - Malayalam."
|
| 45 |
+
),
|
| 46 |
+
]
|
| 47 |
+
|
| 48 |
+
def _info(self):
|
| 49 |
+
return datasets.DatasetInfo(
|
| 50 |
+
description=_DESCRIPTION,
|
| 51 |
+
features=datasets.Features(
|
| 52 |
+
{
|
| 53 |
+
"text": datasets.Value("string")
|
| 54 |
+
}
|
| 55 |
+
),
|
| 56 |
+
supervised_keys=None,
|
| 57 |
+
homepage="https://github.com/qburst/common-crawl-malayalam",
|
| 58 |
+
citation=_CITATION
|
| 59 |
+
)
|
| 60 |
+
|
| 61 |
+
def _split_generators(self, dl_manager):
|
| 62 |
+
"""Returns SplitGenerators."""
|
| 63 |
+
dl_path = dl_manager.download_and_extract(_URLs)
|
| 64 |
+
files = sorted(os.listdir(os.path.join(dl_path, "malayalam_filtered_html_body")))
|
| 65 |
+
file_paths = [os.path.join(dl_path, "malayalam_filtered_html_body", file) for file in files]
|
| 66 |
+
files = sorted(os.listdir(os.path.join(dl_path, "unfiltered_heading_and_para")))
|
| 67 |
+
file_paths.append([os.path.join(dl_path, "malayalam_filtered_html_body", file) for file in files])
|
| 68 |
+
return [
|
| 69 |
+
datasets.SplitGenerator(
|
| 70 |
+
name=datasets.Split.TRAIN,
|
| 71 |
+
gen_kwargs={
|
| 72 |
+
"filepath": file_paths[:32],
|
| 73 |
+
"split": "train",
|
| 74 |
+
},
|
| 75 |
+
),
|
| 76 |
+
datasets.SplitGenerator(
|
| 77 |
+
name=datasets.Split.VALIDATION,
|
| 78 |
+
gen_kwargs={
|
| 79 |
+
"filepath": file_paths[33:36],
|
| 80 |
+
"split": "train",
|
| 81 |
+
},
|
| 82 |
+
),
|
| 83 |
+
datasets.SplitGenerator(
|
| 84 |
+
name=datasets.Split.TEST,
|
| 85 |
+
gen_kwargs={
|
| 86 |
+
"filepath": file_paths[37:40],
|
| 87 |
+
"split": "train",
|
| 88 |
+
},
|
| 89 |
+
)
|
| 90 |
+
]
|
| 91 |
+
|
| 92 |
+
def _generate_examples(self, filepath):
|
| 93 |
+
for file_id, file in enumerate(filepath):
|
| 94 |
+
with open(file, encoding="utf-8") as f:
|
| 95 |
+
for row_id, row in enumerate(f):
|
| 96 |
+
yield row_id, {"text": row.strip()}
|