is there a slider interface?

I'm starting a sentiment annotation workflow -- often it is useful to have a slider for things like sentiment, I was looking through the annotation interfaces list here: https://prodi.gy/docs/api-interfaces, I can't find a slider. Can you confirm if there is no slider, or point me to it if it exists?

Thank you.

Hi! There's not currently a slider interface, no. If you want to use values on a scale, you could set them up as choice options. This also gives you keyboard shortcuts out-of-the-box, so you can just press 1 for 1, and so on.

Alternatively, you can also easily add your own slider with the html interface and a JavaScript function that adds the selected value to the current task. Here's an example:

<input type="range" id="slider" min="1" max="5" onChange="handleChange(this)" />
function handleChange(slider) {
    window.prodigy.update({ value: slider.value })  // will add key "value"
}
1 Like

I see, thank you!

Thank you for the tip here. Is there any example somewhere, or can you give more details? I don't know how to add this to the textcat.manual recipe, or how to add the html to options.

You can add the HTML code as the "html" of the incoming data, or via the "html_template". The JavaScript code can be added via the "javascript" key returned by the "config" of the recipe. See here for details: https://prodi.gy/docs/custom-interfaces#html

Here's an example of how to combine multiple interfaces, e.g. "text", "options" and "html": https://prodi.gy/docs/custom-interfaces

ok, that part makes sense - but I can't find the textcat.manual recipe in the prodigy-recipes repo (GitHub - explosion/prodigy-recipes: 🍳 Recipes for the Prodigy, our fully scriptable annotation tool) -- how I have been editing recipes so far is that I just copy paste the recipe from that repo, and then edit it.

Is there a way I can modify a recipe without doing that, by importing it?

Hi - sorry to bother, can you please help me understand how to add this to the textcat.manual recipe? Thank you.

Hi @mumud123 :slight_smile:

I think the way to go here is to create a custom recipe with a custom interface, completely independent of the existing textcat recipes. The HTML and JS Ines provided would be the actual core components. You can add the text of the current task into the HTML you're displaying via standard templating syntax, too -- you can read up on that on the custom interfaces page Ines linked. The whole system is super easy and flexible once you get the hang of it. You can read up on the basics here: https://prodi.gy/docs/custom-recipes

If you feel lost, I'd suggest you begin by looking at one of the sample recipes that use the html view. For example, the question answering example might help you get started.

2 Likes