KiberAnalyc ABSA — v2
Türkçe otel yorumları için aspect-based sentiment analysis (ABSA). İki aşamalı sistem:
| Klasör | Görev | Mimari |
|---|---|---|
absa_detection_model_final/ |
Yorumda ilgili aspect geçiyor mu? | aspect-conditioned binary, eşik 0.35 |
absa_sentiment_model_final/ |
Geçen aspect için duygu | Pozitif / Negatif |
- Temel model:
dbmdz/convbert-base-turkish-mc4-cased - Maks. uzunluk: 512 token
- 27 aspect; aspect listesi, her aspect'in açıklama metni (
aspect2prompt) ve birleştirme haritası (merge_map)system_config.jsoniçinde.
v2'de değişenler
- Aspect seti 27'ye güncellendi;
spa_*alt aspect'lerispa'ya,havuz_termal→havuz,temizlik_banyo→oda_temizlikolarak birleştirildi.
Kullanım
import json, torch
from huggingface_hub import snapshot_download
from transformers import AutoTokenizer, AutoModelForSequenceClassification
path = snapshot_download("Can07/kiberanalyc-absa", revision="v2")
cfg = json.load(open(f"{path}/system_config.json"))
def load(name):
d = f"{path}/{name}"
return AutoTokenizer.from_pretrained(d), AutoModelForSequenceClassification.from_pretrained(d).eval()
det_tok, det = load("absa_detection_model_final")
sen_tok, sen = load("absa_sentiment_model_final")
@torch.no_grad()
def analyze(review):
results = {}
for aspect in cfg["aspects"]:
prompt = cfg["aspect2prompt"][aspect]
x = det_tok(prompt, review, truncation=True, max_length=cfg["max_length"], return_tensors="pt")
if det(**x).logits.softmax(-1)[0, 1] < cfg["detection_threshold"]:
continue
x = sen_tok(prompt, review, truncation=True, max_length=cfg["max_length"], return_tensors="pt")
results[aspect] = cfg["sent_id2label"][str(sen(**x).logits.argmax(-1).item())]
return results
print(analyze("Odalar temizdi ama yemekler çok lezzetsizdi."))
Sürümler
v1— ilk sürüm (revision="v1"ile erişilebilir)v2— bu sürüm
Model tree for Can07/kiberanalyc-absa
Base model
dbmdz/convbert-base-turkish-mc4-cased