can i scroll down to the annotation?

Hello,
I am using long documents and often happen that the entity is below the fold.
Is it possible to scroll down automatically when prodigy loads the document ?

Thanks

Now that custom JavaScript is supported across all interfaces, I guess you could add a custom script that listens to prodigyupdate, then gets the first <mark> element in the annotation card and calls scrollIntoView() on it. I haven’t tested it, but it could work.

That said, Prodigy usually tries to encourage you to focus on shorter and easier-to-read texts, and split longet texts into shorter chunks. This also helps you collect annotations that the model can actually learn from.

Named entity recognition models are typically sensitive to the very local content – for instance, spaCy’s model implementation considers a window of 4 words on either side. If you cannot make the annotation decision based on the local context, the model is unlikely to learn that decision. By annotating at the sentence-level or short paragraph level, you can avoid that – and if it turns out your can’t annotate like that, you’ll find out very quickly and can go back and revise your label scheme.

thank you @ines
i have just tested the following code:

{
    "javascript": "document.addEventListener('prodigyupdate', ev => {var mark = document.getElementsByTagName('mark')[0]; mark.scrollIntoView();});"
}

It works! Thanks

1 Like

Glad it worked! If you’re using this in your global config, you might want to wrap it in a condition like if (window.prodigy.viewId == 'ner'). Otherwise, it will run on all interfaces, which might not be what you want (and could potentially cause errors).

1 Like