Class RedundancyRemovalCompressor
- Namespace
- AiDotNet.PromptEngineering.Compression
- Assembly
- AiDotNet.dll
Compressor that removes redundant phrases and verbose language from prompts.
public class RedundancyRemovalCompressor : PromptCompressorBase, IPromptCompressor
- Inheritance
-
RedundancyRemovalCompressor
- Implements
- Inherited Members
Remarks
This compressor identifies and removes common patterns of redundant language such as filler phrases, unnecessary qualifiers, and verbose constructions. It preserves the semantic meaning while making the prompt more concise.
For Beginners: Removes wordy phrases without changing meaning.
Example:
var compressor = new RedundancyRemovalCompressor();
string verbose = "I would like you to please help me to analyze the following text";
string compressed = compressor.Compress(verbose);
// Result: "Analyze this text"
// What gets removed:
// - "I would like you to" → (removed)
// - "please help me to" → (removed)
// - "the following" → "this"
Constructors
RedundancyRemovalCompressor(Func<string, int>?)
Initializes a new instance of the RedundancyRemovalCompressor class.
public RedundancyRemovalCompressor(Func<string, int>? tokenCounter = null)
Parameters
Methods
CompressCore(string, CompressionOptions)
Compresses the prompt by removing redundant phrases.
protected override string CompressCore(string prompt, CompressionOptions options)
Parameters
promptstringoptionsCompressionOptions