Skip to content

Latest commit

 

History

History
 
 

text

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Text

Augmentations

Colab

Try running some AugLy text augmentations in Colab! For a full list of available augmentations, see here.

Our text augmentations use nlpaug as their backbone. All functions accept a list of original texts to be augmented as input and return the list of augmented texts.

Function-based

You can call the functional augmentations like so:

import augly.text as txtaugs

texts = ["hello world", "bye planet"]

augmented_synonyms = txtaugs.insert_punctuation_chars(
    texts,
    granularity="all",
    cadence=5.0,
    vary_chars=True,
)

Class-based

You can also call any augmentation as a Transform class with a given probability:

import augly.text as txtaugs

texts = ["hello world", "bye planet"]
transform = InsertPunctuationChars(granularity="all", p=0.5)
aug_texts = transform(texts)

Unit Tests

You can run our text unit tests if you have cloned augly (see here) by running the following:

python -m unittest discover -s augly/tests/text_tests/ -p "*"