시작하기무료로 시작하기

불용어 제거하기

여러분은 사용자 피드백을 "product issues", "service issues", "suggestions"와 같은 범주로 분류하는 프로젝트를 진행하고 있어요. 보통 불용어는 범주를 구분하는 데 큰 의미를 갖지 않죠. 이번 과제에서는 이러한 불용어를 제거해, 나중에 Machine Learning 모델이 피드백을 올바른 주제로 분류하는 데 도움이 되는 핵심 단어에 집중하도록 하세요.

nltk.tokenizeword_tokenizenltk.corpusstopwords.words는 이미 임포트되어 있어요. 또한 NLTK 리소스인 punkt_tabstopwords도 미리 다운로드되어 있어요.

이 연습은 강의의 일부입니다

Python으로 배우는 Natural Language Processing (NLP)

강의 보기

연습 안내

  • 제공된 피드백을 단어 단위로 토큰화하세요.
  • 영어 불용어 목록을 가져오세요.
  • 영어 불용어를 제거하고 결과를 filtered_tokens에 저장하세요.

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

feedback = "I reached out to support and got a helpful response within minutes!!! Very #impressed"

# Tokenize the text
tokens = word_tokenize(____)

# Get the list of English stop words
stop_words = stopwords.____('____')

# Remove stop words 
filtered_tokens = [____ for word in tokens if ____.lower() not in ____]

print(filtered_tokens)
코드 편집 및 실행