File size: 3,386 Bytes
7d2e8eb
 
4019227
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7d2e8eb
 
4019227
7d2e8eb
4019227
7d2e8eb
7c86b0a
 
7d2e8eb
4019227
7d2e8eb
7c86b0a
 
7d2e8eb
4019227
 
 
5f5ead9
 
7d2e8eb
7c86b0a
 
 
 
 
 
 
7d2e8eb
7c86b0a
7d2e8eb
4019227
 
7d2e8eb
4019227
 
7d2e8eb
4019227
 
 
20c3b23
7c86b0a
ff17222
 
 
 
 
 
 
 
 
 
 
 
 
 
8115397
 
7c86b0a
189380e
ff17222
189380e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
---
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.