java.lang.Object
org.apache.lucene.analysis.cn.smart.hhmm.SegGraph

class SegGraph extends Object
Graph representing possible tokens at each start offset in the sentence.

For each start offset, a list of possible tokens is stored.

  • Field Details

    • tokenListTable

      private IntObjectHashMap<ArrayList<SegToken>> tokenListTable
      Map of start offsets to ArrayList of tokens at that position
    • maxStart

      private int maxStart
  • Constructor Details

    • SegGraph

      SegGraph()
  • Method Details

    • isStartExist

      public boolean isStartExist(int s)
      Returns true if a mapping for the specified start offset exists
      Parameters:
      s - startOffset
      Returns:
      true if there are tokens for the startOffset
    • getStartList

      public List<SegToken> getStartList(int s)
      Get the list of tokens at the specified start offset
      Parameters:
      s - startOffset
      Returns:
      List of tokens at the specified start offset.
    • getMaxStart

      public int getMaxStart()
      Get the highest start offset in the map
      Returns:
      maximum start offset, or -1 if the map is empty.
    • makeIndex

      public List<SegToken> makeIndex()
      Set the SegToken.index for each token, based upon its order by startOffset.
      Returns:
      a List of these ordered tokens.
    • addToken

      public void addToken(SegToken token)
      Add a SegToken to the mapping, creating a new mapping at the token's startOffset if one does not exist.
      Parameters:
      token - SegToken
    • toTokenList

      public List<SegToken> toTokenList()
      Return a List of all tokens in the map, ordered by startOffset.
      Returns:
      List of all tokens in the map.
    • toString

      public String toString()
      Overrides:
      toString in class Object