Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Natural Language Processing (NLP) in Python

Cursus bekijken

Oefeninstructies

  • 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 in candidate_labels.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

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'])
Code bewerken en uitvoeren