File size: 1,081 Bytes
0f332f8 | 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 26 27 28 29 30 31 32 33 34 35 36 37 | import os
import json
import sys
import traceback
# Mock paths
PROJECT_ROOT = os.path.abspath(os.getcwd())
RESULT_DIR = os.path.join(PROJECT_ROOT, "results")
print(f"Result Dir: {RESULT_DIR}")
dataset = "Authorship"
path = os.path.join(RESULT_DIR, f"{dataset}.json")
print(f"Path: {path}")
print(f"Exists: {os.path.exists(path)}")
if os.path.exists(path):
try:
with open(path, 'r', encoding='utf-8') as f:
data = json.load(f)
print(f"Data loaded, length: {len(data)}")
# Try ranking
sys.path.append(PROJECT_ROOT)
try:
from leaderboard import rank_results
ranked = rank_results(data)
print(f"Ranked data length: {len(ranked)}")
if len(ranked) > 0:
print("First item:", ranked[0])
except Exception as e:
print(f"Ranking failed: {e}")
traceback.print_exc()
except Exception as e:
print(f"Failed to read/parse json: {e}")
else:
print("File not found!")
|