public class ImmutableFst extends Fst
ImmutableState
objects
not allowing additions/deletionsModifier and Type | Method and Description |
---|---|
void |
addState(State state)
Adds a state to the fst
|
void |
deleteState(State state)
Deletes a state
|
boolean |
equals(java.lang.Object obj) |
int |
getNumStates()
Get the number of states in the fst
|
ImmutableState |
getState(int index) |
int |
hashCode() |
static ImmutableFst |
loadModel(java.io.InputStream inputStream)
Deserializes an ImmutableFst from an InputStream
|
static ImmutableFst |
loadModel(java.lang.String filename)
Deserializes an ImmutableFst from disk
|
void |
saveModel(java.lang.String filename)
Saves binary model to disk
|
java.lang.String |
toString() |
deleteStates, getIsyms, getOsyms, getSemiring, getStart, readStringMap, remapStateIds, setIsyms, setOsyms, setSemiring, setStart
public int getNumStates()
Fst
getNumStates
in class Fst
public ImmutableState getState(int index)
public void addState(State state)
Fst
public void saveModel(java.lang.String filename) throws java.io.IOException
Fst
public static ImmutableFst loadModel(java.io.InputStream inputStream) throws java.io.IOException, java.lang.ClassNotFoundException
inputStream
- the InputStream. It should be already be initialized by the
caller.java.io.IOException
- IO went wrongjava.lang.ClassNotFoundException
- serialization had issuespublic static ImmutableFst loadModel(java.lang.String filename)
filename
- the binary model filenamepublic void deleteState(State state)
Fst
deleteState
in class Fst
state
- the state to delete