AmenRa / ranx

⚡️A Blazing-Fast Python Library for Ranking Evaluation, Comparison, and Fusion 🐍
https://amenra.github.io/ranx
MIT License
427 stars 23 forks source link

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

Closed PaulLerner closed 1 year ago

PaulLerner commented 2 years ago

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 :)

AmenRa commented 2 years ago

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

AmenRa commented 1 year ago

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