Restore comprehensive test corpus with categorized examples
Browse filesResurrect the complete example collection that was lost:
**Coptic → English Examples**:
- Simple Sentences (5 examples): Basic grammatical structures
- Complex Sentences (3 examples): Multi-clause with subordination
- Full Texts (2 examples): Connected discourse paragraphs
**Dependency Parser Examples**:
- Simple Structures: Basic dependency relations
- Complex Structures: Subordination and coordination
- Full Texts: Discourse-level parsing
**Examples now include**:
- Tripartite nominal sentences (Walter Till patterns)
- Perfect tense constructions (ⲁ-)
- Temporal clauses (ⲛⲧⲉⲣⲉ-)
- Negative imperatives (ⲙⲡⲣ-)
- Biblical texts (Genesis, Matthew, Mark, John)
- Parable narratives
All examples organized in collapsible accordions with
descriptive labels for research and testing purposes.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
@@ -151,17 +151,44 @@ def clear_text():
|
|
| 151 |
"""Clear all text"""
|
| 152 |
return ""
|
| 153 |
|
| 154 |
-
#
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
]
|
| 160 |
|
| 161 |
ENGLISH_EXAMPLES = [
|
| 162 |
["The Lord is good", "Sahidic"],
|
| 163 |
["I am a teacher", "Sahidic"],
|
| 164 |
["We give thanks to God", "Sahidic"],
|
|
|
|
|
|
|
| 165 |
]
|
| 166 |
|
| 167 |
# Create Gradio Interface
|
|
@@ -230,14 +257,42 @@ with gr.Blocks(title="Coptic Translation Interface", theme=gr.themes.Soft()) as
|
|
| 230 |
interactive=False
|
| 231 |
)
|
| 232 |
|
| 233 |
-
gr.
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
|
| 242 |
cop_translate_btn.click(
|
| 243 |
fn=translate_coptic_to_english,
|
|
@@ -328,17 +383,39 @@ with gr.Blocks(title="Coptic Translation Interface", theme=gr.themes.Soft()) as
|
|
| 328 |
visible=False
|
| 329 |
)
|
| 330 |
|
| 331 |
-
|
| 332 |
-
"
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 336 |
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 342 |
|
| 343 |
def parse_coptic_text(text):
|
| 344 |
"""Parse Coptic text with neural-symbolic validation"""
|
|
|
|
| 151 |
"""Clear all text"""
|
| 152 |
return ""
|
| 153 |
|
| 154 |
+
# Load comprehensive test corpus
|
| 155 |
+
import json
|
| 156 |
+
from pathlib import Path
|
| 157 |
+
|
| 158 |
+
def load_test_corpus():
|
| 159 |
+
"""Load the comprehensive Coptic test corpus"""
|
| 160 |
+
corpus_path = Path(__file__).parent / "coptic_test_corpus.json"
|
| 161 |
+
if corpus_path.exists():
|
| 162 |
+
with open(corpus_path, 'r', encoding='utf-8') as f:
|
| 163 |
+
return json.load(f)
|
| 164 |
+
return None
|
| 165 |
+
|
| 166 |
+
# Example texts organized by category
|
| 167 |
+
COPTIC_EXAMPLES_SIMPLE = [
|
| 168 |
+
["ⲁⲩⲱ ⲁϥⲙⲟⲩⲧⲉ ⲉⲣⲟϥ", "Sahidic"], # and he called him
|
| 169 |
+
["ⲁⲛⲟⲕ ⲡⲉ ⲡⲛⲟⲩⲧⲉ ⲙⲡⲉⲕⲉⲓⲱⲧ", "Sahidic"], # I am the God of your father
|
| 170 |
+
["ⲙⲡⲣⲣ ϩⲟⲧⲉ", "Sahidic"], # Do not be afraid
|
| 171 |
+
["ⲡϫⲟⲉⲓⲥ ⲡⲉ ⲡⲁⲛⲟⲩⲧⲉ", "Sahidic"], # The Lord is my God
|
| 172 |
+
["ⲁϥⲃⲱⲕ ⲉϩⲣⲁⲓ ⲉⲡⲉⲣⲡⲉ", "Sahidic"], # he went up to the temple
|
| 173 |
+
]
|
| 174 |
+
|
| 175 |
+
COPTIC_EXAMPLES_COMPLEX = [
|
| 176 |
+
["ⲁⲩⲱ ⲛⲧⲉⲣⲉϥⲛⲁⲩ ⲉⲡⲙⲏⲏϣⲉ ⲁϥϣⲡϩⲧⲏϥ ⲉϩⲣⲁⲓ ⲉϫⲱⲟⲩ", "Sahidic"], # when he saw the crowd
|
| 177 |
+
["ⲉϣⲱⲡⲉ ⲇⲉ ⲁⲩⲛⲁⲩ ⲉⲣⲟϥ ⲉϥⲙⲟⲟϣⲉ ϩⲓϫⲛ ⲧⲉⲑⲁⲗⲁⲥⲥⲁ ⲁⲩϣⲧⲟⲣⲧⲣ", "Sahidic"], # when they saw him walking
|
| 178 |
+
["ⲁⲓⲉⲓ ⲅⲁⲣ ⲉⲙⲟⲩⲧⲉ ⲁⲛ ⲉⲛⲇⲓⲕⲁⲓⲟⲥ ⲁⲗⲗⲁ ⲛⲣⲉϥⲣⲛⲟⲃⲉ", "Sahidic"], # I came not to call the righteous
|
| 179 |
+
]
|
| 180 |
+
|
| 181 |
+
COPTIC_EXAMPLES_TEXTS = [
|
| 182 |
+
["ⲛⲉⲩⲛⲟⲩⲙⲏⲏϣⲉ ⲇⲉ ⲛϣⲱⲛⲉ ⲉⲩⲛⲕⲟⲧⲕ ϩⲙ ⲡⲙⲁ ⲉⲧⲙⲙⲁⲩ· ⲛϩⲁⲛⲃⲗⲗⲉ ⲙⲛ ⲛϩⲁⲛϭⲁⲗⲉ ⲙⲛ ⲛϣⲟⲩⲱⲟⲩ·", "Sahidic"], # Healing at the pool
|
| 183 |
+
["ⲉⲓⲥ ⲡⲉⲧϫⲟ ⲁϥⲉⲓ ⲉⲃⲟⲗ ⲉϫⲟ· ⲁⲩⲱ ⲛⲧⲉⲣⲉϥϫⲟ ϩⲟⲓⲛⲉ ⲙⲉⲛ ⲁⲩϩⲉ ϩⲁⲧⲏ ⲧⲉϩⲓⲏ·", "Sahidic"], # The Sower parable
|
| 184 |
]
|
| 185 |
|
| 186 |
ENGLISH_EXAMPLES = [
|
| 187 |
["The Lord is good", "Sahidic"],
|
| 188 |
["I am a teacher", "Sahidic"],
|
| 189 |
["We give thanks to God", "Sahidic"],
|
| 190 |
+
["Do not be afraid", "Sahidic"],
|
| 191 |
+
["He went to the house", "Sahidic"],
|
| 192 |
]
|
| 193 |
|
| 194 |
# Create Gradio Interface
|
|
|
|
| 257 |
interactive=False
|
| 258 |
)
|
| 259 |
|
| 260 |
+
with gr.Accordion("📖 Example Texts", open=True):
|
| 261 |
+
example_category = gr.Radio(
|
| 262 |
+
choices=["Simple Sentences", "Complex Sentences", "Full Texts"],
|
| 263 |
+
value="Simple Sentences",
|
| 264 |
+
label="Example Category"
|
| 265 |
+
)
|
| 266 |
+
|
| 267 |
+
gr.Markdown("**Simple Sentences**: Basic grammatical structures")
|
| 268 |
+
gr.Examples(
|
| 269 |
+
examples=COPTIC_EXAMPLES_SIMPLE,
|
| 270 |
+
inputs=[cop_input, cop_dialect],
|
| 271 |
+
outputs=cop_output,
|
| 272 |
+
fn=translate_coptic_to_english,
|
| 273 |
+
cache_examples=False,
|
| 274 |
+
label="Simple"
|
| 275 |
+
)
|
| 276 |
+
|
| 277 |
+
gr.Markdown("**Complex Sentences**: Multi-clause with subordination")
|
| 278 |
+
gr.Examples(
|
| 279 |
+
examples=COPTIC_EXAMPLES_COMPLEX,
|
| 280 |
+
inputs=[cop_input, cop_dialect],
|
| 281 |
+
outputs=cop_output,
|
| 282 |
+
fn=translate_coptic_to_english,
|
| 283 |
+
cache_examples=False,
|
| 284 |
+
label="Complex"
|
| 285 |
+
)
|
| 286 |
+
|
| 287 |
+
gr.Markdown("**Full Texts**: Connected discourse (paragraphs)")
|
| 288 |
+
gr.Examples(
|
| 289 |
+
examples=COPTIC_EXAMPLES_TEXTS,
|
| 290 |
+
inputs=[cop_input, cop_dialect],
|
| 291 |
+
outputs=cop_output,
|
| 292 |
+
fn=translate_coptic_to_english,
|
| 293 |
+
cache_examples=False,
|
| 294 |
+
label="Texts"
|
| 295 |
+
)
|
| 296 |
|
| 297 |
cop_translate_btn.click(
|
| 298 |
fn=translate_coptic_to_english,
|
|
|
|
| 383 |
visible=False
|
| 384 |
)
|
| 385 |
|
| 386 |
+
with gr.Accordion("📖 Example Texts for Parsing", open=True):
|
| 387 |
+
gr.Markdown("**Simple Structures** - Test basic dependency relations")
|
| 388 |
+
simple_parse_examples = [
|
| 389 |
+
"ⲁⲩⲱ ⲁϥⲙⲟⲩⲧⲉ ⲉⲣⲟϥ", # and he called him
|
| 390 |
+
"ⲁⲛⲟⲕ ⲡⲉ ⲡⲛⲟⲩⲧⲉ ⲙⲡⲉⲕⲉⲓⲱⲧ", # Tripartite nominal
|
| 391 |
+
"ⲡϫⲟⲉⲓⲥ ⲡⲉ ⲡⲁⲛⲟⲩⲧⲉ", # The Lord is my God
|
| 392 |
+
]
|
| 393 |
+
gr.Examples(
|
| 394 |
+
examples=[[ex] for ex in simple_parse_examples],
|
| 395 |
+
inputs=parse_input,
|
| 396 |
+
label="Simple"
|
| 397 |
+
)
|
| 398 |
|
| 399 |
+
gr.Markdown("**Complex Structures** - Test subordination and coordination")
|
| 400 |
+
complex_parse_examples = [
|
| 401 |
+
"ⲁⲩⲱ ⲛⲧⲉⲣⲉϥⲛⲁⲩ ⲉⲡⲙⲏⲏϣⲉ ⲁϥϣⲡϩⲧⲏϥ ⲉϩⲣⲁⲓ ⲉϫⲱⲟⲩ", # Temporal clause
|
| 402 |
+
"ⲁⲓⲉⲓ ⲅⲁⲣ ⲉⲙⲟⲩⲧⲉ ⲁⲛ ⲉⲛⲇⲓⲕⲁⲓⲟⲥ ⲁⲗⲗⲁ ⲛⲣⲉϥⲣⲛⲟⲃⲉ", # Purpose with negation
|
| 403 |
+
]
|
| 404 |
+
gr.Examples(
|
| 405 |
+
examples=[[ex] for ex in complex_parse_examples],
|
| 406 |
+
inputs=parse_input,
|
| 407 |
+
label="Complex"
|
| 408 |
+
)
|
| 409 |
+
|
| 410 |
+
gr.Markdown("**Full Texts** - Test discourse-level parsing")
|
| 411 |
+
text_parse_examples = [
|
| 412 |
+
"ⲛⲉⲩⲛⲟⲩⲙⲏⲏϣⲉ ⲇⲉ ⲛϣⲱⲛⲉ ⲉⲩⲛⲕⲟⲧⲕ ϩⲙ ⲡⲙⲁ ⲉⲧⲙⲙⲁⲩ· ⲛϩⲁⲛⲃⲗⲗⲉ ⲙⲛ ⲛϩⲁⲛϭⲁⲗⲉ ⲙⲛ ⲛϣⲟⲩⲱⲟⲩ·",
|
| 413 |
+
]
|
| 414 |
+
gr.Examples(
|
| 415 |
+
examples=[[ex] for ex in text_parse_examples],
|
| 416 |
+
inputs=parse_input,
|
| 417 |
+
label="Texts"
|
| 418 |
+
)
|
| 419 |
|
| 420 |
def parse_coptic_text(text):
|
| 421 |
"""Parse Coptic text with neural-symbolic validation"""
|