Interface MutableFST

  • All Known Implementing Classes:
    MutableFSTImpl

    public interface MutableFST
    A mutable FST represents a FST which can have arbitrary inputs added to it at any given point of time. Unlike a normal FST which is build once read many, mutable FST can be concurrently written to and read from. Mutable FST provides real time search i.e. search will see words as they are added without needing a flush. Unlike a normal FST, mutable FST does not require the entire input beforehand nor does it require the input to be sorted. Single word additions work well with mutable FST. The reason as to why normal FST and mutable FST have different interfaces is because normal i.e. immutable FST is optimized for storage and represents arcs, nodes and labels by offsets. Thus, all operations are done in integer offsets. Unlike a normal FST, mutable FST has all components mutable i.e. arc and node. Thus, a mutable FST operates on different data structures and follows a slightly different interface. However, functionality wise, the interfaces for immutable FST and mutable FST are identical with no difference.
    • Method Summary

      Modifier and Type Method Description
      void addPath​(String word, int outputSymbol)
      Add a path to the FST
      MutableState getStartState()
      The start state in the FST; there must be exactly one
      void setStartState​(MutableState mutableState)
      Set the start state
      void throwIfInvalid()
      throws an exception if the FST is constructed in an invalid state
    • Method Detail

      • getStartState

        MutableState getStartState()
        The start state in the FST; there must be exactly one
        Returns:
      • setStartState

        void setStartState​(MutableState mutableState)
        Set the start state
      • throwIfInvalid

        void throwIfInvalid()
        throws an exception if the FST is constructed in an invalid state
      • addPath

        void addPath​(String word,
                     int outputSymbol)
        Add a path to the FST