Analyzing the sentiment of a review
Your team is building a tool to monitor customer sentiment in product reviews. As a first step, you're testing the sentiment of individual reviews using a pre-trained pipeline.
Questo esercizio fa parte del corso
Natural Language Processing (NLP) in Python
Istruzioni dell'esercizio
- Initialize a
pipelineforsentiment-analysiswith the"distilbert-base-uncased-finetuned-sst-2-english"model. - Use the
pipelineto classify the sentiment ofreview_text.
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
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)