Arethusa for Nemo API

class nemo_arethusa_plugin.Arethusa(queryinterface, *args, **kwargs)[source]

Arethusa plugin for Nemo

Note

This class inherits some routes from the base AnnotationsApiPlugin

Parameters:

queryinterface (flask_nemo.query.proto.QueryPrototype) – QueryInterface to use to retrieve annotations

Variables:
  • interface – QueryInterface used to retrieve annotations
  • HAS_AUGMENT_RENDER – (True) Adds a stack of render

The overall plugins contains three new routes (on top of AnnotationsAPIPlugin) :

  • /arethusa.deps.json which feeds informations about Arethusa assets dependencies
  • /arethusa-assets/<filename> which is a self implemented assets route.
  • /arethusa.config.json which is the config for the widget

It contains two new templates :

  • a arethusa::text.html template which overrides the original when there is treebank available
  • a arethusa::widget.tree.json template which providees the configuration for the widget

It contains a render functions which will use the arethusa::text.html instead of main::text.html if there is a treebank found within the QueryInterface

Arethusa.render(**kwargs)[source]

Render function stack.

If the template called is the main::text.html, it checks annotations from its query interface and replace it by arethusa::text.html if there is a treebank annotation

Parameters:kwargs – Dictionary of named arguments
Returns:Dictionary of named arguments
Arethusa.r_arethusa_assets(filename)[source]

Routes for assets

Parameters:filename – Filename in data/assets to retrievee
Returns:Content of the file
Arethusa.r_arethusa_dependencies()[source]

Return the json config of dependencies asked by arethusa

Returns:Json with dependencies
Arethusa.r_arethusa_config()[source]

Config JSON route for Arethusa : defines the layout and other resources

Returns:{“template”}