I would like to annotate a NER task but one that includes parsing values of selected NER (such as parsing a date etc.) - is there any recipe that would allow me to add a field to a NER span, that for each span would be fillable at the bottom of the recipe in some "blocks" like fashion?
Hi! The blocks are typically defined upfront and adding them on the fly based on the selected spans is a bit more involved/tricky.
One solution would be to do it in two steps, start by annotating the entities and then stream in one example per entity with a text_input
block (auto-populated with the span text) that you can use for the normalised value. An advantage of this approach is that it allows you to group the same entities together, sort by frequency etc. For example, depending on your data, you may end up with many entity spans "May 2020" with label DATE
and there's no need to manually enter 2020-05
(or whatever) every single time. If there are existing libraries or utilities that can help with parsing the values, you can also incorporate those more easily this way and automate parts of the work. That'd be much less viable if you had to re-compute the parsed value every time you select a span.
If you do want to have it all in one interface and add text fields on the fly for the selected spans, you could probably implement this with a custom HTML / JavaScript interface: the prodigyupdate
event is fired whenever the task is updated and window.prodigy.content.spans
lets you access the selected spans. You can then add a textarea for a given span and have it write to the current task using window.prodigy.update
on change, i.e. when you type in text.