Repository navigation
Description
HermitCrab generates words it cannot parse when a deletion's analysis restores an optional segment between or beside the two switches of a metathesis. The analysis pairs a switch with the restored node instead of with the other switch, so the swap is never undone and no lexical entry matches. Same mechanism as #520, in a position #520 does not cover. Seen at 1ddef2bd (4d9b454 plus the #627 cherry-pick).
Minimal repro (q3f). One stratum, rules in order pr1 then pd. pr1 is the metathesis s t -> t s; pd is the rewrite p -> 0. Prefix aps+ (a morphological rule that inserts aps+ before the root). Roots t, pt, tap.
| Step | Result |
|---|---|
GenerateWords(t, [prefix]) |
ats (aps+t, swap to apt+s, delete p) |
GenerateWords(tap, [prefix]) |
atsa |
ParseWord("ats"), ParseWord("at+s"), ParseWord("atsa"), ParseWord("at+sa") |
no analysis |
ParseWord("ast") (root pt, no swap) |
parses |
What we know
- Analysis un-applies
pdfirst, restoring an optionalpat each gap, sopr1's analysis seest p? s. TraversalMethodBase.Advancere-runs the consuming arc's commands for each optional annotation it steps over, so the skipped node joins the capture of the switch matched just before it.AnalysisMetathesisRuleSpec.ApplyRhszips the nodes of the two switch groups pairwise and unions each pair, sotis unioned with the optionalprather than withs(inferred from the trace; the effect is confirmed by the missing parses).- Wider check on a corpus of 2,241 probe grammars: a clean pairing (restored node ignored) gives 432 analyses (312 words, 51 grammars) that C# lacks.
GenerateWordsreproduces the word for all 432; 58 need the affixes in a different order. - Two more shapes fail the same way: the same grammar compiled right to left, and the deletion in an outer stratum.
Counter-case: do not just drop the skipped node. In one probe grammar (a51-226), C#'s current pairing happens to move a skipped p to where a prefix pp+ needs it, so C# finds PR1+R2|asa and PR1+R0|astt, which a clean pairing misses. The clean pairing finds R2|asa and R0|astt, which C# misses. Both engines generate all four words. A correct fix has to decide where each skipped optional node goes.
Not known: the right rule for where a skipped optional node belongs when a later morph needs it.
Related: #520 (open, POS-scoped deletion; same mechanism), #619 (open, middle context dropped in analysis; different defect in the same file).
Next: design the pairing so a skipped optional node is placed rather than zipped, then check the fixture below and a51-226.
Conformance fixture
edge-cases/metathesis-deletion-restores-segment-between-switches in sillsdev/fieldworks-parser-conformance (PR #50) pins the q3f rows. The four rows ats, at+s, atsa, at+sa are expect_fail there because 1ddef2bd gives no parse. Expected analyses are PRE+R0|at+?s and PRE+R2|at+?sa.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fields🆕 New
Activity
A fixture now pins metathesis followed by a deletion that restores an…
A fixture now pins metathesis followed by a deletion that restores an…
Thirteen fixtures pin metathesis across a morpheme boundary, left-to-…
The C# rejection of a metathesis swap followed by a deletion that res…
Divergence 132 status points at machine#649 and #392 (#517)