alpheios-project / arethusa

Arethusa: Annotation Environment
http://sosol.perseids.org/tools/arethusa
MIT License
34 stars 26 forks source link

Widget api #790

Closed balmas closed 4 years ago

balmas commented 4 years ago

These changes add a javscript api to the Arethusa widget.

The following api calls are supported:

getMorph(sentenceId,wordId) - returns morphology for a token (in the same format as retrieved by the BSPMorphRetriever)

nextChunk() - navigates to the next chunk (sentence)

prevChunk() - navigates to the previous chunk (sentence)

gotoRef(sentenceId) - navigates to a specific chunk (sentence) id

refreshView() - rerenders the tree view

I think there is still more work to do here, particularly to see if there is a way to be sure the api isn't called until the application is fully loaded, but it generally seems to be working pretty well.

There is a corresponding change to the treebank template to use the alpheios-messaging library to call the Arethusa API. I'll be doing a PR on that repo too, and you can see it in action using the simple client at https://alpheios-project.github.io/arethusa-demo-client.

Let me know what you think!