# How to best handle imbalanced text classification with Keras?

I implemented a text classification model using Keras.

Most of the datasets that I use are imbalanced. Therefore, I would like to use SMOTE to handle said imbalance.

I tried both on plain text, and once the text was vectorized, but I don't seem to be able to apply SMOTE on text data.

I use imblearn and received the following error:

Expected n_neighbors <= n_samples,  but n_samples = 3, n_neighbors = 6


How can I fix this error? And is SMOTE a good idea? If not, what other ways could I deal with class imbalance?