IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Natural Language Processing (NLP) in Python

Visualizza il corso

Istruzioni dell'esercizio

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

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

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'])
Modifica ed esegui il codice