asahi417's picture
README
5c5c1ed
raw
history blame contribute delete
615 Bytes
import pandas as pd
from datasets import load_dataset
data = load_dataset('relbert/semeval2012_relational_similarity_v3')
stats = []
for k in data.keys():
for i in data[k]:
stats.append(
{
'relation_type': i['relation_type'],
'split': k,
'positives': len(i['positives']),
'negatives': len(i['negatives']),
'level': i['level']
})
df = pd.DataFrame(stats)
g = df.groupby(['relation_type', 'level', 'split']).sum()
g.to_csv('stats.csv')
with open('stats.md', 'w') as f:
f.write(g.to_markdown())