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]#
Initialize the word proportion selection strategy.
- Parameters:
- Raises:
ValueError – If proportion is not between 0.0 and 1.0.
Methods
__init__(*, proportion[, seed])Initialize the word proportion selection strategy.
select_range(*, text[, word_separator])Select a character range by first selecting words, then converting to character positions.
select_words(*, words)Select a random proportion of words.