Table of Contents

Class RandomDeletion<T>

Namespace
AiDotNet.Augmentation.Text
Assembly
AiDotNet.dll

Randomly deletes words from text.

public class RandomDeletion<T> : TextAugmenterBase<T>, IAugmentation<T, string[]>

Type Parameters

T

The numeric type for calculations.

Inheritance
RandomDeletion<T>
Implements
Inherited Members

Remarks

For Beginners: Random deletion removes some words from text, simulating how people often skip words when speaking quickly or how text might have missing words in noisy transcriptions.

When to use:

  • Text classification where exact wording isn't critical
  • Training robust models for noisy/incomplete text
  • Simulating transcription errors

Constructors

RandomDeletion(double, int, double, string)

Creates a new random deletion augmentation.

public RandomDeletion(double deletionProbability = 0.1, int minWordsToKeep = 1, double probability = 0.2, string languageCode = "en")

Parameters

deletionProbability double

Probability of deleting each word (default: 0.1).

minWordsToKeep int

Minimum words to keep (default: 1).

probability double

Probability of applying this augmentation (default: 0.2).

languageCode string

Language code for language-specific operations.

Properties

DeletionProbability

Gets the probability of deleting each word.

public double DeletionProbability { get; }

Property Value

double

Remarks

Default: 0.1 (10% of words deleted)

MinWordsToKeep

Gets the minimum number of words to keep.

public int MinWordsToKeep { get; }

Property Value

int

Remarks

Default: 1

Ensures the text isn't completely deleted.

Methods

ApplyAugmentation(string[], AugmentationContext<T>)

Implement this method to perform the actual augmentation.

protected override string[] ApplyAugmentation(string[] data, AugmentationContext<T> context)

Parameters

data string[]

The input data.

context AugmentationContext<T>

The augmentation context.

Returns

string[]

The augmented data.

GetParameters()

Gets the parameters of this augmentation.

public override IDictionary<string, object> GetParameters()

Returns

IDictionary<string, object>

A dictionary of parameter names to values.