Editable Interface , Entity Extraction

Hi all, I am trying out ner.correct.
But along with the ner I want to show a table containing the entity label as column and entities predicted as values in the interface itself. Can this be done using html template in custom recipe can anyone direct to some examples where this type of editing is done on the interface?

Hi! The underlying JSON format produced by a recipe like ner.correct will include all predicted entities as a list of "spans". So if you want to display them separately, e.g. as a table below, you could use two blocks: one ner_manual block that shows the text with the highlighted editable entities, and one html block with a html_template that renders a table based on the {{ spans }} variable, which corresponds to the spans in the data. https://prodi.gy/docs/custom-interfaces#blocks

Here's an example of using an html_template: https://prodi.gy/docs/custom-interfaces#html

You can use the example recipe in the prodigy-recipes repo as a starting point, use "view_id": "blocks" and set the blocks in the config: https://github.com/explosion/prodigy-recipes/blob/master/ner/ner_make_gold.py

The HTML template supports accessing variables in the JSON and you can also iterate over lists of objects. So you can loop through the "spans" and create one table row per span, depending on how you want to display the information: Mustache JavaScript: Looping Through Arrays of Objects Output - Stack Overflow For example, you could have a column for the text, a column for the label and optionally columns for the start and end index of the entity.