public class ConcatFileDataSource extends StreamDataSource implements ReferenceSource
DataStartSignal
will be placed before the start of the first file, and a
DataEndSignal
after the last file. No DataStartSignal or DataEndSignal
will be placed between them. Optionally, silence can be added in-between the audio files by setting the property:
edu.cmu.sphinx.frontend.util.ConcatFileDataSource.silenceFileto a audio file for silence. By default, no silence is added. Moreover, one can also specify how many files to skip for every file read.
You can also specify the name of a transcript file to write the transcription to. The transcription will be written in HUB-4 style. A sample HUB-4 transcript looks like:
bn99en_1 1 peter_jennings 0.806084 7.079850 <o,f4,male> Tonight this Thursday big pressure on the Clinton administration to do something about the latest killing in Yugoslavia bn99en_1 1 peter_jennings 7.079850 14.007608 <o,fx,male> Airline passengers and outrageous behavior at thirty thousand feet What can an airline do ... bn99en_1 1 inter_segment_gap 23.097000 28.647000 <o,fx,> ...The format of each line is:
test_set_name category speaker_name start_time_in_seconds end_time_in_seconds <category,hub4_focus_conditions,speaker_sex> transcriptIn our example above,
test_set_name is "bn99en_1" category is "1" speaker_name is "peter_jennings" start_time_in_seconds is "0.806084" end_time_in_seconds is "7.079850" category is "o" for "Overall" hub4_focus_conditions is: "f0" for "Baseline//Broadcast//Speech" "f1" for "Spontaneous//Broadcast//Speech" "f2" for "Speech Over//Telephone//Channels" "f3" for "Speech in the//Presence of//Background Music" "f4" for "Speech Under//Degraded//Acoustic Conditions" "f5" for "Speech from//Non-Native//Speakers" "fx" for "All other speech" speaker_sex is "male" transcript is "Tonight this Thursday big pressure on the Clinton administration to do something about the latest killing in YugoslaviaThe ConcatFileDataSource will produce such a transcript if the name of the file to write to is supplied in the constructor. This transcript file will be used in detected gap insertion errors, because it accurately describes the "correct" sequence of speech and silences in the concatenated version of the audio files.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PROP_ADD_RANDOM_SILENCE
The property that specifies whether to add random silence.
|
static java.lang.String |
PROP_BATCH_FILE
The property for the file containing a list of audio files to read from.
|
static java.lang.String |
PROP_MAX_SILENCE
The property that specifies the maximum number of times the silence file is added between files.
|
static java.lang.String |
PROP_SILENCE_FILE
The property that specifies the silence audio file, if any.
|
static java.lang.String |
PROP_SKIP
The property that specifies the number of files to skip for every file read.
|
static java.lang.String |
PROP_START_FILE
The property that specifies which file to start at.
|
static java.lang.String |
PROP_TOTAL_FILES
The property that specifies the total number of files to read.
|
static java.lang.String |
PROP_TRANSCRIPT_FILE
The property that specifies the name of the transcript file.
|
bitsPerSample, PROP_BIG_ENDIAN_DATA, PROP_BITS_PER_SAMPLE, PROP_BYTES_PER_READ, PROP_SAMPLE_RATE, PROP_SIGNED_DATA, sampleRate
logger
Constructor and Description |
---|
ConcatFileDataSource() |
ConcatFileDataSource(int sampleRate,
int bytesPerRead,
int bitsPerSample,
boolean bigEndian,
boolean signedData,
boolean addRandomSilence,
int maxSilence,
int skip,
java.lang.String silenceFileName,
int startFile,
int totalFiles,
java.lang.String transcriptFile,
java.lang.String batchFile) |
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.String> |
getReferences()
Returns a list of all reference text.
|
java.lang.String |
getTranscriptFile()
Returns the name of the transcript file.
|
void |
initialize()
Initializes a ConcatFileDataSource.
|
void |
newProperties(PropertySheet ps)
This method is called when this configurable component needs to be reconfigured.
|
getData, setInputStream, setInputStream
getPredecessor, setPredecessor
getName, initLogger, toString
@S4Integer(defaultValue=1) public static final java.lang.String PROP_START_FILE
@S4Integer(defaultValue=0) public static final java.lang.String PROP_SKIP
@S4Integer(defaultValue=-1) public static final java.lang.String PROP_TOTAL_FILES
@S4String public static final java.lang.String PROP_SILENCE_FILE
@S4Boolean(defaultValue=false) public static final java.lang.String PROP_ADD_RANDOM_SILENCE
@S4Integer(defaultValue=3) public static final java.lang.String PROP_MAX_SILENCE
@S4String public static final java.lang.String PROP_TRANSCRIPT_FILE
@S4String public static final java.lang.String PROP_BATCH_FILE
public ConcatFileDataSource(int sampleRate, int bytesPerRead, int bitsPerSample, boolean bigEndian, boolean signedData, boolean addRandomSilence, int maxSilence, int skip, java.lang.String silenceFileName, int startFile, int totalFiles, java.lang.String transcriptFile, java.lang.String batchFile)
public ConcatFileDataSource()
public void newProperties(PropertySheet ps) throws PropertyException
Configurable
newProperties
in interface Configurable
newProperties
in class StreamDataSource
ps
- a property sheet holding the new dataPropertyException
- if there is a problem with the properties.public void initialize()
initialize
in interface DataProcessor
initialize
in class StreamDataSource
public java.util.List<java.lang.String> getReferences()
getReferences
in interface ReferenceSource
public java.lang.String getTranscriptFile()