Soru benzerliği ve dilbilgisel doğruluk

Python ile Natural Language Processing (NLP)

Fouad Trad

Machine Learning Engineer

Soru benzerliği

  • İki sorunun yeniden ifade edilmiş hâller olup olmadığını belirler
  • Şunlar için yararlı:
    • Yinelenenleri kaldırma
    • Benzer soruları kümelendirme
    • Arama doğruluğunu artırma
  • Quora Question Pairs (QQP) veri kümesiyle eğitilmiş modellerle yapılır

Üç kişinin soru sorduğunu gösteren görsel.

Python ile Natural Language Processing (NLP)

QQP işlem hattı

from transformers import pipeline

qqp_pipeline = pipeline( task="text-classification", model="textattack/bert-base-uncased-QQP" )
question1 = "How can I learn Python?" question2 = "What is the best way to study Python?"
result = qqp_pipeline({"text": question1, "text_pair": question2})
print(result)
{'label': 'LABEL_1', 'score': 0.6853412985801697}
Python ile Natural Language Processing (NLP)

QQP işlem hattı

from transformers import pipeline
qqp_pipeline = pipeline(
    task="text-classification", 
    model="textattack/bert-base-uncased-QQP"
    )
question1 = "How can I learn Python?"
question2 = "What is the capital of France?"
result = qqp_pipeline({"text": question1, "text_pair": question2})
print(result)
{'label': 'LABEL_0', 'score': 0.9999338388442993}
Python ile Natural Language Processing (NLP)

Dilbilgisel doğruluğu değerlendirme

  • Bir metnin dilbilgisel olarak ne kadar doğru olduğunu değerlendirir
  • Şunlar için yararlı:

    • Eğitim araçları
    • Dilbilgisi denetleyicileri
    • Yazma asistanları
  • Linguistic Acceptability Derlemi (CoLA) ile eğitilmiş modellerle yapılır

Yazılı bir metnin doğruluğunu değerlendiren bir kişiyi gösteren görsel.

Python ile Natural Language Processing (NLP)

CoLA işlem hattı

from transformers import pipeline
cola_classifier = pipeline(
  task="text-classification", 
  model="textattack/distilbert-base-uncased-CoLA"
)

result = cola_classifier("The cat sat on the mat.")
print(result)
[{'label': 'LABEL_1', 'score': 0.9918296933174133}]
Python ile Natural Language Processing (NLP)

CoLA işlem hattı

from transformers import pipeline
cola_classifier = pipeline(
  task="text-classification", 
  model="textattack/distilbert-base-uncased-CoLA"
)
result = cola_classifier("The cat on sat mat the.")
print(result)
[{'label': 'LABEL_0', 'score': 0.9628171324729919}]
Python ile Natural Language Processing (NLP)

Hadi pratik yapalım!

Python ile Natural Language Processing (NLP)

Preparing Video For Download...