Class TokenSample

    • Constructor Detail

      • TokenSample

        public TokenSample​(String text,
                           Span[] tokenSpans)
        Initializes a instance.
        Parameters:
        text - The text which contains the tokens. Must not be null.
        tokenSpans - The spans which mark the start and end of the tokens. Must not be null.
      • TokenSample

        public TokenSample​(Detokenizer detokenizer,
                           String[] tokens)
        Initializes a instance via a Detokenizer.
        Parameters:
        detokenizer - The text which contains the tokens. Must not be null.
        tokens - The tokens to be processed. Must not be null.
    • Method Detail

      • getText

        public String getText()
        Returns:
        Retrieves the text.
      • getTokenSpans

        public Span[] getTokenSpans()
        Returns:
        Retrieves the token spans.
      • parse

        public static TokenSample parse​(String sampleString,
                                        String separatorChars)
        Parses a string sample.
        Parameters:
        sampleString - The sample to be parsed. Must not be null.
        separatorChars - The characters to be considered separators. See DEFAULT_SEPARATOR_CHARS. Must not be null.
        Returns:
        A valid TokenSample instance.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object