HighlightOptions class

HighlightOptions class

Provides the options which are used to extract a highlight (a block of text around found text in search scenarios).

An instance of HighlightOptions is used as a parameter in Parser.get_highlight(int, bool, HighlightOptions) method. See the usage examples there.

Learn more:

The HighlightOptions type exposes the following members:

Constructors

Constructor Description
init Initializes a new instance of the HighlightOptions class which is used to extract a fixed-length highlight.
init Initializes a new HighlightOptions instance used to extract a fixed-length highlight.
init Initializes a new instance of the HighlightOptions class which is used to extract a line‑limited highlight.
init Initializes a new HighlightOptions instance used to extract a highlight with a fixed word count.
init Initializes a new HighlightOptions instance.

Properties

Property Description
is_line_limited The value indicating whether highlight extraction is limited by the start (or the end) of a text line.
max_length The maximum text length.
word_count The maximum word count.

Example

from groupdocs.parser import Parser
from groupdocs.parser.options import HighlightOptions

parser = Parser("sample.docx")
options = HighlightOptions(20)
highlight = parser.get_highlight(1, True, options)
print(highlight.text)

See Also