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

WDLEN – Word Length Distribution

Status: Current Last updated: 2026-05-26 08:21 EDT

Purpose

Computes six distribution tables matching CLAN’s output format. WDLEN provides detailed histograms of word and utterance lengths, useful for studying vocabulary complexity and utterance structure development.

See the CLAN manual for the original WDLEN command specification.

Usage

chatter-clan wdlen file.cha
chatter-clan wdlen --speaker CHI file.cha
chatter-clan wdlen --format json file.cha

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 +-flag coverage audit

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

  • OSX-CLAN/src/clan/wdlen.cpp: usage() and getflag().
  • OSX-CLAN/src/clan/cutt.cpp: mainusage() WDLEN branches.
  • crates/talkbank-clan/src/clan_args.rs: chatter’s rewriter.
  • crates/talkbank-cli/src/cli/args/clan_commands.rs::Wdlen plus clan_common.rs::CommonAnalysisArgs.

(Status legend: same as FREQ.)

WDLEN-specific +-flags (from wdlen.cpp::getflag)

CLAN flagMeaningChatterStatusNotes
+aCompute both words and morphemes from %mor only (no main tier),MissingCLAN’s “depend-only” mode. chatter’s sections 5/6 already use %mor per the six-section design, so the divergence is whether sections 1-4 use main tier or skip.
+bSAdd chars in S to morpheme-delimiter list,MissingMorpheme-boundary customization.
-bSRemove chars in S from delimiter list (-b clears all),Missing
+cSClause-marker delimiter S,Missing
+c@FClause markers from file F,Missing

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

CLAN flagMeaningChatterStatusNotes
+t*X / -t*XInclude/exclude speaker--speaker / --exclude-speakerDone+tX accepted post-2026-05-21.
+t%X / -t%XInclude/exclude dependent tier--tier / --exclude-tier (rewriter target)Rewriter only
+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-wordDoneWDLEN docs say +sm is the recommended search-spec form for %mor-tier searches; chatter does not yet special-case the m suffix.
+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.
+gXGem filter--gemDone
+zN-MUtterance range--rangeDone
+rNRetrace / clitic / prosodic controls--include-retracings (+r6)Partial
+uCombine across files(default)DoneInverse default vs CLAN.
+reRecurse(default)Done
+pSWord delimiter,Missing
+kCase-sensitive--case-sensitive (via CommonAnalysisArgs)Done (no-op per CLAN)WDLEN 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::Wdlen.
+wN / -wNContext window (KWAL/COMBO keyword-context)–Rewriter onlyInapplicable to WDLEN (word-length distributions, no per-match context to surround). The rewriter maps +wN/-wN to --context-after/--context-before, but WDLEN 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.

Audit summary

BucketCount
Done (byte-parity or in scope)10
Partial2
Rewriter only3
Missing6

WDLEN’s specific gaps (+a depend-only mode, +bS/-bS morpheme-delimiter customization, +cS clause delimiters) all affect what counts as a unit in the six distribution sections, i.e., they change the numbers in the histograms. Filed as Phase 1.7 follow-ups.

Six Distribution Sections

SectionWhat it measuresSource
1. Word lengths in charactersCharacter count per wordMain tier
2. Utterance lengths in wordsWord count per utteranceMain tier
3. Turn lengths in utterancesUtterances per turnMain tier
4. Turn lengths in wordsWords per turnMain tier
5. Word lengths in morphemesMorphemes per word (stem + Brown’s suffixes)%mor tier
6. Utterance lengths in morphemesMorphemes per utterance (POS + stem + Brown’s suffixes)%mor tier

Each section shows a histogram (value -> count), mean, and total.

Differences from CLAN

Brown’s morpheme rules

Sections 5 and 6 use distinct counting methods:

  • Section 5: stem + Brown’s suffix count (no POS tag counted). Clitic pairs (~) are merged as one word.
  • Section 6: POS tag + stem + Brown’s suffix count. POS is counted only for the main word (not clitics).

Brown’s suffix strings: PL, PAST, Past, POSS, PASTP, Pastp, PRESP (same 7 as MLU).

Character counting

CLAN strips apostrophes before counting character length. Our implementation matches this behavior.

Speaker ordering

CLAN outputs speakers in reverse encounter order (an artifact of its C linked-list prepend pattern). Our implementation replicates this ordering for parity.

CLAN appends </Table></Worksheet></Workbook> XML tags at the end of output. Our implementation matches this for parity.

Output formats

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

Golden test parity

100% parity with CLAN C binary output.