pyrit.prompt_converter.WordPositionSelectionStrategy#
- class WordPositionSelectionStrategy(*, start_proportion: float, end_proportion: float)[source]#
Bases:
WordSelectionStrategySelects words based on proportional start and end positions.
- __init__(*, start_proportion: float, end_proportion: float) None[source]#
Initializes the word position selection strategy.
- Parameters:
- Raises:
ValueError – If proportions are not between 0.0 and 1.0, or start >= end.
Methods
__init__(*, start_proportion, end_proportion)Initializes the word position selection strategy.
select_range(*, text[, word_separator])Selects a character range by first selecting words, then converting to character positions.
select_words(*, words)Selects words based on the relative position.