|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.stanford.nlp.ie.hmm.Structure
Class to model an HMM structure. This builds a straightforward one-target-state structure, via a series of structure building operations. It can be used like this:
Structure s = new Structure(); s.giveDefault(); s.lengthenTarget(0); s.lengthenTarget(0); s.addTarget(1); s.addPrefix(1); s.addSuffix(2); s.addPrefix(3); s.createTransitions(); State[] struct = s.getStates();
Field Summary | |
static int |
BACKGROUND
|
static int |
END
|
static int |
END_STATE
|
static int |
GLOBAL_END
|
static int |
GLOBAL_START
|
static Double |
ONE
|
static int |
PREFIX
|
protected List |
prefixes
|
static int |
START
|
static int |
START_STATE
|
protected List |
stateTypes
|
static int |
SUFFIX
|
protected List |
suffixes
|
static int |
TARGET
|
protected List |
targets
|
protected List |
transitions
|
static Double |
ZERO
|
Constructor Summary | |
Structure()
|
|
Structure(double[][] transitions,
int[] stateTypes)
|
|
Structure(State[] states)
|
Method Summary | |
void |
addPrefix(int length)
Legacy method for modifying the structure. |
void |
addSuffix(int length)
Legacy method for modifying the structure. |
void |
addTarget(int length)
Legacy method for modifying the structure. |
void |
addTransition(int fromState,
int toState)
Inserts a transition from fromState to toState |
static State[] |
chrisDefaultStates()
Initializes a reasonable default structure, with a background, prefix and suffix states and some number of target states. |
static State[] |
chrisDefaultStates2()
Initializes a reasonable default structure, with a background, prefix and suffix states and some number of target states. |
Structure |
copy()
|
static State[] |
defaultStates()
|
List |
getIncoming(int toState)
|
List |
getOutgoing(int fromState)
|
State[] |
getStates()
|
double[][] |
getTransitions()
|
void |
giveDefault()
Build a simple IE HMM structure, with start and finish state, and one each background, prefix, suffix, and target states. |
protected void |
giveEmpty()
|
void |
giveErgodic(int[] stateTypes)
Builds an ergodic (fully-connected) HMM structure. |
void |
giveTarget()
Build a simple Target HMM structure, with start and finish state and target states only. |
void |
initializeTransitions()
initializes the transition weights in the HMM to "sensible" values |
int |
insertState(int state,
int type)
Inserts a new state of given type AFTER the specified state. |
static State[] |
jimDefaultStates()
Initializes a reasonable default structure, with a background, prefix and suffix states and some number of target states. |
void |
lengthenPrefix(int i)
Legacy method for modifying the structure. |
void |
lengthenSuffix(int i)
Legacy method for modifying the structure. |
void |
lengthenTarget(int i)
Legacy method for modifying the structure. |
static void |
main(String[] args)
Provides a sample exercising of the structure creation operations |
static Structure |
mergeStructures(Structure[] structures)
|
static void |
normalize(double[] dist)
|
int |
numParameters()
|
int |
numPrefixes()
|
int |
numSuffixes()
|
int |
numTargets()
|
static void |
perturbTransitions(double[][] t)
|
void |
setWeight(int fromState,
int toState,
double weight)
Sets the weight for the transition from fromState to toState |
int |
splitState(int state)
Splits a state into two states of the same type producing one new state. |
String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected List transitions
public static final int END_STATE
public static final int START_STATE
public static final int GLOBAL_END
public static final int GLOBAL_START
public static final int END
public static final int START
public static final int BACKGROUND
public static final int TARGET
public static final int PREFIX
public static final int SUFFIX
protected List stateTypes
public static final Double ONE
public static final Double ZERO
protected List prefixes
protected List suffixes
protected List targets
Constructor Detail |
public Structure()
public Structure(State[] states)
public Structure(double[][] transitions, int[] stateTypes)
Method Detail |
public int insertState(int state, int type)
public int splitState(int state)
public void addTransition(int fromState, int toState)
public void setWeight(int fromState, int toState, double weight)
public List getOutgoing(int fromState)
public List getIncoming(int toState)
protected void giveEmpty()
public void giveDefault()
public void giveTarget()
public void giveErgodic(int[] stateTypes)
public static Structure mergeStructures(Structure[] structures)
public int numPrefixes()
public int numTargets()
public int numSuffixes()
public void addPrefix(int length)
public void addSuffix(int length)
public void addTarget(int length)
public void lengthenPrefix(int i)
public void lengthenSuffix(int i)
public void lengthenTarget(int i)
public Structure copy()
public void initializeTransitions()
public double[][] getTransitions()
public static void perturbTransitions(double[][] t)
public static void normalize(double[] dist)
public int numParameters()
public State[] getStates()
getStates
in interface GeneralStructure
public String toString()
toString
in class Object
public static State[] defaultStates()
public static State[] jimDefaultStates()
public static State[] chrisDefaultStates()
public static State[] chrisDefaultStates2()
public static void main(String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |