jira-comments-nsp / jira-comments.py
pheepa's picture
commas
41c919b
raw
history blame
2.3 kB
"""The BookCorpus dataset."""
import datasets
import os
_DESCRIPTION = """\
Dataset of jira comments from different projects of Apache and more.
"""
_CITATION = """\
@InProceedings{Zhu_2015_ICCV,
title = {Jira commentaries},
author = {Filipp Abapolov},
month = {Fubruary},
year = {2023}
}
"""
_REPO = "https://huggingface.co/datasets/pheepa/jira-comments/resolve/main"
_URL = f"{_REPO}/data/jira-comments.tar.gz"
class JiraCommentsConfig(datasets.BuilderConfig):
"""BuilderConfig for BookCorpus."""
def __init__(self, split, **kwargs):
"""BuilderConfig for BookCorpus.
Args:
**kwargs: keyword arguments forwarded to super.
"""
super(JiraCommentsConfig, self).__init__(name='jira-comments', split=split, version=datasets.Version("1.0.0", ""), **kwargs)
self.path = f"{split}-jira-comments.txt"
class JiraComments(datasets.GeneratorBasedBuilder):
"""JiraComments dataset."""
BUILDER_CONFIGS = [
JiraCommentsConfig(name='jira-comments', split='train', description="Train split (75%)"),
JiraCommentsConfig(name='jira-comments', split='test', description="Test split (25%)"),
]
def _info(self):
return datasets.DatasetInfo(
description=_DESCRIPTION,
features=datasets.Features(
{
"text": 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='jira-comments',
split=datasets.Split.TRAIN,
gen_kwargs={"filepath": os.path.join(data_dir, self.config.path)}
),
datasets.SplitGenerator(
name='jira-comments'
split=datasets.Split.TEST,
gen_kwargs={"filepath": os.path.join(data_dir, self.config.path)}
)
]
def _generate_examples(self, filepath):
"""Yields examples."""
with open(filepath, 'r') as f:
for id_, line in enumerate(f):
yield id_, {"text": line}