Package be.ac.ulg.montefiore.run.jahmm.io

Source Code of be.ac.ulg.montefiore.run.jahmm.io.OpdfGaussianReader

/*
* Copyright (c) 2004-2009, Jean-Marc François. All Rights Reserved.
* Licensed under the New BSD license.  See the LICENSE file.
*/

package be.ac.ulg.montefiore.run.jahmm.io;

import java.io.IOException;
import java.io.StreamTokenizer;

import be.ac.ulg.montefiore.run.jahmm.OpdfGaussian;


/**
* This class implements a {@link OpdfGaussian} reader.  The syntax of the
* distribution description is the following.
* <p>
* The description always begins with the keyword <tt>GaussianOPDF</tt>.
* The next (resp. last) symbol is an opening (resp. closing) bracket.
* Between the backets are two numbers separated by a space.  The
* first is the distribution's mean, the second the variance.
* <p>
* For example, reading <tt>GaussianOPDF [ .2 .3 ]</tt> returns a distribution
* equivalent to <code>new OpdfGaussian(.2, .3)</code>.
*/
public class OpdfGaussianReader
extends OpdfReader<OpdfGaussian>
{
  String keyword()
  {
    return "GaussianOPDF";
  }
 
  public OpdfGaussian read(StreamTokenizer st)
  throws IOException,  FileFormatException {
    HmmReader.readWords(st, keyword());
   
    double[] meanVariance = OpdfReader.read(st, 2);
   
    return new OpdfGaussian(meanVariance[0], meanVariance[1]);
  }
}
TOP

Related Classes of be.ac.ulg.montefiore.run.jahmm.io.OpdfGaussianReader

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.