Nodes/ComfyUI_SamplingUtils/IdeographicSentencePad
ComfyUI Node

IdeographicSentencePad

Padding that respects sentence boundaries

By silveroxides·Created 11 months ago·Updated 3 months ago· 20
IdeographicSentencePad
    • padded_text
    text

    Ideographic Sentence Pad is the most surgical of silveroxides' text-padding family. Where Joiner Padding breaks up every pair of letters and Ideographic Line Pad wraps every line, this node works at sentence level: it finds sentence boundaries and wraps each sentence in the invisible ideographic pad (U+2060 U+3000 U+2060) plus carriage-return/line-feed breaks, leaving ordinary spacing inside the sentence untouched.

    How it works

    The source runs one regex that matches a sentence pattern - roughly, a punctuation or period boundary followed by a run of word characters ending in a period. For every match it wraps the sentence with the ideographic pad and CRLF. Net effect: the text keeps its natural internal spacing, but the boundaries between sentences are padded with invisible and CJK-style spacing characters, so the whole paragraph no longer contains any contiguous string a naive filter would match.

    Input is one multiline text; output is padded_text. No other knobs.

    Why the sentence level matters

    This is the variant you reach for when the text is prose, not tags. If you're passing a paragraph-long prompt (or a system-message-style block) into a pipeline with a string filter, sentence-boundary padding is more robust than letter-level padding in one specific way: it doesn't mangle the internal spacing, so whatever reads the text downstream still tokenizes it the way the author wrote it. The trade-off is that it's less thorough - a filter matching a whole sentence's content substring can still find words inside a sentence, because they're still contiguous.

    The usual caveats apply

    • Zero-width joiners get stripped by some normalization/copy-paste paths.
    • This defeats cheap string matching, not anything that decodes unicode first.
    • The regex is tuned for sentence-ish English; unusual punctuation or non-Latin text may not match the pattern, leaving those parts unpadded. Test before you trust it on a weird prompt.

    Install

    ComfyUI Manager → search ComfyUI_SamplingUtils, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/silveroxides/ComfyUI_SamplingUtils
    

    then restart ComfyUI. And the standing pack warning: the README declares the pack DEPRECATED in favor of ComfyUI-UtilsCollection - still works today, but the text nodes are likely to move.

    Categoryadvanced/text

    Inputs (1)

    NameTypeDefaultDescription
    textSTRING

    Outputs (1)

    NameTypeDescription
    padded_textSTRING