[Python] Python: appending list for NLP (stopwords)

Discussão em 'Python' iniciado por Stack, Junho 1, 2025.

  1. Stack

    Stack Membro Participativo

    I am using https://www.kaggle.com/datasets/kazanova/sentiment140 twiter dataset for NLP analysis. To do a text analysis for text mining classes I wanted to remove unnecessary words. Therefore I downloaded stopwords dataset.

    nltk.download('stopwords')
    stop=set(stopwords.words('english'))


    In the dataset I'm using there are however lots of words like I/I'm/me which I want to remove from analysis. However once I apply code to add items to the list then I receive an error: "AttributeError: 'set' object has no attribute 'append'"

    My code:

    list = ["I","I'm","--"]
    stop.append(list)
    print(stop)


    Can you please advise how may I correctly add new items to the 'stop' list?

    Thank you in advance for information.

    Continue reading...

Compartilhe esta Página