Datasets:

Languages:
English
Size:
< 1K
ArXiv:
Libraries:
Datasets
License:
File size: 1,027 Bytes
1bb8d13
 
 
4a89ca9
1bb8d13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import pandas as pd
from datasets import load_dataset

data = load_dataset("cardiffnlp/relentless")
relation_types = [i['relation_type'] for i in data['test']]
full_stats = []
for r in relation_types:
    size = [len([i for i in data[s] if i['relation_type'] == r][0]['pairs']) for s in ['validation', 'test']]
    x = [i for i in data['validation'] if i['relation_type'] == r][0]
    pairs = sorted(zip(x['pairs'], x['ranks']), key=lambda _x: _x[1])
    top_pairs = [" / ".join(a) for a, _ in pairs[:2]]
    bottom_pairs = [" / ".join(a) for a, _ in pairs[:2]]
    middle_pairs = [" / ".join(a) for a, _ in pairs[int(len(pairs)/2)-1:int(len(pairs)/2) + 1]]
    full_stats += [{
        "relation_type": r,
        "val.": size[0],
        "test": size[1],
        "top_pairs": t,
        "middle_pairs": m,
        "bottom_pairs": b} for t, m, b in zip(top_pairs, middle_pairs, bottom_pairs)]

df = pd.DataFrame(full_stats)
print(df[["relation_type", "val.", "test"]].to_markdown(index=False))
print(df.to_latex(index=False))