Class Token

    • Field Detail

      • TOKEN_ATTRIBUTE_FACTORY

        public static final AttributeSource.AttributeFactory TOKEN_ATTRIBUTE_FACTORY
        Convenience factory that returns Token as implementation for the basic attributes and return the default impl (with "Impl" appended) for all other attributes.
        Since:
        3.0
    • Constructor Detail

      • Token

        public Token()
        Constructs a Token will null text.
      • Token

        public Token​(int start,
                     int end)
        Constructs a Token with null text and start & end offsets.
        Parameters:
        start - start offset in the source text
        end - end offset in the source text
      • Token

        public Token​(int start,
                     int end,
                     String typ)
        Constructs a Token with null text and start & end offsets plus the Token type.
        Parameters:
        start - start offset in the source text
        end - end offset in the source text
        typ - the lexical type of this Token
      • Token

        public Token​(int start,
                     int end,
                     int flags)
        Constructs a Token with null text and start & end offsets plus flags. NOTE: flags is EXPERIMENTAL.
        Parameters:
        start - start offset in the source text
        end - end offset in the source text
        flags - The bits to set for this token
      • Token

        public Token​(String text,
                     int start,
                     int end)
        Constructs a Token with the given term text, and start & end offsets. The type defaults to "word." NOTE: for better indexing speed you should instead use the char[] termBuffer methods to set the term text.
        Parameters:
        text - term text
        start - start offset in the source text
        end - end offset in the source text
      • Token

        public Token​(String text,
                     int start,
                     int end,
                     String typ)
        Constructs a Token with the given text, start and end offsets, & type. NOTE: for better indexing speed you should instead use the char[] termBuffer methods to set the term text.
        Parameters:
        text - term text
        start - start offset in the source text
        end - end offset in the source text
        typ - token type
      • Token

        public Token​(String text,
                     int start,
                     int end,
                     int flags)
        Constructs a Token with the given text, start and end offsets, & type. NOTE: for better indexing speed you should instead use the char[] termBuffer methods to set the term text.
        Parameters:
        text - term text
        start - start offset in the source text
        end - end offset in the source text
        flags - token type bits
      • Token

        public Token​(char[] startTermBuffer,
                     int termBufferOffset,
                     int termBufferLength,
                     int start,
                     int end)
        Constructs a Token with the given term buffer (offset & length), start and end offsets
        Parameters:
        startTermBuffer - buffer containing term text
        termBufferOffset - the index in the buffer of the first character
        termBufferLength - number of valid characters in the buffer
        start - start offset in the source text
        end - end offset in the source text