pheepa commited on
Commit
67dfbba
·
1 Parent(s): 4c866b1
Files changed (1) hide show
  1. jira-comments.py +74 -0
jira-comments.py ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """The BookCorpus dataset."""
2
+
3
+ import datasets, os
4
+
5
+
6
+ _DESCRIPTION = """\
7
+ Dataset of jira comments from different projects of Apache and more.
8
+ """
9
+
10
+ _CITATION = """\
11
+ @InProceedings{Zhu_2015_ICCV,
12
+ title = {Jira commentaries},
13
+ author = {Filipp Abapolov},
14
+ month = {Fubruary},
15
+ year = {2023}
16
+ }
17
+ """
18
+
19
+
20
+ _REPO = "https://huggingface.co/datasets/pheepa/jira-comments"
21
+ _URL = f"/data/{_REPO}/jira-comments.tar.gz"
22
+
23
+
24
+ class JiraCommentsConfig(datasets.BuilderConfig):
25
+ """BuilderConfig for BookCorpus."""
26
+
27
+ def __init__(self, **kwargs):
28
+ """BuilderConfig for BookCorpus.
29
+ Args:
30
+ **kwargs: keyword arguments forwarded to super.
31
+ """
32
+ super(JiraCommentsConfig, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs)
33
+
34
+ self.path = "jira-comments.txt"
35
+
36
+
37
+ class JiraComments(datasets.GeneratorBasedBuilder):
38
+ """JiraComments dataset."""
39
+
40
+ BUILDER_CONFIGS = [
41
+ JiraCommentsConfig(
42
+ name="plain_text",
43
+ description="Plain text",
44
+ )
45
+ ]
46
+
47
+ def _info(self):
48
+ return datasets.DatasetInfo(
49
+ description=_DESCRIPTION,
50
+ features=datasets.Features(
51
+ {
52
+ "text": datasets.Value("string"),
53
+ }
54
+ ),
55
+ supervised_keys=None,
56
+ citation=_CITATION,
57
+ )
58
+
59
+ def _split_generators(self, dl_manager):
60
+ """Returns SplitGenerators."""
61
+ data_dir = dl_manager.download_and_extract(_URL)
62
+ return [
63
+ datasets.SplitGenerator(
64
+ name=datasets.Split.TRAIN,
65
+ # These kwargs will be passed to _generate_examples
66
+ gen_kwargs={"filepath": os.path.join(data_dir, self.config.path)},
67
+ ),
68
+ ]
69
+
70
+ def _generate_examples(self, filepath):
71
+ """Yields examples."""
72
+ with open(filepath, 'r') as f:
73
+ for id_, line in enumerate(f):
74
+ yield id_, {"text": line}