Skip to content

HermitCrab: partial lexical entries switch off final-template pruning for the whole grammar #551

Open

Description

@johnml1135

Summary

Final-template pruning (#491) is switched off for the whole grammar as soon as any morpheme is partial, and that includes partial lexical entries, not just partial rules. Grammars such as Sena, which has partial lexical entries, can never get the prune, even after every affix rule is classified.

The obvious narrowing, a guard that ignores lexical entries, looks unsound on current master. This issue tracks whether any narrower guard is safe.

Who is affected: users with partial lexical entries in template-heavy grammars, and maintainers of #491's prune or its PanGloss port.

Done when:

  • a conformance fixture shows whether a partial root can rescue a parse that the prune would discard;
  • any narrower guard keeps full parse identities and multiplicities on that fixture, and fails when its own condition is removed;
  • or the issue is closed with the fixture as evidence that no narrower guard is safe.
Code, at master 2599204
  • The guard is !_morpher.IsPartial || _morpher.AlwaysEnforceFinalTemplates, at AnalysisAffixTemplateRule.cs:47 and MorphologicalRules/AnalysisAffixProcessRule.cs:83.
  • Morpher.IsPartial is true if any morpheme is partial (Morpher.cs:65). The morpheme set includes stratum.Entries as well as the affix rules (Morpher.cs:51-53).

Why ignoring lexical entries looks unsound:

  • A synthesized word takes its partiality from its root: _isPartial = entry.IsPartial (Word.cs:150).
  • After a final template, synthesis lets a non-partial rule apply when the input word is partial: (!input.IsPartial && !_rule.IsPartial) || AlwaysEnforceFinalTemplates (MorphologicalRules/SynthesisAffixProcessRule.cs:67).
  • So a partial root can license exactly the derivation that the analysis-side prune rejects: a non-template rule unapplied before a final template.
  • This is read from the code. It has not been run.

The reported Sena counts (25 partial lexical entries, 6 partial rules) come from a private grammar and are not re-checked here.

Activity

  1. johnml1135 commented on Oct 26, 2026

    @johnml1135
    CollaboratorAuthor

    Correction to the "looks unsound" reasoning in the issue body: templates never apply to a word whose root is partial (SynthesisAffixTemplatesRule.cs:38, !input.RootAllomorph.Morpheme.IsPartial), so a partial lexical entry cannot license a derivation through a final template that the prune would reject.

    One nuance: Apply calls ChooseInflectionalStem before that check, so a partial root with a non-partial LexFamily relative can still take a template, with the relative as the root. The prune stays sound because that word is non-partial, so a following non-partial rule is blocked either way. This part is established by reading the code only; no fixture exercises it.

    The fixture final-template-partial-root in #480 and PR #553 show that making the guard ignore lexical entries leaves all 142 conformance runs identical.

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