ComfyUI Node Runs on cloud

Text Cleanup

Tidy a caption or prompt: change its letter case, collapse stray spaces and line breaks, fix the spacing around punctuation, settle how it ends and straighten curly quotes. Bracketed tokens such as [trigger] keep their case, and with every setting off the text passes through untouched.

By WASasquatch·Created 4 years ago·Updated 3 days ago· 1,900
Text Cleanup
    • text
    • changed
    ◄text►
    ◄casekeep►
    ◄whitespacetrue►
    ◄line_breakskeep►
    ◄punctuationtrue►
    ◄endingkeep►
    ◄quotesfalse►
    CategoryWAS Suite/Text/Operations

    Inputs (7)

    NameTypeDefaultDescription
    textSTRINGThe caption or prompt to tidy, as `a woman ,stands on a beach,,`. Wired from a STRING list, the node runs once per text.
    caseCOMBOkeepkeep = as written; lower; upper; sentence = a capital starts each sentence; title = a capital starts each word. Bracketed tokens such as `[trigger]` keep their case, and sentence and title leave words like NASA or iPhone alone.
    whitespaceBOOLEANtruetrue = runs of spaces and tabs become one space and every line is trimmed, as `a woman ` to `a woman`; false = spacing as written.
    line_breaksCOMBOkeep`keep` = lines as written; `one line` = every line joined with a space and blank lines dropped, for a caption file or an encoder that wants a single line.
    punctuationBOOLEANtruetrue = no space before , . ; : ! ?, one space after , ; : before a word, doubled commas and `. .` collapsed, and separators at either end of a line removed; false = punctuation as written.
    endingCOMBOkeep`keep` = as written; `period` = ends with a full stop unless it already ends in . ! or ?; `none` = closing full stops, commas and semicolons removed.
    quotesBOOLEANfalsetrue = curly quotes and apostrophes become straight ones, as “it’s” to "it's"; false = kept as written.

    Outputs (2)

    NameTypeDescription
    textSTRINGThe tidied text.
    changedBOOLEANtrue when a setting changed the text; false when it came through exactly as it went in.