makcedward / nlpaug

Data augmentation for NLP
https://makcedward.github.io/
MIT License
4.42k stars 461 forks source link

Is it possible to use character aug with all the action (substitute, inset, delete, swap at the same time?) #274

Open keloemma opened 2 years ago

makcedward commented 2 years ago

Technically, it is doable. However, why do you want to generate this kind of synthetic data? Generating meaningful synthetic data helps to improve model performance.

You may use Flow and add all of the actions. Here is the sample code:

import nlpaug.augmenter.char as nac

aug = naf.Sequential([
    nac.RandomCharAug(action="insert"),
    nac.RandomCharAug(action="delete"),
    # ...
])

text = 'The quick brown fox jumps over the lazy dog'
aug.augment(text)