be.ac.ulg.montefiore.run.jahmm.io
Class HmmReader

java.lang.Object
  extended by be.ac.ulg.montefiore.run.jahmm.io.HmmReader

public class HmmReader
extends java.lang.Object

This class can read Hidden Markov Models represented as text files. The file syntax is as follows.

A '#' character induces a comment ; the rest of the line is skipped. Words must be separated with a white space (space, tab or new line). The file is case-sensitive. The file must begin with the words Hmm and v1.0.

The next word must be NbStates followed by a number. This number is the HMM's number of states.

Then comes a description of each state. The n-th description is related to the n-th state. A state description begins with the keywords State and Pi, followed by the initial probability of this state. Then comes the letter A followed by the state transition probabilities separated by a space, in the right order. Then comes a description of an observation distribution which depends on the type of observation handled by the HMM.

The opdfs associated with all the states must have the same type. A HMM description file thus looks like this:

 # A simple Hmm
 Hmm
 v1.0
 NbStates 2
 
 State
 Pi 0.7
 A 0.1 0.9
 IntegerOPDF [ .2 .3 .4 .1 ]

 State
 Pi 0.3
 A 0.4 0.6
 IntegerOPDF [ .1 .1 .1 .7 ]
 
The lines starting with 'IntegerOPDF' are distributions descriptions.


Constructor Summary
HmmReader()
           
 
Method Summary
static
<O extends Observation>
Hmm<O>
read(java.io.Reader reader, OpdfReader<? extends Opdf<O>> opdfReader)
          Reads a HMM from a text file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HmmReader

public HmmReader()
Method Detail

read

public static <O extends Observation> Hmm<O> read(java.io.Reader reader,
                                                  OpdfReader<? extends Opdf<O>> opdfReader)
                                       throws java.io.IOException,
                                              FileFormatException
Reads a HMM from a text file.

Parameters:
reader - The reader to read the HMM description from.
opdfReader - The OpdfReader used to read the observation distributions.
Throws:
java.io.IOException
FileFormatException


Copyright © 2004,2005 Jean-Marc François.