Not able to grasp some code

new_tokens = [token for token in tokens if token not in en_stopwords]

stemmed_tokens = [ps.stem(token) for token in new_tokens]

Not able to understand these 2 lines of codes…
please explain it.
please

Hey @mandeep3207, in the first line we are removing stopwords from the list, it is same as

new_tokens = []
for ix in tokens:
        if ix not in en_stopwords:
             new_tokens.append(ix)

Now, in the second line we are stemming words individually, it is same as

 stemmed_tokens = []
    for token in new_tokens:
            stemmed_tokens.append(ps.stem(token))

Just the difference is way of writing, everything is same.

Hope this cleared your doubt.
Plz mark the doubt as resolved in my doubts section. :blush:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.