How can I deselect a label with the textcat.correct recipe?

Looking at the documentation, I see that there is an argument to "accept empty", but with textcat.correct, an option is often pre-selected. These are radio buttons (mutually-exclusive), and I don't see a way to deselect once one is clicked on. I tried pressing "0" but that just selects option "10" (makes sense).

I'm using the -ae and -UP (model in-loop) arguments.

Hi @jspinella ,

There's not really a way to undo the exclusive selection from the model. Honestly, I think this case was not contemplated when adding -ae to textcat.teach.
One thing you could do is to set the thresholdparameter to ensure that the answers are pre-selected with a high enough confidence only.
Another option would be to flag or reject/ignore these examples and handle them in postprocessing.
Yet another option would be do add an extra button for resetting the radio buttons via custom javascript. For simplicity I put all the code in javascript (you could of course get fancier and add a styled html block instead).
This should do the job, though:

const button = document.createElement('button')
button.style = `
        position: fixed;
        top: 20px;
        right: 20px;
        padding: 12px 24px;
        font-size: 18px;
        background-color: #007bff;
        color: white;
        border: none;
        border-radius: 8px;
        cursor: pointer;`;
button.textContent = "Reset"
button.addEventListener('click', () => { 
    var checkboxes = document.querySelectorAll('.prodigy-options input[type="radio"]');
    checkboxes.forEach((checkbox) => {
        checkbox.checked = false;
    });
     prodigy.update({
        accept: []
    })
})
document.body.appendChild(button)

You can pass a path to the directory with this .js file via .prodigy.json:

{
  "javascript_dir": "path_to_undo_button"
}
1 Like

Thank you Magda! Hopefully the button will be implemented in a future release- it looks like most of the work is done already. Setting a higher confidence threshold is a good option too.

1 Like