RTF2CHAT – Rich Text Format to CHAT Conversion
Status: Current Last updated: 2026-05-22 13:40 EDT
Purpose
Converts Rich Text Format (RTF) files into CHAT format by stripping RTF formatting commands and extracting plain text content.
Usage
chatter-clan rtf2chat input.rtf
Options
| Option | Default | Description |
|---|---|---|
-l, --language | "eng" | ISO 639 language code for the @Languages header |
-o, --output | stdout | Output CHAT file path |
The corpus name in @ID headers is hardcoded to "rtf_corpus"
(crates/talkbank-clan/src/converters/rtf2chat.rs:212); there is
no CLI flag to override it. Same pattern as the other converters
in this directory.
Processing Steps
- RTF stripping: Removes control words, groups, font/color/stylesheet tables, and converts Unicode escapes (
\uN?) to characters. Handles\par(newline) and\tab(tab). - Turn extraction: Looks for CHAT-style speaker prefixes (
*CHI:,*MOT:) in the plain text. If none are found, all text is assigned to a defaultSPKspeaker. - CHAT construction: Builds a proper
ChatFilewith headers, participants, and utterances.
Input Format
RTF (.rtf) files, optionally containing CHAT-style speaker prefixes embedded in the rich text. Standard RTF control sequences are supported including font tables, color tables, stylesheets, Unicode escapes, and nested groups.
Output
A well-formed CHAT file. If the RTF contains CHAT-style speaker codes (*CHI:, *MOT:, etc.), those are preserved as proper CHAT speaker codes. Otherwise, all text is assigned to a default SPK speaker.
Differences from CLAN
- Uses typed AST for CHAT generation
- Produces valid, well-formed CHAT output
CLAN +-flag coverage audit
RTF2CHAT is a converter: input RTF, output CHAT. Sources:
OSX-CLAN/src/clan/rtf2chat.cpp::usage,
crates/talkbank-clan/src/converters/rtf2chat.rs.
RTF2CHAT-specific +-flags (from rtf2chat.cpp::usage)
| CLAN flag | Meaning | Chatter | Status |
|---|---|---|---|
+a | Pretty-print RTF structure (diagnostic) | , | Missing |
+b | Post-process legal CHAT output | , | Missing |
+re | Recurse subdirectories | (default for directory input) | Done |
+oS | Code page | , | Missing |
Audit summary: 2 Done (default conversion + +re), 3 Missing.
The +a diagnostic and +b post-process variants are
power-user features; chatter handles the default conversion.