I am implementing code in Google Colaboratory where I'm trying to reach 2 types of files (see picture) to use trec_eval.
I so far have the following code:
from pathlib import Path
import os
def get_p(qrels_files, results_files):
list_p = []
for folder in (qrels_files, results_files):
p = os.popen(f"./trec_eval P.20 {qrels_files} {results_files}").read()
list_p.append(p)
return list_p
path = "/content/drive/MyDrive/data/classes"
qrels_files = Path(path).glob("*/qrel*_N.txt")
results_files = Path(path).glob("*/results*_N.txt")
get_p(qrels_files, results_files)
I'm trying to get the "qrel(insert number)_N" and the "results(insert number)_N" files from all the directories I have and I'm implementing the evaluation measure in trec_eval inside the for loop so that, that way, the measure can be executed for every class (class=folder where the qrels and results files are). After the measures are done, they are stored in the lists assigned to every measure so that, after, I would use said lists in a Pandas DataFrame.
However, when I execute the code, this happens:
['', '']
The issue is related to the way I access the files and insert them in trec_eval. Any tips to what might be exactly?
