Datasets:
Upload 2 files
Browse files- DiscoEval.py +1 -1
- DiscoEvalConstants.py +179 -0
DiscoEval.py
CHANGED
@@ -439,7 +439,7 @@ class DiscoEvalSentence(datasets.GeneratorBasedBuilder):
|
|
439 |
data = pickle.load(open(filepath, "rb"))
|
440 |
for key, line in enumerate(data):
|
441 |
example = {TEXT_COLUMN_NAME[i]: sent for i, sent in enumerate(line[1:])}
|
442 |
-
example[LABEL_NAME] = RST_DATA_DIR[
|
443 |
yield key, example
|
444 |
|
445 |
else:
|
|
|
439 |
data = pickle.load(open(filepath, "rb"))
|
440 |
for key, line in enumerate(data):
|
441 |
example = {TEXT_COLUMN_NAME[i]: sent for i, sent in enumerate(line[1:])}
|
442 |
+
example[LABEL_NAME] = RST_DATA_DIR[line[0]]
|
443 |
yield key, example
|
444 |
|
445 |
else:
|
DiscoEvalConstants.py
ADDED
@@ -0,0 +1,179 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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'
|
19 |
+
SSPABS_TRAIN_NAME = 'train.txt'
|
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:
|
30 |
+
PDTB_I = 'PDTB-I'
|
31 |
+
PDTB_E = 'PDTB-E'
|
32 |
+
PDTB_TRAIN_NAME = 'train.txt'
|
33 |
+
PDTB_VALID_NAME = 'valid.txt'
|
34 |
+
PDTB_TEST_NAME = 'test.txt'
|
35 |
+
PDTB_DATA_DIR = 'data/PDTB'
|
36 |
+
PDTB_DIRS = {PDTB_E: 'Explicit', PDTB_I: 'Implicit'}
|
37 |
+
PDTB_E_LABELS = [
|
38 |
+
'Comparison.Concession',
|
39 |
+
'Comparison.Contrast',
|
40 |
+
'Contingency.Cause',
|
41 |
+
'Contingency.Condition',
|
42 |
+
'Contingency.Pragmatic condition',
|
43 |
+
'Expansion.Alternative',
|
44 |
+
'Expansion.Conjunction',
|
45 |
+
'Expansion.Instantiation',
|
46 |
+
'Expansion.List',
|
47 |
+
'Expansion.Restatement',
|
48 |
+
'Temporal.Asynchronous',
|
49 |
+
'Temporal.Synchrony',
|
50 |
+
]
|
51 |
+
PDTB_I_LABELS = [
|
52 |
+
'Comparison.Concession',
|
53 |
+
'Comparison.Contrast',
|
54 |
+
'Contingency.Cause',
|
55 |
+
'Contingency.Pragmatic cause',
|
56 |
+
'Expansion.Alternative',
|
57 |
+
'Expansion.Conjunction',
|
58 |
+
'Expansion.Instantiation',
|
59 |
+
'Expansion.List',
|
60 |
+
'Expansion.Restatement',
|
61 |
+
'Temporal.Asynchronous',
|
62 |
+
'Temporal.Synchrony',
|
63 |
+
]
|
64 |
+
PDTB_E_TEXT_COLUMNS = 2
|
65 |
+
PDTB_I_TEXT_COLUMNS = 2
|
66 |
+
|
67 |
+
# SP Constants:
|
68 |
+
SPARXIV = 'SParxiv'
|
69 |
+
SPROCSTORY = 'SProcstory'
|
70 |
+
SPWIKI = 'SPwiki'
|
71 |
+
SP_TRAIN_NAME = 'train.txt'
|
72 |
+
SP_VALID_NAME = 'valid.txt'
|
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:
|
86 |
+
BSOARXIV = 'BSOarxiv'
|
87 |
+
BSOROCSTORY = 'BSOrocstory'
|
88 |
+
BSOWIKI = 'BSOwiki'
|
89 |
+
BSO_TRAIN_NAME = 'train.txt'
|
90 |
+
BSO_VALID_NAME = 'valid.txt'
|
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:
|
101 |
+
DCCHAT = 'DCchat'
|
102 |
+
DCWIKI = 'DCwiki'
|
103 |
+
DC_TRAIN_NAME = 'train.txt'
|
104 |
+
DC_VALID_NAME = 'valid.txt'
|
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'
|
117 |
+
RST_VALID_NAME = 'RST_DEV.pkl'
|
118 |
+
RST_TEST_NAME = 'RST_TEST.pkl'
|
119 |
+
RST_DATA_DIR = 'data/RST'
|
120 |
+
RST_LABELS = [
|
121 |
+
'NS-Explanation',
|
122 |
+
'NS-Evaluation',
|
123 |
+
'NN-Condition',
|
124 |
+
'NS-Summary',
|
125 |
+
'SN-Cause',
|
126 |
+
'SN-Background',
|
127 |
+
'NS-Background',
|
128 |
+
'SN-Summary',
|
129 |
+
'NS-Topic-Change',
|
130 |
+
'NN-Explanation',
|
131 |
+
'SN-Topic-Comment',
|
132 |
+
'NS-Elaboration',
|
133 |
+
'SN-Attribution',
|
134 |
+
'SN-Manner-Means',
|
135 |
+
'NN-Evaluation',
|
136 |
+
'NS-Comparison',
|
137 |
+
'NS-Contrast',
|
138 |
+
'SN-Condition',
|
139 |
+
'NS-Temporal',
|
140 |
+
'NS-Enablement',
|
141 |
+
'SN-Evaluation',
|
142 |
+
'NN-Topic-Comment',
|
143 |
+
'NN-Temporal',
|
144 |
+
'NN-Textual-organization',
|
145 |
+
'NN-Same-unit',
|
146 |
+
'NN-Comparison',
|
147 |
+
'NN-Topic-Change',
|
148 |
+
'SN-Temporal',
|
149 |
+
'NN-Joint',
|
150 |
+
'SN-Enablement',
|
151 |
+
'SN-Explanation',
|
152 |
+
'NN-Contrast',
|
153 |
+
'NN-Cause',
|
154 |
+
'SN-Contrast',
|
155 |
+
'NS-Attribution',
|
156 |
+
'NS-Topic-Comment',
|
157 |
+
'SN-Elaboration',
|
158 |
+
'SN-Comparison',
|
159 |
+
'NS-Cause',
|
160 |
+
'NS-Condition',
|
161 |
+
'NS-Manner-Means'
|
162 |
+
]
|
163 |
+
RST_LABELS = {key: str(i) for i, key in enumerate(RST_LABELS)}
|
164 |
+
RST_TEXT_COLUMNS = 2
|
165 |
+
|
166 |
+
DATASET_NAMES = [
|
167 |
+
SSPABS,
|
168 |
+
PDTB_I,
|
169 |
+
PDTB_E,
|
170 |
+
SPARXIV,
|
171 |
+
SPROCSTORY,
|
172 |
+
SPWIKI,
|
173 |
+
BSOARXIV,
|
174 |
+
BSOROCSTORY,
|
175 |
+
BSOWIKI,
|
176 |
+
DCCHAT,
|
177 |
+
DCWIKI,
|
178 |
+
RST,
|
179 |
+
]
|