Annotation PRO Format Library

Library to read and write Annotation Pro files

License

License

Categories

Categories

ORM Data
GroupId

GroupId

org.annotationpro
ArtifactId

ArtifactId

annotationpro-format
Last Version

Last Version

1.2
Release Date

Release Date

Type

Type

jar
Description

Description

Annotation PRO Format Library
Library to read and write Annotation Pro files
Project URL

Project URL

http://annotationpro.org
Source Code Management

Source Code Management

https://github.com/annotationpro/annotationpro-format-java

Download annotationpro-format

How to add to project

<!-- https://jarcasting.com/artifacts/org.annotationpro/annotationpro-format/ -->
<dependency>
    <groupId>org.annotationpro</groupId>
    <artifactId>annotationpro-format</artifactId>
    <version>1.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.annotationpro/annotationpro-format/
implementation 'org.annotationpro:annotationpro-format:1.2'
// https://jarcasting.com/artifacts/org.annotationpro/annotationpro-format/
implementation ("org.annotationpro:annotationpro-format:1.2")
'org.annotationpro:annotationpro-format:jar:1.2'
<dependency org="org.annotationpro" name="annotationpro-format" rev="1.2">
  <artifact name="annotationpro-format" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.annotationpro', module='annotationpro-format', version='1.2')
)
libraryDependencies += "org.annotationpro" % "annotationpro-format" % "1.2"
[org.annotationpro/annotationpro-format "1.2"]

Dependencies

compile (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

annotationpro-format-java

Java library to save annotation in Annotation Pro format.

Import using Maven

<dependencies>
    <dependency>
        <groupId>org.annotationpro</groupId>
        <artifactId>annotationpro-format</artifactId>
        <version>1.2</version>
    </dependency>
</dependencies>

Write annotation example

        // annotation model
        Annotation annotation = new Annotation(44100);

        // new layer
        Layer layer = new Layer("Example layer");
        layer.setFontSize(12);
        annotation.getLayers().add(layer);

        // new segments
        Segment segment = new Segment("word", 100, 44100);
        layer.getSegments().add(segment);

        Segment segment2 = new Segment("phrase", 52000, 44100);
        layer.getSegments().add(segment2);

        // serialization
        AnnotationSerializer annotationSerializer = new AnnotationSerializer();
        String antxContent = annotationSerializer.serializeAnnotation(annotation);

        // save to file
        try {
            Path file = Paths.get("c:\\annotation new.antx");
            Files.write(file, antxContent.getBytes());
        } catch (IOException e) {
            e.printStackTrace();
        }

Read annotation example

try {
    // read from file
    Path file = Paths.get("c:\\annotation new.antx");
    String xmlContent = new String(Files.readAllBytes(file));

    // deserialize annotation
    AnnotationDeserializer annotationDeserializer = new AnnotationDeserializer();
    Annotation annotation = annotationDeserializer.deserializeAnnotation(xmlContent);

    // get first layer and first segment on this layer
    Layer layer = annotation.getLayers().get(0);
    Segment segment = layer.getSegments().get(0);

} catch (Exception e) {
    e.printStackTrace();
}
org.annotationpro

Annotation Pro Devs

Annotation Pro Developers Group

Versions

Version
1.2
1.1
1.0