Sautrela

edu.gtts.sautrela.wfsa
Class Util

java.lang.Object
  extended by edu.gtts.sautrela.wfsa.Util

public class Util
extends java.lang.Object

Author:
mpenagar

Method Summary
static void doGopalakrishnan(double[] logProb, double[] count)
          The Gopalakrishnan transformation

p'= (p * C + count) / Norma

is implemented using the value C=Max{(1-count)/prob,0} for each probability distribution.
static
<S extends State,Y extends Symbol,T extends Transition<S,Y>>
double
getProb(WFSA<S,Y,T> wfa, java.util.List<Y> obs)
           
static
<S extends State,Y extends Symbol,T extends Transition<S,Y>>
double
getProb(WFSA<S,Y,T> wfa, java.util.List<Y> obs, double beam)
           
static
<T extends Transition<?,?>>
T
getRandomTrans(T[] theArray)
           
static
<Y1 extends Symbol,Y2 extends Symbol>
java.util.List<Y1>
getSymbolList(WFSA<?,Y1,?> A, java.util.List<Y2> symbolList)
          Returns the Symbol List of a given Symbol List from another Alphabet
static
<Y extends Symbol>
java.util.List<Y>
getSymbolListFromNames(WFSA<?,Y,?> A, java.util.List<java.lang.String> symbolNameList)
          Returns the Symbol List of a given Symbol-name List
static WFSA<State,Symbol,Transition<State,Symbol>> newWFSAInstance(org.xml.sax.InputSource is)
          Instantiates a WFSA using a XML description found via an InputSource
static WFSA<State,Symbol,Transition<State,Symbol>> newWFSAInstance(org.xml.sax.InputSource is, Alphabet<Symbol> alphabet)
          Instantiates a WFSA using a XML description found via an InputSource and using an existing Alphabet.
static
<S extends State,Y extends Symbol,T extends Transition<S,Y>>
java.util.List<Y>
randomSymbolList(WFSA<S,Y,T> wfa)
          Generates a random non-null list of Symbols for a WFSA.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSymbolListFromNames

public static <Y extends Symbol> java.util.List<Y> getSymbolListFromNames(WFSA<?,Y,?> A,
                                                                          java.util.List<java.lang.String> symbolNameList)
Returns the Symbol List of a given Symbol-name List

Parameters:
A - the Model to be used

getSymbolList

public static <Y1 extends Symbol,Y2 extends Symbol> java.util.List<Y1> getSymbolList(WFSA<?,Y1,?> A,
                                                                                     java.util.List<Y2> symbolList)
Returns the Symbol List of a given Symbol List from another Alphabet

Parameters:
A - the Model to be used

randomSymbolList

public static <S extends State,Y extends Symbol,T extends Transition<S,Y>> java.util.List<Y> randomSymbolList(WFSA<S,Y,T> wfa)
Generates a random non-null list of Symbols for a WFSA.

Parameters:
wfa - theDWFSAA to be used

getProb

public static <S extends State,Y extends Symbol,T extends Transition<S,Y>> double getProb(WFSA<S,Y,T> wfa,
                                                                                          java.util.List<Y> obs)

getProb

public static <S extends State,Y extends Symbol,T extends Transition<S,Y>> double getProb(WFSA<S,Y,T> wfa,
                                                                                          java.util.List<Y> obs,
                                                                                          double beam)

newWFSAInstance

public static WFSA<State,Symbol,Transition<State,Symbol>> newWFSAInstance(org.xml.sax.InputSource is)
                                                                   throws javax.xml.parsers.ParserConfigurationException,
                                                                          org.xml.sax.SAXException,
                                                                          java.io.IOException
Instantiates a WFSA using a XML description found via an InputSource

Parameters:
is - the InputSource used to locate the XML description
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException

newWFSAInstance

public static WFSA<State,Symbol,Transition<State,Symbol>> newWFSAInstance(org.xml.sax.InputSource is,
                                                                          Alphabet<Symbol> alphabet)
                                                                   throws javax.xml.parsers.ParserConfigurationException,
                                                                          org.xml.sax.SAXException,
                                                                          java.io.IOException
Instantiates a WFSA using a XML description found via an InputSource and using an existing Alphabet. The alphabet could grow.

Parameters:
is - the InputSource used to locate the XML description
alphabet - an existing Alphabet
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException

doGopalakrishnan

public static void doGopalakrishnan(double[] logProb,
                                    double[] count)
The Gopalakrishnan transformation

p'= (p * C + count) / Norma


is implemented using the value C=Max{(1-count)/prob,0} for each probability distribution. This constant ensures that the minimun probability (prior to normalization) will be 1.


getRandomTrans

public static <T extends Transition<?,?>> T getRandomTrans(T[] theArray)

Sautrela