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
| Option | Type | Default | Description |
|---|---|---|---|
-r, --rules | path | (required) | Path to the rules file |
--target-tier | string | "mor" | Target tier label to apply rules to |
-o, --output | path | stdout | Output 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:
- Finds the target dependent tier (default:
%mor:). - If the target is a user-defined text tier, tokenizes its content.
- Applies each rule sequentially, matching patterns and performing substitutions.
- Stores the modified result back on the tier.
Differences from CLAN
- Manual coverage gap: the
CLAN manual only mentions
POSTMORTEMindirectly through the MOR pipeline, so this chapter cannot yet rely on a standalone legacy command spec. - Typed
%morsafety: If a rule would change a parsed%mortier,POSTMORTEMfails explicitly until an AST-based%morrewrite 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).