Package nzilbb.ag.automation.util
Class Annotate
- java.lang.Object
-
- nzilbb.util.CommandLineProgram
-
- nzilbb.ag.automation.util.Annotate
-
@ProgramDescription(value="Utility for running a given annotator over transcript files", arguments="transcript-file ...") public class Annotate extends CommandLineProgram
Command-line utility for running a given annotator on a given set of transcript files.- Author:
- Robert Fromont robert@fromont.net.nz
-
-
Constructor Summary
Constructors Constructor Description Annotate()Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Graph[]annotate(Graph[] graphs)Annotate the given graph.Graph[]deserialize(File transcript)Deserializes the given transcript.FilegetAnnotator()Getter forannotator: Annotator .jar file.BooleangetDebug()Getter fordebug: Whether to print debug tracing.StringgetOutputSuffix()Getter foroutputSuffix: Suffix for adding to the file name of input transcripts in order to determine the annotated transcript file name.FilegetSerialization()Getter forserialization: Serialization .jar file that implements both GraphSerializer and GraphDeserializer.BooleangetStdout()Getter forstdout: Write annotated output to stdout instead of to a file.voidinit()Initialize the deserializer, annotator, and serializer.voidinitAnnotator()Initializes the annotator.voidinitDeserializer()Initializes the deserializer.voidinitSchema()Initializes the schema.voidinitSerializer()Initializes the serializer.static voidmain(String[] argv)Command-line entrypointvoidserialize(Graph[] graphs, File destination)Serialize the given graph to a given file name.AnnotatesetAnnotator(File newAnnotator)Setter forannotator: Annotator .jar file.AnnotatesetDebug(Boolean newDebug)Setter fordebug: Whether to print debug tracing.AnnotatesetOutputSuffix(String newOutputSuffix)Setter foroutputSuffix: Suffix for adding to the file name of input transcripts in order to determine the annotated transcript file name.AnnotatesetSerialization(File newSerialization)Setter forserialization: Serialization .jar file that implements both GraphSerializer and GraphDeserializer.AnnotatesetStdout(Boolean newStdout)Setter forstdout: Write annotated output to stdout instead of to a file.voidstart()Start processing the transcripts-
Methods inherited from class nzilbb.util.CommandLineProgram
error, error, getUsage, getV, getVersion, interpretPropertiesParameters, message, processArguments, setUsage, setV, setVersion, warning, warning
-
-
-
-
Method Detail
-
main
public static void main(String[] argv)
Command-line entrypoint
-
getAnnotator
public File getAnnotator()
Getter forannotator: Annotator .jar file.- Returns:
- Annotator .jar file.
-
setAnnotator
@Switch(value="Annotator .jar for the annotation task", compulsory=true) public Annotate setAnnotator(File newAnnotator)
Setter forannotator: Annotator .jar file.- Parameters:
newAnnotator- Annotator .jar file.
-
getSerialization
public File getSerialization()
Getter forserialization: Serialization .jar file that implements both GraphSerializer and GraphDeserializer.- Returns:
- Serialization .jar file that implements both GraphSerializer and GraphDeserializer.
-
setSerialization
@Switch(value="Serialization .jar for the transcript format conversion", compulsory=true) public Annotate setSerialization(File newSerialization)
Setter forserialization: Serialization .jar file that implements both GraphSerializer and GraphDeserializer.- Parameters:
newSerialization- Serialization .jar file that implements both GraphSerializer and GraphDeserializer.
-
getOutputSuffix
public String getOutputSuffix()
Getter foroutputSuffix: Suffix for adding to the file name of input transcripts in order to determine the annotated transcript file name.Default is
-annotated
.- Returns:
- Suffix for adding to the file name of input transcripts in order to determine the annotated transcript file name.
-
setOutputSuffix
@Switch("Suffix for output transcript files") public Annotate setOutputSuffix(String newOutputSuffix)
Setter foroutputSuffix: Suffix for adding to the file name of input transcripts in order to determine the annotated transcript file name.- Parameters:
newOutputSuffix- Suffix for adding to the file name of input transcripts in order to determine the annotated transcript file name.
-
getStdout
public Boolean getStdout()
Getter forstdout: Write annotated output to stdout instead of to a file. Default is false.- Returns:
- Write annotated output to stdout instead of to a file. Default is false.
-
setStdout
@Switch("Write annotated output to stdout instead of to a file") public Annotate setStdout(Boolean newStdout)
Setter forstdout: Write annotated output to stdout instead of to a file. Default is false.- Parameters:
newStdout- Write annotated output to stdout instead of to a file.
-
getDebug
public Boolean getDebug()
Getter fordebug: Whether to print debug tracing.- Returns:
- Whether to print debug tracing.
-
setDebug
@Switch("Print debug tracing") public Annotate setDebug(Boolean newDebug)
Setter fordebug: Whether to print debug tracing.- Parameters:
newDebug- Whether to print debug tracing.
-
init
public void init() throws IOException, ClassNotFoundException, InvalidConfigurationExceptionInitialize the deserializer, annotator, and serializer.- Throws:
IOException- If a jar file could not be opened.ClassNotFoundException- If an implementing class is not found.InvalidConfigurationException- If the annator has no default configuration.
-
start
public void start() throws TransformationException, SerializationException, IOException, SerializerNotConfiguredException, SerializationParametersMissingExceptionStart processing the transcripts
-
initSchema
public void initSchema()
Initializes the schema.
-
initAnnotator
public void initAnnotator() throws ClassNotFoundException, IOException, InvalidConfigurationExceptionInitializes the annotator.- Throws:
IOException- If the jar file could not be opened.ClassNotFoundException- If an implementing class is not found.InvalidConfigurationException- If the annator has no default configuration.
-
initDeserializer
public void initDeserializer() throws IOExceptionInitializes the deserializer.- Throws:
IOException- If the jar file could not be opened.
-
initSerializer
public void initSerializer() throws IOExceptionInitializes the serializer.- Throws:
IOException- If the jar file could not be opened.
-
deserialize
public Graph[] deserialize(File transcript) throws SerializationException, IOException, SerializerNotConfiguredException, SerializationParametersMissingException
Deserializes the given transcript.- Parameters:
transcript- The transcript file.- Returns:
- The graph represented by the transcript file.
- Throws:
SerializationExceptionIOExceptionSerializerNotConfiguredExceptionSerializationParametersMissingException
-
annotate
public Graph[] annotate(Graph[] graphs) throws TransformationException
Annotate the given graph.- Parameters:
graphs- The graphs to annotate.- Returns:
- The annotated graphs.
- Throws:
TransformationException
-
serialize
public void serialize(Graph[] graphs, File destination) throws IOException, SerializationParametersMissingException, SerializerNotConfiguredException
Serialize the given graph to a given file name.- Parameters:
graphs- The graphs to save.destination- The destination file name to use.- Throws:
IOException- If the file(s) can't be written.SerializationParametersMissingException- If the serializer needs more information.SerializerNotConfiguredException- If the serializer has not been configured.
-
-