hezarfen_rule_based_chatbot
Clone
https://git.tahinli.com/Hezarfen/hezarfen_rule_based_chatbot.git
0 watching0 forksPython1.2 MiBa039b60Ahmet Kaan Gümüş2 months ago64 commits
| 1 | """Benchmark (değerlendirme) setinin yüklenmesi ve doğrulanması. |
| 2 | |
| 3 | Benchmark, motorun DÜRÜST ölçülmesi için `example_questions`'tan AYRI tutulan |
| 4 | etiketli sorulardır. Her kayıt: |
| 5 | {"question": str, "expected_intent": str | "oos", "role": str?} |
| 6 | |
| 7 | `expected_intent == "oos"` -> kapsam dışı; motor bunları FALLBACK'e atmalıdır. |
| 8 | """ |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | : = |
| 18 | |
| 19 | # Depo kökü: src/evaluation/benchmark.py -> parents[2] = proje kökü. |
| 20 | : = |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | """Benchmark kayıtlarını JSONL dosyasından yükler. |
| 27 | |
| 28 | Boş satırlar atlanır. Her satır 'question' ve 'expected_intent' içermelidir. |
| 29 | |
| 30 | Raises: |
| 31 | FileNotFoundError: Dosya yoksa. |
| 32 | ValueError: Bir satır bozuksa veya zorunlu alan eksikse. |
| 33 | """ |
| 34 | |
| 35 | = |
| 36 | |
| 37 | |
| 38 | |
| 39 | : = |
| 40 | |
| 41 | |
| 42 | = |
| 43 | |
| 44 | continue |
| 45 | |
| 46 | = |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | return |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | """Benchmark kayıtlarının tutarlılığını doğrular. |
| 64 | |
| 65 | Kontroller: |
| 66 | - question boş olmayan metin. |
| 67 | - expected_intent ya bilinen bir intent ya da OOS_LABEL. |
| 68 | - (verilirse) role bilinen bir rol. |
| 69 | - benchmark içinde tekrarlanan soru yok. |
| 70 | - (verilirse) hiçbir soru example_questions ile örtüşmez. |
| 71 | - en az bir OOS kaydı bulunur. |
| 72 | |
| 73 | Returns: |
| 74 | Sayımlar: total, in_scope, oos, intents_covered. |
| 75 | |
| 76 | Raises: |
| 77 | ValueError: Herhangi bir kontrol başarısızsa. |
| 78 | """ |
| 79 | |
| 80 | : = |
| 81 | |
| 82 | |
| 83 | |
| 84 | : = |
| 85 | : = |
| 86 | = 0 |
| 87 | |
| 88 | |
| 89 | = |
| 90 | = |
| 91 | = |
| 92 | |
| 93 | |
| 94 | |
| 95 | continue |
| 96 | |
| 97 | = |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | += 1 |
| 104 | in : |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | return |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 |