MulaiMulai sekarang secara 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.

Latihan ini adalah bagian dari kursus

Natural Language Processing (NLP) in Python

Lihat Kursus

Petunjuk latihan

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

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

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'])
Edit dan Jalankan Kode