public class PronounceableFSM extends Object
accept()
will return true.Modifier and Type | Field and Description |
---|---|
private static String |
NUM_OF_TRANSITIONS |
protected boolean |
scanFromFront
Whether we should scan the input string from the front.
|
protected int[] |
transitions
The transitions of this FSM
|
private static String |
TRANSITIONS |
private static String |
VOCAB_SIZE |
protected int |
vocabularySize
The vocabulary size.
|
Constructor and Description |
---|
PronounceableFSM(int vocabularySize,
int[] transitions,
boolean scanFromFront)
Constructs a PronounceableFSM with the given attributes.
|
PronounceableFSM(URL url,
boolean scanFromFront)
Constructs a PronounceableFSM with information in the given URL.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(String inputString)
Checks to see if this finite state machine accepts the given
input string.
|
private void |
loadText(InputStream is)
Loads the ASCII specification of this FSM from the given InputStream.
|
private int |
parseLastInt(String line)
Returns the integer value of the last integer in the given string.
|
private int |
transition(int state,
int symbol)
Causes this FSM to transition to the next state given
the current state and input symbol.
|
private static final String VOCAB_SIZE
private static final String NUM_OF_TRANSITIONS
private static final String TRANSITIONS
protected int vocabularySize
protected int[] transitions
protected boolean scanFromFront
public PronounceableFSM(URL url, boolean scanFromFront) throws IOException
url
- the URL that contains the FSM specificationscanFromFront
- indicates whether this FSM should scan the input
string from the front, or from the backIOException
public PronounceableFSM(int vocabularySize, int[] transitions, boolean scanFromFront)
vocabularySize
- the vocabulary size of the FSMtransitions
- the transitions of the FSMscanFromFront
- indicates whether this FSM should scan the input
string from the front, or from the backprivate void loadText(InputStream is) throws IOException
is
- the input stream to load fromIOException
- if an error occurs on input.private int parseLastInt(String line)
line
- the line to parse the integer fromprivate int transition(int state, int symbol)
state
- the current statesymbol
- the input symbolWebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses