Skip to content

Commit

Permalink
Update run_evaluation.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnweiwei authored Feb 24, 2024
1 parent 38c2025 commit a5fc4c9
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions run_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,9 @@
from trec_eval import EvalFunction

# Create an empty text file to write results, and pass the name to eval
output_file = tempfile.NamedTemporaryFile(delete=False).name
write_eval_file(new_results, output_file)
EvalFunction.eval(['-c', '-m', 'ndcg_cut.10', THE_TOPICS[data], output_file])
# Rename the output file to a better name
shutil.move(output_file, f'eval_{data}.txt')
temp_file = tempfile.NamedTemporaryFile(delete=False).name
EvalFunction.write_file(reranked_data, temp_file)
EvalFunction.main(THE_TOPICS[data], temp_file)


for data in ['mrtydi-ar', 'mrtydi-bn', 'mrtydi-fi', 'mrtydi-id', 'mrtydi-ja', 'mrtydi-ko', 'mrtydi-ru', 'mrtydi-sw', 'mrtydi-te', 'mrtydi-th']:
Expand Down Expand Up @@ -129,7 +127,5 @@
from trec_eval import EvalFunction

temp_file = tempfile.NamedTemporaryFile(delete=False).name
write_eval_file(new_results, temp_file)
EvalFunction.eval(['-c', '-m', 'ndcg_cut.10', THE_TOPICS[data], temp_file])
# Rename the output file to a better name
shutil.move(output_file, f'eval_{data}.txt')
EvalFunction.write_file(reranked_data, temp_file)
EvalFunction.main(THE_TOPICS[data], temp_file)

0 comments on commit a5fc4c9

Please sign in to comment.