Class Transcriber

    • Constructor Detail

      • Transcriber

        public Transcriber()
    • Method Detail

      • getDiarizationRequired

        public abstract boolean getDiarizationRequired()
        Specify whether the transcriber needs the audio to be split into utterance chunks before transcribe(File,Graph) is called.

        If the transcriber returns true when this method is called, it should assume that the participant, turn and utterance layers are populated when transcribe(File,Graph) is called, and that the utterance annotations define the start and end times of individual speaker utterances for transcription.

        If the transcriber returns false when this method is called, it should assume that the turn and utterance layers are empty when transcribe(File,Graph) is called.

      • transcribe

        public abstract Graph transcribe​(File speech,
                                         Graph transcript)
                                  throws Exception
        Transcribes the given audio file, saving the resulting transcript in the given graph.
        Parameters:
        speech - An audio file containing the speech to transcribe.
        transcript - The annotation graph that should contain the transcription.

        If the transcriber's getDiarizationRequired() returns false, the annotation graph may or may not have any annotations on the turn, utterance, and word layers. If there are existing annotations, they should be re-used if possible, or Annotation.destroy() should be called on each to ensure they're removed from the graph.

        If the transcriber's getDiarizationRequired() returns true, it should be assumed that the annotation graph has annotations on the participant, turn, and utterance layers, and that the utterance annotations define the start and end times of individual speaker utterances for transcription. In this case, the transcriber should fill in the labels of the given utterance annotations.

        Returns:
        The given graph. This should have annotations structured as follows:
        • Annotations on the participant layer, if the given transcript had no pre-existing participants.
        • Annotations on the turn layer (even if it's one big turn encompassing the whole transcript), with the parent(s) set to the corresponding participant annotations. The turn labels should match the participant labels
        • Annotations on the utterance layer, with the parent(s) set to the corresponding turn annotations. The labels should be the transcript of the utterance.
        • Optionally, new annotations on the word layer, representing individual word tokens with alignment information, if available.
        Throws:
        Exception
      • transcribeFragments

        public void transcribeFragments​(Stream<File> speech,
                                        Consumer<Graph> consumer)
                                 throws Exception
        Transcribes all audio files in the given stream.

        Implementors may override this to provide more efficient processing in cases where overhead can be saved by invoking a recogniser only once for a collection of recordings, instead of one invocation per recording.

        The default implementation simply creates an empty graph and calls #transcribe(File,Graph) for each speech file.

        Parameters:
        speech - A stream of speech files to transcribe.
        consumer - A consumer for receiving the graphs once they're transcribed.
        Throws:
        Exception
      • setTaskParameters

        public void setTaskParameters​(String parameters)
                               throws InvalidConfigurationException
        Normally, a transcriber has no specific task configuration, so this implementation does nothing.
        Specified by:
        setTaskParameters in class Annotator
        Parameters:
        parameters - The configuration of the annotator, encoded in a String using whatever mechanism is preferred (serialization of Properties object, JSON, etc.)
        Throws:
        InvalidConfigurationException