Skip to main content

TürkRAG

CI PyPI License

All Contributors

Türkçe RAG sistemleri için arama kalitesi katmanı ve uçtan uca benchmark. A Turkish-aware retrieval layer and end-to-end benchmark for RAG systems.

Türkçe · English


Türkçe

TürkRAG; LangChain ve LlamaIndex'in yerini almaz, onların üzerine eklenen Türkçe'ye özel bir katmandır.

Sorun TürkRAG çözümü
Genel bölücüler Dr., vb., T.C. gibi kısaltmalarda cümleyi yanlış keser Türkçe kısaltma sözlüklü cümle bölücü, cümle sınırını asla bölmeyen chunker'lar
BM25 kitaplarımızdan ile kitapı eşleştiremez Kök tabanlı BM25 (Snowball, isteğe bağlı Zemberek)
I/ı, İ/i dönüşümü ve şapkalı harfler eşleşmeyi bozar Türkçe'ye uygun normalizasyon
Chunking × kök bulucu × arama × embedding kombinasyonlarını ölçen açık benchmark yok turkrag-bench ve LEADERBOARD

Kurulum

pip install turkrag                 # çekirdek: text, chunking, stem, BM25
pip install "turkrag[vector]"       # + sentence-transformers ile vektör arama
pip install "turkrag[langchain]"    # + LangChain entegrasyonu
pip install "turkrag[bench]"        # + benchmark CLI

Hızlı başlangıç

from turkrag.chunking import SentenceChunker
from turkrag.retrieval import HybridRetriever

chunks = SentenceChunker(max_chars=800, overlap_sentences=1).split(metin)
retriever = HybridRetriever.from_texts(
    chunks, embedding_model="intfloat/multilingual-e5-small", stemmer="snowball"
)
sonuclar = retriever.search("Türkiye'nin en uzun nehri hangisidir?", k=5)

İlk sonuçlar / First results

TurHistQuAD (1.024 soru), belge düzeyinde nDCG@10, CPU. Farklar eşli bootstrap testiyle sınandı (10.000 örnek). 24 karşılaştırmanın hepsine Holm düzeltmesi uygulandı. Parantez içindeki %95 güven aralığı düzeltilmemiş aralıktır. Bu yüzden aralığı 0'ı dışlayan bazı satırlar da, düzeltmeden sonra "fark yok" olarak işaretlendi. Ayrıntılar: FINDINGS · tüm satırlar: LEADERBOARD. Paired bootstrap, 10,000 resamples. "Significant" means Holm-adjusted p < 0.05 over all 24 comparisons; the bracketed 95% CI is uncorrected.

Karşılaştırma / Comparison Fark / Difference (nDCG@10) Sonuç / Result
Cümle tabanlı parçalama vs bütün belge (BM25) / sentence chunking vs whole documents +0.083 [+0.072, +0.094] anlamlı / significant
Parçalama vs bütün belge (vektör, e5-base) / chunking vs whole documents (vector) +0.064 [+0.054, +0.075] anlamlı / significant
BM25 + kök bulma vs kök bulmasız (3 kök bulucu × 4 chunker) / stemming vs none +0.016 … +0.035 12/12 anlamlı / significant
multilingual-e5-base vs bert-base-turkish-nli-stsb (vektör) +0.114 [+0.101, +0.128] anlamlı / significant
multilingual-e5-base vs multilingual-e5-small (vektör) +0.015 [+0.008, +0.022] anlamlı / significant
Zemberek vs Snowball (BM25) +0.009 [+0.003, +0.017] fark yok / no difference
Önek vs Snowball (BM25) / prefix vs Snowball +0.003 [−0.005, +0.010] fark yok / no difference
Cümle örtüşmesi / sentence overlap (sentence-300-1 vs 300-0) +0.002 [−0.001, +0.005] fark yok / no difference
En iyi hibrit vs en iyi vektör / best hybrid vs best vector (0.573 vs 0.564) +0.009 [+0.001, +0.016] fark yok / no difference
En iyi vektör vs en iyi BM25 / best vector vs best BM25 (0.564 vs 0.553) +0.011 [+0.000, +0.022] fark yok / no difference

Kısaca, bu veride parçalama, kök bulma ve model seçimi fark yaratıyor; hibrit arama ve kök bulucunun türü ise fark yaratmıyor. Kök bulmalı BM25 (sorgu başına 2.8 ms) e5-base ile vektör aramayla (57 ms) aynı düzeyde. In short: chunking, stemming and model choice matter; hybrid search and the choice of stemmer make no measurable difference on this data. Stemmed BM25 (2.8 ms/query) is on par with e5-base vector search (57 ms/query).

Sınırlılıklar / Limitations:

  • Tek veri kümesi (tarih ve teknoloji metinleri). Single dataset.
  • Her sorunun iki ilgili belgesinden biri birkaç kelimelik kısa cevap metni; bu, kelime eşleşmesini kayırabilir. One relevant document per query is a short answer string, which may favour lexical matching.
  • Yalnızca retrieval ölçüldü. Dört açık model CPU'da çalıştırıldı; BM25 ve RRF parametreleri ayarlanmadı. Retrieval only, four open models on CPU, untuned BM25/RRF parameters.

Katkı

İlk katkını 15 dakikada yapabilirsin: CONTRIBUTING.md · İlk katkı için uygun işler


English

TürkRAG does not replace LangChain or LlamaIndex; it is a Turkish-specific layer on top of them: abbreviation-aware sentence splitting, chunkers that never cut a sentence, stem-aware BM25, Turkish case/circumflex normalization, dense and hybrid (RRF) retrieval, and turkrag-bench, an open benchmark that measures chunker × stemmer × retriever × embedding-model combinations in a full retrieval pipeline.

pip install "turkrag[vector]"

See the quick start above. Contributions are welcome: CONTRIBUTING.md.


Katkıcılar / Contributors


Abuzer Harun Özarslan

💻 🚧

Lisans / License

Apache-2.0

Metadata

Release files for turkrag 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for turkrag 0.1.0
File Size Uploaded Provenance Actions
turkrag-0.1.0.tar.gz 65.6 kB With provenance Details for turkrag-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for turkrag 0.1.0
File Interpreter ABI Platform Actions
turkrag-0.1.0-py3-none-any.whl Python 3 none any Details for turkrag-0.1.0-py3-none-any.whl

Total release size: 131.3 kB

Release files / turkrag-0.1.0.tar.gz

Download URL turkrag-0.1.0.tar.gz
Size 65.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4300cafcac684597a3c71965d5f74ab88f8e450f4e0e24f8084dc81ac7fb4c7b
BLAKE2b-256 checksum
How to use checksums
554a84f39e03ca75469f3e43923f442f306a99f116669fc2e06ee33788b7756c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / turkrag-0.1.0-py3-none-any.whl

Download URL turkrag-0.1.0-py3-none-any.whl
Size 65.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aa08ff7f7f4fe696b22016cbcec0af32f73877fc7c812a4b389cdf1af8720d24
BLAKE2b-256 checksum
How to use checksums
94d739e783ef4fdfb4dd7b32b9b60fa69b165fade61c2417862aa856844eaf36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Security for turkrag 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for turkrag-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page