Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

POSTMORTEM – Pattern-Matching Rules for %mor Post-Processing

Status: Current Last updated: 2026-05-12 11:28 EDT

Purpose

Reimplements CLAN’s POSTMORTEM command, which applies pattern-matching and replacement rules to dependent tiers (typically %mor:). Rules are applied sequentially, and wildcard tokens (*) match any single token. The replacement side uses $- to copy the matched wildcard text.

The CLAN manual does not appear to contain a standalone POSTMORTEM command section. It is mentioned indirectly as part of the mor *.cha pipeline that runs MOR, PREPOST, POST, POSTMORTEM, and MEGRASP to produce %mor and %gra.

Usage

chatter clan postmortem --rules postmortem.cut file.cha
chatter clan postmortem --rules rules.cut --target-tier spa file.cha

Options

OptionTypeDefaultDescription
-r, --rulespath(required)Path to the rules file
--target-tierstring"mor"Target tier label to apply rules to
-o, --outputpathstdoutOutput CHAT file path

External Data

Requires a rules file. CLAN uses postmortem.cut from its lib/ directory by default; chatter clan postmortem does not bundle a rules file, so --rules must be passed explicitly. Format: from_pattern => to_replacement (one rule per line, using => or ==> as the separator). Lines starting with # or ; are comments.

Wildcards: * in the pattern matches any single token. $- in the replacement copies the matched wildcard text.

Behavior

For each utterance, the transform:

  1. Finds the target dependent tier (default: %mor:).
  2. If the target is a user-defined text tier, tokenizes its content.
  3. Applies each rule sequentially, matching patterns and performing substitutions.
  4. Stores the modified result back on the tier.

Differences from CLAN

  • Manual coverage gap: the CLAN manual only mentions POSTMORTEM indirectly through the MOR pipeline, so this chapter cannot yet rely on a standalone legacy command spec.
  • Typed %mor safety: If a rule would change a parsed %mor tier, POSTMORTEM fails explicitly until an AST-based %mor rewrite exists, rather than degrading typed morphology into user-defined text.
  • User-defined target tiers are still supported as text rewrite targets.
  • Operates on AST rather than raw text.
  • Uses the framework transform pipeline (parse -> transform -> serialize -> write).