Closed ArvinZhuang closed 2 years ago
Hi @ArvinZhuang
The original design was to try to avoid keeping everything in memory, when possible. E.g., in case qrels or run files were super big. As a result, read_trec_qrels
actually returns an iterator over the file. So after the first time you consume it, it's gone. If you want to load it all into memory, you can wrap it in the list
constructor:
qrels = list(ir_measures.read_trec_qrels('qrel.txt'))
Now, in practice, most of the measure provides actually load up the entire run/qrels into memory internally anyway. So I may just reconsider the above design decision.
Does this resolve your issue?
Hi @seanmacavaney, yes this solves my issue, and I think your design makes sense. Thank you!
Hi, I found that using
ir_measures.read_trec_qrels
to read a trec qrel file and do multi-time evaluations will only work for the first evaluation but give nan for laters.For example my
qrel.txt
is:and run the following code:
this gives:
this is however fine if I define the qrel myself as a dictionary: