Class AltoAnnotationBuilder

java.lang.Object
io.goobi.viewer.model.annotation.AltoAnnotationBuilder

public class AltoAnnotationBuilder extends Object
Creates an AnnotationList of TextualResources from the content of an ALTO document.

Depending on selected granularity, it is either one annotation per page, per TextBlock, per line or per word

Author:
Florian Alpers
  • Constructor Details

    • AltoAnnotationBuilder

      public AltoAnnotationBuilder(AbstractApiUrlManager urls, String format)
      Parameters:
      urls - the URL manager for building annotation API paths
      format - the annotation format, e.g. "oa" for OpenAnnotation or "wa" for WebAnnotation
  • Method Details

    • createAnnotations

      public List<de.intranda.api.annotation.AbstractAnnotation> createAnnotations(de.intranda.digiverso.ocr.alto.model.structureclasses.Page alto, String pi, Integer pageNo, de.intranda.api.annotation.IResource target, AltoAnnotationBuilder.Granularity granularity, boolean urlOnlyTarget)
      createAnnotations.
      Parameters:
      alto - parsed ALTO page from which annotations are extracted
      pi - persistent identifier of the digitized work
      pageNo - physical page number within the work
      target - the IIIF canvas resource used as annotation target
      granularity - level of text elements to generate annotations for
      urlOnlyTarget - if true, use URI-only specific resources as annotation targets
      Returns:
      a list of IIIF annotations generated from the ALTO text elements of the given granularity
    • createAnnotations

      public List<de.intranda.api.annotation.AbstractAnnotation> createAnnotations(List<de.intranda.digiverso.ocr.alto.model.superclasses.GeometricData> elements, String pi, Integer pageNo, de.intranda.api.annotation.IResource target, boolean urlOnlyTarget)
      createAnnotations.
      Parameters:
      elements - list of ALTO geometric elements to convert to annotations
      pi - persistent identifier of the digitized work
      pageNo - physical page number within the work
      target - the IIIF canvas resource used as annotation target
      urlOnlyTarget - if true, use URI-only specific resources as annotation targets
      Returns:
      a list of IIIF annotations generated from the given ALTO geometric elements
    • createAnnotation

      public de.intranda.api.annotation.AbstractAnnotation createAnnotation(de.intranda.digiverso.ocr.alto.model.superclasses.GeometricData element, String pi, Integer pageNo, de.intranda.api.annotation.IResource canvas, boolean urlOnlyTarget)
      createAnnotation.
      Parameters:
      element - ALTO geometric element providing bounds and text content
      pi - persistent identifier of the digitized work
      pageNo - physical page number within the work
      canvas - IIIF canvas resource to annotate
      urlOnlyTarget - if true, use URI-only specific resources as annotation targets
      Returns:
      the annotation created from the given ALTO element, targeting the specified canvas