|
Download README.md from Can07/kiberanalyc-absa: direct link, hf CLI and curl.
- Browser
- Download file 2.26 kB
-
https://huggingface.co/Can07/kiberanalyc-absa/resolve/main/README.md
- Command line
-
hf download hf://Can07/kiberanalyc-absa/README.md
-
curl -L -o README.md https://huggingface.co/Can07/kiberanalyc-absa/resolve/main/README.md
2.26 kB
| language: tr | |
| license: mit | |
| base_model: dbmdz/convbert-base-turkish-mc4-cased | |
| pipeline_tag: text-classification | |
| tags: | |
| - aspect-based-sentiment-analysis | |
| - absa | |
| - turkish | |
| - hotel-reviews | |
| - convbert | |
| - hotel | |
| - restaurant | |
| - hospitality | |
| # 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.json` içinde. | |
| ## v2'de değişenler | |
| - Aspect seti 27'ye güncellendi; `spa_*` alt aspect'leri `spa`'ya, `havuz_termal` → `havuz`, `temizlik_banyo` → `oda_temizlik` olarak birleştirildi. | |
| ## Kullanım | |
| ```python | |
| 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 | |