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

MLT – Mean Length of Turn

Status: Current Last updated: 2026-05-26 11:50 EDT

Purpose

Calculates mean length of turn in utterances and words. A “turn” is a maximal consecutive sequence of utterances by the same speaker; the turn boundary is detected when a different speaker produces the next utterance.

See the CLAN manual for the original MLT command specification.

Usage

chatter-clan mlt file.cha
chatter-clan mlt --speaker CHI file.cha
chatter-clan mlt --format json corpus/

Options (chatter-native)

OptionCLAN FlagDescription
--speaker <CODE>+t*CHI (or +tCHI)Include speaker
--exclude-speaker <CODE>-t*CHI (or -tCHI)Exclude speaker
--gem <LABEL>+g"label"Restrict to gem segment
--range <START-END>+z25-125Utterance range
--id-filter <PATTERN>+t@ID="..."Filter by @ID pattern
--include-retracings+r6Include retraced words in counting
--format <FMT>–Output format: clan (default), text, json, csv

CLAN Equivalence

CLAN commandRust equivalent
mlt file.chachatter-clan mlt file.cha
mlt +t*CHI file.chachatter-clan mlt file.cha --speaker CHI

CLAN +-flag coverage audit

Authoritative enumeration of every CLAN mlt flag, mapped against chatter’s coverage. Sources:

  • OSX-CLAN/src/clan/mlt.cpp: usage() at line 43 and the command-specific getflag() intercept at line 582.
  • OSX-CLAN/src/clan/cutt.cpp: mainusage() MLT branches.
  • crates/talkbank-clan/src/clan_args.rs: chatter’s +flag to --flag rewriter.
  • crates/talkbank-cli/src/cli/args/clan_commands.rs::Mlt plus clan_common.rs::CommonAnalysisArgs, chatter’s clap field surface for MLT.

(Status legend: same as FREQ, Done / Partial / Rewriter only / Missing.)

MLT-specific +-flags (from mlt.cpp::getflag)

CLAN flagMeaningChatterStatusNotes
+aDo not count empty utterances (0 utterances),MissingCLAN’s default is to count them; +a flips that. chatter does not yet expose an empty-utterance switch.
+atCount empty utterances when they carry the [+ trn] postcode,MissingSubtle conversational-analysis convention.
+cSClause-marker delimiter S,MissingUsed to split utterances into clauses for turn counting.
+c@FClause markers from file F,MissingFile-list workflow.
+gSExclude utterances consisting solely of word S--exclude-solo-word SDoneFixed 2026-05-22. Per-subcommand rewriter routing + new clap field; same semantic as MLU. See the MLU page for the broader +g overload story.
+g@F+g from file--exclude-solo-word-fileDoneLanded 2026-05-23. Same shape as MLU +g@F; see the MLU page for the rewriter/loader details. Pinned by mlt_solo_word_from_file.
+o3Combine selected speakers per filepartial via --per-file inversePartialchatter’s aggregate-vs-per-file model is the inverse choice.
+t%X (implicit)Switch to dependent-tier mode for the turn split(default for non-mlt commands)PartialMLT’s nomain = TRUE for +t%X has no chatter analog today; MLT chatter operates on main tier exclusively.

General +-flags MLT inherits (from cutt.cpp::mainusage)

