jira-commentaries-mlm / jira-commentaries-mlm.py
pheepa's picture
full issue comments
1c451a2
"""The BookCorpus dataset."""
import datasets
import os
import json
_DESCRIPTION = """\
Dataset of jira comments from different projects of Apache and more.
"""
_CITATION = """\
@InProceedings{Zhu_2015_ICCV,
title = {Jira commentaries for MLM},
author = {Filipp Abapolov},
month = {Fubruary},
year = {2023}
}
"""
_REPO = "https://huggingface.co/datasets/pheepa/jira-commentaries-mlm/resolve/main"
_URL = f"{_REPO}/data/jira-commentaries.tar.gz"
class JiraComments(datasets.GeneratorBasedBuilder):
"""JiraComments dataset."""
BUILDER_CONFIGS = [
datasets.BuilderConfig(
name='jira-commentaries-mlm',
version=datasets.Version("1.0.0"),
description=_DESCRIPTION
)
]
def _info(self):
return datasets.DatasetInfo(
description=_DESCRIPTION,
features=datasets.Features(
{
"comments": datasets.Value("string"),
}
),
supervised_keys=None,
citation=_CITATION
)
def _split_generators(self, dl_manager):
"""Returns SplitGenerators."""
data_dir = dl_manager.download_and_extract(_URL)
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN,
gen_kwargs={"filepath": os.path.join(data_dir, "train-all-jira-comments.txt")}
),
datasets.SplitGenerator(
name=datasets.Split.TEST,
gen_kwargs={"filepath": os.path.join(data_dir, "test-all-jira-comments.txt")}
)
]
def _generate_examples(self, filepath):
"""Yields examples."""
with open(filepath, 'r') as f:
comments = f.read().split('\n')
for i, comment in enumerate(comments):
yield i, {'comments': comment}