Default selected label in NER_manual

Hi @ines ,

I'm sorry if anyone already asked a similar question but I couldn't find it.
When using NER_manual to highlight entities, the default selected label seems to be:

  • the 1st label (on the left hand side) for the 1st annotation
  • the last selected label in the previous annotation for the remaining annotations

Is there a way of making the 1st label (on the left hand side) always the default selected one?

Taking an example from your documentation:

  1. When we annotate the first sentence, the default selected label is PERSON

  2. Imagine we highlight MacBook Pro as a Product, as below:

  3. We click accept and the next sentence to annotate comes up. This time, the default selected label is Product, as it was the last one to be used in the previous annotation, as below (ignore the fact that we have the same sentence).

Is there a way to change this?

Thank you in advance,

Hi! At the moment, the selected label is kept active as you navigate between annotation tasks – this can often be useful if you're mostly annotating one specific label (because you won't hav to re-select it), but I can definitely see how it can also be desirable to have it reset to the first one. I need to think about how we can best solve this via a config setting.

In the meantime, one workaround could be to use JavaScript to simulate a click on the label whenever the current example changes. You know that the example changed if the current task hash is different from the previous task hash. So you could do something like this:

let prevHash = null

document.addEventListener('prodigyupdate', event => {
    const { task } = event.detail
    // Select the label input for the given default label
    const defaultLabel = document.querySelector('input[value="PERSON"]')
    if (task._task_hash !== prevHash) {  // the displayed task has changed  // simulate click
        prevHash = task._task_hash
1 Like

Hi @ines,

Yes, I understand. A config setting would be great for people to choose between the two, I can see both options being helpful as you just mentioned. But the JavaScript is a great workaround, will try it out.

Many thanks!

1 Like