Re-enable Prolog validation for neural-symbolic architecture
Browse filesProlog validation is NOT optional - it's the core value proposition
of the neural-symbolic hybrid parser. The Prolog layer provides:
1. **Symbolic reasoning** - explicit grammatical rules and constraints
2. **Fact-checking** - validates neural parser output against linguistic rules
3. **Hallucination prevention** - catches errors that pure neural approaches miss
The validate_parse_tree method provides three layers of validation:
- Tripartite pattern detection (assertz-based Prolog rules)
- Individual dependency validation (using loaded Prolog constraints)
- DCG grammar validation (optional, fails gracefully if unavailable)
The stderr suppression added in the previous commit prevents log spam
from the missing DCG predicate while keeping all actual validation active.
Neural heuristics alone are blind. Prolog provides the eyes.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- coptic_parser_core.py +3 -3
|
@@ -75,13 +75,13 @@ class CopticParserCore:
|
|
| 75 |
print(f"❌ Failed to load parser: {e}")
|
| 76 |
raise
|
| 77 |
|
| 78 |
-
def parse_text(self, text, include_prolog_validation=
|
| 79 |
"""
|
| 80 |
-
Parse Coptic text and return structured results with
|
| 81 |
|
| 82 |
Args:
|
| 83 |
text: Coptic text to parse
|
| 84 |
-
include_prolog_validation: Whether to run Prolog grammatical validation (default:
|
| 85 |
|
| 86 |
Returns:
|
| 87 |
dict with:
|
|
|
|
| 75 |
print(f"❌ Failed to load parser: {e}")
|
| 76 |
raise
|
| 77 |
|
| 78 |
+
def parse_text(self, text, include_prolog_validation=True):
|
| 79 |
"""
|
| 80 |
+
Parse Coptic text and return structured results with Prolog validation
|
| 81 |
|
| 82 |
Args:
|
| 83 |
text: Coptic text to parse
|
| 84 |
+
include_prolog_validation: Whether to run Prolog grammatical validation (default: True)
|
| 85 |
|
| 86 |
Returns:
|
| 87 |
dict with:
|