Nodes/Comfyroll Studio/πŸ”€ Text Blacklist
ComfyUI Node Runs on cloud

πŸ”€ Text Blacklist

Strip banned words out of a prompt automatically

By Suzie1Β·Created 3 years agoΒ·Updated 2 years agoΒ· 1,287
πŸ”€ Text Blacklist
    • STRING
    • show_help
    β—„textβ–Ί
    β—„blacklist_wordsβ–Ί
    β—„replacement_textβ–Ί

    The moment your prompt stops being something you type by hand - a wildcard file, an LLM-generated caption, a CSV of scraped tags - you lose control over exactly which words reach the sampler. CR Text Blacklist is the little filter you put in that gap: it scans a string, finds words you've banned, and yanks them out (or swaps in a replacement) before the text ever hits your CLIP encoder.

    It's not glamorous, but if you're running a batch that pulls prompts from anywhere you don't fully trust, this is how you keep a term you never want to render from sneaking through. Think of it as a find-and-delete pass wired into the graph.

    How it works

    You give it the prompt and a list of blacklisted words. It walks the text, matches your banned terms, and removes them - or, if you fill in the replacement field, substitutes that string in their place. The cleaned text comes out the other end as a normal STRING you feed straight into a CLIP Text Encode. No model, instant, deterministic.

    The inputs that matter

    • text (multiline STRING) - the prompt to clean. Wire your wildcard/LLM/loader output in here, or type it.
    • blacklist_words (multiline STRING) - the words to strip. Put them one per line. This is the field you actually maintain.
    • replacement_text (optional STRING) - leave it empty to simply delete matches; fill it to replace each banned word with something neutral instead.

    Outputs are a STRING (the filtered prompt) plus the usual show_help link you can ignore. The STRING goes into your text encode node like any other prompt.

    Installing it

    CR Text Blacklist ships in Comfyroll Studio (Suzie1 / RockOfFire), a large, long-established utility pack. Easiest path is ComfyUI Manager: search "Comfyroll Studio," install, restart. Or clone it:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes.git
    

    and restart. No models, no special dependencies - it's pure Python string handling, so it installs clean and won't drag in conflicting packages.

    Common issues

    The behavior people trip on: matching is by word, so partial or compound cases can surprise you - if a banned word is glued to punctuation or is a substring of a longer token, double-check it actually got removed by wiring the output into a text-display node and reading it. Deletion can also leave a double space or a stray comma where the word used to be; if you're picky about prompt cleanliness, follow it with a text-replace pass, or use the replacement field to drop in an empty-ish token.

    And to be clear about scope: this filters text, it doesn't police concepts. Blacklisting the word "red" won't stop a red object if the rest of the prompt implies one. It removes the literal string, nothing more.

    If the whole pack refuses to load at startup ("Comfyroll Studio: Failed to load Utility nodes" with a NameError in the traceback), that's a corrupted or half-finished install, not this node - reinstall cleanly through Manager, update ComfyUI, and restart fully.

    Category🧩 Comfyroll Studio/πŸ› οΈ Utils/πŸ”€ Text

    Inputs (3)

    NameTypeDefaultDescription
    textSTRINGβ€”
    blacklist_wordsSTRINGβ€”
    replacement_textoptSTRINGβ€”

    Outputs (2)

    NameTypeDescription
    STRING*β€”
    show_helpSTRINGβ€”