pyrit.prompt_converter.WordProportionSelectionStrategy#
- class WordProportionSelectionStrategy(*, proportion: float, seed: int | None = None)[source]#
Bases:
WordSelectionStrategySelects a random proportion of words.
- __init__(*, proportion: float, seed: int | None = None) None[source]#
Initializes the word proportion selection strategy.
- Parameters:
- Raises:
ValueError – If proportion is not between 0.0 and 1.0.
Methods
__init__(*, proportion[, seed])Initializes the word proportion selection strategy.
select_range(*, text[, word_separator])Selects a character range by first selecting words, then converting to character positions.
select_words(*, words)Selects a random proportion of words.