Skip to content

Schema

meganno_client.schema.Schema

The Schema class defines an annotation schema for a project.

Attributes:

Name Type Description
__service object

Service object for the connected project.

set_schemas(schemas=None)

Set a user-defined schema

Parameters:

Name Type Description Default
schemas dict

Schema of annotation task which defines a label_schema which is a list of Python dictionaries defining the name of the label, the level of the label and options which defines a list of valid label options

Full Example:

{
    "label_schema": [
        {
            "name": "sentiment",
            "level": "record",
            "options": [
                {
                    "value": "pos",
                    "text": "positive"
                },
                {
                    "value": "neg",
                    "text": "negative"
                }
            ]
        },

    ]
}

None

Raises:

Type Description
Exception

If response code is not successful

Returns:

Name Type Description
response json

A json of the response

value(active=None)

Get project schema

Parameters:

Name Type Description Default
active bool

If True, only retrieve the active(latest) schema; if False, retrieve all previous schema; if None, retrieve full history.

None

get_active_schemas()

Get the active schema for the project.

get_history()

Get the full history of project schemas