ActiveAnno

Web-based responsive document annotation tool

View the Project on GitHub MaxMello/ActiveAnno

activeannoservice / annotationdefinition.generator / AnnotationGenerator

AnnotationGenerator

abstract class AnnotationGenerator

Base class for AnnotationGenerators. An annotation generator is responsible for automatically generating an annotation value, optionally with a probability attached, for a specific annotation definition. This can be used for statistical methods, simple if-else annotation (for example: if value in list of values, annotate with X), or for machine learning integration.

Constructors

Name Summary
<init> Base class for AnnotationGenerators. An annotation generator is responsible for automatically generating an annotation value, optionally with a probability attached, for a specific annotation definition. This can be used for statistical methods, simple if-else annotation (for example: if value in list of values, annotate with X), or for machine learning integration.AnnotationGenerator(id: String, annotationDefinitionID: String, targetType: TargetType, name: String, description: String, input: AnnotationStepKey, finalizeCondition: FinalizeCondition = FinalizeCondition.Always, createdTimestamp: Long = System.currentTimeMillis())

Properties

Name Summary
annotationDefinitionID val annotationDefinitionID: String
createdTimestamp val createdTimestamp: Long
description var description: String
finalizeCondition var finalizeCondition: FinalizeCondition
id val id: String
input We need to define the input to an AnnotationGenerator directly here, because a single AnnotationGenerator can be shared by multiple projects. For prediction, a generator is always in context of a specific project, but for updating it, it is not.var input: AnnotationStepKey
name var name: String
targetType val targetType: TargetType

Functions

Name Summary
generateAnnotation abstract suspend fun generateAnnotation(document: Document, generatedAnnotationData: GeneratedAnnotationData): Annotation<*>
generateAnnotationBulk Open function to generate annotations in bulk, might be more efficient. By default, just iterates through documentsWithGeneratedAnnotationData and calls generateAnnotation for each. Can be overwritten to implement true bulk behavior.open suspend fun generateAnnotationBulk(documentsWithGeneratedAnnotationData: List<Pair<Document, GeneratedAnnotationData>>): Map<Document, Annotation<*>>
updateModel Call this to update the mutable fields of an AnnotationGeneratoropen fun updateModel(newAnnotationGenerator: AnnotationGenerator): Unit

Inheritors

Name Summary
DetectedLanguageGenerator AnnotationGenerator which detects the language using the “Lingua” library, storing the annotation under the defined key as the ISO 639-1 Code (in upper case). The “unknown” key from Lingua is defined as the string “UNKNOWN”class DetectedLanguageGenerator : AnnotationGenerator
TagSetDocumentTargetGeneratorModel Use this class for external ML models which are already trained and don’t need any training dataclass TagSetDocumentTargetGeneratorModel : AnnotationGenerator
UpdatableAnnotationGenerator Base class for AnnotationGenerators which are updatable, for example ML models, as compared to static models like a statistics based generatorabstract class UpdatableAnnotationGenerator : AnnotationGenerator