Default selected label in NER_manual

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
        defaultLabel.click()  // simulate click
        prevHash = task._task_hash
    }
})
1 Like