Dear Kevin,
You are correct in that the embedded visualisation page does not cover
all the features of the JSON format. In fact, I don't think that there
is a formal specification of it at this point. The server-side code
that processes the objects isn't the prettiest [1] (I think it should
have been wrapped together with the annotation objects, a note for any
future refactoring) but from what I can tell from the normalisation
specifics [2], the structure should look something like.
{
'normalizations: [
[
# Standard unique ID (N[0-9]+).
norm_ann_id,
# I am not entirely sure what the normalisation annotation
# type means, it appears not to be in use.
norm_ann_type,
# ID of the annotation to anchor the normalisation to.
norm_tgt_id,
# Database that is referenced by the annotation.
ref_db,
# ID inside of that database, used to build a URL to the
# database if I remember correctly.
ref_id,
# This should be the raw text that shows up in the UI.
ref_text
],
],
}
The corresponding normalisation unpacking code on the client side is
located here [3]. There is also a whole process of sending a database
over the wire, but I will have to delegate the answer to Sampo Pyysalo
on how exactly this work since I don't know the details very well. A
good read-up on how the normalisation works at a higher level is
available on the homepage [4], but I suspect it won't do without
diving into the code if you want to do the actual embedding.
@Sampo: I think you know the internals of the normalisation better
than me, can you fill in the details regarding the database packing?
Best regards,
Pontus Stenetorp
[1]:
https://github.com/nlplab/brat/blob/master/server/src/document.py#L671
[2]:
https://github.com/nlplab/brat/blob/master/server/src/document.py#L728
[3]:
https://github.com/nlplab/brat/blob/master/client/src/visualizer.js#L730
[4]:
http://brat.nlplab.org/normalization.html