@octra/annotation
v0.1.16
Published
library containing annotation related classes and functions used by OCTRA (e.g. file converters)
Downloads
93
Readme
@octra/annotation
This library offers all annotation related classes and functions used by Octra. It uses AnnotJSON file format as base model. Here you can also find all Annotation converters used by Octra.
Installation
ESM, CJS, TS definitions & UMD (optional)
npm install --save @octra/annotation
UMD Bundle (for Vanilla JS)
You have two options to install this package und use it as UMD:
a) Install via NPM and reference local files (no internet connection needed om production).
<script type="application/javascript" src="node_modules/@octra/annotation/index.umd.js"></script>
b) Reference remote file (internet connection needed on production).
<script type="application/javascript" src="https://unpkg.com/@octra/annotation/index.umd.js"></script>
Use
Import
ESM, Typescript
Import the classes and functions from @octra/annotation
. For example
import { Level } from "@octra/annotation";
const annotation = new OctraAnnotation();
const level = annotation.addLevel(new OctraAnnotation.createSegmentLevel("OCTRA_1"));
annotation.addItemToCurrentLevel(new SampleUnit(123456, 22050), [
new OLabel(
"OCTRA_1",
"hello world"
)
]);
UMD Bundle
All functions and classes are available via global scope OctraAnnotation
. For example:
/*
make sure that you have injected the umd bundle as described before.
*/
const annotation = new OctraAnnotation.OctraAnnotation();
const level = annotation.addLevel(new OctraAnnotation.OctraAnnotation.createSegmentLevel("OCTRA_1"));
annotation.addItemToCurrentLevel(new OctraAnnotation.SampleUnit(123456, 22050), [
new OctraAnnotation.OLabel(
"OCTRA_1",
"hello world"
)
]);
API
You can find more information about classes and functions of @octra/annotation
here.