Class SegGraph


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

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

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int maxStart  
      private java.util.Map<java.lang.Integer,​java.util.ArrayList<SegToken>> tokenListTable
      Map of start offsets to ArrayList of tokens at that position
    • Constructor Summary

      Constructors 
      Constructor Description
      SegGraph()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addToken​(SegToken token)
      Add a SegToken to the mapping, creating a new mapping at the token's startOffset if one does not exist.
      int getMaxStart()
      Get the highest start offset in the map
      java.util.List<SegToken> getStartList​(int s)
      Get the list of tokens at the specified start offset
      boolean isStartExist​(int s)
      Returns true if a mapping for the specified start offset exists
      java.util.List<SegToken> makeIndex()
      Set the SegToken.index for each token, based upon its order by startOffset.
      java.lang.String toString()  
      java.util.List<SegToken> toTokenList()
      Return a List of all tokens in the map, ordered by startOffset.
      • Methods inherited from class java.lang.Object

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

      • tokenListTable

        private java.util.Map<java.lang.Integer,​java.util.ArrayList<SegToken>> tokenListTable
        Map of start offsets to ArrayList of tokens at that position
      • maxStart

        private int maxStart
    • Constructor Detail

      • SegGraph

        SegGraph()
    • Method Detail

      • 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 java.util.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 java.util.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 java.util.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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object