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.File
getAnnotator()
Getter forannotator
: Annotator .jar file.Boolean
getDebug()
Getter fordebug
: Whether to print debug tracing.String
getOutputSuffix()
Getter foroutputSuffix
: Suffix for adding to the file name of input transcripts in order to determine the annotated transcript file name.File
getSerialization()
Getter forserialization
: Serialization .jar file that implements both GraphSerializer and GraphDeserializer.Boolean
getStdout()
Getter forstdout
: Write annotated output to stdout instead of to a file.void
init()
Initialize the deserializer, annotator, and serializer.void
initAnnotator()
Initializes the annotator.void
initDeserializer()
Initializes the deserializer.void
initSchema()
Initializes the schema.void
initSerializer()
Initializes the serializer.static void
main(String[] argv)
Command-line entrypointvoid
serialize(Graph[] graphs, File destination)
Serialize the given graph to a given file name.Annotate
setAnnotator(File newAnnotator)
Setter forannotator
: Annotator .jar file.Annotate
setDebug(Boolean newDebug)
Setter fordebug
: Whether to print debug tracing.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.Annotate
setSerialization(File newSerialization)
Setter forserialization
: Serialization .jar file that implements both GraphSerializer and GraphDeserializer.Annotate
setStdout(Boolean newStdout)
Setter forstdout
: Write annotated output to stdout instead of to a file.void
start()
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, InvalidConfigurationException
Initialize 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, SerializationParametersMissingException
Start processing the transcripts
-
initSchema
public void initSchema()
Initializes the schema.
-
initAnnotator
public void initAnnotator() throws ClassNotFoundException, IOException, InvalidConfigurationException
Initializes 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 IOException
Initializes the deserializer.- Throws:
IOException
- If the jar file could not be opened.
-
initSerializer
public void initSerializer() throws IOException
Initializes 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:
SerializationException
IOException
SerializerNotConfiguredException
SerializationParametersMissingException
-
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.
-
-