OfekGlick commited on
Commit
7164dec
1 Parent(s): 64af2a3

Upload 2 files

Browse files
Files changed (2) hide show
  1. DiscoEval.py +13 -4
  2. DiscoEvalConstants.py +32 -7
DiscoEval.py CHANGED
@@ -115,7 +115,7 @@ class DiscoEvalSentence(datasets.GeneratorBasedBuilder):
115
  DiscoEvalConstants.TEXT_COLUMN_NAME[i]: datasets.Value('string')
116
  for i in range(DiscoEvalConstants.BSO_TEXT_COLUMNS)
117
  }
118
- features_dict[DiscoEvalConstants.LABEL_NAME] = datasets.ClassLabel(names=DiscoEvalConstants.BSO_LABELS)
119
  features = datasets.Features(features_dict)
120
 
121
  elif self.config.name in [DiscoEvalConstants.DCCHAT, DiscoEvalConstants.DCWIKI]:
@@ -123,7 +123,7 @@ class DiscoEvalSentence(datasets.GeneratorBasedBuilder):
123
  DiscoEvalConstants.TEXT_COLUMN_NAME[i]: datasets.Value('string')
124
  for i in range(DiscoEvalConstants.DC_TEXT_COLUMNS)
125
  }
126
- features_dict[DiscoEvalConstants.LABEL_NAME] = datasets.ClassLabel(names=DiscoEvalConstants.DC_LABELS)
127
  features = datasets.Features(features_dict)
128
 
129
  elif self.config.name in [DiscoEvalConstants.RST]:
@@ -155,7 +155,7 @@ class DiscoEvalSentence(datasets.GeneratorBasedBuilder):
155
  DiscoEvalConstants.TEXT_COLUMN_NAME[i]: datasets.Value('string')
156
  for i in range(DiscoEvalConstants.SSPABS_TEXT_COLUMNS)
157
  }
158
- features_dict[DiscoEvalConstants.LABEL_NAME] = datasets.ClassLabel(names=DiscoEvalConstants.SSPABS_LABELS)
159
  features = datasets.Features(features_dict)
160
 
161
  return datasets.DatasetInfo(
@@ -253,5 +253,14 @@ class DiscoEvalSentence(datasets.GeneratorBasedBuilder):
253
  for key, line in enumerate(f):
254
  line = line.strip().split("\t")
255
  example = {DiscoEvalConstants.TEXT_COLUMN_NAME[i]: sent for i, sent in enumerate(line[1:])}
256
- example[DiscoEvalConstants.LABEL_NAME] = line[0]
 
 
 
 
 
 
 
 
 
257
  yield key, example
 
115
  DiscoEvalConstants.TEXT_COLUMN_NAME[i]: datasets.Value('string')
116
  for i in range(DiscoEvalConstants.BSO_TEXT_COLUMNS)
117
  }
118
+ features_dict[DiscoEvalConstants.LABEL_NAME] = datasets.ClassLabel(names=DiscoEvalConstants.BSO_LABELS.values())
119
  features = datasets.Features(features_dict)
120
 
121
  elif self.config.name in [DiscoEvalConstants.DCCHAT, DiscoEvalConstants.DCWIKI]:
 
123
  DiscoEvalConstants.TEXT_COLUMN_NAME[i]: datasets.Value('string')
124
  for i in range(DiscoEvalConstants.DC_TEXT_COLUMNS)
125
  }
126
+ features_dict[DiscoEvalConstants.LABEL_NAME] = datasets.ClassLabel(names=DiscoEvalConstants.DC_LABELS.values())
127
  features = datasets.Features(features_dict)
128
 
129
  elif self.config.name in [DiscoEvalConstants.RST]:
 
155
  DiscoEvalConstants.TEXT_COLUMN_NAME[i]: datasets.Value('string')
156
  for i in range(DiscoEvalConstants.SSPABS_TEXT_COLUMNS)
157
  }
158
+ features_dict[DiscoEvalConstants.LABEL_NAME] = datasets.ClassLabel(names=DiscoEvalConstants.SSPABS_LABELS.values())
159
  features = datasets.Features(features_dict)
160
 
