I'm currently playing around with Prodigy's JavaScript API and ran into a problem when using the update(...)
function. The documentation says that it will trigger a shallow merge of the current task object. Since the frontend is based on React/Redux and I get back the corresponding UPDATE_TASK
action object, I was expecting the UI to re-render based on the state update I provided, but this was not the case.
I'm running the latest Prodigy version and am using the ner_manual
interface, my goal was to play around with other methods for adding the entity spans. Unfortunately not getting visual feedback for the updated span state is kind of a dealbreaker for that
I'm updating the spans on the current task like this:
prodigy.update({
spans: [
...prodigy.content.spans,
{ start: 0, end: 5, token_start: 0, token_end: 0,
label: 'PER' }
]})
This will return the corresponding Redux action (UPDATE_TASK
) with the correct data, and prodigy.content
also contains the updated task. However, the UI does not seem to re-render. It also seems that the update corrupted the state, since I can now also no longer add a span on the token targeted by my custom span via the regular interface. If I then add another span via the regular interface, the span I added via update
disappears again, but I'm still not able to click-select a span to the token targeted by it.