💬 AIIA Text Splitter
Feed it a wall of narration, get back sentences a TTS can chew on
- dialogue_json
- sentence_count
The AIIA podcast pipeline was built around scripts: Speaker: line pairs that a parser turns into structured data, one chunk per line. That's great for two-voice dialogues. It's useless for a single-narrator voiceover, where your "script" is just a wall of prose. This node is the adapter: it takes plain long-form text and splits it into the same dialogue_json structure the script parser produces, so a narrator can flow through the pack's Emotion Annotator → TTS chain exactly like a scripted character.
The use case that makes it shine: audiobooks, YouTube voiceovers, long single-voice narration where you want per-sentence emotion tagging later. You don't hand-write Narrator: ... for every line - you paste the whole chapter and let this node do the bookkeeping.
How it works
It's a sentence splitter with judgment. In the default auto mode it does four things in order: keeps paragraph breaks as structure; splits within each paragraph on sentence-ending punctuation (。!?!?…, including ellipsis); merges any sentence shorter than min_chars into the previous one (so fragments don't become two-second audio blips); and if a sentence runs past max_chars, it re-cuts it at a comma or semicolon. The result is a list of chunks that a TTS can actually speak naturally, each stamped with your speaker_name.
The other two modes are simpler: by_sentence only splits on terminal punctuation (no merging, no re-splitting), and by_line splits on newlines only - useful when your text is already one-sentence-per-line.
The inputs that matter
- text - the long-form text. Multiline; paste it all.
- speaker_name - default
Narrator. This is what gets written into every segment'sspeakerfield, so pick something your downstream nodes expect. - split_mode -
autois the right default for most prose. Reach forby_linewhen your input is already chunked. - min_chars (default 4) / max_chars (default 100) - the two tuning knobs. If a short line keeps vanishing into the previous one, raise
min_chars... no, lower it. If long sentences keep getting chopped mid-thought, raisemax_chars.
Outputs: dialogue_json (the STRING you wire into Emotion Annotator or a TTS node) and sentence_count (an INT, handy for sanity-checking the split or driving a loop).
Install
Standard pack install - this one has no extra dependencies at all:
cd ComfyUI/custom_nodes
git clone https://github.com/havvk/ComfyUI_AIIA.git
or ComfyUI Manager → search "ComfyUI_AIIA", then restart.
Common issues
- A sentence got cut in the wrong place. That's
max_charsdoing its job too eagerly - nudge it up, or switch toby_sentenceand split the long line yourself. - Fragments all over the dialogue JSON. The
min_charsmerge threshold is too low; the node is faithfully keeping every two-word fragment as its own line. Raise it. - The Chinese/English mix.
autohandles both, but the character-count thresholds behave differently across scripts - a 100-char Chinese sentence is a lot more speech than 100 English characters. Expect to tune.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | 待拆分的文本。支持多段落、多行。 | |
| speaker_name | STRING | Narrator | 说话人名称,写入 dialogue_json 的 speaker 字段 |
| split_mode | COMBO | auto | 拆分模式: auto: 按句末标点拆分 + 短句合并 + 长句再拆 by_sentence: 仅按句号/问号/感叹号拆分 by_line: 按换行拆分 |
| min_charsopt | INT | 41–50 | 最小字符数。短于此的句子合并到前一句。 |
| max_charsopt | INT | 10020–500 | 最大字符数。超长句子在逗号/分号处强制拆分。 |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| dialogue_json | STRING | — |
| sentence_count | INT | — |