Class PronounceableFSM

  • Direct Known Subclasses:
    PrefixFSM, SuffixFSM

    public class PronounceableFSM
    extends java.lang.Object
    Implements a finite state machine that checks if a given string is pronounceable. If it is pronounceable, the method accept() will return true.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean scanFromFront
      Whether we should scan the input string from the front.
      protected int[] transitions
      The transitions of this FSM
      protected int vocabularySize
      The vocabulary size.
    • Constructor Summary

      Constructors 
      Constructor Description
      PronounceableFSM​(int vocabularySize, int[] transitions, boolean scanFromFront)
      Constructs a PronounceableFSM with the given attributes.
      PronounceableFSM​(java.net.URL url, boolean scanFromFront)
      Constructs a PronounceableFSM with information in the given URL.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean accept​(java.lang.String inputString)
      Checks to see if this finite state machine accepts the given input string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • vocabularySize

        protected int vocabularySize
        The vocabulary size.
      • transitions

        protected int[] transitions
        The transitions of this FSM
      • scanFromFront

        protected boolean scanFromFront
        Whether we should scan the input string from the front.
    • Constructor Detail

      • PronounceableFSM

        public PronounceableFSM​(java.net.URL url,
                                boolean scanFromFront)
                         throws java.io.IOException
        Constructs a PronounceableFSM with information in the given URL.
        Parameters:
        url - the URL that contains the FSM specification
        scanFromFront - indicates whether this FSM should scan the input string from the front, or from the back
        Throws:
        java.io.IOException
      • PronounceableFSM

        public PronounceableFSM​(int vocabularySize,
                                int[] transitions,
                                boolean scanFromFront)
        Constructs a PronounceableFSM with the given attributes.
        Parameters:
        vocabularySize - the vocabulary size of the FSM
        transitions - the transitions of the FSM
        scanFromFront - indicates whether this FSM should scan the input string from the front, or from the back
    • Method Detail

      • accept

        public boolean accept​(java.lang.String inputString)
        Checks to see if this finite state machine accepts the given input string.
        Parameters:
        inputString - the input string to be tested
        Returns:
        true if this FSM accepts, false if it rejects