Skip to content

HermitCrab analysis explores affix pairs whose inflection-class gate synthesis must reject, multiplying the search when an affix has several MSAs #661

Backlog

Description

@johnml1135

Cost. When one affix has several derivational MSAs with different From inflection classes, each MSA is its own affix process rule. During analysis the rules are unapplied outermost first without any check of the MPR (inflection class) gate; the gate is only tested later, in synthesis, after a root is found. A pair of adjacent rules in which the outer rule requires class A but the inner rule always outputs class B can therefore never synthesise, yet every such pair is explored. With k sibling MSAs per affix and n affixes the search grows like k^n before any root is looked up. On a synthetic grammar with four affixes of three MSAs each, a seven-affix word costs 1328 work steps in PanGloss without the prune and 518 with it; on a large real grammar the gap was about 575x in PanGloss work steps (Linux, provisional, not a speed measurement).

Where in C#. Analysis: the affix rule unapplication in AnalysisAffixProcessRule and its stratum driver (Stratum analysis loop, rules unapplied in reverse order). Synthesis gate: SynthesisAffixProcessRule tests RequiredMprFeatures against word.MprFeatures after the previous rule's MprFeatures output has been applied (MprFeatureGroup Overwrite semantics: the group's members not in the output are removed, then the output is added). The analysis loop never consults either.

Invariant that makes skipping safe. Let O be the most recently unapplied rule and I the rule about to be unapplied directly inside it. In synthesis I is applied, then O, so O's required features are tested against the word after I's output. If group G is an Overwrite group, shared by no other group, that no other rule kind (realizational, compounding) writes, and every allomorph of I outputs at least one member of G, then after I the word's G members are exactly I's G output, whatever the root. If every allomorph of O requires a non-empty set of G members that the union of I's G outputs cannot satisfy (any-of or all-of per the group's match type), O fails its gate for every root. Skip I. Anything else is left alone: ungrouped features, inner rules with no class output, appending groups, template and clitic rules, outer rules with an allomorph that has no required features.

Measured (PanGloss, synthetic and one large grammar). Parses are identical with the prune on and off (set and multiset, every word) on the synthetic grammar and on the large grammar; on an 11-rule synthetic grammar C# and PanGloss gave equal analysis sets for 1745 words. Work steps: toy 1328 to 518; large grammar 256.7M to 0.45M steps over 11 words. Implementation: sillsdev/PanGloss#587.

Breakage analysis. Ordering of analyses is unchanged (pruned paths produced none). Caps: fewer steps can let words finish that were capped before; none finish differently otherwise. MPR features and exception features: handled by the invariant above, undecidable cases left alive. Compounding, clitic, template and realizational rules: excluded as outer or inner rule and as writers of the group, so adjacency across them is never assumed. Open gap: unordered-stratum commuting rules and partial/guess analyses are covered by PanGloss fixtures only for the gate-on equals gate-off property.

Proposal. Precompute the dead (outer, inner) pairs once per language; check one bit per unapplication in the analysis loop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status
      🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions