I'd like to use a personnal API for named entity recognition (NER), and use brat for visualisation. It seems brat offers an Automatic annotation tool, but documentation about its configuration is sparse.
Are there available working examples of this features ?
Could someone explain me what should be the format of the response of the API ?
I finally manage to understand how it works, thanks to this topic in the GoogleGroup diffusion list of BRAT
The text is sent to the Automatic Annotator API as a byte string in the body of a POST request, and the format BRAT required in response from this API is in the form of a dictionary of dictionaries, namel(
THEN, you put this dictionary in a JSON format and you send it back to BRAT.
Note :
.annfile that BRAT generates during manual annotation)I suppose that the strings in "texts" must corresponds to the "offsets", otherwise there should be an error, or at least a problem with the display of tags (this is already the case if you generate the
.annfiles from an automatic detection algorithm and have different start and stop than the associated text)I hope it helps. I managed to make the API using Flask this morning, but I needed to construct a
flask.Responseobject to get the correct output format. Also, the incoming format from BRAT to the Flask API could not be catch until I used aflask.requestobject withrequest.get_body()method.Also, I have to mention that I was not able to use the examples given in the BRAT GitHub :
I mean I could not make them working, but I'm not familiar at all with API and HTTP packages in Python. At least I figured out what was the correct format for the API response.
Finally, I have no idea how to make relations among entities (i.e. BRAT arrows) format from the API, though
seems to work with such thing.
The GoogleGroup discussion
seems to mention that it is not possible to send relations between entities back from the Automatic Annotation API and make them work with BRAT.
I may try it later :-)