Plug in API Live Attributes - czcorpus/kontext GitHub Wiki

Plug-ins / [live_attributes]

  • interface: plugins.abstract.live_attributes.AbstractLiveAttributes
  • type: optional
  • client-side code: yes

This is an optional plug-in allowing user to obtain all the attribute values (aka "text types") according to some existing attribute subset selection.

Let's say you have the following structural element defined in your corpus::

<doc translated="[true|false]" author="[name of the author]" type="[poetry|fiction]">

Let's also assume you have no translated fiction works in your corpus and you pass a query:

{ "doc.type": "fiction" }

The plug-in should return valid values of all other attributes as found in structural elements where doc.type == 'fiction' (your passed values should be included too). Your answer may look like the following example:

{
    "doc.type": ["fiction"],
    "doc.translated": ["false"],
    "doc.author": ["Isaac Asimov", "..." , "Émile Zola"]
}

This makes text type selection much easier as user does not have to know the exact relationship between miscellaneous text type categories.

:construction: