리뷰 감성 분석하기
여러분의 팀은 제품 리뷰에서 고객 감성을 모니터링하는 도구를 만들고 있어요. 첫 단계로, 사전 학습된 파이프라인을 사용해 개별 리뷰의 감성을 테스트해 보겠습니다.
이 연습은 강의의 일부입니다
Python으로 배우는 Natural Language Processing (NLP)
연습 안내
"distilbert-base-uncased-finetuned-sst-2-english"모델로sentiment-analysis용pipeline을 초기화하세요.pipeline을 사용해review_text의 감성을 분류하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
from transformers import pipeline
# Define the sentiment analysis pipeline
classifier = ____
review_text = "The new update made the app much faster and easier to use!"
# Get sentiment prediction
result = ____
print(result)