Unable to create Custom key mappings for textcat.manual recipe

I em extending the 101 on text classification, using this example to add custom key mappings;

Custom keyboard shortcuts for labels NEW: 1.9.4

I am trying to map labels to single keys by creating prodigy.json as follows:

  "keymap": {
      "accept": ["o", "a"],
      "reject": ["k", "x"],
      "save": ["command+space"]
  "keymap_by_label": {"Technology":"1","Politics":"2","Economy":"3","Entertainment":"4"}

and then running

prodigy textcat.manual news_topics ./news_headlines.jsonl --label Technology,Politics,Economy,Entertainment

but in the web interface, pressing 1/2/3/4 do not result in any of my classification labels being selected.

If I do something similar using the ner.manual recipe instead i can choose my NER tag using 1/2/3/4, but is there any reason why I cant do this with text-classication labels?

For some reason, if I use

"keymap_by_label": {"Technology":"t","Politics":"p","Economy":"e","Entertainment":"a"}

instead, then in the UI, if I press 1/2/3/4 then appropriate category is selected, but pressing t does not result in "technology" being selected. This behaviour is not observed for ner.manual.

I am getting the behaviour I want, but the documentation is a bit confusing.

Hi! Sorry if the docs were a bit confusing here, we should probably make it more clear that the choice interface currently only uses the order of the options, so if you want the first option to be selectable by pressing t, you'd set "1": "t" in your custom keymap.

I'll also mark this as enhancement, because it would be nice to also allow customising the shortcuts by the "id" value of the option instead, and then use the per-number shortcuts as the fallback, to still allow a custom sequence that applies to all choice options.

Understood - thank you for clarifying that.
Is there a typo in your response?

if you want the first option to be selectable by pressing T, you'd set "1": "t" in your custom keymap

should be what you meant?

Yes, thanks, edited :sweat_smile: