@@ -152,14 +152,18 @@ def match_metric(metric, tables, value):
152
152
]
153
153
154
154
155
+ def empty_celltags_like (table ):
156
+ return = pd .DataFrame ().reindex_like (table ).fillna ('' )
157
+
158
+
155
159
def mark_with_best_comparator (task_name , dataset_name , metric_name , arxiv_id , table , values ):
156
160
max_hits = 0
157
161
best_tags = None
158
162
rows , cols = table .shape
159
163
160
164
for comparator in comparators :
161
165
hits = 0
162
- cell_tags = pd . DataFrame (). reindex_like ( table ). fillna ( '' )
166
+ cell_tags = empty_celltags_like ( table )
163
167
for col in range (cols ):
164
168
for row in range (rows ):
165
169
for val in table .iloc [row , col ]:
@@ -180,15 +184,36 @@ def mark_with_best_comparator(task_name, dataset_name, metric_name, arxiv_id, ta
180
184
best_tags = cell_tags
181
185
182
186
return best_tags
187
+
188
+
189
+ def normalize_string (s ):
190
+ return s .lower .strip ()
191
+
192
+
193
+ def match_str (a , b ):
194
+ return normalize_string (a ) == normalize_string (b )
195
+
196
+
197
+ def mark_strings (table , tags , values ):
198
+ cell_tags = empty_celltags_like (table )
199
+ beg , end = tags
200
+ rows , cols = table .shape
201
+ for col in range (cols ):
202
+ for row in range (rows ):
203
+ for s in values :
204
+ real = table .iloc [row , col ]
205
+ if match_str (real , s ):
206
+ cell_tags += f"{ beg } { s } { end } "
207
+ return cell_tags
183
208
184
209
185
210
metatables = {}
186
211
def match_many (output_dir , task_name , dataset_name , metric_name , tables , values ):
187
212
for arxiv_id in tables :
188
213
for table in tables [arxiv_id ]:
189
214
best = mark_with_best_comparator (task_name , dataset_name , metric_name , arxiv_id , tables [arxiv_id ][table ], values )
215
+ global metatables
190
216
if best is not None :
191
- global metatables
192
217
key = (arxiv_id , table )
193
218
if key in metatables :
194
219
metatables [key ] += best
0 commit comments