Display Prolog validation results in dependency parsing output
Browse filesAdded comprehensive display of Prolog/Walter Till grammar validation:
**Displays:**
- ✓ Detected grammatical patterns (tripartite sentences, etc.)
- ⚠ Grammatical warnings from Till grammar constraints
- Pattern details with descriptions
- Informative message when no issues found
**Location:**
- Shows after dependency parse table
- Appears in "Dependency Parse" mode
- Section titled "🔍 Prolog Validation (Walter Till Grammar)"
**Format:**
- Success messages for detected patterns
- Warning messages for rule violations
- Code blocks for pattern examples
- Clear, user-friendly presentation
This allows users to see the neural-symbolic validation layer in action,
showing how Walter Till's grammar constraints validate the neural parser
output and detect grammatical patterns.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- apertus_ui.py +30 -0
|
@@ -665,6 +665,36 @@ if prompt:
|
|
| 665 |
table_output = parser.format_table(parse_result)
|
| 666 |
st.markdown(table_output)
|
| 667 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 668 |
# Offer CoNLL-U download
|
| 669 |
conllu_output = parser.format_conllu(parse_result)
|
| 670 |
st.download_button(
|
|
|
|
| 665 |
table_output = parser.format_table(parse_result)
|
| 666 |
st.markdown(table_output)
|
| 667 |
|
| 668 |
+
# Display Prolog validation results if available
|
| 669 |
+
if 'prolog_validation' in parse_result and parse_result['prolog_validation']:
|
| 670 |
+
validation = parse_result['prolog_validation']
|
| 671 |
+
|
| 672 |
+
st.divider()
|
| 673 |
+
st.subheader("🔍 Prolog Validation (Walter Till Grammar)")
|
| 674 |
+
|
| 675 |
+
# Show detected patterns
|
| 676 |
+
if validation.get('patterns_detected'):
|
| 677 |
+
st.success("**✓ Grammatical Patterns Detected:**")
|
| 678 |
+
for pattern in validation['patterns_detected']:
|
| 679 |
+
if isinstance(pattern, dict):
|
| 680 |
+
if pattern.get('is_tripartite'):
|
| 681 |
+
st.write(f"- **Tripartite Sentence**: {pattern.get('description', '')}")
|
| 682 |
+
st.code(pattern.get('pattern', ''), language="")
|
| 683 |
+
else:
|
| 684 |
+
st.write(f"- {pattern}")
|
| 685 |
+
else:
|
| 686 |
+
st.write(f"- {pattern}")
|
| 687 |
+
|
| 688 |
+
# Show warnings if any
|
| 689 |
+
if validation.get('warnings'):
|
| 690 |
+
st.warning("**⚠ Grammatical Warnings:**")
|
| 691 |
+
for warning in validation['warnings']:
|
| 692 |
+
st.write(f"- {warning}")
|
| 693 |
+
|
| 694 |
+
# Show if no issues found
|
| 695 |
+
if not validation.get('warnings') and not validation.get('patterns_detected'):
|
| 696 |
+
st.info("✓ No grammatical issues detected")
|
| 697 |
+
|
| 698 |
# Offer CoNLL-U download
|
| 699 |
conllu_output = parser.format_conllu(parse_result)
|
| 700 |
st.download_button(
|