Detecting duplicate questions
A startup is developing a Q&A assistant to improve the user experience on their support forum. One key feature is to detect when users ask the same question using different words. You've been asked to implement a solution using a pre-trained QQP model that can determine whether two questions are duplicates.
Bu egzersiz
Natural Language Processing (NLP) in Python
kursunun bir parçasıdırEgzersiz talimatları
- Initialize a suitable
classifierpipeline with the"textattack/bert-base-uncased-QQP"model. - Use the pipeline to classify whether
question_1andquestion_2are paraphrases.
Uygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
from transformers import pipeline
# Initialize the pipeline
classifier = ____(task="____", model="____")
question_1 = "What's the process to change my password?"
question_2 = "How do I reset my account password?"
# Detect if the two questions are paraphrases
result = classifier({
"____": ____,
"____": ____
})
print(result)