CLAN flagMeaningChatterStatusNotes
+t*X / -t*XInclude/exclude speaker--speaker / --exclude-speakerDone+tX (no *) also accepted post-2026-05-21 fix.
+t%X / -t%XInclude/exclude dependent tier %X--tier / --exclude-tier (rewriter target)Rewriter onlyNo --tier field on the Mlt struct.
+t@ID="..."Filter by @ID pattern--id-filterDone
+t#ROLEFilter by role--roleDoneFixed 2026-05-22; see FREQ for the shared implementation.
+s"word" / -s"word"Include/exclude word--include-word / --exclude-wordPartialMLT’s +s special-cases xxx/yyy/www exclusion; chatter’s filter does not.
+s@F / -s@FSearch / exclude words from file--include-word-file / --exclude-word-fileDoneLanded 2026-05-22. File format: one pattern per line; blank lines, # -comments, and ;%* -annotation lines skipped. Repeatable.
+gX(in MLT: utterance-elision filter, see above)--gemPartialSame +g overload as MLU.
+zN-MUtterance range--rangeDone
+rNRetrace / clitic / prosodic-symbol / replacement controls--include-retracings (handles +r6 only)Partial
+uCombine across files(default)Donechatter combines by default; inverse default vs CLAN.
+reRecurse subdirectories(default for directory args)Done
+pSAdd S to word delimiters,Missing
+kCase-sensitive matching--case-sensitive (via CommonAnalysisArgs)Done (no-op per CLAN)MLT does no word-keying; +k is silently accepted per CLAN’s cutt.cpp::mainusage no-op semantic. Covered by CommonAnalysisArgs.case_sensitive flatten on ClanCommands::Mlt.
+wN / -wNContext window (KWAL/COMBO keyword-context)–Rewriter onlyInapplicable to MLT (per-speaker turn/utterance totals, no per-match context to surround). The rewriter maps +wN/-wN to --context-after/--context-before, but MLT has no such clap field, so it errors at parse time, the correct outcome for an inapplicable flag (talkbank-clan/AGENTS.md). CLAN’s binary instead empties the output (a context-machinery artifact).
+f / +fEXTOutput to file--output-ext (rewriter target)Rewriter onlyPhase 1.1.
+dNonlydata output-detail level,MissingMLT has no local case 'd'; consumption is via the shared maingetflag path at OSX-CLAN/src/clan/cutt.cpp:9382 with non-empty per-program body at cutt.cpp:9478 (CLAN_SRV-only rejection of onlydata == 1; otherwise pure level effect). chatter has no --display-mode consumer for MLT. Per-MLT rewriter arm in clan_args.rs passes the token through.

Audit summary

BucketCount
Done (byte-parity or in scope)9
Partial (chatter abstraction differs)6
Rewriter only (would error at parse time)3
Missing (no rewriter, no clap field)6

The +a / +at empty-utterance switch and the clause-delimiter flags (+cS, +c@F) are MLT’s most distinctive omissions: they affect what counts as “an utterance” and “a turn” and so directly drive the MLT ratio. Filed as Phase 1.7 follow-ups.

Algorithm

  1. Walk utterances in file order
  2. Group consecutive utterances by the same speaker into turns
  3. For each speaker, compute:
    • Number of turns
    • Total utterances and total words
    • MLT-u: mean turn length in utterances
    • MLT-w: mean turn length in words
    • SD: standard deviation of words per utterance (population SD, dividing by n)

Turn boundaries

A turn boundary occurs when a different speaker produces the next utterance. For example:

*CHI: I want a cookie .          <- turn 1 (CHI)
*CHI: please .                   <- still turn 1 (CHI)
*MOT: here you go .              <- turn 2 (MOT)
*CHI: thank you .                <- turn 3 (CHI)

CHI has 2 turns (3 utterances), MOT has 1 turn (1 utterance).

Output

Speaker: CHI
  Turns: 15
  Utterances: 42
  Words: 127
  MLT (utterances): 2.800
  MLT (words): 8.467
  SD: 3.217

Differences from CLAN

Standard deviation

Uses population SD (dividing by n), matching CLAN. This was verified during parity testing.

SD basis

The SD is computed over per-utterance word counts, not per-turn totals. This matches CLAN’s behavior, which was confirmed through golden test comparison.

Turn detection

Operates on parsed speaker codes from the AST rather than raw text line prefixes. Functionally identical but type-safe.

Output formats

Supports text, JSON, and CSV. CLAN produces text only.

Golden test parity

100% parity with CLAN C binary output.