From f434710aca04312ef58235d1f58eed6865ec8af0 Mon Sep 17 00:00:00 2001 From: Martin Popel Date: Sat, 23 Mar 2024 13:15:12 +0100 Subject: [PATCH] `--list -t wmt23 -l cs-uk` should print just cs-uk, not other language pairs When omitting `-l`, `--list` will still print all the language pairs for that test set. Motivation: Originally, `--list` showed just the list of language pairs, so there was no reason to call it with `-l`, but now it lists all the **fields** for a given language pair and it is relatively slow (it has to parse the XML files), so it makes sense to restrict the listing to a single language pair only. --- sacrebleu/sacrebleu.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sacrebleu/sacrebleu.py b/sacrebleu/sacrebleu.py index d778e1d..6b7cd9e 100755 --- a/sacrebleu/sacrebleu.py +++ b/sacrebleu/sacrebleu.py @@ -242,8 +242,7 @@ def main(): if args.list: if args.test_set: - langpairs = get_langpairs_for_testset(args.test_set) - for pair in langpairs: + for pair in [args.langpair] if args.langpair else get_langpairs_for_testset(args.test_set): fields = DATASETS[args.test_set].fieldnames(pair) print(f'{pair}: {", ".join(fields)}') else: