throws FileNotFoundException, IOException {
String location = "";
InputStream inputStream = StreamFactory.getInputStream(location, path);
LogMath logMath = LogMath.getLogMath();
logger.info("Loading transition matrices from: ");
logger.info(path);
Pool<float[][]> pool = new Pool<float[][]>(path);
ExtendedStreamTokenizer est = new ExtendedStreamTokenizer(inputStream, '#', false);
est.expectString("tmat");
int numMatrices = est.getInt("numMatrices");
est.expectString("X");
// numStates = est.getInt("numStates");
for (int i = 0; i < numMatrices; i++) {
est.expectString("tmat");
est.expectString("[" + i + ']');
est.expectString("nstate");
// Number of emitting states + 1, final non-emitting state
int numStates = est.getInt("numStates") + 1;
float[][] tmat = new float[numStates][numStates];
for (int j = 0; j < numStates; j++) {
for (int k = 0; k < numStates; k++) {
// the last row is just zeros, so we just do
// the first (numStates - 1) rows
if (j < numStates - 1) {
if (k == j || k == j + 1) {
tmat[j][k] = est.getFloat("tmat value");
}
}
tmat[j][k] = logMath.linearToLog(tmat[j][k]);
if (logger.isLoggable(Level.FINE)) {
logger.fine("tmat j " + j + " k "
+ k + " tm " + tmat[j][k]);
}