I just got started with NLP in machine learning. I was dealing with sentiment analysis for the Twitter dataset the part where I am confused is if we remove stop-words before stemming the words will it not affect the negative reviews like -"i food was not good" in these cases, even if make an exception for not what about the other words like wasn't don't so what do I do?
I taught about stemming the words and then removing the stop words but doesnt seem like good idea
This is one of the downsides to the bag-of-words way of doing sentiment analysis.
When you use transformer models to do sentiment analysis you don't remove stop words, or stem words. They give better results, especially with the larger models, but require more memory and CPU/GPU resources.
So if you have to stick with old-style sentiment analysis, remove "not" from your stopword list, or consider not using stop words at all. You can also add custom phrases to handle negatives and double negatives, e.g. see How to asses sentiment on "double negative" sentences