Usage Guide

Beginner usage guide to using NLarge

Importing the library

Before using NLarge, start by importing the library. For this example, we will be importing the synonym augmenter, you may find the usage guide of other augmentation types:

-

Random Augmenter

-

Synonym Augmenter

-

Large Language Model (LLM) Augmenter

Import NLarge Synonym Augmenter:

from NLarge.synonym import SynonymAugmenter

Initialize the instance

Before using the augmenter, we will first initialize an instance of the augmenter.

Initialize Synonym Augmenter:

syn_aug = SynonymAugmenter()

Calling the function

After initializing the instance, you may call the augmenter function easily. For more information about the arguments required for each augmenter function, you may view them in the usage guide of other augmentation types:

-

Random Augmenter

-

Synonym Augmenter

-

Large Language Model (LLM) Augmenter

Using Synonym Augmenter on a sentence:

sample_text = "The quick brown fox jumps over the lazy dog." 
syn_aug(sample_text, aug_src='wordnet', aug_p=0.3)

Full code for the Synonym Augmenter Usage:

from NLarge.synonym import SynonymAugmenter

syn_aug = SynonymAugmenter()
sample_text = "The quick brown fox jumps over the lazy dog."
syn_aug(sample_text, aug_src='wordnet', aug_p=0.3)

Take note that the augmenter works on string level, this is done intentionally to provide for scalability and customization options. If you wish to perform augmenter on a dataset level, you would need to create helper functions to do so. You may find an example helper function to augment and enlarge the dataset in the helper functions guide inAugmenting Datasets.