RandomSwap<T>
Models & Types · AiDotNet.Augmentation.Text
Randomly swaps the positions of words in text.
Inheritance: AugmentationBase<T, string[]> → TextAugmenterBase<T> → RandomSwap<T>
For Beginners
Random swap changes word order, like swapping “the big dog” to “big the dog”. This helps models become less sensitive to exact word ordering.
How It Works
When to use:
- Sentiment analysis (where word presence matters more than order)
- Topic classification
- Tasks where word order is somewhat flexible
When NOT to use:
- Tasks where word order is critical (machine translation, grammar checking)
- Named entity recognition
Constructors
| Constructor | Summary |
|---|---|
RandomSwap(int numSwaps, double probability, string languageCode) |
Creates a new random swap augmentation. |
Properties
| Property | Summary |
|---|---|
int NumSwaps { get; } |
Gets the number of word swaps to perform. |
Methods
| Method | Summary |
|---|---|
IDictionary<string, object> GetParameters() |