private long dumpBestPath(DataOutputStream dataOutputStream, BatchNISTRecognizer.CTLUtterance ctlutterance, Token token) { if (token == null) { return(0L); } Token predecessor = token.getPredecessor(); long num = this.dumpBestPath(dataOutputStream, ctlutterance, predecessor); if (token.isWord()) { long collectTime = token.getCollectTime(); WordSearchState wordSearchState = (WordSearchState)token.getSearchState(); Word word = wordSearchState.getPronunciation().getWord(); string spelling = word.getSpelling(); if (!String.instancehelper_startsWith(spelling, "<")) { string[] array = String.instancehelper_split(ctlutterance.name, "_"); dataOutputStream.write(String.instancehelper_getBytes(new StringBuilder().append(array[0]).append('_').append(array[1]).append('_').append(array[2]).append(" 1 ").append((double)((long)ctlutterance.startOffset + num) / 100.0).append(' ').append((double)(collectTime - num) / 100.0).append(' ').toString())); dataOutputStream.write(BatchNISTRecognizer.hex2Binary(spelling)); dataOutputStream.write(String.instancehelper_getBytes(" 0.700000\n")); } return(collectTime); } return(num); }
public CTLIterator(BatchNISTRecognizer this_0) { this.this_0 = this_0; this.ctlReader = new LineNumberReader(new FileReader(this_0.ctlFile)); this.refReader = new LineNumberReader(new FileReader(this_0.refFile)); this.utterance = this.nextUtterance(); }
public new static void main(string[] argv) { if (argv.Length != 1) { [email protected]("Usage: BatchForcedAlignerRecognizer propertiesFile"); java.lang.System.exit(1); } BatchNISTRecognizer.main(argv); }
public static byte[] hex2Binary(string spelling) { byte[] array = new byte[String.instancehelper_length(spelling) / 2]; for (int i = 0; i < String.instancehelper_length(spelling); i += 2) { int num = BatchNISTRecognizer.hexToByte(String.instancehelper_charAt(spelling, i)); int num2 = BatchNISTRecognizer.hexToByte(String.instancehelper_charAt(spelling, i + 1)); array[i / 2] = (byte)((sbyte)(num2 + 16 * num)); } return(array); }
internal CTLUtterance(BatchNISTRecognizer batchNISTRecognizer, string text, string text2) { this_0 = batchNISTRecognizer; this.@ref = text2; string[] array = String.instancehelper_split(text, " "); if (array.Length != 4) { string text3 = new StringBuilder().append("CTL Syntax Error: ").append(text).toString(); throw new BatchNISTRecognizer.CTLException(batchNISTRecognizer, text3); } this.startOffset = Integer.parseInt(array[1]); this.endOffset = Integer.parseInt(array[2]); this.name = array[3]; this.data = new byte[(this.endOffset - this.startOffset) * batchNISTRecognizer.bytesPerFrame]; int num = String.instancehelper_indexOf(array[0], 46); this.file = array[0]; if (num >= 0) { this.file = String.instancehelper_substring(this.file, 0, num); } this.file = new StringBuilder().append(batchNISTRecognizer.dataDir).append('/').append(this.file).append(".raw").toString(); try { FileInputStream fileInputStream = new FileInputStream(this.file); fileInputStream.skip((long)(this.startOffset * batchNISTRecognizer.bytesPerFrame)); if (fileInputStream.read(this.data) != this.data.Length) { fileInputStream.close(); string text4 = new StringBuilder().append("Unable to read ").append(this.data.Length).append(" bytes of utterance ").append(this.name).toString(); throw new BatchNISTRecognizer.CTLException(batchNISTRecognizer, text4); } fileInputStream.close(); } catch (IOException ex) { throw new BatchNISTRecognizer.CTLException(batchNISTRecognizer, new StringBuilder().append("Unable to read utterance ").append(this.name).append(": ").append(Throwable.instancehelper_getMessage(ex)).toString()); } }
internal CTLException(BatchNISTRecognizer batchNISTRecognizer, string text) : base(text) { this.this_0 = batchNISTRecognizer; }