Zero-shot classification of support tickets
A company receives hundreds of support tickets daily, covering topics like billing issues, technical problems, and account management. Manually sorting these tickets is inefficient. You've been asked to use a zero-shot classification model to automatically categorize incoming ticket messages without needing a custom-trained classifier.
This exercise is part of the course
Natural Language Processing (NLP) in Python
Exercise instructions
- Create a zero-shot
classifier
pipeline using the"MoritzLaurer/DeBERTa-v3-base-mnli-fever-anli"
model. - Use it to classify the
ticket_text
into one of the categories listed incandidate_labels
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
from transformers import pipeline
# Initialize the zero-shot classifier
classifier = ____
ticket_text = "I was charged twice for my subscription this month. Can you please refund the extra charge?"
candidate_labels = ["Billing", "Technical Issue", "Account Access"]
# Classify the ticket
result = ____
print(result['labels'])
print(result['scores'])