AmenRa / ranx

⚡️A Blazing-Fast Python Library for Ranking Evaluation, Comparison, and Fusion 🐍

Home Page:https://amenra.github.io/ranx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request] infer run/qrels format from file extension in `from_file`

PaulLerner opened this issue · comments

Is your feature request related to a problem? Please describe.
I think it’s quite frustrating to have to specify the format of qrels/run (TREC or JSON). I often get exceptions if I forget to specify the 'trec' format because JSON is default.

Describe the solution you'd like
You could infer the format from the file extension: if .json then JSON else TREC. I can open a PR if you’re interested :)

Hi Paul,

I agree with you, and I thought about it in the past.

However, I plan to have a custom JSON-based file for Runs (in addition to those already supported) and using the sole file extension would not be enough/safe to infer the input file type.
So, do not bother opening a PR, as your code could be changed soon after.

I will add the requested feature in the upcoming weeks for sure!

Best,

Elias

Added in 0.2.9.
Works with both save and from_file.
kind now can be used to override the default behaviour.