You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the text has only one word, the function naw.RandomWordAug(action='swap') will change words in position 0 and position 1, then it will throw en error: IndexError: list index out of range. Maybe you can add a determine statement that if text has only one word, then return it directly.
The text was updated successfully, but these errors were encountered:
Exact error location: nlpaug/augmenter/word/random.py/ line 45 swap_position = self._get_swap_position(i, len(original_tokens) - 1). The swap_position will be 1 is there is only one token in text.
Similar problem happens when use naw.RandomWordAug(action=delete) while a text has only one token. In this scenario, the token will be deleted and the text will become nan.
If the text has only one word, the function
naw.RandomWordAug(action='swap')
will change words in position 0 and position 1, then it will throw en error:IndexError: list index out of range
. Maybe you can add a determine statement that if text has only one word, then return it directly.The text was updated successfully, but these errors were encountered: