|
--- |
|
library_name: transformers |
|
language: |
|
- tr |
|
base_model: |
|
- dbmdz/bert-base-turkish-uncased |
|
|
|
tags: |
|
- text-classification |
|
- sequence-classification |
|
- transformers |
|
- turkish |
|
- intent-classification |
|
datasets: |
|
- custom |
|
metrics: |
|
- accuracy |
|
- f1 |
|
- precision |
|
- recall |
|
--- |
|
|
|
# 🔍 Query Classifier: Turkish BERT Model |
|
|
|
Bu model, Türkçe sorguları **"keyword"** ve **"semantic"** olmak üzere iki sınıfa ayırmak amacıyla eğitilmiş bir `BERT` tabanlı sıralı sınıflandırma (sequence classification) modelidir. Model, kısa metinlerin veya arama sorgularının niyetini (intent) belirlemede kullanılabilir. |
|
|
|
This model is a `BERT` based sequence classification model trained to classify Turkish queries into two classes, **“keyword ”** and **“semantic ”**. The model can be used to determine the intent of short texts or search queries. |
|
## 🧾 Kullanım Senaryosu ( Usage Scenario) |
|
|
|
Kullanıcıdan gelen bir sorgunun **anahtar kelime temelli mi**, yoksa **daha geniş anlamsal bağlam içeren** bir yapı mı taşıdığını tespit etmek için kullanılır. Bu sayede sorgular farklı işleme stratejilerine yönlendirilebilir. |
|
|
|
It is used to determine whether a query from a user is **keyword-based** or contains a **broader semantic context**. In this way, queries can be directed to different processing strategies. |
|
## 🧠 Model Detayları (Model Details) |
|
|
|
- **Model mimarisi:** BERT (`dbmdz/bert-base-turkish-uncased`) |
|
- **Eğitim verisi:** Özel olarak etiketlenmiş 2 sınıflı sorgu veri kümesi |
|
- **Etiketler:** |
|
- `keyword`: Daha çok başlık veya kısa anahtar ifadeler (örneğin: *Gece Gelen*, *Ozan Kılıç*) |
|
- `semantic`: Daha açıklayıcı veya anlam yüklü ifadeler (örneğin: *2020 yılı dram filmleri*, *Bilim kurgu filmleri*) |
|
|
|
- **Model architecture:** BERT (`dbmdz/bert-base-turkish-uncased`) |
|
- **Training data:** Specially labeled 2-class query dataset |
|
- **Tags:** |
|
- `keyword`: Mostly titles or short key phrases (e.g. *Gece Gelen*, *Ozan Kılıç*) |
|
- `semantic`: More descriptive or meaningful phrases (for example: *2020 drama movies*, *science fiction movies*) |
|
|
|
## 📈 Model Başarımı (Model Success) |
|
|
|
Test kümesi üzerinde elde edilen sonuçlar (Results obtained on the test set): |
|
|
|
```text |
|
precision recall f1-score support |
|
|
|
keyword 0.97 0.95 0.96 552 |
|
semantic 0.71 0.81 0.76 86 |
|
|
|
accuracy 0.93 638 |
|
macro avg 0.84 0.88 0.86 638 |
|
weighted avg 0.93 0.93 0.93 638 |
|
``` |
|
## 🚀 Kullanım Örneği (Usage) |
|
|
|
```python |
|
from transformers import AutoTokenizer, AutoModelForSequenceClassification |
|
import torch |
|
|
|
model = AutoModelForSequenceClassification.from_pretrained("melique/query-classifier") |
|
tokenizer = AutoTokenizer.from_pretrained("melique/query-classifier") |
|
|
|
text = "Yaşam" |
|
inputs = tokenizer(text, return_tensors="pt") |
|
outputs = model(**inputs) |
|
|
|
pred = torch.argmax(outputs.logits, dim=1).item() |
|
labels = ["keyword", "semantic"] |
|
print(f"Tahmin edilen sınıf: {labels[pred]}") |
|
``` |
|
## Lisans (License) |
|
Bu model, araştırma ve eğitim amaçlı olarak paylaşılmıştır. Ticari kullanımlar için model sahibi ile iletişime geçiniz. |
|
|
|
This model is shared for research and educational purposes. For commercial use, please contact the model owner. |
|
|