highlight_placeholders#

scikitplot.cleanprompt.highlight_placeholders(text, policy=RedactionPolicy(kinds=None, allow=(), tag_style=TagStyle(prefix='[', suffix=']', separator='-', uppercase_kind=True, style='placeholder', surrogates=None), overlap=<OverlapStrategy.LONGEST_WINS: 'LONGEST_WINS'>, limits=Limits(max_input_chars=1000000, max_spans=100000, max_entries=50000, max_literal_terms=10000, max_literal_length=4096), case_insensitive=False, min_confidence=0.0, preserve_placeholders=True), color=None, stream=None)[source]#

Return a copy of text with placeholders wrapped in colour.

Parameters:
textstr

Text containing placeholders.

policyRedactionPolicy, default=DEFAULT_POLICY

Supplies the placeholder grammar.

colorbool, optional

Explicit override; see should_colorize.

streamfile-like, optional

Destination used to detect a terminal.

Returns:
str

A decorated copy, or text unchanged when colour is disabled.

Parameters:
Return type:

str

Examples

>>> highlight_placeholders("a [EMAIL-1] b", color=False)
'a [EMAIL-1] b'