StopWordRemovalCompressor

Models & Types · AiDotNet.PromptEngineering.Compression

Compressor that removes common stop words to reduce prompt length.

Inheritance: PromptCompressorBase → StopWordRemovalCompressor

For Beginners

Removes common words like “the”, “a”, “is” to make prompts shorter.

Example:

When to use:

  • When maximum compression is needed
  • When the AI can infer meaning from keywords
  • Not recommended for conversational prompts

How It Works

This compressor removes frequently occurring words that often don’t add significant meaning to the prompt (articles, prepositions, auxiliary verbs, etc.). It’s more aggressive than redundancy removal and may slightly reduce readability.

Constructors

Constructor Summary
StopWordRemovalCompressor(AggressivenessLevel level, Func<string, int> tokenCounter) Initializes a new instance of the StopWordRemovalCompressor class.