| |
|
| | """
|
| | Test: Validation System für User-Korrektionen
|
| | """
|
| | import sys
|
| | sys.path.insert(0, '.')
|
| |
|
| | from wikipedia_fallback_learner import WikipediaFallbackLearner
|
| |
|
| | print("="*70)
|
| | print("TEST: Correction Validation System")
|
| | print("="*70)
|
| |
|
| | learner = WikipediaFallbackLearner()
|
| |
|
| | test_cases = [
|
| | {
|
| | 'name': '✅ Gute Korrektion',
|
| | 'query': 'Wer hat die Glühbirne erfunden?',
|
| | 'correction': 'Thomas Alva Edison hat die praktische Glühbirne 1879 erfunden'
|
| | },
|
| | {
|
| | 'name': '❌ Zu kurz',
|
| | 'query': 'Wer hat die Glühbirne erfunden?',
|
| | 'correction': 'Edison'
|
| | },
|
| | {
|
| | 'name': '❌ Passt nicht zum Thema',
|
| | 'query': 'Wer hat die Glühbirne erfunden?',
|
| | 'correction': 'Das Wetter ist heute schön und warm'
|
| | },
|
| | {
|
| | 'name': '⚠️ Schwach verwandt',
|
| | 'query': 'Wer hat die Glühbirne erfunden?',
|
| | 'correction': 'Dies ist eine Frage über Erfinder'
|
| | },
|
| | {
|
| | 'name': '✅ Wikipedia-validierbar',
|
| | 'query': 'Was ist Berlin?',
|
| | 'correction': 'Berlin ist die Hauptstadt und bevölkerungsreichste Stadt Deutschland'
|
| | },
|
| | ]
|
| |
|
| | for i, test in enumerate(test_cases, 1):
|
| | print(f"\n[Test {i}] {test['name']}")
|
| | print(f" Query: {test['query']}")
|
| | print(f" Correction: {test['correction'][:60]}...")
|
| |
|
| | result = learner.validate_correction(test['query'], test['correction'])
|
| |
|
| | print(f"\n Result:")
|
| | print(f" Valid: {result['is_valid']}")
|
| | print(f" Score: {result['score']:.0%}")
|
| | print(f" Reason: {result['reason']}")
|
| |
|
| | if result['suggestions']:
|
| | print(f" Tip: {result['suggestions']}")
|
| |
|
| | if result['issues']:
|
| | print(f" Issues: {', '.join(result['issues'])}")
|
| |
|
| | print("\n" + "="*70)
|
| | print("✅ Validation System funktoniert!")
|
| | print("="*70)
|
| | print("\nWie es funktioniert:")
|
| | print("1. User gibt Korrektur ein")
|
| | print("2. System validiert die Antwort")
|
| | print("3. Wenn gut → speichern und lernen")
|
| | print("4. Wenn schlecht → ablehnen mit Tipp")
|
| | print("5. User sieht Rückmeldung und kann verbessern")
|
| |
|