com.groupdocs.parser

Interfaces

Classes

Exceptions

com.groupdocs.parser

Class HighlightOptions



  • public final class HighlightOptions
    extends Object

    Provides the options for highlight.


    HighlightOptions class is used to define options of highlight extraction. Highlight is a part of text. To extract highlight you need to set the start position, direction relative to this position and length. Length can be set by characters, words count or to line's start (end).

    • Method Detail

      • getDirection

        public int getDirection()

        Gets a direction of highlight.

        Returns:
        A direction of highlight.
      • getWordSeparators

        public WordSeparators getWordSeparators()

        Gets an instance of WordSeparators which is used to check separator characters.

        Returns:
        An instance of WordSeparators.
      • getPosition

        public int getPosition()

        Gets a start position of highlight.

        Returns:
        A start position of highlight.
      • getMode

        public int getMode()

        Gets a mode of highlight extraction.

        Returns:
        A mode of highlight extraction.
      • getLength

        public int getLength()

        Gets a length of highlight.

        Returns:
        A length of highlight.
      • createFixedLengthOptions

        public static HighlightOptions createFixedLengthOptions(int direction,
                                                int position,
                                                int length)

        Creates an instance of HighlightOptions for highlight extraction with the fixed length.

        Parameters:
        direction - A direction of highlight.
        position - A start position of highlight.
        length - A length of highlight.
        Returns:
        An instance of HighlightOptions.
      • createWordsCountOptions

        public static HighlightOptions createWordsCountOptions(int direction,
                                               int position,
                                               int wordsCount)

        Creates an instance of HighlightOptions for highlight extraction with the limited words count.

        Parameters:
        direction - A direction of highlight.
        position - A start position of highlight.
        wordsCount - A count of words in highlight.
        Returns:
        An instance of HighlightOptions.
      • createWordsCountOptions

        public static HighlightOptions createWordsCountOptions(int direction,
                                               int position,
                                               int wordsCount,
                                               WordSeparators wordSeparators)

        Creates an instance of HighlightOptions for highlight extraction with the limited words count.

        Parameters:
        direction - A direction of highlight.
        position - A start position of highlight.
        wordsCount - A count of words in highlight.
        wordSeparators - An instance of WordSeparators.
        Returns:
        An instance of HighlightOptions.
      • createLineOptions

        public static HighlightOptions createLineOptions(int direction,
                                         int position)

        Creates an instance of HighlightOptions for highlight extraction to line's start (end).

        Parameters:
        direction - A direction of highlight.
        position - A start position of highlight.
        Returns:
        An instance of HighlightOptions.
      • createLineOptions

        public static HighlightOptions createLineOptions(int direction,
                                         int position,
                                         int maxLength)

        Creates an instance of HighlightOptions for highlight extraction to line's start (end).

        Parameters:
        direction - A direction of highlight.
        position - A start position of highlight.
        maxLength - A maximum length of highlight.


        maxLength parameter limits the size of highlight. If start/end of line is farther than maxLength, then highlight contains only maxLength characters.

        Returns:
        An instance of HighlightOptions.