turkrag 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- turkrag-0.1.0/.gitignore +30 -0
- turkrag-0.1.0/CHANGELOG.md +24 -0
- turkrag-0.1.0/LICENSE +202 -0
- turkrag-0.1.0/PKG-INFO +173 -0
- turkrag-0.1.0/README.md +117 -0
- turkrag-0.1.0/bench/README.md +68 -0
- turkrag-0.1.0/bench/configs/models/README.md +28 -0
- turkrag-0.1.0/pyproject.toml +135 -0
- turkrag-0.1.0/src/turkrag/__init__.py +20 -0
- turkrag-0.1.0/src/turkrag/_registry.py +87 -0
- turkrag-0.1.0/src/turkrag/bench/__init__.py +11 -0
- turkrag-0.1.0/src/turkrag/bench/cli.py +203 -0
- turkrag-0.1.0/src/turkrag/bench/config.py +215 -0
- turkrag-0.1.0/src/turkrag/bench/datasets.py +242 -0
- turkrag-0.1.0/src/turkrag/bench/leaderboard.py +166 -0
- turkrag-0.1.0/src/turkrag/bench/metrics.py +80 -0
- turkrag-0.1.0/src/turkrag/bench/runner.py +303 -0
- turkrag-0.1.0/src/turkrag/bench/stats.py +195 -0
- turkrag-0.1.0/src/turkrag/chunking/__init__.py +29 -0
- turkrag-0.1.0/src/turkrag/chunking/_packing.py +73 -0
- turkrag-0.1.0/src/turkrag/chunking/base.py +139 -0
- turkrag-0.1.0/src/turkrag/chunking/paragraph.py +81 -0
- turkrag-0.1.0/src/turkrag/chunking/sentence.py +66 -0
- turkrag-0.1.0/src/turkrag/chunking/window.py +90 -0
- turkrag-0.1.0/src/turkrag/integrations/__init__.py +10 -0
- turkrag-0.1.0/src/turkrag/integrations/langchain.py +121 -0
- turkrag-0.1.0/src/turkrag/integrations/llamaindex.py +75 -0
- turkrag-0.1.0/src/turkrag/py.typed +0 -0
- turkrag-0.1.0/src/turkrag/retrieval/__init__.py +36 -0
- turkrag-0.1.0/src/turkrag/retrieval/base.py +135 -0
- turkrag-0.1.0/src/turkrag/retrieval/bm25.py +125 -0
- turkrag-0.1.0/src/turkrag/retrieval/embeddings.py +178 -0
- turkrag-0.1.0/src/turkrag/retrieval/fusion.py +180 -0
- turkrag-0.1.0/src/turkrag/retrieval/vector.py +113 -0
- turkrag-0.1.0/src/turkrag/stem/__init__.py +33 -0
- turkrag-0.1.0/src/turkrag/stem/base.py +126 -0
- turkrag-0.1.0/src/turkrag/stem/simple.py +67 -0
- turkrag-0.1.0/src/turkrag/stem/snowball.py +39 -0
- turkrag-0.1.0/src/turkrag/stem/zemberek.py +78 -0
- turkrag-0.1.0/src/turkrag/text/__init__.py +33 -0
- turkrag-0.1.0/src/turkrag/text/abbreviations.py +95 -0
- turkrag-0.1.0/src/turkrag/text/casing.py +73 -0
- turkrag-0.1.0/src/turkrag/text/data/abbreviations.txt +116 -0
- turkrag-0.1.0/src/turkrag/text/normalize.py +133 -0
- turkrag-0.1.0/src/turkrag/text/sentences.py +185 -0
- turkrag-0.1.0/src/turkrag/text/tokenize.py +47 -0
- turkrag-0.1.0/tests/__init__.py +0 -0
- turkrag-0.1.0/tests/bench/__init__.py +0 -0
- turkrag-0.1.0/tests/bench/test_bench.py +175 -0
- turkrag-0.1.0/tests/bench/test_stats.py +177 -0
- turkrag-0.1.0/tests/chunking/__init__.py +0 -0
- turkrag-0.1.0/tests/chunking/conftest.py +23 -0
- turkrag-0.1.0/tests/chunking/test_chunkers.py +243 -0
- turkrag-0.1.0/tests/integrations/__init__.py +0 -0
- turkrag-0.1.0/tests/integrations/test_langchain.py +53 -0
- turkrag-0.1.0/tests/integrations/test_llamaindex.py +28 -0
- turkrag-0.1.0/tests/retrieval/__init__.py +0 -0
- turkrag-0.1.0/tests/retrieval/conftest.py +57 -0
- turkrag-0.1.0/tests/retrieval/test_bm25.py +112 -0
- turkrag-0.1.0/tests/retrieval/test_vector_hybrid.py +207 -0
- turkrag-0.1.0/tests/stem/__init__.py +0 -0
- turkrag-0.1.0/tests/stem/test_contract.py +69 -0
- turkrag-0.1.0/tests/stem/test_stemmers.py +96 -0
- turkrag-0.1.0/tests/stem/test_zemberek.py +38 -0
- turkrag-0.1.0/tests/text/__init__.py +0 -0
- turkrag-0.1.0/tests/text/test_abbreviations.py +41 -0
- turkrag-0.1.0/tests/text/test_casing.py +49 -0
- turkrag-0.1.0/tests/text/test_normalize.py +54 -0
- turkrag-0.1.0/tests/text/test_sentences.py +102 -0
- turkrag-0.1.0/tests/text/test_tokenize.py +37 -0
turkrag-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
build/
|
|
6
|
+
dist/
|
|
7
|
+
.venv/
|
|
8
|
+
.mypy_cache/
|
|
9
|
+
.ruff_cache/
|
|
10
|
+
.pytest_cache/
|
|
11
|
+
.coverage
|
|
12
|
+
htmlcov/
|
|
13
|
+
.ipynb_checkpoints/
|
|
14
|
+
|
|
15
|
+
# Environment / secrets
|
|
16
|
+
.env
|
|
17
|
+
.env.*
|
|
18
|
+
|
|
19
|
+
# Docs build
|
|
20
|
+
site/
|
|
21
|
+
|
|
22
|
+
# Benchmark caches (results/*.json ARE committed)
|
|
23
|
+
bench/.cache/
|
|
24
|
+
bench/datasets/*/raw/
|
|
25
|
+
|
|
26
|
+
# OS / editor
|
|
27
|
+
.DS_Store
|
|
28
|
+
Thumbs.db
|
|
29
|
+
.idea/
|
|
30
|
+
.vscode/
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. Format: [Keep a Changelog](https://keepachangelog.com/), versioning: [SemVer](https://semver.org/).
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [0.1.0] - 2026-11-30
|
|
8
|
+
|
|
9
|
+
First public release.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- `turkrag.stem`: `Stemmer` interface and registry with Snowball (default), prefix (F5), Zemberek (optional) and identity stemmers.
|
|
13
|
+
- `turkrag.retrieval.BM25Retriever`: stem-aware BM25 (Okapi with Lucene IDF, BM25L, BM25+), stopwords, chunk metadata.
|
|
14
|
+
- `turkrag.chunking`: `SentenceChunker`, `ParagraphChunker`, `WindowChunker` with exact character offsets; chunker registry.
|
|
15
|
+
- `turkrag.text`: Turkish casing, normalization, tokenization, abbreviation dictionary and sentence splitter.
|
|
16
|
+
- `VectorRetriever` (sentence-transformers or any `Embedder`, automatic E5/BGE/Nomic prefixes), `HybridRetriever` and `reciprocal_rank_fusion`.
|
|
17
|
+
- `turkrag.integrations`: LangChain `TurkishTextSplitter` / `TurkRAGRetriever`, LlamaIndex `TurkishNodeParser`.
|
|
18
|
+
- `turkrag-bench` CLI (`run`, `leaderboard`, `list`): chunker × stemmer × retriever × model grid, Recall@5/10, MRR@10, nDCG@10, index time and query latency; YAML model cards; TurHistQuadRetrieval loader (MIT).
|
|
19
|
+
- `turkrag-bench compare A B`: paired bootstrap (10,000 resamples, fixed seed) with mean difference, 95% CI and p-value; `turkrag.bench.stats` (`paired_bootstrap`, `bootstrap_ci`, `holm`). Result files store per-query nDCG@10, MRR@10 and Recall@5; the leaderboard shows a 95% CI for nDCG@10.
|
|
20
|
+
- `bench/FINDINGS.md`: significance-tested findings on TurHistQuAD (24 comparisons, Holm-corrected).
|
|
21
|
+
- Documentation site (MkDocs Material): quickstart, user guide (text, chunking, stemming, retrieval, LangChain/LlamaIndex, benchmark), API reference; example notebook `examples/quickstart.ipynb`; 15 good first issue drafts.
|
|
22
|
+
|
|
23
|
+
[Unreleased]: https://github.com/AbuzerHarunOzarslan/turkrag/compare/v0.1.0...HEAD
|
|
24
|
+
[0.1.0]: https://github.com/AbuzerHarunOzarslan/turkrag/releases/tag/v0.1.0
|
turkrag-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
turkrag-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: turkrag
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Turkish-aware chunking, stemming and retrieval for RAG pipelines, plus an end-to-end Turkish RAG benchmark.
|
|
5
|
+
Project-URL: Homepage, https://github.com/AbuzerHarunOzarslan/turkrag
|
|
6
|
+
Project-URL: Documentation, https://abuzerharunozarslan.github.io/turkrag/
|
|
7
|
+
Project-URL: Repository, https://github.com/AbuzerHarunOzarslan/turkrag
|
|
8
|
+
Project-URL: Issues, https://github.com/AbuzerHarunOzarslan/turkrag/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/AbuzerHarunOzarslan/turkrag/blob/main/CHANGELOG.md
|
|
10
|
+
Author: Abuzer Harun Özarslan
|
|
11
|
+
License-Expression: Apache-2.0
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: benchmark,bm25,chunking,nlp,rag,retrieval,stemming,turkish
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Intended Audience :: Science/Research
|
|
17
|
+
Classifier: Natural Language :: Turkish
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
24
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
25
|
+
Classifier: Typing :: Typed
|
|
26
|
+
Requires-Python: >=3.10
|
|
27
|
+
Requires-Dist: numpy>=1.24
|
|
28
|
+
Requires-Dist: rank-bm25>=0.2.2
|
|
29
|
+
Requires-Dist: snowballstemmer>=2.2
|
|
30
|
+
Provides-Extra: all
|
|
31
|
+
Requires-Dist: huggingface-hub>=0.23; extra == 'all'
|
|
32
|
+
Requires-Dist: langchain-core>=0.3; extra == 'all'
|
|
33
|
+
Requires-Dist: langchain-text-splitters>=0.3; extra == 'all'
|
|
34
|
+
Requires-Dist: llama-index-core>=0.10; extra == 'all'
|
|
35
|
+
Requires-Dist: pyarrow>=14; extra == 'all'
|
|
36
|
+
Requires-Dist: pyyaml>=6.0; extra == 'all'
|
|
37
|
+
Requires-Dist: sentence-transformers>=2.7; extra == 'all'
|
|
38
|
+
Requires-Dist: setuptools<81,>=65; extra == 'all'
|
|
39
|
+
Requires-Dist: zemberek-python>=0.2.3; extra == 'all'
|
|
40
|
+
Provides-Extra: bench
|
|
41
|
+
Requires-Dist: huggingface-hub>=0.23; extra == 'bench'
|
|
42
|
+
Requires-Dist: pyarrow>=14; extra == 'bench'
|
|
43
|
+
Requires-Dist: pyyaml>=6.0; extra == 'bench'
|
|
44
|
+
Requires-Dist: sentence-transformers>=2.7; extra == 'bench'
|
|
45
|
+
Provides-Extra: langchain
|
|
46
|
+
Requires-Dist: langchain-core>=0.3; extra == 'langchain'
|
|
47
|
+
Requires-Dist: langchain-text-splitters>=0.3; extra == 'langchain'
|
|
48
|
+
Provides-Extra: llamaindex
|
|
49
|
+
Requires-Dist: llama-index-core>=0.10; extra == 'llamaindex'
|
|
50
|
+
Provides-Extra: vector
|
|
51
|
+
Requires-Dist: sentence-transformers>=2.7; extra == 'vector'
|
|
52
|
+
Provides-Extra: zemberek
|
|
53
|
+
Requires-Dist: setuptools<81,>=65; extra == 'zemberek'
|
|
54
|
+
Requires-Dist: zemberek-python>=0.2.3; extra == 'zemberek'
|
|
55
|
+
Description-Content-Type: text/markdown
|
|
56
|
+
|
|
57
|
+
# TürkRAG
|
|
58
|
+
|
|
59
|
+
[](https://github.com/AbuzerHarunOzarslan/turkrag/actions/workflows/ci.yml)
|
|
60
|
+
[](https://pypi.org/project/turkrag/)
|
|
61
|
+
[](LICENSE)
|
|
62
|
+
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
63
|
+
[](#katkıcılar--contributors)
|
|
64
|
+
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
65
|
+
|
|
66
|
+
**Türkçe RAG sistemleri için arama kalitesi katmanı ve uçtan uca benchmark.**
|
|
67
|
+
*A Turkish-aware retrieval layer and end-to-end benchmark for RAG systems.*
|
|
68
|
+
|
|
69
|
+
[Türkçe](#türkçe) · [English](#english)
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Türkçe
|
|
74
|
+
|
|
75
|
+
TürkRAG; LangChain ve LlamaIndex'in **yerini almaz**, onların üzerine eklenen Türkçe'ye özel bir katmandır.
|
|
76
|
+
|
|
77
|
+
| Sorun | TürkRAG çözümü |
|
|
78
|
+
|---|---|
|
|
79
|
+
| 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 |
|
|
80
|
+
| BM25 `kitaplarımızdan` ile `kitap`ı eşleştiremez | Kök tabanlı BM25 (Snowball, isteğe bağlı Zemberek) |
|
|
81
|
+
| `I`/`ı`, `İ`/`i` dönüşümü ve şapkalı harfler eşleşmeyi bozar | Türkçe'ye uygun normalizasyon |
|
|
82
|
+
| Chunking × kök bulucu × arama × embedding kombinasyonlarını ölçen açık benchmark yok | `turkrag-bench` ve [LEADERBOARD](bench/LEADERBOARD.md) |
|
|
83
|
+
|
|
84
|
+
### Kurulum
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
pip install turkrag # çekirdek: text, chunking, stem, BM25
|
|
88
|
+
pip install "turkrag[vector]" # + sentence-transformers ile vektör arama
|
|
89
|
+
pip install "turkrag[langchain]" # + LangChain entegrasyonu
|
|
90
|
+
pip install "turkrag[bench]" # + benchmark CLI
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Hızlı başlangıç
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
from turkrag.chunking import SentenceChunker
|
|
97
|
+
from turkrag.retrieval import HybridRetriever
|
|
98
|
+
|
|
99
|
+
chunks = SentenceChunker(max_chars=800, overlap_sentences=1).split(metin)
|
|
100
|
+
retriever = HybridRetriever.from_texts(
|
|
101
|
+
chunks, embedding_model="intfloat/multilingual-e5-small", stemmer="snowball"
|
|
102
|
+
)
|
|
103
|
+
sonuclar = retriever.search("Türkiye'nin en uzun nehri hangisidir?", k=5)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### İlk sonuçlar / First results
|
|
107
|
+
|
|
108
|
+
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](bench/FINDINGS.md) · tüm satırlar: [LEADERBOARD](bench/LEADERBOARD.md).
|
|
109
|
+
*Paired bootstrap, 10,000 resamples. "Significant" means Holm-adjusted p < 0.05 over all 24 comparisons; the bracketed 95% CI is uncorrected.*
|
|
110
|
+
|
|
111
|
+
| Karşılaştırma / Comparison | Fark / Difference (nDCG@10) | Sonuç / Result |
|
|
112
|
+
|---|---:|---|
|
|
113
|
+
| Cümle tabanlı parçalama vs bütün belge (BM25) / sentence chunking vs whole documents | +0.083 [+0.072, +0.094] | **anlamlı / significant** |
|
|
114
|
+
| Parçalama vs bütün belge (vektör, e5-base) / chunking vs whole documents (vector) | +0.064 [+0.054, +0.075] | **anlamlı / significant** |
|
|
115
|
+
| 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** |
|
|
116
|
+
| multilingual-e5-base vs bert-base-turkish-nli-stsb (vektör) | +0.114 [+0.101, +0.128] | **anlamlı / significant** |
|
|
117
|
+
| multilingual-e5-base vs multilingual-e5-small (vektör) | +0.015 [+0.008, +0.022] | **anlamlı / significant** |
|
|
118
|
+
| Zemberek vs Snowball (BM25) | +0.009 [+0.003, +0.017] | fark yok / no difference |
|
|
119
|
+
| Önek vs Snowball (BM25) / prefix vs Snowball | +0.003 [−0.005, +0.010] | fark yok / no difference |
|
|
120
|
+
| Cümle örtüşmesi / sentence overlap (sentence-300-1 vs 300-0) | +0.002 [−0.001, +0.005] | fark yok / no difference |
|
|
121
|
+
| 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 |
|
|
122
|
+
| 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 |
|
|
123
|
+
|
|
124
|
+
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.
|
|
125
|
+
*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).*
|
|
126
|
+
|
|
127
|
+
**Sınırlılıklar / Limitations:**
|
|
128
|
+
- Tek veri kümesi (tarih ve teknoloji metinleri). *Single dataset.*
|
|
129
|
+
- 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.*
|
|
130
|
+
- 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.*
|
|
131
|
+
|
|
132
|
+
### Katkı
|
|
133
|
+
|
|
134
|
+
İlk katkını 15 dakikada yapabilirsin: [CONTRIBUTING.md](CONTRIBUTING.md) ·
|
|
135
|
+
[İlk katkı için uygun işler](docs/good-first-issues.md)
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## English
|
|
140
|
+
|
|
141
|
+
TürkRAG does **not** replace LangChain or LlamaIndex; it is a Turkish-specific layer on top of them:
|
|
142
|
+
abbreviation-aware sentence splitting, chunkers that never cut a sentence, stem-aware BM25,
|
|
143
|
+
Turkish case/circumflex normalization, dense and hybrid (RRF) retrieval, and `turkrag-bench`, an
|
|
144
|
+
open benchmark that measures chunker × stemmer × retriever × embedding-model combinations in a full
|
|
145
|
+
retrieval pipeline.
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
pip install "turkrag[vector]"
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
See the quick start above. Contributions are welcome: [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Katkıcılar / Contributors
|
|
156
|
+
|
|
157
|
+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
158
|
+
<!-- prettier-ignore-start -->
|
|
159
|
+
<!-- markdownlint-disable -->
|
|
160
|
+
<table>
|
|
161
|
+
<tbody>
|
|
162
|
+
<tr>
|
|
163
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/AbuzerHarunOzarslan"><img src="https://avatars.githubusercontent.com/AbuzerHarunOzarslan?s=100" width="100px;" alt=""/><br /><sub><b>Abuzer Harun Özarslan</b></sub></a><br /><a href="#code-AbuzerHarunOzarslan" title="Code">💻</a> <a href="#maintenance-AbuzerHarunOzarslan" title="Maintenance">🚧</a></td>
|
|
164
|
+
</tr>
|
|
165
|
+
</tbody>
|
|
166
|
+
</table>
|
|
167
|
+
<!-- markdownlint-restore -->
|
|
168
|
+
<!-- prettier-ignore-end -->
|
|
169
|
+
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
170
|
+
|
|
171
|
+
## Lisans / License
|
|
172
|
+
|
|
173
|
+
[Apache-2.0](LICENSE)
|
turkrag-0.1.0/README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# TürkRAG
|
|
2
|
+
|
|
3
|
+
[](https://github.com/AbuzerHarunOzarslan/turkrag/actions/workflows/ci.yml)
|
|
4
|
+
[](https://pypi.org/project/turkrag/)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
7
|
+
[](#katkıcılar--contributors)
|
|
8
|
+
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
9
|
+
|
|
10
|
+
**Türkçe RAG sistemleri için arama kalitesi katmanı ve uçtan uca benchmark.**
|
|
11
|
+
*A Turkish-aware retrieval layer and end-to-end benchmark for RAG systems.*
|
|
12
|
+
|
|
13
|
+
[Türkçe](#türkçe) · [English](#english)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Türkçe
|
|
18
|
+
|
|
19
|
+
TürkRAG; LangChain ve LlamaIndex'in **yerini almaz**, onların üzerine eklenen Türkçe'ye özel bir katmandır.
|
|
20
|
+
|
|
21
|
+
| Sorun | TürkRAG çözümü |
|
|
22
|
+
|---|---|
|
|
23
|
+
| 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 |
|
|
24
|
+
| BM25 `kitaplarımızdan` ile `kitap`ı eşleştiremez | Kök tabanlı BM25 (Snowball, isteğe bağlı Zemberek) |
|
|
25
|
+
| `I`/`ı`, `İ`/`i` dönüşümü ve şapkalı harfler eşleşmeyi bozar | Türkçe'ye uygun normalizasyon |
|
|
26
|
+
| Chunking × kök bulucu × arama × embedding kombinasyonlarını ölçen açık benchmark yok | `turkrag-bench` ve [LEADERBOARD](bench/LEADERBOARD.md) |
|
|
27
|
+
|
|
28
|
+
### Kurulum
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install turkrag # çekirdek: text, chunking, stem, BM25
|
|
32
|
+
pip install "turkrag[vector]" # + sentence-transformers ile vektör arama
|
|
33
|
+
pip install "turkrag[langchain]" # + LangChain entegrasyonu
|
|
34
|
+
pip install "turkrag[bench]" # + benchmark CLI
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Hızlı başlangıç
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from turkrag.chunking import SentenceChunker
|
|
41
|
+
from turkrag.retrieval import HybridRetriever
|
|
42
|
+
|
|
43
|
+
chunks = SentenceChunker(max_chars=800, overlap_sentences=1).split(metin)
|
|
44
|
+
retriever = HybridRetriever.from_texts(
|
|
45
|
+
chunks, embedding_model="intfloat/multilingual-e5-small", stemmer="snowball"
|
|
46
|
+
)
|
|
47
|
+
sonuclar = retriever.search("Türkiye'nin en uzun nehri hangisidir?", k=5)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### İlk sonuçlar / First results
|
|
51
|
+
|
|
52
|
+
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](bench/FINDINGS.md) · tüm satırlar: [LEADERBOARD](bench/LEADERBOARD.md).
|
|
53
|
+
*Paired bootstrap, 10,000 resamples. "Significant" means Holm-adjusted p < 0.05 over all 24 comparisons; the bracketed 95% CI is uncorrected.*
|
|
54
|
+
|
|
55
|
+
| Karşılaştırma / Comparison | Fark / Difference (nDCG@10) | Sonuç / Result |
|
|
56
|
+
|---|---:|---|
|
|
57
|
+
| Cümle tabanlı parçalama vs bütün belge (BM25) / sentence chunking vs whole documents | +0.083 [+0.072, +0.094] | **anlamlı / significant** |
|
|
58
|
+
| Parçalama vs bütün belge (vektör, e5-base) / chunking vs whole documents (vector) | +0.064 [+0.054, +0.075] | **anlamlı / significant** |
|
|
59
|
+
| 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** |
|
|
60
|
+
| multilingual-e5-base vs bert-base-turkish-nli-stsb (vektör) | +0.114 [+0.101, +0.128] | **anlamlı / significant** |
|
|
61
|
+
| multilingual-e5-base vs multilingual-e5-small (vektör) | +0.015 [+0.008, +0.022] | **anlamlı / significant** |
|
|
62
|
+
| Zemberek vs Snowball (BM25) | +0.009 [+0.003, +0.017] | fark yok / no difference |
|
|
63
|
+
| Önek vs Snowball (BM25) / prefix vs Snowball | +0.003 [−0.005, +0.010] | fark yok / no difference |
|
|
64
|
+
| Cümle örtüşmesi / sentence overlap (sentence-300-1 vs 300-0) | +0.002 [−0.001, +0.005] | fark yok / no difference |
|
|
65
|
+
| 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 |
|
|
66
|
+
| 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 |
|
|
67
|
+
|
|
68
|
+
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.
|
|
69
|
+
*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).*
|
|
70
|
+
|
|
71
|
+
**Sınırlılıklar / Limitations:**
|
|
72
|
+
- Tek veri kümesi (tarih ve teknoloji metinleri). *Single dataset.*
|
|
73
|
+
- 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.*
|
|
74
|
+
- 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.*
|
|
75
|
+
|
|
76
|
+
### Katkı
|
|
77
|
+
|
|
78
|
+
İlk katkını 15 dakikada yapabilirsin: [CONTRIBUTING.md](CONTRIBUTING.md) ·
|
|
79
|
+
[İlk katkı için uygun işler](docs/good-first-issues.md)
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## English
|
|
84
|
+
|
|
85
|
+
TürkRAG does **not** replace LangChain or LlamaIndex; it is a Turkish-specific layer on top of them:
|
|
86
|
+
abbreviation-aware sentence splitting, chunkers that never cut a sentence, stem-aware BM25,
|
|
87
|
+
Turkish case/circumflex normalization, dense and hybrid (RRF) retrieval, and `turkrag-bench`, an
|
|
88
|
+
open benchmark that measures chunker × stemmer × retriever × embedding-model combinations in a full
|
|
89
|
+
retrieval pipeline.
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
pip install "turkrag[vector]"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
See the quick start above. Contributions are welcome: [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Katkıcılar / Contributors
|
|
100
|
+
|
|
101
|
+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
102
|
+
<!-- prettier-ignore-start -->
|
|
103
|
+
<!-- markdownlint-disable -->
|
|
104
|
+
<table>
|
|
105
|
+
<tbody>
|
|
106
|
+
<tr>
|
|
107
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/AbuzerHarunOzarslan"><img src="https://avatars.githubusercontent.com/AbuzerHarunOzarslan?s=100" width="100px;" alt=""/><br /><sub><b>Abuzer Harun Özarslan</b></sub></a><br /><a href="#code-AbuzerHarunOzarslan" title="Code">💻</a> <a href="#maintenance-AbuzerHarunOzarslan" title="Maintenance">🚧</a></td>
|
|
108
|
+
</tr>
|
|
109
|
+
</tbody>
|
|
110
|
+
</table>
|
|
111
|
+
<!-- markdownlint-restore -->
|
|
112
|
+
<!-- prettier-ignore-end -->
|
|
113
|
+
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
114
|
+
|
|
115
|
+
## Lisans / License
|
|
116
|
+
|
|
117
|
+
[Apache-2.0](LICENSE)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# turkrag-bench
|
|
2
|
+
|
|
3
|
+
Türkçe RAG için uçtan uca retrieval benchmark'ı. TR-MTEB yalnızca embedding modellerini ölçer;
|
|
4
|
+
`turkrag-bench` ise **chunker × kök bulucu × arama yöntemi × embedding modeli** kombinasyonlarını
|
|
5
|
+
tam bir arama hattında ölçer.
|
|
6
|
+
|
|
7
|
+
*End-to-end retrieval benchmark for Turkish RAG. TR-MTEB scores embedding models; `turkrag-bench`
|
|
8
|
+
scores **chunker × stemmer × retriever × embedding model** combinations in a full retrieval
|
|
9
|
+
pipeline.*
|
|
10
|
+
|
|
11
|
+
📊 Sonuçlar / Results: [LEADERBOARD.md](LEADERBOARD.md)
|
|
12
|
+
|
|
13
|
+
## Kullanım / Usage
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install "turkrag[bench,zemberek]" # ya da repo içinde / or in the repo: uv sync --all-extras
|
|
17
|
+
|
|
18
|
+
turkrag-bench list # veri setleri, ızgara, modeller / datasets, grid, models
|
|
19
|
+
turkrag-bench run --limit-queries 50 # hızlı deneme / quick smoke run
|
|
20
|
+
turkrag-bench run # tam ızgara / full grid (CPU'da ~1 saat / ~1 h on CPU)
|
|
21
|
+
turkrag-bench run --models multilingual-e5-small --retrievers bm25,hybrid
|
|
22
|
+
turkrag-bench leaderboard # LEADERBOARD.md'yi yeniden üret / rebuild it
|
|
23
|
+
turkrag-bench compare \
|
|
24
|
+
turhistquad__window-2-1__hybrid__zemberek__multilingual-e5-base \
|
|
25
|
+
turhistquad__sentence-300-0__vector__-__multilingual-e5-base # eşli bootstrap / paired bootstrap
|
|
26
|
+
python bench/findings.py # FINDINGS.md tablosu / significance table
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Komutları repo kök klasöründen çalıştır (varsayılan yollar `bench/...`).
|
|
30
|
+
*Run from the repository root (default paths are `bench/...`).*
|
|
31
|
+
|
|
32
|
+
## Klasörler / Layout
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
bench/
|
|
36
|
+
├── configs/
|
|
37
|
+
│ ├── grid.yaml # ızgara: veri setleri, chunker'lar, stemmer'lar, retriever'lar
|
|
38
|
+
│ └── models/*.yaml # her embedding modeli = tek YAML / one YAML per model
|
|
39
|
+
├── datasets/*.md # veri kartları (kaynak, lisans, istatistik) / data cards
|
|
40
|
+
├── results/*.json # her ızgara hücresi için bir dosya / one file per grid cell
|
|
41
|
+
└── LEADERBOARD.md # results/ klasöründen üretilir / generated from results/
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Ölçülenler / What is measured
|
|
45
|
+
|
|
46
|
+
| Alan / Field | Açıklama / Description |
|
|
47
|
+
|---|---|
|
|
48
|
+
| `ndcg@10` | Ana sıralama metriği / primary metric |
|
|
49
|
+
| `mrr@10`, `recall@5`, `recall@10` | Belge düzeyinde / document level |
|
|
50
|
+
| `index_seconds` | Parçalama + indeks kurma (model yükleme hariç) / chunking + indexing (model load excluded) |
|
|
51
|
+
| `query_ms_mean`, `query_ms_p95` | Tek sorgu gecikmesi / single-query latency |
|
|
52
|
+
|
|
53
|
+
Hibrit hücreler aynı chunker için kurulmuş BM25 ve vektör indekslerini yeniden kullanır; indeks
|
|
54
|
+
süreleri ikisinin toplamıdır. *Hybrid cells reuse the BM25 and vector indexes built for the same
|
|
55
|
+
chunker; their index time is the sum of both.*
|
|
56
|
+
|
|
57
|
+
## Katkı / Contributing
|
|
58
|
+
|
|
59
|
+
- **Model eklemek / Add a model:** [`configs/models/README.md`](configs/models/README.md), tek YAML.
|
|
60
|
+
- **Veri seti eklemek / Add a dataset:** `src/turkrag/bench/datasets.py` içinde
|
|
61
|
+
`@register_dataset("ad", info)` ile bir yükleyici yaz, `bench/datasets/<ad>.md` veri kartını ekle
|
|
62
|
+
(lisansı mutlaka kontrol et). *Write a loader with `@register_dataset`, add a data card and
|
|
63
|
+
always check the license.*
|
|
64
|
+
- Sonuç dosyalarını ve yeniden üretilmiş `LEADERBOARD.md`'yi PR'a ekle.
|
|
65
|
+
*Include the result files and the regenerated `LEADERBOARD.md` in your PR.*
|
|
66
|
+
|
|
67
|
+
Sonuçlar donanıma bağlıdır (özellikle süreler); ortam bilgisi her JSON dosyasına yazılır.
|
|
68
|
+
*Timings depend on hardware; the environment is recorded in every result file.*
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Benchmark modelleri / Benchmark models
|
|
2
|
+
|
|
3
|
+
Benchmark'a model eklemek için bu klasöre **tek bir YAML dosyası** ekle, kod yazmana gerek yok.
|
|
4
|
+
*To add a model to the benchmark, add **one YAML file** here. No code needed.*
|
|
5
|
+
|
|
6
|
+
```yaml
|
|
7
|
+
name: my-model # zorunlu: kısa ad (harf, rakam, . _ -) / required short name
|
|
8
|
+
model_id: org/model-name # zorunlu: Hugging Face id ya da yerel yol / required HF id or path
|
|
9
|
+
query_prefix: "query: " # isteğe bağlı; yazılmazsa bilinen aileler için otomatik
|
|
10
|
+
document_prefix: "passage: " # optional; auto-detected for known families (E5, BGE, Nomic)
|
|
11
|
+
batch_size: 32 # isteğe bağlı / optional
|
|
12
|
+
model_kwargs: {trust_remote_code: true} # isteğe bağlı / optional
|
|
13
|
+
license: MIT # modelin lisansı (zorunlu tut) / the model's license
|
|
14
|
+
params_millions: 118 # parametre sayısı (milyon) / parameter count (millions)
|
|
15
|
+
notes: Kısa not / short note
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Sonra / Then:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
turkrag-bench run --models my-model # yalnızca yeni modelin hücrelerini çalıştırır / runs only its cells
|
|
22
|
+
git add bench/configs/models/my-model.yaml bench/results/ bench/LEADERBOARD.md
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Kurallar / Rules: model herkese açık ve lisansı açık kaynak ya da araştırmaya izin veren bir lisans
|
|
26
|
+
olmalı; sonuç dosyalarını (`bench/results/*.json`) PR'a ekle.
|
|
27
|
+
*The model must be public with a permissive or research-friendly license; include the result files
|
|
28
|
+
in your PR.*
|