Package io.goobi.viewer.model.annotation
Class AltoAnnotationBuilder
java.lang.Object
io.goobi.viewer.model.annotation.AltoAnnotationBuilder
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumerates the ALTO document hierarchy levels at which annotations can be generated, from a full page down to individual words. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionde.intranda.api.annotation.AbstractAnnotationcreateAnnotation(de.intranda.digiverso.ocr.alto.model.superclasses.GeometricData element, String pi, Integer pageNo, de.intranda.api.annotation.IResource canvas, boolean urlOnlyTarget) createAnnotation.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.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.
-
Constructor Details
-
AltoAnnotationBuilder
- Parameters:
urls- the URL manager for building annotation API pathsformat- 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 extractedpi- persistent identifier of the digitized workpageNo- physical page number within the worktarget- the IIIF canvas resource used as annotation targetgranularity- level of text elements to generate annotations forurlOnlyTarget- 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 annotationspi- persistent identifier of the digitized workpageNo- physical page number within the worktarget- the IIIF canvas resource used as annotation targeturlOnlyTarget- 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 contentpi- persistent identifier of the digitized workpageNo- physical page number within the workcanvas- IIIF canvas resource to annotateurlOnlyTarget- if true, use URI-only specific resources as annotation targets- Returns:
- the annotation created from the given ALTO element, targeting the specified canvas
-