161
  return datasets.DatasetInfo(
 
253
  for key, line in enumerate(f):
254
  line = line.strip().split("\t")
255
  example = {DiscoEvalConstants.TEXT_COLUMN_NAME[i]: sent for i, sent in enumerate(line[1:])}
256
+ if self.config.name in (DiscoEvalConstants.PDTB_E, DiscoEvalConstants.PDTB_I):
257
+ example[DiscoEvalConstants.LABEL_NAME] = line[0]
258
+ elif self.config.name in (DiscoEvalConstants.DCCHAT, DiscoEvalConstants.DCWIKI):
259
+ example[DiscoEvalConstants.LABEL_NAME] = DiscoEvalConstants.DC_LABELS[line[0]]
260
+ elif self.config.name == DiscoEvalConstants.SSPABS:
261
+ example[DiscoEvalConstants.LABEL_NAME] = DiscoEvalConstants.SSPABS_LABELS[line[0]]
262
+ elif self.config.name in (DiscoEvalConstants.SPWIKI, DiscoEvalConstants.SPROCSTORY, DiscoEvalConstants.SPARXIV):
263
+ example[DiscoEvalConstants.LABEL_NAME] = DiscoEvalConstants.SP_LABELS[line[0]]
264
+ elif self.config.name in (DiscoEvalConstants.BSOARXIV, DiscoEvalConstants.BSOWIKI, DiscoEvalConstants.BSOROCSTORY):
265
+ example[DiscoEvalConstants.LABEL_NAME] = DiscoEvalConstants.BSO_LABELS[line[0]]
266
  yield key, example
DiscoEvalConstants.py CHANGED
@@ -1,6 +1,18 @@
1
  # General Constants:
2
  LABEL_NAME = 'label'
3
- TEXT_COLUMN_NAME = [f"sentence_{i}" for i in range(1, 10)]
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  # SSPabs Constants:
6
  SSPABS = 'SSPabs'
@@ -8,7 +20,10 @@ SSPABS_TRAIN_NAME = 'train.txt'
8
  SSPABS_VALID_NAME = 'valid.txt'
9
  SSPABS_TEST_NAME = 'test.txt'
10
  SSPABS_DATA_DIR = 'data/SSP/abs'
11
- SSPABS_LABELS = ["0", "1"]
 
 
 
12
  SSPABS_TEXT_COLUMNS = 1
13
 
14
  # PDTB Constants:
@@ -49,7 +64,6 @@ PDTB_I_LABELS = [
49
  PDTB_E_TEXT_COLUMNS = 2
50
  PDTB_I_TEXT_COLUMNS = 2
51
 
52
-
53
  # SP Constants:
54
  SPARXIV = 'SParxiv'
55
  SPROCSTORY = 'SProcstory'
@@ -59,7 +73,13 @@ SP_VALID_NAME = 'valid.txt'
59
  SP_TEST_NAME = 'test.txt'
60
  SP_DATA_DIR = 'data/SP'
61
  SP_DIRS = {SPARXIV: 'arxiv', SPROCSTORY: 'rocstory', SPWIKI: 'wiki'}
62
- SP_LABELS = ["0", "1", "2", "3", "4"]
 
 
 
 
 
 
63
  SP_TEXT_COLUMNS = 5
64
 
65
  # BSO Constants:
@@ -71,7 +91,10 @@ BSO_VALID_NAME = 'valid.txt'
71
  BSO_TEST_NAME = 'test.txt'
72
  BSO_DATA_DIR = 'data/BSO'
73
  BSO_DIRS = {BSOARXIV: 'arxiv', BSOROCSTORY: 'rocstory', BSOWIKI: 'wiki'}
74
- BSO_LABELS = ["0", "1"]
 
 
 
75
  BSO_TEXT_COLUMNS = 2
76
 
77
  # DC Constants:
@@ -82,10 +105,12 @@ DC_VALID_NAME = 'valid.txt'
82
  DC_TEST_NAME = 'test.txt'
83
  DC_DATA_DIR = 'data/DC'
84
  DC_DIRS = {DCCHAT: 'chat', DCWIKI: 'wiki'}
85
- DC_LABELS = ["0", "1"]
 
 
 
86
  DC_TEXT_COLUMNS = 6
87
 
88
-
89
  # RST Constants:
90
  RST = 'RST'
91
  RST_TRAIN_NAME = 'RST_TRAIN.pkl'
 
1
  # General Constants:
2
  LABEL_NAME = 'label'
3
+ numbers = {
4
+ 1: "first",
5
+ 2: "second",
6
+ 3: "third",
7
+ 4: "fourth",
8
+ 5: "fifth",
9
+ 6: "sixth",
10
+ 7: "seventh",
11
+ 8: "eighth",
12
+ 9: "ninth"
13
+
14
+ }
15
+ TEXT_COLUMN_NAME = [f"{numbers[i]}_sentence" for i in range(1, 10)]
16
 
17
  # SSPabs Constants:
18
  SSPABS = 'SSPabs'
 
20
  SSPABS_VALID_NAME = 'valid.txt'
21
  SSPABS_TEST_NAME = 'test.txt'
22
  SSPABS_DATA_DIR = 'data/SSP/abs'
23
+ SSPABS_LABELS = {
24
+ "0": "Does not belong to abstract",
25
+ "1": "Belongs to abstract",
26
+ }
27
  SSPABS_TEXT_COLUMNS = 1
28
 
29
  # PDTB Constants:
 
64
  PDTB_E_TEXT_COLUMNS = 2
65
  PDTB_I_TEXT_COLUMNS = 2
66
 
 
67
  # SP Constants:
68
  SPARXIV = 'SParxiv'
69
  SPROCSTORY = 'SProcstory'
 
73
  SP_TEST_NAME = 'test.txt'
74
  SP_DATA_DIR = 'data/SP'
75
  SP_DIRS = {SPARXIV: 'arxiv', SPROCSTORY: 'rocstory', SPWIKI: 'wiki'}
76
+ SP_LABELS = {
77
+ "0": 'First sentence',
78
+ "1": 'Second sentence',
79
+ "2": 'Third sentence',
80
+ "3": "Fourth sentence",
81
+ "4": "Fifth sentence",
82
+ }
83
  SP_TEXT_COLUMNS = 5
84
 
85
  # BSO Constants:
 
91
  BSO_TEST_NAME = 'test.txt'
92
  BSO_DATA_DIR = 'data/BSO'
93
  BSO_DIRS = {BSOARXIV: 'arxiv', BSOROCSTORY: 'rocstory', BSOWIKI: 'wiki'}
94
+ BSO_LABELS = {
95
+ "0": 'Incorrect order',
96
+ "1": 'Correct order',
97
+ }
98
  BSO_TEXT_COLUMNS = 2
99
 
100
  # DC Constants:
 
105
  DC_TEST_NAME = 'test.txt'
106
  DC_DATA_DIR = 'data/DC'
107
  DC_DIRS = {DCCHAT: 'chat', DCWIKI: 'wiki'}
108
+ DC_LABELS = {
109
+ "0": "Incoherent",
110
+ "1": "Coherent",
111
+ }
112
  DC_TEXT_COLUMNS = 6
113
 
 
114
  # RST Constants:
115
  RST = 'RST'
116
  RST_TRAIN_NAME = 'RST_TRAIN.pkl'