Flag Translation Guide
Status: Current Last updated: 2026-06-15 13:28 EDT
The original CLAN uses a +flag/-flag syntax that differs from standard CLI conventions. The Rust reimplementation accepts both styles, legacy CLAN flags are automatically rewritten to modern --flag equivalents before parsing.
Complete Flag Mapping
| CLAN Flag | Modern Equivalent | Meaning |
|---|---|---|
+t*CHI | --speaker CHI | Include speaker |
-t*CHI | --exclude-speaker CHI | Exclude speaker |
+t%mor | --tier mor | Include dependent tier |
-t%gra | --exclude-tier gra | Exclude dependent tier |
+t@ID="..." | --id-filter "..." | Filter by @ID header pattern |
+s<word> | --include-word (FREQ) / --keyword (KWAL) / --search (COMBO) | Search input; the modern flag depends on the command (FREQ filters by word, KWAL’s keyword is --keyword, COMBO’s boolean search is --search). NOTE: the legacy +s rewrite currently maps to --include-word for every command, so for KWAL/COMBO use the modern flag directly. |
-s<word> | --exclude-word <word> | Exclude word |
+g<label> | --gem <label> | Include gem segment |
-g<label> | --exclude-gem <label> | Exclude gem segment |
+z25-125 | --range 25-125 | Utterance range |
+r6 | --include-retracings | Count retraced material |
+u | (default behavior) | Merge speakers (already default) |
+dN | --display-mode N (generic) / per-command typed flag | Display mode, partially landed. Each +dN value is rewritten command-by-command. FREQ +d1 → --word-list-only, +d2 → --format csv, +d3 → --types-tokens-only --format csv, +d4 → --types-tokens-only. COOCCUR +d → --no-frequency-counts. FREQPOS +d → --position-classification second. Other +dN values still fall through to the generic --display-mode N placeholder, which clap does not consume yet (see Phase 3 plan). |
+k | --plus-k (--case-sensitive alias) | Flip the command’s case mode. FREQ, VOCD, and CHIP preserve case by default and fold under +k; KWAL, COMBO, FREQPOS, DIST, and MAXWD fold by default and preserve under +k. Other inherited +k flags may be no-ops; check each command’s parity page. |
+fEXT | --output-ext EXT | Output file extension, currently non-functional: the rewriter at crates/talkbank-clan/src/clan_args.rs:107 produces --output-ext, but no clap field consumes it. Tracked as Phase 2 of the rewriter-honor plan (blocked on a batch-output prerequisite). |
+wN | --context-after N | Context lines after match |
-wN | --context-before N | Context lines before match |
Examples
Speaker Filtering
# Original CLAN: include CHI, exclude MOT
freq +t*CHI -t*MOT file.cha
# Modern equivalent
chatter-clan freq --speaker CHI --exclude-speaker MOT file.cha
Word Search
# Original CLAN: search for "want" followed by "need". COMBO takes ONE +s and
# joins terms with ^ (multiple +s flags are rejected: "Only one s option").
combo +s"want^need" file.cha
# Modern equivalent
chatter-clan combo --search "want^need" file.cha
Combined Filters
# Original CLAN: CHI speaker, utterances 10-50, include retraced material
freq +t*CHI +z10-50 +r6 file.cha
# Modern equivalent
chatter-clan freq --speaker CHI --range 10-50 --include-retracings file.cha
Notes
- The
+uflag (merge speakers into a single analysis) is the default behavior and is accepted but ignored. - Flags are position-independent; they can appear before or after file arguments.
- Unknown flags that don’t match CLAN patterns pass through unchanged to clap, which will report an error with suggestions.
+dNand+kare now partially functional: see the per-command status tables underclan-reference/commands/for whichNvalues and which commands are wired up.+fEXTis still rewritten by the legacy-flag layer but rejected byclap(no consuming field yet). Seemigrating-from-clan.mdfor the same caveats and the rewriter-honor plan that tracks the remaining gaps.