Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistent data type (list) for char augmenters #302

Closed
fratambot opened this issue Jun 22, 2022 · 1 comment
Closed

Consistent data type (list) for char augmenters #302

fratambot opened this issue Jun 22, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@fratambot
Copy link

First of all let me thank you for this amazing library !
I am using nlpaug.augmenter.char to augment my text data in different ways and I noticed that when I call the .augment() method with n=1 it returns a string:

import nlpaug.augmenter.char as nac
aug_typo = nac.KeyboardAug(...)
augmentations = aug_typo.augment("my string", n=1)
print(type(augmentations))

>> <class 'str'>

while for more than 1 augmentations it returns a list of strings:

import nlpaug.augmenter.char as nac
aug_typo = nac.KeyboardAug(...)
augmentations = aug_typo.augment("my string", n=2)
print(type(augmentations))

>> <class 'list'>

It would be nice to have always the same type of output, i.e. even with only 1 augmentation having a list with one string inside.

I don't know if it's going to produce regressions but as it is right now I have to check first if the output is a string or a list and in the latter case loop over the list to get the strings inside.

Many thanks in advance and have a nice day ! :)

@makcedward
Copy link
Owner

makcedward commented Jul 1, 2022

By design, the return type is the same as the input type. I agree that consistency is important and it will be enhanced in next release.

@makcedward makcedward added the enhancement New feature or request label Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants