pheepa commited on
Commit
5ff78ef
1 Parent(s): c218a32
Files changed (1) hide show
  1. jira-comments.py +7 -4
jira-comments.py CHANGED
@@ -53,16 +53,19 @@ class JiraComments(datasets.GeneratorBasedBuilder):
53
  return [
54
  datasets.SplitGenerator(
55
  name=datasets.Split.TRAIN,
56
- gen_kwargs={"filepath": os.path.join(data_dir, "train-jira-comments.txt")}
57
  ),
58
  datasets.SplitGenerator(
59
  name=datasets.Split.TEST,
60
- gen_kwargs={"filepath": os.path.join(data_dir, "test-jira-comments.txt")}
61
  )
62
  ]
63
 
64
  def _generate_examples(self, filepath):
65
  """Yields examples."""
66
  with open(filepath, 'r') as f:
67
- for id_, line in enumerate(f):
68
- yield id_, {"text": line}
 
 
 
 
53
  return [
54
  datasets.SplitGenerator(
55
  name=datasets.Split.TRAIN,
56
+ gen_kwargs={"filepath": os.path.join(data_dir, "train-pairs-jira-comments.txt")}
57
  ),
58
  datasets.SplitGenerator(
59
  name=datasets.Split.TEST,
60
+ gen_kwargs={"filepath": os.path.join(data_dir, "test-pairs-jira-comments.txt")}
61
  )
62
  ]
63
 
64
  def _generate_examples(self, filepath):
65
  """Yields examples."""
66
  with open(filepath, 'r') as f:
67
+ triples = f.read()
68
+
69
+ for id_, line in enumerate(range(0, len(triples), 3)):
70
+ l, a, b = line.split('\n')
71
+ yield id_, {"text": ' '.join([a, b]), 'labels': int(l)}